Example #1
0
 @Override
 public void endVisit(VariableDeclarationStatement node) {
   Collection<VMVariableDeclarationFragment> vars = new ArrayList<VMVariableDeclarationFragment>();
   for (int i = 0; i < node.fragments().size(); i++) {
     vars.add((VMVariableDeclarationFragment) (expressions.pop()));
   }
   VMVariableDeclarationStatement statement = VM.asVariableDeclarationStatement(node, vars);
   topBlock.getStatements().add(statement);
 }
Example #2
0
 @Override
 public void endVisit(ClassInstanceCreation node) {
   Stack<VMExpression> arguments = new Stack<VMExpression>();
   for (int i = 0; i < node.arguments().size(); i++) {
     arguments.push((VMExpression) expressions.pop());
   }
   VMClassInstanceCreation classInstanceCreation =
       VM.createClassInstanceCreation(node.getType(), node);
   while (!arguments.empty()) classInstanceCreation.getArguments().add(arguments.pop());
   expressions.push(classInstanceCreation);
 };
Example #3
0
 public boolean visit(TryStatement node) {
   VMTryStatement tryStatement = VM.createTryStatement(node);
   topBlock = tryStatement;
   blocks.push(tryStatement);
   return true;
 }
Example #4
0
 public boolean visit(ForStatement node) {
   VMForStatement forStatement = VM.createForStatement(node);
   topBlock = forStatement;
   blocks.push(forStatement);
   return true;
 }
Example #5
0
 public boolean visit(WhileStatement node) {
   VMWhileStatement whileStatement = VM.createWhileStatement(node);
   topBlock = whileStatement;
   blocks.push(whileStatement);
   return true;
 }
Example #6
0
 public boolean visit(IfStatement node) {
   VMIfStatement ifStatement = VM.createIfStatement(node);
   topBlock = ifStatement;
   blocks.push(ifStatement);
   return true;
 }
Example #7
0
 @Override
 public void endVisit(ExpressionStatement node) {
   VMExpressionStatement statement =
       VM.asVMExpressionStatement(node, (VMExpression) (expressions.pop()));
   topBlock.getStatements().add(statement);
 }