RESOLVED FIXED 209703
[JSC] Public class field should accept "static" as field name
https://bugs.webkit.org/show_bug.cgi?id=209703
Summary [JSC] Public class field should accept "static" as field name
Caio Lima
Reported 2020-03-28 09:28:22 PDT
The following program should be valid, but throws a SyntaxError: ``` class A { super; static; set; get; test() { return "foo"; } } ```
Attachments
Patch (3.19 KB, patch)
2020-03-28 09:59 PDT, Caio Lima
no flags
Patch (3.37 KB, patch)
2020-03-30 07:36 PDT, Caio Lima
no flags
Patch (3.38 KB, patch)
2020-03-30 11:59 PDT, Caio Lima
no flags
Caio Lima
Comment 1 2020-03-28 09:59:24 PDT
Ross Kirsling
Comment 2 2020-03-28 12:56:39 PDT
Comment on attachment 394826 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394826&action=review > Source/JavaScriptCore/ChangeLog:8 > + It allows class fields being created using "static" as identifier. We should link to the spec here but unfortunately the PR is still unmerged. (https://github.com/tc39/ecma262/pull/1668) Since the idea is the same as other identifiers though, I suppose we could at least link to this: https://tc39.es/ecma262/#prod-IdentifierName > Source/JavaScriptCore/parser/Parser.cpp:2880 > + // Reparse "static()" as a method named or "static" as a class field. grammar nit: remove 'named' > JSTests/stress/class-fields-harmony.js:909 > +{ I think Cait brought this file over from V8. Are we sure we want to make arbitrary edits here? (https://github.com/v8/v8/blob/master/test/mjsunit/harmony/public-instance-class-fields.js) Also, perhaps we should add this to test262? Because SM is currently failing too.
Caio Lima
Comment 3 2020-03-30 07:36:58 PDT
Caio Lima
Comment 4 2020-03-30 07:37:31 PDT
Comment on attachment 394826 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394826&action=review Thank you very much for the review! >> Source/JavaScriptCore/ChangeLog:8 >> + It allows class fields being created using "static" as identifier. > > We should link to the spec here but unfortunately the PR is still unmerged. > (https://github.com/tc39/ecma262/pull/1668) > > Since the idea is the same as other identifiers though, I suppose we could at least link to this: > https://tc39.es/ecma262/#prod-IdentifierName I agree. Added. >> JSTests/stress/class-fields-harmony.js:909 >> +{ > > I think Cait brought this file over from V8. Are we sure we want to make arbitrary edits here? > (https://github.com/v8/v8/blob/master/test/mjsunit/harmony/public-instance-class-fields.js) > > Also, perhaps we should add this to test262? Because SM is currently failing too. I'll place this in a separate file to avoid any issue. Test262 were added by https://github.com/tc39/test262/pull/2550
Ross Kirsling
Comment 5 2020-03-30 11:20:50 PDT
Comment on attachment 394916 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394916&action=review > JSTests/ChangeLog:8 > + * stress/class-fields-harmony.js: Oops, looks like the ChangeLog needs to be regenerated.
Caio Lima
Comment 6 2020-03-30 11:59:37 PDT
Caio Lima
Comment 7 2020-03-30 12:00:43 PDT
Comment on attachment 394944 [details] Patch Thank you very much for the review!
EWS
Comment 8 2020-03-30 12:24:18 PDT
Committed r259216: <https://trac.webkit.org/changeset/259216> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394944 [details].
Radar WebKit Bug Importer
Comment 9 2020-03-30 12:25:16 PDT
Note You need to log in before you can comment on or make changes to this bug.