LibJS: Remove GlobalObject from execute() and related AST functions
This is a continuation of the previous four commits. Passing a global object here is largely redundant, we definitely need the interpreter but can get the VM and (later) current active realm from there - and also the global object while we still need it, although I'd like to remove Interpreter::global_object() in the future. This now matches the bytecode interpreter's execute_impl() functions.
This commit is contained in:
parent
e992a9f469
commit
5398dcc55e
Notes:
sideshowbarker
2024-07-17 20:58:35 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/5398dcc55e Pull-request: https://github.com/SerenityOS/serenity/pull/14973 Reviewed-by: https://github.com/davidot ✅
10 changed files with 409 additions and 357 deletions
File diff suppressed because it is too large
Load diff
|
@ -48,7 +48,7 @@ create_ast_node(SourceRange range, Args&&... args)
|
|||
class ASTNode : public RefCounted<ASTNode> {
|
||||
public:
|
||||
virtual ~ASTNode() = default;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const = 0;
|
||||
virtual Completion execute(Interpreter&) const = 0;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const;
|
||||
virtual void dump(int indent) const;
|
||||
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const;
|
||||
|
@ -143,7 +143,7 @@ class IterationStatement : public Statement {
|
|||
public:
|
||||
using Statement::Statement;
|
||||
|
||||
virtual Completion loop_evaluation(Interpreter&, GlobalObject&, Vector<FlyString> const&) const = 0;
|
||||
virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const = 0;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const;
|
||||
|
||||
private:
|
||||
|
@ -156,7 +156,7 @@ public:
|
|||
: Statement(source_range)
|
||||
{
|
||||
}
|
||||
Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
};
|
||||
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
: Statement(source_range)
|
||||
{
|
||||
}
|
||||
Completion execute(Interpreter&, GlobalObject&) const override { return {}; }
|
||||
Completion execute(Interpreter&) const override { return {}; }
|
||||
};
|
||||
|
||||
class ExpressionStatement final : public Statement {
|
||||
|
@ -177,7 +177,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -235,7 +235,7 @@ public:
|
|||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
Completion evaluate_statements(Interpreter& interpreter, GlobalObject& global_object) const;
|
||||
Completion evaluate_statements(Interpreter&) const;
|
||||
|
||||
void add_var_scoped_declaration(NonnullRefPtr<Declaration> variables);
|
||||
void add_lexical_declaration(NonnullRefPtr<Declaration> variables);
|
||||
|
@ -255,7 +255,7 @@ public:
|
|||
ThrowCompletionOr<void> for_each_var_function_declaration_in_reverse_order(ThrowCompletionOrVoidCallback<FunctionDeclaration const&>&& callback) const;
|
||||
ThrowCompletionOr<void> for_each_var_scoped_variable_declaration(ThrowCompletionOrVoidCallback<VariableDeclaration const&>&& callback) const;
|
||||
|
||||
void block_declaration_instantiation(Interpreter&, GlobalObject&, Environment*) const;
|
||||
void block_declaration_instantiation(Interpreter&, Environment*) const;
|
||||
|
||||
ThrowCompletionOr<void> for_each_function_hoistable_with_annexB_extension(ThrowCompletionOrVoidCallback<FunctionDeclaration&>&& callback) const;
|
||||
|
||||
|
@ -336,7 +336,7 @@ public:
|
|||
entry.m_module_request = &m_module_request;
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
|
@ -424,7 +424,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
|
@ -467,7 +467,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
bool is_strict_mode() const { return m_is_strict_mode; }
|
||||
void set_strict_mode() { m_is_strict_mode = true; }
|
||||
|
@ -495,7 +495,7 @@ public:
|
|||
bool has_top_level_await() const { return m_has_top_level_await; }
|
||||
void set_has_top_level_await() { m_has_top_level_await = true; }
|
||||
|
||||
ThrowCompletionOr<void> global_declaration_instantiation(Interpreter&, GlobalObject&, GlobalEnvironment&) const;
|
||||
ThrowCompletionOr<void> global_declaration_instantiation(Interpreter&, GlobalEnvironment&) const;
|
||||
|
||||
private:
|
||||
virtual bool is_program() const override { return true; }
|
||||
|
@ -514,7 +514,7 @@ public:
|
|||
: ScopeNode(source_range)
|
||||
{
|
||||
}
|
||||
Completion execute(Interpreter& interpreter, GlobalObject& object) const override;
|
||||
Completion execute(Interpreter&) const override;
|
||||
};
|
||||
|
||||
class FunctionBody final : public ScopeNode {
|
||||
|
@ -528,7 +528,7 @@ public:
|
|||
|
||||
bool in_strict_mode() const { return m_in_strict_mode; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
private:
|
||||
bool m_in_strict_mode { false };
|
||||
|
@ -540,7 +540,7 @@ public:
|
|||
: ASTNode(source_range)
|
||||
{
|
||||
}
|
||||
virtual ThrowCompletionOr<Reference> to_reference(Interpreter&, GlobalObject&) const;
|
||||
virtual ThrowCompletionOr<Reference> to_reference(Interpreter&) const;
|
||||
};
|
||||
|
||||
class Declaration : public Statement {
|
||||
|
@ -564,7 +564,7 @@ public:
|
|||
: Declaration(source_range)
|
||||
{
|
||||
}
|
||||
Completion execute(Interpreter&, GlobalObject&) const override { return {}; }
|
||||
Completion execute(Interpreter&) const override { return {}; }
|
||||
|
||||
ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&&) const override
|
||||
{
|
||||
|
@ -662,7 +662,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -688,14 +688,14 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
bool has_name() const { return !name().is_empty(); }
|
||||
|
||||
Value instantiate_ordinary_function_expression(Interpreter& interpreter, GlobalObject& global_object, FlyString given_name) const;
|
||||
Value instantiate_ordinary_function_expression(Interpreter&, FlyString given_name) const;
|
||||
|
||||
private:
|
||||
virtual bool is_function_expression() const override { return true; }
|
||||
|
@ -708,7 +708,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Completion execute(Interpreter&, GlobalObject&) const override { return {}; }
|
||||
Completion execute(Interpreter&) const override { return {}; }
|
||||
};
|
||||
|
||||
class YieldExpression final : public Expression {
|
||||
|
@ -723,7 +723,7 @@ public:
|
|||
Expression const* argument() const { return m_argument; }
|
||||
bool is_yield_from() const { return m_is_yield_from; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -740,7 +740,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -758,7 +758,7 @@ public:
|
|||
|
||||
Expression const* argument() const { return m_argument; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -780,7 +780,7 @@ public:
|
|||
Statement const& consequent() const { return *m_consequent; }
|
||||
Statement const* alternate() const { return m_alternate; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -802,8 +802,8 @@ public:
|
|||
Expression const& test() const { return *m_test; }
|
||||
Statement const& body() const { return *m_body; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, GlobalObject&, Vector<FlyString> const&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override;
|
||||
|
@ -825,8 +825,8 @@ public:
|
|||
Expression const& test() const { return *m_test; }
|
||||
Statement const& body() const { return *m_body; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, GlobalObject&, Vector<FlyString> const&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override;
|
||||
|
@ -848,7 +848,7 @@ public:
|
|||
Expression const& object() const { return *m_object; }
|
||||
Statement const& body() const { return *m_body; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -873,8 +873,8 @@ public:
|
|||
Expression const* update() const { return m_update; }
|
||||
Statement const& body() const { return *m_body; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, GlobalObject&, Vector<FlyString> const&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override;
|
||||
|
@ -900,10 +900,10 @@ public:
|
|||
Expression const& rhs() const { return *m_rhs; }
|
||||
Statement const& body() const { return *m_body; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, GlobalObject&, Vector<FlyString> const&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
|
@ -926,10 +926,10 @@ public:
|
|||
Expression const& rhs() const { return *m_rhs; }
|
||||
Statement const& body() const { return *m_body; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, GlobalObject&, Vector<FlyString> const&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
|
@ -948,8 +948,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, GlobalObject&, Vector<FlyString> const&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
|
@ -993,7 +993,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1019,7 +1019,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1067,7 +1067,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
private:
|
||||
|
@ -1090,7 +1090,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1106,7 +1106,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1122,7 +1122,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1139,7 +1139,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1160,7 +1160,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
};
|
||||
|
@ -1177,7 +1177,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1206,9 +1206,9 @@ public:
|
|||
FlyString const& string() const { return m_string; }
|
||||
void set_lexically_bound_function_argument_index(size_t index) { m_lexically_bound_function_argument = index; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual ThrowCompletionOr<Reference> to_reference(Interpreter&, GlobalObject&) const override;
|
||||
virtual ThrowCompletionOr<Reference> to_reference(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
private:
|
||||
|
@ -1229,7 +1229,7 @@ public:
|
|||
|
||||
FlyString const& string() const { return m_string; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
virtual bool is_private_identifier() const override { return true; }
|
||||
|
@ -1246,7 +1246,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
enum class ElementKind {
|
||||
Method,
|
||||
|
@ -1259,7 +1259,7 @@ public:
|
|||
|
||||
// We use the Completion also as a ClassStaticBlockDefinition Record.
|
||||
using ClassValue = Variant<ClassFieldDefinition, Completion, PrivateElement>;
|
||||
virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, GlobalObject&, Object& home_object) const = 0;
|
||||
virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, Object& home_object) const = 0;
|
||||
|
||||
virtual Optional<FlyString> private_bound_identifier() const { return {}; };
|
||||
|
||||
|
@ -1288,7 +1288,7 @@ public:
|
|||
virtual ElementKind class_element_kind() const override { return ElementKind::Method; }
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, GlobalObject&, Object& home_object) const override;
|
||||
virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, Object& home_object) const override;
|
||||
virtual Optional<FlyString> private_bound_identifier() const override;
|
||||
|
||||
private:
|
||||
|
@ -1315,7 +1315,7 @@ public:
|
|||
virtual ElementKind class_element_kind() const override { return ElementKind::Field; }
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter& interpreter, GlobalObject& object, Object& home_object) const override;
|
||||
virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, Object& home_object) const override;
|
||||
virtual Optional<FlyString> private_bound_identifier() const override;
|
||||
|
||||
private:
|
||||
|
@ -1334,7 +1334,7 @@ public:
|
|||
}
|
||||
|
||||
virtual ElementKind class_element_kind() const override { return ElementKind::StaticInitializer; }
|
||||
virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, GlobalObject&, Object& home_object) const override;
|
||||
virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, Object& home_object) const override;
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
|
@ -1350,7 +1350,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
virtual bool is_super_expression() const override { return true; }
|
||||
|
@ -1372,13 +1372,13 @@ public:
|
|||
String const& source_text() const { return m_source_text; }
|
||||
RefPtr<FunctionExpression> constructor() const { return m_constructor; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
bool has_name() const { return !m_name.is_empty(); }
|
||||
|
||||
ThrowCompletionOr<ECMAScriptFunctionObject*> class_definition_evaluation(Interpreter& interpreter, GlobalObject& global_object, FlyString const& binding_name = {}, FlyString const& class_name = {}) const;
|
||||
ThrowCompletionOr<ECMAScriptFunctionObject*> class_definition_evaluation(Interpreter&, FlyString const& binding_name = {}, FlyString const& class_name = {}) const;
|
||||
|
||||
private:
|
||||
virtual bool is_class_expression() const override { return true; }
|
||||
|
@ -1398,7 +1398,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1424,7 +1424,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
|
@ -1437,7 +1437,7 @@ public:
|
|||
: Expression(source_range)
|
||||
{
|
||||
}
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
};
|
||||
|
@ -1456,7 +1456,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1465,7 +1465,7 @@ public:
|
|||
protected:
|
||||
virtual bool is_call_expression() const override { return true; }
|
||||
|
||||
Completion throw_type_error_for_callee(Interpreter&, GlobalObject&, Value callee_value, StringView call_type) const;
|
||||
Completion throw_type_error_for_callee(Interpreter&, Value callee_value, StringView call_type) const;
|
||||
|
||||
NonnullRefPtr<Expression> m_callee;
|
||||
Vector<Argument> const m_arguments;
|
||||
|
@ -1475,7 +1475,7 @@ private:
|
|||
Value this_value;
|
||||
Value callee;
|
||||
};
|
||||
ThrowCompletionOr<ThisAndCallee> compute_this_and_callee(Interpreter&, GlobalObject&, Reference const&) const;
|
||||
ThrowCompletionOr<ThisAndCallee> compute_this_and_callee(Interpreter&, Reference const&) const;
|
||||
};
|
||||
|
||||
class NewExpression final : public CallExpression {
|
||||
|
@ -1485,7 +1485,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
virtual bool is_new_expression() const override { return true; }
|
||||
};
|
||||
|
@ -1514,7 +1514,7 @@ public:
|
|||
VERIFY(is_part_of_synthetic_constructor == IsPartOfSyntheticConstructor::Yes);
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
|
@ -1559,7 +1559,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1584,7 +1584,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1627,7 +1627,7 @@ public:
|
|||
auto& target() const { return m_target; }
|
||||
Expression const* init() const { return m_init; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
|
@ -1646,7 +1646,7 @@ public:
|
|||
|
||||
DeclarationKind declaration_kind() const { return m_declaration_kind; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1695,7 +1695,7 @@ public:
|
|||
bool is_method() const { return m_is_method; }
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
private:
|
||||
NonnullRefPtr<Expression> m_key;
|
||||
|
@ -1713,7 +1713,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1736,7 +1736,7 @@ public:
|
|||
|
||||
Vector<RefPtr<Expression>> const& elements() const { return m_elements; }
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1761,7 +1761,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1782,11 +1782,11 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
ThrowCompletionOr<Value> get_template_object(Interpreter& interpreter, GlobalObject& global_object) const;
|
||||
ThrowCompletionOr<Value> get_template_object(Interpreter&) const;
|
||||
|
||||
private:
|
||||
NonnullRefPtr<Expression> const m_tag;
|
||||
|
@ -1804,9 +1804,9 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual ThrowCompletionOr<Reference> to_reference(Interpreter&, GlobalObject&) const override;
|
||||
virtual ThrowCompletionOr<Reference> to_reference(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
bool is_computed() const { return m_computed; }
|
||||
|
@ -1858,8 +1858,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter& interpreter, GlobalObject& global_object) const override;
|
||||
virtual ThrowCompletionOr<JS::Reference> to_reference(Interpreter& interpreter, GlobalObject& global_object) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual ThrowCompletionOr<JS::Reference> to_reference(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
|
@ -1867,7 +1867,7 @@ private:
|
|||
JS::Reference reference;
|
||||
Value value;
|
||||
};
|
||||
ThrowCompletionOr<ReferenceAndValue> to_reference_and_value(Interpreter&, GlobalObject&) const;
|
||||
ThrowCompletionOr<ReferenceAndValue> to_reference_and_value(Interpreter&) const;
|
||||
|
||||
NonnullRefPtr<Expression> m_base;
|
||||
Vector<Reference> m_references;
|
||||
|
@ -1886,7 +1886,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
|
@ -1904,7 +1904,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
private:
|
||||
virtual bool is_import_call() const override { return true; }
|
||||
|
@ -1924,7 +1924,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
private:
|
||||
|
@ -1953,7 +1953,7 @@ public:
|
|||
BlockStatement const& body() const { return m_body; }
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
private:
|
||||
Variant<FlyString, NonnullRefPtr<BindingPattern>> m_parameter;
|
||||
|
@ -1975,7 +1975,7 @@ public:
|
|||
BlockStatement const* finalizer() const { return m_finalizer; }
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
private:
|
||||
|
@ -1995,7 +1995,7 @@ public:
|
|||
Expression const& argument() const { return m_argument; }
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
private:
|
||||
|
@ -2013,7 +2013,7 @@ public:
|
|||
Expression const* test() const { return m_test; }
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
private:
|
||||
RefPtr<Expression> m_test;
|
||||
|
@ -2028,11 +2028,11 @@ public:
|
|||
}
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const;
|
||||
|
||||
Completion execute_impl(Interpreter&, GlobalObject&) const;
|
||||
Completion execute_impl(Interpreter&) const;
|
||||
void add_case(NonnullRefPtr<SwitchCase> switch_case) { m_cases.append(move(switch_case)); }
|
||||
|
||||
private:
|
||||
|
@ -2048,7 +2048,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
|
||||
FlyString const& target_label() const { return m_target_label; }
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
@ -2065,7 +2065,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
|
||||
FlyString const& target_label() const { return m_target_label; }
|
||||
|
@ -2081,7 +2081,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override;
|
||||
virtual Completion execute(Interpreter&) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
|
||||
};
|
||||
|
||||
|
@ -2094,8 +2094,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual Completion execute(Interpreter&, GlobalObject&) const override { return m_value; }
|
||||
virtual ThrowCompletionOr<Reference> to_reference(Interpreter&, GlobalObject&) const override { return m_reference; }
|
||||
virtual Completion execute(Interpreter&) const override { return m_value; }
|
||||
virtual ThrowCompletionOr<Reference> to_reference(Interpreter&) const override { return m_reference; }
|
||||
|
||||
private:
|
||||
Reference m_reference;
|
||||
|
|
|
@ -773,7 +773,7 @@ ThrowCompletionOr<void> NewClass::execute_impl(Bytecode::Interpreter& interprete
|
|||
auto name = m_class_expression.name();
|
||||
auto scope = interpreter.ast_interpreter_scope();
|
||||
auto& ast_interpreter = scope.interpreter();
|
||||
auto class_object = TRY(m_class_expression.class_definition_evaluation(ast_interpreter, interpreter.global_object(), name, name.is_null() ? ""sv : name));
|
||||
auto class_object = TRY(m_class_expression.class_definition_evaluation(ast_interpreter, name, name.is_null() ? ""sv : name));
|
||||
interpreter.accumulator() = class_object;
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -80,13 +80,13 @@ ThrowCompletionOr<Value> Interpreter::run(Script& script_record)
|
|||
auto& script = script_record.parse_node();
|
||||
|
||||
// 12. Let result be Completion(GlobalDeclarationInstantiation(script, globalEnv)).
|
||||
auto instantiation_result = script.global_declaration_instantiation(*this, global_object, global_environment);
|
||||
auto instantiation_result = script.global_declaration_instantiation(*this, global_environment);
|
||||
Completion result = instantiation_result.is_throw_completion() ? instantiation_result.throw_completion() : normal_completion({});
|
||||
|
||||
// 13. If result.[[Type]] is normal, then
|
||||
if (result.type() == Completion::Type::Normal) {
|
||||
// a. Set result to the result of evaluating script.
|
||||
result = script.execute(*this, global_object);
|
||||
result = script.execute(*this);
|
||||
}
|
||||
|
||||
// 14. If result.[[Type]] is normal and result.[[Value]] is empty, then
|
||||
|
|
|
@ -712,7 +712,7 @@ ThrowCompletionOr<Value> perform_eval(GlobalObject& global_object, Value x, Call
|
|||
eval_result = result;
|
||||
} else {
|
||||
auto& ast_interpreter = vm.interpreter();
|
||||
eval_result = TRY(program->execute(ast_interpreter, global_object));
|
||||
eval_result = TRY(program->execute(ast_interpreter));
|
||||
}
|
||||
|
||||
// 30. If result.[[Type]] is normal and result.[[Value]] is empty, then
|
||||
|
|
|
@ -451,7 +451,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia
|
|||
// Resulting value is in the accumulator.
|
||||
argument_value = value_and_frame.frame->registers.at(0);
|
||||
} else if (interpreter) {
|
||||
argument_value = TRY(parameter.default_value->execute(*interpreter, global_object)).release_value();
|
||||
argument_value = TRY(parameter.default_value->execute(*interpreter)).release_value();
|
||||
}
|
||||
} else {
|
||||
argument_value = js_undefined();
|
||||
|
@ -730,7 +730,7 @@ void async_block_start(VM& vm, NonnullRefPtr<Statement> const& async_body, Promi
|
|||
// 3. Set the code evaluation state of asyncContext such that when evaluation is resumed for that execution context the following steps will be performed:
|
||||
auto* execution_steps = NativeFunction::create(realm, "", [&async_body, &promise_capability](auto& vm, auto& global_object) -> ThrowCompletionOr<Value> {
|
||||
// a. Let result be the result of evaluating asyncBody.
|
||||
auto result = async_body->execute(vm.interpreter(), global_object);
|
||||
auto result = async_body->execute(vm.interpreter());
|
||||
|
||||
// b. Assert: If we return here, the async function either threw an exception or performed an implicit or explicit return; all awaiting is done.
|
||||
|
||||
|
@ -862,7 +862,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
|||
TRY(function_declaration_instantiation(ast_interpreter));
|
||||
|
||||
// 2. Return the result of evaluating FunctionStatementList.
|
||||
return m_ecmascript_code->execute(*ast_interpreter, global_object);
|
||||
return m_ecmascript_code->execute(*ast_interpreter);
|
||||
}
|
||||
// AsyncFunctionBody : FunctionBody
|
||||
else if (m_kind == FunctionKind::Async) {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/Lexer.h>
|
||||
#include <LibJS/Parser.h>
|
||||
#include <LibJS/Runtime/AbstractOperations.h>
|
||||
|
@ -173,9 +174,12 @@ ThrowCompletionOr<Value> perform_shadow_realm_eval(GlobalObject& global_object,
|
|||
|
||||
// 17. If result.[[Type]] is normal, then
|
||||
if (!eval_result.is_throw_completion()) {
|
||||
// FIXME: Remove once everything uses the VM's current realm.
|
||||
auto eval_realm_interpreter = Interpreter::create_with_existing_realm(eval_realm);
|
||||
|
||||
// TODO: Optionally use bytecode interpreter?
|
||||
// a. Set result to the result of evaluating body.
|
||||
result = program->execute(vm.interpreter(), eval_realm.global_object());
|
||||
result = program->execute(*eval_realm_interpreter);
|
||||
}
|
||||
|
||||
// 18. If result.[[Type]] is normal and result.[[Value]] is empty, then
|
||||
|
|
|
@ -235,23 +235,23 @@ Symbol* VM::get_global_symbol(String const& description)
|
|||
return new_global_symbol;
|
||||
}
|
||||
|
||||
ThrowCompletionOr<Value> VM::named_evaluation_if_anonymous_function(GlobalObject& global_object, ASTNode const& expression, FlyString const& name)
|
||||
ThrowCompletionOr<Value> VM::named_evaluation_if_anonymous_function(ASTNode const& expression, FlyString const& name)
|
||||
{
|
||||
// 8.3.3 Static Semantics: IsAnonymousFunctionDefinition ( expr ), https://tc39.es/ecma262/#sec-isanonymousfunctiondefinition
|
||||
// And 8.3.5 Runtime Semantics: NamedEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-namedevaluation
|
||||
if (is<FunctionExpression>(expression)) {
|
||||
auto& function = static_cast<FunctionExpression const&>(expression);
|
||||
if (!function.has_name()) {
|
||||
return function.instantiate_ordinary_function_expression(interpreter(), global_object, name);
|
||||
return function.instantiate_ordinary_function_expression(interpreter(), name);
|
||||
}
|
||||
} else if (is<ClassExpression>(expression)) {
|
||||
auto& class_expression = static_cast<ClassExpression const&>(expression);
|
||||
if (!class_expression.has_name()) {
|
||||
return TRY(class_expression.class_definition_evaluation(interpreter(), global_object, {}, name));
|
||||
return TRY(class_expression.class_definition_evaluation(interpreter(), {}, name));
|
||||
}
|
||||
}
|
||||
|
||||
return TRY(expression.execute(interpreter(), global_object)).release_value();
|
||||
return TRY(expression.execute(interpreter())).release_value();
|
||||
}
|
||||
|
||||
// 13.15.5.2 Runtime Semantics: DestructuringAssignmentEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-destructuringassignmentevaluation
|
||||
|
@ -327,7 +327,7 @@ ThrowCompletionOr<void> VM::property_binding_initialization(BindingPattern const
|
|||
if (auto identifier_ptr = property.name.get_pointer<NonnullRefPtr<Identifier>>()) {
|
||||
assignment_target = TRY(resolve_binding((*identifier_ptr)->string(), environment));
|
||||
} else if (auto member_ptr = property.alias.get_pointer<NonnullRefPtr<MemberExpression>>()) {
|
||||
assignment_target = TRY((*member_ptr)->to_reference(interpreter(), global_object));
|
||||
assignment_target = TRY((*member_ptr)->to_reference(interpreter()));
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ ThrowCompletionOr<void> VM::property_binding_initialization(BindingPattern const
|
|||
return identifier->string();
|
||||
},
|
||||
[&](NonnullRefPtr<Expression> const& expression) -> ThrowCompletionOr<PropertyKey> {
|
||||
auto result = TRY(expression->execute(interpreter(), global_object)).release_value();
|
||||
auto result = TRY(expression->execute(interpreter())).release_value();
|
||||
return result.to_property_key(global_object);
|
||||
}));
|
||||
|
||||
|
@ -361,7 +361,7 @@ ThrowCompletionOr<void> VM::property_binding_initialization(BindingPattern const
|
|||
|
||||
auto value_to_assign = TRY(object->get(name));
|
||||
if (property.initializer && value_to_assign.is_undefined()) {
|
||||
value_to_assign = TRY(named_evaluation_if_anonymous_function(global_object, *property.initializer, identifier.string()));
|
||||
value_to_assign = TRY(named_evaluation_if_anonymous_function(*property.initializer, identifier.string()));
|
||||
}
|
||||
|
||||
if (!environment)
|
||||
|
@ -378,15 +378,15 @@ ThrowCompletionOr<void> VM::property_binding_initialization(BindingPattern const
|
|||
},
|
||||
[&](NonnullRefPtr<BindingPattern> const&) -> ThrowCompletionOr<Optional<Reference>> { return Optional<Reference> {}; },
|
||||
[&](NonnullRefPtr<MemberExpression> const& member_expression) -> ThrowCompletionOr<Optional<Reference>> {
|
||||
return TRY(member_expression->to_reference(interpreter(), global_object));
|
||||
return TRY(member_expression->to_reference(interpreter()));
|
||||
}));
|
||||
|
||||
auto value_to_assign = TRY(object->get(name));
|
||||
if (property.initializer && value_to_assign.is_undefined()) {
|
||||
if (auto* identifier_ptr = property.alias.get_pointer<NonnullRefPtr<Identifier>>())
|
||||
value_to_assign = TRY(named_evaluation_if_anonymous_function(global_object, *property.initializer, (*identifier_ptr)->string()));
|
||||
value_to_assign = TRY(named_evaluation_if_anonymous_function(*property.initializer, (*identifier_ptr)->string()));
|
||||
else
|
||||
value_to_assign = TRY(property.initializer->execute(interpreter(), global_object)).release_value();
|
||||
value_to_assign = TRY(property.initializer->execute(interpreter())).release_value();
|
||||
}
|
||||
|
||||
if (auto* binding_ptr = property.alias.get_pointer<NonnullRefPtr<BindingPattern>>()) {
|
||||
|
@ -421,7 +421,7 @@ ThrowCompletionOr<void> VM::iterator_binding_initialization(BindingPattern const
|
|||
},
|
||||
[&](NonnullRefPtr<BindingPattern> const&) -> ThrowCompletionOr<Optional<Reference>> { return Optional<Reference> {}; },
|
||||
[&](NonnullRefPtr<MemberExpression> const& member_expression) -> ThrowCompletionOr<Optional<Reference>> {
|
||||
return TRY(member_expression->to_reference(interpreter(), global_object));
|
||||
return TRY(member_expression->to_reference(interpreter()));
|
||||
}));
|
||||
|
||||
// BindingRestElement : ... BindingIdentifier
|
||||
|
@ -520,9 +520,9 @@ ThrowCompletionOr<void> VM::iterator_binding_initialization(BindingPattern const
|
|||
if (value.is_undefined() && entry.initializer) {
|
||||
VERIFY(!entry.is_rest);
|
||||
if (auto* identifier_ptr = entry.alias.get_pointer<NonnullRefPtr<Identifier>>())
|
||||
value = TRY(named_evaluation_if_anonymous_function(global_object, *entry.initializer, (*identifier_ptr)->string()));
|
||||
value = TRY(named_evaluation_if_anonymous_function(*entry.initializer, (*identifier_ptr)->string()));
|
||||
else
|
||||
value = TRY(entry.initializer->execute(interpreter(), global_object)).release_value();
|
||||
value = TRY(entry.initializer->execute(interpreter())).release_value();
|
||||
}
|
||||
|
||||
if (auto* binding_ptr = entry.alias.get_pointer<NonnullRefPtr<BindingPattern>>()) {
|
||||
|
|
|
@ -203,7 +203,7 @@ public:
|
|||
ThrowCompletionOr<void> binding_initialization(FlyString const& target, Value value, Environment* environment, GlobalObject& global_object);
|
||||
ThrowCompletionOr<void> binding_initialization(NonnullRefPtr<BindingPattern> const& target, Value value, Environment* environment, GlobalObject& global_object);
|
||||
|
||||
ThrowCompletionOr<Value> named_evaluation_if_anonymous_function(GlobalObject& global_object, ASTNode const& expression, FlyString const& name);
|
||||
ThrowCompletionOr<Value> named_evaluation_if_anonymous_function(ASTNode const& expression, FlyString const& name);
|
||||
|
||||
void save_execution_context_stack();
|
||||
void restore_execution_context_stack();
|
||||
|
|
|
@ -660,7 +660,7 @@ ThrowCompletionOr<void> SourceTextModule::execute_module(VM& vm, Optional<Promis
|
|||
TRY(vm.push_execution_context(module_context, realm().global_object()));
|
||||
|
||||
// c. Let result be the result of evaluating module.[[ECMAScriptCode]].
|
||||
auto result = m_ecmascript_code->execute(vm.interpreter(), realm().global_object());
|
||||
auto result = m_ecmascript_code->execute(vm.interpreter());
|
||||
|
||||
// d. Suspend moduleContext and remove it from the execution context stack.
|
||||
vm.pop_execution_context();
|
||||
|
|
Loading…
Add table
Reference in a new issue