mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 07:29:16 -05:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user