Package com.caucho.quercus.expr

Examples of com.caucho.quercus.expr.Expr


    Location location = _location;

    if (location != null)
      return location;

    Expr call = peekCall(0);

    if (call != null)
      return call.getLocation();

    return Location.UNKNOWN;
  }
View Full Code Here


   * Returns the current function.
   */
  public String getFunctionLocation()
  {
    // XXX: need to work with compiled code, too
    Expr call = peekCall(0);

    if (call != null)
      return call.getFunctionLocation();
    else
      return "";
  }
View Full Code Here

              Optional opt = (Optional) ann;

              if (! opt.value().equals("")) {
                try {
                  Expr expr = QuercusParser.parse(_moduleContext.getQuercus(), opt.value());
                  _defaultExprs[i] = expr;
                } catch (java.io.IOException e) {
                  throw new QuercusRuntimeException(e);
                }
              } else
View Full Code Here

   
    for (; i < _marshalArgs.length; i++) {
      Marshal marshal = _marshalArgs[i];
     
      if (i < args.length && args[i] != null) {
        Expr arg = args[i];

        int argCost = marshal.getMarshalingCost(arg);

        cost = Math.max(argCost + cost, cost);
      }
View Full Code Here

    }
    else if (qThis != null)
      obj = qThis.toJavaObject();

    for (int i = 0; i < _marshalArgs.length; i++) {
      Expr expr;

      if (i < exprs.length && exprs[i] != null)
        expr = exprs[i];
      else {
        expr = _defaultExprs[i];
View Full Code Here

   * Use with care, for compiled code this can be a relatively expensive
   * operation.
   */
  public Location getLocation()
  {
    Expr call = peekCall(0);

    if (call != null)
      return call.getLocation();

    return Location.UNKNOWN;
  }
View Full Code Here

   * Returns the current function.
   */
  public String getFunctionLocation()
  {
    // XXX: need to work with compiled code, too
    Expr call = peekCall(0);

    if (call != null)
      return call.getFunctionLocation();
    else
      return "";
  }
View Full Code Here

    ArrayValue varArray = new ArrayValueImpl();

    for (ClassField field : cl.getClassFields().values()) {
      if (field.isPublic()) {
        StringValue name = field.getName();
        Expr initValue = field.getInitValue();
       
        Value value = initValue.eval(env);

        varArray.append(name, value);
      }
    }
View Full Code Here

      return null;
  }
 
  private static void addInterpreted(Env env, ArrayValue result, int i)
  {
    Expr expr = env.peekCall(i);

    if (expr instanceof CallExpr) {
      CallExpr callExpr = (CallExpr) expr;

      String functionName = callExpr.getName();
      if ("debug_backtrace".equals(functionName))
        return;
 
      ArrayValue call = new ArrayValueImpl();
      result.put(call);
     
      if (callExpr.getFileName() != null) {
        call.put(FILE,
                 env.createString(callExpr.getFileName()));
        call.put(LINE,
                 LongValue.create(callExpr.getLine()));
      }

      call.put(FUNCTION,
               env.createString(callExpr.getName()));

      // Create "args" argument value array

      // evaluating args a second time is problematic, affecting mediawiki
      // php/180q
      //ArrayValueImpl args = evalArgsArray(env, callExpr);

      ArrayValueImpl args = new ArrayValueImpl(env.peekArgs(i));
     
      call.put(ARGS, args);
    }
    else if (expr instanceof ObjectMethodExpr) {
      ObjectMethodExpr callExpr = (ObjectMethodExpr) expr;

      ArrayValue call = new ArrayValueImpl();
      result.put(call);
     
      if (callExpr.getFileName() != null) {
        call.put(FILE,
                 env.createString(callExpr.getFileName()));
        call.put(LINE,
                 LongValue.create(callExpr.getLine()));
      }

      call.put(FUNCTION,
               env.createString(callExpr.getName()));

      call.put(CLASS,
               env.createString(env.peekCallThis(i).getClassName()));

      call.put(TYPE, env.createString("->"));

      call.put(ARGS, new ArrayValueImpl());
    }
    else if (expr instanceof FunIncludeExpr) {
      ArrayValue call = new ArrayValueImpl();
      result.put(call);
     
      if (expr.getFileName() != null) {
        call.put(FILE, env.createString(expr.getFileName()));
        call.put(LINE, LongValue.create(expr.getLine()));
      }

      call.put(FUNCTION, env.createString("include"));
    }
    else if (expr instanceof FunIncludeOnceExpr) {
      boolean isRequire = ((FunIncludeOnceExpr) expr).isRequire();
     
      ArrayValue call = new ArrayValueImpl();
      result.put(call);
     
      if (expr.getFileName() != null) {
        call.put(FILE, env.createString(expr.getFileName()));
        call.put(LINE, LongValue.create(expr.getLine()));
      }
   
      String name;
     
      if (isRequire)
View Full Code Here

   
    getStaticFields(env, array, _cls);
   
    HashMap<StringValue, ClassField> fieldMap = _cls.getClassFields();
    for (Map.Entry<StringValue, ClassField> entry : fieldMap.entrySet()) {
      Expr initExpr = entry.getValue().getInitValue();
     
      array.put(entry.getKey(), initExpr.eval(env));
    }
   
    return array;
  }
View Full Code Here

TOP

Related Classes of com.caucho.quercus.expr.Expr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.