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

JSSpecCompiler: Save references to return value and function arguments

This commit is contained in:
Dan Klishch 2023-10-21 21:18:58 -04:00 committed by Andrew Kaster
parent 7f47340c82
commit 5825eaa264
10 changed files with 89 additions and 49 deletions

View file

@ -37,17 +37,26 @@ public:
class FunctionDefinition : public FunctionDeclaration {
public:
FunctionDefinition(StringView name, Tree ast);
FunctionDefinition(StringView name, Tree ast, Vector<StringView>&& argument_names);
void reindex_ssa_variables();
Tree m_ast;
NamedVariableDeclarationRef m_return_value;
Vector<StringView> m_argument_names;
// Populates during reference resolving
// NOTE: The hash map here is ordered since we do not want random hash changes to break our test
// expectations (looking at you, SipHash).
OrderedHashMap<StringView, NamedVariableDeclarationRef> m_local_variables;
Vector<SSAVariableDeclarationRef> m_local_ssa_variables;
// Fields populate during CFG building
NamedVariableDeclarationRef m_named_return_value;
RefPtr<ControlFlowGraph> m_cfg;
// Fields populate during SSA building
Vector<SSAVariableDeclarationRef> m_arguments;
SSAVariableDeclarationRef m_return_value;
Vector<SSAVariableDeclarationRef> m_local_ssa_variables;
};
}