1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Check for invalid implicit values

This commit is contained in:
Jonas Dohse 2011-01-18 23:31:50 +01:00
parent d0f13223bc
commit d200619774

View file

@ -717,8 +717,11 @@ exports.Obj = class Obj extends Base
compileNode: (o) -> compileNode: (o) ->
props = @properties props = @properties
props = props.filter ((x) -> x not instanceof Value) if @generated
return (if @front then '({})' else '{}') unless props.length return (if @front then '({})' else '{}') unless props.length
if @generated
for node in props
if node instanceof Value
throw new Error 'No implicit values in implict objects allowed'
idt = o.indent += TAB idt = o.indent += TAB
lastNoncom = @lastNonComment @properties lastNoncom = @lastNonComment @properties
props = for prop, i in props props = for prop, i in props