Skip to content

Commit

Permalink
Issue #1547 'use strict' duplicate property definitions in obj litera…
Browse files Browse the repository at this point in the history
…ls prohibited
  • Loading branch information
geraldalewis committed Jan 16, 2012
1 parent 3a694d7 commit a2ef66f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/nodes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a2ef66f

Please sign in to comment.