1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:08:12 +00:00

JSSpecCompiler: Create FunctionDeclarations for all external functions

This commit is contained in:
Dan Klishch 2023-10-02 13:34:00 -04:00 committed by Andrew Kaster
parent 5338cdd153
commit 7f47340c82
8 changed files with 32 additions and 35 deletions

View file

@ -10,13 +10,18 @@
namespace JSSpecCompiler {
void TranslationUnit::adopt_declaration(NonnullRefPtr<FunctionDeclaration>&& declaration)
{
declaration->m_translation_unit = this;
function_index.set(declaration->m_name, declaration.ptr());
declarations_owner.append(move(declaration));
}
FunctionDefinitionRef TranslationUnit::adopt_function(NonnullRefPtr<FunctionDefinition>&& function)
{
function->m_translation_unit = this;
function_index.set(function->m_name, make_ref_counted<FunctionPointer>(function));
FunctionDefinitionRef result = function.ptr();
function_definitions.append(move(function));
functions_to_compile.append(result);
adopt_declaration(function);
return result;
}