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

Function findBreakTarget

test/fixtures/snapshot/typescript.js:103714–103737  ·  view source on GitHub ↗

* Finds the label that is the target for a `break` statement. * * @param labelText An optional name of a containing labeled statement.

(labelText)

Source from the content-addressed store, hash-verified

103712 * @param labelText An optional name of a containing labeled statement.
103713 */
103714 function findBreakTarget(labelText) {
103715 if (blockStack) {
103716 if (labelText) {
103717 for (var i = blockStack.length - 1; i >= 0; i--) {
103718 var block = blockStack[i];
103719 if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) {
103720 return block.breakLabel;
103721 }
103722 else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) {
103723 return block.breakLabel;
103724 }
103725 }
103726 }
103727 else {
103728 for (var i = blockStack.length - 1; i >= 0; i--) {
103729 var block = blockStack[i];
103730 if (supportsUnlabeledBreak(block)) {
103731 return block.breakLabel;
103732 }
103733 }
103734 }
103735 }
103736 return 0;
103737 }
103738 /**
103739 * Finds the label that is the target for a `continue` statement.
103740 *

Callers 2

visitBreakStatementFunction · 0.85

Tested by

no test coverage detected