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