void InstantiationVisitor::visit(CallExpr& c)
{
	std::vector<std::unique_ptr<Expr>> args;

	for (auto& arg : c.arguments())
		args.emplace_back(clone(*arg));

	_expr.reset(new CallExpr(c.sloc(), c.name(), std::move(args), c.type()));
	static_cast<CallExpr&>(*_expr).target(c.target());
}
Beispiel #2
0
  gc<String> SignatureBuilder::build(const CallExpr& expr, bool isLValue)
  {
    SignatureBuilder builder;

    if (!expr.leftArg().isNull())
    {
      builder.writeArg(expr.leftArg());
    }

    builder.add(expr.name()->cString());
    if (isLValue) builder.add("=");

    if (!expr.rightArg().isNull())
    {
      builder.add(" ");
      builder.writeArg(expr.rightArg());
    }

    // TODO(bob): Can you do destructuring here?
    if (isLValue) builder.add("=0:");

    return String::create(builder.signature_, builder.length_);
  }