Skip to content

Commit 0005071

Browse files
committed
Merge branch 'main' of https://github.com/microsoft/typescript-go into fix/1374
2 parents f8ba3fe + 5595106 commit 0005071

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

internal/binder/binder.go

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,9 @@ func (b *Binder) declareSymbolAndAddToSymbolTable(node *ast.Node, symbolFlags as
443443
return b.declareClassMember(node, symbolFlags, symbolExcludes)
444444
case ast.KindEnumDeclaration:
445445
return b.declareSymbol(ast.GetExports(b.container.Symbol()), b.container.Symbol(), node, symbolFlags, symbolExcludes)
446-
case ast.KindTypeLiteral, ast.KindJSDocTypeLiteral, ast.KindObjectLiteralExpression, ast.KindInterfaceDeclaration, ast.KindJsxAttributes:
446+
case ast.KindTypeLiteral, ast.KindObjectLiteralExpression, ast.KindInterfaceDeclaration, ast.KindJsxAttributes:
447447
return b.declareSymbol(ast.GetMembers(b.container.Symbol()), b.container.Symbol(), node, symbolFlags, symbolExcludes)
448-
case ast.KindFunctionType, ast.KindConstructorType, ast.KindCallSignature, ast.KindConstructSignature, ast.KindJSDocSignature,
448+
case ast.KindFunctionType, ast.KindConstructorType, ast.KindCallSignature, ast.KindConstructSignature,
449449
ast.KindIndexSignature, ast.KindMethodDeclaration, ast.KindMethodSignature, ast.KindConstructor, ast.KindGetAccessor,
450450
ast.KindSetAccessor, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction,
451451
ast.KindClassStaticBlockDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindMappedType:
@@ -672,10 +672,8 @@ func (b *Binder) bind(node *ast.Node) bool {
672672
case ast.KindSetAccessor:
673673
b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsSetAccessor, ast.SymbolFlagsSetAccessorExcludes)
674674
case ast.KindFunctionType, ast.KindConstructorType:
675-
// !!! KindJSDocSignature
676675
b.bindFunctionOrConstructorType(node)
677676
case ast.KindTypeLiteral, ast.KindMappedType:
678-
// !!! KindJSDocTypeLiteral
679677
b.bindAnonymousDeclaration(node, ast.SymbolFlagsTypeLiteral, ast.InternalSymbolNameType)
680678
case ast.KindObjectLiteralExpression:
681679
b.bindAnonymousDeclaration(node, ast.SymbolFlagsObjectLiteral, ast.InternalSymbolNameObject)
@@ -1109,10 +1107,6 @@ func (b *Binder) bindVariableDeclarationOrBindingElement(node *ast.Node) {
11091107
}
11101108

11111109
func (b *Binder) bindParameter(node *ast.Node) {
1112-
// !!!
1113-
// if node.kind == KindJSDocParameterTag && b.container.kind != KindJSDocSignature {
1114-
// return
1115-
// }
11161110
decl := node.AsParameterDeclaration()
11171111
if b.inStrictMode && node.Flags&ast.NodeFlagsAmbient == 0 {
11181112
// It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
@@ -1178,17 +1172,6 @@ func (b *Binder) bindBlockScopedDeclaration(node *ast.Node, symbolFlags ast.Symb
11781172
}
11791173

11801174
func (b *Binder) bindTypeParameter(node *ast.Node) {
1181-
// !!!
1182-
// if isJSDocTemplateTag(node.parent) {
1183-
// var container *HasLocals = getEffectiveContainerForJSDocTemplateTag(node.parent)
1184-
// if container {
1185-
// Debug.assertNode(container, canHaveLocals)
1186-
// /* TODO(TS-TO-GO) QuestionQuestionEqualsToken BinaryExpression: container.locals ??= createSymbolTable() */ TODO
1187-
// b.declareSymbol(container.locals /*parent*/, nil, node, SymbolFlagsTypeParameter, SymbolFlagsTypeParameterExcludes)
1188-
// } else {
1189-
// b.declareSymbolAndAddToSymbolTable(node, SymbolFlagsTypeParameter, SymbolFlagsTypeParameterExcludes)
1190-
// }
1191-
// }
11921175
if node.Parent.Kind == ast.KindInferType {
11931176
container := b.getInferTypeContainer(node.Parent)
11941177
if container != nil {
@@ -1621,10 +1604,6 @@ func (b *Binder) bindChildren(node *ast.Node) {
16211604
b.bindCallExpressionFlow(node)
16221605
case ast.KindNonNullExpression:
16231606
b.bindNonNullExpressionFlow(node)
1624-
// case *JSDocTypedefTag, *JSDocCallbackTag, *JSDocEnumTag:
1625-
// b.bindJSDocTypeAlias(node)
1626-
// case *JSDocImportTag:
1627-
// b.bindJSDocImportTag(node)
16281607
case ast.KindSourceFile:
16291608
sourceFile := node.AsSourceFile()
16301609
b.bindEachStatementFunctionsFirst(sourceFile.Statements)
@@ -2553,7 +2532,7 @@ func SetValueDeclaration(symbol *ast.Symbol, node *ast.Node) {
25532532
func GetContainerFlags(node *ast.Node) ContainerFlags {
25542533
switch node.Kind {
25552534
case ast.KindClassExpression, ast.KindClassDeclaration, ast.KindEnumDeclaration, ast.KindObjectLiteralExpression, ast.KindTypeLiteral,
2556-
ast.KindJSDocTypeLiteral, ast.KindJsxAttributes:
2535+
ast.KindJsxAttributes:
25572536
return ContainerFlagsIsContainer
25582537
case ast.KindInterfaceDeclaration:
25592538
return ContainerFlagsIsContainer | ContainerFlagsIsInterface
@@ -2568,7 +2547,7 @@ func GetContainerFlags(node *ast.Node) ContainerFlags {
25682547
fallthrough
25692548
case ast.KindConstructor, ast.KindClassStaticBlockDeclaration:
25702549
return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer
2571-
case ast.KindMethodSignature, ast.KindCallSignature, ast.KindJSDocSignature, ast.KindFunctionType, ast.KindConstructSignature, ast.KindConstructorType:
2550+
case ast.KindMethodSignature, ast.KindCallSignature, ast.KindFunctionType, ast.KindConstructSignature, ast.KindConstructorType:
25722551
return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike
25732552
case ast.KindFunctionDeclaration:
25742553
return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer
@@ -2605,9 +2584,6 @@ func isNarrowingExpression(expr *ast.Node) bool {
26052584
case ast.KindCallExpression:
26062585
return hasNarrowableArgument(expr)
26072586
case ast.KindParenthesizedExpression:
2608-
// if isJSDocTypeAssertion(expr) {
2609-
// return false
2610-
// }
26112587
return isNarrowingExpression(expr.AsParenthesizedExpression().Expression)
26122588
case ast.KindNonNullExpression:
26132589
return isNarrowingExpression(expr.AsNonNullExpression().Expression)

0 commit comments

Comments
 (0)