update NOTICE and LICENSE
[nit.git] / tests / base_attr2.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import kernel
16
17 class A
18 var a1: Object = self
19 protected var a2: Object = self
20 private var a3: Object = self
21
22 var a4: Object writable = self
23 protected var a5: Object writable = self
24 private var a6: Object writable = self
25
26 var a7: Object protected writable = self
27 protected var a8: Object protected writable = self
28 private var a9: Object protected writable = self
29
30 var a10: Object private writable = self
31 protected var a11: Object private writable = self
32 private var a12: Object private writable = self
33
34 var _cpt: Int = 0
35
36 redef fun output
37 do
38 _cpt += 1
39 _cpt.output
40 end
41
42 fun foo_a(a: A)
43 do
44 a1.output
45 a1 = a
46 a2.output
47 a2 = a
48 a3.output
49 a3 = a
50 a4.output
51 a4 = a
52 a5.output
53 a5 = a
54 a6.output
55 a6 = a
56 a7.output
57 a7 = a
58 a8.output
59 a8 = a
60 a9.output
61 a9 = a
62 a10.output
63 a10 = a
64 a11.output
65 a11 = a
66 a12.output
67 a12 = a
68
69 '\n'.output
70
71 a.a1.output
72 a.a1 = a
73 a.a2.output
74 a.a2 = a
75 a.a3.output
76 a.a3 = a
77 a.a4.output
78 a.a4 = a
79 a.a5.output
80 a.a5 = a
81 a.a6.output
82 a.a6 = a
83 a.a7.output
84 a.a7 = a
85 a.a8.output
86 a.a8 = a
87 a.a9.output
88 a.a9 = a
89 a.a10.output
90 a.a10 = a
91 a.a11.output
92 a.a11 = a
93 a.a12.output
94 a.a12 = a
95
96 '\n'.output
97 end
98 end
99
100 fun foo(a: A)
101 do
102 a.a1.output
103 a.a1 = a
104 a.a2.output
105 a.a2 = a
106 a.a3.output
107 a.a3 = a
108 a.a4.output
109 a.a4 = a
110 a.a5.output
111 a.a5 = a
112 a.a6.output
113 a.a6 = a
114 a.a7.output
115 a.a7 = a
116 a.a8.output
117 a.a8 = a
118 a.a9.output
119 a.a9 = a
120 a.a10.output
121 a.a10 = a
122 a.a11.output
123 a.a11 = a
124 a.a12.output
125 a.a12 = a
126
127 '\n'.output
128 end
129
130 var a = new A
131 a.foo_a(a)
132 foo(a)