oxc icon indicating copy to clipboard operation
oxc copied to clipboard

feat(minifier): fold array and object constructors

Open camchenry opened this issue 4 months ago • 4 comments

This will fold expressions like new Object() to {}, and new Array() to []. Based on the closure compiler tests: https://github.com/google/closure-compiler/blob/b7e380b6320a52ce7fbac0334ede00d6a8c92fad/test/com/google/javascript/jscomp/PeepholeSubstituteAlternateSyntaxTest.java#L78.

This is outside my usual area, so feedback is welcome.

NOTE: this was previously a full stack of PRs, but Graphite decided to stop working completely for some reason and only gave me this error when I submitted a PR:

ERROR: Failed to submit PR for 10-02-feat_minifier_fold_single_arg_new_array_expressions:
{}

so I decided to just completely remake this stack and submit as 1 PR.

camchenry avatar Oct 02 '24 19:10 camchenry