mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
parent
0b2d852f67
commit
46841d916d
3 changed files with 10 additions and 0 deletions
|
@ -1488,6 +1488,9 @@
|
|||
value = prop.value;
|
||||
} else {
|
||||
ref3 = prop.base.cache(o), key = ref3[0], value = ref3[1];
|
||||
if (key instanceof IdentifierLiteral) {
|
||||
key = new PropertyName(key.value);
|
||||
}
|
||||
}
|
||||
prop = new Assign(new Value(new IdentifierLiteral(oref), [new Access(key)]), value);
|
||||
}
|
||||
|
|
|
@ -1019,6 +1019,7 @@ exports.Obj = class Obj extends Base
|
|||
value = prop.value
|
||||
else
|
||||
[key, value] = prop.base.cache o
|
||||
key = new PropertyName key.value if key instanceof IdentifierLiteral
|
||||
prop = new Assign (new Value (new IdentifierLiteral oref), [new Access key]), value
|
||||
if indent then answer.push @makeCode indent
|
||||
answer.push prop.compileToFragments(o, LEVEL_TOP)...
|
||||
|
|
|
@ -569,3 +569,9 @@ test "object keys with interpolations", ->
|
|||
interpolated:
|
||||
nested:
|
||||
123: 456
|
||||
|
||||
test "#4324: Shorthand after interpolated key", ->
|
||||
a = 2
|
||||
obj = {"#{1}": 1, a}
|
||||
eq 1, obj[1]
|
||||
eq 2, obj.a
|
||||
|
|
Loading…
Reference in a new issue