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:
parent
3a694d7dfa
commit
a2ef66f197
1 changed files with 8 additions and 0 deletions
|
@ -780,6 +780,14 @@ exports.Obj = class Obj extends Base
|
||||||
|
|
||||||
compileNode: (o) ->
|
compileNode: (o) ->
|
||||||
props = @properties
|
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
|
return (if @front then '({})' else '{}') unless props.length
|
||||||
if @generated
|
if @generated
|
||||||
for node in props when node instanceof Value
|
for node in props when node instanceof Value
|
||||||
|
|
Loading…
Add table
Reference in a new issue