0 issues 1 contributor 4 branches 0 releases
Additions: 25 Deletions: 2 View patch
1 }
2 dump_fn_name := '_v_dump_expr_$node.cname' + (if node.expr_type.is_ptr() { '_ptr' } else { '' })
3 g.write(' ${dump_fn_name}(${ctoslit(fpath)}, $line, $sexpr, ')
4- g.expr(node.expr)
5+ if node.expr_type.has_flag(.shared_f) {
6+ g.write('&')
7+ g.expr(node.expr)
8+ g.write('->val')
9+ } else {
10+ g.expr(node.expr)
11+ }
12 g.write(' )')
13 }
14
15 _, str_method_expects_ptr, _ := dump_sym.str_method_info()
16 is_ptr := ast.Type(dump_type).is_ptr()
17 deref, _ := deref_kind(str_method_expects_ptr, is_ptr, dump_type)
18- to_string_fn_name := g.get_str_fn(dump_type)
19+ to_string_fn_name := g.get_str_fn(ast.Type(dump_type).clear_flag(.shared_f))
20 ptr_asterisk := if is_ptr { '*' } else { '' }
21 mut str_dumparg_type := '$cname$ptr_asterisk'
22 if dump_sym.kind == .function {
23
1new file mode 100644
2+[vlib/v/tests/inout/dump_shared_arg.vv:12] inst: &AtomicStruct{
3+ a: 1
4+}
5
1new file mode 100644
2+module main
3+
4+struct AtomicStruct {
5+ a int
6+}
7+
8+fn main() {
9+ shared inst := AtomicStruct{
10+ a: 1
11+ }
12+ lock inst {
13+ dump(inst)
14+ }
15+}
16