Support "break", "continue", "return".

This commit is contained in:
Wilson Snyder
2010-02-14 10:01:21 -05:00
parent 48603c0ee2
commit cdd06e7236
28 changed files with 761 additions and 84 deletions
+10
View File
@@ -360,12 +360,22 @@ public:
puts(")); }\n");
}
}
virtual void visit(AstJumpGo* nodep, AstNUser*) {
puts("goto __Vlabel"+cvtToStr(nodep->labelp()->labelNum())+";\n");
}
virtual void visit(AstJumpLabel* nodep, AstNUser*) {
puts("{\n");
nodep->stmtsp()->iterateAndNext(*this);
puts("}\n");
puts("__Vlabel"+cvtToStr(nodep->labelNum())+": ;\n");
}
virtual void visit(AstWhile* nodep, AstNUser*) {
nodep->precondsp()->iterateAndNext(*this);
puts("while (");
nodep->condp()->iterateAndNext(*this);
puts(") {\n");
nodep->bodysp()->iterateAndNext(*this);
nodep->incsp()->iterateAndNext(*this);
nodep->precondsp()->iterateAndNext(*this); // Need to recompute before next loop
puts("}\n");
}