diff options
| author | Yong He <yonghe@outlook.com> | 2017-11-03 09:38:02 -0400 |
|---|---|---|
| committer | Yong He <yonghe@outlook.com> | 2017-11-03 09:38:02 -0400 |
| commit | a0458266d7cd5d802b8c51e6a997b4bf0d9beb82 (patch) | |
| tree | 39f16538178907240e59b8e531ae153391805833 /source/slang/lower-to-ir.cpp | |
| parent | d5e2319c33115d0241dd9d2047c0a5f029553dde (diff) | |
in-progress work
Diffstat (limited to 'source/slang/lower-to-ir.cpp')
| -rw-r--r-- | source/slang/lower-to-ir.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp index 998197279..6099df1ed 100644 --- a/source/slang/lower-to-ir.cpp +++ b/source/slang/lower-to-ir.cpp @@ -870,9 +870,12 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower auto subs = declRef.substitutions; while(subs) { - for(auto aa : subs->args) + if (auto genSubst = subs.As<GenericSubstitution>()) { - (*ioArgs).Add(getSimpleVal(context, lowerVal(context, aa))); + for (auto aa : genSubst->args) + { + (*ioArgs).Add(getSimpleVal(context, lowerVal(context, aa))); + } } subs = subs->outer; } @@ -3037,24 +3040,33 @@ RefPtr<Substitutions> lowerSubstitutions( { if(!subst) return nullptr; + RefPtr<Substitutions> result; + if (auto genSubst = dynamic_cast<GenericSubstitution*>(subst)) + { + RefPtr<GenericSubstitution> newSubst = new GenericSubstitution(); + newSubst->genericDecl = genSubst->genericDecl; + + for (auto arg : genSubst->args) + { + auto newArg = lowerSubstitutionArg(context, arg); + newSubst->args.Add(newArg); + } - RefPtr<Substitutions> newSubst = new Substitutions(); + result = newSubst; + } + else if (auto thisSubst = dynamic_cast<ThisTypeSubstitution*>(subst)) + { + RefPtr<ThisTypeSubstitution> newSubst = new ThisTypeSubstitution(); + newSubst->sourceType = lowerSubstitutionArg(context, thisSubst->sourceType); + result = newSubst; + } if (subst->outer) { - newSubst->outer = lowerSubstitutions( + result->outer = lowerSubstitutions( context, subst->outer); } - - newSubst->genericDecl = subst->genericDecl; - - for (auto arg : subst->args) - { - auto newArg = lowerSubstitutionArg(context, arg); - newSubst->args.Add(newArg); - } - - return newSubst; + return result; } LoweredValInfo emitDeclRef( |
