RESOLVED FIXED 150115
[ES6] Class method should not declare any variables to upper scope.
https://bugs.webkit.org/show_bug.cgi?id=150115
Summary [ES6] Class method should not declare any variables to upper scope.
Yusuke Suzuki
Reported 2015-10-13 23:03:34 PDT
In the following case, class A { method() { } } the current implementation attempt to declare the variable `method` to the lexical scope for the class `A`'s body.
Attachments
Patch (3.74 KB, patch)
2015-10-13 23:10 PDT, Yusuke Suzuki
no flags
Yusuke Suzuki
Comment 1 2015-10-13 23:04:02 PDT
Copied from https://bugs.webkit.org/show_bug.cgi?id=150089 Current Class expression implementation declares method names as a variable. For example, class A { method() { } } In the above case, we declare a variable `method` in the current implementation. I guess this is the old draft behavior because I can't see any step in the current spec. http://www.ecma-international.org/ecma-262/6.0/#sec-runtime-semantics-definemethod As a result, if we evaluate the following, class A { 1() { } } We attempt to declare the variable `1`. We now wrap the class body with the class lexical scope. However, the lexical scope does not allow us to declare incorrect Identifier variable (like `1`). So assertion is fired.
Yusuke Suzuki
Comment 2 2015-10-13 23:10:32 PDT
Geoffrey Garen
Comment 3 2015-10-14 09:37:30 PDT
Comment on attachment 263060 [details] Patch r=me
WebKit Commit Bot
Comment 4 2015-10-14 22:31:20 PDT
Comment on attachment 263060 [details] Patch Clearing flags on attachment: 263060 Committed r191086: <http://trac.webkit.org/changeset/191086>
WebKit Commit Bot
Comment 5 2015-10-14 22:31:23 PDT
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.