File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -3670,7 +3670,7 @@ fn (mut g Gen) selector_expr(node ast.SelectorExpr) {
3670
3670
if is_as_cast {
3671
3671
g.write ('(' )
3672
3672
}
3673
- if node.or_block.kind != .absent && ! g.is_assign_lhs && g.table.sym (node.typ).kind != .chan {
3673
+ if node.or_block.kind != .absent && g.table.sym (node.typ).kind != .chan {
3674
3674
is_ptr := sym.kind in [.interface_, .sum_type]
3675
3675
stmt_str := g.go_before_last_stmt ().trim_space ()
3676
3676
styp := g.typ (g.unwrap_generic (node.typ))
Original file line number Diff line number Diff line change
1
+ struct Tree {
2
+ mut :
3
+ nr_elems int
4
+ parent ? & Tree
5
+ }
6
+
7
+ fn (mut t Tree) set_nr_elems (name string , value int ) {
8
+ t.parent or { return }.nr_elems = value
9
+ }
10
+
11
+ fn test_main () {
12
+ parent := Tree{
13
+ nr_elems: 11
14
+ }
15
+ mut child := Tree{
16
+ parent: & parent
17
+ }
18
+ child.set_nr_elems ('Buzz' , 123 )
19
+ assert child.parent or { return }.nr_elems == 123
20
+ }
You can’t perform that action at this time.
0 commit comments