From e640fdd395d5f283ae780056bbd95d25bcf4765f Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 24 Feb 2021 09:50:38 +0100 Subject: [PATCH] LibJS: Let RegExpPrototype inherit from Object directly https://tc39.es/ecma262/#sec-properties-of-the-regexp-prototype-object The RegExp prototype object: - is an ordinary object. - is not a RegExp instance and does not have a [[RegExpMatcher]] internal slot or any of the other internal slots of RegExp instance objects. In other words: no need to have RegExpPrototype inherit from RegExpObject (we weren't even calling its initialize()). --- Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp | 2 +- Userland/Libraries/LibJS/Runtime/RegExpPrototype.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index a23174112b..8c7d5b1a74 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -36,7 +36,7 @@ namespace JS { RegExpPrototype::RegExpPrototype(GlobalObject& global_object) - : RegExpObject({}, {}, *global_object.object_prototype()) + : Object(*global_object.object_prototype()) { } diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h index 69b0708ce1..372c64a41c 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h @@ -30,8 +30,8 @@ namespace JS { -class RegExpPrototype final : public RegExpObject { - JS_OBJECT(RegExpPrototype, RegExpObject); +class RegExpPrototype final : public Object { + JS_OBJECT(RegExpPrototype, Object); public: explicit RegExpPrototype(GlobalObject&);