PolySolveResult res = solve_poly_type(param->poly_sym, param->type_expr, actual_type);
// If we are trying to match against an "address of" node that was
- // placed because of a method call, there's a small change that the
+ // placed because of a method call, there's a small chance that the
// address of is unnecessary and can be removed. This happens in
// unify_node_and_type, but because that relies on knowning the type,
// it cannot happen until after polymorphic arguments are determined.
}
+customize :: struct {
+ symbol_name: str;
+}
Cast_Mapping :: struct {
type: type_expr;
io.write(writer, type_encoding(method_info.return_type));
io.write(writer, ")) {\n");
- method_name := ff.name;
+ method_name := slice.find_opt(ff.tags, [it](it.type == customize))
+ ->transform(x => misc.any_as(x, customize).symbol_name)
+ ?? ff.name;
+
if name_map != null_proc {
method_name = name_map(method_name);
}
case debug_type_kind_union: {
u32 variant = *(u32 *) base;
- if (variant == 0) {
+ if (variant >= type->onion.variant_count) {
WRITE("unknown_variant");
} else {
- debug_type_union_variant_t *uv = &type->onion.variants[variant - 1];
+ debug_type_union_variant_t *uv = &type->onion.variants[variant];
WRITE_FORMAT("%s(", uv->name);
append_value_from_memory_with_type(builder, bh_pointer_add(base, type->onion.tag_size), uv->type);
run_proc := os.process_spawn(prog, args);
r := io.reader_make(&run_proc);
- while !(r->empty()) {
+ while !r->empty() {
line := r->read_line(consume_newline=true);
print(line);
}