summaryrefslogtreecommitdiffstats
path: root/source/slang/lower.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/lower.cpp')
-rw-r--r--source/slang/lower.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/slang/lower.cpp b/source/slang/lower.cpp
index 55dabb826..60f86ad17 100644
--- a/source/slang/lower.cpp
+++ b/source/slang/lower.cpp
@@ -1714,10 +1714,14 @@ struct LoweringVisitor
if (loweredEntryPointFunc->getName() == "main")
loweredEntryPointFunc->Name.Content = "main_";
+ RefPtr<BlockStmt> bodyStmt = new BlockStmt();
+ bodyStmt->scopeDecl = new ScopeDecl();
+
// We will want to generate declarations into the body of our new `main()`
LoweringVisitor subVisitor = *this;
subVisitor.isBuildingStmt = true;
subVisitor.stmtBeingBuilt = nullptr;
+ subVisitor.parentDecl = bodyStmt->scopeDecl;
// The parameters of the entry-point function will be translated to
// both a local variable (for passing to/from the entry point func),
@@ -1839,7 +1843,9 @@ struct LoweringVisitor
VaryingParameterDirection::Output);
}
- mainDecl->Body = subVisitor.stmtBeingBuilt;
+ bodyStmt->body = subVisitor.stmtBeingBuilt;
+
+ mainDecl->Body = bodyStmt;
// Once we are done building the body, we append our new declaration to the program.