Skip to content

Commit

Permalink
add test for mishoo#1448 & mishoo#1450
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed Feb 18, 2017
1 parent d079089 commit 391a25a
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions test/compress/issue-1261.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 49,50 @@ pure_function_calls: {
a.b(), f.g();
}
}

pure_function_calls_toplevel: {
options = {
evaluate : true,
conditionals : true,
comparisons : true,
side_effects : true,
booleans : true,
unused : true,
if_return : true,
join_vars : true,
cascade : true,
negate_iife : true,
toplevel : true,
}
input: {
// pure top-level IIFE will be dropped
// @__PURE__ - comment
(function() {
console.log("iife0");
})();

// pure top-level IIFE assigned to unreferenced var will be dropped
var iife1 = /*@__PURE__*/(function() {
console.log("iife1");
function iife1() {}
return iife1;
})();

(function(){
// pure IIFE in function scope assigned to unreferenced var will be dropped
var iife2 = /*#__PURE__*/(function() {
console.log("iife2");
function iife2() {}
return iife2;
})();
})();

// comment #__PURE__ comment
bar(), baz(), quux();
a.b(), /* @__PURE__ */ c.d.e(), f.g();
}
expect: {
baz(), quux();
a.b(), f.g();
}
}

0 comments on commit 391a25a

Please sign in to comment.