Skip to content

Commit d8f8212

Browse files
committedFeb 16, 2025
Add cdecl prototypes to the ModuleCompiler
1 parent 18a1fca commit d8f8212

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/Visitor.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ std::any ASTBuilderVisitor::visitCdecl(kyoto::KyotoParser::CdeclContext* ctx)
6060

6161
auto* ret_type = std::any_cast<KType*>(visit(ctx->type()));
6262
const auto varargs = ctx->parameterList()->ELLIPSIS() != nullptr;
63-
return (ASTNode*)new FunctionNode(name, args, varargs, ret_type, nullptr, compiler);
63+
auto* proto = new FunctionNode(name, args, varargs, ret_type, nullptr, compiler);
64+
compiler.add_function(proto);
65+
return (ASTNode*)proto;
6466
}
6567

6668
std::any ASTBuilderVisitor::visitFunctionDefinition(kyoto::KyotoParser::FunctionDefinitionContext* ctx)

0 commit comments

Comments
 (0)