* Writes an operation as a statement to the current label's statement list. * * @param operation The OpCode of the operation
(operationIndex)
| 104175 | * @param operation The OpCode of the operation |
| 104176 | */ |
| 104177 | function writeOperation(operationIndex) { |
| 104178 | tryEnterLabel(operationIndex); |
| 104179 | tryEnterOrLeaveBlock(operationIndex); |
| 104180 | // early termination, nothing else to process in this label |
| 104181 | if (lastOperationWasAbrupt) { |
| 104182 | return; |
| 104183 | } |
| 104184 | lastOperationWasAbrupt = false; |
| 104185 | lastOperationWasCompletion = false; |
| 104186 | var opcode = operations[operationIndex]; |
| 104187 | if (opcode === 0 /* OpCode.Nop */) { |
| 104188 | return; |
| 104189 | } |
| 104190 | else if (opcode === 10 /* OpCode.Endfinally */) { |
| 104191 | return writeEndfinally(); |
| 104192 | } |
| 104193 | var args = operationArguments[operationIndex]; |
| 104194 | if (opcode === 1 /* OpCode.Statement */) { |
| 104195 | return writeStatement(args[0]); |
| 104196 | } |
| 104197 | var location = operationLocations[operationIndex]; |
| 104198 | switch (opcode) { |
| 104199 | case 2 /* OpCode.Assign */: |
| 104200 | return writeAssign(args[0], args[1], location); |
| 104201 | case 3 /* OpCode.Break */: |
| 104202 | return writeBreak(args[0], location); |
| 104203 | case 4 /* OpCode.BreakWhenTrue */: |
| 104204 | return writeBreakWhenTrue(args[0], args[1], location); |
| 104205 | case 5 /* OpCode.BreakWhenFalse */: |
| 104206 | return writeBreakWhenFalse(args[0], args[1], location); |
| 104207 | case 6 /* OpCode.Yield */: |
| 104208 | return writeYield(args[0], location); |
| 104209 | case 7 /* OpCode.YieldStar */: |
| 104210 | return writeYieldStar(args[0], location); |
| 104211 | case 8 /* OpCode.Return */: |
| 104212 | return writeReturn(args[0], location); |
| 104213 | case 9 /* OpCode.Throw */: |
| 104214 | return writeThrow(args[0], location); |
| 104215 | } |
| 104216 | } |
| 104217 | /** |
| 104218 | * Writes a statement to the current label's statement list. |
| 104219 | * |
no test coverage detected