mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibJS: Don't define the "prototype" property for arrow functions
This commit is contained in:
parent
45ccd9f8d9
commit
1110b1b444
2 changed files with 6 additions and 1 deletions
|
@ -61,7 +61,8 @@ ScriptFunction::ScriptFunction(const FlyString& name, const Statement& body, Vec
|
||||||
, m_function_length(m_function_length)
|
, m_function_length(m_function_length)
|
||||||
, m_is_arrow_function(is_arrow_function)
|
, m_is_arrow_function(is_arrow_function)
|
||||||
{
|
{
|
||||||
define_property("prototype", Object::create_empty(interpreter(), interpreter().global_object()), 0);
|
if (!is_arrow_function)
|
||||||
|
define_property("prototype", Object::create_empty(interpreter(), interpreter().global_object()), 0);
|
||||||
define_native_property("length", length_getter, nullptr, Attribute::Configurable);
|
define_native_property("length", length_getter, nullptr, Attribute::Configurable);
|
||||||
define_native_property("name", name_getter, nullptr, Attribute::Configurable);
|
define_native_property("name", name_getter, nullptr, Attribute::Configurable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,10 @@ try {
|
||||||
assert(foobar.x.y() === foobar);
|
assert(foobar.x.y() === foobar);
|
||||||
assert(foobar.x.z() === foobar.x);
|
assert(foobar.x.z() === foobar.x);
|
||||||
|
|
||||||
|
var Baz = () => {};
|
||||||
|
|
||||||
|
assert(Baz.prototype === undefined);
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
"use strict";
|
"use strict";
|
||||||
assert(isStrictMode());
|
assert(isStrictMode());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue