specify immutable class members

This commit is contained in:
uan
2026-02-08 11:20:23 +01:00
parent 08686c2681
commit ccd59f6a0a

View File

@@ -85,7 +85,10 @@ fn (mut g Generator) gen_class_print_func(stmt ClassDecl) {
if member.type != 'string' && g.symbols.lookup_class(member.type) != none { if member.type != 'string' && g.symbols.lookup_class(member.type) != none {
inner_struct_name := mangle_struct(member.type) inner_struct_name := mangle_struct(member.type)
g.out.writeln('print_${inner_struct_name}(s.${member.name}, indent + 1);') g.out.write_string('print_${inner_struct_name}(s.${member.name}, indent + 1);')
if member.is_immutable {
g.out.write_string('printf(" (immutable)\\n");')
}
} else { } else {
format := get_type_format(member.type) format := get_type_format(member.type)
g.out.write_string('printf("%${format}') g.out.write_string('printf("%${format}')