google / google/closure-compiler
Add compiler pass that converts new+anonymous function to IIFE
Open
internal-issue-created
triage-done
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Now compiler can't optimize constructions like:
```
new function() {
console.log(1);
};
```
As i know this is equal to:
```
(function() {
console.log(1);
return {};
})()
```
which can be simplified to:
```
console.log(1);
```
Is it possible to add similar pass to main optimization loop or update inlineFunctions pass to support it?
Contributor guide
Assessment
This issue has not been assessed yet.