summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-25 17:19:01 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-25 17:20:23 +0200
commit7b28fa99bae17a501008124c1fc38250501b9d34 (patch)
tree4420e0d47e2c7560c822778e1756d901287a0a39 /Userland
parentbce7fdba8117a82b832063645210df3fbb8614ea (diff)
downloadserenity-7b28fa99bae17a501008124c1fc38250501b9d34.zip
LibJS: Rename Reference methods to match the spec
- get -> get_value (GetValue in the spec) - put -> put_value (PutValue in the spec) Also add spec links. :^)
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/AST.cpp14
-rw-r--r--Userland/Libraries/LibJS/Runtime/Reference.cpp6
-rw-r--r--Userland/Libraries/LibJS/Runtime/Reference.h4
3 files changed, 13 insertions, 11 deletions
diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp
index edf1480f91..de997c6324 100644
--- a/Userland/Libraries/LibJS/AST.cpp
+++ b/Userland/Libraries/LibJS/AST.cpp
@@ -142,7 +142,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
if (!property_name.is_valid())
return {};
auto reference = Reference { super_base, property_name, super_base };
- callee = reference.get(global_object);
+ callee = reference.get_value(global_object);
if (vm.exception())
return {};
this_value = &vm.this_value(global_object).as_object();
@@ -150,7 +150,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
auto reference = member_expression.to_reference(interpreter, global_object);
if (vm.exception())
return {};
- callee = reference.get(global_object);
+ callee = reference.get_value(global_object);
if (vm.exception())
return {};
this_value = reference.get_this_value();
@@ -708,7 +708,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
if (reference.is_unresolvable()) {
lhs_result = js_undefined();
} else {
- lhs_result = reference.get(global_object, false);
+ lhs_result = reference.get_value(global_object, false);
}
} else {
lhs_result = m_lhs->execute(interpreter, global_object);
@@ -1467,7 +1467,7 @@ Value AssignmentExpression::execute(Interpreter& interpreter, GlobalObject& glob
return {};
}
- reference.put(global_object, rhs_result);
+ reference.put_value(global_object, rhs_result);
if (interpreter.exception())
return {};
@@ -1482,7 +1482,7 @@ Value UpdateExpression::execute(Interpreter& interpreter, GlobalObject& global_o
if (interpreter.exception())
return {};
- auto old_value = reference.get(global_object);
+ auto old_value = reference.get_value(global_object);
if (interpreter.exception())
return {};
old_value = old_value.to_numeric(global_object);
@@ -1507,7 +1507,7 @@ Value UpdateExpression::execute(Interpreter& interpreter, GlobalObject& global_o
VERIFY_NOT_REACHED();
}
- reference.put(global_object, new_value);
+ reference.put_value(global_object, new_value);
if (interpreter.exception())
return {};
return m_prefixed ? new_value : old_value;
@@ -1805,7 +1805,7 @@ Value MemberExpression::execute(Interpreter& interpreter, GlobalObject& global_o
auto reference = to_reference(interpreter, global_object);
if (interpreter.exception())
return {};
- return reference.get(global_object);
+ return reference.get_value(global_object);
}
void MetaProperty::dump(int indent) const
diff --git a/Userland/Libraries/LibJS/Runtime/Reference.cpp b/Userland/Libraries/LibJS/Runtime/Reference.cpp
index 99204c60fc..06160498f6 100644
--- a/Userland/Libraries/LibJS/Runtime/Reference.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Reference.cpp
@@ -11,7 +11,8 @@
namespace JS {
-void Reference::put(GlobalObject& global_object, Value value)
+// 6.2.4.6 PutValue ( V, W ), https://tc39.es/ecma262/#sec-putvalue
+void Reference::put_value(GlobalObject& global_object, Value value)
{
auto& vm = global_object.vm();
@@ -71,7 +72,8 @@ void Reference::throw_reference_error(GlobalObject& global_object)
vm.throw_exception<ReferenceError>(global_object, ErrorType::UnknownIdentifier, m_name.to_string_or_symbol().to_display_string());
}
-Value Reference::get(GlobalObject& global_object, bool throw_if_undefined)
+// 6.2.4.5 GetValue ( V ), https://tc39.es/ecma262/#sec-getvalue
+Value Reference::get_value(GlobalObject& global_object, bool throw_if_undefined)
{
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 32503cb268..5c25181d6b 100644
--- a/Userland/Libraries/LibJS/Runtime/Reference.h
+++ b/Userland/Libraries/LibJS/Runtime/Reference.h
@@ -97,8 +97,8 @@ public:
return !m_this_value.is_empty();
}
- void put(GlobalObject&, Value);
- Value get(GlobalObject&, bool throw_if_undefined = true);
+ void put_value(GlobalObject&, Value);
+ Value get_value(GlobalObject&, bool throw_if_undefined = true);
bool delete_(GlobalObject&);
String to_string() const;