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

Function simplifyModifiers

internal/checker/nodebuilder.go:212–222  ·  view source on GitHub ↗
(f *ast.NodeFactory, newDecl *ast.Node, isDeclKind func(*ast.Node) bool, symbol *ast.Symbol)

Source from the content-addressed store, hash-verified

210}
211
212func simplifyModifiers(f *ast.NodeFactory, newDecl *ast.Node, isDeclKind func(*ast.Node) bool, symbol *ast.Symbol) *ast.Node {
213 decls := core.Filter(symbol.Declarations, isDeclKind)
214 var declWithModifiers *ast.Node
215 if len(decls) > 0 {
216 declWithModifiers = decls[0]
217 } else {
218 declWithModifiers = newDecl
219 }
220 modifiers := declWithModifiers.ModifierFlags() & ^(ast.ModifierFlagsExport | ast.ModifierFlagsAmbient)
221 return ast.ReplaceModifiers(f, newDecl, f.NewModifierList(ast.CreateModifiersFromModifierFlags(modifiers, f.NewModifier)))
222}
223
224// SymbolToEntityName implements NodeBuilderInterface.
225func (b *NodeBuilder) SymbolToEntityName(symbol *ast.Symbol, meaning ast.SymbolFlags, enclosingDeclaration *ast.Node, flags nodebuilder.Flags, internalFlags nodebuilder.InternalFlags, tracker nodebuilder.SymbolTracker) *ast.Node {

Callers 1

ExpandSymbolForHoverMethod · 0.85

Calls 6

ModifierFlagsMethod · 0.95
FilterFunction · 0.92
ReplaceModifiersFunction · 0.92
lenFunction · 0.85
NewModifierListMethod · 0.80

Tested by

no test coverage detected