예제 #1
0
  protected int getLocalVar(Declarator d) {
    int v = d.getLocalVar();
    if (v < 0) {
      v = getMaxLocals(); // delayed variable allocation.
      d.setLocalVar(v);
      incMaxLocals(1);
    }

    return v;
  }
예제 #2
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);
    }
  }