Support object literal shorthands

This commit is contained in:
dcodeIO
2018-07-14 15:18:45 +02:00
parent c636eddcd2
commit 10a9f407bf
6 changed files with 25 additions and 12 deletions

View File

@ -446,9 +446,15 @@ export class ASTBuilder {
for (let i = 1; i < numElements; ++i) {
sb.push(",\n");
indent(sb, this.indentLevel);
this.visitNode(names[i]);
sb.push(": ");
this.visitNode(values[i]);
let name = names[i];
let value = values[i];
if (name === value) {
this.visitNode(name);
} else {
this.visitNode(name);
sb.push(": ");
this.visitNode(value);
}
}
sb.push("\n");
indent(sb, --this.indentLevel);