/** {@inheritDoc} */ @Override public void toString(StringBuilder out, int indent) { if (indent < 0) { out.append(fun.label); if (args.size() == 0) return; out.append('['); for (int i = 0; i < args.size(); i++) { if (i > 0) out.append(", "); args.get(i).toString(out, -1); } out.append(']'); } else { for (int i = 0; i < indent; i++) { out.append(' '); } out.append("call ") .append(fun) .append(" at position <") .append(fun.pos) .append("> with type=") .append(type) .append('\n'); for (Expr a : args) { a.toString(out, indent + 2); } } }
/** * Returns true if we can determine the two expressions are equivalent; may sometimes return * false. */ @Override public boolean isSame(Expr obj) { while (obj instanceof ExprUnary && ((ExprUnary) obj).op == ExprUnary.Op.NOOP) obj = ((ExprUnary) obj).sub; if (obj == this) return true; if (!(obj instanceof ExprCall)) return false; ExprCall x = (ExprCall) obj; if (fun != x.fun || args.size() != x.args.size()) return false; for (int i = 0; i < args.size(); i++) if (!args.get(i).isSame(x.args.get(i))) return false; return true; }