mirror of https://github.com/lukechilds/rollup.git
Rich Harris
8 years ago
committed by
GitHub
30 changed files with 179 additions and 13 deletions
@ -0,0 +1,10 @@ |
|||
export default function isProgramLevel ( node ) { |
|||
do { |
|||
if ( node.type === 'Program' ) { |
|||
return true; |
|||
} |
|||
node = node.parent; |
|||
} while ( node && !/Function/.test( node.type ) ); |
|||
|
|||
return false; |
|||
} |
@ -1,4 +1,3 @@ |
|||
module.exports = { |
|||
skip: true, |
|||
description: 'discards unused function expression assigned to a variable that calls itself and a global' |
|||
}; |
|||
|
@ -0,0 +1,5 @@ |
|||
define(function () { 'use strict'; |
|||
|
|||
|
|||
|
|||
}); |
@ -0,0 +1,2 @@ |
|||
'use strict'; |
|||
|
@ -0,0 +1 @@ |
|||
|
@ -0,0 +1,6 @@ |
|||
(function () { |
|||
'use strict'; |
|||
|
|||
|
|||
|
|||
}()); |
@ -0,0 +1,9 @@ |
|||
(function (global, factory) { |
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : |
|||
typeof define === 'function' && define.amd ? define(factory) : |
|||
(factory()); |
|||
}(this, (function () { 'use strict'; |
|||
|
|||
|
|||
|
|||
}))); |
@ -0,0 +1,3 @@ |
|||
module.exports = { |
|||
description: 'discards unused function expression assigned to a variable that calls itself and has side effects' |
|||
}; |
@ -0,0 +1,5 @@ |
|||
define(function () { 'use strict'; |
|||
|
|||
|
|||
|
|||
}); |
@ -0,0 +1,2 @@ |
|||
'use strict'; |
|||
|
@ -0,0 +1 @@ |
|||
|
@ -0,0 +1,6 @@ |
|||
(function () { |
|||
'use strict'; |
|||
|
|||
|
|||
|
|||
}()); |
@ -0,0 +1,9 @@ |
|||
(function (global, factory) { |
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : |
|||
typeof define === 'function' && define.amd ? define(factory) : |
|||
(factory()); |
|||
}(this, (function () { 'use strict'; |
|||
|
|||
|
|||
|
|||
}))); |
@ -0,0 +1,7 @@ |
|||
var foo = function foo(param) { |
|||
if ( whatever ) { |
|||
foo(param); |
|||
} else { |
|||
param.foo = 1; |
|||
} |
|||
}; |
@ -0,0 +1,3 @@ |
|||
module.exports = { |
|||
description: 'skips a dead branch (h)' |
|||
}; |
@ -0,0 +1,8 @@ |
|||
define(function () { 'use strict'; |
|||
|
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
|||
|
|||
}); |
@ -0,0 +1,6 @@ |
|||
'use strict'; |
|||
|
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
@ -0,0 +1,4 @@ |
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
@ -0,0 +1,9 @@ |
|||
(function () { |
|||
'use strict'; |
|||
|
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
|||
|
|||
}()); |
@ -0,0 +1,12 @@ |
|||
(function (global, factory) { |
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : |
|||
typeof define === 'function' && define.amd ? define(factory) : |
|||
(factory()); |
|||
}(this, (function () { 'use strict'; |
|||
|
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
|||
|
|||
}))); |
@ -0,0 +1,11 @@ |
|||
function bar(umm) { |
|||
umm = hmm(); |
|||
console.log("bar"); |
|||
} |
|||
function hmm() { |
|||
return true; |
|||
} |
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
@ -0,0 +1,3 @@ |
|||
module.exports = { |
|||
description: 'skips a dead branch (h)' |
|||
}; |
@ -0,0 +1,8 @@ |
|||
define(function () { 'use strict'; |
|||
|
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
|||
|
|||
}); |
@ -0,0 +1,6 @@ |
|||
'use strict'; |
|||
|
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
@ -0,0 +1,4 @@ |
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
@ -0,0 +1,9 @@ |
|||
(function () { |
|||
'use strict'; |
|||
|
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
|||
|
|||
}()); |
@ -0,0 +1,12 @@ |
|||
(function (global, factory) { |
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : |
|||
typeof define === 'function' && define.amd ? define(factory) : |
|||
(factory()); |
|||
}(this, (function () { 'use strict'; |
|||
|
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
|||
|
|||
}))); |
@ -0,0 +1,12 @@ |
|||
function bar() { |
|||
var t; |
|||
t = hmm(); |
|||
console.log("bar"); |
|||
} |
|||
function hmm() { |
|||
return true; |
|||
} |
|||
function baz() { |
|||
console.log("baz"); |
|||
} |
|||
baz(); |
Loading…
Reference in new issue