diff options
| author | Yong He <yonghe@outlook.com> | 2018-01-15 13:54:57 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-15 13:54:57 -0800 |
| commit | 8abae0515d734c51e7d55c44ccfdadefea8c6802 (patch) | |
| tree | bf959f2c7e41223c30d1883d26528d40f7f17916 /source/slang/lookup.cpp | |
| parent | e86ab5fff089b90cb037a97d525e819faca1fa73 (diff) | |
| parent | cff418ba55e60a45554a8fb77dea756b8724396f (diff) | |
Merge pull request #365 from csyonghe/extension
Allow extension of a concrete type to implement additional interface
Diffstat (limited to 'source/slang/lookup.cpp')
| -rw-r--r-- | source/slang/lookup.cpp | 14 |
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); |
