Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / base_scope.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 class Foo
16 fun start do end
17 fun finish do end
18 redef fun output do 0.output
19 end
20 var foo = new Foo
21 var maybe: Bool = true
22
23 #alt1#var a = 0
24 #alt1#var b = 0
25 #alt1#var c = 0
26
27 if maybe then
28 if maybe then var a = 1 else var a = 2
29 while maybe do
30 while false do var a = 3
31 loop
32 do
33 do var a = 4
34 with a = foo do
35 a.output
36 with b = foo do var c = 5
37 var b = 6
38 b.output
39 var c = 7
40 c.output
41 end
42
43 for a in [8] do
44 a.output
45 for b in [9] do var c = 10
46 var b = 11
47 b.output
48 var c = 12
49 c.output
50 end
51 assert maybe else
52 assert maybe else var a = 13
53 var a = 14
54 a.output
55 end
56 var a = 15
57 a.output
58 end
59 var a = 16
60 a.output
61 if maybe then break
62 end
63 var a = 17
64 a.output
65 if maybe then break
66 end
67 var a = 18
68 a.output
69 else if maybe then
70 var a = 19
71 a.output
72 else
73 var a = 20
74 a.output
75 end
76 var a = 21
77 a.output