mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
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. :^)
This commit is contained in:
parent
bce7fdba81
commit
7b28fa99ba
3 changed files with 13 additions and 11 deletions
|
@ -142,7 +142,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
|
||||||
if (!property_name.is_valid())
|
if (!property_name.is_valid())
|
||||||
return {};
|
return {};
|
||||||
auto reference = Reference { super_base, property_name, super_base };
|
auto reference = Reference { super_base, property_name, super_base };
|
||||||
callee = reference.get(global_object);
|
callee = reference.get_value(global_object);
|
||||||
if (vm.exception())
|
if (vm.exception())
|
||||||
return {};
|
return {};
|
||||||
this_value = &vm.this_value(global_object).as_object();
|
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);
|
auto reference = member_expression.to_reference(interpreter, global_object);
|
||||||
if (vm.exception())
|
if (vm.exception())
|
||||||
return {};
|
return {};
|
||||||
callee = reference.get(global_object);
|
callee = reference.get_value(global_object);
|
||||||
if (vm.exception())
|
if (vm.exception())
|
||||||
return {};
|
return {};
|
||||||
this_value = reference.get_this_value();
|
this_value = reference.get_this_value();
|
||||||
|
@ -708,7 +708,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
|
||||||
if (reference.is_unresolvable()) {
|
if (reference.is_unresolvable()) {
|
||||||
lhs_result = js_undefined();
|
lhs_result = js_undefined();
|
||||||
} else {
|
} else {
|
||||||
lhs_result = reference.get(global_object, false);
|
lhs_result = reference.get_value(global_object, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lhs_result = m_lhs->execute(interpreter, global_object);
|
lhs_result = m_lhs->execute(interpreter, global_object);
|
||||||
|
@ -1467,7 +1467,7 @@ Value AssignmentExpression::execute(Interpreter& interpreter, GlobalObject& glob
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
reference.put(global_object, rhs_result);
|
reference.put_value(global_object, rhs_result);
|
||||||
if (interpreter.exception())
|
if (interpreter.exception())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
@ -1482,7 +1482,7 @@ Value UpdateExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
||||||
|
|
||||||
if (interpreter.exception())
|
if (interpreter.exception())
|
||||||
return {};
|
return {};
|
||||||
auto old_value = reference.get(global_object);
|
auto old_value = reference.get_value(global_object);
|
||||||
if (interpreter.exception())
|
if (interpreter.exception())
|
||||||
return {};
|
return {};
|
||||||
old_value = old_value.to_numeric(global_object);
|
old_value = old_value.to_numeric(global_object);
|
||||||
|
@ -1507,7 +1507,7 @@ Value UpdateExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
reference.put(global_object, new_value);
|
reference.put_value(global_object, new_value);
|
||||||
if (interpreter.exception())
|
if (interpreter.exception())
|
||||||
return {};
|
return {};
|
||||||
return m_prefixed ? new_value : old_value;
|
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);
|
auto reference = to_reference(interpreter, global_object);
|
||||||
if (interpreter.exception())
|
if (interpreter.exception())
|
||||||
return {};
|
return {};
|
||||||
return reference.get(global_object);
|
return reference.get_value(global_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaProperty::dump(int indent) const
|
void MetaProperty::dump(int indent) const
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
|
|
||||||
namespace JS {
|
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();
|
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());
|
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()) {
|
if (is_unresolvable()) {
|
||||||
throw_reference_error(global_object);
|
throw_reference_error(global_object);
|
||||||
|
|
|
@ -97,8 +97,8 @@ public:
|
||||||
return !m_this_value.is_empty();
|
return !m_this_value.is_empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void put(GlobalObject&, Value);
|
void put_value(GlobalObject&, Value);
|
||||||
Value get(GlobalObject&, bool throw_if_undefined = true);
|
Value get_value(GlobalObject&, bool throw_if_undefined = true);
|
||||||
bool delete_(GlobalObject&);
|
bool delete_(GlobalObject&);
|
||||||
|
|
||||||
String to_string() const;
|
String to_string() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue