mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibJS: Allow constructing generator from function with null "prototype"
Fixes 4 test262 tests and simplifies some upcoming stuff.
This commit is contained in:
parent
acce880359
commit
d8f5971ddf
Notes:
github-actions[bot]
2025-11-17 22:44:21 +00:00
Author: https://github.com/awesomekling
Commit: d8f5971ddf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6845
5 changed files with 13 additions and 9 deletions
|
|
@ -32,15 +32,17 @@ ThrowCompletionOr<GC::Ref<GeneratorObject>> GeneratorObject::create(Realm& realm
|
|||
static Bytecode::PropertyLookupCache cache;
|
||||
generating_function_prototype = TRY(generating_function->get(vm.names.prototype, cache));
|
||||
}
|
||||
auto generating_function_prototype_object = TRY(generating_function_prototype.to_object(vm));
|
||||
GC::Ptr<Object> generating_function_prototype_object = nullptr;
|
||||
if (!generating_function_prototype.is_nullish())
|
||||
generating_function_prototype_object = MUST(generating_function_prototype.to_object(vm));
|
||||
auto object = realm.create<GeneratorObject>(realm, generating_function_prototype_object, move(execution_context));
|
||||
object->m_generating_function = generating_function;
|
||||
object->m_previous_value = initial_value;
|
||||
return object;
|
||||
}
|
||||
|
||||
GeneratorObject::GeneratorObject(Realm&, Object& prototype, NonnullOwnPtr<ExecutionContext> context, Optional<StringView> generator_brand)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
GeneratorObject::GeneratorObject(Realm& realm, Object* prototype, NonnullOwnPtr<ExecutionContext> context, Optional<StringView> generator_brand)
|
||||
: Object(realm, prototype)
|
||||
, m_execution_context(move(context))
|
||||
, m_generator_brand(move(generator_brand))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue