summaryrefslogtreecommitdiffstats
path: root/source/slang/lower-to-ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/lower-to-ir.cpp')
-rw-r--r--source/slang/lower-to-ir.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp
index a01279f2e..ed8ed3318 100644
--- a/source/slang/lower-to-ir.cpp
+++ b/source/slang/lower-to-ir.cpp
@@ -608,9 +608,13 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
// set up sub context for generating our new function
+ List<IRType*> paramTypes;
+
for( auto paramDecl : decl->GetParameters() )
{
IRType* irParamType = lowerSimpleType(context, paramDecl->getType());
+ paramTypes.Add(irParamType);
+
IRParam* irParam = subBuilder->emitParam(irParamType);
DeclRef<ParamDecl> paramDeclRef = makeDeclRef(paramDecl.Ptr());
@@ -620,8 +624,13 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
subContext->shared->declValues.Add(paramDeclRef, irParamVal);
}
- auto irResultType = lowerType(context, decl->ReturnType);
+ auto irResultType = lowerSimpleType(context, decl->ReturnType);
+ auto irFuncType = getBuilder()->getFuncType(
+ paramTypes.Count(),
+ &paramTypes[0],
+ irResultType);
+ irFunc->type.init(irFunc, irFuncType);
lowerStmt(subContext, decl->Body);