MCPcopy Create free account
hub / github.com/nodejs/node / isFinalLabelReachable

Function isFinalLabelReachable

test/fixtures/snapshot/typescript.js:104023–104042  ·  view source on GitHub ↗

* Tests whether the final label of the generator function body * is reachable by user code.

(operationIndex)

Source from the content-addressed store, hash-verified

104021 * is reachable by user code.
104022 */
104023 function isFinalLabelReachable(operationIndex) {
104024 // if the last operation was *not* a completion (return/throw) then
104025 // the final label is reachable.
104026 if (!lastOperationWasCompletion) {
104027 return true;
104028 }
104029 // if there are no labels defined or referenced, then the final label is
104030 // not reachable.
104031 if (!labelOffsets || !labelExpressions) {
104032 return false;
104033 }
104034 // if the label for this offset is referenced, then the final label
104035 // is reachable.
104036 for (var label = 0; label < labelOffsets.length; label++) {
104037 if (labelOffsets[label] === operationIndex && labelExpressions[label]) {
104038 return true;
104039 }
104040 }
104041 return false;
104042 }
104043 /**
104044 * Appends a case clause for the last label and sets the new label.
104045 *

Callers 1

flushFinalLabelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected