1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:28:11 +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

@ -0,0 +1,25 @@
/*
* Copyright (c) 2023, Dan Klishch <danilklishch@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "Compiler/GenericASTPass.h"
namespace JSSpecCompiler {
// ReferenceResolvingPass collects all variable names declared in the function and replaces
// UnresolvedReference nodes with either SlotName, Variable, or FunctionPointer nodes.
class ReferenceResolvingPass : public GenericASTPass {
public:
using GenericASTPass::GenericASTPass;
protected:
RecursionDecision on_entry(Tree tree) override;
void on_leave(Tree tree) override;
};
}