mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 18:05:07 +00:00

It replaces UnresolvedReference with Variable, FunctionPointer, or SlotName nodes. Also, it gathers all variable names from their declarations.
34 lines
684 B
C++
34 lines
684 B
C++
/*
|
|
* Copyright (c) 2023, Dan Klishch <danilklishch@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/HashMap.h>
|
|
#include <AK/RefCounted.h>
|
|
#include <AK/RefPtr.h>
|
|
#include <AK/StringView.h>
|
|
|
|
#include "Forward.h"
|
|
|
|
namespace JSSpecCompiler {
|
|
|
|
class ExecutionContext {
|
|
public:
|
|
HashMap<StringView, FunctionPointerRef> m_functions;
|
|
};
|
|
|
|
class Function : public RefCounted<Function> {
|
|
public:
|
|
Function(ExecutionContext* context, StringView name, Tree ast);
|
|
|
|
ExecutionContext* m_context;
|
|
StringView m_name;
|
|
Tree m_ast;
|
|
VariableDeclarationRef m_return_value;
|
|
HashMap<StringView, VariableDeclarationRef> m_local_variables;
|
|
};
|
|
|
|
}
|