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

Issue #1547 'use strict' duplicate property definitions in obj literals prohibited

This commit is contained in:
Gerald Lewis 2012-01-09 12:53:32 -05:00
parent 3a694d7dfa
commit a2ef66f197

View file

@ -780,6 +780,14 @@ exports.Obj = class Obj extends Base
compileNode: (o) ->
props = @properties
propNames = []
for prop in @properties
prop = prop.variable if prop.isComplex()
if prop?
propName = prop.unwrapAll().value.toString()
if propName in propNames
throw SyntaxError "duplicate data property #{propName} in object literals are not allowed"
propNames.push propName
return (if @front then '({})' else '{}') unless props.length
if @generated
for node in props when node instanceof Value