Commit f2760b27 by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

parse.y (lookup_field_wrapper): Search for final local aliases.

 2000-04-19  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* parse.y (lookup_field_wrapper): Search for final local aliases.
	(resolve_expression_name): Let lookup_field_wrapper search for
	final local aliases. Force the value of `name' if one is found.
	(qualify_ambiguous_name): CONVERT_EXPR is enough to now we have
	an expression name. Fixed comments.

From-SVN: r33400
parent c1b177ec
...@@ -47,6 +47,14 @@ Thu Apr 20 18:20:58 2000 Jason Schroeder <shrode@subnature.com> ...@@ -47,6 +47,14 @@ Thu Apr 20 18:20:58 2000 Jason Schroeder <shrode@subnature.com>
2000-04-19 Alexandre Petit-Bianco <apbianco@cygnus.com> 2000-04-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (lookup_field_wrapper): Search for final local aliases.
(resolve_expression_name): Let lookup_field_wrapper search for
final local aliases. Force the value of `name' if one is found.
(qualify_ambiguous_name): CONVERT_EXPR is enough to now we have
an expression name. Fixed comments.
2000-04-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (yyerror): `msg' can be null, don't use it in that case. * parse.y (yyerror): `msg' can be null, don't use it in that case.
2000-04-19 Tom Tromey <tromey@cygnus.com> 2000-04-19 Tom Tromey <tromey@cygnus.com>
......
/* A Bison parser, made from ./parse.y /* A Bison parser, made from ./parse.y
by GNU Bison version 1.25 by GNU Bison version 1.28 */
*/
#define YYBISON 1 /* Identify Bison output. */ #define YYBISON 1 /* Identify Bison output. */
...@@ -12,113 +11,113 @@ ...@@ -12,113 +11,113 @@
#define yychar java_char #define yychar java_char
#define yydebug java_debug #define yydebug java_debug
#define yynerrs java_nerrs #define yynerrs java_nerrs
#define PLUS_TK 258 #define PLUS_TK 257
#define MINUS_TK 259 #define MINUS_TK 258
#define MULT_TK 260 #define MULT_TK 259
#define DIV_TK 261 #define DIV_TK 260
#define REM_TK 262 #define REM_TK 261
#define LS_TK 263 #define LS_TK 262
#define SRS_TK 264 #define SRS_TK 263
#define ZRS_TK 265 #define ZRS_TK 264
#define AND_TK 266 #define AND_TK 265
#define XOR_TK 267 #define XOR_TK 266
#define OR_TK 268 #define OR_TK 267
#define BOOL_AND_TK 269 #define BOOL_AND_TK 268
#define BOOL_OR_TK 270 #define BOOL_OR_TK 269
#define EQ_TK 271 #define EQ_TK 270
#define NEQ_TK 272 #define NEQ_TK 271
#define GT_TK 273 #define GT_TK 272
#define GTE_TK 274 #define GTE_TK 273
#define LT_TK 275 #define LT_TK 274
#define LTE_TK 276 #define LTE_TK 275
#define PLUS_ASSIGN_TK 277 #define PLUS_ASSIGN_TK 276
#define MINUS_ASSIGN_TK 278 #define MINUS_ASSIGN_TK 277
#define MULT_ASSIGN_TK 279 #define MULT_ASSIGN_TK 278
#define DIV_ASSIGN_TK 280 #define DIV_ASSIGN_TK 279
#define REM_ASSIGN_TK 281 #define REM_ASSIGN_TK 280
#define LS_ASSIGN_TK 282 #define LS_ASSIGN_TK 281
#define SRS_ASSIGN_TK 283 #define SRS_ASSIGN_TK 282
#define ZRS_ASSIGN_TK 284 #define ZRS_ASSIGN_TK 283
#define AND_ASSIGN_TK 285 #define AND_ASSIGN_TK 284
#define XOR_ASSIGN_TK 286 #define XOR_ASSIGN_TK 285
#define OR_ASSIGN_TK 287 #define OR_ASSIGN_TK 286
#define PUBLIC_TK 288 #define PUBLIC_TK 287
#define PRIVATE_TK 289 #define PRIVATE_TK 288
#define PROTECTED_TK 290 #define PROTECTED_TK 289
#define STATIC_TK 291 #define STATIC_TK 290
#define FINAL_TK 292 #define FINAL_TK 291
#define SYNCHRONIZED_TK 293 #define SYNCHRONIZED_TK 292
#define VOLATILE_TK 294 #define VOLATILE_TK 293
#define TRANSIENT_TK 295 #define TRANSIENT_TK 294
#define NATIVE_TK 296 #define NATIVE_TK 295
#define PAD_TK 297 #define PAD_TK 296
#define ABSTRACT_TK 298 #define ABSTRACT_TK 297
#define MODIFIER_TK 299 #define MODIFIER_TK 298
#define DECR_TK 300 #define DECR_TK 299
#define INCR_TK 301 #define INCR_TK 300
#define DEFAULT_TK 302 #define DEFAULT_TK 301
#define IF_TK 303 #define IF_TK 302
#define THROW_TK 304 #define THROW_TK 303
#define BOOLEAN_TK 305 #define BOOLEAN_TK 304
#define DO_TK 306 #define DO_TK 305
#define IMPLEMENTS_TK 307 #define IMPLEMENTS_TK 306
#define THROWS_TK 308 #define THROWS_TK 307
#define BREAK_TK 309 #define BREAK_TK 308
#define IMPORT_TK 310 #define IMPORT_TK 309
#define ELSE_TK 311 #define ELSE_TK 310
#define INSTANCEOF_TK 312 #define INSTANCEOF_TK 311
#define RETURN_TK 313 #define RETURN_TK 312
#define VOID_TK 314 #define VOID_TK 313
#define CATCH_TK 315 #define CATCH_TK 314
#define INTERFACE_TK 316 #define INTERFACE_TK 315
#define CASE_TK 317 #define CASE_TK 316
#define EXTENDS_TK 318 #define EXTENDS_TK 317
#define FINALLY_TK 319 #define FINALLY_TK 318
#define SUPER_TK 320 #define SUPER_TK 319
#define WHILE_TK 321 #define WHILE_TK 320
#define CLASS_TK 322 #define CLASS_TK 321
#define SWITCH_TK 323 #define SWITCH_TK 322
#define CONST_TK 324 #define CONST_TK 323
#define TRY_TK 325 #define TRY_TK 324
#define FOR_TK 326 #define FOR_TK 325
#define NEW_TK 327 #define NEW_TK 326
#define CONTINUE_TK 328 #define CONTINUE_TK 327
#define GOTO_TK 329 #define GOTO_TK 328
#define PACKAGE_TK 330 #define PACKAGE_TK 329
#define THIS_TK 331 #define THIS_TK 330
#define BYTE_TK 332 #define BYTE_TK 331
#define SHORT_TK 333 #define SHORT_TK 332
#define INT_TK 334 #define INT_TK 333
#define LONG_TK 335 #define LONG_TK 334
#define CHAR_TK 336 #define CHAR_TK 335
#define INTEGRAL_TK 337 #define INTEGRAL_TK 336
#define FLOAT_TK 338 #define FLOAT_TK 337
#define DOUBLE_TK 339 #define DOUBLE_TK 338
#define FP_TK 340 #define FP_TK 339
#define ID_TK 341 #define ID_TK 340
#define REL_QM_TK 342 #define REL_QM_TK 341
#define REL_CL_TK 343 #define REL_CL_TK 342
#define NOT_TK 344 #define NOT_TK 343
#define NEG_TK 345 #define NEG_TK 344
#define ASSIGN_ANY_TK 346 #define ASSIGN_ANY_TK 345
#define ASSIGN_TK 347 #define ASSIGN_TK 346
#define OP_TK 348 #define OP_TK 347
#define CP_TK 349 #define CP_TK 348
#define OCB_TK 350 #define OCB_TK 349
#define CCB_TK 351 #define CCB_TK 350
#define OSB_TK 352 #define OSB_TK 351
#define CSB_TK 353 #define CSB_TK 352
#define SC_TK 354 #define SC_TK 353
#define C_TK 355 #define C_TK 354
#define DOT_TK 356 #define DOT_TK 355
#define STRING_LIT_TK 357 #define STRING_LIT_TK 356
#define CHAR_LIT_TK 358 #define CHAR_LIT_TK 357
#define INT_LIT_TK 359 #define INT_LIT_TK 358
#define FP_LIT_TK 360 #define FP_LIT_TK 359
#define TRUE_TK 361 #define TRUE_TK 360
#define FALSE_TK 362 #define FALSE_TK 361
#define BOOL_LIT_TK 363 #define BOOL_LIT_TK 362
#define NULL_TK 364 #define NULL_TK 363
#line 48 "./parse.y" #line 48 "./parse.y"
...@@ -517,7 +516,7 @@ typedef union { ...@@ -517,7 +516,7 @@ typedef union {
#define YYFLAG -32768 #define YYFLAG -32768
#define YYNTBASE 110 #define YYNTBASE 110
#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 272) #define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 272)
static const char yytranslate[] = { 0, static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
...@@ -545,18 +544,18 @@ static const char yytranslate[] = { 0, ...@@ -545,18 +544,18 @@ static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
106, 107, 108, 109 107, 108, 109
}; };
#if YYDEBUG != 0 #if YYDEBUG != 0
...@@ -2387,7 +2386,8 @@ static const short yycheck[] = { 3, ...@@ -2387,7 +2386,8 @@ static const short yycheck[] = { 3,
#define YYPURE 1 #define YYPURE 1
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/cygnus/gnupro-98r1/share/bison.simple" #line 3 "/usr/lib/bison.simple"
/* This file comes from bison-1.28. */
/* Skeleton output parser for bison, /* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
...@@ -2404,46 +2404,66 @@ static const short yycheck[] = { 3, ...@@ -2404,46 +2404,66 @@ static const short yycheck[] = { 3,
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a /* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction. Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */ in version 1.24 of Bison. */
#ifndef alloca /* This is the parser code that is written into each bison parser
when the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
#ifndef YYSTACK_USE_ALLOCA
#ifdef alloca
#define YYSTACK_USE_ALLOCA
#else /* alloca not defined */
#ifdef __GNUC__ #ifdef __GNUC__
#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca #define alloca __builtin_alloca
#else /* not GNU C. */ #else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
#define YYSTACK_USE_ALLOCA
#include <alloca.h> #include <alloca.h>
#else /* not sparc */ #else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__) /* We think this test detects Watcom and Microsoft C. */
/* This used to test MSDOS, but that is a bad idea
since that symbol is in the user namespace. */
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
#if 0 /* No need for malloc.h, which pollutes the namespace;
instead, just don't use alloca. */
#include <malloc.h> #include <malloc.h>
#endif
#else /* not MSDOS, or __TURBOC__ */ #else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX) #if defined(_AIX)
#include <malloc.h> /* I don't know what this was needed for, but it pollutes the namespace.
So I turned it off. rms, 2 May 1997. */
/* #include <malloc.h> */
#pragma alloca #pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */ #define YYSTACK_USE_ALLOCA
#ifdef __hpux #else /* not MSDOS, or __TURBOC__, or _AIX */
#ifdef __cplusplus #if 0
extern "C" { #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
void *alloca (unsigned int); and on HPUX 10. Eventually we can turn this on. */
}; #define YYSTACK_USE_ALLOCA
#else /* not __cplusplus */ #define alloca __builtin_alloca
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */ #endif /* __hpux */
#endif
#endif /* not _AIX */ #endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */ #endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc. */ #endif /* not sparc */
#endif /* not GNU C. */ #endif /* not GNU C */
#endif /* alloca not defined. */ #endif /* alloca not defined */
#endif /* YYSTACK_USE_ALLOCA not defined */
/* This is the parser code that is written into each bison parser #ifdef YYSTACK_USE_ALLOCA
when the %semantic_parser declaration is not specified in the grammar. #define YYSTACK_ALLOC alloca
It was written by Richard Stallman by simplifying the hairy parser #else
used when %semantic_parser is specified. */ #define YYSTACK_ALLOC malloc
#endif
/* Note: there must be only one dollar sign in this file. /* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action It is replaced by the list of actions, each action
...@@ -2453,8 +2473,8 @@ void *alloca (); ...@@ -2453,8 +2473,8 @@ void *alloca ();
#define yyclearin (yychar = YYEMPTY) #define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2 #define YYEMPTY -2
#define YYEOF 0 #define YYEOF 0
#define YYACCEPT return(0) #define YYACCEPT goto yyacceptlab
#define YYABORT return(1) #define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1 #define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror. /* Like YYERROR except do call yyerror.
This remains here temporarily to ease the This remains here temporarily to ease the
...@@ -2535,12 +2555,12 @@ int yydebug; /* nonzero means print parse trace */ ...@@ -2535,12 +2555,12 @@ int yydebug; /* nonzero means print parse trace */
#ifndef YYMAXDEPTH #ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000 #define YYMAXDEPTH 10000
#endif #endif
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
int yyparse (void);
#endif
/* Define __yy_memcpy. Note that the size argument
should be passed with type unsigned int, because that is what the non-GCC
definitions require. With GCC, __builtin_memcpy takes an arg
of type size_t, but it can handle unsigned int. */
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */ #else /* not GNU C or C++ */
...@@ -2552,7 +2572,7 @@ static void ...@@ -2552,7 +2572,7 @@ static void
__yy_memcpy (to, from, count) __yy_memcpy (to, from, count)
char *to; char *to;
char *from; char *from;
int count; unsigned int count;
{ {
register char *f = from; register char *f = from;
register char *t = to; register char *t = to;
...@@ -2567,10 +2587,10 @@ __yy_memcpy (to, from, count) ...@@ -2567,10 +2587,10 @@ __yy_memcpy (to, from, count)
/* This is the most reliable way to avoid incompatibilities /* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */ in available built-in functions on various systems. */
static void static void
__yy_memcpy (char *to, char *from, int count) __yy_memcpy (char *to, char *from, unsigned int count)
{ {
register char *f = from;
register char *t = to; register char *t = to;
register char *f = from;
register int i = count; register int i = count;
while (i-- > 0) while (i-- > 0)
...@@ -2580,7 +2600,7 @@ __yy_memcpy (char *to, char *from, int count) ...@@ -2580,7 +2600,7 @@ __yy_memcpy (char *to, char *from, int count)
#endif #endif
#endif #endif
#line 196 "/usr/cygnus/gnupro-98r1/share/bison.simple" #line 217 "/usr/lib/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed /* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *. into yyparse. The argument should have type void *.
...@@ -2601,6 +2621,15 @@ __yy_memcpy (char *to, char *from, int count) ...@@ -2601,6 +2621,15 @@ __yy_memcpy (char *to, char *from, int count)
#define YYPARSE_PARAM_DECL #define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */ #endif /* not YYPARSE_PARAM */
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
#ifdef YYPARSE_PARAM
int yyparse (void *);
#else
int yyparse (void);
#endif
#endif
int int
yyparse(YYPARSE_PARAM_ARG) yyparse(YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL YYPARSE_PARAM_DECL
...@@ -2629,6 +2658,7 @@ yyparse(YYPARSE_PARAM_ARG) ...@@ -2629,6 +2658,7 @@ yyparse(YYPARSE_PARAM_ARG)
#endif #endif
int yystacksize = YYINITDEPTH; int yystacksize = YYINITDEPTH;
int yyfree_stacks = 0;
#ifdef YYPURE #ifdef YYPURE
int yychar; int yychar;
...@@ -2713,18 +2743,32 @@ yynewstate: ...@@ -2713,18 +2743,32 @@ yynewstate:
if (yystacksize >= YYMAXDEPTH) if (yystacksize >= YYMAXDEPTH)
{ {
yyerror("parser stack overflow"); yyerror("parser stack overflow");
if (yyfree_stacks)
{
free (yyss);
free (yyvs);
#ifdef YYLSP_NEEDED
free (yyls);
#endif
}
return 2; return 2;
} }
yystacksize *= 2; yystacksize *= 2;
if (yystacksize > YYMAXDEPTH) if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH; yystacksize = YYMAXDEPTH;
yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); #ifndef YYSTACK_USE_ALLOCA
__yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); yyfree_stacks = 1;
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); #endif
__yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
__yy_memcpy ((char *)yyss, (char *)yyss1,
size * (unsigned int) sizeof (*yyssp));
yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
__yy_memcpy ((char *)yyvs, (char *)yyvs1,
size * (unsigned int) sizeof (*yyvsp));
#ifdef YYLSP_NEEDED #ifdef YYLSP_NEEDED
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
__yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); __yy_memcpy ((char *)yyls, (char *)yyls1,
size * (unsigned int) sizeof (*yylsp));
#endif #endif
#endif /* no yyoverflow */ #endif /* no yyoverflow */
...@@ -4976,7 +5020,7 @@ case 503: ...@@ -4976,7 +5020,7 @@ case 503:
break;} break;}
} }
/* the action file gets copied in in place of this dollarsign */ /* the action file gets copied in in place of this dollarsign */
#line 498 "/usr/cygnus/gnupro-98r1/share/bison.simple" #line 543 "/usr/lib/bison.simple"
yyvsp -= yylen; yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;
...@@ -5171,6 +5215,30 @@ yyerrhandle: ...@@ -5171,6 +5215,30 @@ yyerrhandle:
yystate = yyn; yystate = yyn;
goto yynewstate; goto yynewstate;
yyacceptlab:
/* YYACCEPT comes here. */
if (yyfree_stacks)
{
free (yyss);
free (yyvs);
#ifdef YYLSP_NEEDED
free (yyls);
#endif
}
return 0;
yyabortlab:
/* YYABORT comes here. */
if (yyfree_stacks)
{
free (yyss);
free (yyvs);
#ifdef YYLSP_NEEDED
free (yyls);
#endif
}
return 1;
} }
#line 2546 "./parse.y" #line 2546 "./parse.y"
...@@ -6616,6 +6684,21 @@ lookup_field_wrapper (class, name) ...@@ -6616,6 +6684,21 @@ lookup_field_wrapper (class, name)
tree decl; tree decl;
java_parser_context_save_global (); java_parser_context_save_global ();
decl = lookup_field (&type, name); decl = lookup_field (&type, name);
/* Last chance: if we're within the context of an inner class, we
might be trying to access a local variable defined in an outer
context. We try to look for it now. */
if (INNER_CLASS_TYPE_P (class) && (!decl || decl == error_mark_node))
{
char *alias_buffer;
MANGLE_OUTER_LOCAL_VARIABLE_NAME (alias_buffer, name);
name = get_identifier (alias_buffer);
type = class;
decl = lookup_field (&type, name);
if (decl && decl != error_mark_node)
FIELD_LOCAL_ALIAS_USED (decl) = 1;
}
java_parser_context_restore_global (); java_parser_context_restore_global ();
return decl == error_mark_node ? NULL : decl; return decl == error_mark_node ? NULL : decl;
} }
...@@ -11080,25 +11163,17 @@ resolve_expression_name (id, orig) ...@@ -11080,25 +11163,17 @@ resolve_expression_name (id, orig)
else else
{ {
decl = lookup_field_wrapper (current_class, name); decl = lookup_field_wrapper (current_class, name);
/* Last chance: if we're within the context of an inner
class, we might be trying to access a local variable
defined in an outer context. We try to look for it
now. */
if (!decl && INNER_CLASS_TYPE_P (current_class))
{
char *alias_buffer;
MANGLE_OUTER_LOCAL_VARIABLE_NAME (alias_buffer, name);
name = get_identifier (alias_buffer);
decl = lookup_field_wrapper (current_class, name);
if (decl)
FIELD_LOCAL_ALIAS_USED (decl) = 1;
}
if (decl) if (decl)
{ {
tree access = NULL_TREE; tree access = NULL_TREE;
int fs = FIELD_STATIC (decl); int fs = FIELD_STATIC (decl);
/* If we're accessing an outer scope local alias, make
sure we change the name of the field we're going to
build access to. */
if (FIELD_LOCAL_ALIAS_USED (decl))
name = DECL_NAME (decl);
/* Instance variable (8.3.1.1) can't appear within /* Instance variable (8.3.1.1) can't appear within
static method, static initializer or initializer for static method, static initializer or initializer for
a static variable. */ a static variable. */
...@@ -12784,8 +12859,9 @@ qualify_ambiguous_name (id) ...@@ -12784,8 +12859,9 @@ qualify_ambiguous_name (id)
qual = TREE_CHAIN (qual); qual = TREE_CHAIN (qual);
again = new_array_found = 1; again = new_array_found = 1;
continue; continue;
case NEW_CLASS_EXPR:
case CONVERT_EXPR: case CONVERT_EXPR:
break;
case NEW_CLASS_EXPR:
qual_wfl = TREE_OPERAND (qual_wfl, 0); qual_wfl = TREE_OPERAND (qual_wfl, 0);
break; break;
case ARRAY_REF: case ARRAY_REF:
...@@ -12870,10 +12946,10 @@ qualify_ambiguous_name (id) ...@@ -12870,10 +12946,10 @@ qualify_ambiguous_name (id)
} }
} while (again); } while (again);
/* If name appears within the scope of a location variable /* If name appears within the scope of a local variable declaration
declaration or parameter declaration, then it is an expression or parameter declaration, then it is an expression name. We don't
name. We don't carry this test out if we're in the context of the carry this test out if we're in the context of the use of SUPER
use of SUPER or THIS */ or THIS */
if (!this_found && !super_found if (!this_found && !super_found
&& TREE_CODE (name) != STRING_CST && TREE_CODE (name) != INTEGER_CST && TREE_CODE (name) != STRING_CST && TREE_CODE (name) != INTEGER_CST
&& (decl = IDENTIFIER_LOCAL_VALUE (name))) && (decl = IDENTIFIER_LOCAL_VALUE (name)))
...@@ -12909,7 +12985,7 @@ qualify_ambiguous_name (id) ...@@ -12909,7 +12985,7 @@ qualify_ambiguous_name (id)
QUAL_RESOLUTION (qual) = decl; QUAL_RESOLUTION (qual) = decl;
} }
/* Method call are expression name */ /* Method call, array references and cast are expression name */
else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
|| TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF
|| TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR) || TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR)
......
...@@ -3986,6 +3986,21 @@ lookup_field_wrapper (class, name) ...@@ -3986,6 +3986,21 @@ lookup_field_wrapper (class, name)
tree decl; tree decl;
java_parser_context_save_global (); java_parser_context_save_global ();
decl = lookup_field (&type, name); decl = lookup_field (&type, name);
/* Last chance: if we're within the context of an inner class, we
might be trying to access a local variable defined in an outer
context. We try to look for it now. */
if (INNER_CLASS_TYPE_P (class) && (!decl || decl == error_mark_node))
{
char *alias_buffer;
MANGLE_OUTER_LOCAL_VARIABLE_NAME (alias_buffer, name);
name = get_identifier (alias_buffer);
type = class;
decl = lookup_field (&type, name);
if (decl && decl != error_mark_node)
FIELD_LOCAL_ALIAS_USED (decl) = 1;
}
java_parser_context_restore_global (); java_parser_context_restore_global ();
return decl == error_mark_node ? NULL : decl; return decl == error_mark_node ? NULL : decl;
} }
...@@ -8450,25 +8465,17 @@ resolve_expression_name (id, orig) ...@@ -8450,25 +8465,17 @@ resolve_expression_name (id, orig)
else else
{ {
decl = lookup_field_wrapper (current_class, name); decl = lookup_field_wrapper (current_class, name);
/* Last chance: if we're within the context of an inner
class, we might be trying to access a local variable
defined in an outer context. We try to look for it
now. */
if (!decl && INNER_CLASS_TYPE_P (current_class))
{
char *alias_buffer;
MANGLE_OUTER_LOCAL_VARIABLE_NAME (alias_buffer, name);
name = get_identifier (alias_buffer);
decl = lookup_field_wrapper (current_class, name);
if (decl)
FIELD_LOCAL_ALIAS_USED (decl) = 1;
}
if (decl) if (decl)
{ {
tree access = NULL_TREE; tree access = NULL_TREE;
int fs = FIELD_STATIC (decl); int fs = FIELD_STATIC (decl);
/* If we're accessing an outer scope local alias, make
sure we change the name of the field we're going to
build access to. */
if (FIELD_LOCAL_ALIAS_USED (decl))
name = DECL_NAME (decl);
/* Instance variable (8.3.1.1) can't appear within /* Instance variable (8.3.1.1) can't appear within
static method, static initializer or initializer for static method, static initializer or initializer for
a static variable. */ a static variable. */
...@@ -10154,8 +10161,9 @@ qualify_ambiguous_name (id) ...@@ -10154,8 +10161,9 @@ qualify_ambiguous_name (id)
qual = TREE_CHAIN (qual); qual = TREE_CHAIN (qual);
again = new_array_found = 1; again = new_array_found = 1;
continue; continue;
case NEW_CLASS_EXPR:
case CONVERT_EXPR: case CONVERT_EXPR:
break;
case NEW_CLASS_EXPR:
qual_wfl = TREE_OPERAND (qual_wfl, 0); qual_wfl = TREE_OPERAND (qual_wfl, 0);
break; break;
case ARRAY_REF: case ARRAY_REF:
...@@ -10240,10 +10248,10 @@ qualify_ambiguous_name (id) ...@@ -10240,10 +10248,10 @@ qualify_ambiguous_name (id)
} }
} while (again); } while (again);
/* If name appears within the scope of a location variable /* If name appears within the scope of a local variable declaration
declaration or parameter declaration, then it is an expression or parameter declaration, then it is an expression name. We don't
name. We don't carry this test out if we're in the context of the carry this test out if we're in the context of the use of SUPER
use of SUPER or THIS */ or THIS */
if (!this_found && !super_found if (!this_found && !super_found
&& TREE_CODE (name) != STRING_CST && TREE_CODE (name) != INTEGER_CST && TREE_CODE (name) != STRING_CST && TREE_CODE (name) != INTEGER_CST
&& (decl = IDENTIFIER_LOCAL_VALUE (name))) && (decl = IDENTIFIER_LOCAL_VALUE (name)))
...@@ -10279,7 +10287,7 @@ qualify_ambiguous_name (id) ...@@ -10279,7 +10287,7 @@ qualify_ambiguous_name (id)
QUAL_RESOLUTION (qual) = decl; QUAL_RESOLUTION (qual) = decl;
} }
/* Method call are expression name */ /* Method call, array references and cast are expression name */
else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
|| TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF
|| TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR) || TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment