RESOLVED FIXED 152575
[ES6] Arrow function syntax. Lexical bind "super" inside of the arrow function in generator.
https://bugs.webkit.org/show_bug.cgi?id=152575
Summary [ES6] Arrow function syntax. Lexical bind "super" inside of the arrow functio...
GSkachkov
Reported 2015-12-28 10:15:06 PST
We need support following case in lexical bind arguments in arrow function: class B { gen() { return 42; } } class A extends B { *gen() { let arr = () => super.gen(); return arr(); } } typeof a.gen().next() === 'array';
Attachments
Patch (7.90 KB, patch)
2016-03-02 23:59 PST, GSkachkov
ysuzuki: review+
GSkachkov
Comment 1 2016-03-02 23:50:42 PST
We are already supporting arguments in arrow function in generators. Modified test example: var result = 'some-value'; class B { gen() { return result; } } class A extends B { *gen() { let arr = () => super.gen(); return arr(); } } var a = new A(); a.gen().next().value === result; //Should be true now it is : SyntaxErorr: super can only be used in a method of a derived class
GSkachkov
Comment 2 2016-03-02 23:59:01 PST
Created attachment 272737 [details] Patch Patch comming
Yusuke Suzuki
Comment 3 2016-03-03 04:54:37 PST
Comment on attachment 272737 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=272737&action=review Nice catch. The approach looks nice. A few nits. > Source/JavaScriptCore/parser/Parser.h:939 > { This function should be renamed to represent the returned scope is not generator's scope. And please note that this function skips arrow function and generator, but it does not skip generator function. > Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js:147 > + } Could you add tests like method() { function *gen() { let arr = () => super.getValue(); arr(); } } This should be SyntaxError.
GSkachkov
Comment 4 2016-03-04 11:18:48 PST
GSkachkov
Comment 5 2016-03-04 11:19:07 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.