mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Fix #3935: Implicit calls + obj key interpolation
Allow implicit calls when the first key of an implicit object has interpolation.
This commit is contained in:
@@ -751,3 +751,20 @@ test "unexpected object keys", ->
|
||||
{a: 1, [[]]: 2}
|
||||
^
|
||||
'''
|
||||
|
||||
test "invalid object keys", ->
|
||||
assertErrorFormat '''
|
||||
@a: 1
|
||||
''', '''
|
||||
[stdin]:1:1: error: invalid object key
|
||||
@a: 1
|
||||
^^
|
||||
'''
|
||||
assertErrorFormat '''
|
||||
f
|
||||
@a: 1
|
||||
''', '''
|
||||
[stdin]:2:3: error: invalid object key
|
||||
@a: 1
|
||||
^^
|
||||
'''
|
||||
|
||||
@@ -695,3 +695,14 @@ test 'implicit invocation with implicit object literal', ->
|
||||
else
|
||||
"a": 1
|
||||
eq 2, obj.a
|
||||
|
||||
# #3935: Implicit call when the first key of an implicit object has interpolation.
|
||||
a = 'a'
|
||||
f
|
||||
"#{a}": 1
|
||||
obj =
|
||||
if f
|
||||
"#{a}": 2
|
||||
else
|
||||
"#{a}": 1
|
||||
eq 2, obj.a
|
||||
|
||||
Reference in New Issue
Block a user