fix(compiler): take quoting into account when determining if object literals can be shared (#22942)
PR Close #22942
This commit is contained in:
parent
16f021c319
commit
d98e9e7c7f
|
@ -227,8 +227,12 @@ class KeyVisitor implements o.ExpressionVisitor {
|
|||
}
|
||||
|
||||
visitLiteralMapExpr(ast: o.LiteralMapExpr, context: object): string {
|
||||
const mapEntry = (entry: o.LiteralMapEntry) =>
|
||||
`${entry.key}:${entry.value.visitExpression(this, context)}`;
|
||||
const mapKey =
|
||||
(entry: o.LiteralMapEntry) => {
|
||||
const quote = entry.quoted ? '"' : '';
|
||||
return `${quote}${entry.key}${quote}`;
|
||||
} const mapEntry = (entry: o.LiteralMapEntry) =>
|
||||
`${mapKey(entry)}:${entry.value.visitExpression(this, context)}`;
|
||||
return `{${ast.entries.map(mapEntry).join(',')}`;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue