MCPcopy Index your code
hub / github.com/nodejs/node / isStartOfExpression

Function isStartOfExpression

test/fixtures/snapshot/typescript.js:34323–34355  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34321 }
34322 }
34323 function isStartOfExpression() {
34324 if (isStartOfLeftHandSideExpression()) {
34325 return true;
34326 }
34327 switch (token()) {
34328 case 39 /* SyntaxKind.PlusToken */:
34329 case 40 /* SyntaxKind.MinusToken */:
34330 case 54 /* SyntaxKind.TildeToken */:
34331 case 53 /* SyntaxKind.ExclamationToken */:
34332 case 89 /* SyntaxKind.DeleteKeyword */:
34333 case 112 /* SyntaxKind.TypeOfKeyword */:
34334 case 114 /* SyntaxKind.VoidKeyword */:
34335 case 45 /* SyntaxKind.PlusPlusToken */:
34336 case 46 /* SyntaxKind.MinusMinusToken */:
34337 case 29 /* SyntaxKind.LessThanToken */:
34338 case 132 /* SyntaxKind.AwaitKeyword */:
34339 case 125 /* SyntaxKind.YieldKeyword */:
34340 case 80 /* SyntaxKind.PrivateIdentifier */:
34341 // Yield/await always starts an expression. Either it is an identifier (in which case
34342 // it is definitely an expression). Or it's a keyword (either because we're in
34343 // a generator or async function, or in strict mode (or both)) and it started a yield or await expression.
34344 return true;
34345 default:
34346 // Error tolerance. If we see the start of some binary operator, we consider
34347 // that the start of an expression. That way we'll parse out a missing identifier,
34348 // give a good message about an identifier being missing, and then consume the
34349 // rest of the binary expression.
34350 if (isBinaryOperator()) {
34351 return true;
34352 }
34353 return isIdentifier();
34354 }
34355 }
34356 function isStartOfExpressionStatement() {
34357 // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.
34358 return token() !== 18 /* SyntaxKind.OpenBraceToken */ &&

Callers 7

isListElementFunction · 0.85
parseTypeParameterFunction · 0.85
parseYieldExpressionFunction · 0.85
isStartOfStatementFunction · 0.85

Calls 4

isBinaryOperatorFunction · 0.85
tokenFunction · 0.70
isIdentifierFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…