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

Method isIdentifier

internal/parser/parser.go:6278–6290  ·  view source on GitHub ↗

Ignore strict mode flag because we will report an error in type checker instead.

()

Source from the content-addressed store, hash-verified

6276
6277// Ignore strict mode flag because we will report an error in type checker instead.
6278func (p *Parser) isIdentifier() bool {
6279 if p.token == ast.KindIdentifier {
6280 return true
6281 }
6282 // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is
6283 // considered a keyword and is not an identifier.
6284 // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is
6285 // considered a keyword and is not an identifier.
6286 if p.token == ast.KindYieldKeyword && p.inYieldContext() || p.token == ast.KindAwaitKeyword && p.inAwaitContext() {
6287 return false
6288 }
6289 return p.token > ast.KindLastReservedWord
6290}
6291
6292func (p *Parser) isBindingIdentifier() bool {
6293 // `let await`/`let yield` in [Yield] or [Await] are allowed here and disallowed in the binder.

Calls 2

inYieldContextMethod · 0.95
inAwaitContextMethod · 0.95

Tested by

no test coverage detected