My favorites | Sign in
v8
Project Home Downloads Wiki Issues Source Code Search
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1834: func of CallExpression shoud be get from the MemberExpression before Arguments are evaluated
9 people starred this issue and may be notified of changes. Back to list
 
Reported by teram...@gmail.com, Nov 18, 2011

var obj = {};
obj.foo( obj.foo = function(){ console.log("new func"); } );
// "new func"
obj.foo();
// "new func"

This code shoud throw "obj.foo is not function" exception. But v8 engine [[call]] the value of function which is assigned by Arguments

Function Calls is following step by ECMAScript 5th Specification
http://es5.github.com/#x11.2.3

 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
 4. If Type(func) is not Object, throw a TypeError exception.
 5. If IsCallable(func) is false, throw a TypeError exception.
 6. (snip)

So, func indicates shoud be Undefined and it should throw TypeError by step4.

Nov 21, 2011
Project Member #1 kmillikin@chromium.org
(No comment was entered for this change.)
Status: Assigned
Owner: kmillikin@chromium.org
Nov 21, 2011
Project Member #2 kmillikin@chromium.org
Thanks for the report.  This is a known issue in V8: we are currently compatible with ES 3 and incompatible with ES 5.

Priority is low because there are obvious workarounds and we don't know of any real websites that rely on the ES 5 (not ES 3) behavior of assigning to a function values property during arguments to a call to that property.
Nov 22, 2011
Project Member #3 kmillikin@chromium.org
(No comment was entered for this change.)
Labels: DeliberateSpecViolation
Apr 9, 2013
Project Member #4 verwa...@chromium.org
 Issue 2620  has been merged into this issue.
Apr 10, 2013
Project Member #5 kmillikin@chromium.org
Who would be a good new owner for this?
Status: Accepted
Owner: ---
Cc: rossb...@chromium.org danno@chromium.org
Apr 10, 2013
Project Member #6 danno@chromium.org
(No comment was entered for this change.)
Owner: rossb...@chromium.org
Cc: mstarzinger@chromium.org
Sign in to add a comment

Powered by Google Project Hosting