Skip to content

Commit 499d313

Browse files
authored
TSL: Fix duplicate assignments (#27798)
* AssignNode: Fix duplicate assignments * add void
1 parent 5b4520e commit 499d313

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

examples/jsm/nodes/core/AssignNode.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,21 @@ class AssignNode extends TempNode {
5656

5757
const sourceType = sourceNode.getNodeType( builder );
5858

59+
const nodeData = builder.getDataFromNode( this );
60+
5961
//
6062

6163
let snippet;
6264

63-
if ( needsSplitAssign ) {
65+
if ( nodeData.initialized === true ) {
66+
67+
if ( output !== 'void' ) {
68+
69+
snippet = target;
70+
71+
}
72+
73+
} else if ( needsSplitAssign ) {
6474

6575
const sourceVar = builder.getVarFromNode( this, null, targetType );
6676
const sourceProperty = builder.getPropertyName( sourceVar );
@@ -101,6 +111,8 @@ class AssignNode extends TempNode {
101111

102112
}
103113

114+
nodeData.initialized = true;
115+
104116
return builder.format( snippet, targetType, output );
105117

106118
}

0 commit comments

Comments
 (0)