1 // testlocalvars.java --- Semantic unit test for Java
2
3 // Copyright (C) 2009-2023 Free Software Foundation, Inc.
4
5 // Author: Eric M. Ludlam <zappo@gnu.org>
6
7 // This file is part of GNU Emacs.
8
9 // GNU Emacs is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 3 of the License, or
12 // (at your option) any later version.
13
14 // GNU Emacs is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18
19 // You should have received a copy of the GNU General Public License
20 // along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22
23 class foo {
24 foo *member;
25 char anArray[10];
26 };
27
28 void func()
29 {
30 foo local1;
31 foo* local2 = localvar.member;
32 foo* local3 = new foo();
33 foo local4[10];
34 char local5[5] = {'1','2','3','4','5'};
35 char *local6 = "12345";
36 char local7 = local.anArray[0];
37 char local8 = true ? 10 : 11 ;
38
39 // Check that all of the above was parsed
40 local//-1-
41 ; //#1# ("local1" "local2" "local3" "local4" "local5" "local6" "local7" "local8" )
42
43 local1.//-2-
44 ; //#2# ("anArray" "member")
45
46 local2->//-3-
47 ; //#3# ("anArray" "member")
48
49 local3->//-4-
50 ; //#4# ("anArray" "member")
51
52 local4[0].//-5-
53 ; //#5# ("anArray" "member")
54 }