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

LibJS/Bytecode: Add codegen for ImportCall

Also moved most of the AST ImportCall::execute() into a helper so we can
share the code.
This commit is contained in:
Andreas Kling 2023-06-24 15:22:16 +02:00
parent eb9298b54e
commit 8a5e71256d
8 changed files with 160 additions and 89 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021-2023, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
*
@ -351,6 +351,25 @@ private:
bool m_is_spread = false;
};
class ImportCall final : public Instruction {
public:
ImportCall(Register specifier, Register options)
: Instruction(Type::ImportCall)
, m_specifier(specifier)
, m_options(options)
{
}
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
void replace_references_impl(Register, Register);
private:
Register m_specifier;
Register m_options;
};
class IteratorToArray final : public Instruction {
public:
IteratorToArray()