Fix object lookups via object literals #65

Merged
merged 1 commit into from Aug 1, 2011

Conversation

Projects
None yet
2 participants
Contributor

tricknotes commented Aug 1, 2011

I noticed that the following JavaSsript does not compile correctly.

var o = {}
o[{a: 1, b: 2}] = 3

compiled:

o = {}
o[
  a: 1
  b: 2
] = 3

But when run this code, this occurs error.

I modified this compilation.

Thanks.

Owner

rstacruz commented Aug 1, 2011

Thanks!

Just as an afterthought: which do you think would look better?

#1
o[a: 1] = 3
o[(a: 2, b: 3)] = 4
#2
o[{a: 1}] = 3
o[{a: 2, b: 3}] = 4
#3
o[a: 1] = 3
o[(
  a: 2
  b: 3
)] = 4

rstacruz added a commit that referenced this pull request Aug 1, 2011

@rstacruz rstacruz merged commit 02cd263 into js2coffee:master Aug 1, 2011

Owner

rstacruz commented Aug 1, 2011

(I've renamed this issue from Fix object literal to Fix object lookups via object literals.)

Contributor

tricknotes commented Aug 2, 2011

I want to use '{}' rather than '()' , because I would like to express the object literal notation.
In CoffeeScript, the good way I think is that '{}' is not used.
So, the followings looks good.

#4
o[a: 1] = 3
o[a: 2, b: 3] = 4

If you think would like to this idea, may I write patch and send as pull request?

clojens pushed a commit to coffeebook/js2coffee that referenced this pull request May 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment