summaryrefslogtreecommitdiff
path: root/source/slang/slang-parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-parser.cpp')
-rw-r--r--source/slang/slang-parser.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index b99df18e4..cc3a661f3 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -2576,11 +2576,20 @@ namespace Slang
typeSpec.expr = parseFuncTypeExpr(parser);
return typeSpec;
}
+
+ bool inGlobalScope = false;
+ if (AdvanceIf(parser, TokenType::Scope))
+ {
+ inGlobalScope = true;
+ }
Token typeName = parser->ReadToken(TokenType::Identifier);
auto basicType = parser->astBuilder->create<VarExpr>();
- basicType->scope = parser->currentLookupScope;
+ if (inGlobalScope)
+ basicType->scope = parser->currentModule->ownedScope;
+ else
+ basicType->scope = parser->currentLookupScope;
basicType->loc = typeName.loc;
basicType->name = typeName.getNameOrNull();