Skip to content
Snippets Groups Projects
Commit a36118a1 authored by lucien.noel's avatar lucien.noel
Browse files

le test 7 OK

parent 3a1cc83e
No related branches found
No related tags found
No related merge requests found
...@@ -226,14 +226,15 @@ public class ByteCodeGenerator implements ASTVisitor { ...@@ -226,14 +226,15 @@ public class ByteCodeGenerator implements ASTVisitor {
} }
public Object visit(Tantque node) { public Object visit(Tantque node) {
bytecode += "label_"+nb_label+":\n"; int local_nb_label = nb_label;
nb_label += 2;
bytecode += "label_"+local_nb_label+":\n";
node.getCondition().accept(this); node.getCondition().accept(this);
bytecode += "ldc "+((getBoolInExpression(node.getCondition()))?"1":"0")+"\n"; loadBoolInByteCode(node.getCondition());
bytecode += "ifeq label_"+(nb_label+1)+"\n"; bytecode += "ifeq label_"+(local_nb_label+1)+"\n";
node.getInstruction().accept(this); node.getInstruction().accept(this);
bytecode += "goto label_"+nb_label+"\n"; bytecode += "goto label_"+local_nb_label+"\n";
bytecode += "label_"+(nb_label+1)+":\n"; bytecode += "label_"+(local_nb_label+1)+":\n";
nb_label += 2;
return null; return null;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment