Comment #1 on issue 435 by [email protected]: The .length property of a function always returns zero
http://code.google.com/p/v8/issues/detail?id=435

The issue still exists. Firefox 3.6.13 pops up 1 as well.

In Chromium, by inspecting 'window.confirm' it seems to be a native function. I tried to implement a simple example where the length of a native function is non-zero, but it didn't work.

Using v8 from trunk, neither setting the 'length' property or setting the argc in the v8::Signature passed to the FunctionTemplate seem to work. The example is attached.

I'm not so familiar with v8 internals, but for functions, the Get() ends up using the AccessorDescriptor 'FunctionLength' (acessors.cc) and calls Accessors::FunctionGetLength, which look in SharedFunctionInfo for the length.

My guess here is that maybe SharedFunctionInfo length is not being set for native functions? (it could use the v8::Signature argc parameter to fill that)

Attachments:
        main.cc  913 bytes

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to