Don't add color as possible type if it was not set

This commit is contained in:
Maximilian Krög
2021-08-08 15:30:57 +02:00
parent c1f4749e4d
commit 2bcd57193d

View File

@@ -596,9 +596,9 @@ function getEqualOperator(operator) {
// find common type // find common type
let type = ValueTypes.ANY; let type = ValueTypes.ANY;
for (let i = 0; i < args.length; i++) { for (let i = 0; i < args.length; i++) {
type = type & getValueType(args[i]); type &= getValueType(args[i]);
} }
if (type === 0) { if (type === ValueTypes.NONE) {
throw new Error( throw new Error(
`All arguments should be of compatible type, got ${JSON.stringify( `All arguments should be of compatible type, got ${JSON.stringify(
args args
@@ -608,7 +608,7 @@ function getEqualOperator(operator) {
// Since it's not possible to have color types here, we can leave it out // Since it's not possible to have color types here, we can leave it out
// This fixes issues in case the value type is ambiguously detected as a color (e.g. the string 'red') // This fixes issues in case the value type is ambiguously detected as a color (e.g. the string 'red')
type = type ^ ValueTypes.COLOR; type &= ~ValueTypes.COLOR;
return `(${expressionToGlsl( return `(${expressionToGlsl(
context, context,