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

Function isModuleSpecifierLike

internal/ls/utilities.go:47–59  ·  view source on GitHub ↗
(node *ast.Node)

Source from the content-addressed store, hash-verified

45}
46
47func isModuleSpecifierLike(node *ast.Node) bool {
48 if !ast.IsStringLiteralLike(node) {
49 return false
50 }
51
52 if ast.IsRequireCall(node.Parent, false /*requireStringLiteralLikeArgument*/) || ast.IsImportCall(node.Parent) {
53 return node.Parent.Arguments()[0] == node
54 }
55
56 return node.Parent.Kind == ast.KindExternalModuleReference ||
57 node.Parent.Kind == ast.KindImportDeclaration ||
58 node.Parent.Kind == ast.KindJSImportDeclaration
59}
60
61func getNonModuleSymbolOfMergedModuleSymbol(symbol *ast.Symbol) *ast.Symbol {
62 if len(symbol.Declarations) == 0 || (symbol.Flags&(ast.SymbolFlagsModule|ast.SymbolFlagsTransient)) == 0 {

Callers 2

getReferenceAtPositionFunction · 0.85

Calls 4

IsStringLiteralLikeFunction · 0.92
IsRequireCallFunction · 0.92
IsImportCallFunction · 0.92
ArgumentsMethod · 0.80

Tested by

no test coverage detected