Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using obsolete closure primitives #6

Merged
merged 1 commit into from
Sep 4, 2024
Merged

Stop using obsolete closure primitives #6

merged 1 commit into from
Sep 4, 2024

Conversation

ribrdb
Copy link

@ribrdb ribrdb commented Sep 3, 2024

Closure compiler looks for these based on the resolved name, which no longer works in es6 modules. So we inline what the compiler would do.

  • object.create -> object literal
  • object.createSet -> object literal with true values
  • reflect.objectProperty -> JSCompiler_renameProperty
  • reflect.object => multiple JSCompiler_renameProperty
  • add @pureOrBreakMyCode to reflect.cache calls

There's no documentation for @pureOrBreakMyCode, but Steve Hicks from Google said that's the correct solution and this seems to be the syntax based on google/closure-compiler#4178 It seems like adding this to reflect.cache itself would work if the call is inlined. However I don't know if that always happens, so I also added it at the callsites.

Closure compiler looks for these based on the resolved name, which no longer works in es6 modules. So we inline what the compiler would do.
 - object.create -> object literal
 - object.createSet -> object literal with `true` values
 - reflect.objectProperty -> JSCompiler_renameProperty
 - reflect.object => multiple JSCompiler_renameProperty
 - add @pureOrBreakMyCode to reflect.cache calls

There's no documentation for @pureOrBreakMyCode, but Steve Hicks from Google said that's the correct solution and this seems to be the syntax based on google/closure-compiler#4178
It seems like adding this to reflect.cache itself would work if the call is inlined. However I don't know if that always happens, so I also added it at the callsites.
@ribrdb ribrdb merged commit 4dab78a into es6 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants