mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 16:35:06 +00:00
LibJS/Bytecode: Move object_to_iterator to CommonImplementations
This commit is contained in:
parent
4f8f8b7792
commit
661dbbc83d
3 changed files with 10 additions and 9 deletions
|
@ -535,4 +535,13 @@ Object* iterator_to_object(VM& vm, IteratorRecord iterator)
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IteratorRecord object_to_iterator(VM& vm, Object& object)
|
||||||
|
{
|
||||||
|
return IteratorRecord {
|
||||||
|
.iterator = &MUST(object.get(vm.names.iterator)).as_object(),
|
||||||
|
.next_method = MUST(object.get(vm.names.next)),
|
||||||
|
.done = MUST(object.get(vm.names.done)).as_bool()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,5 +36,6 @@ ThrowCompletionOr<void> create_variable(VM&, DeprecatedFlyString const& name, Op
|
||||||
ThrowCompletionOr<ECMAScriptFunctionObject*> new_class(VM&, ClassExpression const&, Optional<IdentifierTableIndex> const& lhs_name);
|
ThrowCompletionOr<ECMAScriptFunctionObject*> new_class(VM&, ClassExpression const&, Optional<IdentifierTableIndex> const& lhs_name);
|
||||||
ThrowCompletionOr<NonnullGCPtr<Object>> super_call_with_argument_array(VM&, Value argument_array, bool is_synthetic);
|
ThrowCompletionOr<NonnullGCPtr<Object>> super_call_with_argument_array(VM&, Value argument_array, bool is_synthetic);
|
||||||
Object* iterator_to_object(VM&, IteratorRecord);
|
Object* iterator_to_object(VM&, IteratorRecord);
|
||||||
|
IteratorRecord object_to_iterator(VM&, Object&);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -645,15 +645,6 @@ ThrowCompletionOr<void> ImportCall::execute_impl(Bytecode::Interpreter& interpre
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static IteratorRecord object_to_iterator(VM& vm, Object& object)
|
|
||||||
{
|
|
||||||
return IteratorRecord {
|
|
||||||
.iterator = &MUST(object.get(vm.names.iterator)).as_object(),
|
|
||||||
.next_method = MUST(object.get(vm.names.next)),
|
|
||||||
.done = MUST(object.get(vm.names.done)).as_bool()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
ThrowCompletionOr<void> IteratorToArray::execute_impl(Bytecode::Interpreter& interpreter) const
|
ThrowCompletionOr<void> IteratorToArray::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
auto& vm = interpreter.vm();
|
auto& vm = interpreter.vm();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue