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

Function getIsDeferredContext

internal/binder/nameresolver.go:459–475  ·  view source on GitHub ↗
(location *ast.Node, lastLocation *ast.Node)

Source from the content-addressed store, hash-verified

457}
458
459func getIsDeferredContext(location *ast.Node, lastLocation *ast.Node) bool {
460 if location.Kind != ast.KindArrowFunction && location.Kind != ast.KindFunctionExpression {
461 // initializers in instance property declaration of class like entities are executed in constructor and thus deferred
462 // A name is evaluated within the enclosing scope - so it shouldn't count as deferred
463 return ast.IsTypeQueryNode(location) ||
464 (ast.IsFunctionLikeDeclaration(location) || location.Kind == ast.KindPropertyDeclaration && !ast.IsStatic(location)) &&
465 (lastLocation == nil || lastLocation != location.Name())
466 }
467 if lastLocation != nil && lastLocation == location.Name() {
468 return false
469 }
470 // generator functions and async functions are not inlined in control flow when immediately invoked
471 if location.BodyData().AsteriskToken != nil || ast.HasSyntacticModifier(location, ast.ModifierFlagsAsync) {
472 return true
473 }
474 return ast.GetImmediatelyInvokedFunctionExpression(location) == nil
475}
476
477func isTypeParameterSymbolDeclaredInContainer(symbol *ast.Symbol, container *ast.Node) bool {
478 for _, decl := range symbol.Declarations {

Callers 1

ResolveMethod · 0.85

Calls 7

IsTypeQueryNodeFunction · 0.92
IsStaticFunction · 0.92
HasSyntacticModifierFunction · 0.92
NameMethod · 0.65
BodyDataMethod · 0.65

Tested by

no test coverage detected