Status: New
Owner: ----
New issue 462 by flier.lu: the function expression was broken after r3043
(v1.3.15)
http://code.google.com/p/v8/issues/detail?id=462
Before the latest update r3043 (v1.3.15) or recent build, v8 could
compile script includes the function expression, like
function (msg) { return msg.length; }
which could be executed with Script::Run and return a function object.
but in the latest build (v1.3.15), the function must have a name, like
function foo(msg) { return msg.length; }
or
var foo = function(msg) { return msg.length; };
It seems break the FunctionExpression definition in ECMA-262 c13 (p71)
The production FunctionExpression : function ( FormalParameterListopt
) { FunctionBody } is evaluated
as follows:
1. Create a new Function object as specified in 13.2 with parameters
specified by FormalParameterListopt
and body specified by FunctionBody. Pass in the scope chain of the
running execution context as the
Scope.
2. Return Result(2).
The production FunctionExpression : function Identifier (
FormalParameterListopt ) { FunctionBody
} is evaluated as follows:
1. Create a new object as if by the expression new Object().
2. Add Result(1) to the front of the scope chain.
3. Create a new Function object as specified in 13.2 with parameters
specified by FormalParameterListopt
and body specified by FunctionBody. Pass in the scope chain of the
running execution context as the
Scope.
4. Create a property in the object Result(1). The property's name is
Identifier, value is Result(3), and
attributes are { DontDelete, ReadOnly }.
5. Remove Result(1) from the front of the scope chain.
6. Return Result(3).
NOTE
The Identifier in a FunctionExpression can be referenced from inside the
FunctionExpression's FunctionBody
to allow the function to call itself recursively. However, unlike in a
FunctionDeclaration, the Identifier in a
FunctionExpression cannot be referenced from and does not affect the
scope enclosing the
FunctionExpression.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---