summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2018-01-21 17:23:03 -0800
committerTim Foley <tfoley@nvidia.com>2018-01-21 18:06:40 -0800
commitef2f92fee8463fff2bf66f07eac228ff38df319f (patch)
tree258dba1d71337ec0c020085d35284307f106466d /source
parent41311209af4963f44acf34942d42828590d4b156 (diff)
Trying to get generic extensions to work
- Don't drop specializations on a method when adding it to requirement dictionary - Handle extension declarations under a generic when emitting to IR
Diffstat (limited to 'source')
-rw-r--r--source/slang/check.cpp2
-rw-r--r--source/slang/lower-to-ir.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index 52558ee15..e2d519a4c 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -1708,7 +1708,7 @@ namespace Slang
{
// TODO: actually implement matching here. For now we'll
// just pretend that things are satisfied in order to make progress..
- requirementDict.AddIfNotExists(requiredMemberDeclRef, DeclRef<Decl>(memberDecl, nullptr));
+ requirementDict.AddIfNotExists(requiredMemberDeclRef, memberDecl);
return true;
}
diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp
index 5d710725a..42d6dc303 100644
--- a/source/slang/lower-to-ir.cpp
+++ b/source/slang/lower-to-ir.cpp
@@ -3734,6 +3734,8 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
LoweredValInfo visitGenericDecl(GenericDecl * genDecl)
{
+ // TODO: Should this just always visit/lower the inner decl?
+
if (auto innerFuncDecl = genDecl->inner->As<FuncDecl>())
return lowerFuncDecl(innerFuncDecl);
else if (auto innerStructDecl = genDecl->inner->As<StructDecl>())
@@ -3741,6 +3743,10 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
visitAggTypeDecl(innerStructDecl);
return LoweredValInfo();
}
+ else if( auto extensionDecl = genDecl->inner->As<ExtensionDecl>() )
+ {
+ return visitExtensionDecl(extensionDecl);
+ }
SLANG_RELEASE_ASSERT(false);
UNREACHABLE_RETURN(LoweredValInfo());
}