From a0458266d7cd5d802b8c51e6a997b4bf0d9beb82 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 3 Nov 2017 09:38:02 -0400 Subject: in-progress work --- source/slang/lower-to-ir.cpp | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'source/slang/lower-to-ir.cpp') 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 : ValVisitorargs) + if (auto genSubst = subs.As()) { - (*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 lowerSubstitutions( { if(!subst) return nullptr; + RefPtr result; + if (auto genSubst = dynamic_cast(subst)) + { + RefPtr newSubst = new GenericSubstitution(); + newSubst->genericDecl = genSubst->genericDecl; + + for (auto arg : genSubst->args) + { + auto newArg = lowerSubstitutionArg(context, arg); + newSubst->args.Add(newArg); + } - RefPtr newSubst = new Substitutions(); + result = newSubst; + } + else if (auto thisSubst = dynamic_cast(subst)) + { + RefPtr 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( -- cgit v1.2.3