Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.PrefixExpression


     *
     * @param name local variable or field name
     * @return expression
     */
    public PrefixExpressionBuilder buildPreincrement(String name) {
        PrefixExpression prefixex = getAST().newPrefixExpression();
        prefixex.setOperator(PrefixExpression.Operator.INCREMENT);
        return new PrefixExpressionBuilder(this, prefixex, getAST().newSimpleName(name));
    }
View Full Code Here


        test.setLeftOperand(m_ast.newSimpleName(name));
        FieldAccess access = m_ast.newFieldAccess();
        access.setExpression(m_ast.newSimpleName(array));
        access.setName(m_ast.newSimpleName("length"));
        test.setRightOperand(access);
        PrefixExpression post = m_ast.newPrefixExpression();
        post.setOperator(PrefixExpression.Operator.INCREMENT);
        post.setOperand(m_ast.newSimpleName(name));
        addForStatement(name, m_ast.newPrimitiveType(PrimitiveType.INT), m_ast.newNumberLiteral("0"), test,
            post, block);
    }
View Full Code Here

  @Test
  public void testArrayInc() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("ArrayInc", ARRAY_INC);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    PrefixExpression inc = (PrefixExpression) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(inc);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof EclipseInstructionSequence);
    LoadArrayInstruction load = (LoadArrayInstruction) tac.instruction(inc.getOperand());
   
    EclipseInstructionSequence seq = (EclipseInstructionSequence) instr;
    Assert.assertEquals(
        "Wrong number of instructions in sequence: " + seq.getInstructions().length,
        3, seq.getInstructions().length);
View Full Code Here

                        // Produce prefix operators next time.
                        if (operator.equals("--")) {
                            isPostfix = false;
                        }
                    } else {
                        PrefixExpression prefix = ast.newPrefixExpression();
                        prefix.setOperand((Expression) ASTNode.copySubtree(ast,
                                assignment.getLeftHandSide()));
                        prefix.setOperator(PrefixExpression.Operator
                                .toOperator(operator));
                        expression = prefix;
                    }

                    returnStatement.setExpression(expression);
View Full Code Here

        return false;
      }
    }

    if (parent instanceof PrefixExpression) {
      PrefixExpression prefix = (PrefixExpression) parent;
      if (prefix.getOperator()
          .equals(PrefixExpression.Operator.INCREMENT)
          || prefix.getOperator().equals(
              PrefixExpression.Operator.DECREMENT)) {
        return true;
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.PrefixExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.