1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

JSSpecCompiler: Adopt more C++ terminology

Let's not use strange names like `ExecutionContext`, which nobody will
understand in the future.
This commit is contained in:
Dan Klishch 2023-09-19 10:29:57 -04:00 committed by Jelle Raaijmakers
parent 4578004ad6
commit 567b1f6e7c
9 changed files with 51 additions and 21 deletions

View file

@ -15,17 +15,27 @@
namespace JSSpecCompiler {
class ExecutionContext {
public:
HashMap<StringView, FunctionPointerRef> m_functions;
struct TranslationUnit {
FunctionDefinitionRef adopt_function(NonnullRefPtr<FunctionDefinition>&& function);
Vector<NonnullRefPtr<FunctionDefinition>> function_definitions;
HashMap<StringView, FunctionPointerRef> function_index;
};
class Function : public RefCounted<Function> {
class FunctionDeclaration : public RefCounted<FunctionDeclaration> {
public:
Function(ExecutionContext* context, StringView name, Tree ast);
FunctionDeclaration(StringView name);
ExecutionContext* m_context;
virtual ~FunctionDeclaration() = default;
TranslationUnit* m_translation_unit = nullptr;
StringView m_name;
};
class FunctionDefinition : public FunctionDeclaration {
public:
FunctionDefinition(StringView name, Tree ast);
Tree m_ast;
VariableDeclarationRef m_return_value;
HashMap<StringView, VariableDeclarationRef> m_local_variables;