summaryrefslogtreecommitdiffstats
path: root/source/slang/ir.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2018-01-21 18:03:35 -0800
committerTim Foley <tfoley@nvidia.com>2018-01-21 18:06:40 -0800
commitf114c377f2cb7458fb8555151752f21d4d824e49 (patch)
tree8f9a4cf703e76f72a788acda841f6ec3ee6f3ba0 /source/slang/ir.cpp
parentef2f92fee8463fff2bf66f07eac228ff38df319f (diff)
A hacky fix for specializing methods from extensions
If we don't find the generic we expect in the first pass during IR specialization, then we check for the special case where we are trying to specialize something from a generic extension, using the type being extended. We assume that the generic parameter lists match (that part is the huge hack), and collect the arguments as if they were for the extension instead of the type. This will break when/if we ever have generic extensions with parameter lists that don't match the type being extended.
Diffstat (limited to 'source/slang/ir.cpp')
-rw-r--r--source/slang/ir.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp
index 1d3c91979..b965f908c 100644
--- a/source/slang/ir.cpp
+++ b/source/slang/ir.cpp
@@ -4510,6 +4510,19 @@ namespace Slang
}
}
+ if( !newGenericDecl )
+ {
+ if(auto gd = dynamic_cast<GenericDecl*>(newDecl))
+ {
+ if( auto ed = gd->inner.As<ExtensionDecl>() )
+ {
+ // TODO: we should confirm that it is an extension for the correct type...
+
+ newGenericDecl = gd;
+ }
+ }
+ }
+
SLANG_ASSERT(newGenericDecl);
RefPtr<GenericSubstitution> newSubst = new GenericSubstitution();