Merge branch '1643_splatted_access' of https://github.com/geraldalewis/coffee-script
This commit is contained in:
commit
46b7a2d17c
|
@ -313,21 +313,21 @@ test "#1643: splatted accesses in destructuring assignments should not be declar
|
||||||
for access in accesses
|
for access in accesses
|
||||||
for i,j in [1,2,3] #position can matter
|
for i,j in [1,2,3] #position can matter
|
||||||
code =
|
code =
|
||||||
"""
|
"""
|
||||||
nonce = {}; nonce2 = {}; nonce3 = {};
|
nonce = {}; nonce2 = {}; nonce3 = {};
|
||||||
@o = o = new (class C then a:{}); f = -> o
|
@o = o = new (class C then a:{}); f = -> o
|
||||||
[#{new Array(i).join('x,')}#{access}...] = [#{new Array(i).join('0,')}nonce, nonce2, nonce3]
|
[#{new Array(i).join('x,')}#{access}...] = [#{new Array(i).join('0,')}nonce, nonce2, nonce3]
|
||||||
unless #{access}[0] is nonce and #{access}[1] is nonce2 and #{access}[2] is nonce3 then throw new Error('[...]')
|
unless #{access}[0] is nonce and #{access}[1] is nonce2 and #{access}[2] is nonce3 then throw new Error('[...]')
|
||||||
"""
|
"""
|
||||||
eq nonce, unless (try CoffeeScript.run code, bare: true catch e then true) then nonce
|
eq nonce, unless (try CoffeeScript.run code, bare: true catch e then true) then nonce
|
||||||
# subpatterns like `[[a]...]` and `[{a}...]`
|
# subpatterns like `[[a]...]` and `[{a}...]`
|
||||||
subpatterns = ['[sub, sub2, sub3]', '{0: sub, 1: sub2, 2: sub3}']
|
subpatterns = ['[sub, sub2, sub3]', '{0: sub, 1: sub2, 2: sub3}']
|
||||||
for subpattern in subpatterns
|
for subpattern in subpatterns
|
||||||
for i,j in [1,2,3]
|
for i,j in [1,2,3]
|
||||||
code =
|
code =
|
||||||
"""
|
"""
|
||||||
nonce = {}; nonce2 = {}; nonce3 = {};
|
nonce = {}; nonce2 = {}; nonce3 = {};
|
||||||
[#{new Array(i).join('x,')}#{subpattern}...] = [#{new Array(i).join('0,')}nonce, nonce2, nonce3]
|
[#{new Array(i).join('x,')}#{subpattern}...] = [#{new Array(i).join('0,')}nonce, nonce2, nonce3]
|
||||||
unless sub is nonce and sub2 is nonce2 and sub3 is nonce3 then throw new Error('[sub...]')
|
unless sub is nonce and sub2 is nonce2 and sub3 is nonce3 then throw new Error('[sub...]')
|
||||||
"""
|
"""
|
||||||
eq nonce, unless (try CoffeeScript.run code, bare: true catch e then true) then nonce
|
eq nonce, unless (try CoffeeScript.run code, bare: true catch e then true) then nonce
|
||||||
|
|
Loading…
Reference in New Issue