Status: New
Owner: ----

New issue 2679 by [email protected]: Incompatibility to ECMA 5.1 for function calls.
http://code.google.com/p/v8/issues/detail?id=2679

Please see the following example:

function foo() {
    Math.sqrt = Math.exp;
    return 2;
}
console.log(Math.sqrt(2));
console.log(Math.exp(2));
console.log(Math.sqrt(foo()));

Executed on V8 it returns the following values:
1.4142135623730951
7.3890560989306495
7.3890560989306495

But it should be:
1.4142135623730951
7.3890560989306495
1.4142135623730951

ECMA 5.1 clearly states in section (11.2.3 Function Calls):
1. Let ref be the result of evaluating MemberExpression.
2. Let func be GetValue(ref).
3. Let argList be the result of evaluating Arguments, producing an internal list of argument values (see 11.2.4).

So func must be evaluated before the arguments and therefore in this example the old Math.sqrt implementation should get invoked.


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to