@@ -1996,18 +1996,16 @@ AstCall * create_implicit_for_expansion_call(Context *context, AstFor *fornode)
19961996}
19971997
19981998
1999-
2000- b32 resolve_intrinsic_interface_constraint (Context * context , AstConstraint * constraint ) {
2001- AstInterface * interface = constraint -> interface ;
2002- Type * type = type_build_from_ast (context , (AstType * ) constraint -> args [0 ]);
2003- if (!type ) return 0 ;
2004-
1999+ static b32 resolve_intrinsic_interface_constraint_inner (Context * context , AstInterface * interface , Type * type ) {
20052000 if (!strcmp (interface -> name , "type_is_bool" )) return type_is_bool (type );
20062001 if (!strcmp (interface -> name , "type_is_int" )) return type_is_integer (type );
20072002 if (!strcmp (interface -> name , "type_is_float" )) return type -> kind == Type_Kind_Basic && (type -> Basic .flags & Basic_Flag_Float );
20082003 if (!strcmp (interface -> name , "type_is_number" )) return type -> kind == Type_Kind_Basic && (type -> Basic .flags & Basic_Flag_Numeric );
20092004 if (!strcmp (interface -> name , "type_is_simd" )) return type -> kind == Type_Kind_Basic && (type -> Basic .flags & Basic_Flag_SIMD );
2010- if (!strcmp (interface -> name , "type_is_pointer" )) return type_is_pointer (type ) || type_is_rawptr (type );
2005+ if (!strcmp (interface -> name , "type_is_pointer" )) {
2006+ printf ("RUNNING TYPE IS POINTER ON: %s\n" , type_get_name (context , type ));
2007+ return type_is_pointer (type ) || type_is_rawptr (type );
2008+ }
20112009 if (!strcmp (interface -> name , "type_is_enum" )) return type -> kind == Type_Kind_Enum ;
20122010 if (!strcmp (interface -> name , "type_is_simple" )) return type -> kind == Type_Kind_Basic
20132011 || type -> kind == Type_Kind_Enum
@@ -2022,3 +2020,16 @@ b32 resolve_intrinsic_interface_constraint(Context *context, AstConstraint *cons
20222020 if (!strcmp (interface -> name , "type_is_function" )) return type -> kind == Type_Kind_Function ;
20232021 return 0 ;
20242022}
2023+
2024+ TypeMatch resolve_intrinsic_interface_constraint (Context * context , AstConstraint * constraint ) {
2025+ AstInterface * interface = constraint -> interface ;
2026+ Type * type = type_build_from_ast (context , (AstType * ) constraint -> args [0 ]);
2027+ if (!type ) return TYPE_MATCH_YIELD ;
2028+
2029+ if (resolve_intrinsic_interface_constraint_inner (context , interface , type )) {
2030+ return TYPE_MATCH_SUCCESS ;
2031+ } else {
2032+ return TYPE_MATCH_FAILED ;
2033+ }
2034+ }
2035+
0 commit comments