* Tests whether the final label of the generator function body * is reachable by user code.
(operationIndex)
| 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 | * |