Skip to content

Commit 4e73f87

Browse files
committed
v2: dynamic map type generation; map init; move more logic from cleanc to transformer
1 parent e0d05f5 commit 4e73f87

3 files changed

Lines changed: 898 additions & 249 deletions

File tree

‎cmd/v2/test.v‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2926,6 +2926,21 @@ fn main() {
29262926
print_int(hm4[3]) // 9
29272927
print_int(hm4[4]) // 16
29282928

2929+
// 54.6 Map literal initialization
2930+
print_str('map literal:')
2931+
mut hm5 := {
2932+
'a': 1
2933+
'b': 2
2934+
'c': 3
2935+
}
2936+
print_int(hm5['a']) // 1
2937+
print_int(hm5['b']) // 2
2938+
print_int(hm5['c']) // 3
2939+
print_int(hm5.len) // 3
2940+
hm5['d'] = 4
2941+
print_int(hm5['d']) // 4
2942+
print_int(hm5.len) // 4
2943+
29292944
// ==================== 55. MULTI-RETURN ====================
29302945
print_str('--- 55. Multi-return ---')
29312946

0 commit comments

Comments
 (0)