google / google/closure-compiler

Redundant unary '+' operators not merged

Open
#504 6 comments 0 reactions 0 assignees View on GitHub
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

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.