google / google/closure-compiler
Redundant unary '+' operators not merged
Open
enhancement
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
asm.js, from a strictly JavaScript perspective, produces a lot of redundant operators. For example, a function that takes a double and returns the same double would be expressed as:
``` javascript
function f(x) {
x = +x; // tells asm.js that the argument is a double
return +x;
}
```
Closure Compiler minifies that into:
``` javascript
function f(a){return+ +a}
```
Of course, the double + operator isn't necessary.
Contributor guide
Assessment
This issue has not been assessed yet.