google / google/closure-compiler

include collapseProperties into mainOptimizationLoop

Open
#3,205 2 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.