Skip to content

Commit 7d8b148

Browse files
authored
TSL: Improve error message for operators with void values (mrdoob#31593)
1 parent eda8be6 commit 7d8b148

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/nodes/math/OperatorNode.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ class OperatorNode extends TempNode {
103103
* and the input node types.
104104
*
105105
* @param {NodeBuilder} builder - The current node builder.
106+
* @param {?string} [output=null] - The output type.
106107
* @return {string} The node type.
107108
*/
108-
getNodeType( builder ) {
109+
getNodeType( builder, output = null ) {
109110

110111
const op = this.op;
111112

@@ -117,7 +118,7 @@ class OperatorNode extends TempNode {
117118

118119
if ( typeA === 'void' || typeB === 'void' ) {
119120

120-
return 'void';
121+
return output || 'void';
121122

122123
} else if ( op === '%' ) {
123124

@@ -193,7 +194,7 @@ class OperatorNode extends TempNode {
193194

194195
const { aNode, bNode } = this;
195196

196-
const type = this.getNodeType( builder );
197+
const type = this.getNodeType( builder, output );
197198

198199
let typeA = null;
199200
let typeB = null;

0 commit comments

Comments
 (0)