More tests for binding elements referencing previous elements

This commit is contained in:
Nathan Shively-Sanders 2016-12-06 13:05:52 -08:00
parent 72a1e85cd7
commit 4efa61cf80
2 changed files with 16 additions and 2 deletions

View file

@ -1,4 +1,10 @@
const [a, b = a] = [1]; // ok
const [a, b = a, c = c] = [1]; // error for c
const [a, b = a, c = d, d = a] = [1]; // error for c
const [c, d = c, e = e] = [1]; // error for e = e
const [f, g = f, h = i, i = f] = [1]; // error for h = i
(function ([a, b = a]) { // ok
})([1]);
(function ([c, d = c, e = e]) { // error for e = e
})([1]);
(function ([f, g = f, h = i, i = f]) { // error for h = i
})([1])

View file

@ -0,0 +1,8 @@
const {
a = 1,
b = 2,
c = b, // ok
d = a, // ok
e = f, // error
f = f // error
} = { } as any;