summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-10-29 00:17:33 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2021-10-29 21:29:24 +0300
commit7c96ed8cf3457e76c36d5beae502b0986b5d3c2e (patch)
tree73463f07e6e69f65e0146707b615d451b95e047c /Userland
parent294f2447456b986009a195d77fd3b9f3eeb8c6e3 (diff)
downloadserenity-7c96ed8cf3457e76c36d5beae502b0986b5d3c2e.zip
LibJS: Convert SymbolPrototype functions to ThrowCompletionOr
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp24
-rw-r--r--Userland/Libraries/LibJS/Runtime/SymbolPrototype.h8
2 files changed, 16 insertions, 16 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp
index 6ca8a12354..fb80a16347 100644
--- a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp
@@ -28,10 +28,10 @@ void SymbolPrototype::initialize(GlobalObject& global_object)
auto& vm = this->vm();
Object::initialize(global_object);
u8 attr = Attribute::Writable | Attribute::Configurable;
- define_old_native_function(vm.names.toString, to_string, 0, attr);
- define_old_native_function(vm.names.valueOf, value_of, 0, attr);
- define_old_native_accessor(vm.names.description, description_getter, {}, Attribute::Configurable);
- define_old_native_function(*vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable);
+ define_native_function(vm.names.toString, to_string, 0, attr);
+ define_native_function(vm.names.valueOf, value_of, 0, attr);
+ define_native_accessor(vm.names.description, description_getter, {}, Attribute::Configurable);
+ define_native_function(*vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable);
// 20.4.3.6 Symbol.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Symbol"), Attribute::Configurable);
@@ -53,9 +53,9 @@ static ThrowCompletionOr<Symbol*> this_symbol_value(GlobalObject& global_object,
}
// 20.4.3.2 get Symbol.prototype.description, https://tc39.es/ecma262/#sec-symbol.prototype.description
-JS_DEFINE_OLD_NATIVE_FUNCTION(SymbolPrototype::description_getter)
+JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::description_getter)
{
- auto* symbol = TRY_OR_DISCARD(this_symbol_value(global_object, vm.this_value(global_object)));
+ auto* symbol = TRY(this_symbol_value(global_object, vm.this_value(global_object)));
auto& description = symbol->raw_description();
if (!description.has_value())
return js_undefined();
@@ -63,23 +63,23 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(SymbolPrototype::description_getter)
}
// 20.4.3.3 Symbol.prototype.toString ( ), https://tc39.es/ecma262/#sec-symbol.prototype.tostring
-JS_DEFINE_OLD_NATIVE_FUNCTION(SymbolPrototype::to_string)
+JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::to_string)
{
- auto* symbol = TRY_OR_DISCARD(this_symbol_value(global_object, vm.this_value(global_object)));
+ auto* symbol = TRY(this_symbol_value(global_object, vm.this_value(global_object)));
return js_string(vm, symbol->to_string());
}
// 20.4.3.4 Symbol.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-symbol.prototype.valueof
-JS_DEFINE_OLD_NATIVE_FUNCTION(SymbolPrototype::value_of)
+JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::value_of)
{
- return TRY_OR_DISCARD(this_symbol_value(global_object, vm.this_value(global_object)));
+ return TRY(this_symbol_value(global_object, vm.this_value(global_object)));
}
// 20.4.3.5 Symbol.prototype [ @@toPrimitive ] ( hint ), https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
-JS_DEFINE_OLD_NATIVE_FUNCTION(SymbolPrototype::symbol_to_primitive)
+JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::symbol_to_primitive)
{
// The hint argument is ignored.
- return TRY_OR_DISCARD(this_symbol_value(global_object, vm.this_value(global_object)));
+ return TRY(this_symbol_value(global_object, vm.this_value(global_object)));
}
}
diff --git a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.h b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.h
index 8b17ed0c75..67412ad73b 100644
--- a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.h
+++ b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.h
@@ -19,11 +19,11 @@ public:
virtual ~SymbolPrototype() override;
private:
- JS_DECLARE_OLD_NATIVE_FUNCTION(description_getter);
+ JS_DECLARE_NATIVE_FUNCTION(description_getter);
- JS_DECLARE_OLD_NATIVE_FUNCTION(to_string);
- JS_DECLARE_OLD_NATIVE_FUNCTION(value_of);
- JS_DECLARE_OLD_NATIVE_FUNCTION(symbol_to_primitive);
+ JS_DECLARE_NATIVE_FUNCTION(to_string);
+ JS_DECLARE_NATIVE_FUNCTION(value_of);
+ JS_DECLARE_NATIVE_FUNCTION(symbol_to_primitive);
};
}