The following issues were found
Userland/Libraries/LibJS/Runtime/DatePrototype.cpp
1 issues
Line: 109
}
// 21.4.4.2 Date.prototype.getDate ( ), https://tc39.es/ecma262/#sec-date.prototype.getdate
JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_date)
{
auto* this_object = typed_this(vm, global_object);
if (!this_object)
return {};
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp
1 issues
Line: 33
}
// 20.5.3.4 Error.prototype.toString ( ), https://tc39.es/ecma262/#sec-error.prototype.tostring
JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string)
{
auto this_value = vm.this_value(global_object);
if (!this_value.is_object()) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObject, this_value.to_string_without_side_effects());
return {};
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp
1 issues
Line: 48
}
// @STAGE 2@ FinalizationRegistry.prototype.cleanupSome ( [ callback ] ), https://github.com/tc39/proposal-cleanup-some/blob/master/spec/finalization-registry.html
JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::cleanup_some)
{
auto* finalization_registry = typed_this(vm, global_object);
if (!finalization_registry)
return {};
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp
1 issues
Line: 46
}
// 20.2.3.1 Function.prototype.apply ( thisArg, argArray ), https://tc39.es/ecma262/#sec-function.prototype.apply
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply)
{
auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object)
return {};
if (!this_object->is_function()) {
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp
1 issues
Line: 48
}
// 27.5.1.2 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.next
JS_DEFINE_NATIVE_FUNCTION(GeneratorObjectPrototype::next)
{
auto generator_object = typed_this(vm, global_object);
if (!generator_object)
return {};
return generator_object->next_impl(vm, global_object, {});
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
1 issues
Line: 311
#undef __JS_ENUMERATE
}
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::gc)
{
#ifdef __serenity__
dbgln("Forced garbage collection requested!");
#endif
vm.heap().collect_garbage();
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp
1 issues
Line: 31
}
// 27.1.2.1 %IteratorPrototype% [ @@iterator ] ( ), https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::symbol_iterator)
{
auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object)
return {};
return this_object;
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/JSONObject.cpp
1 issues
Line: 129
}
// 25.5.2 JSON.stringify ( value [ , replacer [ , space ] ] ), https://tc39.es/ecma262/#sec-json.stringify
JS_DEFINE_NATIVE_FUNCTION(JSONObject::stringify)
{
if (!vm.argument_count())
return js_undefined();
auto value = vm.argument(0);
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/MapConstructor.cpp
1 issues
Line: 88
}
// 24.1.2.2 get Map [ @@species ], https://tc39.es/ecma262/#sec-get-map-@@species
JS_DEFINE_NATIVE_GETTER(MapConstructor::symbol_species_getter)
{
return vm.this_value(global_object);
}
}
Reported by Cppcheck.
Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp
1 issues
Line: 36
}
// 24.1.5.2.1 %MapIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%mapiteratorprototype%.next
JS_DEFINE_NATIVE_FUNCTION(MapIteratorPrototype::next)
{
auto this_value = vm.this_value(global_object);
if (!this_value.is_object() || !is<MapIterator>(this_value.as_object())) {
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Map Iterator");
return {};
Reported by Cppcheck.