File tree Expand file tree Collapse file tree
src/backend/llvm/code-generation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,11 +16,15 @@ export class DoStatementGenerator implements NodeGenerateInterface<ts.DoStatemen
1616 const next = llvm . BasicBlock . create ( ctx . llvmContext ) ;
1717 ctx . scope . enclosureFunction . llvmFunction . addBasicBlock ( next ) ;
1818
19+ ctx . scope . breakBlock = next ;
20+
1921 builder . createBr ( positiveBlock ) ;
2022 builder . setInsertionPoint ( positiveBlock ) ;
2123
2224 passStatement ( < any > node . statement , ctx , builder ) ;
2325
26+ ctx . scope . continueBlock = null ;
27+
2428 builder . createBr ( conditionBlock ) ;
2529 builder . setInsertionPoint ( conditionBlock ) ;
2630
Original file line number Diff line number Diff line change 1212 return total ;
1313 }
1414
15+ function simpleBreak ( ) : number {
16+ let total : number = 0 ;
17+ let i : number = 0 ;
18+
19+ do {
20+ total = total + i ;
21+ i += 1 ;
22+
23+ if ( i > 100 ) {
24+ break ;
25+ }
26+ } while ( true ) ;
27+
28+ return total ;
29+ }
30+
1531 calculateTotalFromRange ( 1 , 100 ) ;
1632 calculateTotalFromRange ( 50 , 100 ) ;
33+ simpleBreak ( ) ;
1734}
You can’t perform that action at this time.
0 commit comments