diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-07-06 09:52:53 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-06 09:52:53 -0700 |
| commit | 21a14cb4e0d578bc4f8a460016269a1199cac0da (patch) | |
| tree | 88a04619ceaaa37b87199dd82334cc9d102c156d /source/slang/syntax.cpp | |
| parent | f313df379dd9e0d4395f072ffb87016a6f20d5a1 (diff) | |
| parent | f145e09a6dcbcf326f782b3e6a76dbf291c792cf (diff) | |
Merge pull request #53 from tfoleyNV/cross-compilation
Initial work on cross-compilation
Diffstat (limited to 'source/slang/syntax.cpp')
| -rw-r--r-- | source/slang/syntax.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index 983f18bb7..12d8c90bb 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -1,8 +1,6 @@ #include "syntax.h" -#pragma warning AAA #include "visitor.h" -#pragma warning BBB #include <typeinfo> #include <assert.h> @@ -55,9 +53,6 @@ namespace Slang return res.ProduceString(); } -#pragma warning CCC - - // Generate dispatch logic and other definitions for all syntax classes #define SYNTAX_CLASS(NAME, BASE) /* empty */ #include "object-meta-begin.h" @@ -79,8 +74,6 @@ namespace Slang #include "object-meta-end.h" -#pragma warning DDD - void ExpressionType::accept(IValVisitor* visitor, void* extra) { accept((ITypeVisitor*)visitor, extra); @@ -881,9 +874,20 @@ void ExpressionType::accept(IValVisitor* visitor, void* extra) auto parentDecl = decl->ParentDecl; if (auto parentGeneric = dynamic_cast<GenericDecl*>(parentDecl)) { - // We need to strip away one layer of specialization - assert(substitutions); - return DeclRefBase(parentGeneric, substitutions->outer); + if (substitutions && substitutions->genericDecl == parentDecl) + { + // We strip away the specializations that were applied to + // the parent, since we were asked for a reference *to* the parent. + return DeclRefBase(parentGeneric, substitutions->outer); + } + else + { + // Either we don't have specializations, or the inner-most + // specializations didn't apply to the parent decl. This + // can happen if we are looking at an unspecialized + // declaration that is a child of a generic. + return DeclRefBase(parentGeneric, substitutions); + } } else { |
