From 920b4d730e04a37e7247ce9a456af39a16705188 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 13 Jun 2021 12:20:21 +0100 Subject: [PATCH] LibJS: Add missing ECMA-262 section/title/URL comments to Map --- Userland/Libraries/LibJS/Runtime/MapConstructor.cpp | 4 ++++ Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp index d216b7e5d6..dfb4fffdbb 100644 --- a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp @@ -21,7 +21,10 @@ void MapConstructor::initialize(GlobalObject& global_object) { auto& vm = this->vm(); NativeFunction::initialize(global_object); + + // 24.1.2.1 Map.prototype, https://tc39.es/ecma262/#sec-map.prototype define_property(vm.names.prototype, global_object.map_prototype(), 0); + define_property(vm.names.length, Value(0), Attribute::Configurable); define_native_accessor(vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); @@ -31,6 +34,7 @@ MapConstructor::~MapConstructor() { } +// 24.1.1.1 Map ( [ iterable ] ), https://tc39.es/ecma262/#sec-map-iterable Value MapConstructor::call() { auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp index 274c0f3751..927b3de61a 100644 --- a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp @@ -31,6 +31,7 @@ MapIteratorPrototype::~MapIteratorPrototype() { } +// 24.1.5.2.1 %MapIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%mapiteratorprototype%.next JS_DEFINE_NATIVE_FUNCTION(MapIteratorPrototype::next) { auto this_value = vm.this_value(global_object);