Beispiel #1
0
  /** Creates a function call expression */
  @Override
  public Expr createCall(BiancaParser parser, Location location, ArrayList<Expr> args)
      throws IOException {
    ExprFactory factory = parser.getExprFactory();

    return factory.createThisMethod(location, _qThis, _name.toString(), args);
  }
  public ClassVirtualMethodExpr(Location location, String name, Expr[] args) {
    super(location);

    _methodName = MethodIntern.intern(name);
    _hash = _methodName.hashCodeCaseInsensitive();

    _args = args;
  }
  public ClassVirtualMethodExpr(Location location, String methodName, ArrayList<Expr> args) {
    super(location);

    _methodName = MethodIntern.intern(methodName);
    _hash = _methodName.hashCodeCaseInsensitive();

    _args = new Expr[args.size()];
    args.toArray(_args);
  }
Beispiel #4
0
  /** Returns a String representation of this Exception. */
  public static Value __toString(Env env, @This ObjectValue value) {
    StringValue sb = new StringValue();

    sb.append("ExceptionClass[" + value.getName() + "]\n");
    sb.append(getMessage(env, value));
    sb.append("\n");
    sb.append(getTraceAsString(env, value));
    sb.append("\n");

    return sb;
  }
Beispiel #5
0
  /** Returns the trace. */
  public static Value getTraceAsString(Env env, @This Value obj) {
    Value trace = getTrace(env, obj);

    StringValue sb = new StringValue();
    sb.append("<trace>");

    Iterator<Value> iter = trace.getValueIterator(env);

    while (iter.hasNext()) {
      Value value = iter.next();

      sb = sb.append('\n');
      sb = sb.append(value.get(FILE));
      sb = sb.append(':');
      sb = sb.append(value.get(LINE));
      sb = sb.append(": ");
      sb = sb.append(value.get(FUNCTION));
    }

    return sb;
  }