1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:27:35 +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:
Andreas Kling 2021-06-25 17:19:01 +02:00
parent bce7fdba81
commit 7b28fa99ba
3 changed files with 13 additions and 11 deletions

View file

@ -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);

View file

@ -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;