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
Notes: sideshowbarker 2024-07-17 05:01:20 +09:00
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;
}