Skip to content

Commit c800106

Browse files
authored
TSL: Fix assignment to swizzled for var intent (#31647)
1 parent c0f77e8 commit c800106

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/nodes/core/AssignNode.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ class AssignNode extends TempNode {
9797

9898
const { targetNode, sourceNode } = this;
9999

100-
const targetProperties = builder.getNodeProperties( targetNode );
100+
const scope = targetNode.getScope();
101+
102+
const targetProperties = builder.getNodeProperties( scope );
101103
targetProperties.assign = true;
102104

103105
const properties = builder.getNodeProperties( this );

src/nodes/utils/SplitNode.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ class SplitNode extends Node {
100100

101101
}
102102

103+
/**
104+
* Returns the scope of the node.
105+
*
106+
* @return {Node} The scope of the node.
107+
*/
108+
getScope() {
109+
110+
return this.node.getScope();
111+
112+
}
113+
103114
generate( builder, output ) {
104115

105116
const node = this.node;

0 commit comments

Comments
 (0)