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

Function parseArrowFunctionExpressionBody

test/fixtures/snapshot/typescript.js:34764–34796  ·  view source on GitHub ↗
(isAsync)

Source from the content-addressed store, hash-verified

34762 return withJSDoc(finishNode(node, pos), hasJSDoc);
34763 }
34764 function parseArrowFunctionExpressionBody(isAsync) {
34765 if (token() === 18 /* SyntaxKind.OpenBraceToken */) {
34766 return parseFunctionBlock(isAsync ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */);
34767 }
34768 if (token() !== 26 /* SyntaxKind.SemicolonToken */ &&
34769 token() !== 98 /* SyntaxKind.FunctionKeyword */ &&
34770 token() !== 84 /* SyntaxKind.ClassKeyword */ &&
34771 isStartOfStatement() &&
34772 !isStartOfExpressionStatement()) {
34773 // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
34774 //
34775 // Here we try to recover from a potential error situation in the case where the
34776 // user meant to supply a block. For example, if the user wrote:
34777 //
34778 // a =>
34779 // let v = 0;
34780 // }
34781 //
34782 // they may be missing an open brace. Check to see if that's the case so we can
34783 // try to recover better. If we don't do this, then the next close curly we see may end
34784 // up preemptively closing the containing construct.
34785 //
34786 // Note: even when 'IgnoreMissingOpenBrace' is passed, parseBody will still error.
34787 return parseFunctionBlock(16 /* SignatureFlags.IgnoreMissingOpenBrace */ | (isAsync ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */));
34788 }
34789 var savedTopLevel = topLevel;
34790 topLevel = false;
34791 var node = isAsync
34792 ? doInAwaitContext(parseAssignmentExpressionOrHigher)
34793 : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
34794 topLevel = savedTopLevel;
34795 return node;
34796 }
34797 function parseConditionalExpressionRest(leftOperand, pos) {
34798 // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
34799 var questionToken = parseOptionalToken(57 /* SyntaxKind.QuestionToken */);

Calls 6

parseFunctionBlockFunction · 0.85
isStartOfStatementFunction · 0.85
doInAwaitContextFunction · 0.85
doOutsideOfAwaitContextFunction · 0.85
tokenFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…