~mna/snow

snow/pkg/codegen/testdata/fn_nested_struct_method.snow.want -rw-r--r-- 671 bytes
424066c5Martin Angers doc: v0.0.5 1 year, 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package main

import "fmt"

type _ا4اS struct {
	_اx string
}

func (
	self *_ا4اS,
) _اinit() {
	self._اx = "hello"
}

type _ا5اT struct {
	_اy string
}

func (
	self *_ا5اT,
) _اappend(
	s string,
) {
	self._اy = self._اy + s
}

func _ا5اTاnew(
	s _ا5اT,
	m map[string]bool,
) _ا5اT {
	var r _ا5اT
	if m["y"] {
		r._اy = s._اy
	}
	return r
}

func _ا4اSاnew(
	s _ا4اS,
	m map[string]bool,
) _ا4اS {
	var r _ا4اS
	if m["x"] {
		r._اx = s._اx
	}
	return r
}

func main() {
	var s _ا4اS
	var t _ا5اT
	s._اinit()
	t._اappend(s._اx)
	t._اappend(", world")
	_اprintln(t._اy)
}

func _اprintln(
	s string,
) {
	fmt.Println(s)
}