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

Method checkNonIdentifierName

internal/parser/reparser.go:41–50  ·  view source on GitHub ↗
(name *ast.Node)

Source from the content-addressed store, hash-verified

39}
40
41func (p *Parser) checkNonIdentifierName(name *ast.Node) *ast.Node {
42 if ast.IsIdentifier(name) && !scanner.IsValidIdentifier(name.AsIdentifier().Text) {
43 errLoc := name.Loc
44 if errLoc.Len() == 0 { // missing name, emit error on the character before the missing name node
45 errLoc = core.NewTextRange(name.Loc.Pos()-1, name.Loc.Pos())
46 }
47 p.parseErrorAtRange(errLoc, diagnostics.Identifier_expected)
48 }
49 return name
50}
51
52// Hosted tags find a host and add their children to the correct location under the host.
53// Unhosted tags add synthetic nodes to the reparse list.

Callers 3

reparseUnhostedMethod · 0.95
reparseJSDocSignatureMethod · 0.95
gatherTypeParametersMethod · 0.95

Calls 7

parseErrorAtRangeMethod · 0.95
IsIdentifierFunction · 0.92
IsValidIdentifierFunction · 0.92
NewTextRangeFunction · 0.92
AsIdentifierMethod · 0.80
LenMethod · 0.65
PosMethod · 0.65

Tested by

no test coverage detected