Beispiel #1
0
  /**
   * Evaluates the expression.
   *
   * @param env the calling environment.
   * @return the expression value.
   */
  @Override
  public Value evalCopy(Env env) {
    Value obj = env.getThis();

    if (obj.isNull()) {
      return cannotUseThisError(env);
    }

    return obj.getThisField(env, _name).copy();
  }
Beispiel #2
0
  /**
   * Evaluates the expression.
   *
   * @param env the calling environment.
   * @return the expression value.
   */
  @Override
  public void evalUnset(Env env) {
    Value obj = env.getThis();

    if (obj.isNull()) {
      cannotUseThisError(env);
    }

    obj.unsetThisField(_name);
  }
Beispiel #3
0
  /**
   * Evaluates the expression.
   *
   * @param env the calling environment.
   * @return the expression value.
   */
  @Override
  public Value evalArg(Env env, boolean isTop) {
    Value obj = env.getThis();

    if (obj.isNull()) {
      return cannotUseThisError(env);
    }

    return obj.getThisFieldArg(env, _name);
  }
Beispiel #4
0
  /**
   * Evaluates the expression.
   *
   * @param env the calling environment.
   * @return the expression value.
   */
  @Override
  public Value evalAssignRef(Env env, Value value) {
    Value obj = env.getThis();

    if (obj.isNull()) {
      cannotUseThisError(env);
    }

    obj.putThisField(env, _name, value);

    return value;
  }
Beispiel #5
0
  /**
   * Evaluates the expression.
   *
   * @param env the calling environment.
   * @return the expression value.
   */
  @Override
  public Var evalVar(Env env) {
    Value obj = env.getThis();

    if (obj.isNull()) {
      cannotUseThisError(env);

      return new Var();
    }

    return obj.getThisFieldVar(env, _name);
  }
Beispiel #6
0
  /** Evaluates as an array index assign ($a[index] = value). */
  @Override
  public Value evalArrayAssign(Env env, Value index, Value value) {
    Value obj = env.getThis();

    if (obj.isNull()) {
      cannotUseThisError(env);
    }

    Value fieldVar = obj.getThisFieldVar(env, _name);

    // php/03mm
    return fieldVar.put(index, value);
  }