@@ -270,9 +270,15 @@ class WebGLFunctionNode extends FunctionNode {
270270 this . astGeneric ( ast . right , retArr ) ;
271271 break ;
272272 case 'LiteralInteger & LiteralInteger' :
273- this . castLiteralToFloat ( ast . left , retArr ) ;
274- retArr . push ( operatorMap [ ast . operator ] || ast . operator ) ;
275- this . castLiteralToFloat ( ast . right , retArr ) ;
273+ if ( this . isState ( 'casting-to-integer' ) ) {
274+ this . astGeneric ( ast . left , retArr ) ;
275+ retArr . push ( operatorMap [ ast . operator ] || ast . operator ) ;
276+ this . astGeneric ( ast . right , retArr ) ;
277+ } else {
278+ this . castLiteralToFloat ( ast . left , retArr ) ;
279+ retArr . push ( operatorMap [ ast . operator ] || ast . operator ) ;
280+ this . castLiteralToFloat ( ast . right , retArr ) ;
281+ }
276282 break ;
277283
278284 case 'Integer & Float' :
@@ -421,7 +427,8 @@ class WebGLFunctionNode extends FunctionNode {
421427 if ( ! foundOperator ) return null ;
422428 retArr . push ( foundOperator ) ;
423429 retArr . push ( '(' ) ;
424- switch ( this . getType ( ast . left ) ) {
430+ const leftType = this . getType ( ast . left ) ;
431+ switch ( leftType ) {
425432 case 'Number' :
426433 case 'Float' :
427434 this . castValueToInteger ( ast . left , retArr ) ;
@@ -433,7 +440,8 @@ class WebGLFunctionNode extends FunctionNode {
433440 this . astGeneric ( ast . left , retArr ) ;
434441 }
435442 retArr . push ( ',' ) ;
436- switch ( this . getType ( ast . right ) ) {
443+ const rightType = this . getType ( ast . right ) ;
444+ switch ( rightType ) {
437445 case 'Number' :
438446 case 'Float' :
439447 this . castValueToInteger ( ast . right , retArr ) ;
@@ -1338,4 +1346,4 @@ const operatorMap = {
13381346
13391347module . exports = {
13401348 WebGLFunctionNode
1341- } ;
1349+ } ;
0 commit comments