1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:08:10 +00:00

JSSpecCompiler: Add reference resolving pass

It replaces UnresolvedReference with Variable, FunctionPointer, or
SlotName nodes. Also, it gathers all variable names from their
declarations.
This commit is contained in:
Dan Klishch 2023-08-19 23:17:06 -04:00 committed by Andrew Kaster
parent 326bac19d9
commit 81519975c5
9 changed files with 116 additions and 4 deletions

View file

@ -40,6 +40,16 @@ private:
Variant<Tree*, NullableTree*> m_tree_ptr;
};
class VariableDeclaration : public RefCounted<VariableDeclaration> {
public:
VariableDeclaration(StringView name)
: m_name(name)
{
}
StringView m_name;
};
class Node : public RefCounted<Node> {
public:
virtual ~Node() = default;
@ -380,12 +390,12 @@ protected:
class Variable : public Expression {
public:
Variable(StringView variable_name)
: m_name(variable_name)
Variable(VariableDeclarationRef variable_declaration)
: m_variable_declaration(move(variable_declaration))
{
}
StringView m_name;
VariableDeclarationRef m_variable_declaration;
protected:
void dump_tree(StringBuilder& builder) override;