Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 4 additions & 28 deletions internal/binder/binder.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,9 @@ func (b *Binder) declareSymbolAndAddToSymbolTable(node *ast.Node, symbolFlags as
return b.declareClassMember(node, symbolFlags, symbolExcludes)
case ast.KindEnumDeclaration:
return b.declareSymbol(ast.GetExports(b.container.Symbol()), b.container.Symbol(), node, symbolFlags, symbolExcludes)
case ast.KindTypeLiteral, ast.KindJSDocTypeLiteral, ast.KindObjectLiteralExpression, ast.KindInterfaceDeclaration, ast.KindJsxAttributes:
case ast.KindTypeLiteral, ast.KindObjectLiteralExpression, ast.KindInterfaceDeclaration, ast.KindJsxAttributes:
return b.declareSymbol(ast.GetMembers(b.container.Symbol()), b.container.Symbol(), node, symbolFlags, symbolExcludes)
case ast.KindFunctionType, ast.KindConstructorType, ast.KindCallSignature, ast.KindConstructSignature, ast.KindJSDocSignature,
case ast.KindFunctionType, ast.KindConstructorType, ast.KindCallSignature, ast.KindConstructSignature,
ast.KindIndexSignature, ast.KindMethodDeclaration, ast.KindMethodSignature, ast.KindConstructor, ast.KindGetAccessor,
ast.KindSetAccessor, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction,
ast.KindClassStaticBlockDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindMappedType:
Expand Down Expand Up @@ -672,10 +672,8 @@ func (b *Binder) bind(node *ast.Node) bool {
case ast.KindSetAccessor:
b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsSetAccessor, ast.SymbolFlagsSetAccessorExcludes)
case ast.KindFunctionType, ast.KindConstructorType:
// !!! KindJSDocSignature
b.bindFunctionOrConstructorType(node)
case ast.KindTypeLiteral, ast.KindMappedType:
// !!! KindJSDocTypeLiteral
b.bindAnonymousDeclaration(node, ast.SymbolFlagsTypeLiteral, ast.InternalSymbolNameType)
case ast.KindObjectLiteralExpression:
b.bindAnonymousDeclaration(node, ast.SymbolFlagsObjectLiteral, ast.InternalSymbolNameObject)
Expand Down Expand Up @@ -1121,10 +1119,6 @@ func (b *Binder) bindVariableDeclarationOrBindingElement(node *ast.Node) {
}

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

func (b *Binder) bindTypeParameter(node *ast.Node) {
// !!!
// if isJSDocTemplateTag(node.parent) {
// var container *HasLocals = getEffectiveContainerForJSDocTemplateTag(node.parent)
// if container {
// Debug.assertNode(container, canHaveLocals)
// /* TODO(TS-TO-GO) QuestionQuestionEqualsToken BinaryExpression: container.locals ??= createSymbolTable() */ TODO
// b.declareSymbol(container.locals /*parent*/, nil, node, SymbolFlagsTypeParameter, SymbolFlagsTypeParameterExcludes)
// } else {
// b.declareSymbolAndAddToSymbolTable(node, SymbolFlagsTypeParameter, SymbolFlagsTypeParameterExcludes)
// }
// }
if node.Parent.Kind == ast.KindInferType {
container := b.getInferTypeContainer(node.Parent)
if container != nil {
Expand Down Expand Up @@ -1633,10 +1616,6 @@ func (b *Binder) bindChildren(node *ast.Node) {
b.bindCallExpressionFlow(node)
case ast.KindNonNullExpression:
b.bindNonNullExpressionFlow(node)
// case *JSDocTypedefTag, *JSDocCallbackTag, *JSDocEnumTag:
// b.bindJSDocTypeAlias(node)
// case *JSDocImportTag:
// b.bindJSDocImportTag(node)
case ast.KindSourceFile:
sourceFile := node.AsSourceFile()
b.bindEachStatementFunctionsFirst(sourceFile.Statements)
Expand Down Expand Up @@ -2565,7 +2544,7 @@ func SetValueDeclaration(symbol *ast.Symbol, node *ast.Node) {
func GetContainerFlags(node *ast.Node) ContainerFlags {
switch node.Kind {
case ast.KindClassExpression, ast.KindClassDeclaration, ast.KindEnumDeclaration, ast.KindObjectLiteralExpression, ast.KindTypeLiteral,
ast.KindJSDocTypeLiteral, ast.KindJsxAttributes:
ast.KindJsxAttributes:
return ContainerFlagsIsContainer
case ast.KindInterfaceDeclaration:
return ContainerFlagsIsContainer | ContainerFlagsIsInterface
Expand All @@ -2580,7 +2559,7 @@ func GetContainerFlags(node *ast.Node) ContainerFlags {
fallthrough
case ast.KindConstructor, ast.KindClassStaticBlockDeclaration:
return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer
case ast.KindMethodSignature, ast.KindCallSignature, ast.KindJSDocSignature, ast.KindFunctionType, ast.KindConstructSignature, ast.KindConstructorType:
case ast.KindMethodSignature, ast.KindCallSignature, ast.KindFunctionType, ast.KindConstructSignature, ast.KindConstructorType:
return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike
case ast.KindFunctionDeclaration:
return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer
Expand Down Expand Up @@ -2617,9 +2596,6 @@ func isNarrowingExpression(expr *ast.Node) bool {
case ast.KindCallExpression:
return hasNarrowableArgument(expr)
case ast.KindParenthesizedExpression:
// if isJSDocTypeAssertion(expr) {
// return false
// }
return isNarrowingExpression(expr.AsParenthesizedExpression().Expression)
case ast.KindNonNullExpression:
return isNarrowingExpression(expr.AsNonNullExpression().Expression)
Expand Down