mirror of https://github.com/lukechilds/rollup.git
Rich-Harris
9 years ago
5 changed files with 86 additions and 21 deletions
@ -0,0 +1,4 @@ |
|||
module.exports = { |
|||
description: 'allows reassigments to default parameters that shadow imports', |
|||
babel: true |
|||
}; |
@ -0,0 +1,21 @@ |
|||
import { bar, baz, x, items, p, q, r, s } from './other'; |
|||
|
|||
function foo ( bar = 1, { baz } = { baz: 2 }, [[[,x = 3] = []] = []] = [], ...items ) { |
|||
bar += 1; |
|||
baz += 1; |
|||
x += 1; |
|||
|
|||
let { p, q } = { p: 4, q: 5 }; |
|||
let [ r, s ] = [ 6, 7 ]; |
|||
|
|||
p++; |
|||
q += 1; |
|||
r = 7; |
|||
s = 6; |
|||
|
|||
return bar + baz + x + items.length + p + q + r + s; |
|||
} |
|||
|
|||
assert.equal( foo(), 33 ); |
|||
assert.equal( foo( 2 ), 34 ); |
|||
assert.equal( foo( 2, { baz: 3 }, [[[99,10]]], 'a', 'b', 'c' ), 45 ); |
@ -0,0 +1,8 @@ |
|||
export const bar = 'bar'; |
|||
export const baz = 'baz'; |
|||
export const x = 'x'; |
|||
export const items = 'items'; |
|||
export const p = 'p'; |
|||
export const q = 'q'; |
|||
export const r = 'r'; |
|||
export const s = 's'; |
Loading…
Reference in new issue