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

Method bindDeferredExpandoAssignment

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

Source from the content-addressed store, hash-verified

1054}
1055
1056func (b *Binder) bindDeferredExpandoAssignment(node *ast.Node) {
1057 parent := getParentOfPropertyAssignment(node)
1058 symbol := b.lookupEntity(parent, b.blockScopeContainer)
1059 if symbol == nil {
1060 symbol = b.lookupEntity(parent, b.container)
1061 }
1062 if symbol = getInitializerSymbol(symbol); symbol != nil {
1063 if ast.HasDynamicName(node) {
1064 b.bindAnonymousDeclaration(node, ast.SymbolFlagsProperty|ast.SymbolFlagsAssignment, ast.InternalSymbolNameComputed)
1065 b.addLateBoundAssignmentDeclarationToSymbol(node, symbol)
1066 } else {
1067 // We declare expandos only when there are no non-expando declarations for that name.
1068 exports := ast.GetExports(symbol)
1069 if existing := exports[b.getDeclarationName(node)]; existing == nil || existing.Flags&ast.SymbolFlagsAssignment != 0 {
1070 b.declareSymbol(exports, symbol, node, ast.SymbolFlagsProperty|ast.SymbolFlagsAssignment, ast.SymbolFlagsPropertyExcludes)
1071 }
1072 }
1073 }
1074}
1075
1076func getParentOfPropertyAssignment(node *ast.Node) *ast.Node {
1077 switch node.Kind {

Callers 1

Calls 9

lookupEntityMethod · 0.95
getDeclarationNameMethod · 0.95
declareSymbolMethod · 0.95
HasDynamicNameFunction · 0.92
GetExportsFunction · 0.92
getInitializerSymbolFunction · 0.85

Tested by

no test coverage detected