diff options
| author | Yong He <yonghe@outlook.com> | 2017-12-21 19:50:22 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-21 19:50:22 -0500 |
| commit | fab52a1bd6aa056ba91a2697133e62a169866242 (patch) | |
| tree | 239e42c6e9fd2907afe52974cccda41555bde2ba /source/slang/mangle.cpp | |
| parent | 6f681279d99e72e717bb2b91763b80e570ae725b (diff) | |
| parent | 00490154ef0762839556b5884ba9b7523b265a1c (diff) | |
Merge pull request #324 from tfoleyNV/generic-struct-specialization
Support generic `struct` types during IR-based emit
Diffstat (limited to 'source/slang/mangle.cpp')
| -rw-r--r-- | source/slang/mangle.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/slang/mangle.cpp b/source/slang/mangle.cpp index 721072b82..0625a6f73 100644 --- a/source/slang/mangle.cpp +++ b/source/slang/mangle.cpp @@ -184,6 +184,18 @@ namespace Slang } } + // TODO: this needs to be centralized + RefPtr<GenericSubstitution> getOutermostGenericSubst( + RefPtr<Substitutions> inSubst) + { + for (auto subst = inSubst; subst; subst = subst->outer) + { + if (auto genericSubst = subst.As<GenericSubstitution>()) + return genericSubst; + } + return nullptr; + } + void emitQualifiedName( ManglingContext* context, DeclRef<Decl> declRef) @@ -221,7 +233,7 @@ namespace Slang // There are two cases here: either we have specializations // in place for the parent generic declaration, or we don't. - auto subst = declRef.substitutions.As<GenericSubstitution>(); + auto subst = getOutermostGenericSubst(declRef.substitutions); if( subst && subst->genericDecl == parentGenericDeclRef.getDecl() ) { // This is the case where we *do* have substitutions. |
