RESOLVED FIXED 214297
[JSC] Add support for static private class fields
https://bugs.webkit.org/show_bug.cgi?id=214297
Summary [JSC] Add support for static private class fields
Xan Lopez
Reported 2020-07-14 01:46:13 PDT
Once bug #194095 lands this is very easy to support.
Attachments
Add support for static private fields (11.62 KB, patch)
2020-07-14 01:51 PDT, Xan Lopez
ysuzuki: review-
Add support for static private fields, v2 (13.94 KB, patch)
2020-11-18 01:47 PST, Xan Lopez
no flags
Add support for static private fields, v3 (18.84 KB, patch)
2020-11-19 03:42 PST, Xan Lopez
no flags
Add support for static private fields, v4 (18.84 KB, patch)
2020-11-19 05:06 PST, Xan Lopez
no flags
Add support for static private fields, v4 (18.84 KB, patch)
2020-11-19 05:20 PST, Xan Lopez
no flags
Xan Lopez
Comment 1 2020-07-14 01:51:02 PDT
Created attachment 404216 [details] Add support for static private fields v1
Radar WebKit Bug Importer
Comment 2 2020-07-21 01:47:15 PDT
Yusuke Suzuki
Comment 3 2020-09-23 12:05:44 PDT
Comment on attachment 404216 [details] Add support for static private fields Can you rebase and fix EWS failures?
Xan Lopez
Comment 4 2020-09-23 23:21:57 PDT
(In reply to Yusuke Suzuki from comment #3) > Comment on attachment 404216 [details] > Add support for static private fields > > Can you rebase and fix EWS failures? Hey! Maybe it was not totally clear from the first comment, but this patch needs the static public fields patch in bug #194095 to apply, so can't really fix EWS until that one lands. Just uploaded it for reference, that's why it was not flagged as r?. Will get on it when possible for sure!
Xan Lopez
Comment 5 2020-11-18 01:47:09 PST
Created attachment 414430 [details] Add support for static private fields, v2 v2, rebase, add specific option for static private fields
Caio Lima
Comment 6 2020-11-18 03:03:45 PST
Comment on attachment 414430 [details] Add support for static private fields, v2 View in context: https://bugs.webkit.org/attachment.cgi?id=414430&action=review > JSTests/stress/class-fields-static-private-harmony.js:344 > +*/ I think it's fine to remove it or maybe include a helper function to check `SymbolIsPrivate`. > JSTests/stress/class-fields-static-private-harmony.js:390 > +} Could we include a test that checks if we throw if we try to redefine a private field as static and vice versa? I also miss a test that verifies if instance of a class can't access static fields. Do you mind adding them if they are missing?
Yusuke Suzuki
Comment 7 2020-11-18 20:58:03 PST
Comment on attachment 414430 [details] Add support for static private fields, v2 View in context: https://bugs.webkit.org/attachment.cgi?id=414430&action=review >> JSTests/stress/class-fields-static-private-harmony.js:344 >> +*/ > > I think it's fine to remove it or maybe include a helper function to check `SymbolIsPrivate`. Let's add $vm.isPrivateSymbol and use it here.
Xan Lopez
Comment 8 2020-11-19 03:42:20 PST
Created attachment 414562 [details] Add support for static private fields, v3 v3, support the vm.isPrivateSymbol tests add a couple tests suggested by Caio
Caio Lima
Comment 9 2020-11-19 04:47:06 PST
Comment on attachment 414562 [details] Add support for static private fields, v3 View in context: https://bugs.webkit.org/attachment.cgi?id=414562&action=review > Source/JavaScriptCore/tools/JSDollarVM.cpp:3385 > + Symbol* symbol = asSymbol(callFrame->argument(0)); "asSymbol" don't work if `value.asCell()->isSymbol()` is false. This is going to break whenever we call `isPrivateSymbol(x)` and x is not a Symbol. We should just call `asSymbol` when we are sure that JSValue is a Symbol. I think what you meant to use here is: ``` ... if (!callFrame->argument(0).isSymbol()) ... ```
Xan Lopez
Comment 10 2020-11-19 05:06:20 PST
Created attachment 414565 [details] Add support for static private fields, v4 v4, be more careful with asSymbol() in $vm.isPrivateSymbol()
Xan Lopez
Comment 11 2020-11-19 05:20:56 PST
Created attachment 414568 [details] Add support for static private fields, v4 v4bis, upload the right patch
Caio Lima
Comment 12 2020-11-19 05:30:42 PST
Comment on attachment 414568 [details] Add support for static private fields, v4 LGTM.
Yusuke Suzuki
Comment 13 2020-11-19 12:23:37 PST
Comment on attachment 414568 [details] Add support for static private fields, v4 r=me
EWS
Comment 14 2020-11-19 12:46:12 PST
Committed r270043: <https://trac.webkit.org/changeset/270043> All reviewed patches have been landed. Closing bug and clearing flags on attachment 414568 [details].
Note You need to log in before you can comment on or make changes to this bug.