oxc
oxc copied to clipboard
feat(minifier): fold array and object constructors
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.