Exemple #1
0
void IRGenerator::accept(CallExpr& call)
{
    FNTRACE();

    std::vector<Value*> args;
    for (Expr* arg: call.args().values()) {
        if (Value* v = codegen(arg)) {
            args.push_back(v);
        } else {
            return;
        }
    }

    if (call.callee()->isFunction()) {
        Value* callee = codegen(call.callee());
        // builtin function
        result_ = createCallFunction(static_cast<IRBuiltinFunction*>(callee), args);
    } else if (call.callee()->isBuiltin()) {
        Value* callee = codegen(call.callee());
        // builtin handler
        result_ = createInvokeHandler(static_cast<IRBuiltinHandler*>(callee), args);
    } else {
        // source handler
        codegenInline(*static_cast<Handler*>(call.callee()));
        result_ = nullptr;
    }
}
Exemple #2
0
void FlowCallVisitor::accept(CallExpr& call)
{
    for (const auto& arg: call.args().values()) {
        visit(arg);
    }

    if (call.callee() && call.callee()->isBuiltin()) {
        calls_.push_back(&call);
    }
}