summaryrefslogtreecommitdiffstats
path: root/source/slang/lookup.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-01-14 16:52:02 -0500
committerYong He <yonghe@outlook.com>2018-01-14 16:52:02 -0500
commitae8ef43d2c807da536331eaeec022e35aa4299c1 (patch)
tree78d8c1a96ec8012c5ee84f5b072d353997c84450 /source/slang/lookup.cpp
parentd33e6b7475a87d5a62101afc81813e9c9e458a70 (diff)
Fixup field lookup from a member function defined in an extension
This fixes item 2 in #361 Modifies existing extension-multi-interface.slang test case to cover the additional scenario.
Diffstat (limited to 'source/slang/lookup.cpp')
-rw-r--r--source/slang/lookup.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/slang/lookup.cpp b/source/slang/lookup.cpp
index 376d9bd6d..19503d63f 100644
--- a/source/slang/lookup.cpp
+++ b/source/slang/lookup.cpp
@@ -345,7 +345,19 @@ void DoLookupImpl(
// Now perform "local" lookup in the context of the container,
// as if we were looking up a member directly.
- //
+
+ // if we are currently in an extension decl, perform local lookup
+ // in the target decl we are extending
+ if (auto extDeclRef = containerDeclRef.As<ExtensionDecl>())
+ {
+ if (auto targetDeclRef = extDeclRef.getDecl()->targetType->AsDeclRefType())
+ {
+ if (auto aggDeclRef = targetDeclRef->declRef.As<AggTypeDecl>())
+ {
+ containerDeclRef = extDeclRef.Substitute(aggDeclRef);
+ }
+ }
+ }
DoLocalLookupImpl(
session,
name, containerDeclRef, request, result, breadcrumbs);