RESOLVED FIXED 212679
Logical Assignment: perform NamedEvaluation of anonymous functions
https://bugs.webkit.org/show_bug.cgi?id=212679
Summary Logical Assignment: perform NamedEvaluation of anonymous functions
Devin Rousso
Reported 2020-06-02 18:52:33 PDT
``` let foo = null; foo ??= function() {}; console.log(foo.name); // should be "foo", but is currently "" ``` which matches the functionality of regular assignments ``` let foo = function() {}; console.log(foo.name); // "foo" ``` Issue: <https://github.com/tc39/proposal-logical-assignment/issues/23> PR: <https://github.com/tc39/proposal-logical-assignment/pull/24>
Attachments
Patch (1.93 KB, patch)
2020-06-02 19:33 PDT, Devin Rousso
no flags
Patch (4.86 KB, patch)
2020-06-05 10:39 PDT, Devin Rousso
no flags
Devin Rousso
Comment 1 2020-06-02 19:33:20 PDT
Ross Kirsling
Comment 2 2020-06-02 19:58:48 PDT
Comment on attachment 400884 [details] Patch r=me as long as the test262 update is incoming.
Joseph Pecoraro
Comment 3 2020-06-03 01:12:17 PDT
Nice. Yeah there should be some test associated with this!
Devin Rousso
Comment 4 2020-06-04 15:24:20 PDT
I manually tested the test262 updates in <https://github.com/tc39/test262/pull/2649> and we passed them all :) @yusukesuzuki suggested that I land this rather than wait for the tests so we can get additional fuzzing coverage. I'm inclined to agree, especially with how simple this change is and the fact that we already pass the tests. Thoughts?
Saam Barati
Comment 5 2020-06-04 15:36:00 PDT
(In reply to Devin Rousso from comment #4) > I manually tested the test262 updates in > <https://github.com/tc39/test262/pull/2649> and we passed them all :) > > @yusukesuzuki suggested that I land this rather than wait for the tests so > we can get additional fuzzing coverage. > > I'm inclined to agree, especially with how simple this change is and the > fact that we already pass the tests. > > Thoughts? Why not just write your own test?
Devin Rousso
Comment 6 2020-06-04 16:35:12 PDT
(In reply to Saam Barati from comment #5) > (In reply to Devin Rousso from comment #4) > > I manually tested the test262 updates in <https://github.com/tc39/test262/pull/2649> and we passed them all :) > > > > @yusukesuzuki suggested that I land this rather than wait for the tests so we can get additional fuzzing coverage. > > > > I'm inclined to agree, especially with how simple this change is and the fact that we already pass the tests. > > > > Thoughts? > > Why not just write your own test? I could, but I would write basically the exact same tests, so I thought it was duplicate effort for no reward (same code being tested twice).
Saam Barati
Comment 7 2020-06-04 16:36:03 PDT
(In reply to Devin Rousso from comment #6) > (In reply to Saam Barati from comment #5) > > (In reply to Devin Rousso from comment #4) > > > I manually tested the test262 updates in <https://github.com/tc39/test262/pull/2649> and we passed them all :) > > > > > > @yusukesuzuki suggested that I land this rather than wait for the tests so we can get additional fuzzing coverage. > > > > > > I'm inclined to agree, especially with how simple this change is and the fact that we already pass the tests. > > > > > > Thoughts? > > > > Why not just write your own test? > > I could, but I would write basically the exact same tests, so I thought it > was duplicate effort for no reward (same code being tested twice). it's helpful to have tests that live outside test262
Yusuke Suzuki
Comment 8 2020-06-04 17:35:39 PDT
(In reply to Devin Rousso from comment #6) > (In reply to Saam Barati from comment #5) > > (In reply to Devin Rousso from comment #4) > > > I manually tested the test262 updates in <https://github.com/tc39/test262/pull/2649> and we passed them all :) > > > > > > @yusukesuzuki suggested that I land this rather than wait for the tests so we can get additional fuzzing coverage. > > > > > > I'm inclined to agree, especially with how simple this change is and the fact that we already pass the tests. > > > > > > Thoughts? > > > > Why not just write your own test? > > I could, but I would write basically the exact same tests, so I thought it > was duplicate effort for no reward (same code being tested twice). I like adding these tests into JSTests/stress/ even if test262 has duplicate ones. test262 is shared with other engines. Due to some mistakes in test262, the coverage in JSC can be regressed. One example is this[1]. test262 putted BigInt to utility file and every tests using this utility file failed in JSC even if the test is not using BigInt. I'm seeing very similar issues in WPT, and I think dedicated JSC stress tests is better in terms of regression testing. [1]: https://github.com/tc39/test262/issues/1252
Devin Rousso
Comment 9 2020-06-05 10:39:20 PDT
Created attachment 401174 [details] Patch Thanks for the feedback @saamyjoon and @yusukesuzuki, I had not considered test262 itself having issues. I've added some test cases to JSTests/stress/logical-assignment-{aoperator-nd,coalesce,or}.js :)
EWS
Comment 10 2020-06-05 12:06:09 PDT
Committed r262638: <https://trac.webkit.org/changeset/262638> All reviewed patches have been landed. Closing bug and clearing flags on attachment 401174 [details].
Radar WebKit Bug Importer
Comment 11 2020-06-05 12:08:05 PDT
Note You need to log in before you can comment on or make changes to this bug.