* XXX more cases needed.
*/
static GLboolean
-_slang_assignment_compatible(const slang_typeinfo *t0,
- const slang_typeinfo *t1)
-
+_slang_assignment_compatible(slang_assemble_ctx *A,
+ slang_operation *op0,
+ slang_operation *op1)
{
-#if 1
- GLuint sz0 = _slang_sizeof_type_specifier(&t0->spec);
- GLuint sz1 = _slang_sizeof_type_specifier(&t1->spec);
+ slang_typeinfo t0, t1;
+ GLuint sz0, sz1;
+
+
+ slang_typeinfo_construct(&t0);
+ _slang_typeof_operation(A, op0, &t0);
+
+ slang_typeinfo_construct(&t1);
+ _slang_typeof_operation(A, op1, &t1);
+
+ sz0 = _slang_sizeof_type_specifier(&t0.spec);
+ sz1 = _slang_sizeof_type_specifier(&t1.spec);
+#if 1
if (sz0 != sz1) {
printf("size mismatch %u vs %u\n", sz0, sz1);
return GL_FALSE;
}
#endif
- if (t0->spec.type == SLANG_SPEC_STRUCT &&
- t1->spec.type == SLANG_SPEC_STRUCT &&
- t0->spec._struct->a_name != t1->spec._struct->a_name)
+ if (t0.spec.type == SLANG_SPEC_STRUCT &&
+ t1.spec.type == SLANG_SPEC_STRUCT &&
+ t0.spec._struct->a_name != t1.spec._struct->a_name)
return GL_FALSE;
#if 0 /* not used just yet - causes problems elsewhere */
- if (t0->spec.type == SLANG_SPEC_INT &&
- t1->spec.type == SLANG_SPEC_FLOAT)
+ if (t0.spec.type == SLANG_SPEC_INT &&
+ t1.spec.type == SLANG_SPEC_FLOAT)
return GL_FALSE;
- if (t0->spec.type == SLANG_SPEC_BOOL &&
- t1->spec.type == SLANG_SPEC_FLOAT)
+ if (t0.spec.type == SLANG_SPEC_BOOL &&
+ t1.spec.type == SLANG_SPEC_FLOAT)
return GL_FALSE;
- if (t0->spec.type == SLANG_SPEC_BOOL &&
- t1->spec.type == SLANG_SPEC_INT)
+ if (t0.spec.type == SLANG_SPEC_BOOL &&
+ t1.spec.type == SLANG_SPEC_INT)
return GL_FALSE;
#endif
return GL_TRUE;
slang_ir_node *n, *lhs, *rhs;
/* lhs and rhs type checking */
- if (0)
- {
- slang_typeinfo t0, t1;
-
- slang_typeinfo_construct(&t0);
- _slang_typeof_operation(A, &oper->children[0], &t0);
-
- slang_typeinfo_construct(&t1);
- _slang_typeof_operation(A, &oper->children[1], &t1);
-
- if (!_slang_assignment_compatible(&t0, &t1)) {
- slang_info_log_error(A->log,
- "illegal types in assignment");
- return NULL;
- }
+ if (!_slang_assignment_compatible(A,
+ &oper->children[0],
+ &oper->children[1])) {
+ slang_info_log_error(A->log, "illegal types in assignment");
+ return NULL;
}
lhs = _slang_gen_operation(A, &oper->children[0]);