source:
tests/zombies/scope.cfa
@
bfa7bf0
Last change on this file since bfa7bf0 was fd54fef, checked in by , 4 years ago | |
---|---|
|
|
File size: 858 bytes |
Rev | Line | |
---|---|---|
[51b7345] | 1 | int x; |
2 | typedef double y; | |
3 | typedef float t; | |
4 | y z; | |
[10dc7491] | 5 | //otype u = struct { int a; double b; }; |
6 | typedef struct { int a; double b; } u; | |
[51b7345] | 7 | int f( int y ); |
8 | y q; | |
[10dc7491] | 9 | struct x { int x; }; |
[51b7345] | 10 | |
[0b2961f] | 11 | y w( y y, u v ) { |
[10dc7491] | 12 | // otype x | { x t(u); }; |
13 | void ?{}(struct x *); | |
14 | void ^?{}(struct x *); | |
15 | extern struct x t( u ); | |
[a65d92e] | 16 | u u = y; |
[10dc7491] | 17 | struct x z = t(u); |
[51b7345] | 18 | } |
19 | ||
20 | y p; | |
21 | ||
[fd54fef] | 22 | trait has_u( z ) { |
[a65d92e] | 23 | z u(z); |
[51b7345] | 24 | }; |
25 | ||
[fd54fef] | 26 | forall( t | has_u( t ) ) |
[0b2961f] | 27 | y q( t the_t ) { |
[a65d92e] | 28 | t y = u( the_t ); |
[51b7345] | 29 | } |
30 | ||
31 | t f( y p ) { | |
[a65d92e] | 32 | int y; |
33 | typedef char x; | |
34 | { | |
35 | x y; | |
36 | typedef x z; | |
37 | { | |
38 | z x; | |
39 | typedef z y; | |
40 | y z = x; | |
41 | } | |
42 | z x = y; | |
43 | } | |
44 | x q = y; | |
[51b7345] | 45 | } |
46 | ||
[10dc7491] | 47 | void some_func() {} |
48 | ||
[51b7345] | 49 | t g( void ) { |
[a65d92e] | 50 | typedef char x; |
[10dc7491] | 51 | // try { |
[a65d92e] | 52 | some_func(); |
[10dc7491] | 53 | // } catch ( x x ) { |
54 | // t y = x; | |
55 | // } | |
[a65d92e] | 56 | x z; |
[51b7345] | 57 | } |
58 | ||
[0b2961f] | 59 | y q( i ) /* K&R style */ |
60 | int i; | |
[51b7345] | 61 | { |
[a65d92e] | 62 | switch ( i ) { |
63 | y q = i; | |
64 | case 0: | |
65 | return q; | |
66 | default: | |
67 | return i; | |
68 | } | |
[51b7345] | 69 | } |
70 | ||
[a65d92e] | 71 | // Local Variables: // |
72 | // tab-width: 4 // | |
73 | // End: // |
Note: See TracBrowser
for help on using the repository browser.