The following issues were found
Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp
1 issues
Line: 58
}
// 20.4.2.2 Symbol.for ( key ), https://tc39.es/ecma262/#sec-symbol.for
JS_DEFINE_NATIVE_FUNCTION(SymbolConstructor::for_)
{
String description = vm.argument(0).to_string(global_object);
return global_object.vm().get_global_symbol(description);
}
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp
1 issues
Line: 56
}
// 20.4.3.2 get Symbol.prototype.description, https://tc39.es/ecma262/#sec-symbol.prototype.description
JS_DEFINE_NATIVE_GETTER(SymbolPrototype::description_getter)
{
auto symbol_value = this_symbol_value(global_object, vm.this_value(global_object));
if (vm.exception())
return {};
auto& description = symbol_value.as_symbol().raw_description();
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp
1 issues
Line: 68
}
// 12.3.2 Temporal.Calendar.from ( item ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.from
JS_DEFINE_NATIVE_FUNCTION(CalendarConstructor::from)
{
auto item = vm.argument(0);
// 1. Return ? ToTemporalCalendar(item).
return to_temporal_calendar(global_object, item);
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp
1 issues
Line: 73
}
// 12.4.3 get Temporal.Calendar.prototype.id, https://tc39.es/proposal-temporal/#sec-get-temporal.calendar.prototype.id
JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::id_getter)
{
// 1. Let calendar be the this value.
auto calendar = vm.this_value(global_object);
// 2. Return ? ToString(calendar).
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp
1 issues
Line: 107
}
// 7.2.2 Temporal.Duration.from ( item ), https://tc39.es/proposal-temporal/#sec-temporal.duration.from
JS_DEFINE_NATIVE_FUNCTION(DurationConstructor::from)
{
auto item = vm.argument(0);
// 1. If Type(item) is Object and item has an [[InitializedTemporalDuration]] internal slot, then
if (item.is_object() && is<Duration>(item.as_object())) {
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp
1 issues
Line: 64
}
// 7.3.3 get Temporal.Duration.prototype.years, https://tc39.es/proposal-temporal/#sec-get-temporal.duration.prototype.years
JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::years_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = typed_this(global_object);
if (vm.exception())
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp
1 issues
Line: 74
}
// 8.2.2 Temporal.Instant.from ( item ), https://tc39.es/proposal-temporal/#sec-temporal.instant.from
JS_DEFINE_NATIVE_FUNCTION(InstantConstructor::from)
{
auto item = vm.argument(0);
// 1. If Type(item) is Object and item has an [[InitializedTemporalInstant]] internal slot, then
if (item.is_object() && is<Instant>(item.as_object())) {
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp
1 issues
Line: 59
}
// 8.3.3 get Temporal.Instant.prototype.epochSeconds, https://tc39.es/proposal-temporal/#sec-get-temporal.instant.prototype.epochseconds
JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_seconds_getter)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = typed_this(global_object);
if (vm.exception())
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp
1 issues
Line: 49
}
// 2.2.1 Temporal.Now.timeZone ( ), https://tc39.es/proposal-temporal/#sec-temporal.now.timezone
JS_DEFINE_NATIVE_FUNCTION(Now::time_zone)
{
// 1. Return ! SystemTimeZone().
return system_time_zone(global_object);
}
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp
1 issues
Line: 88
}
// 3.2.2 Temporal.PlainDate.from ( item [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.from
JS_DEFINE_NATIVE_FUNCTION(PlainDateConstructor::from)
{
// 1. Set options to ? GetOptionsObject(options).
auto* options = get_options_object(global_object, vm.argument(1));
if (vm.exception())
return {};
Reported by Cppcheck.