MCPcopy
hub / github.com/jquery/esprima / parseDirective

Method parseDirective

src/parser.ts:2998–3007  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2996 // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive
2997
2998 parseDirective(): Node.Directive | Node.ExpressionStatement {
2999 const token = this.lookahead;
3000
3001 const node = this.createNode();
3002 const expr = this.parseExpression();
3003 const directive = (expr.type === Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null;
3004 this.consumeSemicolon();
3005
3006 return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr));
3007 }
3008
3009 parseDirectivePrologues(): Node.Statement[] {
3010 let firstRestricted: RawToken | null = null;

Callers 1

Calls 5

createNodeMethod · 0.95
parseExpressionMethod · 0.95
getTokenRawMethod · 0.95
consumeSemicolonMethod · 0.95
finalizeMethod · 0.95

Tested by

no test coverage detected