diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-11-27 17:14:50 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-27 21:32:41 +0100 |
commit | 3200ff5f4f424b5938d9e7e2a411da5e6963ad1c (patch) | |
tree | 10775ea9d7a4a4193a22eb04662b48e9f5592f01 /Libraries | |
parent | 3db8ced4c7a3b17b3787892748a38824b2ebe95d (diff) | |
download | serenity-3200ff5f4f424b5938d9e7e2a411da5e6963ad1c.zip |
LibJS+js: Rename RegExp.{content => pattern}
The spec talks about it as 'pattern', so let's use that instead.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibJS/Runtime/RegExpConstructor.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/RegExpObject.cpp | 8 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/RegExpObject.h | 8 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/RegExpPrototype.cpp | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/Libraries/LibJS/Runtime/RegExpConstructor.cpp b/Libraries/LibJS/Runtime/RegExpConstructor.cpp index 6e96637d38..a416ee54e4 100644 --- a/Libraries/LibJS/Runtime/RegExpConstructor.cpp +++ b/Libraries/LibJS/Runtime/RegExpConstructor.cpp @@ -58,13 +58,13 @@ Value RegExpConstructor::construct(Function&) auto& vm = this->vm(); if (!vm.argument_count()) return RegExpObject::create(global_object(), "(?:)", ""); - auto contents = vm.argument(0).to_string(global_object()); + auto pattern = vm.argument(0).to_string(global_object()); if (vm.exception()) return {}; auto flags = vm.argument_count() > 1 ? vm.argument(1).to_string(global_object()) : ""; if (vm.exception()) return {}; - return RegExpObject::create(global_object(), contents, flags); + return RegExpObject::create(global_object(), pattern, flags); } } diff --git a/Libraries/LibJS/Runtime/RegExpObject.cpp b/Libraries/LibJS/Runtime/RegExpObject.cpp index 4aab7dff13..6959034f52 100644 --- a/Libraries/LibJS/Runtime/RegExpObject.cpp +++ b/Libraries/LibJS/Runtime/RegExpObject.cpp @@ -33,14 +33,14 @@ namespace JS { -RegExpObject* RegExpObject::create(GlobalObject& global_object, String content, String flags) +RegExpObject* RegExpObject::create(GlobalObject& global_object, String pattern, String flags) { - return global_object.heap().allocate<RegExpObject>(global_object, content, flags, *global_object.regexp_prototype()); + return global_object.heap().allocate<RegExpObject>(global_object, pattern, flags, *global_object.regexp_prototype()); } -RegExpObject::RegExpObject(String content, String flags, Object& prototype) +RegExpObject::RegExpObject(String pattern, String flags, Object& prototype) : Object(prototype) - , m_content(content) + , m_pattern(pattern) , m_flags(flags) { } diff --git a/Libraries/LibJS/Runtime/RegExpObject.h b/Libraries/LibJS/Runtime/RegExpObject.h index e15694bf5a..341b8acf0a 100644 --- a/Libraries/LibJS/Runtime/RegExpObject.h +++ b/Libraries/LibJS/Runtime/RegExpObject.h @@ -35,18 +35,18 @@ class RegExpObject : public Object { JS_OBJECT(RegExpObject, Object); public: - static RegExpObject* create(GlobalObject&, String content, String flags); + static RegExpObject* create(GlobalObject&, String pattern, String flags); - RegExpObject(String content, String flags, Object& prototype); + RegExpObject(String pattern, String flags, Object& prototype); virtual ~RegExpObject() override; - const String& content() const { return m_content; } + const String& pattern() const { return m_pattern; } const String& flags() const { return m_flags; } private: virtual bool is_regexp_object() const override { return true; } - String m_content; + String m_pattern; String m_flags; }; diff --git a/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Libraries/LibJS/Runtime/RegExpPrototype.cpp index 7be563acf5..83f7c9fb8b 100644 --- a/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -66,7 +66,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::to_string) auto* regexp_object = regexp_object_from(vm, global_object); if (!regexp_object) return {}; - return js_string(vm, String::formatted("/{}/{}", regexp_object->content(), regexp_object->flags())); + return js_string(vm, String::formatted("/{}/{}", regexp_object->pattern(), regexp_object->flags())); } } |