mirror of https://github.com/lukechilds/rollup.git
Rich Harris
9 years ago
3 changed files with 21 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||
var assert = require( 'assert' ); |
|||
|
|||
module.exports = { |
|||
description: 'detect side effect in member expression assignment when not top level', |
|||
code: function ( code ) { |
|||
assert.equal( code.indexOf( 'function set(key, value) { foo[key] = value; }' ) >= 0, true, code ); |
|||
assert.equal( code.indexOf( 'set("bar", 2);' ) >= 0, true, code ); |
|||
assert.equal( code.indexOf( 'set("qux", 3);' ) >= 0, true, code ); |
|||
} |
|||
} |
@ -0,0 +1,9 @@ |
|||
var foo = {}; |
|||
|
|||
function set(key, value) { foo[key] = value; } |
|||
|
|||
set("bar", 2); |
|||
set("qux", 3); |
|||
|
|||
console.log(foo); |
|||
|
Loading…
Reference in new issue