google / google/closure-compiler
include collapseProperties into mainOptimizationLoop
Open
internal-issue-created
triage-done
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
collapseProperties pass could be usefull with inlineFunctions/inlineVariables. E.g. code:
```
const SERVER_CONFIG = {
url: 'http://example.com',
port: 8080,
}
function getServerConfig() {
return SERVER_CONFIG;
}
const {url, port} = getServerConfig();
console.log(`${url}:${port}`)
```
now it will be transformed to:
```
var a = {url:"http://example.com", port:8080};
console.log(a.url + ":" + a.port);
```
but with collapseProperties in mainOptimizationLoop it can be transformed to:
```
console.log("http://example.com:8080");
```
Contributor guide
Assessment
This issue has not been assessed yet.