11#ifndef ARK_COMPILER_NAMERESOLUTIONPASS_HPP
12#define ARK_COMPILER_NAMERESOLUTIONPASS_HPP
16#include <unordered_set>
37 void process(
const Node& ast)
override;
43 [[nodiscard]]
const Node& ast()
const noexcept override;
51 std::string addDefinedSymbol(
const std::string& sym,
bool is_mutable);
66 void visit(
Node& node,
bool register_declarations);
74 void visitKeyword(
Node& node,
Keyword keyword,
bool register_declarations);
82 void addSymbolNode(
const Node& symbol,
const std::string& old_name =
"");
91 [[nodiscard]]
bool mayBeFromPlugin(
const std::string& name)
const noexcept;
93 std::string updateSymbolWithFullyQualifiedName(
Node& symbol);
99 void checkForUndefinedSymbol()
const;
107 [[nodiscard]] std::string offerSuggestion(
const std::string& str)
const;
Interface for a compiler pass (take in an AST, output an AST)
Handle scope resolution at compile time.
std::vector< std::string > m_plugin_names
std::unordered_set< std::string > m_language_symbols
Precomputed set of language symbols that can't be used to define variables.
std::unordered_set< std::string > m_defined_symbols
ScopeResolver m_scope_resolver
std::vector< Node > m_symbol_nodes
A node of an Abstract Syntax Tree for ArkScript.
An interface to describe compiler passes.
Keyword
The different keywords available.