If the destructuring assignment is synthetic use the left side as source map

This helps in scenarios like below where the assignment is created synthetically
for ({a} of {a: string}) {
}
This commit is contained in:
Sheetal Nandi
2015-12-10 15:03:10 -08:00
parent 631e62d7ba
commit 513e1f5fce
5 changed files with 537 additions and 453 deletions

View File

@@ -3955,7 +3955,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
else if (isAssignmentExpressionStatement) {
// Source map node for root.left = root.right is root
emitDestructuringAssignment(target, value, root);
// but if root is synthetic, which could be in below case, use the target which is { a }
// for ({a} of {a: string}) {
// }
emitDestructuringAssignment(target, value, nodeIsSynthesized(root) ? target : root);
}
else {
if (root.parent.kind !== SyntaxKind.ParenthesizedExpression) {