mirror of https://github.com/lukechilds/rollup.git
kzc
8 years ago
14 changed files with 99 additions and 4 deletions
@ -1,7 +1,7 @@ |
|||
import Node from '../Node.js'; |
|||
|
|||
export default class ThrowStatement extends Node { |
|||
hasEffects ( scope ) { |
|||
return scope.findLexicalBoundary().isModuleScope; // TODO should this just be `true`? probably...
|
|||
hasEffects () { |
|||
return true; |
|||
} |
|||
} |
|||
|
@ -1,5 +1,13 @@ |
|||
'use strict'; |
|||
|
|||
function foo ( ok ) { |
|||
if ( !ok ) { |
|||
throw new Error( 'this will be ignored' ); |
|||
} |
|||
} |
|||
|
|||
foo(); |
|||
|
|||
var main = 42; |
|||
|
|||
module.exports = main; |
|||
|
@ -1,3 +1,11 @@ |
|||
function foo ( ok ) { |
|||
if ( !ok ) { |
|||
throw new Error( 'this will be ignored' ); |
|||
} |
|||
} |
|||
|
|||
foo(); |
|||
|
|||
var main = 42; |
|||
|
|||
export default main; |
|||
|
@ -0,0 +1,6 @@ |
|||
module.exports = { |
|||
description: 'throw statement is a side effect', |
|||
options: { |
|||
moduleName: 'myBundle' |
|||
} |
|||
}; |
@ -0,0 +1,9 @@ |
|||
define(function () { 'use strict'; |
|||
|
|||
function foo () { |
|||
throw new Error( 'throw side effect' ); |
|||
} |
|||
|
|||
foo(); |
|||
|
|||
}); |
@ -0,0 +1,7 @@ |
|||
'use strict'; |
|||
|
|||
function foo () { |
|||
throw new Error( 'throw side effect' ); |
|||
} |
|||
|
|||
foo(); |
@ -0,0 +1,5 @@ |
|||
function foo () { |
|||
throw new Error( 'throw side effect' ); |
|||
} |
|||
|
|||
foo(); |
@ -0,0 +1,10 @@ |
|||
(function () { |
|||
'use strict'; |
|||
|
|||
function foo () { |
|||
throw new Error( 'throw side effect' ); |
|||
} |
|||
|
|||
foo(); |
|||
|
|||
}()); |
@ -0,0 +1,13 @@ |
|||
(function (global, factory) { |
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : |
|||
typeof define === 'function' && define.amd ? define(factory) : |
|||
(factory()); |
|||
}(this, (function () { 'use strict'; |
|||
|
|||
function foo () { |
|||
throw new Error( 'throw side effect' ); |
|||
} |
|||
|
|||
foo(); |
|||
|
|||
}))); |
@ -0,0 +1,5 @@ |
|||
function foo () { |
|||
throw new Error( 'throw side effect' ); |
|||
} |
|||
|
|||
foo(); |
Loading…
Reference in new issue