// other uses of checking polymorphic structures against
// actual nodes strictly forbidden.
if (type->kind == Type_Kind_PolyStruct) {
- if (node_type->kind == Type_Kind_Struct) {
+ if (node_type && node_type->kind == Type_Kind_Struct) {
if (node_type->Struct.constructed_from->type_id == type->id) {
return TYPE_MATCH_SUCCESS;
}
// This case enables to ability to have less values on the
// left hand side of an assignment than what the right hand
// side call would be returning.
- if (node_type->kind == Type_Kind_Compound) {
+ if (node_type && node_type->kind == Type_Kind_Compound) {
AstCall *call = get_call_expr_from_node((AstNode *) node);
if (!call) return TYPE_MATCH_FAILED;
}
);
+#overload
+from_array :: (arr: [] $T, by_pointer: bool) => generator(
+ &.{ data = arr.data, count = arr.count, current = 0 },
+
+ ctx => {
+ if ctx.current < ctx.count {
+ defer ctx.current += 1;
+ return &ctx.data[ctx.current], true;
+ }
+
+ return null, false;
+ }
+);
+
#overload
from_array :: (arr: [] $T) => generator(
&.{ data = arr.data, count = arr.count, current = 0 },