diff --git a/include/Ark/Compiler/NameResolution/StaticScope.hpp b/include/Ark/Compiler/NameResolution/StaticScope.hpp index 996320bf..e2f4d540 100644 --- a/include/Ark/Compiler/NameResolution/StaticScope.hpp +++ b/include/Ark/Compiler/NameResolution/StaticScope.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include namespace Ark::internal @@ -79,6 +80,7 @@ namespace Ark::internal [[nodiscard]] inline virtual bool withPrefix() const { return false; } [[nodiscard]] inline virtual bool isGlob() const { return false; } [[nodiscard]] inline virtual std::string prefix() const { return ""; } + [[nodiscard]] inline virtual bool hasSymbol(const std::string&) const { return false; } private: std::unordered_set m_vars {}; @@ -123,6 +125,7 @@ namespace Ark::internal [[nodiscard]] inline bool withPrefix() const override { return m_with_prefix; } [[nodiscard]] inline bool isGlob() const override { return m_is_glob; } [[nodiscard]] inline std::string prefix() const override { return m_namespace; } + [[nodiscard]] inline bool hasSymbol(const std::string& symbol) const override { return std::ranges::find(m_symbols, symbol) != m_symbols.end(); } private: std::string m_namespace; diff --git a/src/arkreactor/Compiler/NameResolution/ScopeResolver.cpp b/src/arkreactor/Compiler/NameResolution/ScopeResolver.cpp index bb4a89e5..19219ecc 100644 --- a/src/arkreactor/Compiler/NameResolution/ScopeResolver.cpp +++ b/src/arkreactor/Compiler/NameResolution/ScopeResolver.cpp @@ -98,7 +98,7 @@ namespace Ark::internal { if (top && prefix == scope->prefix()) return std::make_pair(true, maybe_fqn); - if (!top && prefix == scope->prefix() && scope->isGlob()) + if (!top && prefix == scope->prefix() && (scope->isGlob() || scope->hasSymbol(name))) return std::make_pair(true, maybe_fqn); top = false; diff --git a/src/arkreactor/Compiler/NameResolution/StaticScope.cpp b/src/arkreactor/Compiler/NameResolution/StaticScope.cpp index c052ab14..4de3dfe2 100644 --- a/src/arkreactor/Compiler/NameResolution/StaticScope.cpp +++ b/src/arkreactor/Compiler/NameResolution/StaticScope.cpp @@ -1,6 +1,5 @@ #include -#include #include #include