コード例 #1
0
  private void evaluatePrefixMethod(int op, String method, Expression expression, Expression orig) {
    // load Expressions
    VariableSlotLoader usesSubscript = loadWithSubscript(expression);

    // execute Method
    execMethodAndStoreForSubscriptOperator(op, method, expression, usesSubscript, orig);

    // new value is already on stack, so nothing to do here
    if (usesSubscript != null) controller.getCompileStack().removeVar(usesSubscript.getIndex());
  }
コード例 #2
0
  private void evaluatePostfixMethod(
      int op, String method, Expression expression, Expression orig) {
    CompileStack compileStack = controller.getCompileStack();
    final OperandStack operandStack = controller.getOperandStack();

    // load Expressions
    VariableSlotLoader usesSubscript = loadWithSubscript(expression);

    // save copy for later
    operandStack.dup();
    ClassNode expressionType = operandStack.getTopOperand();
    int tempIdx = compileStack.defineTemporaryVariable("postfix_" + method, expressionType, true);

    // execute Method
    execMethodAndStoreForSubscriptOperator(op, method, expression, usesSubscript, orig);

    // remove the result of the method call
    operandStack.pop();

    // reload saved value
    operandStack.load(expressionType, tempIdx);
    compileStack.removeVar(tempIdx);
    if (usesSubscript != null) compileStack.removeVar(usesSubscript.getIndex());
  }