google / google/closure-compiler
Missed IIFE inlining opportunity
Open
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Given this code:
``` js
(function() {
var $fun;
var $str;
(function() {
$fun = function(a) {
return console.log(a);
};
$str = "hello";
})();
(function() {
$fun($str);
})();
})();
```
It could be inlined all the way to:
``` js
console.log("hello");
```
However, Closure Compiler today only reduces that to:
``` js
(function() {
var a, b;
(function() {
a = function(a) {
return console.log(a);
};
b = "hello";
})();
a(b);
})();
```
Contributor guide
Assessment
This issue has not been assessed yet.