diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-08 11:04:01 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-08 11:04:01 -0700 |
commit | 798a2619a5ae3d45cec3a95d93ff3b2513f254a7 (patch) | |
tree | f7c3089c4de092da89be517df006c684e8a7f812 /tools/js-optimizer.js | |
parent | 272e961c063ad4fdb44e61babdfbb0bee200752b (diff) |
remove code after a return in a block of statements
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r-- | tools/js-optimizer.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index 91064de4..0d1e8801 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -2507,6 +2507,8 @@ function eliminate(ast, memSafe) { if (type === 'stat') { node = node[1]; type = node[0]; + } else if (type == 'return' && i < stats.length-1) { + stats.length = i+1; // remove any code after a return } // Check for things that affect elimination if (type in ELIMINATION_SAFE_NODES) { |