summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2019-01-30 15:40:00 -0800
committerGitHub <noreply@github.com>2019-01-30 15:40:00 -0800
commitc6e5551f6cf38caa37f4ebb6415e97c86eece241 (patch)
tree9a3153d2749b733ad82563bebbc4aa2d2c0ca126 /source
parent8286737741474a866c8c804070da11cb91710801 (diff)
parentdc018032ee82911030601fa1cd3ca39ca107ad44 (diff)
Merge branch 'master' into fix-while-in-gen
Diffstat (limited to 'source')
-rw-r--r--source/slang/parser.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp
index 5cc048cf5..914ec0a23 100644
--- a/source/slang/parser.cpp
+++ b/source/slang/parser.cpp
@@ -2992,7 +2992,14 @@ namespace Slang
{
// Add any modifiers we parsed before the declaration to the list
// of modifiers on the declaration itself.
- AddModifiers(decl.Ptr(), modifiers.first);
+ //
+ // We need to be careful, because if `decl` is a generic declaration,
+ // then we really want the modifiers to apply to the inner declaration.
+ //
+ RefPtr<Decl> declToModify = decl;
+ if(auto genericDecl = decl.As<GenericDecl>())
+ declToModify = genericDecl->inner;
+ AddModifiers(declToModify.Ptr(), modifiers.first);
// Make sure the decl is properly nested inside its lexical parent
if (containerDecl)