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

Method getEffectiveDeclarationFlags

internal/checker/checker.go:3687–3700  ·  view source on GitHub ↗
(n *ast.Node, flagsToCheck ast.ModifierFlags)

Source from the content-addressed store, hash-verified

3685}
3686
3687func (c *Checker) getEffectiveDeclarationFlags(n *ast.Node, flagsToCheck ast.ModifierFlags) ast.ModifierFlags {
3688 flags := c.getCombinedModifierFlagsCached(n)
3689 // children of classes (even ambient classes) should not be marked as ambient or export
3690 // because those flags have no useful semantics there.
3691 if !ast.IsInterfaceDeclaration(n.Parent) && !ast.IsClassDeclaration(n.Parent) && !ast.IsClassExpression(n.Parent) && n.Flags&ast.NodeFlagsAmbient != 0 {
3692 container := getEnclosingContainer(n)
3693 if container != nil && container.Flags&ast.NodeFlagsExportContext != 0 && flags&ast.ModifierFlagsAmbient == 0 && !(ast.IsModuleBlock(n.Parent) && ast.IsGlobalScopeAugmentation(n.Parent.Parent)) {
3694 // It is nested in an ambient export context, which means it is automatically exported
3695 flags |= ast.ModifierFlagsExport
3696 }
3697 flags |= ast.ModifierFlagsAmbient
3698 }
3699 return flags & flagsToCheck
3700}
3701
3702func (c *Checker) isImplementationCompatibleWithOverload(implementation *Signature, overload *Signature) bool {
3703 erasedSource := c.getErasedSignature(implementation)

Calls 7

IsInterfaceDeclarationFunction · 0.92
IsClassDeclarationFunction · 0.92
IsClassExpressionFunction · 0.92
IsModuleBlockFunction · 0.92
getEnclosingContainerFunction · 0.85

Tested by

no test coverage detected