예제 #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);
 }
예제 #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);
 };
예제 #3
0
 public boolean visit(TryStatement node) {
   VMTryStatement tryStatement = VM.createTryStatement(node);
   topBlock = tryStatement;
   blocks.push(tryStatement);
   return true;
 }
예제 #4
0
 public boolean visit(ForStatement node) {
   VMForStatement forStatement = VM.createForStatement(node);
   topBlock = forStatement;
   blocks.push(forStatement);
   return true;
 }
예제 #5
0
 public boolean visit(WhileStatement node) {
   VMWhileStatement whileStatement = VM.createWhileStatement(node);
   topBlock = whileStatement;
   blocks.push(whileStatement);
   return true;
 }
예제 #6
0
 public boolean visit(IfStatement node) {
   VMIfStatement ifStatement = VM.createIfStatement(node);
   topBlock = ifStatement;
   blocks.push(ifStatement);
   return true;
 }
예제 #7
0
 @Override
 public void endVisit(ExpressionStatement node) {
   VMExpressionStatement statement =
       VM.asVMExpressionStatement(node, (VMExpression) (expressions.pop()));
   topBlock.getStatements().add(statement);
 }