Ver código fonte

TSL: Operator - Left to right associativity (#28709)

sunag 1 ano atrás
pai
commit
f5e2b94362
1 arquivos alterados com 6 adições e 6 exclusões
  1. 6 6
      examples/jsm/nodes/math/OperatorNode.js

+ 6 - 6
examples/jsm/nodes/math/OperatorNode.js

@@ -8,22 +8,22 @@ class OperatorNode extends TempNode {
 
 		super();
 
-		this.op = op;
-
 		if ( params.length > 0 ) {
 
-			let finalBNode = bNode;
+			let finalOp = new OperatorNode( op, aNode, bNode );
 
-			for ( let i = 0; i < params.length; i ++ ) {
+			for ( let i = 0; i < params.length - 1; i ++ ) {
 
-				finalBNode = new OperatorNode( op, finalBNode, params[ i ] );
+				finalOp = new OperatorNode( op, finalOp, params[ i ] );
 
 			}
 
-			bNode = finalBNode;
+			aNode = finalOp;
+			bNode = params[ params.length - 1 ];
 
 		}
 
+		this.op = op;
 		this.aNode = aNode;
 		this.bNode = bNode;