mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
allowing numbers to be used as object keys
This commit is contained in:
@@ -115,6 +115,7 @@ rule
|
||||
AssignObj:
|
||||
IDENTIFIER ASSIGN Expression { result = AssignNode.new(ValueNode.new(val[0]), val[2], :object) }
|
||||
| STRING ASSIGN Expression { result = AssignNode.new(ValueNode.new(LiteralNode.new(val[0])), val[2], :object) }
|
||||
| NUMBER ASSIGN Expression { result = AssignNode.new(ValueNode.new(LiteralNode.new(val[0])), val[2], :object) }
|
||||
| Comment { result = val[0] }
|
||||
;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -112,6 +112,7 @@ grammar: {
|
||||
AssignObj: [
|
||||
o "IDENTIFIER ASSIGN Expression", -> new AssignNode(new ValueNode(yytext), $3, 'object')
|
||||
o "STRING ASSIGN Expression", -> new AssignNode(new ValueNode(new LiteralNode(yytext)), $3, 'object')
|
||||
o "NUMBER ASSIGN Expression", -> new AssignNode(new ValueNode(new LiteralNode(yytext)), $3, 'object')
|
||||
o "Comment"
|
||||
]
|
||||
|
||||
|
||||
2
test/fixtures/execution/test_literals.coffee
vendored
2
test/fixtures/execution/test_literals.coffee
vendored
@@ -43,6 +43,8 @@ bob: {
|
||||
salutation + " " + @name
|
||||
hello: ->
|
||||
@greet "Hello"
|
||||
10: 'number'
|
||||
}
|
||||
|
||||
puts bob.hello() is "Hello Bob"
|
||||
puts bob[10] is 'number'
|
||||
|
||||
Reference in New Issue
Block a user