Skip to content

Commit 0b1d4d3

Browse files
committed
Adding a test for #2613
1 parent ac39899 commit 0b1d4d3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/assignment.coffee

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@ test "#1627: prohibit conditional assignment of undefined variables", ->
293293
doesNotThrow (-> CoffeeScript.compile "x = null; do -> x ?= 10"), "allow (x = null; do -> x ?= 10)"
294294
doesNotThrow (-> CoffeeScript.compile "x = null; do -> x ||= 10"), "allow (x = null; do -> x ||= 10)"
295295
doesNotThrow (-> CoffeeScript.compile "x = null; do -> x or= 10"), "allow (x = null; do -> x or= 10)"
296-
296+
297297
throws (-> CoffeeScript.compile "-> -> -> x ?= 10"), null, "prohibit (-> -> -> x ?= 10)"
298298
doesNotThrow (-> CoffeeScript.compile "x = null; -> -> -> x ?= 10"), "allow (x = null; -> -> -> x ?= 10)"
299-
299+
300300
test "more existential assignment", ->
301301
global.temp ?= 0
302302
eq global.temp, 0
@@ -311,7 +311,7 @@ test "#1348, #1216: existential assignment compilation", ->
311311
eq nonce, b
312312
#the first ?= compiles into a statement; the second ?= compiles to a ternary expression
313313
eq a ?= b ?= 1, nonce
314-
314+
315315
if a then a ?= 2 else a = 3
316316
eq a, nonce
317317

@@ -375,3 +375,8 @@ test '#2532: compound assignment with terminator', ->
375375
!
376376
"
377377
"""
378+
379+
test "#2613: parens on LHS of destructuring", ->
380+
a = {}
381+
[(a).b] = [1, 2, 3]
382+
eq a.b, 1

0 commit comments

Comments
 (0)