-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[builtins] Builtin function doesnt have constructor property #531
Comments
I think make_builtin_fn should take even global as parameter (apart from parent), just like make_constructor_fn. Then, we can set the constructor field as "Function" (fetched from global). Something like the following: pub fn make_builtin_fn<N>(function: NativeFunctionData, name: N, parent: &Value, length: usize, global: &Value)
where
N: Into<String> {
...
let mut function = Object::function(Function::builtin(Vec::new(), function), Value::null());
let constructor = Object::function(function, global.get_field("Function"));
function.insert_property("constructor", Property::data_descriptor(constructor.into(),
Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::PERMANENT));
...
} @HalidOdat Any thoughts about this? |
Yes. this is good solution, maybe we should accept an @54k1 should I assign you to this issue? |
Yes, that would be a good solution to take Interpreter as the parameter. Thanks for pointing it out. Sure, I can take this up. |
Good catch! I should have looked at the spec first. What we are trying to do is not spec compliant. the We don't have to worry about setting
|
Thanks for pointing this out. |
To Reproduce
[].findIndex.constructor
Expected behavior
Should return a
Function
constructor. Insteadundefined
is returned.Custom functions do have
constructor
property which returns correctly.The text was updated successfully, but these errors were encountered: