Package org.eclipse.jdt.internal.debug.eval.ast.instructions

Examples of org.eclipse.jdt.internal.debug.eval.ast.instructions.AssignmentOperator


      int unboxedVariableTypeId = getUnBoxedTypeId(leftHandSide);
      int unboxedValueTypeId = getUnBoxedTypeId(rightHandSide);
      int unboxedResultTypeId = Instruction.getBinaryPromotionType(
          unboxedVariableTypeId, unboxedValueTypeId);

      push(new AssignmentOperator(variableTypeId, variableTypeId,
          fCounter));

      leftHandSide.accept(this);

      if (char0 == '=') {

        boolean storeRequired = false;
        if (rightBinding.isPrimitive()) {
          boxing(leftBinding, rightBinding);
          storeRequired = true;
        }
        rightHandSide.accept(this);
        if (storeRequired) {
          storeInstruction(); // boxing
        }

      } else {
        boolean unrecognized = false;

        boxing(leftBinding, rightBinding);

        switch (char0) {
        case '=': // equal
          break;
        case '+': // plus equal
          push(new PlusOperator(unboxedVariableTypeId,
              unboxedValueTypeId, unboxedResultTypeId, fCounter));
          break;
        case '-': // minus equal
          push(new MinusOperator(unboxedVariableTypeId,
              unboxedValueTypeId, unboxedResultTypeId, fCounter));
          break;
        case '*': // multiply equal
          push(new MultiplyOperator(unboxedVariableTypeId,
              unboxedValueTypeId, unboxedResultTypeId, fCounter));
          break;
        case '/': // divide equal
          push(new DivideOperator(unboxedVariableTypeId,
              unboxedValueTypeId, unboxedResultTypeId, fCounter));
          break;
        case '%': // remainder equal
          push(new RemainderOperator(unboxedVariableTypeId,
              unboxedValueTypeId, unboxedResultTypeId, fCounter));
          break;
        case '^': // XOr equal
          push(new XorOperator(unboxedVariableTypeId,
              unboxedValueTypeId, unboxedResultTypeId, fCounter));
          break;
        case '|': // or equal
          push(new OrOperator(unboxedVariableTypeId,
              unboxedValueTypeId, unboxedResultTypeId, fCounter));
          break;
        case '&': // and equal
          push(new AndOperator(unboxedVariableTypeId,
              unboxedValueTypeId, unboxedResultTypeId, fCounter));
          break;
        case '<': // left shift equal
          push(new LeftShiftOperator(unboxedVariableTypeId,
              unboxedValueTypeId, unboxedResultTypeId, fCounter));
          break;
        case '>': // right shift equal or unsigned right shift equal
          switch (char2) {
          case '=': // right shift equal
            push(new RightShiftOperator(unboxedVariableTypeId,
                unboxedValueTypeId, unboxedResultTypeId,
                fCounter));
            break;
          case '>': // unsigned right shift equal
            push(new UnsignedRightShiftOperator(
                unboxedVariableTypeId, unboxedValueTypeId,
                unboxedResultTypeId, fCounter));
            break;
          default:
            unrecognized = true;
            break;
          }
          break;
        default:
          unrecognized = true;
          break;
        }

        if (unrecognized) {
          setHasError(true);
          addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Unrecognized_assignment_operator____4
              + opToken);
          return false;
        }

        unBoxing(leftBinding);
        push(new Dup());
        storeInstruction(); // dupe
        storeInstruction(); // un-boxing

        boolean storeRequired = unBoxing(rightBinding);
        rightHandSide.accept(this);
        if (storeRequired) {
          storeInstruction(); // un-boxing
        }

        storeInstruction(); // operation
        storeInstruction(); // boxing

      }

    } else {
      boolean unrecognized = false;

      switch (char0) {
      case '=': // equal
        push(new AssignmentOperator(variableTypeId, valueTypeId,
            fCounter));
        break;
      case '+': // plus equal
        push(new PlusAssignmentOperator(variableTypeId, valueTypeId,
            fCounter));
View Full Code Here


      storeInstruction();

      // conditional jump will be added here

      push(new NoOp(fCounter));
      push(new AssignmentOperator(paramTypeId, paramTypeId, fCounter));
      push(new PushLocalVariable(paramIdentifier));
      storeInstruction();
      push(new org.eclipse.jdt.internal.debug.eval.ast.instructions.ArrayAccess(
          fCounter));
      push(new PushLocalVariable(arrayIdentifier));
      storeInstruction();
      push(new PostfixPlusPlusOperator(Instruction.T_int, fCounter));
      push(new PushLocalVariable(varIdentifier));
      storeInstruction();
      storeInstruction();
      storeInstruction();
      if (checkAutoBoxing(typeBinding.getElementType(), paramBinding)) {
        storeInstruction();
      }
      storeInstruction();
      addPopInstruction();
      node.getBody().accept(this);
      storeInstruction();

      // jump will be added here

    } else {
      // the expression returns a collection
      String iteratorIdentifier = "#i" + fUniqueIdIndex++; //$NON-NLS-1$
      push(new LocalVariableCreation(iteratorIdentifier,
          "Ljava/util/Iterator;", 0, false, true, fCounter)); //$NON-NLS-1$
      push(new SendMessage(
          "iterator", "()Ljava/util/Iterator;", 0, null, fCounter)); //$NON-NLS-1$//$NON-NLS-2$
      node.getExpression().accept(this);
      storeInstruction();
      storeInstruction();
      push(new LocalVariableCreation(paramIdentifier, typeSignature, 0,
          isParamPrimitiveType, false, fCounter));
      storeInstruction();

      push(new SendMessage("hasNext", "()Z", 0, null, fCounter)); //$NON-NLS-1$ //$NON-NLS-2$
      push(new PushLocalVariable(iteratorIdentifier));
      storeInstruction();
      storeInstruction();

      // conditional jump will be added here

      push(new NoOp(fCounter));
      push(new AssignmentOperator(paramTypeId, paramTypeId, fCounter));
      push(new PushLocalVariable(paramIdentifier));
      storeInstruction();
      push(new SendMessage(
          "next", "()Ljava/lang/Object;", 0, null, fCounter)); //$NON-NLS-1$ //$NON-NLS-2$
      push(new PushLocalVariable(iteratorIdentifier));
View Full Code Here

    if (expressionTypeId == Instruction.T_Object) {

      int expressionUnBoxedTypeId = getUnBoxedTypeId(operand);

      AssignmentOperator assignmentInstruction = new AssignmentOperator(
          Instruction.T_Object, Instruction.T_Object, fCounter);
      push(assignmentInstruction);
      operand.accept(this);
      switch (char0) {
      case '+': // plus plus
        push(new PlusOperator(expressionUnBoxedTypeId,
            expressionUnBoxedTypeId, expressionUnBoxedTypeId,
            fCounter));
        break;
      case '-': // minus minus
        push(new MinusOperator(expressionUnBoxedTypeId,
            expressionUnBoxedTypeId, expressionUnBoxedTypeId,
            fCounter));
        break;
      default:
        setHasError(true);
        addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_unrecognized_postfix_operator____15
            + opToken);
        return false;
      }
      push(new Value(fCounter));
      push(new Dup());
      storeInstruction(); // dupe
      storeInstruction(); // value
      push(new DupX1());
      storeInstruction(); // dup_x1
      ITypeBinding typeBinding = resolveTypeBinding(operand);
      if (typeBinding == null) {
        return false;
      }
      unBoxing(typeBinding);
      storeInstruction(); // un-boxing
      push(new PushInt(1));
      storeInstruction(); // push 1
      storeInstruction(); // operator
      boxing(typeBinding, null);
      storeInstruction(); // boxing
      storeInstruction(); // assignment
      push(new Pop(assignmentInstruction.getSize() + 1));

      return false;
    }

    switch (char0) {
View Full Code Here

        storeInstruction(); // un-boxing

      } else {
        // plus plus and minus minus operators

        push(new AssignmentOperator(Instruction.T_Object,
            Instruction.T_Object, fCounter));

        operand.accept(this);

        boxing(typeBinding, null);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.debug.eval.ast.instructions.AssignmentOperator

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.