google / google/closure-compiler

Dead code elimination doest removes throw after return.

Open
#2,324 1 comment 0 reactions 0 assignees View on GitHub
P3
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Consider this code.

```js
function a() {
return true;
throw Error('Not called!');
}
```

`throw` can be safely removed, but it isn't. Configuration default (compilation_level: 'SIMPLE').

BTW, throw after throw also not removed

```js
function a() {
return 1;
throw Error('Not called 1');
throw Error('Not called 2');
}
```

Compiler leaves both throws in code in that case.

Version: v20170124
Built on: 2017-01-27 11:44

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.