Mercurial > projects > ldc
annotate test/funcs.d @ 108:288fe1029e1f trunk
[svn r112] Fixed 'case 1,2,3:' style case statements.
Fixed a bunch of bugs with return/break/continue in loops.
Fixed support for the DMDFE hidden implicit return value variable. This can be needed for some foreach statements where the loop body is converted to a nested delegate, but also possibly returns from the function.
Added std.math to phobos.
Added AA runtime support code, done ground work for implementing AAs.
Several other bugfixes.
author | lindquist |
---|---|
date | Tue, 20 Nov 2007 05:29:20 +0100 |
parents | c53b6e3fe49a |
children | d9d5d59873d8 |
rev | line source |
---|---|
1 | 1 void main() |
2 { | |
3 printf("Testing functions\n"); | |
4 int i = 5; | |
5 assert(a(i) == 110); | |
6 assert(i == 11); | |
7 | |
8 S s; | |
9 s.i = 5; | |
10 d(s); | |
11 assert(s.i == 5); | |
12 e(s); | |
13 assert(s.i == 6); | |
14 | |
15 printf(" SUCCESS\n"); | |
16 } | |
17 | |
18 int a(ref int i) | |
19 { | |
20 i*=2; | |
21 return b(i); | |
22 } | |
23 | |
24 int b(ref int i) | |
25 { | |
26 i++; | |
27 return c(i); | |
28 } | |
29 | |
30 int c(int i) | |
31 { | |
32 return i*10; | |
33 } | |
34 | |
35 struct S | |
36 { | |
37 int i; | |
38 } | |
39 | |
40 void d(S s) | |
41 { | |
42 s.i++; | |
43 } | |
44 | |
45 void e(ref S s) | |
46 { | |
47 s.i++; | |
48 } |