MCPcopy
hub / github.com/BloombergGraphics/whatiscode / parseContinueStatement

Function parseContinueStatement

scripts/libs/esprima.js:3538–3578  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

3536 // 12.7 The continue statement
3537
3538 function parseContinueStatement(node) {
3539 var label = null, key;
3540
3541 expectKeyword('continue');
3542
3543 // Optimize the most common form: 'continue;'.
3544 if (source.charCodeAt(startIndex) === 0x3B) {
3545 lex();
3546
3547 if (!state.inIteration) {
3548 throwError(Messages.IllegalContinue);
3549 }
3550
3551 return node.finishContinueStatement(null);
3552 }
3553
3554 if (hasLineTerminator) {
3555 if (!state.inIteration) {
3556 throwError(Messages.IllegalContinue);
3557 }
3558
3559 return node.finishContinueStatement(null);
3560 }
3561
3562 if (lookahead.type === Token.Identifier) {
3563 label = parseVariableIdentifier();
3564
3565 key = '$' + label.name;
3566 if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
3567 throwError(Messages.UnknownLabel, label.name);
3568 }
3569 }
3570
3571 consumeSemicolon();
3572
3573 if (label === null && !state.inIteration) {
3574 throwError(Messages.IllegalContinue);
3575 }
3576
3577 return node.finishContinueStatement(label);
3578 }
3579
3580 // 12.8 The break statement
3581

Callers 1

parseStatementFunction · 0.85

Calls 5

expectKeywordFunction · 0.85
lexFunction · 0.85
throwErrorFunction · 0.85
parseVariableIdentifierFunction · 0.85
consumeSemicolonFunction · 0.85

Tested by

no test coverage detected