Пример #1
0
  public void atDeclarator(Declarator d) throws CompileError {
    d.setLocalVar(getMaxLocals());
    d.setClassName(resolveClassName(d.getClassName()));

    int size;
    if (is2word(d.getType(), d.getArrayDim())) size = 2;
    else size = 1;

    incMaxLocals(size);

    /*  NOTE: Array initializers has not been supported.
     */
    ASTree init = d.getInitializer();
    if (init != null) {
      doTypeCheck(init);
      atVariableAssign(null, '=', null, d, init, false);
    }
  }
Пример #2
0
  protected void atAssignExpr(AssignExpr expr, boolean doDup) throws CompileError {
    // =, %=, &=, *=, /=, +=, -=, ^=, |=, <<=, >>=, >>>=
    int op = expr.getOperator();
    ASTree left = expr.oprand1();
    ASTree right = expr.oprand2();
    if (left instanceof Variable)
      atVariableAssign(expr, op, (Variable) left, ((Variable) left).getDeclarator(), right, doDup);
    else {
      if (left instanceof Expr) {
        Expr e = (Expr) left;
        if (e.getOperator() == ARRAY) {
          atArrayAssign(expr, op, (Expr) left, right, doDup);
          return;
        }
      }

      atFieldAssign(expr, op, left, right, doDup);
    }
  }