google / google/closure-compiler
Variable inlining changes program behavior by ignoring var hoisting
Open
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
test.js:
```
var x = 1;
var z = function () {
var y = x;
var x = 0;
return y;
}();
console.log(z);
```
Observed behavior:
```
$ node test.js
undefined
$ closure-compiler test.js
var x=1,z=function(){return 0}();console.log(z);
$ closure-compiler test.js | node
0
```
Desired behavior: closure-compiler should not change program behavior.
Version:
```
$ closure-compiler --version
Closure Compiler (http://github.com/google/closure-compiler)
Version: 1.0-SNAPSHOT
Built on: 2018-07-18 15:08
```
Contributor guide
Assessment
This issue has not been assessed yet.