Skip to content

Commit 5595106

Browse files
authored
Remove JSDoc handling from the binder (#1827)
1 parent ed2d8c9 commit 5595106

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)
@@ -1121,10 +1119,6 @@ func (b *Binder) bindVariableDeclarationOrBindingElement(node *ast.Node) {
11211119
}
11221120

11231121
func (b *Binder) bindParameter(node *ast.Node) {
1124-
// !!!
1125-
// if node.kind == KindJSDocParameterTag && b.container.kind != KindJSDocSignature {
1126-
// return
1127-
// }
11281122
decl := node.AsParameterDeclaration()
11291123
if b.inStrictMode && node.Flags&ast.NodeFlagsAmbient == 0 {
11301124
// It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
@@ -1190,17 +1184,6 @@ func (b *Binder) bindBlockScopedDeclaration(node *ast.Node, symbolFlags ast.Symb
11901184
}
11911185

11921186
func (b *Binder) bindTypeParameter(node *ast.Node) {
1193-
// !!!
1194-
// if isJSDocTemplateTag(node.parent) {
1195-
// var container *HasLocals = getEffectiveContainerForJSDocTemplateTag(node.parent)
1196-
// if container {
1197-
// Debug.assertNode(container, canHaveLocals)
1198-
// /* TODO(TS-TO-GO) QuestionQuestionEqualsToken BinaryExpression: container.locals ??= createSymbolTable() */ TODO
1199-
// b.declareSymbol(container.locals /*parent*/, nil, node, SymbolFlagsTypeParameter, SymbolFlagsTypeParameterExcludes)
1200-
// } else {
1201-
// b.declareSymbolAndAddToSymbolTable(node, SymbolFlagsTypeParameter, SymbolFlagsTypeParameterExcludes)
1202-
// }
1203-
// }
12041187
if node.Parent.Kind == ast.KindInferType {
12051188
container := b.getInferTypeContainer(node.Parent)
12061189
if container != nil {
@@ -1633,10 +1616,6 @@ func (b *Binder) bindChildren(node *ast.Node) {
16331616
b.bindCallExpressionFlow(node)
16341617
case ast.KindNonNullExpression:
16351618
b.bindNonNullExpressionFlow(node)
1636-
// case *JSDocTypedefTag, *JSDocCallbackTag, *JSDocEnumTag:
1637-
// b.bindJSDocTypeAlias(node)
1638-
// case *JSDocImportTag:
1639-
// b.bindJSDocImportTag(node)
16401619
case ast.KindSourceFile:
16411620
sourceFile := node.AsSourceFile()
16421621
b.bindEachStatementFunctionsFirst(sourceFile.Statements)
@@ -2565,7 +2544,7 @@ func SetValueDeclaration(symbol *ast.Symbol, node *ast.Node) {
25652544
func GetContainerFlags(node *ast.Node) ContainerFlags {
25662545
switch node.Kind {
25672546
case ast.KindClassExpression, ast.KindClassDeclaration, ast.KindEnumDeclaration, ast.KindObjectLiteralExpression, ast.KindTypeLiteral,
2568-
ast.KindJSDocTypeLiteral, ast.KindJsxAttributes:
2547+
ast.KindJsxAttributes:
25692548
return ContainerFlagsIsContainer
25702549
case ast.KindInterfaceDeclaration:
25712550
return ContainerFlagsIsContainer | ContainerFlagsIsInterface
@@ -2580,7 +2559,7 @@ func GetContainerFlags(node *ast.Node) ContainerFlags {
25802559
fallthrough
25812560
case ast.KindConstructor, ast.KindClassStaticBlockDeclaration:
25822561
return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer
2583-
case ast.KindMethodSignature, ast.KindCallSignature, ast.KindJSDocSignature, ast.KindFunctionType, ast.KindConstructSignature, ast.KindConstructorType:
2562+
case ast.KindMethodSignature, ast.KindCallSignature, ast.KindFunctionType, ast.KindConstructSignature, ast.KindConstructorType:
25842563
return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike
25852564
case ast.KindFunctionDeclaration:
25862565
return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer
@@ -2617,9 +2596,6 @@ func isNarrowingExpression(expr *ast.Node) bool {
26172596
case ast.KindCallExpression:
26182597
return hasNarrowableArgument(expr)
26192598
case ast.KindParenthesizedExpression:
2620-
// if isJSDocTypeAssertion(expr) {
2621-
// return false
2622-
// }
26232599
return isNarrowingExpression(expr.AsParenthesizedExpression().Expression)
26242600
case ast.KindNonNullExpression:
26252601
return isNarrowingExpression(expr.AsNonNullExpression().Expression)

0 commit comments

Comments
 (0)