mirror of https://github.com/lukechilds/rollup.git
Rich Harris
9 years ago
5 changed files with 28 additions and 6 deletions
@ -1,4 +1,19 @@ |
|||||
export default { |
const modifierNodes = { |
||||
AssignmentExpression: 'left', |
AssignmentExpression: 'left', |
||||
UpdateExpression: 'argument' |
UpdateExpression: 'argument', |
||||
|
UnaryExpression: 'argument' |
||||
}; |
}; |
||||
|
|
||||
|
export default modifierNodes; |
||||
|
|
||||
|
export function isModifierNode ( node ) { |
||||
|
if ( !( node.type in modifierNodes ) ) { |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
if ( node.type === 'UnaryExpression' ) { |
||||
|
return node.operator === 'delete'; |
||||
|
} |
||||
|
|
||||
|
return true; |
||||
|
} |
||||
|
@ -0,0 +1,3 @@ |
|||||
|
module.exports = { |
||||
|
description: '`delete` operator at the top level is preserved' |
||||
|
}; |
@ -0,0 +1,4 @@ |
|||||
|
var a = { b: 1 }; |
||||
|
assert.strictEqual(a.b, 1); |
||||
|
delete a.b; |
||||
|
assert.strictEqual(a.b, undefined); |
Loading…
Reference in new issue