~mna/snow

snow/pkg/codegen/testdata/fn_struct_method.snow.want -rw-r--r-- 481 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
package main

import "fmt"

func _اprintln(
	x int,
) {
	fmt.Println(x)
}

type _ا5اS struct {
	_اx int
}

func (
	self *_ا5اS,
) _اinc() {
	self._اx = self._اx + 1
}

func (
	self *_ا5اS,
) _اrefinc() {
	self._اx = self._اx + 1
}

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

func main() {
	var s _ا5اS
	s._اx = 3
	s._اinc()
	_اprintln(s._اx)
	s._اrefinc()
	_اprintln(s._اx)
}