Bug 152570 - [ES6] Arrow function. Arrow function should raise exception ReferenceError only when access to 'arguments' on top level
Summary: [ES6] Arrow function. Arrow function should raise exception ReferenceError on...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 140855
  Show dependency treegraph
 
Reported: 2015-12-27 13:07 PST by GSkachkov
Modified: 2016-02-17 13:33 PST (History)
5 users (show)

See Also:


Attachments
Patch (3.28 KB, patch)
2016-02-16 11:09 PST, GSkachkov
no flags Details | Formatted Diff | Diff
Patch (3.35 KB, patch)
2016-02-17 11:36 PST, GSkachkov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description GSkachkov 2015-12-27 13:07:13 PST
Arrow function should raise exception ReferenceError only when access to 'arguments' in strict mode in top level arrow function. 

'use strict';

var arr = (error) => {
    if (error) {
       return arguments; 
    } else {
       return [];
    } 
};

arr(false) === [];

arr(true); // ReferenceError
Comment 1 GSkachkov 2016-02-16 11:02:36 PST
It seems that it is not important is this strict mode or not, just arrow function on top level.
Comment 2 GSkachkov 2016-02-16 11:09:45 PST
Created attachment 271441 [details]
Patch

Added tests
Comment 3 Saam Barati 2016-02-16 15:26:57 PST
Comment on attachment 271441 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=271441&action=review

> LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-top-level.js:2
> +// Ignore this test in run-jsc-stress-tests, but run in run-webkit-tests
> +//@ skip

Why?
Comment 4 GSkachkov 2016-02-17 00:10:34 PST
Comment on attachment 271441 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=271441&action=review

>> LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-top-level.js:2
>> +//@ skip
> 
> Why?

jsc always has arguments http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/jsc.cpp#L758 so I skip tests in jsc
But in browser we do not have arguments, so I'm checking only for browser.
Comment 5 Saam Barati 2016-02-17 09:51:53 PST
Comment on attachment 271441 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=271441&action=review

>>> LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-top-level.js:2
>>> +//@ skip
>> 
>> Why?
> 
> jsc always has arguments http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/jsc.cpp#L758 so I skip tests in jsc
> But in browser we do not have arguments, so I'm checking only for browser.

Ok. Can you add that to your comment in the test?
Comment 6 GSkachkov 2016-02-17 11:36:52 PST
Created attachment 271572 [details]
Patch

Fix comments
Comment 7 GSkachkov 2016-02-17 12:05:19 PST
(In reply to comment #5)
> Comment on attachment 271441 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=271441&action=review
> 
> >>> LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-top-level.js:2
> >>> +//@ skip
> >> 
> >> Why?
> > 
> > jsc always has arguments http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/jsc.cpp#L758 so I skip tests in jsc
> > But in browser we do not have arguments, so I'm checking only for browser.
> 
> Ok. Can you add that to your comment in the test?

Fixed
Comment 8 WebKit Commit Bot 2016-02-17 13:33:32 PST
Comment on attachment 271572 [details]
Patch

Clearing flags on attachment: 271572

Committed r196718: <http://trac.webkit.org/changeset/196718>
Comment 9 WebKit Commit Bot 2016-02-17 13:33:35 PST
All reviewed patches have been landed.  Closing bug.