diff options
| author | Yong He <yonghe@outlook.com> | 2018-01-15 19:22:39 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-15 19:22:39 -0800 |
| commit | 68fd4485708bf98c66e27e330692138f3eb6f289 (patch) | |
| tree | b2bac3c7fdf9f1bd218e2b448a0fd5cf03a467fd /source/slang/lookup.cpp | |
| parent | 8abae0515d734c51e7d55c44ccfdadefea8c6802 (diff) | |
| parent | 513f56b85e3678bbaf40f74397e8d9a864761c08 (diff) | |
Merge pull request #367 from csyonghe/extension2
Support transitive interfaces
Diffstat (limited to 'source/slang/lookup.cpp')
| -rw-r--r-- | source/slang/lookup.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/slang/lookup.cpp b/source/slang/lookup.cpp index 19503d63f..0791c508b 100644 --- a/source/slang/lookup.cpp +++ b/source/slang/lookup.cpp @@ -297,6 +297,23 @@ void DoLocalLookupImpl( session, name, extDeclRef, request, result, inBreadcrumbs); } + + } + // for interface decls, also lookup in the base interfaces + if (request.semantics) + { + if (auto interfaceDeclRef = containerDeclRef.As<InterfaceDecl>()) + { + auto baseInterfaces = getMembersOfType<InheritanceDecl>(interfaceDeclRef); + for (auto inheritanceDeclRef : baseInterfaces) + { + auto baseType = inheritanceDeclRef.getDecl()->base.type.As<DeclRefType>(); + SLANG_ASSERT(baseType); + int diff = 0; + auto baseInterfaceDeclRef = baseType->declRef.SubstituteImpl(interfaceDeclRef.substitutions, &diff); + DoLocalLookupImpl(session, name, baseInterfaceDeclRef.As<ContainerDecl>(), request, result, inBreadcrumbs); + } + } } } |
