Permalink
Browse files

removing code that restricts duplicate key names and associated tests

  • Loading branch information...
michaelficarra committed May 21, 2012
1 parent 6c6c8bd commit 7c29ea4d38928f829315ea4bd630219fb1e3ac30
Showing with 5 additions and 71 deletions.
  1. +5 −28 lib/coffee-script/nodes.js
  2. +0 −10 src/nodes.coffee
  3. +0 −33 test/strict.coffee
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -801,16 +801,6 @@ exports.Obj = class Obj extends Base
compileNode: (o) ->
props = @properties
- propNames = []
- normalise = (v) -> if IDENTIFIER.test v then v else "" + do Function "return #{v}"
- for prop in @properties
- prop = prop.variable if prop.isComplex()
- if prop?
- propName = prop.unwrapAll().value.toString()
- normalisedPropName = normalise propName
- if normalisedPropName in propNames
- throw SyntaxError "multiple object literal properties named \"#{propName}\""
- propNames.push normalisedPropName
return (if @front then '({})' else '{}') unless props.length
if @generated
for node in props when node instanceof Value
View
@@ -55,41 +55,8 @@ test "octal escape sequences prohibited", ->
strictOk "`'\\1'`"
eq "\\" + "1", `"\\1"`
-
-test "duplicate property definitions in object literals are prohibited", ->
- strict 'o = {x:1, x:1}'
- strict 'x = 1; o = {x, x: 2}'
-
-test "#2333: more duplicate property prohibitions", ->
- usingKeys = (a, b) -> "{#{a}:0, #{b}:0}"
- strict '{a, "a":0}'
- strict usingKeys "a", '"a"'
- strict usingKeys "'a'", "a"
- strict usingKeys "'a'", '"a"'
- strict usingKeys "'a'", "'a'"
- strict usingKeys "0", "0x0"
- strict usingKeys "0", "'\\x30'"
- strict usingKeys ".1", "0.1"
- strict usingKeys ".1", "1e-1"
- strict usingKeys "100", "1e2"
- strict usingKeys "'\\0'", "'\\x00'"
- strict usingKeys "'\\t'", "'\\x09'"
- strict usingKeys "'\\\\x00'", "'\\\\\\x7800'"
- strict usingKeys "'c'", "'\\c'"
- strict usingKeys "'\\\\'", "'\\x5c'"
- strict usingKeys "'\\\n0'", "0"
- strict usingKeys "'\\\n0'", "'\\x00'"
- strict usingKeys "'\\'a'", "\"'a\""
- strict usingKeys "'\\\\a'", "'\\\\a'"
- strictOk usingKeys "a", "b"
- strictOk usingKeys "'\"a\"'", "'a'"
- strictOk usingKeys "'\"a\"'", '"\'a\'"'
- strictOk usingKeys "0", '"0x0"'
- strictOk usingKeys "0", '"\\\\x30"'
-
test "duplicate formal parameters are prohibited", ->
nonce = {}
-
# a Param can be an Identifier, ThisProperty( @-param ), Array, or Object
# a Param can also be a splat (...) or an assignment (param=value)
# the following function expressions should throw errors

3 comments on commit 7c29ea4

@domenic

This comment has been minimized.

Show comment Hide comment
@domenic

domenic Jun 4, 2012

Contributor

Why?

Contributor

domenic replied Jun 4, 2012

Why?

@michaelficarra

This comment has been minimized.

Show comment Hide comment
@michaelficarra

michaelficarra Jun 4, 2012

Collaborator
@domenic

This comment has been minimized.

Show comment Hide comment
@domenic

domenic Jun 4, 2012

Contributor

Thanks!

Contributor

domenic replied Jun 4, 2012

Thanks!

Please sign in to comment.