fix(compiler): quote non identifiers in map keys. (#18788)

PR Close #18788
This commit is contained in:
Tobias Bosch
2017-08-18 15:02:10 -07:00
committed by Miško Hevery
parent c1a4621c8f
commit 2fbc92fd2e
2 changed files with 7 additions and 3 deletions
@@ -169,10 +169,11 @@ describe('TypeScriptNodeEmitter', () => {
expect(emitStmt(o.literalMap([
{key: 'someKey', value: o.literal(1), quoted: false},
{key: 'a', value: o.literal('a'), quoted: false},
{key: '*', value: o.literal('star'), quoted: true},
{key: 'b', value: o.literal('b'), quoted: true},
{key: '*', value: o.literal('star'), quoted: false},
]).toStmt())
.replace(/\s+/gm, ''))
.toEqual(`({someKey:1,a:"a","*":"star"});`);
.toEqual(`({someKey:1,a:"a","b":"b","*":"star"});`);
});
it('should support blank literals', () => {