diff options
Diffstat (limited to 'source/slang/slang-parser.cpp')
| -rw-r--r-- | source/slang/slang-parser.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp index 342ac9e55..95eb971ee 100644 --- a/source/slang/slang-parser.cpp +++ b/source/slang/slang-parser.cpp @@ -5127,7 +5127,11 @@ void Parser::parseSourceFile(ContainerDecl* program) currentModule = getModuleDecl(program); - PushScope(program); + // If the program already has a scope, then reuse it instead of overwriting it! + if (program->ownedScope) + PushScope(program->ownedScope); + else + PushScope(program); // A single `ModuleDecl` might span multiple source files, so it // is possible that we are parsing a new source file into a module |
