Просмотр исходного кода

TSL: Fix assignment to swizzled for var intent (#31647)

sunag 4 месяцев назад
Родитель
Сommit
c800106fb4
2 измененных файлов с 14 добавлено и 1 удалено
  1. 3 1
      src/nodes/core/AssignNode.js
  2. 11 0
      src/nodes/utils/SplitNode.js

+ 3 - 1
src/nodes/core/AssignNode.js

@@ -97,7 +97,9 @@ class AssignNode extends TempNode {
 
 		const { targetNode, sourceNode } = this;
 
-		const targetProperties = builder.getNodeProperties( targetNode );
+		const scope = targetNode.getScope();
+
+		const targetProperties = builder.getNodeProperties( scope );
 		targetProperties.assign = true;
 
 		const properties = builder.getNodeProperties( this );

+ 11 - 0
src/nodes/utils/SplitNode.js

@@ -100,6 +100,17 @@ class SplitNode extends Node {
 
 	}
 
+	/**
+	 * Returns the scope of the node.
+	 *
+	 * @return {Node} The scope of the node.
+	 */
+	getScope() {
+
+		return this.node.getScope();
+
+	}
+
 	generate( builder, output ) {
 
 		const node = this.node;

粤ICP备19079148号