assert(union_capture_idx != 0);
if (sc->capture_is_by_pointer) {
- u64 capture_pointer_local = emit_local_allocation(mod, &code, sc->capture);
+ u64 capture_pointer_local = emit_local_allocation(mod, &code, (AstTyped *) sc->capture);
WIL(NULL, WI_LOCAL_GET, union_capture_idx);
WIL(NULL, WI_PTR_CONST, switch_node->expr->type->Union.alignment);
sc->capture->flags |= Ast_Flag_Decl_Followed_By_Init;
sc->capture->flags |= Ast_Flag_Address_Taken;
- emit_local_allocation(mod, &code, sc->capture);
- emit_location(mod, &code, sc->capture);
+ emit_local_allocation(mod, &code, (AstTyped *) sc->capture);
+ emit_location(mod, &code, (AstTyped *) sc->capture);
WIL(NULL, WI_LOCAL_GET, union_capture_idx);
WIL(NULL, WI_PTR_CONST, switch_node->expr->type->Union.alignment);
}
}
+create_optional :: () -> NewOptional(i32) {
+ return .{ Some = i32 };
+}
+
new_optional_test :: () {
- v := NewOptional(i32).{ Some = 123 };
+ v := create_optional();
v2 := NewOptional(str).{ None = .{} };
println(v);
println(v2);
- v = .{ None = .{} };
println(unwrap_optional(v));
}