You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
! isn't included in the "examplary source, containing all possible tokens" inside test/api.js or test/fixture/*.glsl
Under lib/operators.js, boolean complement and negation have been commented out since d68a9ed
so it looks like this has been this way for a while.
Uncommenting out either of the operators causes the tests to fail with
~/glsl-transpiler$ npm test
> [email protected] test
> node test/index.js
undefined:3
out[0] = a[0] ! b[0]
^
SyntaxError: Unexpected token '!'
at new Function (<anonymous>)
at createOperations (file:///home/willheslam/glsl-transpiler/lib/stdlib.js:99:30)
My guess is this is because ! and ~ are unary operators, not binary.
This gives a clue as to why null is being prepended - perhaps glsl-transpiler is treating the ! token as though it's binary, and null is the missing first operand! Hopefully it's a straight forward fix because GLSL and JS are 1:1 here, at least syntactically.
processOperation in operators.js already seems to handle unary operators like i++ and -x so hopefully it can also apply to ! and ~.
A workaround for now is just to negate manually, i.e. foo ? false : true or foo == false.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
!
isn't included in the "examplary source, containing all possible tokens" inside test/api.js or test/fixture/*.glslUnder lib/operators.js, boolean complement and negation have been commented out since
d68a9ed
so it looks like this has been this way for a while.
Uncommenting out either of the operators causes the tests to fail with
My guess is this is because
!
and~
are unary operators, not binary.This gives a clue as to why
null
is being prepended - perhaps glsl-transpiler is treating the!
token as though it's binary, andnull
is the missing first operand! Hopefully it's a straight forward fix because GLSL and JS are 1:1 here, at least syntactically.processOperation
in operators.js already seems to handle unary operators likei++
and-x
so hopefully it can also apply to!
and~
.A workaround for now is just to negate manually, i.e.
foo ? false : true
orfoo == false
.The text was updated successfully, but these errors were encountered: