MCPcopy Create free account
hub / github.com/microsoft/typescript-go / bindThisPropertyAssignment

Method bindThisPropertyAssignment

internal/binder/binder.go:1121–1141  ·  view source on GitHub ↗
(node *ast.Node)

Source from the content-addressed store, hash-verified

1119}
1120
1121func (b *Binder) bindThisPropertyAssignment(node *ast.Node) {
1122 if !ast.IsInJSFile(node) {
1123 return
1124 }
1125 bin := node.AsBinaryExpression()
1126 if ast.IsPropertyAccessExpression(bin.Left) && ast.IsPrivateIdentifier(bin.Left.AsPropertyAccessExpression().Name()) ||
1127 b.thisContainer == nil {
1128 return
1129 }
1130 if classSymbol, symbolTable := b.getThisClassAndSymbolTable(); symbolTable != nil {
1131 if ast.HasDynamicName(node) {
1132 b.declareSymbolEx(symbolTable, classSymbol, node, ast.SymbolFlagsProperty, ast.SymbolFlagsNone, true /*isReplaceableByMethod*/, true /*isComputedName*/)
1133 b.addLateBoundAssignmentDeclarationToSymbol(node, classSymbol)
1134 } else {
1135 b.declareSymbolEx(symbolTable, classSymbol, node, ast.SymbolFlagsProperty|ast.SymbolFlagsAssignment, ast.SymbolFlagsNone, true /*isReplaceableByMethod*/, false /*isComputedName*/)
1136 }
1137 } else if b.thisContainer.Kind != ast.KindFunctionDeclaration && b.thisContainer.Kind != ast.KindFunctionExpression {
1138 // !!! constructor functions
1139 panic("Unhandled case in bindThisPropertyAssignment: " + b.thisContainer.Kind.String())
1140 }
1141}
1142
1143func (b *Binder) getThisClassAndSymbolTable() (classSymbol *ast.Symbol, symbolTable ast.SymbolTable) {
1144 if b.thisContainer == nil {

Callers 1

bindMethod · 0.95

Calls 12

declareSymbolExMethod · 0.95
IsInJSFileFunction · 0.92
IsPrivateIdentifierFunction · 0.92
HasDynamicNameFunction · 0.92
panicFunction · 0.85
AsBinaryExpressionMethod · 0.80
NameMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected