M include/util.h => include/util.h +3 -0
@@ 108,6 108,9 @@ d_printf(char *fmt, ...);
int
v_printf(char *fmt, ...);
+/* a_printf: assert and print as appropriate if there is an error. */
+#define a_printf(expr, ...) if (!expr) { fprintf(stderr, __VA_ARGS__); assert(false); }
+
struct error;
struct error *
M src/object/object.c => src/object/object.c +1 -1
@@ 468,7 468,7 @@ getorcreatestruct(struct object *obj, struct ast_type *t, struct state *s)
return v;
}
struct ast_type *complete = ast_type_struct_complete(t, state_getext(s));
- assert(complete);
+ a_printf(complete, "%s is incomplete\n", ast_type_str(t));
v = value_struct_create(complete);
object_assign(obj, v);
return v;