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

Method bindParameter

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

Source from the content-addressed store, hash-verified

1193}
1194
1195func (b *Binder) bindParameter(node *ast.Node) {
1196 decl := node.AsParameterDeclaration()
1197 if node.Flags&ast.NodeFlagsAmbient == 0 {
1198 // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
1199 // strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
1200 b.checkStrictModeEvalOrArguments(node, decl.Name())
1201 }
1202 if ast.IsBindingPattern(decl.Name()) {
1203 index := slices.Index(node.Parent.Parameters(), node)
1204 b.bindAnonymousDeclaration(node, ast.SymbolFlagsFunctionScopedVariable, "__"+strconv.Itoa(index))
1205 } else {
1206 b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsFunctionScopedVariable, ast.SymbolFlagsParameterExcludes)
1207 }
1208 // If this is a property-parameter, then also declare the property symbol into the
1209 // containing class.
1210 if ast.IsParameterPropertyDeclaration(node, node.Parent) {
1211 classDeclaration := node.Parent.Parent
1212 flags := ast.SymbolFlagsProperty | core.IfElse(decl.QuestionToken != nil, ast.SymbolFlagsOptional, ast.SymbolFlagsNone)
1213 b.declareSymbol(ast.GetMembers(classDeclaration.Symbol()), classDeclaration.Symbol(), node, flags, ast.SymbolFlagsPropertyExcludes)
1214 }
1215}
1216
1217func (b *Binder) bindFunctionDeclaration(node *ast.Node) {
1218 if !b.file.IsDeclarationFile && node.Flags&ast.NodeFlagsAmbient == 0 && ast.IsAsyncFunction(node) {

Callers 1

bindMethod · 0.95

Calls 12

declareSymbolMethod · 0.95
IsBindingPatternFunction · 0.92
IfElseFunction · 0.92
GetMembersFunction · 0.92
NameMethod · 0.65
SymbolMethod · 0.65
ParametersMethod · 0.45

Tested by

no test coverage detected