~mna/snow

snow/pkg/codegen/testdata/struct_complex_generic.snow.want -rw-r--r-- 926 bytes
424066c5Martin Angers doc: v0.0.5 1 year, 8 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
63
64
65
66
67
68
69
70
71
package main

import "fmt"

type _اAا0 struct {
	_اbb  _ا4اBا0
	_اffa func(
		int,
	) int
}

func _اAا0اnew(
	s _اAا0,
	m map[string]bool,
) _اAا0 {
	var r _اAا0
	if m["bb"] {
		r._اbb = s._اbb
	}
	if m["ffa"] {
		r._اffa = s._اffa
	}
	return r
}

func _اstr(
	s string,
) string {
	return s
}

func _اinteger(
	i int,
) int {
	return i
}

type _ا4اBا0 struct {
	_اffb func(
		string,
	) string
}

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

func main() {
	var a _اAا0 = _اAا0اnew(_اAا0{_اbb: _ا4اBا0اnew(_ا4اBا0{_اffb: _اstr}, map[string]bool{"ffb": true}), _اffa: _اinteger}, map[string]bool{"bb": true, "ffa": true})
	_اprintln(a._اbb._اffb("ok"))
	_اprintiln(a._اffa(3))
}

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

func _اprintiln(
	v int,
) {
	fmt.Println(v)
}