(node)
| 102918 | } |
| 102919 | } |
| 102920 | function transformAndEmitForStatement(node) { |
| 102921 | if (containsYield(node)) { |
| 102922 | // [source] |
| 102923 | // for (var i = 0; i < 10; i++) { |
| 102924 | // /*body*/ |
| 102925 | // } |
| 102926 | // |
| 102927 | // [intermediate] |
| 102928 | // .local i |
| 102929 | // i = 0; |
| 102930 | // .loop incrementLabel, endLoopLabel |
| 102931 | // .mark conditionLabel |
| 102932 | // .brfalse endLoopLabel, (i < 10) |
| 102933 | // /*body*/ |
| 102934 | // .mark incrementLabel |
| 102935 | // i++; |
| 102936 | // .br conditionLabel |
| 102937 | // .endloop |
| 102938 | // .mark endLoopLabel |
| 102939 | var conditionLabel = defineLabel(); |
| 102940 | var incrementLabel = defineLabel(); |
| 102941 | var endLabel = beginLoopBlock(incrementLabel); |
| 102942 | if (node.initializer) { |
| 102943 | var initializer = node.initializer; |
| 102944 | if (ts.isVariableDeclarationList(initializer)) { |
| 102945 | transformAndEmitVariableDeclarationList(initializer); |
| 102946 | } |
| 102947 | else { |
| 102948 | emitStatement(ts.setTextRange(factory.createExpressionStatement(ts.visitNode(initializer, visitor, ts.isExpression)), initializer)); |
| 102949 | } |
| 102950 | } |
| 102951 | markLabel(conditionLabel); |
| 102952 | if (node.condition) { |
| 102953 | emitBreakWhenFalse(endLabel, ts.visitNode(node.condition, visitor, ts.isExpression)); |
| 102954 | } |
| 102955 | transformAndEmitEmbeddedStatement(node.statement); |
| 102956 | markLabel(incrementLabel); |
| 102957 | if (node.incrementor) { |
| 102958 | emitStatement(ts.setTextRange(factory.createExpressionStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression)), node.incrementor)); |
| 102959 | } |
| 102960 | emitBreak(conditionLabel); |
| 102961 | endLoopBlock(); |
| 102962 | } |
| 102963 | else { |
| 102964 | emitStatement(ts.visitNode(node, visitor, ts.isStatement)); |
| 102965 | } |
| 102966 | } |
| 102967 | function visitForStatement(node) { |
| 102968 | if (inStatementContainingYield) { |
| 102969 | beginScriptLoopBlock(); |
no test coverage detected