示例#1
0
  /** Constructor. */
  private ModuleContext(ClassLoader loader) {
    _loader = loader;

    _marshalFactory = new MarshalFactory(this);
    _exprFactory = new ExprFactory();

    _stdClassDef = new InterpretedClassDef("stdClass", null, new String[0]);
    _stdClass = new BiancaClass(this, _stdClassDef, null);

    _staticClasses.put(_stdClass.getName(), _stdClassDef);
  }
  /**
   * Evaluates the expression.
   *
   * @param env the calling environment.
   * @return the expression value.
   */
  @Override
  public Value eval(Env env) {
    Value qThis = env.getThis();

    BiancaClass cls = qThis.getBiancaClass();

    if (cls == null) {
      env.error(getLocation(), L.l("no calling class found"));

      return NullValue.NULL;
    }

    Value[] values = evalArgs(env, _args);

    env.pushCall(this, cls, values);

    try {
      return cls.callMethod(env, qThis, _methodName, _hash, values);
    } finally {
      env.popCall();
    }
  }