diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-09-14 16:53:08 +0430 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-09-14 20:03:27 +0100 |
commit | f7a68ae998e9a989cbc6e12ed95bc7cb8117632c (patch) | |
tree | 70d9afa1cb0563bc00541733385639969e2d0cb8 /Userland/Libraries | |
parent | fbb31b4519256c119b99fcf5b8bed9dd0acb937b (diff) | |
download | serenity-f7a68ae998e9a989cbc6e12ed95bc7cb8117632c.zip |
LibJS: Mark two JS::Reference functions `const`
These two are inherently const, and the next commit needs to call them
on a const object, so let's just mark them const.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Reference.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Reference.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Reference.cpp b/Userland/Libraries/LibJS/Runtime/Reference.cpp index 414034b12f..bb6d3620b1 100644 --- a/Userland/Libraries/LibJS/Runtime/Reference.cpp +++ b/Userland/Libraries/LibJS/Runtime/Reference.cpp @@ -73,7 +73,7 @@ void Reference::put_value(GlobalObject& global_object, Value value) } } -void Reference::throw_reference_error(GlobalObject& global_object) +void Reference::throw_reference_error(GlobalObject& global_object) const { auto& vm = global_object.vm(); if (!m_name.is_valid()) @@ -83,7 +83,7 @@ void Reference::throw_reference_error(GlobalObject& global_object) } // 6.2.4.5 GetValue ( V ), https://tc39.es/ecma262/#sec-getvalue -Value Reference::get_value(GlobalObject& global_object, bool throw_if_undefined) +Value Reference::get_value(GlobalObject& global_object, bool throw_if_undefined) const { if (is_unresolvable()) { throw_reference_error(global_object); diff --git a/Userland/Libraries/LibJS/Runtime/Reference.h b/Userland/Libraries/LibJS/Runtime/Reference.h index 0dd129e47f..6c663335ee 100644 --- a/Userland/Libraries/LibJS/Runtime/Reference.h +++ b/Userland/Libraries/LibJS/Runtime/Reference.h @@ -98,13 +98,13 @@ public: } void put_value(GlobalObject&, Value); - Value get_value(GlobalObject&, bool throw_if_undefined = true); + Value get_value(GlobalObject&, bool throw_if_undefined = true) const; bool delete_(GlobalObject&); String to_string() const; private: - void throw_reference_error(GlobalObject&); + void throw_reference_error(GlobalObject&) const; BaseType m_base_type { BaseType::Unresolvable }; union { |