Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / base_attr_lazy_int.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 Foo
18 var a1: Int = fa1 is lazy
19 var a2: Int = fa2 is lazy
20 fun fa1: Int do
21 1.output
22 return 10
23 end
24 fun fa2: Int do
25 2.output
26 return 20
27 end
28 end
29
30 var f = new Foo
31 f.a1.output
32 f.a1.output
33 f.a2.output
34 f.a2.output
35 '\n'.output
36
37 var g = new Foo
38 g.a2.output
39 g.a1.output
40 g.a2.output
41 g.a1.output
42 '\n'.output
43
44 var h = new Foo
45 h.a1 = 100
46 h.a1.output
47 h.a1.output