Examples of PrefixExpression


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

        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

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

  @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

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

                        // 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

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

        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

Examples of org.eclipse.jdt.internal.compiler.ast.PrefixExpression

      this.scribe.space();
    }
    Expression expression = unaryExpression.expression;

    if (expression instanceof PrefixExpression) {
      PrefixExpression prefixExpression = (PrefixExpression) expression;
      final int numberOfParensForExpression = (prefixExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
      if (numberOfParensForExpression == 0) {
        switch(operatorValue) {
          case OperatorIds.PLUS:
            if (prefixExpression.operator == OperatorIds.PLUS) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.PrefixExpression

      this.scribe.space();
    }
    Expression expression = unaryExpression.expression;

    if (expression instanceof PrefixExpression) {
      PrefixExpression prefixExpression = (PrefixExpression) expression;
      final int numberOfParensForExpression = (prefixExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
      if (numberOfParensForExpression == 0) {
        switch(operatorValue) {
          case OperatorIds.PLUS:
            if (prefixExpression.operator == OperatorIds.PLUS) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.PrefixExpression

      this.scribe.space();
    }
    Expression expression = unaryExpression.expression;

    if (expression instanceof PrefixExpression) {
      PrefixExpression prefixExpression = (PrefixExpression) expression;
      final int numberOfParensForExpression = (prefixExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
      if (numberOfParensForExpression == 0) {
        switch(operatorValue) {
          case OperatorIds.PLUS:
            if (prefixExpression.operator == OperatorIds.PLUS) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.PrefixExpression

          IntLiteral.One,
          op,
          this.endStatementPosition);
    } else {
      this.expressionStack[this.expressionPtr] =
        new PrefixExpression(
          leftHandSide,
          IntLiteral.One,
          op,
          this.intStack[this.intPtr--]);
    }
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PrefixExpression

    super(goal);
  }

  public IGoal[] init() {
    ExpressionTypeGoal typedGoal = (ExpressionTypeGoal) goal;
    PrefixExpression prefixExpression = (PrefixExpression) typedGoal
        .getExpression();

    // XXX: actually, we have to check the contents of the variable here,
    // since for example typeof(++"abc")=string, but typeof(++"123")=integer
    // ...
    return new IGoal[] { new ExpressionTypeGoal(goal.getContext(),
        prefixExpression.getVariable()) };
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.