Debian Codegraph @

gcc/testsuite/gm2/errors/fail/nestedproc4.mod

raw
1 (* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. *)
2 (* This file is part of GNU Modula-2.
3
4 GNU Modula-2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with gm2; see the file COPYING. If not, write to the Free Software
16 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *)
17 MODULE nestedproc4 ;
18
19 FROM StdIO IMPORT Write ;
20 FROM StrIO IMPORT WriteLn ;
21
22 VAR
23 s: ARRAY [0..10] OF CHAR ;
24
25 PROCEDURE a ;
26
27 PROCEDURE b ;
28 VAR
29 p: PROC ;
30
31 PROCEDURE c ;
32 VAR
33 s: ARRAY [0..10] OF CHAR ;
34
35 PROCEDURE d ;
36
37 PROCEDURE e ;
38 BEGIN
39 s[4] := 'a' ;
40 b2
41 END e ;
42
43 BEGIN
44 e
45 END d ;
46
47 BEGIN
48 d
49 END c ;
50
51 BEGIN
52 foo(b) ;
53 p := b ;
54 c
55 END b ;
56
57 PROCEDURE b2 ;
58 BEGIN
59 s[4] := 'g' ;
60 END b2 ;
61
62
63 BEGIN
64 s := 'abcdgfghi' ;
65 b ;
66 Write(s[4]) ; WriteLn
67 (* output should be 'g' *)
68 END a ;
69
70
71 PROCEDURE foo (p: PROC) ;
72 BEGIN
73 END foo ;
74
75
76 BEGIN
77 a
78 END nestedproc4.