1/* A Bison parser, made from /home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y, by GNU bison 1.75.  */
2
3/* Skeleton parser for Yacc-like parsing with Bison,
4   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software
18   Foundation, Inc., 59 Temple Place - Suite 330,
19   Boston, MA 02111-1307, USA.  */
20
21/* As a special exception, when this file is copied by Bison into a
22   Bison output file, you may use that output file without restriction.
23   This special exception was added by the Free Software Foundation
24   in version 1.24 of Bison.  */
25
26/* Written by Richard Stallman by simplifying the original so called
27   ``semantic'' parser.  */
28
29/* All symbols defined below should begin with yy or YY, to avoid
30   infringing on user name space.  This should be done even for local
31   variables, as they might otherwise be expanded by user macros.
32   There are some unavoidable exceptions within include files to
33   define necessary library symbols; they are noted "INFRINGES ON
34   USER NAME SPACE" below.  */
35
36/* Identify Bison output.  */
37#define YYBISON	1
38
39/* Pure parsers.  */
40#define YYPURE	1
41
42/* Using locations.  */
43#define YYLSP_NEEDED 0
44
45/* If NAME_PREFIX is specified substitute the variables and functions
46   names.  */
47#define yyparse java_parse
48#define yylex   java_lex
49#define yyerror java_error
50#define yylval  java_lval
51#define yychar  java_char
52#define yydebug java_debug
53#define yynerrs java_nerrs
54
55
56/* Tokens.  */
57#ifndef YYTOKENTYPE
58# define YYTOKENTYPE
59   /* Put the tokens into the symbol table, so that GDB and other debuggers
60      know about them.  */
61   enum yytokentype {
62     PLUS_TK = 258,
63     MINUS_TK = 259,
64     MULT_TK = 260,
65     DIV_TK = 261,
66     REM_TK = 262,
67     LS_TK = 263,
68     SRS_TK = 264,
69     ZRS_TK = 265,
70     AND_TK = 266,
71     XOR_TK = 267,
72     OR_TK = 268,
73     BOOL_AND_TK = 269,
74     BOOL_OR_TK = 270,
75     EQ_TK = 271,
76     NEQ_TK = 272,
77     GT_TK = 273,
78     GTE_TK = 274,
79     LT_TK = 275,
80     LTE_TK = 276,
81     PLUS_ASSIGN_TK = 277,
82     MINUS_ASSIGN_TK = 278,
83     MULT_ASSIGN_TK = 279,
84     DIV_ASSIGN_TK = 280,
85     REM_ASSIGN_TK = 281,
86     LS_ASSIGN_TK = 282,
87     SRS_ASSIGN_TK = 283,
88     ZRS_ASSIGN_TK = 284,
89     AND_ASSIGN_TK = 285,
90     XOR_ASSIGN_TK = 286,
91     OR_ASSIGN_TK = 287,
92     PUBLIC_TK = 288,
93     PRIVATE_TK = 289,
94     PROTECTED_TK = 290,
95     STATIC_TK = 291,
96     FINAL_TK = 292,
97     SYNCHRONIZED_TK = 293,
98     VOLATILE_TK = 294,
99     TRANSIENT_TK = 295,
100     NATIVE_TK = 296,
101     PAD_TK = 297,
102     ABSTRACT_TK = 298,
103     STRICT_TK = 299,
104     MODIFIER_TK = 300,
105     DECR_TK = 301,
106     INCR_TK = 302,
107     DEFAULT_TK = 303,
108     IF_TK = 304,
109     THROW_TK = 305,
110     BOOLEAN_TK = 306,
111     DO_TK = 307,
112     IMPLEMENTS_TK = 308,
113     THROWS_TK = 309,
114     BREAK_TK = 310,
115     IMPORT_TK = 311,
116     ELSE_TK = 312,
117     INSTANCEOF_TK = 313,
118     RETURN_TK = 314,
119     VOID_TK = 315,
120     CATCH_TK = 316,
121     INTERFACE_TK = 317,
122     CASE_TK = 318,
123     EXTENDS_TK = 319,
124     FINALLY_TK = 320,
125     SUPER_TK = 321,
126     WHILE_TK = 322,
127     CLASS_TK = 323,
128     SWITCH_TK = 324,
129     CONST_TK = 325,
130     TRY_TK = 326,
131     FOR_TK = 327,
132     NEW_TK = 328,
133     CONTINUE_TK = 329,
134     GOTO_TK = 330,
135     PACKAGE_TK = 331,
136     THIS_TK = 332,
137     ASSERT_TK = 333,
138     BYTE_TK = 334,
139     SHORT_TK = 335,
140     INT_TK = 336,
141     LONG_TK = 337,
142     CHAR_TK = 338,
143     INTEGRAL_TK = 339,
144     FLOAT_TK = 340,
145     DOUBLE_TK = 341,
146     FP_TK = 342,
147     ID_TK = 343,
148     REL_QM_TK = 344,
149     REL_CL_TK = 345,
150     NOT_TK = 346,
151     NEG_TK = 347,
152     ASSIGN_ANY_TK = 348,
153     ASSIGN_TK = 349,
154     OP_TK = 350,
155     CP_TK = 351,
156     OCB_TK = 352,
157     CCB_TK = 353,
158     OSB_TK = 354,
159     CSB_TK = 355,
160     SC_TK = 356,
161     C_TK = 357,
162     DOT_TK = 358,
163     STRING_LIT_TK = 359,
164     CHAR_LIT_TK = 360,
165     INT_LIT_TK = 361,
166     FP_LIT_TK = 362,
167     TRUE_TK = 363,
168     FALSE_TK = 364,
169     BOOL_LIT_TK = 365,
170     NULL_TK = 366
171   };
172#endif
173#define PLUS_TK 258
174#define MINUS_TK 259
175#define MULT_TK 260
176#define DIV_TK 261
177#define REM_TK 262
178#define LS_TK 263
179#define SRS_TK 264
180#define ZRS_TK 265
181#define AND_TK 266
182#define XOR_TK 267
183#define OR_TK 268
184#define BOOL_AND_TK 269
185#define BOOL_OR_TK 270
186#define EQ_TK 271
187#define NEQ_TK 272
188#define GT_TK 273
189#define GTE_TK 274
190#define LT_TK 275
191#define LTE_TK 276
192#define PLUS_ASSIGN_TK 277
193#define MINUS_ASSIGN_TK 278
194#define MULT_ASSIGN_TK 279
195#define DIV_ASSIGN_TK 280
196#define REM_ASSIGN_TK 281
197#define LS_ASSIGN_TK 282
198#define SRS_ASSIGN_TK 283
199#define ZRS_ASSIGN_TK 284
200#define AND_ASSIGN_TK 285
201#define XOR_ASSIGN_TK 286
202#define OR_ASSIGN_TK 287
203#define PUBLIC_TK 288
204#define PRIVATE_TK 289
205#define PROTECTED_TK 290
206#define STATIC_TK 291
207#define FINAL_TK 292
208#define SYNCHRONIZED_TK 293
209#define VOLATILE_TK 294
210#define TRANSIENT_TK 295
211#define NATIVE_TK 296
212#define PAD_TK 297
213#define ABSTRACT_TK 298
214#define STRICT_TK 299
215#define MODIFIER_TK 300
216#define DECR_TK 301
217#define INCR_TK 302
218#define DEFAULT_TK 303
219#define IF_TK 304
220#define THROW_TK 305
221#define BOOLEAN_TK 306
222#define DO_TK 307
223#define IMPLEMENTS_TK 308
224#define THROWS_TK 309
225#define BREAK_TK 310
226#define IMPORT_TK 311
227#define ELSE_TK 312
228#define INSTANCEOF_TK 313
229#define RETURN_TK 314
230#define VOID_TK 315
231#define CATCH_TK 316
232#define INTERFACE_TK 317
233#define CASE_TK 318
234#define EXTENDS_TK 319
235#define FINALLY_TK 320
236#define SUPER_TK 321
237#define WHILE_TK 322
238#define CLASS_TK 323
239#define SWITCH_TK 324
240#define CONST_TK 325
241#define TRY_TK 326
242#define FOR_TK 327
243#define NEW_TK 328
244#define CONTINUE_TK 329
245#define GOTO_TK 330
246#define PACKAGE_TK 331
247#define THIS_TK 332
248#define ASSERT_TK 333
249#define BYTE_TK 334
250#define SHORT_TK 335
251#define INT_TK 336
252#define LONG_TK 337
253#define CHAR_TK 338
254#define INTEGRAL_TK 339
255#define FLOAT_TK 340
256#define DOUBLE_TK 341
257#define FP_TK 342
258#define ID_TK 343
259#define REL_QM_TK 344
260#define REL_CL_TK 345
261#define NOT_TK 346
262#define NEG_TK 347
263#define ASSIGN_ANY_TK 348
264#define ASSIGN_TK 349
265#define OP_TK 350
266#define CP_TK 351
267#define OCB_TK 352
268#define CCB_TK 353
269#define OSB_TK 354
270#define CSB_TK 355
271#define SC_TK 356
272#define C_TK 357
273#define DOT_TK 358
274#define STRING_LIT_TK 359
275#define CHAR_LIT_TK 360
276#define INT_LIT_TK 361
277#define FP_LIT_TK 362
278#define TRUE_TK 363
279#define FALSE_TK 364
280#define BOOL_LIT_TK 365
281#define NULL_TK 366
282
283
284
285
286/* Copy the first part of user declarations.  */
287#line 5 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
288
289#include "config.h"
290#include "system.h"
291#include <dirent.h>
292#include "tree.h"
293#include "rtl.h"
294#include "real.h"
295#include "obstack.h"
296#include "toplev.h"
297#include "flags.h"
298#include "java-tree.h"
299#include "jcf.h"
300#include "lex.h"
301#include "parse.h"
302#include "zipfile.h"
303#include "convert.h"
304#include "buffer.h"
305#include "xref.h"
306#include "function.h"
307#include "except.h"
308#include "ggc.h"
309#include "debug.h"
310#include "tree-inline.h"
311
312/* Local function prototypes */
313static char *java_accstring_lookup PARAMS ((int));
314static void  classitf_redefinition_error PARAMS ((const char *,tree, tree, tree));
315static void  variable_redefinition_error PARAMS ((tree, tree, tree, int));
316static tree  create_class PARAMS ((int, tree, tree, tree));
317static tree  create_interface PARAMS ((int, tree, tree));
318static void  end_class_declaration PARAMS ((int));
319static tree  find_field PARAMS ((tree, tree));
320static tree lookup_field_wrapper PARAMS ((tree, tree));
321static int   duplicate_declaration_error_p PARAMS ((tree, tree, tree));
322static void  register_fields PARAMS ((int, tree, tree));
323static tree parser_qualified_classname PARAMS ((tree));
324static int  parser_check_super PARAMS ((tree, tree, tree));
325static int  parser_check_super_interface PARAMS ((tree, tree, tree));
326static void check_modifiers_consistency PARAMS ((int));
327static tree lookup_cl PARAMS ((tree));
328static tree lookup_java_method2 PARAMS ((tree, tree, int));
329static tree method_header PARAMS ((int, tree, tree, tree));
330static void fix_method_argument_names PARAMS ((tree ,tree));
331static tree method_declarator PARAMS ((tree, tree));
332static void parse_warning_context PARAMS ((tree cl, const char *msg, ...))
333  ATTRIBUTE_PRINTF_2;
334static void issue_warning_error_from_context PARAMS ((tree, const char *msg, va_list))
335  ATTRIBUTE_PRINTF (2, 0);
336static void parse_ctor_invocation_error PARAMS ((void));
337static tree parse_jdk1_1_error PARAMS ((const char *));
338static void complete_class_report_errors PARAMS ((jdep *));
339static int process_imports PARAMS ((void));
340static void read_import_dir PARAMS ((tree));
341static int find_in_imports_on_demand PARAMS ((tree, tree));
342static void find_in_imports PARAMS ((tree, tree));
343static void check_inner_class_access PARAMS ((tree, tree, tree));
344static int check_pkg_class_access PARAMS ((tree, tree, bool));
345static void register_package PARAMS ((tree));
346static tree resolve_package PARAMS ((tree, tree *, tree *));
347static tree resolve_class PARAMS ((tree, tree, tree, tree));
348static void declare_local_variables PARAMS ((int, tree, tree));
349static void dump_java_tree PARAMS ((enum tree_dump_index, tree));
350static void source_start_java_method PARAMS ((tree));
351static void source_end_java_method PARAMS ((void));
352static tree find_name_in_single_imports PARAMS ((tree));
353static void check_abstract_method_header PARAMS ((tree));
354static tree lookup_java_interface_method2 PARAMS ((tree, tree));
355static tree resolve_expression_name PARAMS ((tree, tree *));
356static tree maybe_create_class_interface_decl PARAMS ((tree, tree, tree, tree));
357static int check_class_interface_creation PARAMS ((int, int, tree,
358						  tree, tree, tree));
359static tree patch_method_invocation PARAMS ((tree, tree, tree, int,
360					    int *, tree *));
361static int breakdown_qualified PARAMS ((tree *, tree *, tree));
362static int in_same_package PARAMS ((tree, tree));
363static tree resolve_and_layout PARAMS ((tree, tree));
364static tree qualify_and_find PARAMS ((tree, tree, tree));
365static tree resolve_no_layout PARAMS ((tree, tree));
366static int invocation_mode PARAMS ((tree, int));
367static tree find_applicable_accessible_methods_list PARAMS ((int, tree,
368							    tree, tree));
369static void search_applicable_methods_list PARAMS ((int, tree, tree, tree,
370						   tree *, tree *));
371static tree find_most_specific_methods_list PARAMS ((tree));
372static int argument_types_convertible PARAMS ((tree, tree));
373static tree patch_invoke PARAMS ((tree, tree, tree));
374static int maybe_use_access_method PARAMS ((int, tree *, tree *));
375static tree lookup_method_invoke PARAMS ((int, tree, tree, tree, tree));
376static tree register_incomplete_type PARAMS ((int, tree, tree, tree));
377static tree check_inner_circular_reference PARAMS ((tree, tree));
378static tree check_circular_reference PARAMS ((tree));
379static tree obtain_incomplete_type PARAMS ((tree));
380static tree java_complete_lhs PARAMS ((tree));
381static tree java_complete_tree PARAMS ((tree));
382static tree maybe_generate_pre_expand_clinit PARAMS ((tree));
383static int analyze_clinit_body PARAMS ((tree, tree));
384static int maybe_yank_clinit PARAMS ((tree));
385static void start_complete_expand_method PARAMS ((tree));
386static void java_complete_expand_method PARAMS ((tree));
387static void java_expand_method_bodies PARAMS ((tree));
388static int  unresolved_type_p PARAMS ((tree, tree *));
389static void create_jdep_list PARAMS ((struct parser_ctxt *));
390static tree build_expr_block PARAMS ((tree, tree));
391static tree enter_block PARAMS ((void));
392static tree exit_block PARAMS ((void));
393static tree lookup_name_in_blocks PARAMS ((tree));
394static void maybe_absorb_scoping_blocks PARAMS ((void));
395static tree build_method_invocation PARAMS ((tree, tree));
396static tree build_new_invocation PARAMS ((tree, tree));
397static tree build_assignment PARAMS ((int, int, tree, tree));
398static tree build_binop PARAMS ((enum tree_code, int, tree, tree));
399static tree patch_assignment PARAMS ((tree, tree));
400static tree patch_binop PARAMS ((tree, tree, tree));
401static tree build_unaryop PARAMS ((int, int, tree));
402static tree build_incdec PARAMS ((int, int, tree, int));
403static tree patch_unaryop PARAMS ((tree, tree));
404static tree build_cast PARAMS ((int, tree, tree));
405static tree build_null_of_type PARAMS ((tree));
406static tree patch_cast PARAMS ((tree, tree));
407static int valid_ref_assignconv_cast_p PARAMS ((tree, tree, int));
408static int valid_builtin_assignconv_identity_widening_p PARAMS ((tree, tree));
409static int valid_cast_to_p PARAMS ((tree, tree));
410static int valid_method_invocation_conversion_p PARAMS ((tree, tree));
411static tree try_builtin_assignconv PARAMS ((tree, tree, tree));
412static tree try_reference_assignconv PARAMS ((tree, tree));
413static tree build_unresolved_array_type PARAMS ((tree));
414static int build_type_name_from_array_name PARAMS ((tree, tree *));
415static tree build_array_from_name PARAMS ((tree, tree, tree, tree *));
416static tree build_array_ref PARAMS ((int, tree, tree));
417static tree patch_array_ref PARAMS ((tree));
418static tree make_qualified_name PARAMS ((tree, tree, int));
419static tree merge_qualified_name PARAMS ((tree, tree));
420static tree make_qualified_primary PARAMS ((tree, tree, int));
421static int resolve_qualified_expression_name PARAMS ((tree, tree *,
422						     tree *, tree *));
423static void qualify_ambiguous_name PARAMS ((tree));
424static tree resolve_field_access PARAMS ((tree, tree *, tree *));
425static tree build_newarray_node PARAMS ((tree, tree, int));
426static tree patch_newarray PARAMS ((tree));
427static tree resolve_type_during_patch PARAMS ((tree));
428static tree build_this PARAMS ((int));
429static tree build_wfl_wrap PARAMS ((tree, int));
430static tree build_return PARAMS ((int, tree));
431static tree patch_return PARAMS ((tree));
432static tree maybe_access_field PARAMS ((tree, tree, tree));
433static int complete_function_arguments PARAMS ((tree));
434static int check_for_static_method_reference PARAMS ((tree, tree, tree,
435						      tree, tree));
436static int not_accessible_p PARAMS ((tree, tree, tree, int));
437static void check_deprecation PARAMS ((tree, tree));
438static int class_in_current_package PARAMS ((tree));
439static tree build_if_else_statement PARAMS ((int, tree, tree, tree));
440static tree patch_if_else_statement PARAMS ((tree));
441static tree add_stmt_to_compound PARAMS ((tree, tree, tree));
442static tree add_stmt_to_block PARAMS ((tree, tree, tree));
443static tree patch_exit_expr PARAMS ((tree));
444static tree build_labeled_block PARAMS ((int, tree));
445static tree finish_labeled_statement PARAMS ((tree, tree));
446static tree build_bc_statement PARAMS ((int, int, tree));
447static tree patch_bc_statement PARAMS ((tree));
448static tree patch_loop_statement PARAMS ((tree));
449static tree build_new_loop PARAMS ((tree));
450static tree build_loop_body PARAMS ((int, tree, int));
451static tree finish_loop_body PARAMS ((int, tree, tree, int));
452static tree build_debugable_stmt PARAMS ((int, tree));
453static tree finish_for_loop PARAMS ((int, tree, tree, tree));
454static tree patch_switch_statement PARAMS ((tree));
455static tree string_constant_concatenation PARAMS ((tree, tree));
456static tree build_string_concatenation PARAMS ((tree, tree));
457static tree patch_string_cst PARAMS ((tree));
458static tree patch_string PARAMS ((tree));
459static tree encapsulate_with_try_catch PARAMS ((int, tree, tree, tree));
460static tree build_assertion PARAMS ((int, tree, tree));
461static tree build_try_statement PARAMS ((int, tree, tree));
462static tree build_try_finally_statement PARAMS ((int, tree, tree));
463static tree patch_try_statement PARAMS ((tree));
464static tree patch_synchronized_statement PARAMS ((tree, tree));
465static tree patch_throw_statement PARAMS ((tree, tree));
466static void check_thrown_exceptions PARAMS ((int, tree));
467static int check_thrown_exceptions_do PARAMS ((tree));
468static void purge_unchecked_exceptions PARAMS ((tree));
469static bool ctors_unchecked_throws_clause_p PARAMS ((tree));
470static void check_throws_clauses PARAMS ((tree, tree, tree));
471static void finish_method_declaration PARAMS ((tree));
472static tree build_super_invocation PARAMS ((tree));
473static int verify_constructor_circularity PARAMS ((tree, tree));
474static char *constructor_circularity_msg PARAMS ((tree, tree));
475static tree build_this_super_qualified_invocation PARAMS ((int, tree, tree,
476							  int, int));
477static const char *get_printable_method_name PARAMS ((tree));
478static tree patch_conditional_expr PARAMS ((tree, tree, tree));
479static tree generate_finit PARAMS ((tree));
480static tree generate_instinit PARAMS ((tree));
481static tree build_instinit_invocation PARAMS ((tree));
482static void fix_constructors PARAMS ((tree));
483static tree build_alias_initializer_parameter_list PARAMS ((int, tree,
484							    tree, int *));
485static tree craft_constructor PARAMS ((tree, tree));
486static int verify_constructor_super PARAMS ((tree));
487static tree create_artificial_method PARAMS ((tree, int, tree, tree, tree));
488static void start_artificial_method_body PARAMS ((tree));
489static void end_artificial_method_body PARAMS ((tree));
490static int check_method_redefinition PARAMS ((tree, tree));
491static int check_method_types_complete PARAMS ((tree));
492static void java_check_regular_methods PARAMS ((tree));
493static void java_check_abstract_methods PARAMS ((tree));
494static void unreachable_stmt_error PARAMS ((tree));
495static tree find_expr_with_wfl PARAMS ((tree));
496static void missing_return_error PARAMS ((tree));
497static tree build_new_array_init PARAMS ((int, tree));
498static tree patch_new_array_init PARAMS ((tree, tree));
499static tree maybe_build_array_element_wfl PARAMS ((tree));
500static int array_constructor_check_entry PARAMS ((tree, tree));
501static const char *purify_type_name PARAMS ((const char *));
502static tree fold_constant_for_init PARAMS ((tree, tree));
503static tree strip_out_static_field_access_decl PARAMS ((tree));
504static jdeplist *reverse_jdep_list PARAMS ((struct parser_ctxt *));
505static void static_ref_err PARAMS ((tree, tree, tree));
506static void parser_add_interface PARAMS ((tree, tree, tree));
507static void add_superinterfaces PARAMS ((tree, tree));
508static tree jdep_resolve_class PARAMS ((jdep *));
509static int note_possible_classname PARAMS ((const char *, int));
510static void java_complete_expand_classes PARAMS ((void));
511static void java_complete_expand_class PARAMS ((tree));
512static void java_complete_expand_methods PARAMS ((tree));
513static tree cut_identifier_in_qualified PARAMS ((tree));
514static tree java_stabilize_reference PARAMS ((tree));
515static tree do_unary_numeric_promotion PARAMS ((tree));
516static char * operator_string PARAMS ((tree));
517static tree do_merge_string_cste PARAMS ((tree, const char *, int, int));
518static tree merge_string_cste PARAMS ((tree, tree, int));
519static tree java_refold PARAMS ((tree));
520static int java_decl_equiv PARAMS ((tree, tree));
521static int binop_compound_p PARAMS ((enum tree_code));
522static tree search_loop PARAMS ((tree));
523static int labeled_block_contains_loop_p PARAMS ((tree, tree));
524static int check_abstract_method_definitions PARAMS ((int, tree, tree));
525static void java_check_abstract_method_definitions PARAMS ((tree));
526static void java_debug_context_do PARAMS ((int));
527static void java_parser_context_push_initialized_field PARAMS ((void));
528static void java_parser_context_pop_initialized_field PARAMS ((void));
529static tree reorder_static_initialized PARAMS ((tree));
530static void java_parser_context_suspend PARAMS ((void));
531static void java_parser_context_resume PARAMS ((void));
532static int pop_current_osb PARAMS ((struct parser_ctxt *));
533
534/* JDK 1.1 work. FIXME */
535
536static tree maybe_make_nested_class_name PARAMS ((tree));
537static int make_nested_class_name PARAMS ((tree));
538static void set_nested_class_simple_name_value PARAMS ((tree, int));
539static void link_nested_class_to_enclosing PARAMS ((void));
540static tree resolve_inner_class PARAMS ((htab_t, tree, tree *, tree *, tree));
541static tree find_as_inner_class PARAMS ((tree, tree, tree));
542static tree find_as_inner_class_do PARAMS ((tree, tree));
543static int check_inner_class_redefinition PARAMS ((tree, tree));
544
545static tree build_thisn_assign PARAMS ((void));
546static tree build_current_thisn PARAMS ((tree));
547static tree build_access_to_thisn PARAMS ((tree, tree, int));
548static tree maybe_build_thisn_access_method PARAMS ((tree));
549
550static tree build_outer_field_access PARAMS ((tree, tree));
551static tree build_outer_field_access_methods PARAMS ((tree));
552static tree build_outer_field_access_expr PARAMS ((int, tree, tree,
553						  tree, tree));
554static tree build_outer_method_access_method PARAMS ((tree));
555static tree build_new_access_id PARAMS ((void));
556static tree build_outer_field_access_method PARAMS ((tree, tree, tree,
557						    tree, tree));
558
559static int outer_field_access_p PARAMS ((tree, tree));
560static int outer_field_expanded_access_p PARAMS ((tree, tree *,
561						 tree *, tree *));
562static tree outer_field_access_fix PARAMS ((tree, tree, tree));
563static tree build_incomplete_class_ref PARAMS ((int, tree));
564static tree patch_incomplete_class_ref PARAMS ((tree));
565static tree create_anonymous_class PARAMS ((int, tree));
566static void patch_anonymous_class PARAMS ((tree, tree, tree));
567static void add_inner_class_fields PARAMS ((tree, tree));
568
569static tree build_dot_class_method PARAMS ((tree));
570static tree build_dot_class_method_invocation PARAMS ((tree));
571static void create_new_parser_context PARAMS ((int));
572static void mark_parser_ctxt PARAMS ((void *));
573static tree maybe_build_class_init_for_field PARAMS ((tree, tree));
574
575static int attach_init_test_initialization_flags PARAMS ((PTR *, PTR));
576static int emit_test_initialization PARAMS ((PTR *, PTR));
577
578static char *string_convert_int_cst PARAMS ((tree));
579
580/* Number of error found so far. */
581int java_error_count;
582/* Number of warning found so far. */
583int java_warning_count;
584/* Tell when not to fold, when doing xrefs */
585int do_not_fold;
586/* Cyclic inheritance report, as it can be set by layout_class */
587const char *cyclic_inheritance_report;
588
589/* The current parser context */
590struct parser_ctxt *ctxp;
591
592/* List of things that were analyzed for which code will be generated */
593struct parser_ctxt *ctxp_for_generation = NULL;
594
595/* binop_lookup maps token to tree_code. It is used where binary
596   operations are involved and required by the parser. RDIV_EXPR
597   covers both integral/floating point division. The code is changed
598   once the type of both operator is worked out.  */
599
600static const enum tree_code binop_lookup[19] =
601  {
602    PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR,
603    LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR,
604    BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR,
605    TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR,
606    EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR,
607   };
608#define BINOP_LOOKUP(VALUE) 						\
609  binop_lookup [((VALUE) - PLUS_TK) % ARRAY_SIZE (binop_lookup)]
610
611/* This is the end index for binary operators that can also be used
612   in compound assignements. */
613#define BINOP_COMPOUND_CANDIDATES 11
614
615/* The "$L" identifier we use to create labels.  */
616static GTY(()) tree label_id;
617
618/* The "StringBuffer" identifier used for the String `+' operator. */
619static GTY(()) tree wfl_string_buffer;
620
621/* The "append" identifier used for String `+' operator.  */
622static GTY(()) tree wfl_append;
623
624/* The "toString" identifier used for String `+' operator. */
625static GTY(()) tree wfl_to_string;
626
627/* The "java.lang" import qualified name.  */
628static GTY(()) tree java_lang_id;
629
630/* The generated `inst$' identifier used for generated enclosing
631   instance/field access functions.  */
632static GTY(()) tree inst_id;
633
634/* Context and flag for static blocks */
635static GTY(()) tree current_static_block;
636
637/* The generated `write_parm_value$' identifier.  */
638static GTY(()) tree wpv_id;
639
640/* The list of all packages we've seen so far */
641static GTY(()) tree package_list;
642
643/* Hold THIS for the scope of the current method decl.  */
644static GTY(()) tree current_this;
645
646/* Hold a list of catch clauses list. The first element of this list is
647   the list of the catch clauses of the currently analysed try block. */
648static GTY(()) tree currently_caught_type_list;
649
650/* This holds a linked list of all the case labels for the current
651   switch statement.  It is only used when checking to see if there
652   are duplicate labels.  FIXME: probably this should just be attached
653   to the switch itself; then it could be referenced via
654   `ctxp->current_loop'.  */
655static GTY(()) tree case_label_list;
656
657/* Anonymous class counter. Will be reset to 1 every time a non
658   anonymous class gets created. */
659static int anonymous_class_counter = 1;
660
661static GTY(()) tree src_parse_roots[1];
662
663/* All classes seen from source code */
664#define gclass_list src_parse_roots[0]
665
666/* Check modifiers. If one doesn't fit, retrieve it in its declaration
667   line and point it out.  */
668/* Should point out the one that don't fit. ASCII/unicode, going
669   backward. FIXME */
670
671#define check_modifiers(__message, __value, __mask) do {	\
672  if ((__value) & ~(__mask))					\
673    {								\
674      size_t i, remainder = (__value) & ~(__mask);	       	\
675      for (i = 0; i < ARRAY_SIZE (ctxp->modifier_ctx); i++)	\
676        if ((1 << i) & remainder)				\
677	  parse_error_context (ctxp->modifier_ctx [i], (__message), \
678			       java_accstring_lookup (1 << i)); \
679    }								\
680} while (0)
681
682
683
684/* Enabling traces.  */
685#ifndef YYDEBUG
686# define YYDEBUG 1
687#endif
688
689/* Enabling verbose error messages.  */
690#ifdef YYERROR_VERBOSE
691# undef YYERROR_VERBOSE
692# define YYERROR_VERBOSE 1
693#else
694# define YYERROR_VERBOSE 0
695#endif
696
697#ifndef YYSTYPE
698#line 401 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
699typedef union {
700  tree node;
701  int sub_token;
702  struct {
703    int token;
704    int location;
705  } operator;
706  int value;
707} yystype;
708/* Line 193 of /usr/share/bison/yacc.c.  */
709#line 710 "p13913.c"
710# define YYSTYPE yystype
711# define YYSTYPE_IS_TRIVIAL 1
712#endif
713
714#ifndef YYLTYPE
715typedef struct yyltype
716{
717  int first_line;
718  int first_column;
719  int last_line;
720  int last_column;
721} yyltype;
722# define YYLTYPE yyltype
723# define YYLTYPE_IS_TRIVIAL 1
724#endif
725
726/* Copy the second part of user declarations.  */
727#line 411 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
728
729#include "lex.c"
730
731
732/* Line 213 of /usr/share/bison/yacc.c.  */
733#line 734 "p13913.c"
734
735#if ! defined (yyoverflow) || YYERROR_VERBOSE
736
737/* The parser invokes alloca or malloc; define the necessary symbols.  */
738
739# if YYSTACK_USE_ALLOCA
740#  define YYSTACK_ALLOC alloca
741# else
742#  ifndef YYSTACK_USE_ALLOCA
743#   if defined (alloca) || defined (_ALLOCA_H)
744#    define YYSTACK_ALLOC alloca
745#   else
746#    ifdef __GNUC__
747#     define YYSTACK_ALLOC __builtin_alloca
748#    endif
749#   endif
750#  endif
751# endif
752
753# ifdef YYSTACK_ALLOC
754   /* Pacify GCC's `empty if-body' warning. */
755#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
756# else
757#  if defined (__STDC__) || defined (__cplusplus)
758#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
759#   define YYSIZE_T size_t
760#  endif
761#  define YYSTACK_ALLOC malloc
762#  define YYSTACK_FREE free
763# endif
764#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
765
766
767#if (! defined (yyoverflow) \
768     && (! defined (__cplusplus) \
769	 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
770
771/* A type that is properly aligned for any stack member.  */
772union yyalloc
773{
774  short yyss;
775  YYSTYPE yyvs;
776  };
777
778/* The size of the maximum gap between one aligned stack and the next.  */
779# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
780
781/* The size of an array large to enough to hold all stacks, each with
782   N elements.  */
783# define YYSTACK_BYTES(N) \
784     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
785      + YYSTACK_GAP_MAX)
786
787/* Copy COUNT objects from FROM to TO.  The source and destination do
788   not overlap.  */
789# ifndef YYCOPY
790#  if 1 < __GNUC__
791#   define YYCOPY(To, From, Count) \
792      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
793#  else
794#   define YYCOPY(To, From, Count)		\
795      do					\
796	{					\
797	  register YYSIZE_T yyi;		\
798	  for (yyi = 0; yyi < (Count); yyi++)	\
799	    (To)[yyi] = (From)[yyi];	\
800	}					\
801      while (0)
802#  endif
803# endif
804
805/* Relocate STACK from its old location to the new one.  The
806   local variables YYSIZE and YYSTACKSIZE give the old and new number of
807   elements in the stack, and YYPTR gives the new location of the
808   stack.  Advance YYPTR to a properly aligned location for the next
809   stack.  */
810# define YYSTACK_RELOCATE(Stack)					\
811    do									\
812      {									\
813	YYSIZE_T yynewbytes;						\
814	YYCOPY (&yyptr->Stack, Stack, yysize);				\
815	Stack = &yyptr->Stack;						\
816	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;	\
817	yyptr += yynewbytes / sizeof (*yyptr);				\
818      }									\
819    while (0)
820
821#endif
822
823#if defined (__STDC__) || defined (__cplusplus)
824   typedef signed char yysigned_char;
825#else
826   typedef short yysigned_char;
827#endif
828
829/* YYFINAL -- State number of the termination state. */
830#define YYFINAL  3
831#define YYLAST   5787
832
833/* YYNTOKENS -- Number of terminals. */
834#define YYNTOKENS  112
835/* YYNNTS -- Number of nonterminals. */
836#define YYNNTS  165
837/* YYNRULES -- Number of rules. */
838#define YYNRULES  511
839/* YYNRULES -- Number of states. */
840#define YYNSTATES  787
841
842/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
843#define YYUNDEFTOK  2
844#define YYMAXUTOK   366
845
846#define YYTRANSLATE(X) \
847  ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
848
849/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
850static const unsigned char yytranslate[] =
851{
852       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
853       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
854       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
855       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
856       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
857       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
858       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
859       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
860       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
861       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
862       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
863       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
864       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
865       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
866       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
867       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
868       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
869       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
870       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
871       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
872       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
873       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
874       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
875       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
876       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
877       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
878       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
879      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
880      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
881      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
882      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
883      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
884      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
885      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
886      85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
887      95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
888     105,   106,   107,   108,   109,   110,   111
889};
890
891#if YYDEBUG
892/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
893   YYRHS.  */
894static const unsigned short yyprhs[] =
895{
896       0,     0,     3,     4,     7,     9,    11,    13,    15,    17,
897      19,    21,    23,    25,    27,    29,    31,    33,    35,    37,
898      39,    42,    45,    47,    49,    51,    55,    57,    58,    60,
899      62,    64,    67,    70,    73,    77,    79,    82,    84,    87,
900      91,    94,    98,   100,   102,   106,   109,   113,   119,   124,
901     130,   132,   134,   136,   138,   140,   143,   144,   152,   153,
902     160,   164,   167,   171,   176,   177,   180,   184,   187,   188,
903     191,   194,   196,   200,   204,   207,   211,   213,   216,   218,
904     220,   222,   224,   226,   228,   230,   232,   234,   238,   243,
905     245,   249,   253,   255,   259,   263,   268,   270,   274,   277,
906     281,   285,   287,   289,   290,   294,   297,   301,   305,   310,
907     315,   318,   322,   325,   329,   332,   336,   341,   345,   349,
908     353,   355,   359,   363,   366,   370,   373,   377,   379,   380,
909     383,   386,   388,   392,   396,   398,   400,   403,   405,   406,
910     410,   413,   417,   421,   426,   429,   433,   437,   442,   444,
911     449,   455,   463,   470,   472,   474,   475,   480,   481,   487,
912     488,   494,   495,   502,   506,   511,   514,   518,   521,   525,
913     528,   532,   534,   537,   539,   541,   543,   545,   547,   550,
914     553,   556,   560,   564,   569,   571,   575,   579,   582,   586,
915     588,   590,   592,   595,   597,   599,   601,   604,   607,   611,
916     613,   615,   617,   619,   621,   623,   625,   627,   629,   631,
917     633,   635,   637,   639,   641,   643,   645,   647,   649,   651,
918     653,   655,   657,   659,   662,   665,   668,   671,   674,   677,
919     680,   683,   687,   692,   697,   703,   708,   714,   721,   729,
920     736,   738,   740,   742,   744,   746,   748,   750,   756,   759,
921     763,   768,   776,   784,   785,   789,   794,   797,   801,   807,
922     810,   814,   818,   823,   825,   828,   831,   833,   836,   840,
923     843,   846,   850,   853,   858,   861,   864,   868,   873,   876,
924     878,   886,   894,   901,   905,   911,   916,   924,   931,   934,
925     937,   941,   944,   945,   947,   949,   952,   953,   955,   957,
926     961,   965,   968,   972,   975,   979,   982,   986,   989,   993,
927     996,  1000,  1003,  1007,  1011,  1014,  1018,  1024,  1028,  1031,
928    1035,  1041,  1047,  1050,  1055,  1059,  1061,  1065,  1069,  1074,
929    1077,  1079,  1082,  1085,  1090,  1093,  1097,  1102,  1105,  1108,
930    1110,  1112,  1114,  1116,  1120,  1122,  1124,  1126,  1128,  1130,
931    1134,  1138,  1142,  1146,  1150,  1154,  1158,  1162,  1166,  1172,
932    1177,  1179,  1184,  1190,  1196,  1203,  1207,  1211,  1216,  1222,
933    1225,  1229,  1230,  1238,  1239,  1246,  1250,  1254,  1256,  1260,
934    1264,  1268,  1272,  1277,  1282,  1287,  1292,  1296,  1300,  1302,
935    1305,  1309,  1313,  1316,  1319,  1323,  1327,  1331,  1335,  1338,
936    1342,  1347,  1353,  1360,  1366,  1373,  1378,  1383,  1388,  1393,
937    1397,  1402,  1406,  1411,  1413,  1415,  1417,  1419,  1422,  1425,
938    1427,  1429,  1432,  1434,  1437,  1439,  1442,  1445,  1448,  1451,
939    1454,  1457,  1459,  1462,  1465,  1467,  1470,  1473,  1479,  1484,
940    1489,  1495,  1500,  1503,  1509,  1514,  1520,  1522,  1526,  1530,
941    1534,  1538,  1542,  1546,  1548,  1552,  1556,  1560,  1564,  1566,
942    1570,  1574,  1578,  1582,  1586,  1590,  1592,  1596,  1600,  1604,
943    1608,  1612,  1616,  1620,  1624,  1628,  1632,  1634,  1638,  1642,
944    1646,  1650,  1652,  1656,  1660,  1662,  1666,  1670,  1672,  1676,
945    1680,  1682,  1686,  1690,  1692,  1696,  1700,  1702,  1708,  1713,
946    1717,  1723,  1725,  1727,  1731,  1735,  1737,  1739,  1741,  1743,
947    1745,  1747
948};
949
950/* YYRHS -- A `-1'-separated list of the rules' RHS. */
951static const short yyrhs[] =
952{
953     113,     0,    -1,    -1,   114,   127,    -1,   106,    -1,   107,
954      -1,   110,    -1,   105,    -1,   104,    -1,   111,    -1,   117,
955      -1,   118,    -1,    84,    -1,    87,    -1,    51,    -1,   119,
956      -1,   122,    -1,   123,    -1,   119,    -1,   119,    -1,   117,
957     247,    -1,   123,   247,    -1,   124,    -1,   125,    -1,   126,
958      -1,   123,   103,   126,    -1,    88,    -1,    -1,   130,    -1,
959     128,    -1,   129,    -1,   130,   128,    -1,   130,   129,    -1,
960     128,   129,    -1,   130,   128,   129,    -1,   131,    -1,   128,
961     131,    -1,   134,    -1,   129,   134,    -1,    76,   123,   101,
962      -1,    76,     1,    -1,    76,   123,     1,    -1,   132,    -1,
963     133,    -1,    56,   123,   101,    -1,    56,     1,    -1,    56,
964     123,     1,    -1,    56,   123,   103,     5,   101,    -1,    56,
965     123,   103,     1,    -1,    56,   123,   103,     5,     1,    -1,
966     136,    -1,   171,    -1,   194,    -1,     1,    -1,    45,    -1,
967     135,    45,    -1,    -1,   135,    68,   126,   139,   140,   137,
968     142,    -1,    -1,    68,   126,   139,   140,   138,   142,    -1,
969     135,    68,     1,    -1,    68,     1,    -1,    68,   126,     1,
970      -1,   135,    68,   126,     1,    -1,    -1,    64,   120,    -1,
971      64,   120,     1,    -1,    64,     1,    -1,    -1,    53,   141,
972      -1,    53,     1,    -1,   121,    -1,   141,   102,   121,    -1,
973     141,   102,     1,    -1,    97,    98,    -1,    97,   143,    98,
974      -1,   144,    -1,   143,   144,    -1,   145,    -1,   161,    -1,
975     163,    -1,   184,    -1,   146,    -1,   151,    -1,   136,    -1,
976     171,    -1,   194,    -1,   116,   147,   101,    -1,   135,   116,
977     147,   101,    -1,   148,    -1,   147,   102,   148,    -1,   147,
978     102,     1,    -1,   149,    -1,   149,    94,   150,    -1,   149,
979      94,     1,    -1,   149,    94,   150,     1,    -1,   126,    -1,
980     149,    99,   100,    -1,   126,     1,    -1,   149,    99,     1,
981      -1,   149,   100,     1,    -1,   275,    -1,   182,    -1,    -1,
982     153,   152,   160,    -1,   153,     1,    -1,   116,   154,   158,
983      -1,    60,   154,   158,    -1,   135,   116,   154,   158,    -1,
984     135,    60,   154,   158,    -1,   116,     1,    -1,   135,   116,
985       1,    -1,    60,     1,    -1,   135,    60,     1,    -1,   135,
986       1,    -1,   126,    95,    96,    -1,   126,    95,   155,    96,
987      -1,   154,    99,   100,    -1,   126,    95,     1,    -1,   154,
988      99,     1,    -1,   156,    -1,   155,   102,   156,    -1,   155,
989     102,     1,    -1,   116,   149,    -1,   157,   116,   149,    -1,
990     116,     1,    -1,   157,   116,     1,    -1,   135,    -1,    -1,
991      54,   159,    -1,    54,     1,    -1,   120,    -1,   159,   102,
992     120,    -1,   159,   102,     1,    -1,   184,    -1,   101,    -1,
993     162,   184,    -1,   135,    -1,    -1,   165,   164,   167,    -1,
994     166,   158,    -1,   135,   166,   158,    -1,   124,    95,    96,
995      -1,   124,    95,   155,    96,    -1,   185,   168,    -1,   185,
996     169,   168,    -1,   185,   187,   168,    -1,   185,   169,   187,
997     168,    -1,   186,    -1,   170,    95,    96,   101,    -1,   170,
998      95,   243,    96,   101,    -1,   123,   103,    66,    95,   243,
999      96,   101,    -1,   123,   103,    66,    95,    96,   101,    -1,
1000      77,    -1,    66,    -1,    -1,    62,   126,   172,   177,    -1,
1001      -1,   135,    62,   126,   173,   177,    -1,    -1,    62,   126,
1002     176,   174,   177,    -1,    -1,   135,    62,   126,   176,   175,
1003     177,    -1,    62,   126,     1,    -1,   135,    62,   126,     1,
1004      -1,    64,   121,    -1,   176,   102,   121,    -1,    64,     1,
1005      -1,   176,   102,     1,    -1,    97,    98,    -1,    97,   178,
1006      98,    -1,   179,    -1,   178,   179,    -1,   180,    -1,   181,
1007      -1,   136,    -1,   171,    -1,   146,    -1,   153,   101,    -1,
1008     153,     1,    -1,    97,    98,    -1,    97,   102,    98,    -1,
1009      97,   183,    98,    -1,    97,   183,   102,    98,    -1,   150,
1010      -1,   183,   102,   150,    -1,   183,   102,     1,    -1,    97,
1011      98,    -1,   185,   187,   186,    -1,    97,    -1,    98,    -1,
1012     188,    -1,   187,   188,    -1,   189,    -1,   191,    -1,   136,
1013      -1,   190,   101,    -1,   116,   147,    -1,   157,   116,   147,
1014      -1,   193,    -1,   196,    -1,   200,    -1,   201,    -1,   212,
1015      -1,   216,    -1,   193,    -1,   197,    -1,   202,    -1,   213,
1016      -1,   217,    -1,   184,    -1,   194,    -1,   198,    -1,   203,
1017      -1,   215,    -1,   223,    -1,   224,    -1,   225,    -1,   228,
1018      -1,   226,    -1,   230,    -1,   227,    -1,   101,    -1,   126,
1019      90,    -1,   195,   191,    -1,   126,     1,    -1,   195,   192,
1020      -1,   199,   101,    -1,     1,   101,    -1,     1,    97,    -1,
1021       1,    98,    -1,   170,    95,     1,    -1,   170,    95,    96,
1022       1,    -1,   170,    95,   243,     1,    -1,   170,    95,   243,
1023      96,     1,    -1,   123,   103,    66,     1,    -1,   123,   103,
1024      66,    95,     1,    -1,   123,   103,    66,    95,   243,     1,
1025      -1,   123,   103,    66,    95,   243,    96,     1,    -1,   123,
1026     103,    66,    95,    96,     1,    -1,   272,    -1,   256,    -1,
1027     257,    -1,   252,    -1,   253,    -1,   249,    -1,   238,    -1,
1028      49,    95,   275,    96,   191,    -1,    49,     1,    -1,    49,
1029      95,     1,    -1,    49,    95,   275,     1,    -1,    49,    95,
1030     275,    96,   192,    57,   191,    -1,    49,    95,   275,    96,
1031     192,    57,   192,    -1,    -1,   205,   204,   206,    -1,    69,
1032      95,   275,    96,    -1,    69,     1,    -1,    69,    95,     1,
1033      -1,    69,    95,   275,    96,     1,    -1,    97,    98,    -1,
1034      97,   209,    98,    -1,    97,   207,    98,    -1,    97,   207,
1035     209,    98,    -1,   208,    -1,   207,   208,    -1,   209,   187,
1036      -1,   210,    -1,   209,   210,    -1,    63,   276,    90,    -1,
1037      48,    90,    -1,    63,     1,    -1,    63,   276,     1,    -1,
1038      48,     1,    -1,    67,    95,   275,    96,    -1,   211,   191,
1039      -1,    67,     1,    -1,    67,    95,     1,    -1,    67,    95,
1040     275,     1,    -1,   211,   192,    -1,    52,    -1,   214,   191,
1041      67,    95,   275,    96,   101,    -1,   219,   101,   275,   101,
1042     221,    96,   191,    -1,   219,   101,   101,   221,    96,   191,
1043      -1,   219,   101,     1,    -1,   219,   101,   275,   101,     1,
1044      -1,   219,   101,   101,     1,    -1,   219,   101,   275,   101,
1045     221,    96,   192,    -1,   219,   101,   101,   221,    96,   192,
1046      -1,    72,    95,    -1,    72,     1,    -1,    72,    95,     1,
1047      -1,   218,   220,    -1,    -1,   222,    -1,   190,    -1,   222,
1048       1,    -1,    -1,   222,    -1,   199,    -1,   222,   102,   199,
1049      -1,   222,   102,     1,    -1,    55,   101,    -1,    55,   126,
1050     101,    -1,    55,     1,    -1,    55,   126,     1,    -1,    74,
1051     101,    -1,    74,   126,   101,    -1,    74,     1,    -1,    74,
1052     126,     1,    -1,    59,   101,    -1,    59,   275,   101,    -1,
1053      59,     1,    -1,    59,   275,     1,    -1,    50,   275,   101,
1054      -1,    50,     1,    -1,    50,   275,     1,    -1,    78,   275,
1055      90,   275,   101,    -1,    78,   275,   101,    -1,    78,     1,
1056      -1,    78,   275,     1,    -1,   229,    95,   275,    96,   184,
1057      -1,   229,    95,   275,    96,     1,    -1,   229,     1,    -1,
1058     229,    95,     1,    96,    -1,   229,    95,     1,    -1,   135,
1059      -1,    71,   184,   231,    -1,    71,   184,   234,    -1,    71,
1060     184,   231,   234,    -1,    71,     1,    -1,   232,    -1,   231,
1061     232,    -1,   233,   184,    -1,    61,    95,   156,    96,    -1,
1062      61,     1,    -1,    61,    95,     1,    -1,    61,    95,     1,
1063      96,    -1,    65,   184,    -1,    65,     1,    -1,   236,    -1,
1064     244,    -1,   115,    -1,    77,    -1,    95,   275,    96,    -1,
1065     238,    -1,   248,    -1,   249,    -1,   250,    -1,   237,    -1,
1066     123,   103,    77,    -1,    95,   275,     1,    -1,   123,   103,
1067       1,    -1,   117,   103,     1,    -1,    60,   103,     1,    -1,
1068     123,   103,    68,    -1,   122,   103,    68,    -1,   117,   103,
1069      68,    -1,    60,   103,    68,    -1,    73,   120,    95,   243,
1070      96,    -1,    73,   120,    95,    96,    -1,   239,    -1,   242,
1071     126,    95,    96,    -1,   242,   126,    95,    96,   142,    -1,
1072     242,   126,    95,   243,    96,    -1,   242,   126,    95,   243,
1073      96,   142,    -1,    73,     1,   101,    -1,    73,   120,     1,
1074      -1,    73,   120,    95,     1,    -1,    73,   120,    95,   243,
1075       1,    -1,   242,     1,    -1,   242,   126,     1,    -1,    -1,
1076      73,   120,    95,   243,    96,   240,   142,    -1,    -1,    73,
1077     120,    95,    96,   241,   142,    -1,   123,   103,    73,    -1,
1078     235,   103,    73,    -1,   275,    -1,   243,   102,   275,    -1,
1079     243,   102,     1,    -1,    73,   117,   245,    -1,    73,   119,
1080     245,    -1,    73,   117,   245,   247,    -1,    73,   119,   245,
1081     247,    -1,    73,   119,   247,   182,    -1,    73,   117,   247,
1082     182,    -1,    73,     1,   100,    -1,    73,     1,    99,    -1,
1083     246,    -1,   245,   246,    -1,    99,   275,   100,    -1,    99,
1084     275,     1,    -1,    99,     1,    -1,    99,   100,    -1,   247,
1085      99,   100,    -1,   247,    99,     1,    -1,   235,   103,   126,
1086      -1,    66,   103,   126,    -1,    66,     1,    -1,   123,    95,
1087      96,    -1,   123,    95,   243,    96,    -1,   235,   103,   126,
1088      95,    96,    -1,   235,   103,   126,    95,   243,    96,    -1,
1089      66,   103,   126,    95,    96,    -1,    66,   103,   126,    95,
1090     243,    96,    -1,    66,   103,     1,    96,    -1,    66,   103,
1091       1,   103,    -1,   123,    99,   275,   100,    -1,   236,    99,
1092     275,   100,    -1,   123,    99,     1,    -1,   123,    99,   275,
1093       1,    -1,   236,    99,     1,    -1,   236,    99,   275,     1,
1094      -1,   235,    -1,   123,    -1,   252,    -1,   253,    -1,   251,
1095      47,    -1,   251,    46,    -1,   256,    -1,   257,    -1,     3,
1096     255,    -1,   258,    -1,     3,     1,    -1,   254,    -1,     4,
1097     254,    -1,     4,     1,    -1,    47,   255,    -1,    47,     1,
1098      -1,    46,   255,    -1,    46,     1,    -1,   251,    -1,    91,
1099     255,    -1,    92,   255,    -1,   259,    -1,    91,     1,    -1,
1100      92,     1,    -1,    95,   117,   247,    96,   255,    -1,    95,
1101     117,    96,   255,    -1,    95,   275,    96,   258,    -1,    95,
1102     123,   247,    96,   258,    -1,    95,   117,    99,     1,    -1,
1103      95,     1,    -1,    95,   117,   247,    96,     1,    -1,    95,
1104     117,    96,     1,    -1,    95,   123,   247,    96,     1,    -1,
1105     255,    -1,   260,     5,   255,    -1,   260,     6,   255,    -1,
1106     260,     7,   255,    -1,   260,     5,     1,    -1,   260,     6,
1107       1,    -1,   260,     7,     1,    -1,   260,    -1,   261,     3,
1108     260,    -1,   261,     4,   260,    -1,   261,     3,     1,    -1,
1109     261,     4,     1,    -1,   261,    -1,   262,     8,   261,    -1,
1110     262,     9,   261,    -1,   262,    10,   261,    -1,   262,     8,
1111       1,    -1,   262,     9,     1,    -1,   262,    10,     1,    -1,
1112     262,    -1,   263,    20,   262,    -1,   263,    18,   262,    -1,
1113     263,    21,   262,    -1,   263,    19,   262,    -1,   263,    58,
1114     118,    -1,   263,    20,     1,    -1,   263,    18,     1,    -1,
1115     263,    21,     1,    -1,   263,    19,     1,    -1,   263,    58,
1116       1,    -1,   263,    -1,   264,    16,   263,    -1,   264,    17,
1117     263,    -1,   264,    16,     1,    -1,   264,    17,     1,    -1,
1118     264,    -1,   265,    11,   264,    -1,   265,    11,     1,    -1,
1119     265,    -1,   266,    12,   265,    -1,   266,    12,     1,    -1,
1120     266,    -1,   267,    13,   266,    -1,   267,    13,     1,    -1,
1121     267,    -1,   268,    14,   267,    -1,   268,    14,     1,    -1,
1122     268,    -1,   269,    15,   268,    -1,   269,    15,     1,    -1,
1123     269,    -1,   269,    89,   275,    90,   270,    -1,   269,    89,
1124      90,     1,    -1,   269,    89,     1,    -1,   269,    89,   275,
1125      90,     1,    -1,   270,    -1,   272,    -1,   273,   274,   271,
1126      -1,   273,   274,     1,    -1,   123,    -1,   248,    -1,   250,
1127      -1,    93,    -1,    94,    -1,   271,    -1,   275,    -1
1128};
1129
1130/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
1131static const unsigned short yyrline[] =
1132{
1133       0,   562,   562,   561,   577,   579,   580,   581,   582,   583,
1134     587,   589,   592,   594,   595,   598,   600,   603,   607,   611,
1135     615,   624,   635,   637,   640,   644,   649,   654,   656,   657,
1136     658,   659,   660,   661,   662,   665,   670,   676,   678,   681,
1137     687,   689,   693,   695,   698,   725,   727,   731,   750,   752,
1138     756,   759,   761,   762,   770,   775,   792,   790,   796,   795,
1139     799,   801,   803,   808,   812,   814,   816,   818,   822,   824,
1140     826,   833,   839,   844,   848,   857,   867,   869,   872,   874,
1141     875,   876,   886,   888,   889,   891,   893,   897,   900,   910,
1142     913,   915,   919,   922,   929,   935,   943,   945,   947,   949,
1143     954,   958,   960,   966,   964,   976,   980,   983,   985,   987,
1144     989,   994,   999,  1004,  1009,  1016,  1022,  1024,  1033,  1035,
1145    1039,  1044,  1049,  1053,  1058,  1063,  1068,  1075,  1085,  1087,
1146    1089,  1093,  1096,  1098,  1102,  1104,  1108,  1117,  1135,  1133,
1147    1143,  1146,  1150,  1156,  1160,  1167,  1169,  1171,  1175,  1180,
1148    1187,  1194,  1196,  1200,  1207,  1219,  1217,  1223,  1222,  1227,
1149    1226,  1231,  1230,  1234,  1236,  1240,  1246,  1251,  1253,  1257,
1150    1260,  1264,  1266,  1269,  1271,  1272,  1274,  1278,  1282,  1288,
1151    1293,  1296,  1298,  1300,  1304,  1310,  1314,  1319,  1328,  1332,
1152    1337,  1351,  1353,  1356,  1358,  1360,  1367,  1371,  1374,  1378,
1153    1380,  1381,  1382,  1383,  1384,  1388,  1390,  1391,  1392,  1393,
1154    1397,  1399,  1400,  1401,  1402,  1403,  1404,  1405,  1406,  1407,
1155    1408,  1409,  1412,  1430,  1441,  1444,  1448,  1454,  1464,  1469,
1156    1474,  1479,  1481,  1486,  1488,  1493,  1495,  1497,  1499,  1501,
1157    1505,  1507,  1508,  1509,  1510,  1511,  1512,  1515,  1521,  1523,
1158    1525,  1529,  1534,  1541,  1539,  1555,  1561,  1563,  1565,  1571,
1159    1574,  1576,  1578,  1582,  1584,  1587,  1591,  1593,  1596,  1603,
1160    1609,  1611,  1613,  1617,  1625,  1628,  1630,  1632,  1636,  1641,
1161    1650,  1655,  1662,  1669,  1671,  1673,  1677,  1680,  1689,  1696,
1162    1698,  1702,  1715,  1717,  1723,  1729,  1733,  1735,  1739,  1742,
1163    1744,  1748,  1751,  1753,  1755,  1759,  1762,  1764,  1766,  1770,
1164    1773,  1775,  1777,  1781,  1787,  1789,  1793,  1798,  1802,  1804,
1165    1808,  1815,  1817,  1819,  1821,  1825,  1837,  1840,  1842,  1847,
1166    1851,  1853,  1860,  1869,  1886,  1888,  1893,  1897,  1900,  1905,
1167    1907,  1910,  1912,  1914,  1916,  1917,  1918,  1919,  1920,  1922,
1168    1927,  1929,  1931,  1933,  1937,  1940,  1942,  1944,  1951,  1954,
1169    1956,  1958,  1964,  1965,  1971,  1972,  1974,  1976,  1978,  1980,
1170    1982,  1990,  1988,  2023,  2022,  2039,  2042,  2046,  2052,  2057,
1171    2061,  2064,  2066,  2068,  2071,  2082,  2091,  2093,  2097,  2100,
1172    2104,  2115,  2117,  2125,  2152,  2154,  2158,  2162,  2168,  2172,
1173    2175,  2177,  2188,  2199,  2204,  2210,  2212,  2216,  2219,  2221,
1174    2226,  2231,  2236,  2243,  2245,  2246,  2247,  2250,  2255,  2260,
1175    2262,  2263,  2265,  2266,  2270,  2276,  2278,  2282,  2285,  2289,
1176    2292,  2296,  2298,  2300,  2302,  2303,  2305,  2309,  2318,  2320,
1177    2322,  2336,  2338,  2343,  2345,  2347,  2351,  2353,  2358,  2363,
1178    2368,  2370,  2372,  2376,  2378,  2383,  2388,  2390,  2394,  2396,
1179    2401,  2406,  2411,  2413,  2415,  2419,  2421,  2426,  2431,  2436,
1180    2441,  2443,  2445,  2447,  2449,  2451,  2455,  2457,  2462,  2467,
1181    2469,  2473,  2475,  2480,  2484,  2486,  2491,  2495,  2497,  2502,
1182    2506,  2508,  2513,  2517,  2519,  2524,  2528,  2530,  2535,  2541,
1183    2543,  2547,  2549,  2552,  2555,  2562,  2564,  2565,  2568,  2570,
1184    2573,  2577
1185};
1186#endif
1187
1188#if YYDEBUG || YYERROR_VERBOSE
1189/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1190   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1191static const char *const yytname[] =
1192{
1193  "$end", "error", "$undefined", "PLUS_TK", "MINUS_TK", "MULT_TK", "DIV_TK",
1194  "REM_TK", "LS_TK", "SRS_TK", "ZRS_TK", "AND_TK", "XOR_TK", "OR_TK",
1195  "BOOL_AND_TK", "BOOL_OR_TK", "EQ_TK", "NEQ_TK", "GT_TK", "GTE_TK",
1196  "LT_TK", "LTE_TK", "PLUS_ASSIGN_TK", "MINUS_ASSIGN_TK",
1197  "MULT_ASSIGN_TK", "DIV_ASSIGN_TK", "REM_ASSIGN_TK", "LS_ASSIGN_TK",
1198  "SRS_ASSIGN_TK", "ZRS_ASSIGN_TK", "AND_ASSIGN_TK", "XOR_ASSIGN_TK",
1199  "OR_ASSIGN_TK", "PUBLIC_TK", "PRIVATE_TK", "PROTECTED_TK", "STATIC_TK",
1200  "FINAL_TK", "SYNCHRONIZED_TK", "VOLATILE_TK", "TRANSIENT_TK",
1201  "NATIVE_TK", "PAD_TK", "ABSTRACT_TK", "STRICT_TK", "MODIFIER_TK",
1202  "DECR_TK", "INCR_TK", "DEFAULT_TK", "IF_TK", "THROW_TK", "BOOLEAN_TK",
1203  "DO_TK", "IMPLEMENTS_TK", "THROWS_TK", "BREAK_TK", "IMPORT_TK",
1204  "ELSE_TK", "INSTANCEOF_TK", "RETURN_TK", "VOID_TK", "CATCH_TK",
1205  "INTERFACE_TK", "CASE_TK", "EXTENDS_TK", "FINALLY_TK", "SUPER_TK",
1206  "WHILE_TK", "CLASS_TK", "SWITCH_TK", "CONST_TK", "TRY_TK", "FOR_TK",
1207  "NEW_TK", "CONTINUE_TK", "GOTO_TK", "PACKAGE_TK", "THIS_TK",
1208  "ASSERT_TK", "BYTE_TK", "SHORT_TK", "INT_TK", "LONG_TK", "CHAR_TK",
1209  "INTEGRAL_TK", "FLOAT_TK", "DOUBLE_TK", "FP_TK", "ID_TK", "REL_QM_TK",
1210  "REL_CL_TK", "NOT_TK", "NEG_TK", "ASSIGN_ANY_TK", "ASSIGN_TK", "OP_TK",
1211  "CP_TK", "OCB_TK", "CCB_TK", "OSB_TK", "CSB_TK", "SC_TK", "C_TK",
1212  "DOT_TK", "STRING_LIT_TK", "CHAR_LIT_TK", "INT_LIT_TK", "FP_LIT_TK",
1213  "TRUE_TK", "FALSE_TK", "BOOL_LIT_TK", "NULL_TK", "$accept", "goal",
1214  "@1", "literal", "type", "primitive_type", "reference_type",
1215  "class_or_interface_type", "class_type", "interface_type", "array_type",
1216  "name", "simple_name", "qualified_name", "identifier",
1217  "compilation_unit", "import_declarations", "type_declarations",
1218  "package_declaration", "import_declaration",
1219  "single_type_import_declaration", "type_import_on_demand_declaration",
1220  "type_declaration", "modifiers", "class_declaration", "@2", "@3",
1221  "super", "interfaces", "interface_type_list", "class_body",
1222  "class_body_declarations", "class_body_declaration",
1223  "class_member_declaration", "field_declaration", "variable_declarators",
1224  "variable_declarator", "variable_declarator_id", "variable_initializer",
1225  "method_declaration", "@4", "method_header", "method_declarator",
1226  "formal_parameter_list", "formal_parameter", "final", "throws",
1227  "class_type_list", "method_body", "static_initializer", "static",
1228  "constructor_declaration", "@5", "constructor_header",
1229  "constructor_declarator", "constructor_body", "constructor_block_end",
1230  "explicit_constructor_invocation", "this_or_super",
1231  "interface_declaration", "@6", "@7", "@8", "@9", "extends_interfaces",
1232  "interface_body", "interface_member_declarations",
1233  "interface_member_declaration", "constant_declaration",
1234  "abstract_method_declaration", "array_initializer",
1235  "variable_initializers", "block", "block_begin", "block_end",
1236  "block_statements", "block_statement",
1237  "local_variable_declaration_statement", "local_variable_declaration",
1238  "statement", "statement_nsi", "statement_without_trailing_substatement",
1239  "empty_statement", "label_decl", "labeled_statement",
1240  "labeled_statement_nsi", "expression_statement", "statement_expression",
1241  "if_then_statement", "if_then_else_statement",
1242  "if_then_else_statement_nsi", "switch_statement", "@10",
1243  "switch_expression", "switch_block", "switch_block_statement_groups",
1244  "switch_block_statement_group", "switch_labels", "switch_label",
1245  "while_expression", "while_statement", "while_statement_nsi",
1246  "do_statement_begin", "do_statement", "for_statement",
1247  "for_statement_nsi", "for_header", "for_begin", "for_init",
1248  "for_update", "statement_expression_list", "break_statement",
1249  "continue_statement", "return_statement", "throw_statement",
1250  "assert_statement", "synchronized_statement", "synchronized",
1251  "try_statement", "catches", "catch_clause", "catch_clause_parameter",
1252  "finally", "primary", "primary_no_new_array", "type_literals",
1253  "class_instance_creation_expression", "anonymous_class_creation", "@11",
1254  "@12", "something_dot_new", "argument_list",
1255  "array_creation_expression", "dim_exprs", "dim_expr", "dims",
1256  "field_access", "method_invocation", "array_access",
1257  "postfix_expression", "post_increment_expression",
1258  "post_decrement_expression", "trap_overflow_corner_case",
1259  "unary_expression", "pre_increment_expression",
1260  "pre_decrement_expression", "unary_expression_not_plus_minus",
1261  "cast_expression", "multiplicative_expression", "additive_expression",
1262  "shift_expression", "relational_expression", "equality_expression",
1263  "and_expression", "exclusive_or_expression", "inclusive_or_expression",
1264  "conditional_and_expression", "conditional_or_expression",
1265  "conditional_expression", "assignment_expression", "assignment",
1266  "left_hand_side", "assignment_operator", "expression",
1267  "constant_expression", 0
1268};
1269#endif
1270
1271# ifdef YYPRINT
1272/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1273   token YYLEX-NUM.  */
1274static const unsigned short yytoknum[] =
1275{
1276       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
1277     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
1278     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1279     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
1280     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
1281     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
1282     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
1283     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
1284     335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
1285     345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
1286     355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
1287     365,   366
1288};
1289# endif
1290
1291/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
1292static const unsigned short yyr1[] =
1293{
1294       0,   112,   114,   113,   115,   115,   115,   115,   115,   115,
1295     116,   116,   117,   117,   117,   118,   118,   119,   120,   121,
1296     122,   122,   123,   123,   124,   125,   126,   127,   127,   127,
1297     127,   127,   127,   127,   127,   128,   128,   129,   129,   130,
1298     130,   130,   131,   131,   132,   132,   132,   133,   133,   133,
1299     134,   134,   134,   134,   135,   135,   137,   136,   138,   136,
1300     136,   136,   136,   136,   139,   139,   139,   139,   140,   140,
1301     140,   141,   141,   141,   142,   142,   143,   143,   144,   144,
1302     144,   144,   145,   145,   145,   145,   145,   146,   146,   147,
1303     147,   147,   148,   148,   148,   148,   149,   149,   149,   149,
1304     149,   150,   150,   152,   151,   151,   153,   153,   153,   153,
1305     153,   153,   153,   153,   153,   154,   154,   154,   154,   154,
1306     155,   155,   155,   156,   156,   156,   156,   157,   158,   158,
1307     158,   159,   159,   159,   160,   160,   161,   162,   164,   163,
1308     165,   165,   166,   166,   167,   167,   167,   167,   168,   169,
1309     169,   169,   169,   170,   170,   172,   171,   173,   171,   174,
1310     171,   175,   171,   171,   171,   176,   176,   176,   176,   177,
1311     177,   178,   178,   179,   179,   179,   179,   180,   181,   181,
1312     182,   182,   182,   182,   183,   183,   183,   184,   184,   185,
1313     186,   187,   187,   188,   188,   188,   189,   190,   190,   191,
1314     191,   191,   191,   191,   191,   192,   192,   192,   192,   192,
1315     193,   193,   193,   193,   193,   193,   193,   193,   193,   193,
1316     193,   193,   194,   195,   196,   196,   197,   198,   198,   198,
1317     198,   198,   198,   198,   198,   198,   198,   198,   198,   198,
1318     199,   199,   199,   199,   199,   199,   199,   200,   200,   200,
1319     200,   201,   202,   204,   203,   205,   205,   205,   205,   206,
1320     206,   206,   206,   207,   207,   208,   209,   209,   210,   210,
1321     210,   210,   210,   211,   212,   212,   212,   212,   213,   214,
1322     215,   216,   216,   216,   216,   216,   217,   217,   218,   218,
1323     218,   219,   220,   220,   220,   220,   221,   221,   222,   222,
1324     222,   223,   223,   223,   223,   224,   224,   224,   224,   225,
1325     225,   225,   225,   226,   226,   226,   227,   227,   227,   227,
1326     228,   228,   228,   228,   228,   229,   230,   230,   230,   230,
1327     231,   231,   232,   233,   233,   233,   233,   234,   234,   235,
1328     235,   236,   236,   236,   236,   236,   236,   236,   236,   236,
1329     236,   236,   236,   236,   237,   237,   237,   237,   238,   238,
1330     238,   238,   238,   238,   238,   238,   238,   238,   238,   238,
1331     238,   240,   239,   241,   239,   242,   242,   243,   243,   243,
1332     244,   244,   244,   244,   244,   244,   244,   244,   245,   245,
1333     246,   246,   246,   247,   247,   247,   248,   248,   248,   249,
1334     249,   249,   249,   249,   249,   249,   249,   250,   250,   250,
1335     250,   250,   250,   251,   251,   251,   251,   252,   253,   254,
1336     254,   254,   254,   254,   255,   255,   255,   256,   256,   257,
1337     257,   258,   258,   258,   258,   258,   258,   259,   259,   259,
1338     259,   259,   259,   259,   259,   259,   260,   260,   260,   260,
1339     260,   260,   260,   261,   261,   261,   261,   261,   262,   262,
1340     262,   262,   262,   262,   262,   263,   263,   263,   263,   263,
1341     263,   263,   263,   263,   263,   263,   264,   264,   264,   264,
1342     264,   265,   265,   265,   266,   266,   266,   267,   267,   267,
1343     268,   268,   268,   269,   269,   269,   270,   270,   270,   270,
1344     270,   271,   271,   272,   272,   273,   273,   273,   274,   274,
1345     275,   276
1346};
1347
1348/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
1349static const unsigned char yyr2[] =
1350{
1351       0,     2,     0,     2,     1,     1,     1,     1,     1,     1,
1352       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1353       2,     2,     1,     1,     1,     3,     1,     0,     1,     1,
1354       1,     2,     2,     2,     3,     1,     2,     1,     2,     3,
1355       2,     3,     1,     1,     3,     2,     3,     5,     4,     5,
1356       1,     1,     1,     1,     1,     2,     0,     7,     0,     6,
1357       3,     2,     3,     4,     0,     2,     3,     2,     0,     2,
1358       2,     1,     3,     3,     2,     3,     1,     2,     1,     1,
1359       1,     1,     1,     1,     1,     1,     1,     3,     4,     1,
1360       3,     3,     1,     3,     3,     4,     1,     3,     2,     3,
1361       3,     1,     1,     0,     3,     2,     3,     3,     4,     4,
1362       2,     3,     2,     3,     2,     3,     4,     3,     3,     3,
1363       1,     3,     3,     2,     3,     2,     3,     1,     0,     2,
1364       2,     1,     3,     3,     1,     1,     2,     1,     0,     3,
1365       2,     3,     3,     4,     2,     3,     3,     4,     1,     4,
1366       5,     7,     6,     1,     1,     0,     4,     0,     5,     0,
1367       5,     0,     6,     3,     4,     2,     3,     2,     3,     2,
1368       3,     1,     2,     1,     1,     1,     1,     1,     2,     2,
1369       2,     3,     3,     4,     1,     3,     3,     2,     3,     1,
1370       1,     1,     2,     1,     1,     1,     2,     2,     3,     1,
1371       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1372       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1373       1,     1,     1,     2,     2,     2,     2,     2,     2,     2,
1374       2,     3,     4,     4,     5,     4,     5,     6,     7,     6,
1375       1,     1,     1,     1,     1,     1,     1,     5,     2,     3,
1376       4,     7,     7,     0,     3,     4,     2,     3,     5,     2,
1377       3,     3,     4,     1,     2,     2,     1,     2,     3,     2,
1378       2,     3,     2,     4,     2,     2,     3,     4,     2,     1,
1379       7,     7,     6,     3,     5,     4,     7,     6,     2,     2,
1380       3,     2,     0,     1,     1,     2,     0,     1,     1,     3,
1381       3,     2,     3,     2,     3,     2,     3,     2,     3,     2,
1382       3,     2,     3,     3,     2,     3,     5,     3,     2,     3,
1383       5,     5,     2,     4,     3,     1,     3,     3,     4,     2,
1384       1,     2,     2,     4,     2,     3,     4,     2,     2,     1,
1385       1,     1,     1,     3,     1,     1,     1,     1,     1,     3,
1386       3,     3,     3,     3,     3,     3,     3,     3,     5,     4,
1387       1,     4,     5,     5,     6,     3,     3,     4,     5,     2,
1388       3,     0,     7,     0,     6,     3,     3,     1,     3,     3,
1389       3,     3,     4,     4,     4,     4,     3,     3,     1,     2,
1390       3,     3,     2,     2,     3,     3,     3,     3,     2,     3,
1391       4,     5,     6,     5,     6,     4,     4,     4,     4,     3,
1392       4,     3,     4,     1,     1,     1,     1,     2,     2,     1,
1393       1,     2,     1,     2,     1,     2,     2,     2,     2,     2,
1394       2,     1,     2,     2,     1,     2,     2,     5,     4,     4,
1395       5,     4,     2,     5,     4,     5,     1,     3,     3,     3,
1396       3,     3,     3,     1,     3,     3,     3,     3,     1,     3,
1397       3,     3,     3,     3,     3,     1,     3,     3,     3,     3,
1398       3,     3,     3,     3,     3,     3,     1,     3,     3,     3,
1399       3,     1,     3,     3,     1,     3,     3,     1,     3,     3,
1400       1,     3,     3,     1,     3,     3,     1,     5,     4,     3,
1401       5,     1,     1,     3,     3,     1,     1,     1,     1,     1,
1402       1,     1
1403};
1404
1405/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1406   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
1407   means the default is an error.  */
1408static const unsigned short yydefact[] =
1409{
1410       2,     0,     0,     1,    53,    54,     0,     0,     0,     0,
1411     222,     3,     0,     0,     0,    35,    42,    43,    37,     0,
1412      50,    51,    52,    45,    26,     0,    22,    23,    24,     0,
1413      61,     0,    40,     0,     0,    36,    38,     0,     0,    55,
1414       0,     0,    46,    44,     0,   163,     0,     0,   159,    62,
1415       0,    68,    41,    39,     0,     0,     0,    60,     0,    48,
1416       0,    25,   167,    19,   165,    17,     0,   156,     0,     0,
1417      67,    18,     0,     0,    58,   164,     0,   161,    63,    68,
1418      49,    47,    14,     0,    12,    13,   169,     0,    10,    11,
1419      15,    16,    17,     0,   175,   177,     0,   176,     0,   171,
1420     173,   174,   168,   166,   160,    66,    70,    71,    69,     0,
1421     158,     0,    56,   112,     0,   128,   110,     0,     0,    89,
1422      92,   128,     0,    20,    21,   114,     0,     0,   179,   178,
1423     170,   172,     0,     0,    59,   162,     0,     0,     0,     0,
1424     107,    98,    87,     0,     0,     0,     0,   106,   393,     0,
1425     113,   128,   111,     0,   128,    73,    72,   189,    74,    22,
1426       0,    84,     0,    76,    78,    82,    83,     0,    79,     0,
1427      80,   138,   128,    85,    81,     0,    86,    57,   118,   115,
1428       0,   127,     0,   120,     0,   130,   131,   129,   119,   117,
1429      91,     0,    90,    94,     0,     0,     0,     0,     0,     0,
1430       0,   342,     0,     0,     0,     0,     8,     7,     4,     5,
1431       6,     9,   341,     0,     0,   414,     0,   102,   413,   339,
1432     348,   344,   360,     0,   340,   345,   346,   347,   431,   415,
1433     416,   424,   446,   419,   420,   422,   434,   453,   458,   465,
1434     476,   481,   484,   487,   490,   493,   496,   501,   510,   502,
1435       0,   101,    99,    97,   100,   395,   394,   109,    88,   108,
1436     187,     0,   128,    75,    77,   105,     0,   136,     0,   140,
1437       0,     0,     0,   279,     0,     0,     0,     0,     0,     0,
1438       0,     0,   342,     0,     0,     0,    10,    16,   414,     0,
1439     127,   195,     0,     0,   210,     0,   191,   193,     0,   194,
1440     199,   211,     0,   200,   212,     0,   201,   202,   213,   253,
1441       0,   203,     0,   214,   204,   292,     0,   215,   216,   217,
1442     219,   221,   218,     0,   220,   246,   245,     0,   243,   244,
1443     241,   242,   240,   125,   123,   116,     0,     0,     0,   423,
1444     414,   345,   347,   421,   426,   425,   430,   429,   428,   427,
1445       0,   398,     0,     0,     0,    18,     0,   435,   432,   436,
1446     433,   442,     0,   414,     0,   180,     0,   184,     0,     0,
1447       0,     0,     0,     0,    95,     0,     0,   369,     0,   418,
1448     417,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1449       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1450       0,     0,   508,   509,     0,   142,     0,   141,   135,   104,
1451     134,   189,   139,     0,   229,   230,   228,   248,     0,   314,
1452       0,   303,   301,     0,   311,   309,     0,   275,     0,   256,
1453       0,   329,     0,   289,     0,   307,   305,     0,   318,     0,
1454       0,   197,     0,   225,   223,     0,     0,   190,   188,   192,
1455     196,   414,   325,   224,   227,     0,   274,     0,   414,   294,
1456     298,   291,     0,     0,   322,     0,   122,   121,   126,   124,
1457     133,   132,   353,   357,     0,   397,   387,   386,   365,     0,
1458     380,   388,     0,   381,     0,   366,     0,     0,     0,    20,
1459      21,   350,   343,   181,   182,     0,   352,   356,   355,   399,
1460       0,   377,   409,     0,   351,   354,   375,   349,   376,   396,
1461     411,     0,   370,     0,   450,   447,   451,   448,   452,   449,
1462     456,   454,   457,   455,   462,   459,   463,   460,   464,   461,
1463     472,   467,   474,   469,   471,   466,   473,   468,   475,     0,
1464     470,   479,   477,   480,   478,   483,   482,   486,   485,   489,
1465     488,   492,   491,   495,   494,   499,     0,     0,   504,   503,
1466     143,   414,   144,     0,     0,   148,     0,   249,     0,   315,
1467     313,   304,   302,   312,   310,   276,     0,   257,     0,     0,
1468       0,   326,   330,     0,   327,   290,   308,   306,   319,     0,
1469     317,   343,     0,   198,   231,     0,     0,     0,   254,     0,
1470     295,     0,   283,     0,     0,   324,     0,   405,   406,     0,
1471     392,     0,   389,   382,   385,   383,   384,   367,   359,     0,
1472     444,   438,   441,     0,     0,   439,   186,   183,   185,   400,
1473       0,   410,   407,     0,   412,   408,   361,     0,   498,     0,
1474       0,   145,     0,     0,   146,   250,     0,   277,   273,     0,
1475     334,     0,   338,   337,   331,   328,   332,     0,   235,     0,
1476     232,   233,     0,     0,     0,   259,     0,   263,     0,   266,
1477       0,   300,   299,   285,     0,   297,     0,   323,     0,   403,
1478       0,   391,   390,     0,   368,   358,   443,   437,   445,   440,
1479     379,   378,   401,     0,   362,   363,   500,   497,     0,   147,
1480       0,     0,     0,   247,     0,   199,     0,   206,   207,     0,
1481     208,   209,     0,   258,   335,     0,   316,   236,     0,     0,
1482     234,   272,   269,   270,   511,     0,   261,   264,     0,   260,
1483       0,   267,     0,     0,   284,     0,   321,   320,   404,   374,
1484       0,   402,   364,     0,   149,     0,     0,     0,   226,   278,
1485       0,   336,   333,   239,   237,     0,   271,   268,   262,     0,
1486     282,     0,   372,     0,     0,   150,     0,   251,     0,     0,
1487     238,   280,   281,   152,     0,     0,     0,     0,   151,     0,
1488       0,     0,     0,   287,     0,   252,   286
1489};
1490
1491/* YYDEFGOTO[NTERM-NUM]. */
1492static const short yydefgoto[] =
1493{
1494      -1,     1,     2,   212,   285,   213,    89,    90,    72,    64,
1495     214,   215,    26,    27,    28,    11,    12,    13,    14,    15,
1496      16,    17,    18,   452,   291,   136,   109,    51,    74,   108,
1497     134,   162,   163,   164,    95,   118,   119,   120,   216,   166,
1498     266,    96,   115,   182,   183,   292,   140,   187,   409,   168,
1499     169,   170,   268,   171,   172,   412,   562,   563,   293,    21,
1500      47,    76,    69,   111,    48,    67,    98,    99,   100,   101,
1501     217,   368,   294,   175,   565,   730,   296,   297,   298,   299,
1502     704,   300,   301,   302,   303,   707,   304,   305,   306,   307,
1503     708,   308,   455,   309,   598,   666,   667,   668,   669,   310,
1504     311,   710,   312,   313,   314,   711,   315,   316,   461,   674,
1505     675,   317,   318,   319,   320,   321,   322,   323,   324,   581,
1506     582,   583,   584,   218,   219,   220,   221,   222,   740,   683,
1507     223,   500,   224,   480,   481,   124,   225,   226,   227,   228,
1508     229,   230,   231,   232,   233,   234,   235,   236,   237,   238,
1509     239,   240,   241,   242,   243,   244,   245,   246,   247,   248,
1510     249,   250,   404,   501,   725
1511};
1512
1513/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1514   STATE-NUM.  */
1515#define YYPACT_NINF -630
1516static const short yypact[] =
1517{
1518    -630,    57,   108,  -630,  -630,  -630,   411,    -9,   471,   482,
1519    -630,  -630,   518,   627,   576,  -630,  -630,  -630,  -630,   493,
1520    -630,  -630,  -630,  -630,  -630,    20,  -630,  -630,  -630,   338,
1521    -630,   307,  -630,    27,   692,  -630,  -630,   614,   757,  -630,
1522      -9,   553,  -630,  -630,    25,  -630,   563,     4,   122,  -630,
1523     568,   210,  -630,  -630,    -9,   782,   399,  -630,   397,  -630,
1524      40,  -630,  -630,  -630,  -630,   151,  1250,  -630,   572,     4,
1525    -630,  -630,   355,   596,  -630,  -630,     4,   122,  -630,   210,
1526    -630,  -630,  -630,   597,  -630,  -630,  -630,   598,   195,  -630,
1527    -630,  -630,   -19,   975,  -630,  -630,    54,  -630,  1302,  -630,
1528    -630,  -630,  -630,  -630,  -630,  -630,  -630,  -630,   264,   256,
1529    -630,     4,  -630,  -630,   316,   -22,  -630,   118,   131,  -630,
1530     191,   -22,   301,   319,   319,  -630,   603,   622,  -630,  -630,
1531    -630,  -630,   638,  1032,  -630,  -630,   256,   610,   663,    17,
1532    -630,  -630,  -630,   673,  2245,   110,   424,  -630,  -630,   150,
1533    -630,   -22,  -630,   182,   -22,  -630,  -630,   360,  -630,   376,
1534     864,  -630,  1076,  -630,  -630,  -630,  -630,    47,  -630,   392,
1535    -630,  -630,   448,  -630,  -630,  1965,  -630,  -630,  -630,  -630,
1536     677,   490,   259,  -630,   721,  -630,  -630,   438,  -630,  -630,
1537    -630,   157,  -630,  -630,  2953,  5191,  3005,  3071,   469,    21,
1538     491,  -630,  3123,  3189,  3241,  1490,  -630,  -630,  -630,  -630,
1539    -630,  -630,  -630,   -10,   513,   972,    33,  -630,   521,   530,
1540    -630,  -630,  -630,   706,  -630,   710,  -630,   740,   817,  -630,
1541    -630,  -630,  -630,  -630,  -630,  -630,  -630,   928,   884,   585,
1542     965,   922,   631,   655,   621,   636,     8,  -630,  -630,  -630,
1543     866,  -630,  -630,  -630,  -630,  -630,  -630,  -630,  -630,  -630,
1544    -630,   891,   448,  -630,  -630,  -630,   245,  -630,   574,  -630,
1545     719,   248,  3307,  -630,    71,  2297,    15,   277,   405,   267,
1546     415,    94,   584,  3359,  5624,    -9,   -10,   513,   985,   241,
1547     414,  -630,   721,   664,  -630,  1896,  -630,  -630,   582,  -630,
1548    -630,  -630,  2034,  -630,  -630,   587,  -630,  -630,  -630,  -630,
1549    2034,  -630,  2034,  -630,  -630,  5676,   662,  -630,  -630,  -630,
1550    -630,  -630,  -630,   422,  -630,   850,   870,   817,   946,   951,
1551    -630,  -630,  -630,  -630,   905,  -630,   645,   708,   711,  -630,
1552     809,  -630,  -630,  -630,  -630,  -630,  -630,  -630,  -630,  -630,
1553      26,  -630,   734,   871,   678,   678,   425,  -630,  -630,  -630,
1554    -630,  -630,   743,   972,   261,  -630,   713,  -630,   555,    28,
1555     722,  5388,  2363,   581,  -630,   207,  3425,  -630,   426,  -630,
1556    -630,  3477,  3543,  3595,  3661,  3713,  3779,  3831,  3897,  3949,
1557    4015,  4067,  4133,   630,  4185,  4251,  4303,  4369,  4421,  4487,
1558    4539,  2415,  -630,  -630,  4605,  -630,   377,  -630,  -630,  -630,
1559    -630,  -630,  -630,  1896,  -630,  -630,  -630,  -630,  4657,  -630,
1560      84,  -630,  -630,   204,  -630,  -630,   214,  -630,  4723,  -630,
1561    4775,  -630,   463,  -630,  5243,  -630,  -630,   220,  -630,   124,
1562     272,   712,   679,  -630,  -630,    -9,  2481,  -630,  -630,  -630,
1563    -630,   996,   490,  -630,  -630,   727,  -630,   759,  1019,  -630,
1564    -630,  -630,    36,  2533,  -630,  4841,  -630,  -630,  -630,   905,
1565    -630,  -630,  -630,  -630,   -13,   736,  -630,  -630,  -630,  2599,
1566     678,  -630,   381,   678,   381,  -630,  2651,  4893,   170,   417,
1567     640,  -630,  1752,  -630,  -630,  2179,  -630,  -630,  -630,  -630,
1568     510,  -630,  -630,   202,  -630,  -630,  -630,  -630,  -630,   748,
1569    -630,   237,  -630,  5454,  -630,  -630,  -630,  -630,  -630,  -630,
1570    -630,   928,  -630,   928,  -630,   884,  -630,   884,  -630,   884,
1571    -630,   585,  -630,   585,  -630,   585,  -630,   585,  -630,   195,
1572    -630,  -630,   965,  -630,   965,  -630,   922,  -630,   631,  -630,
1573     655,  -630,   621,  -630,   636,  -630,   828,   762,  -630,  -630,
1574    -630,  1077,  -630,  1896,   764,  -630,  1896,  -630,   325,  -630,
1575    -630,  -630,  -630,  -630,  -630,  -630,   366,  -630,   765,   427,
1576     268,   463,  -630,   392,  -630,  -630,  -630,  -630,  -630,  5624,
1577    -630,  -630,   430,   712,  -630,   873,    65,   686,  -630,   776,
1578    -630,  5336,  -630,  5268,   778,   786,   789,  -630,  -630,  5506,
1579    -630,   251,  -630,   319,  -630,   319,  -630,  -630,   793,    85,
1580    -630,  -630,  -630,  4959,  1158,  -630,  -630,  -630,  -630,  -630,
1581    5011,  -630,  -630,  5572,  -630,  -630,   256,   617,  -630,  5077,
1582     698,  -630,  1896,  2717,  -630,  -630,  2101,  -630,  -630,   306,
1583    -630,   811,  -630,  -630,  -630,  -630,  -630,   800,  -630,  2769,
1584    -630,  -630,   893,    75,  5129,  -630,   725,  -630,  1604,  -630,
1585    5624,  -630,  -630,  -630,   822,   805,  5311,  -630,   317,  -630,
1586     629,  -630,  -630,   256,  -630,   831,  -630,  -630,  -630,  -630,
1587    -630,  -630,  -630,   666,  -630,   256,  -630,  -630,   453,  -630,
1588     222,    90,   476,  -630,   874,   889,  2101,  -630,  -630,  2101,
1589    -630,  -630,   876,  -630,   878,   903,  -630,  -630,   979,   165,
1590    -630,  -630,  -630,  -630,  -630,   442,  -630,  -630,  1694,  -630,
1591    1827,  -630,   910,  2034,  -630,   917,  -630,  -630,  -630,  -630,
1592     256,  -630,  -630,  2835,  -630,   227,  4657,  2034,  -630,  -630,
1593    2887,  -630,  -630,  -630,  -630,  1000,  -630,  -630,  -630,   920,
1594    -630,  2034,  -630,   240,   201,  -630,   394,  -630,  5268,   921,
1595    -630,  -630,  -630,  -630,   246,  2101,   934,  5311,  -630,   967,
1596    2101,   937,  2101,  -630,  2101,  -630,  -630
1597};
1598
1599/* YYPGOTO[NTERM-NUM].  */
1600static const short yypgoto[] =
1601{
1602    -630,  -630,  -630,  -630,   -62,   -55,   641,   -26,  -131,   161,
1603     138,    -6,   475,  -630,   139,  -630,  1022,   593,  -630,    51,
1604    -630,  -630,   815,   102,   554,  -630,  -630,   980,   960,  -630,
1605    -130,  -630,   879,  -630,   -88,  -112,   901,  -175,  -203,  -630,
1606    -630,   -60,   400,   785,  -324,  -128,  -102,  -630,  -630,  -630,
1607    -630,  -630,  -630,  -630,   887,  -630,   100,  -630,   637,   371,
1608    -630,  -630,  -630,  -630,   993,    -8,  -630,   953,  -630,  -630,
1609     101,  -630,  -116,   784,   758,  -167,  -294,  -630,   739,  -277,
1610     109,  -430,   588,  -336,  -630,  -630,  -630,  -302,  -630,  -630,
1611    -630,  -630,  -630,  -630,  -630,  -630,   389,   390,  -629,  -287,
1612    -630,  -630,  -630,  -630,  -630,  -630,  -630,  -241,  -630,  -625,
1613     742,  -630,  -630,  -630,  -630,  -630,  -630,  -630,  -630,  -630,
1614     477,  -630,   483,  -630,  -630,  -630,   145,  -630,  -630,  -630,
1615    -630,  -432,  -630,   714,   312,   -38,  1226,   234,  1246,   235,
1616     428,   545,   877,  -138,   635,   730,  -482,  -630,   623,   602,
1617     565,   633,   672,   684,   687,   683,   676,  -630,   458,   694,
1618     791,  -630,  -630,   856,  -630
1619};
1620
1621/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
1622   positive, shift that token.  If negative, reduce the rule which
1623   number is the opposite.  If zero, do what YYDEFACT says.
1624   If YYTABLE_NINF, parse error.  */
1625#define YYTABLE_NINF -508
1626static const short yytable[] =
1627{
1628      25,   449,   367,    33,    87,   334,   177,   186,   295,   184,
1629     625,    88,   467,   460,   596,   153,   351,   174,   188,   147,
1630      63,    42,   351,   400,    71,   453,    59,   472,    52,   496,
1631      60,   127,   138,   456,   374,   457,    87,   600,    88,   731,
1632      65,    80,    63,    88,    65,   165,   174,    63,   265,   257,
1633     123,   735,   259,   267,   619,   128,   343,     3,   347,   349,
1634      92,   104,    65,    35,   358,   360,   661,    65,   110,   356,
1635     269,    87,   421,   167,   165,   180,   721,   139,    88,    24,
1636     122,   637,    88,   607,    54,   569,   684,    92,    35,   122,
1637     608,   661,    92,   369,   473,   435,   497,   401,   127,   731,
1638      87,    66,   167,   135,    19,    88,    63,    88,   -27,     4,
1639    -154,   252,    71,    24,    19,    19,    19,   189,   352,   141,
1640     286,    43,   337,    44,   352,   588,    65,    92,    53,    88,
1641      54,    92,    65,   184,   -93,   -93,    19,  -293,   601,    19,
1642      19,    81,   689,   776,  -103,   354,    29,    31,  -103,   362,
1643     410,   255,   781,     5,    92,   129,    92,    19,   141,    24,
1644     407,   662,   469,   432,     6,   722,   754,   630,    93,   288,
1645       7,   622,   422,   441,   355,   123,     8,   680,    92,    56,
1646      58,   685,    24,    61,     9,   570,   745,   630,   340,   340,
1647     340,   340,   630,    61,    65,   436,   340,   340,   363,   180,
1648      93,   693,   754,   631,    91,   571,    88,   471,   184,    10,
1649     253,   701,   -96,   137,   589,   573,   705,   -96,   -96,   -96,
1650     -96,   586,   114,   660,    68,   590,   117,   719,   720,   103,
1651     445,    91,   142,   143,   107,   160,    91,    88,   634,   181,
1652     286,   753,   443,   515,   517,   519,   566,   770,   123,   417,
1653     256,   -96,   681,   -96,    54,    92,   -96,   -96,   -96,   -96,
1654     286,   755,   491,    73,   160,   114,   117,   630,   431,   652,
1655     148,    91,   449,   491,   180,    91,   705,   290,   427,   705,
1656     508,    88,   191,   258,   143,   144,    92,   -24,   -24,   288,
1657     145,   146,   628,   156,   122,    24,   451,   774,    91,   672,
1658      91,   460,   632,   630,   451,   572,   451,   713,    49,   458,
1659     706,   764,    71,   287,   289,   574,   482,   484,   736,   191,
1660     325,   587,    91,   744,   489,   490,   645,   715,   765,   -24,
1661      92,   444,    65,   593,   -24,   -24,   -24,   635,   539,    45,
1662     -24,   773,   157,   418,   -24,   705,   408,   778,   449,   621,
1663     705,   682,   705,   133,   705,   335,   105,   492,   286,   709,
1664     -64,   336,   378,   181,   157,   157,   132,   647,   591,   703,
1665     706,    50,   428,   706,   460,   340,   340,   340,   340,   340,
1666     340,   340,   340,   340,   340,   340,   340,    92,   340,   340,
1667     340,   340,   340,   340,   340,   645,   642,   290,    78,    91,
1668      75,   148,    46,  -255,   -64,   712,   429,   561,   -65,   326,
1669     327,   137,    23,   423,   157,  -325,   433,   181,   149,   709,
1670     437,   646,   709,   464,   191,   254,   485,   512,   650,   453,
1671      91,   658,   456,   287,   289,  -155,   449,    97,   181,   706,
1672     325,   289,   613,   756,   706,   615,   706,   325,   706,   289,
1673     -64,   289,   -65,   287,   658,   325,   760,   325,   260,    39,
1674     325,    50,   648,    46,   653,   712,   460,   656,   712,    97,
1675     767,   261,    30,   560,    91,   460,   191,   417,   205,   336,
1676     149,   340,    41,    32,   772,   687,   340,   121,   709,   157,
1677     775,   475,   353,   709,   -64,   709,  -157,   709,   703,    24,
1678     430,   123,   138,   760,   173,   767,   694,   772,   286,  -325,
1679     434,   286,    61,   623,   509,   290,   149,   465,   -29,     4,
1680     486,   513,   651,   184,   579,   659,   151,   154,   580,   326,
1681     327,    91,   757,   173,   712,    39,   326,   327,    39,   712,
1682     338,   712,    82,   712,   326,   327,   326,   327,   743,   326,
1683     327,   287,   289,   739,    57,    40,    20,   288,   325,    24,
1684     288,    41,   737,     5,    62,   742,    20,    20,    20,    70,
1685      24,   746,   350,   102,     6,    84,   -28,     4,    85,    24,
1686       7,    61,   504,   614,   191,   616,     8,   286,    20,   180,
1687      22,    20,    20,   386,   387,   388,    88,   106,   113,   116,
1688      22,    22,    22,   328,   150,    34,   629,    38,   159,    20,
1689     762,   178,   630,   286,   -31,     4,   370,   340,   340,    10,
1690      94,     5,    22,   152,   375,    22,    22,   -30,     4,   376,
1691      55,   538,     6,   340,   398,   159,   288,   159,     7,   155,
1692     451,    24,   396,    22,     8,    92,   466,   326,   327,   505,
1693     399,    24,    94,   494,   506,     5,    24,   495,   507,     5,
1694      24,    82,   288,   641,   185,   290,   644,   397,   290,    24,
1695       6,   411,     5,   286,   190,   286,     7,    10,   333,  -153,
1696     504,    82,     8,   450,    24,    24,    24,   161,   454,     7,
1697       5,    24,   -33,     4,    84,     8,    82,    85,    24,   504,
1698     451,   287,   289,   451,   287,   289,   179,   377,   325,   468,
1699      24,   325,   470,   695,    84,    10,   161,    85,    24,   630,
1700     329,   176,   288,   328,   288,   738,    24,   451,    10,    84,
1701     328,   630,    85,    24,   663,   474,   624,     5,   328,   149,
1702     328,   451,   699,   328,   290,   592,   325,   505,   325,   664,
1703     176,    24,   506,   181,     7,   451,   507,   -32,     4,   446,
1704       8,    24,   741,   463,   698,    24,   505,    24,   630,   451,
1705     290,   506,    82,   663,   451,   507,   451,   479,   451,    61,
1706     287,   289,   -34,     4,   665,   289,    24,   325,   664,    91,
1707     498,   325,   612,    10,    24,   612,    24,   326,   327,    24,
1708     326,   327,     5,  -506,  -506,    84,   287,   289,    85,    24,
1709     330,   493,   714,   325,   143,   748,   414,   415,   749,     7,
1710     416,   325,    24,   726,   597,     8,   599,     5,    36,   638,
1711     290,   609,   290,  -507,  -507,   326,   327,   326,   327,   487,
1712     329,   328,   488,   633,     7,   289,   369,   329,   289,    36,
1713       8,   325,   639,    36,   325,   329,     5,   329,    10,   643,
1714     329,   649,    82,   379,   380,   125,   287,   289,   287,   289,
1715      36,   670,   289,   325,   660,   325,   326,   327,   325,   676,
1716     326,   327,   677,    10,   779,   678,   289,   384,   385,   783,
1717    -373,   785,   325,   786,   720,    84,  -344,  -344,    85,    24,
1718     289,   716,   326,   327,   371,   331,   325,   601,   372,    39,
1719     326,   327,   373,   325,   289,    82,  -346,  -346,   733,   289,
1720     325,   289,   325,   289,   126,   325,    40,   325,  -371,   325,
1721     330,   747,    41,   381,   382,   383,     5,   330,   394,   395,
1722     326,   327,    82,   326,   327,   330,  -205,   330,    84,  -344,
1723     330,    85,    24,  -344,   531,   533,   535,   537,   329,   402,
1724     403,  -137,   326,   327,   326,   327,   332,   326,   327,  -346,
1725     476,   477,   478,  -346,   751,    84,   125,   750,    85,    24,
1726     753,   326,   327,   389,   390,   391,   392,   405,   525,   527,
1727     529,   328,  -415,  -415,   328,   326,   327,  -416,  -416,   752,
1728     251,   770,   326,   327,   145,   146,   759,   521,   523,   326,
1729     327,   326,   327,   761,   326,   327,   326,   327,   326,   327,
1730      39,   771,   777,   393,   782,   331,    82,   542,   544,   328,
1731     780,   328,   331,   784,   540,   126,    37,    40,    79,   112,
1732     331,   264,   331,    41,   192,   331,   406,   262,   330,    77,
1733     564,   131,   413,   448,   459,   727,   728,   462,   654,    84,
1734     364,   251,    85,    24,   655,  -505,  -505,   371,   546,   483,
1735     328,   372,   345,   -17,   328,   373,   554,     5,  -505,  -505,
1736     371,   548,   552,    82,   372,   550,   332,     0,   442,  -505,
1737    -505,   371,    83,   332,     7,   372,   328,   697,   559,   442,
1738       8,   332,     0,   332,   328,     0,   332,   -17,   329,     0,
1739       0,   329,  -505,  -505,   371,     0,    84,     0,   372,    85,
1740      24,     5,   373,     0,     0,     0,     0,    82,   420,   157,
1741     158,   426,     0,    10,   328,     0,    83,   328,     7,   439,
1742     440,     0,     0,   331,     8,     0,   329,     0,   329,     0,
1743       0,     0,     0,     0,     0,     0,   328,     0,   328,   688,
1744      84,   328,     0,    85,    24,   -17,     0,     0,     0,     0,
1745    -505,  -505,   371,   157,   263,   328,   372,    10,     0,     0,
1746     640,     0,     0,     0,     0,     0,     0,   329,     0,   328,
1747       0,   329,     0,     0,     0,     0,   328,     0,   330,     0,
1748       0,   330,     0,   328,   332,   328,     0,     0,   328,    82,
1749     328,     0,   328,   329,     0,     0,     0,     0,   198,     0,
1750       0,   329,     0,     0,   199,     0,     0,     0,   503,     0,
1751       0,   200,   511,     0,     0,   201,   330,     0,   330,     0,
1752       0,     0,    84,     0,     0,    85,    24,     0,     0,   202,
1753     203,   329,     0,   204,   329,     0,     0,   557,     0,     0,
1754       0,     0,   206,   207,   208,   209,     0,     0,   210,   211,
1755       0,     0,     0,   329,   568,   329,     0,   330,   329,     0,
1756       0,   330,     0,     0,   576,     0,   578,     0,     0,     0,
1757       0,     0,   329,   331,     0,     5,   331,     0,     0,     0,
1758       0,    82,     0,   330,     0,     0,   329,     0,     0,     0,
1759      83,   330,     7,   329,     0,     0,     0,     0,     8,   604,
1760     329,   606,   329,     0,     0,   329,     0,   329,     0,   329,
1761       0,   331,     0,   331,    84,   611,     0,    85,    24,     0,
1762       0,   330,     0,     0,   330,     0,     0,     5,    86,     0,
1763       0,   251,     0,    82,   332,     0,     0,   332,     0,     0,
1764       0,     0,    83,   330,     7,   330,     0,     0,   330,     0,
1765       8,     0,   331,     0,     0,     0,   331,     0,     0,     0,
1766       0,     0,   330,     0,     0,     0,    84,     0,     0,    85,
1767      24,     0,   332,     0,   332,     0,   330,     0,   331,     0,
1768     130,     0,     0,   330,     0,     0,   331,     0,     0,     0,
1769     330,     0,   330,     0,     0,   330,     0,   330,     0,   330,
1770     341,   341,   341,   341,     0,     0,     0,     0,   341,   341,
1771       0,     0,     0,   332,     0,     0,   331,   332,     0,   331,
1772     342,   342,   342,   342,     0,   657,     0,     0,   342,   342,
1773       0,     0,     0,     0,     0,     0,     0,     0,   331,   332,
1774     331,     0,     0,   331,     0,     0,     0,   332,     0,     0,
1775       0,     0,     0,     0,     0,     0,     0,   331,     0,     0,
1776       0,     0,     0,     0,     0,     0,   691,     0,     0,     0,
1777       0,   331,     0,   194,   195,     0,     0,   332,   331,     0,
1778     332,     0,     0,     0,     0,   331,     0,   331,     0,     0,
1779     331,     0,   331,     0,   331,     0,     0,     0,     0,   332,
1780     724,   332,     0,     0,   332,     0,   732,     0,     0,     0,
1781       0,     0,     0,     0,     0,     0,   196,   197,   332,     0,
1782       0,    82,     0,     0,     0,     0,     0,     0,     0,     0,
1783     198,     0,   332,     0,     0,     0,   199,     0,     0,   332,
1784       0,     0,     0,   200,     0,     0,   332,   201,   332,     0,
1785       0,   332,     0,   332,    84,   332,     0,    85,    24,     0,
1786       0,   202,   203,     0,     0,   204,     0,   205,   365,     0,
1787       0,     0,   366,     0,   206,   207,   208,   209,     0,     0,
1788     210,   211,   766,     0,     0,   270,   769,   341,   341,   341,
1789     341,   341,   341,   341,   341,   341,   341,   341,   341,     0,
1790     341,   341,   341,   341,   341,   341,   341,   342,   342,   342,
1791     342,   342,   342,   342,   342,   342,   342,   342,   342,     0,
1792     342,   342,   342,   342,   342,   342,   342,     0,     0,     5,
1793     196,   197,   663,   271,   272,    82,   273,     0,     0,   274,
1794       0,     0,     0,   275,   198,     0,     0,   664,     0,     0,
1795     276,   277,     8,   278,     0,   279,   280,   200,   281,     0,
1796       0,   282,   283,     0,     0,     0,     0,     0,    84,     0,
1797       0,    85,    24,     0,     0,   270,     0,     0,     0,   284,
1798       0,   157,   729,     0,     0,    10,     0,     0,   206,   207,
1799     208,   209,     0,   341,   210,   211,     0,     0,   341,     0,
1800       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1801       0,     0,     0,   342,     0,     0,     0,     0,   342,     5,
1802     196,   197,   663,   271,   272,    82,   273,     0,     0,   274,
1803       0,     0,     0,   275,   198,     0,     0,   664,     0,     0,
1804     276,   277,     8,   278,     0,   279,   280,   200,   281,     0,
1805       0,   282,   283,     0,     0,     0,     0,     0,    84,     0,
1806       0,    85,    24,     0,     0,     0,     0,     0,     0,   284,
1807       0,   157,   758,     0,     0,    10,     0,     0,   206,   207,
1808     208,   209,     0,    82,   210,   211,     0,     0,     0,     0,
1809       0,     0,   198,     0,     0,     0,     0,     0,   199,     0,
1810       0,     0,     0,     0,     0,   200,     0,     0,   270,   201,
1811       0,     0,     0,     0,     0,     0,    84,     0,     0,    85,
1812      24,     0,     0,   202,   203,     0,     0,   204,     0,   341,
1813     341,     0,     0,     0,     0,     0,   206,   207,   208,   209,
1814       0,     0,   210,   211,     0,   341,     0,     0,     0,   342,
1815     342,     0,     5,   196,   197,  -265,   271,   272,    82,   273,
1816       0,     0,   274,     0,     0,   342,   275,   198,     0,     0,
1817    -265,     0,     0,   276,   277,     8,   278,   270,   279,   280,
1818     200,   281,     0,     0,   282,   283,     0,     0,     0,     0,
1819       0,    84,     0,     0,    85,    24,     0,     0,     0,     0,
1820       0,     0,   284,     0,   157,  -265,     0,     0,    10,     0,
1821       0,   206,   207,   208,   209,     0,     0,   210,   211,     0,
1822       0,     5,   196,   197,     0,   271,   272,    82,   273,     0,
1823       0,   274,     0,     0,     0,   275,   198,     0,     0,     0,
1824       0,     0,   276,   277,     8,   278,   270,   279,   280,   200,
1825     281,     0,     0,   282,   283,     0,     0,     0,     0,     0,
1826      84,     0,     0,    85,    24,     0,     0,     0,     0,     0,
1827       0,   284,     0,   157,   447,     0,     0,    10,     0,     0,
1828     206,   207,   208,   209,     0,     0,   210,   211,     0,     0,
1829       5,   196,   197,     0,   271,   272,    82,   273,     0,     0,
1830     274,     0,     0,     0,   275,   198,     0,     0,     0,     0,
1831       0,   276,   277,     8,   278,   270,   279,   280,   200,   281,
1832       0,     0,   282,   283,     0,     0,     0,     0,     0,    84,
1833       0,     0,    85,    24,     0,     0,     0,     0,     0,     0,
1834     284,     0,   157,     0,     0,     0,    10,     0,     0,   206,
1835     207,   208,   209,     0,     0,   210,   211,     0,     0,     5,
1836     196,   197,     0,   271,   272,    82,   273,     0,     0,   274,
1837       0,     0,     0,   275,   198,     0,     0,     0,     0,     0,
1838     276,   277,   270,   278,     0,   279,   280,   200,   281,     0,
1839       0,   282,   283,     0,     0,     0,     0,     0,    84,     0,
1840       0,    85,    24,     0,     0,     0,     0,     0,     0,   284,
1841       0,   157,     0,     0,     0,    10,     0,     0,   206,   207,
1842     208,   209,     0,     0,   210,   211,     5,   196,   197,     0,
1843     702,   272,    82,   273,     0,     0,   274,     0,     0,     0,
1844     275,   198,     0,     0,     0,     0,     0,   276,   277,     0,
1845     278,     0,   279,   280,   200,   281,     0,     0,   282,   283,
1846     626,     0,   194,   195,     0,    84,     0,     0,    85,    24,
1847       0,     0,     0,     0,     0,     0,   284,     0,   157,     0,
1848       0,     0,    10,     0,     0,   206,   207,   208,   209,     0,
1849       0,   210,   211,     0,     0,     0,     0,     0,     0,     0,
1850       0,     0,     0,     0,     0,   196,   197,     0,     0,     0,
1851      82,     0,     0,     0,     0,     0,     0,     0,     0,   198,
1852       0,     0,     0,     0,     0,   199,   193,     0,   194,   195,
1853       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
1854       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
1855     202,   203,     0,     0,   204,     0,   205,   627,     0,     0,
1856       0,     0,     0,   206,   207,   208,   209,     0,     0,   210,
1857     211,   196,   197,     0,     0,     0,    82,     0,   424,     0,
1858     194,   195,     0,     0,     0,   198,     0,     0,     0,     0,
1859       0,   199,     0,     0,     0,     0,     0,     0,   200,     0,
1860       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
1861       0,     0,    85,    24,     0,     0,   202,   203,     0,     0,
1862     204,     0,   205,   196,   197,     0,     0,     0,    82,   206,
1863     207,   208,   209,     0,     0,   210,   211,   198,     0,     0,
1864       0,     0,     0,   199,   502,     0,   194,   195,     0,     0,
1865     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
1866       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
1867       0,     0,   204,     0,     0,     0,     0,     0,   425,     0,
1868       0,   206,   207,   208,   209,     0,     0,   210,   211,   196,
1869     197,     0,     0,     0,    82,     0,   555,     0,   194,   195,
1870       0,     0,     0,   198,     0,     0,     0,     0,     0,   199,
1871       0,     0,     0,     0,     0,     0,   200,     0,     0,     0,
1872     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
1873      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
1874       0,   196,   197,   148,     0,     0,    82,   206,   207,   208,
1875     209,     0,     0,   210,   211,   198,     0,     0,     0,     0,
1876       0,   199,   594,     0,   194,   195,     0,     0,   200,     0,
1877       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
1878       0,     0,    85,    24,     0,   556,   202,   203,     0,     0,
1879     204,     0,     0,     0,     0,     0,     0,     0,     0,   206,
1880     207,   208,   209,     0,     0,   210,   211,   196,   197,     0,
1881       0,     0,    82,     0,   602,     0,   194,   195,     0,     0,
1882       0,   198,     0,     0,     0,     0,     0,   199,     0,     0,
1883       0,     0,     0,     0,   200,     0,     0,     0,   201,     0,
1884       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
1885       0,     0,   202,   203,     0,     0,   204,   595,     0,   196,
1886     197,     0,     0,     0,    82,   206,   207,   208,   209,     0,
1887       0,   210,   211,   198,     0,     0,     0,     0,     0,   199,
1888     610,     0,   194,   195,     0,     0,   200,     0,     0,     0,
1889     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
1890      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
1891       0,     0,     0,     0,   603,     0,     0,   206,   207,   208,
1892     209,     0,     0,   210,   211,   196,   197,     0,     0,     0,
1893      82,     0,   617,     0,   194,   195,     0,     0,     0,   198,
1894       0,     0,     0,     0,     0,   199,     0,     0,     0,     0,
1895       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
1896       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
1897     202,   203,     0,     0,   204,     0,     0,   196,   197,   148,
1898       0,     0,    82,   206,   207,   208,   209,     0,     0,   210,
1899     211,   198,     0,     0,     0,     0,     0,   199,   594,     0,
1900     194,   195,     0,     0,   200,     0,     0,     0,   201,     0,
1901       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
1902       0,     0,   202,   203,     0,     0,   204,   618,     0,     0,
1903       0,     0,     0,     0,     0,   206,   207,   208,   209,     0,
1904       0,   210,   211,   196,   197,     0,     0,     0,    82,     0,
1905     717,     0,   194,   195,     0,     0,     0,   198,     0,     0,
1906       0,     0,     0,   199,     0,     0,     0,     0,     0,     0,
1907     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
1908       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
1909       0,     0,   204,   700,     0,   196,   197,     0,     0,     0,
1910      82,   206,   207,   208,   209,     0,     0,   210,   211,   198,
1911       0,     0,     0,     0,     0,   199,   717,     0,   194,   195,
1912       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
1913       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
1914     202,   203,     0,     0,   204,   718,     0,     0,     0,     0,
1915       0,     0,     0,   206,   207,   208,   209,     0,     0,   210,
1916     211,   196,   197,     0,     0,     0,    82,     0,   602,     0,
1917     194,   195,     0,     0,     0,   198,     0,     0,     0,     0,
1918       0,   199,     0,     0,     0,     0,     0,     0,   200,     0,
1919       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
1920       0,     0,    85,    24,     0,     0,   202,   203,     0,     0,
1921     204,   763,     0,   196,   197,     0,     0,     0,    82,   206,
1922     207,   208,   209,     0,     0,   210,   211,   198,     0,     0,
1923       0,     0,     0,   199,   339,     0,   194,   195,     0,     0,
1924     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
1925       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
1926       0,     0,   204,     0,     0,     0,     0,     0,   768,     0,
1927       0,   206,   207,   208,   209,     0,     0,   210,   211,   196,
1928     197,     0,     0,     0,    82,     0,   346,     0,   194,   195,
1929       0,     0,     0,   198,     0,     0,     0,     0,     0,   199,
1930       0,     0,     0,     0,     0,     0,   200,     0,     0,     0,
1931     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
1932      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
1933       0,   196,   197,     0,     0,     0,    82,   206,   207,   208,
1934     209,     0,     0,   210,   211,   198,     0,     0,     0,     0,
1935       0,   199,   348,     0,   194,   195,     0,     0,   200,     0,
1936       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
1937       0,     0,    85,    24,     0,     0,   202,   203,     0,     0,
1938     204,     0,     0,     0,     0,     0,     0,     0,     0,   206,
1939     207,   208,   209,     0,     0,   210,   211,   196,   197,     0,
1940       0,     0,    82,     0,   357,     0,   194,   195,     0,     0,
1941       0,   198,     0,     0,     0,     0,     0,   199,     0,     0,
1942       0,     0,     0,     0,   200,     0,     0,     0,   201,     0,
1943       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
1944       0,     0,   202,   203,     0,     0,   204,     0,     0,   196,
1945     197,     0,     0,     0,    82,   206,   207,   208,   209,     0,
1946       0,   210,   211,   198,     0,     0,     0,     0,     0,   199,
1947     359,     0,   194,   195,     0,     0,   200,     0,     0,     0,
1948     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
1949      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
1950       0,     0,     0,     0,     0,     0,     0,   206,   207,   208,
1951     209,     0,     0,   210,   211,   196,   197,     0,     0,     0,
1952      82,     0,   361,     0,   194,   195,     0,     0,     0,   198,
1953       0,     0,     0,     0,     0,   199,     0,     0,     0,     0,
1954       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
1955       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
1956     202,   203,     0,     0,   204,     0,     0,   196,   197,     0,
1957       0,     0,    82,   206,   207,   208,   209,     0,     0,   210,
1958     211,   198,     0,     0,     0,     0,     0,   199,   419,     0,
1959     194,   195,     0,     0,   200,     0,     0,     0,   201,     0,
1960       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
1961       0,     0,   202,   203,     0,     0,   204,     0,     0,     0,
1962       0,     0,     0,     0,     0,   206,   207,   208,   209,     0,
1963       0,   210,   211,   196,   197,     0,     0,     0,    82,     0,
1964     438,     0,   194,   195,     0,     0,     0,   198,     0,     0,
1965       0,     0,     0,   199,     0,     0,     0,     0,     0,     0,
1966     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
1967       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
1968       0,     0,   204,     0,     0,   196,   197,     0,     0,     0,
1969      82,   206,   207,   208,   209,     0,     0,   210,   211,   198,
1970       0,     0,     0,     0,     0,   199,   510,     0,   194,   195,
1971       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
1972       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
1973     202,   203,     0,     0,   204,     0,     0,     0,     0,     0,
1974       0,     0,     0,   206,   207,   208,   209,     0,     0,   210,
1975     211,   196,   197,     0,     0,     0,    82,     0,   514,     0,
1976     194,   195,     0,     0,     0,   198,     0,     0,     0,     0,
1977       0,   199,     0,     0,     0,     0,     0,     0,   200,     0,
1978       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
1979       0,     0,    85,    24,     0,     0,   202,   203,     0,     0,
1980     204,     0,     0,   196,   197,     0,     0,     0,    82,   206,
1981     207,   208,   209,     0,     0,   210,   211,   198,     0,     0,
1982       0,     0,     0,   199,   516,     0,   194,   195,     0,     0,
1983     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
1984       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
1985       0,     0,   204,     0,     0,     0,     0,     0,     0,     0,
1986       0,   206,   207,   208,   209,     0,     0,   210,   211,   196,
1987     197,     0,     0,     0,    82,     0,   518,     0,   194,   195,
1988       0,     0,     0,   198,     0,     0,     0,     0,     0,   199,
1989       0,     0,     0,     0,     0,     0,   200,     0,     0,     0,
1990     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
1991      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
1992       0,   196,   197,     0,     0,     0,    82,   206,   207,   208,
1993     209,     0,     0,   210,   211,   198,     0,     0,     0,     0,
1994       0,   199,   520,     0,   194,   195,     0,     0,   200,     0,
1995       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
1996       0,     0,    85,    24,     0,     0,   202,   203,     0,     0,
1997     204,     0,     0,     0,     0,     0,     0,     0,     0,   206,
1998     207,   208,   209,     0,     0,   210,   211,   196,   197,     0,
1999       0,     0,    82,     0,   522,     0,   194,   195,     0,     0,
2000       0,   198,     0,     0,     0,     0,     0,   199,     0,     0,
2001       0,     0,     0,     0,   200,     0,     0,     0,   201,     0,
2002       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
2003       0,     0,   202,   203,     0,     0,   204,     0,     0,   196,
2004     197,     0,     0,     0,    82,   206,   207,   208,   209,     0,
2005       0,   210,   211,   198,     0,     0,     0,     0,     0,   199,
2006     524,     0,   194,   195,     0,     0,   200,     0,     0,     0,
2007     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
2008      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
2009       0,     0,     0,     0,     0,     0,     0,   206,   207,   208,
2010     209,     0,     0,   210,   211,   196,   197,     0,     0,     0,
2011      82,     0,   526,     0,   194,   195,     0,     0,     0,   198,
2012       0,     0,     0,     0,     0,   199,     0,     0,     0,     0,
2013       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
2014       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
2015     202,   203,     0,     0,   204,     0,     0,   196,   197,     0,
2016       0,     0,    82,   206,   207,   208,   209,     0,     0,   210,
2017     211,   198,     0,     0,     0,     0,     0,   199,   528,     0,
2018     194,   195,     0,     0,   200,     0,     0,     0,   201,     0,
2019       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
2020       0,     0,   202,   203,     0,     0,   204,     0,     0,     0,
2021       0,     0,     0,     0,     0,   206,   207,   208,   209,     0,
2022       0,   210,   211,   196,   197,     0,     0,     0,    82,     0,
2023     530,     0,   194,   195,     0,     0,     0,   198,     0,     0,
2024       0,     0,     0,   199,     0,     0,     0,     0,     0,     0,
2025     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
2026       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
2027       0,     0,   204,     0,     0,   196,   197,     0,     0,     0,
2028      82,   206,   207,   208,   209,     0,     0,   210,   211,   198,
2029       0,     0,     0,     0,     0,   199,   532,     0,   194,   195,
2030       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
2031       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
2032     202,   203,     0,     0,   204,     0,     0,     0,     0,     0,
2033       0,     0,     0,   206,   207,   208,   209,     0,     0,   210,
2034     211,   196,   197,     0,     0,     0,    82,     0,   534,     0,
2035     194,   195,     0,     0,     0,   198,     0,     0,     0,     0,
2036       0,   199,     0,     0,     0,     0,     0,     0,   200,     0,
2037       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
2038       0,     0,    85,    24,     0,     0,   202,   203,     0,     0,
2039     204,     0,     0,   196,   197,     0,     0,     0,    82,   206,
2040     207,   208,   209,     0,     0,   210,   211,   198,     0,     0,
2041       0,     0,     0,   199,   536,     0,   194,   195,     0,     0,
2042     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
2043       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
2044       0,     0,   204,     0,     0,     0,     0,     0,     0,     0,
2045       0,   206,   207,   208,   209,     0,     0,   210,   211,   196,
2046     197,     0,     0,     0,    82,     0,   541,     0,   194,   195,
2047       0,     0,     0,   198,     0,     0,     0,     0,     0,   199,
2048       0,     0,     0,     0,     0,     0,   200,     0,     0,     0,
2049     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
2050      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
2051       0,   196,   197,     0,     0,     0,    82,   206,   207,   208,
2052     209,     0,     0,   210,   211,   198,     0,     0,     0,     0,
2053       0,   199,   543,     0,   194,   195,     0,     0,   200,     0,
2054       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
2055       0,     0,    85,    24,     0,     0,   202,   203,     0,     0,
2056     204,     0,     0,     0,     0,     0,     0,     0,     0,   206,
2057     207,   208,   209,     0,     0,   210,   211,   196,   197,     0,
2058       0,     0,    82,     0,   545,     0,   194,   195,     0,     0,
2059       0,   198,     0,     0,     0,     0,     0,   199,     0,     0,
2060       0,     0,     0,     0,   200,     0,     0,     0,   201,     0,
2061       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
2062       0,     0,   202,   203,     0,     0,   204,     0,     0,   196,
2063     197,     0,     0,     0,    82,   206,   207,   208,   209,     0,
2064       0,   210,   211,   198,     0,     0,     0,     0,     0,   199,
2065     547,     0,   194,   195,     0,     0,   200,     0,     0,     0,
2066     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
2067      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
2068       0,     0,     0,     0,     0,     0,     0,   206,   207,   208,
2069     209,     0,     0,   210,   211,   196,   197,     0,     0,     0,
2070      82,     0,   549,     0,   194,   195,     0,     0,     0,   198,
2071       0,     0,     0,     0,     0,   199,     0,     0,     0,     0,
2072       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
2073       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
2074     202,   203,     0,     0,   204,     0,     0,   196,   197,     0,
2075       0,     0,    82,   206,   207,   208,   209,     0,     0,   210,
2076     211,   198,     0,     0,     0,     0,     0,   199,   551,     0,
2077     194,   195,     0,     0,   200,     0,     0,     0,   201,     0,
2078       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
2079       0,     0,   202,   203,     0,     0,   204,     0,     0,     0,
2080       0,     0,     0,     0,     0,   206,   207,   208,   209,     0,
2081       0,   210,   211,   196,   197,     0,     0,     0,    82,     0,
2082     553,     0,   194,   195,     0,     0,     0,   198,     0,     0,
2083       0,     0,     0,   199,     0,     0,     0,     0,     0,     0,
2084     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
2085       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
2086       0,     0,   204,     0,     0,   196,   197,     0,     0,     0,
2087      82,   206,   207,   208,   209,     0,     0,   210,   211,   198,
2088       0,     0,     0,     0,     0,   199,   558,     0,   194,   195,
2089       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
2090       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
2091     202,   203,     0,     0,   204,     0,     0,     0,     0,     0,
2092       0,     0,     0,   206,   207,   208,   209,     0,     0,   210,
2093     211,   196,   197,     0,     0,     0,    82,     0,   567,     0,
2094     194,   195,     0,     0,     0,   198,     0,     0,     0,     0,
2095       0,   199,     0,     0,     0,     0,     0,     0,   200,     0,
2096       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
2097       0,     0,    85,    24,     0,     0,   202,   203,     0,     0,
2098     204,     0,     0,   196,   197,     0,     0,     0,    82,   206,
2099     207,   208,   209,     0,     0,   210,   211,   198,     0,     0,
2100       0,     0,     0,   199,   575,     0,   194,   195,     0,     0,
2101     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
2102       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
2103       0,     0,   204,     0,     0,     0,     0,     0,     0,     0,
2104       0,   206,   207,   208,   209,     0,     0,   210,   211,   196,
2105     197,     0,     0,     0,    82,     0,   577,     0,   194,   195,
2106       0,     0,     0,   198,     0,     0,     0,     0,     0,   199,
2107       0,     0,     0,     0,     0,     0,   200,     0,     0,     0,
2108     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
2109      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
2110       0,   196,   197,     0,     0,     0,    82,   206,   207,   208,
2111     209,     0,     0,   210,   211,   198,     0,     0,     0,     0,
2112       0,   199,   605,     0,   194,   195,     0,     0,   200,     0,
2113       0,     0,   201,     0,     0,     0,     0,     0,     0,    84,
2114       0,     0,    85,    24,     0,     0,   202,   203,     0,     0,
2115     204,     0,     0,     0,     0,     0,     0,     0,     0,   206,
2116     207,   208,   209,     0,     0,   210,   211,   196,   197,     0,
2117       0,     0,    82,     0,   620,     0,   194,   195,     0,     0,
2118       0,   198,     0,     0,     0,     0,     0,   199,     0,     0,
2119       0,     0,     0,     0,   200,     0,     0,     0,   201,     0,
2120       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
2121       0,     0,   202,   203,     0,     0,   204,     0,     0,   196,
2122     197,     0,     0,     0,    82,   206,   207,   208,   209,     0,
2123       0,   210,   211,   198,     0,     0,     0,     0,     0,   199,
2124     686,     0,   194,   195,     0,     0,   200,     0,     0,     0,
2125     201,     0,     0,     0,     0,     0,     0,    84,     0,     0,
2126      85,    24,     0,     0,   202,   203,     0,     0,   204,     0,
2127       0,     0,     0,     0,     0,     0,     0,   206,   207,   208,
2128     209,     0,     0,   210,   211,   196,   197,     0,     0,     0,
2129      82,     0,   690,     0,   194,   195,     0,     0,     0,   198,
2130       0,     0,     0,     0,     0,   199,     0,     0,     0,     0,
2131       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
2132       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
2133     202,   203,     0,     0,   204,     0,     0,   196,   197,     0,
2134       0,     0,    82,   206,   207,   208,   209,     0,     0,   210,
2135     211,   198,     0,     0,     0,     0,     0,   199,   696,     0,
2136     194,   195,     0,     0,   200,     0,     0,     0,   201,     0,
2137       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
2138       0,     0,   202,   203,     0,     0,   204,     0,     0,     0,
2139       0,     0,     0,     0,     0,   206,   207,   208,   209,     0,
2140       0,   210,   211,   196,   197,     0,     0,     0,    82,     0,
2141     723,     0,   194,   195,     0,     0,     0,   198,     0,     0,
2142       0,     0,     0,   199,     0,     0,     0,     0,     0,     0,
2143     200,     0,     0,     0,   201,     0,     0,     0,     0,     0,
2144       0,    84,     0,     0,    85,    24,     0,     0,   202,   203,
2145       0,     0,   204,     0,     0,   196,   197,     0,     0,     0,
2146      82,   206,   207,   208,   209,     0,     0,   210,   211,   198,
2147       0,     0,   344,     0,   194,   199,     0,     0,     0,     0,
2148       0,     0,   200,     0,     0,     0,   201,     0,     0,     0,
2149       0,     0,     0,    84,     0,     0,    85,    24,     0,     0,
2150     202,   203,     0,     0,   204,     0,     0,     0,     0,     0,
2151       0,     0,     0,   206,   207,   208,   209,   196,   197,   210,
2152     211,     0,    82,     0,   585,     0,     0,     0,     0,     0,
2153       0,   198,     0,     0,     0,     0,     0,   199,     0,     0,
2154       0,     0,     0,     0,   200,     0,     0,     0,   201,   673,
2155       0,     0,     0,     0,     0,    84,     0,     0,    85,    24,
2156       0,     0,   202,   203,     0,     0,   204,     0,  -288,  -288,
2157    -288,     0,     0,     0,  -288,   206,   207,   208,   209,     0,
2158       0,   210,   211,  -288,     0,     0,     0,     0,     0,  -288,
2159       0,     0,   734,     0,   196,   197,  -288,     0,     0,    82,
2160    -288,     0,     0,     0,     0,     0,     0,  -288,   198,     0,
2161    -288,  -288,     0,     0,   199,     0,     0,   671,  -288,     0,
2162       0,   200,     0,     0,  -288,   201,     0,  -288,  -288,  -288,
2163    -288,     0,    84,  -288,  -288,    85,    24,   196,   197,     0,
2164       0,     0,    82,   284,  -296,     0,     0,     0,     0,     0,
2165       0,   198,   206,   207,   208,   209,     0,   199,   210,   211,
2166       0,     0,   196,   197,   200,     0,     0,    82,   201,     0,
2167       0,   194,   195,     0,     0,    84,   198,     0,    85,    24,
2168       0,     0,   199,     0,     0,     0,   284,  -296,     0,   200,
2169       0,     0,     0,   201,     0,   206,   207,   208,   209,     0,
2170      84,   210,   211,    85,    24,     0,     0,     0,     0,     0,
2171       0,   284,     0,     0,   196,   197,     0,     0,     0,    82,
2172     206,   207,   208,   209,     0,     0,   210,   211,   198,     0,
2173       0,     0,     0,     0,   199,     0,     0,   194,   195,     0,
2174       0,   200,     0,     0,     0,   201,     0,     0,     0,     0,
2175       0,     0,    84,     0,     0,    85,    24,     0,     0,   202,
2176     203,     0,     0,   204,   499,     0,     0,     0,     0,     0,
2177       0,     0,   206,   207,   208,   209,     0,     0,   210,   211,
2178     196,   197,     0,     0,     0,    82,     0,     0,     0,   194,
2179     195,     0,     0,     0,   198,     0,     0,     0,     0,     0,
2180     199,     0,     0,     0,     0,     0,     0,   200,     0,     0,
2181       0,   201,     0,     0,     0,     0,     0,     0,    84,     0,
2182       0,    85,    24,     0,     0,   202,   203,     0,     0,   204,
2183     636,     0,   196,   197,     0,     0,     0,    82,   206,   207,
2184     208,   209,     0,     0,   210,   211,   198,     0,     0,     0,
2185       0,     0,   199,     0,     0,   194,   195,     0,     0,   200,
2186       0,     0,     0,   201,     0,     0,     0,     0,     0,     0,
2187      84,     0,     0,    85,    24,     0,     0,   202,   203,     0,
2188       0,   204,   679,     0,     0,     0,     0,     0,     0,     0,
2189     206,   207,   208,   209,     0,     0,   210,   211,   196,   197,
2190       0,     0,     0,    82,     0,     0,     0,   194,   195,     0,
2191       0,     0,   198,     0,     0,     0,     0,     0,   199,     0,
2192       0,     0,     0,     0,     0,   200,     0,     0,     0,   201,
2193       0,     0,     0,     0,     0,     0,    84,     0,     0,    85,
2194      24,     0,     0,   202,   203,     0,     0,   204,   692,     0,
2195     196,   197,     0,     0,     0,    82,   206,   207,   208,   209,
2196       0,     0,   210,   211,   198,     0,     0,     0,     0,     0,
2197     199,     0,     0,     0,     0,     0,     0,   200,     0,     0,
2198       0,   201,     0,     0,     0,     0,     0,     0,    84,     0,
2199       0,    85,    24,     0,     0,   202,   203,     0,     0,   204,
2200       0,     5,   196,   197,     0,     0,     0,    82,   206,   207,
2201     208,   209,     0,     0,   210,   211,   198,     0,     0,     0,
2202       0,     0,   199,     0,     0,     0,     0,     0,     0,   200,
2203       0,     0,     0,   201,     0,     0,     0,     0,     0,     0,
2204      84,     0,     0,    85,    24,     0,     0,     0,     0,     0,
2205       0,   284,     0,     0,     0,     0,     0,     0,     0,     0,
2206     206,   207,   208,   209,     0,     0,   210,   211
2207};
2208
2209static const short yycheck[] =
2210{
2211       6,   295,   205,     9,    66,   180,   136,   138,   175,   137,
2212     492,    66,   336,   315,   446,   127,     1,   133,     1,   121,
2213      46,     1,     1,    15,    50,   302,     1,     1,     1,     1,
2214       5,    93,    54,   310,     1,   312,    98,     1,    93,   668,
2215      46,     1,    68,    98,    50,   133,   162,    73,     1,   151,
2216      88,   676,   154,   169,   486,     1,   194,     0,   196,   197,
2217      66,    69,    68,    12,   202,   203,     1,    73,    76,   200,
2218     172,   133,     1,   133,   162,   137,     1,    99,   133,    88,
2219      99,   513,   137,    96,   103,     1,     1,    93,    37,    99,
2220     103,     1,    98,   103,    68,     1,    68,    89,   160,   728,
2221     162,    97,   162,   111,     2,   160,   132,   162,     0,     1,
2222      95,     1,   138,    88,    12,    13,    14,   100,   103,     1,
2223     175,   101,   184,   103,   103,     1,   132,   133,   101,   184,
2224     103,   137,   138,   261,   101,   102,    34,   101,   102,    37,
2225      38,   101,   624,   768,    97,   200,     7,     8,   101,   204,
2226     266,     1,   777,    45,   160,   101,   162,    55,     1,    88,
2227     262,    96,   337,   279,    56,    90,     1,   102,    66,   175,
2228      62,     1,   101,   285,   200,   213,    68,   609,   184,    40,
2229      41,    96,    88,    44,    76,   101,    96,   102,   194,   195,
2230     196,   197,   102,    54,   200,   101,   202,   203,   204,   261,
2231      98,   633,     1,     1,    66,     1,   261,   338,   336,   101,
2232     100,   643,    94,    95,    90,     1,   646,    99,   100,   101,
2233     102,     1,    83,     1,   102,   101,    87,   659,     1,    68,
2234     292,    93,   101,   102,    73,   133,    98,   292,     1,   137,
2235     295,     1,     1,   381,   382,   383,   413,     1,   286,     1,
2236     100,    94,     1,    96,   103,   261,    99,   100,   101,   102,
2237     315,    96,     1,    53,   162,   126,   127,   102,     1,     1,
2238     100,   133,   566,     1,   336,   137,   706,   175,     1,   709,
2239      73,   336,   143,   101,   102,    94,   292,    46,    47,   295,
2240      99,   100,   495,   132,    99,    88,   302,    96,   160,   601,
2241     162,   603,   100,   102,   310,   101,   312,     1,     1,   315,
2242     646,   743,   338,   175,   175,   101,   354,   355,     1,   180,
2243     175,   101,   184,   101,   362,   363,     1,   651,   101,    88,
2244     336,    90,   338,   445,    93,    94,    95,   100,   393,     1,
2245      99,   101,    97,    95,   103,   775,   101,   101,   642,   487,
2246     780,   100,   782,    97,   784,    96,     1,    96,   413,   646,
2247      53,   102,   223,   261,    97,    97,   102,     1,    96,   646,
2248     706,    64,    95,   709,   676,   381,   382,   383,   384,   385,
2249     386,   387,   388,   389,   390,   391,   392,   393,   394,   395,
2250     396,   397,   398,   399,   400,     1,   563,   295,     1,   261,
2251       1,   100,    64,    97,    97,   646,     1,   413,    53,   175,
2252     175,    95,     1,   274,    97,     1,     1,   315,    99,   706,
2253     281,    96,   709,     1,   285,     1,     1,     1,     1,   706,
2254     292,     1,   709,   295,   295,    97,   730,    66,   336,   775,
2255     295,   302,   480,     1,   780,   483,   782,   302,   784,   310,
2256      53,   312,    97,   315,     1,   310,   733,   312,    98,    45,
2257     315,    64,    96,    64,   580,   706,   768,   583,   709,    98,
2258     747,    95,     1,    96,   336,   777,   337,     1,    97,   102,
2259      99,   487,    68,     1,   761,   623,   492,    87,   775,    97,
2260      96,   352,     1,   780,    97,   782,    97,   784,   775,    88,
2261      95,   539,    54,   780,   133,   782,   636,   784,   563,    95,
2262      95,   566,   373,    96,   375,   413,    99,    95,     0,     1,
2263      95,    95,    95,   651,    61,    95,   126,   127,    65,   295,
2264     295,   393,    90,   162,   775,    45,   302,   302,    45,   780,
2265     102,   782,    51,   784,   310,   310,   312,   312,    95,   315,
2266     315,   413,   413,   683,     1,    62,     2,   563,   413,    88,
2267     566,    68,   678,    45,     1,   695,    12,    13,    14,     1,
2268      88,    95,   103,     1,    56,    84,     0,     1,    87,    88,
2269      62,   442,     1,   482,   445,   484,    68,   642,    34,   651,
2270       2,    37,    38,     8,     9,    10,   651,     1,     1,     1,
2271      12,    13,    14,   175,     1,    12,    96,    14,   133,    55,
2272     740,     1,   102,   668,     0,     1,   103,   623,   624,   101,
2273      66,    45,    34,     1,   103,    37,    38,     0,     1,    99,
2274      37,     1,    56,   639,    13,   160,   642,   162,    62,     1,
2275     646,    88,    11,    55,    68,   651,     1,   413,   413,    68,
2276      14,    88,    98,    98,    73,    45,    88,   102,    77,    45,
2277      88,    51,   668,   563,     1,   563,   566,    12,   566,    88,
2278      56,    97,    45,   728,     1,   730,    62,   101,     1,    95,
2279       1,    51,    68,   101,    88,    88,    88,   133,   101,    62,
2280      45,    88,     0,     1,    84,    68,    51,    87,    88,     1,
2281     706,   563,   563,   709,   566,   566,    96,     1,   563,     1,
2282      88,   566,     1,    96,    84,   101,   162,    87,    88,   102,
2283     175,   133,   728,   295,   730,    96,    88,   733,   101,    84,
2284     302,   102,    87,    88,    48,     1,    96,    45,   310,    99,
2285     312,   747,   642,   315,   642,    66,   601,    68,   603,    63,
2286     162,    88,    73,   651,    62,   761,    77,     0,     1,    95,
2287      68,    88,    96,   101,    66,    88,    68,    88,   102,   775,
2288     668,    73,    51,    48,   780,    77,   782,    99,   784,   640,
2289     642,   642,     0,     1,    98,   646,    88,   642,    63,   651,
2290      68,   646,   480,   101,    88,   483,    88,   563,   563,    88,
2291     566,   566,    45,    93,    94,    84,   668,   668,    87,    88,
2292     175,    98,     1,   668,   102,   706,    97,    98,   709,    62,
2293     101,   676,    88,    98,    97,    68,    67,    45,    13,     1,
2294     728,    95,   730,    93,    94,   601,   601,   603,   603,    96,
2295     295,   413,    99,    95,    62,   706,   103,   302,   709,    34,
2296      68,   706,    90,    38,   709,   310,    45,   312,   101,    95,
2297     315,    96,    51,    46,    47,     1,   728,   728,   730,   730,
2298      55,    95,   733,   728,     1,   730,   642,   642,   733,   101,
2299     646,   646,    96,   101,   775,    96,   747,     3,     4,   780,
2300      97,   782,   747,   784,     1,    84,    46,    47,    87,    88,
2301     761,   101,   668,   668,    95,   175,   761,   102,    99,    45,
2302     676,   676,   103,   768,   775,    51,    46,    47,    96,   780,
2303     775,   782,   777,   784,    60,   780,    62,   782,    97,   784,
2304     295,    57,    68,     5,     6,     7,    45,   302,    16,    17,
2305     706,   706,    51,   709,   709,   310,    57,   312,    84,    99,
2306     315,    87,    88,   103,   389,   390,   391,   392,   413,    93,
2307      94,    97,   728,   728,   730,   730,   175,   733,   733,    99,
2308      99,   100,   101,   103,    96,    84,     1,   101,    87,    88,
2309       1,   747,   747,    18,    19,    20,    21,    96,   386,   387,
2310     388,   563,    46,    47,   566,   761,   761,    46,    47,    96,
2311     144,     1,   768,   768,    99,   100,    96,   384,   385,   775,
2312     775,   777,   777,    96,   780,   780,   782,   782,   784,   784,
2313      45,   101,   101,    58,    57,   295,    51,   394,   395,   601,
2314      96,   603,   302,    96,   393,    60,    14,    62,    58,    79,
2315     310,   162,   312,    68,   143,   315,   261,   160,   413,    56,
2316     413,    98,   268,   295,   315,   666,   666,   315,   581,    84,
2317     204,   205,    87,    88,   581,    93,    94,    95,   396,   355,
2318     642,    99,   195,    88,   646,   103,   400,    45,    93,    94,
2319      95,   397,   399,    51,    99,   398,   295,    -1,   103,    93,
2320      94,    95,    60,   302,    62,    99,   668,   639,   404,   103,
2321      68,   310,    -1,   312,   676,    -1,   315,    88,   563,    -1,
2322      -1,   566,    93,    94,    95,    -1,    84,    -1,    99,    87,
2323      88,    45,   103,    -1,    -1,    -1,    -1,    51,   272,    97,
2324      98,   275,    -1,   101,   706,    -1,    60,   709,    62,   283,
2325     284,    -1,    -1,   413,    68,    -1,   601,    -1,   603,    -1,
2326      -1,    -1,    -1,    -1,    -1,    -1,   728,    -1,   730,     1,
2327      84,   733,    -1,    87,    88,    88,    -1,    -1,    -1,    -1,
2328      93,    94,    95,    97,    98,   747,    99,   101,    -1,    -1,
2329     103,    -1,    -1,    -1,    -1,    -1,    -1,   642,    -1,   761,
2330      -1,   646,    -1,    -1,    -1,    -1,   768,    -1,   563,    -1,
2331      -1,   566,    -1,   775,   413,   777,    -1,    -1,   780,    51,
2332     782,    -1,   784,   668,    -1,    -1,    -1,    -1,    60,    -1,
2333      -1,   676,    -1,    -1,    66,    -1,    -1,    -1,   372,    -1,
2334      -1,    73,   376,    -1,    -1,    77,   601,    -1,   603,    -1,
2335      -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,
2336      92,   706,    -1,    95,   709,    -1,    -1,   401,    -1,    -1,
2337      -1,    -1,   104,   105,   106,   107,    -1,    -1,   110,   111,
2338      -1,    -1,    -1,   728,   418,   730,    -1,   642,   733,    -1,
2339      -1,   646,    -1,    -1,   428,    -1,   430,    -1,    -1,    -1,
2340      -1,    -1,   747,   563,    -1,    45,   566,    -1,    -1,    -1,
2341      -1,    51,    -1,   668,    -1,    -1,   761,    -1,    -1,    -1,
2342      60,   676,    62,   768,    -1,    -1,    -1,    -1,    68,   463,
2343     775,   465,   777,    -1,    -1,   780,    -1,   782,    -1,   784,
2344      -1,   601,    -1,   603,    84,   479,    -1,    87,    88,    -1,
2345      -1,   706,    -1,    -1,   709,    -1,    -1,    45,    98,    -1,
2346      -1,   495,    -1,    51,   563,    -1,    -1,   566,    -1,    -1,
2347      -1,    -1,    60,   728,    62,   730,    -1,    -1,   733,    -1,
2348      68,    -1,   642,    -1,    -1,    -1,   646,    -1,    -1,    -1,
2349      -1,    -1,   747,    -1,    -1,    -1,    84,    -1,    -1,    87,
2350      88,    -1,   601,    -1,   603,    -1,   761,    -1,   668,    -1,
2351      98,    -1,    -1,   768,    -1,    -1,   676,    -1,    -1,    -1,
2352     775,    -1,   777,    -1,    -1,   780,    -1,   782,    -1,   784,
2353     194,   195,   196,   197,    -1,    -1,    -1,    -1,   202,   203,
2354      -1,    -1,    -1,   642,    -1,    -1,   706,   646,    -1,   709,
2355     194,   195,   196,   197,    -1,   589,    -1,    -1,   202,   203,
2356      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   728,   668,
2357     730,    -1,    -1,   733,    -1,    -1,    -1,   676,    -1,    -1,
2358      -1,    -1,    -1,    -1,    -1,    -1,    -1,   747,    -1,    -1,
2359      -1,    -1,    -1,    -1,    -1,    -1,   630,    -1,    -1,    -1,
2360      -1,   761,    -1,     3,     4,    -1,    -1,   706,   768,    -1,
2361     709,    -1,    -1,    -1,    -1,   775,    -1,   777,    -1,    -1,
2362     780,    -1,   782,    -1,   784,    -1,    -1,    -1,    -1,   728,
2363     664,   730,    -1,    -1,   733,    -1,   670,    -1,    -1,    -1,
2364      -1,    -1,    -1,    -1,    -1,    -1,    46,    47,   747,    -1,
2365      -1,    51,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2366      60,    -1,   761,    -1,    -1,    -1,    66,    -1,    -1,   768,
2367      -1,    -1,    -1,    73,    -1,    -1,   775,    77,   777,    -1,
2368      -1,   780,    -1,   782,    84,   784,    -1,    87,    88,    -1,
2369      -1,    91,    92,    -1,    -1,    95,    -1,    97,    98,    -1,
2370      -1,    -1,   102,    -1,   104,   105,   106,   107,    -1,    -1,
2371     110,   111,   746,    -1,    -1,     1,   750,   381,   382,   383,
2372     384,   385,   386,   387,   388,   389,   390,   391,   392,    -1,
2373     394,   395,   396,   397,   398,   399,   400,   381,   382,   383,
2374     384,   385,   386,   387,   388,   389,   390,   391,   392,    -1,
2375     394,   395,   396,   397,   398,   399,   400,    -1,    -1,    45,
2376      46,    47,    48,    49,    50,    51,    52,    -1,    -1,    55,
2377      -1,    -1,    -1,    59,    60,    -1,    -1,    63,    -1,    -1,
2378      66,    67,    68,    69,    -1,    71,    72,    73,    74,    -1,
2379      -1,    77,    78,    -1,    -1,    -1,    -1,    -1,    84,    -1,
2380      -1,    87,    88,    -1,    -1,     1,    -1,    -1,    -1,    95,
2381      -1,    97,    98,    -1,    -1,   101,    -1,    -1,   104,   105,
2382     106,   107,    -1,   487,   110,   111,    -1,    -1,   492,    -1,
2383      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2384      -1,    -1,    -1,   487,    -1,    -1,    -1,    -1,   492,    45,
2385      46,    47,    48,    49,    50,    51,    52,    -1,    -1,    55,
2386      -1,    -1,    -1,    59,    60,    -1,    -1,    63,    -1,    -1,
2387      66,    67,    68,    69,    -1,    71,    72,    73,    74,    -1,
2388      -1,    77,    78,    -1,    -1,    -1,    -1,    -1,    84,    -1,
2389      -1,    87,    88,    -1,    -1,    -1,    -1,    -1,    -1,    95,
2390      -1,    97,    98,    -1,    -1,   101,    -1,    -1,   104,   105,
2391     106,   107,    -1,    51,   110,   111,    -1,    -1,    -1,    -1,
2392      -1,    -1,    60,    -1,    -1,    -1,    -1,    -1,    66,    -1,
2393      -1,    -1,    -1,    -1,    -1,    73,    -1,    -1,     1,    77,
2394      -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,
2395      88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,   623,
2396     624,    -1,    -1,    -1,    -1,    -1,   104,   105,   106,   107,
2397      -1,    -1,   110,   111,    -1,   639,    -1,    -1,    -1,   623,
2398     624,    -1,    45,    46,    47,    48,    49,    50,    51,    52,
2399      -1,    -1,    55,    -1,    -1,   639,    59,    60,    -1,    -1,
2400      63,    -1,    -1,    66,    67,    68,    69,     1,    71,    72,
2401      73,    74,    -1,    -1,    77,    78,    -1,    -1,    -1,    -1,
2402      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    -1,    -1,
2403      -1,    -1,    95,    -1,    97,    98,    -1,    -1,   101,    -1,
2404      -1,   104,   105,   106,   107,    -1,    -1,   110,   111,    -1,
2405      -1,    45,    46,    47,    -1,    49,    50,    51,    52,    -1,
2406      -1,    55,    -1,    -1,    -1,    59,    60,    -1,    -1,    -1,
2407      -1,    -1,    66,    67,    68,    69,     1,    71,    72,    73,
2408      74,    -1,    -1,    77,    78,    -1,    -1,    -1,    -1,    -1,
2409      84,    -1,    -1,    87,    88,    -1,    -1,    -1,    -1,    -1,
2410      -1,    95,    -1,    97,    98,    -1,    -1,   101,    -1,    -1,
2411     104,   105,   106,   107,    -1,    -1,   110,   111,    -1,    -1,
2412      45,    46,    47,    -1,    49,    50,    51,    52,    -1,    -1,
2413      55,    -1,    -1,    -1,    59,    60,    -1,    -1,    -1,    -1,
2414      -1,    66,    67,    68,    69,     1,    71,    72,    73,    74,
2415      -1,    -1,    77,    78,    -1,    -1,    -1,    -1,    -1,    84,
2416      -1,    -1,    87,    88,    -1,    -1,    -1,    -1,    -1,    -1,
2417      95,    -1,    97,    -1,    -1,    -1,   101,    -1,    -1,   104,
2418     105,   106,   107,    -1,    -1,   110,   111,    -1,    -1,    45,
2419      46,    47,    -1,    49,    50,    51,    52,    -1,    -1,    55,
2420      -1,    -1,    -1,    59,    60,    -1,    -1,    -1,    -1,    -1,
2421      66,    67,     1,    69,    -1,    71,    72,    73,    74,    -1,
2422      -1,    77,    78,    -1,    -1,    -1,    -1,    -1,    84,    -1,
2423      -1,    87,    88,    -1,    -1,    -1,    -1,    -1,    -1,    95,
2424      -1,    97,    -1,    -1,    -1,   101,    -1,    -1,   104,   105,
2425     106,   107,    -1,    -1,   110,   111,    45,    46,    47,    -1,
2426      49,    50,    51,    52,    -1,    -1,    55,    -1,    -1,    -1,
2427      59,    60,    -1,    -1,    -1,    -1,    -1,    66,    67,    -1,
2428      69,    -1,    71,    72,    73,    74,    -1,    -1,    77,    78,
2429       1,    -1,     3,     4,    -1,    84,    -1,    -1,    87,    88,
2430      -1,    -1,    -1,    -1,    -1,    -1,    95,    -1,    97,    -1,
2431      -1,    -1,   101,    -1,    -1,   104,   105,   106,   107,    -1,
2432      -1,   110,   111,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2433      -1,    -1,    -1,    -1,    -1,    46,    47,    -1,    -1,    -1,
2434      51,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    60,
2435      -1,    -1,    -1,    -1,    -1,    66,     1,    -1,     3,     4,
2436      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2437      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2438      91,    92,    -1,    -1,    95,    -1,    97,    98,    -1,    -1,
2439      -1,    -1,    -1,   104,   105,   106,   107,    -1,    -1,   110,
2440     111,    46,    47,    -1,    -1,    -1,    51,    -1,     1,    -1,
2441       3,     4,    -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,
2442      -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,
2443      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2444      -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,
2445      95,    -1,    97,    46,    47,    -1,    -1,    -1,    51,   104,
2446     105,   106,   107,    -1,    -1,   110,   111,    60,    -1,    -1,
2447      -1,    -1,    -1,    66,     1,    -1,     3,     4,    -1,    -1,
2448      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2449      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2450      -1,    -1,    95,    -1,    -1,    -1,    -1,    -1,   101,    -1,
2451      -1,   104,   105,   106,   107,    -1,    -1,   110,   111,    46,
2452      47,    -1,    -1,    -1,    51,    -1,     1,    -1,     3,     4,
2453      -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,    -1,    66,
2454      -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,
2455      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2456      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2457      -1,    46,    47,   100,    -1,    -1,    51,   104,   105,   106,
2458     107,    -1,    -1,   110,   111,    60,    -1,    -1,    -1,    -1,
2459      -1,    66,     1,    -1,     3,     4,    -1,    -1,    73,    -1,
2460      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2461      -1,    -1,    87,    88,    -1,    90,    91,    92,    -1,    -1,
2462      95,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,
2463     105,   106,   107,    -1,    -1,   110,   111,    46,    47,    -1,
2464      -1,    -1,    51,    -1,     1,    -1,     3,     4,    -1,    -1,
2465      -1,    60,    -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,
2466      -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2467      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2468      -1,    -1,    91,    92,    -1,    -1,    95,    96,    -1,    46,
2469      47,    -1,    -1,    -1,    51,   104,   105,   106,   107,    -1,
2470      -1,   110,   111,    60,    -1,    -1,    -1,    -1,    -1,    66,
2471       1,    -1,     3,     4,    -1,    -1,    73,    -1,    -1,    -1,
2472      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2473      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2474      -1,    -1,    -1,    -1,   101,    -1,    -1,   104,   105,   106,
2475     107,    -1,    -1,   110,   111,    46,    47,    -1,    -1,    -1,
2476      51,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,    60,
2477      -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,
2478      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2479      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2480      91,    92,    -1,    -1,    95,    -1,    -1,    46,    47,   100,
2481      -1,    -1,    51,   104,   105,   106,   107,    -1,    -1,   110,
2482     111,    60,    -1,    -1,    -1,    -1,    -1,    66,     1,    -1,
2483       3,     4,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2484      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2485      -1,    -1,    91,    92,    -1,    -1,    95,    96,    -1,    -1,
2486      -1,    -1,    -1,    -1,    -1,   104,   105,   106,   107,    -1,
2487      -1,   110,   111,    46,    47,    -1,    -1,    -1,    51,    -1,
2488       1,    -1,     3,     4,    -1,    -1,    -1,    60,    -1,    -1,
2489      -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,
2490      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2491      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2492      -1,    -1,    95,    96,    -1,    46,    47,    -1,    -1,    -1,
2493      51,   104,   105,   106,   107,    -1,    -1,   110,   111,    60,
2494      -1,    -1,    -1,    -1,    -1,    66,     1,    -1,     3,     4,
2495      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2496      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2497      91,    92,    -1,    -1,    95,    96,    -1,    -1,    -1,    -1,
2498      -1,    -1,    -1,   104,   105,   106,   107,    -1,    -1,   110,
2499     111,    46,    47,    -1,    -1,    -1,    51,    -1,     1,    -1,
2500       3,     4,    -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,
2501      -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,
2502      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2503      -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,
2504      95,    96,    -1,    46,    47,    -1,    -1,    -1,    51,   104,
2505     105,   106,   107,    -1,    -1,   110,   111,    60,    -1,    -1,
2506      -1,    -1,    -1,    66,     1,    -1,     3,     4,    -1,    -1,
2507      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2508      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2509      -1,    -1,    95,    -1,    -1,    -1,    -1,    -1,   101,    -1,
2510      -1,   104,   105,   106,   107,    -1,    -1,   110,   111,    46,
2511      47,    -1,    -1,    -1,    51,    -1,     1,    -1,     3,     4,
2512      -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,    -1,    66,
2513      -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,
2514      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2515      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2516      -1,    46,    47,    -1,    -1,    -1,    51,   104,   105,   106,
2517     107,    -1,    -1,   110,   111,    60,    -1,    -1,    -1,    -1,
2518      -1,    66,     1,    -1,     3,     4,    -1,    -1,    73,    -1,
2519      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2520      -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,
2521      95,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,
2522     105,   106,   107,    -1,    -1,   110,   111,    46,    47,    -1,
2523      -1,    -1,    51,    -1,     1,    -1,     3,     4,    -1,    -1,
2524      -1,    60,    -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,
2525      -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2526      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2527      -1,    -1,    91,    92,    -1,    -1,    95,    -1,    -1,    46,
2528      47,    -1,    -1,    -1,    51,   104,   105,   106,   107,    -1,
2529      -1,   110,   111,    60,    -1,    -1,    -1,    -1,    -1,    66,
2530       1,    -1,     3,     4,    -1,    -1,    73,    -1,    -1,    -1,
2531      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2532      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2533      -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,   105,   106,
2534     107,    -1,    -1,   110,   111,    46,    47,    -1,    -1,    -1,
2535      51,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,    60,
2536      -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,
2537      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2538      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2539      91,    92,    -1,    -1,    95,    -1,    -1,    46,    47,    -1,
2540      -1,    -1,    51,   104,   105,   106,   107,    -1,    -1,   110,
2541     111,    60,    -1,    -1,    -1,    -1,    -1,    66,     1,    -1,
2542       3,     4,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2543      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2544      -1,    -1,    91,    92,    -1,    -1,    95,    -1,    -1,    -1,
2545      -1,    -1,    -1,    -1,    -1,   104,   105,   106,   107,    -1,
2546      -1,   110,   111,    46,    47,    -1,    -1,    -1,    51,    -1,
2547       1,    -1,     3,     4,    -1,    -1,    -1,    60,    -1,    -1,
2548      -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,
2549      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2550      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2551      -1,    -1,    95,    -1,    -1,    46,    47,    -1,    -1,    -1,
2552      51,   104,   105,   106,   107,    -1,    -1,   110,   111,    60,
2553      -1,    -1,    -1,    -1,    -1,    66,     1,    -1,     3,     4,
2554      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2555      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2556      91,    92,    -1,    -1,    95,    -1,    -1,    -1,    -1,    -1,
2557      -1,    -1,    -1,   104,   105,   106,   107,    -1,    -1,   110,
2558     111,    46,    47,    -1,    -1,    -1,    51,    -1,     1,    -1,
2559       3,     4,    -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,
2560      -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,
2561      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2562      -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,
2563      95,    -1,    -1,    46,    47,    -1,    -1,    -1,    51,   104,
2564     105,   106,   107,    -1,    -1,   110,   111,    60,    -1,    -1,
2565      -1,    -1,    -1,    66,     1,    -1,     3,     4,    -1,    -1,
2566      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2567      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2568      -1,    -1,    95,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2569      -1,   104,   105,   106,   107,    -1,    -1,   110,   111,    46,
2570      47,    -1,    -1,    -1,    51,    -1,     1,    -1,     3,     4,
2571      -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,    -1,    66,
2572      -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,
2573      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2574      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2575      -1,    46,    47,    -1,    -1,    -1,    51,   104,   105,   106,
2576     107,    -1,    -1,   110,   111,    60,    -1,    -1,    -1,    -1,
2577      -1,    66,     1,    -1,     3,     4,    -1,    -1,    73,    -1,
2578      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2579      -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,
2580      95,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,
2581     105,   106,   107,    -1,    -1,   110,   111,    46,    47,    -1,
2582      -1,    -1,    51,    -1,     1,    -1,     3,     4,    -1,    -1,
2583      -1,    60,    -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,
2584      -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2585      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2586      -1,    -1,    91,    92,    -1,    -1,    95,    -1,    -1,    46,
2587      47,    -1,    -1,    -1,    51,   104,   105,   106,   107,    -1,
2588      -1,   110,   111,    60,    -1,    -1,    -1,    -1,    -1,    66,
2589       1,    -1,     3,     4,    -1,    -1,    73,    -1,    -1,    -1,
2590      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2591      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2592      -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,   105,   106,
2593     107,    -1,    -1,   110,   111,    46,    47,    -1,    -1,    -1,
2594      51,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,    60,
2595      -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,
2596      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2597      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2598      91,    92,    -1,    -1,    95,    -1,    -1,    46,    47,    -1,
2599      -1,    -1,    51,   104,   105,   106,   107,    -1,    -1,   110,
2600     111,    60,    -1,    -1,    -1,    -1,    -1,    66,     1,    -1,
2601       3,     4,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2602      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2603      -1,    -1,    91,    92,    -1,    -1,    95,    -1,    -1,    -1,
2604      -1,    -1,    -1,    -1,    -1,   104,   105,   106,   107,    -1,
2605      -1,   110,   111,    46,    47,    -1,    -1,    -1,    51,    -1,
2606       1,    -1,     3,     4,    -1,    -1,    -1,    60,    -1,    -1,
2607      -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,
2608      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2609      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2610      -1,    -1,    95,    -1,    -1,    46,    47,    -1,    -1,    -1,
2611      51,   104,   105,   106,   107,    -1,    -1,   110,   111,    60,
2612      -1,    -1,    -1,    -1,    -1,    66,     1,    -1,     3,     4,
2613      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2614      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2615      91,    92,    -1,    -1,    95,    -1,    -1,    -1,    -1,    -1,
2616      -1,    -1,    -1,   104,   105,   106,   107,    -1,    -1,   110,
2617     111,    46,    47,    -1,    -1,    -1,    51,    -1,     1,    -1,
2618       3,     4,    -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,
2619      -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,
2620      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2621      -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,
2622      95,    -1,    -1,    46,    47,    -1,    -1,    -1,    51,   104,
2623     105,   106,   107,    -1,    -1,   110,   111,    60,    -1,    -1,
2624      -1,    -1,    -1,    66,     1,    -1,     3,     4,    -1,    -1,
2625      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2626      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2627      -1,    -1,    95,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2628      -1,   104,   105,   106,   107,    -1,    -1,   110,   111,    46,
2629      47,    -1,    -1,    -1,    51,    -1,     1,    -1,     3,     4,
2630      -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,    -1,    66,
2631      -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,
2632      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2633      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2634      -1,    46,    47,    -1,    -1,    -1,    51,   104,   105,   106,
2635     107,    -1,    -1,   110,   111,    60,    -1,    -1,    -1,    -1,
2636      -1,    66,     1,    -1,     3,     4,    -1,    -1,    73,    -1,
2637      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2638      -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,
2639      95,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,
2640     105,   106,   107,    -1,    -1,   110,   111,    46,    47,    -1,
2641      -1,    -1,    51,    -1,     1,    -1,     3,     4,    -1,    -1,
2642      -1,    60,    -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,
2643      -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2644      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2645      -1,    -1,    91,    92,    -1,    -1,    95,    -1,    -1,    46,
2646      47,    -1,    -1,    -1,    51,   104,   105,   106,   107,    -1,
2647      -1,   110,   111,    60,    -1,    -1,    -1,    -1,    -1,    66,
2648       1,    -1,     3,     4,    -1,    -1,    73,    -1,    -1,    -1,
2649      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2650      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2651      -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,   105,   106,
2652     107,    -1,    -1,   110,   111,    46,    47,    -1,    -1,    -1,
2653      51,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,    60,
2654      -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,
2655      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2656      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2657      91,    92,    -1,    -1,    95,    -1,    -1,    46,    47,    -1,
2658      -1,    -1,    51,   104,   105,   106,   107,    -1,    -1,   110,
2659     111,    60,    -1,    -1,    -1,    -1,    -1,    66,     1,    -1,
2660       3,     4,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2661      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2662      -1,    -1,    91,    92,    -1,    -1,    95,    -1,    -1,    -1,
2663      -1,    -1,    -1,    -1,    -1,   104,   105,   106,   107,    -1,
2664      -1,   110,   111,    46,    47,    -1,    -1,    -1,    51,    -1,
2665       1,    -1,     3,     4,    -1,    -1,    -1,    60,    -1,    -1,
2666      -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,
2667      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2668      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2669      -1,    -1,    95,    -1,    -1,    46,    47,    -1,    -1,    -1,
2670      51,   104,   105,   106,   107,    -1,    -1,   110,   111,    60,
2671      -1,    -1,    -1,    -1,    -1,    66,     1,    -1,     3,     4,
2672      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2673      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2674      91,    92,    -1,    -1,    95,    -1,    -1,    -1,    -1,    -1,
2675      -1,    -1,    -1,   104,   105,   106,   107,    -1,    -1,   110,
2676     111,    46,    47,    -1,    -1,    -1,    51,    -1,     1,    -1,
2677       3,     4,    -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,
2678      -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,
2679      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2680      -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,
2681      95,    -1,    -1,    46,    47,    -1,    -1,    -1,    51,   104,
2682     105,   106,   107,    -1,    -1,   110,   111,    60,    -1,    -1,
2683      -1,    -1,    -1,    66,     1,    -1,     3,     4,    -1,    -1,
2684      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2685      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2686      -1,    -1,    95,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2687      -1,   104,   105,   106,   107,    -1,    -1,   110,   111,    46,
2688      47,    -1,    -1,    -1,    51,    -1,     1,    -1,     3,     4,
2689      -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,    -1,    66,
2690      -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,
2691      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2692      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2693      -1,    46,    47,    -1,    -1,    -1,    51,   104,   105,   106,
2694     107,    -1,    -1,   110,   111,    60,    -1,    -1,    -1,    -1,
2695      -1,    66,     1,    -1,     3,     4,    -1,    -1,    73,    -1,
2696      -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,
2697      -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,
2698      95,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,
2699     105,   106,   107,    -1,    -1,   110,   111,    46,    47,    -1,
2700      -1,    -1,    51,    -1,     1,    -1,     3,     4,    -1,    -1,
2701      -1,    60,    -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,
2702      -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2703      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2704      -1,    -1,    91,    92,    -1,    -1,    95,    -1,    -1,    46,
2705      47,    -1,    -1,    -1,    51,   104,   105,   106,   107,    -1,
2706      -1,   110,   111,    60,    -1,    -1,    -1,    -1,    -1,    66,
2707       1,    -1,     3,     4,    -1,    -1,    73,    -1,    -1,    -1,
2708      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,
2709      87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,    -1,
2710      -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,   105,   106,
2711     107,    -1,    -1,   110,   111,    46,    47,    -1,    -1,    -1,
2712      51,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,    60,
2713      -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,
2714      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2715      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2716      91,    92,    -1,    -1,    95,    -1,    -1,    46,    47,    -1,
2717      -1,    -1,    51,   104,   105,   106,   107,    -1,    -1,   110,
2718     111,    60,    -1,    -1,    -1,    -1,    -1,    66,     1,    -1,
2719       3,     4,    -1,    -1,    73,    -1,    -1,    -1,    77,    -1,
2720      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2721      -1,    -1,    91,    92,    -1,    -1,    95,    -1,    -1,    -1,
2722      -1,    -1,    -1,    -1,    -1,   104,   105,   106,   107,    -1,
2723      -1,   110,   111,    46,    47,    -1,    -1,    -1,    51,    -1,
2724       1,    -1,     3,     4,    -1,    -1,    -1,    60,    -1,    -1,
2725      -1,    -1,    -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,
2726      73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,
2727      -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,
2728      -1,    -1,    95,    -1,    -1,    46,    47,    -1,    -1,    -1,
2729      51,   104,   105,   106,   107,    -1,    -1,   110,   111,    60,
2730      -1,    -1,     1,    -1,     3,    66,    -1,    -1,    -1,    -1,
2731      -1,    -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,
2732      -1,    -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,
2733      91,    92,    -1,    -1,    95,    -1,    -1,    -1,    -1,    -1,
2734      -1,    -1,    -1,   104,   105,   106,   107,    46,    47,   110,
2735     111,    -1,    51,    -1,     1,    -1,    -1,    -1,    -1,    -1,
2736      -1,    60,    -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,
2737      -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,    77,     1,
2738      -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,    88,
2739      -1,    -1,    91,    92,    -1,    -1,    95,    -1,    45,    46,
2740      47,    -1,    -1,    -1,    51,   104,   105,   106,   107,    -1,
2741      -1,   110,   111,    60,    -1,    -1,    -1,    -1,    -1,    66,
2742      -1,    -1,     1,    -1,    46,    47,    73,    -1,    -1,    51,
2743      77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    60,    -1,
2744      87,    88,    -1,    -1,    66,    -1,    -1,     1,    95,    -1,
2745      -1,    73,    -1,    -1,   101,    77,    -1,   104,   105,   106,
2746     107,    -1,    84,   110,   111,    87,    88,    46,    47,    -1,
2747      -1,    -1,    51,    95,    96,    -1,    -1,    -1,    -1,    -1,
2748      -1,    60,   104,   105,   106,   107,    -1,    66,   110,   111,
2749      -1,    -1,    46,    47,    73,    -1,    -1,    51,    77,    -1,
2750      -1,     3,     4,    -1,    -1,    84,    60,    -1,    87,    88,
2751      -1,    -1,    66,    -1,    -1,    -1,    95,    96,    -1,    73,
2752      -1,    -1,    -1,    77,    -1,   104,   105,   106,   107,    -1,
2753      84,   110,   111,    87,    88,    -1,    -1,    -1,    -1,    -1,
2754      -1,    95,    -1,    -1,    46,    47,    -1,    -1,    -1,    51,
2755     104,   105,   106,   107,    -1,    -1,   110,   111,    60,    -1,
2756      -1,    -1,    -1,    -1,    66,    -1,    -1,     3,     4,    -1,
2757      -1,    73,    -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,
2758      -1,    -1,    84,    -1,    -1,    87,    88,    -1,    -1,    91,
2759      92,    -1,    -1,    95,    96,    -1,    -1,    -1,    -1,    -1,
2760      -1,    -1,   104,   105,   106,   107,    -1,    -1,   110,   111,
2761      46,    47,    -1,    -1,    -1,    51,    -1,    -1,    -1,     3,
2762       4,    -1,    -1,    -1,    60,    -1,    -1,    -1,    -1,    -1,
2763      66,    -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,    -1,
2764      -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,
2765      -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,
2766      96,    -1,    46,    47,    -1,    -1,    -1,    51,   104,   105,
2767     106,   107,    -1,    -1,   110,   111,    60,    -1,    -1,    -1,
2768      -1,    -1,    66,    -1,    -1,     3,     4,    -1,    -1,    73,
2769      -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,
2770      84,    -1,    -1,    87,    88,    -1,    -1,    91,    92,    -1,
2771      -1,    95,    96,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2772     104,   105,   106,   107,    -1,    -1,   110,   111,    46,    47,
2773      -1,    -1,    -1,    51,    -1,    -1,    -1,     3,     4,    -1,
2774      -1,    -1,    60,    -1,    -1,    -1,    -1,    -1,    66,    -1,
2775      -1,    -1,    -1,    -1,    -1,    73,    -1,    -1,    -1,    77,
2776      -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    87,
2777      88,    -1,    -1,    91,    92,    -1,    -1,    95,    96,    -1,
2778      46,    47,    -1,    -1,    -1,    51,   104,   105,   106,   107,
2779      -1,    -1,   110,   111,    60,    -1,    -1,    -1,    -1,    -1,
2780      66,    -1,    -1,    -1,    -1,    -1,    -1,    73,    -1,    -1,
2781      -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,    84,    -1,
2782      -1,    87,    88,    -1,    -1,    91,    92,    -1,    -1,    95,
2783      -1,    45,    46,    47,    -1,    -1,    -1,    51,   104,   105,
2784     106,   107,    -1,    -1,   110,   111,    60,    -1,    -1,    -1,
2785      -1,    -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,    73,
2786      -1,    -1,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,
2787      84,    -1,    -1,    87,    88,    -1,    -1,    -1,    -1,    -1,
2788      -1,    95,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2789     104,   105,   106,   107,    -1,    -1,   110,   111
2790};
2791
2792/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2793   symbol of state STATE-NUM.  */
2794static const unsigned short yystos[] =
2795{
2796       0,   113,   114,     0,     1,    45,    56,    62,    68,    76,
2797     101,   127,   128,   129,   130,   131,   132,   133,   134,   135,
2798     136,   171,   194,     1,    88,   123,   124,   125,   126,   126,
2799       1,   126,     1,   123,   129,   131,   134,   128,   129,    45,
2800      62,    68,     1,   101,   103,     1,    64,   172,   176,     1,
2801      64,   139,     1,   101,   103,   129,   126,     1,   126,     1,
2802       5,   126,     1,   119,   121,   123,    97,   177,   102,   174,
2803       1,   119,   120,    53,   140,     1,   173,   176,     1,   139,
2804       1,   101,    51,    60,    84,    87,    98,   116,   117,   118,
2805     119,   122,   123,   135,   136,   146,   153,   171,   178,   179,
2806     180,   181,     1,   121,   177,     1,     1,   121,   141,   138,
2807     177,   175,   140,     1,   126,   154,     1,   126,   147,   148,
2808     149,   154,    99,   247,   247,     1,    60,   116,     1,   101,
2809      98,   179,   102,    97,   142,   177,   137,    95,    54,    99,
2810     158,     1,   101,   102,    94,    99,   100,   158,   100,    99,
2811       1,   154,     1,   147,   154,     1,   121,    97,    98,   124,
2812     135,   136,   143,   144,   145,   146,   151,   153,   161,   162,
2813     163,   165,   166,   171,   184,   185,   194,   142,     1,    96,
2814     116,   135,   155,   156,   157,     1,   120,   159,     1,   100,
2815       1,   126,   148,     1,     3,     4,    46,    47,    60,    66,
2816      73,    77,    91,    92,    95,    97,   104,   105,   106,   107,
2817     110,   111,   115,   117,   122,   123,   150,   182,   235,   236,
2818     237,   238,   239,   242,   244,   248,   249,   250,   251,   252,
2819     253,   254,   255,   256,   257,   258,   259,   260,   261,   262,
2820     263,   264,   265,   266,   267,   268,   269,   270,   271,   272,
2821     273,   275,     1,   100,     1,     1,   100,   158,   101,   158,
2822      98,    95,   166,    98,   144,     1,   152,   184,   164,   158,
2823       1,    49,    50,    52,    55,    59,    66,    67,    69,    71,
2824      72,    74,    77,    78,    95,   116,   117,   122,   123,   126,
2825     135,   136,   157,   170,   184,   187,   188,   189,   190,   191,
2826     193,   194,   195,   196,   198,   199,   200,   201,   203,   205,
2827     211,   212,   214,   215,   216,   218,   219,   223,   224,   225,
2828     226,   227,   228,   229,   230,   238,   249,   251,   252,   253,
2829     256,   257,   272,     1,   149,    96,   102,   116,   102,     1,
2830     123,   248,   250,   255,     1,   254,     1,   255,     1,   255,
2831     103,     1,   103,     1,   117,   119,   120,     1,   255,     1,
2832     255,     1,   117,   123,   275,    98,   102,   150,   183,   103,
2833     103,    95,    99,   103,     1,   103,    99,     1,   126,    46,
2834      47,     5,     6,     7,     3,     4,     8,     9,    10,    18,
2835      19,    20,    21,    58,    16,    17,    11,    12,    13,    14,
2836      15,    89,    93,    94,   274,    96,   155,   158,   101,   160,
2837     184,    97,   167,   185,    97,    98,   101,     1,    95,     1,
2838     275,     1,   101,   126,     1,   101,   275,     1,    95,     1,
2839      95,     1,   184,     1,    95,     1,   101,   126,     1,   275,
2840     275,   147,   103,     1,    90,   116,    95,    98,   186,   188,
2841     101,   123,   135,   191,   101,   204,   191,   191,   123,   190,
2842     199,   220,   222,   101,     1,    95,     1,   156,     1,   149,
2843       1,   120,     1,    68,     1,   126,    99,   100,   101,    99,
2844     245,   246,   247,   245,   247,     1,    95,    96,    99,   247,
2845     247,     1,    96,    98,    98,   102,     1,    68,    68,    96,
2846     243,   275,     1,   275,     1,    68,    73,    77,    73,   126,
2847       1,   275,     1,    95,     1,   255,     1,   255,     1,   255,
2848       1,   260,     1,   260,     1,   261,     1,   261,     1,   261,
2849       1,   262,     1,   262,     1,   262,     1,   262,     1,   117,
2850     118,     1,   263,     1,   263,     1,   264,     1,   265,     1,
2851     266,     1,   267,     1,   268,     1,    90,   275,     1,   271,
2852      96,   123,   168,   169,   170,   186,   187,     1,   275,     1,
2853     101,     1,   101,     1,   101,     1,   275,     1,   275,    61,
2854      65,   231,   232,   233,   234,     1,     1,   101,     1,    90,
2855     101,    96,    66,   147,     1,    96,   243,    97,   206,    67,
2856       1,   102,     1,   101,   275,     1,   275,    96,   103,    95,
2857       1,   275,   246,   247,   182,   247,   182,     1,    96,   243,
2858       1,   255,     1,    96,    96,   258,     1,    98,   150,    96,
2859     102,     1,   100,    95,     1,   100,    96,   243,     1,    90,
2860     103,   168,   187,    95,   168,     1,    96,     1,    96,    96,
2861       1,    95,     1,   184,   232,   234,   184,   275,     1,    95,
2862       1,     1,    96,    48,    63,    98,   207,   208,   209,   210,
2863      95,     1,   199,     1,   221,   222,   101,    96,    96,    96,
2864     243,     1,   100,   241,     1,    96,     1,   255,     1,   258,
2865       1,   275,    96,   243,   142,    96,     1,   270,    66,   168,
2866      96,   243,    49,   191,   192,   193,   195,   197,   202,   211,
2867     213,   217,   219,     1,     1,   156,   101,     1,    96,   243,
2868       1,     1,    90,     1,   275,   276,    98,   208,   209,    98,
2869     187,   210,   275,    96,     1,   221,     1,   184,    96,   142,
2870     240,    96,   142,    95,   101,    96,    95,    57,   192,   192,
2871     101,    96,    96,     1,     1,    96,     1,    90,    98,    96,
2872     191,    96,   142,    96,   243,   101,   275,   191,   101,   275,
2873       1,   101,   191,   101,    96,    96,   221,   101,   101,   192,
2874      96,   221,    57,   192,    96,   192,   192
2875};
2876
2877#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
2878# define YYSIZE_T __SIZE_TYPE__
2879#endif
2880#if ! defined (YYSIZE_T) && defined (size_t)
2881# define YYSIZE_T size_t
2882#endif
2883#if ! defined (YYSIZE_T)
2884# if defined (__STDC__) || defined (__cplusplus)
2885#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2886#  define YYSIZE_T size_t
2887# endif
2888#endif
2889#if ! defined (YYSIZE_T)
2890# define YYSIZE_T unsigned int
2891#endif
2892
2893#define yyerrok		(yyerrstatus = 0)
2894#define yyclearin	(yychar = YYEMPTY)
2895#define YYEMPTY		-2
2896#define YYEOF		0
2897
2898#define YYACCEPT	goto yyacceptlab
2899#define YYABORT		goto yyabortlab
2900#define YYERROR		goto yyerrlab1
2901
2902/* Like YYERROR except do call yyerror.  This remains here temporarily
2903   to ease the transition to the new meaning of YYERROR, for GCC.
2904   Once GCC version 2 has supplanted version 1, this can go.  */
2905
2906#define YYFAIL		goto yyerrlab
2907
2908#define YYRECOVERING()  (!!yyerrstatus)
2909
2910#define YYBACKUP(Token, Value)					\
2911do								\
2912  if (yychar == YYEMPTY && yylen == 1)				\
2913    {								\
2914      yychar = (Token);						\
2915      yylval = (Value);						\
2916      yychar1 = YYTRANSLATE (yychar);				\
2917      YYPOPSTACK;						\
2918      goto yybackup;						\
2919    }								\
2920  else								\
2921    { 								\
2922      yyerror ("syntax error: cannot back up");			\
2923      YYERROR;							\
2924    }								\
2925while (0)
2926
2927#define YYTERROR	1
2928#define YYERRCODE	256
2929
2930/* YYLLOC_DEFAULT -- Compute the default location (before the actions
2931   are run).  */
2932
2933#ifndef YYLLOC_DEFAULT
2934# define YYLLOC_DEFAULT(Current, Rhs, N)           \
2935  Current.first_line   = Rhs[1].first_line;      \
2936  Current.first_column = Rhs[1].first_column;    \
2937  Current.last_line    = Rhs[N].last_line;       \
2938  Current.last_column  = Rhs[N].last_column;
2939#endif
2940
2941/* YYLEX -- calling `yylex' with the right arguments.  */
2942
2943#ifdef YYLEX_PARAM
2944# define YYLEX	yylex (&yylval, YYLEX_PARAM)
2945#else
2946# define YYLEX	yylex (&yylval)
2947#endif
2948
2949/* Enable debugging if requested.  */
2950#if YYDEBUG
2951
2952# ifndef YYFPRINTF
2953#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2954#  define YYFPRINTF fprintf
2955# endif
2956
2957# define YYDPRINTF(Args)			\
2958do {						\
2959  if (yydebug)					\
2960    YYFPRINTF Args;				\
2961} while (0)
2962# define YYDSYMPRINT(Args)			\
2963do {						\
2964  if (yydebug)					\
2965    yysymprint Args;				\
2966} while (0)
2967/* Nonzero means print parse trace.  It is left uninitialized so that
2968   multiple parsers can coexist.  */
2969int yydebug;
2970#else /* !YYDEBUG */
2971# define YYDPRINTF(Args)
2972# define YYDSYMPRINT(Args)
2973#endif /* !YYDEBUG */
2974
2975/* YYINITDEPTH -- initial size of the parser's stacks.  */
2976#ifndef	YYINITDEPTH
2977# define YYINITDEPTH 200
2978#endif
2979
2980/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2981   if the built-in stack extension method is used).
2982
2983   Do not make this value too large; the results are undefined if
2984   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
2985   evaluated with infinite-precision integer arithmetic.  */
2986
2987#if YYMAXDEPTH == 0
2988# undef YYMAXDEPTH
2989#endif
2990
2991#ifndef YYMAXDEPTH
2992# define YYMAXDEPTH 10000
2993#endif
2994
2995
2996
2997#if YYERROR_VERBOSE
2998
2999# ifndef yystrlen
3000#  if defined (__GLIBC__) && defined (_STRING_H)
3001#   define yystrlen strlen
3002#  else
3003/* Return the length of YYSTR.  */
3004static YYSIZE_T
3005#   if defined (__STDC__) || defined (__cplusplus)
3006yystrlen (const char *yystr)
3007#   else
3008yystrlen (yystr)
3009     const char *yystr;
3010#   endif
3011{
3012  register const char *yys = yystr;
3013
3014  while (*yys++ != '\0')
3015    continue;
3016
3017  return yys - yystr - 1;
3018}
3019#  endif
3020# endif
3021
3022# ifndef yystpcpy
3023#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
3024#   define yystpcpy stpcpy
3025#  else
3026/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3027   YYDEST.  */
3028static char *
3029#   if defined (__STDC__) || defined (__cplusplus)
3030yystpcpy (char *yydest, const char *yysrc)
3031#   else
3032yystpcpy (yydest, yysrc)
3033     char *yydest;
3034     const char *yysrc;
3035#   endif
3036{
3037  register char *yyd = yydest;
3038  register const char *yys = yysrc;
3039
3040  while ((*yyd++ = *yys++) != '\0')
3041    continue;
3042
3043  return yyd - 1;
3044}
3045#  endif
3046# endif
3047
3048#endif /* !YYERROR_VERBOSE */
3049
3050
3051
3052#if YYDEBUG
3053/*-----------------------------.
3054| Print this symbol on YYOUT.  |
3055`-----------------------------*/
3056
3057static void
3058#if defined (__STDC__) || defined (__cplusplus)
3059yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
3060#else
3061yysymprint (yyout, yytype, yyvalue)
3062    FILE* yyout;
3063    int yytype;
3064    YYSTYPE yyvalue;
3065#endif
3066{
3067  /* Pacify ``unused variable'' warnings.  */
3068  (void) yyvalue;
3069
3070  if (yytype < YYNTOKENS)
3071    {
3072      YYFPRINTF (yyout, "token %s (", yytname[yytype]);
3073# ifdef YYPRINT
3074      YYPRINT (yyout, yytoknum[yytype], yyvalue);
3075# endif
3076    }
3077  else
3078    YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
3079
3080  switch (yytype)
3081    {
3082      default:
3083        break;
3084    }
3085  YYFPRINTF (yyout, ")");
3086}
3087#endif /* YYDEBUG. */
3088
3089
3090/*-----------------------------------------------.
3091| Release the memory associated to this symbol.  |
3092`-----------------------------------------------*/
3093
3094static void
3095#if defined (__STDC__) || defined (__cplusplus)
3096yydestruct (int yytype, YYSTYPE yyvalue)
3097#else
3098yydestruct (yytype, yyvalue)
3099    int yytype;
3100    YYSTYPE yyvalue;
3101#endif
3102{
3103  /* Pacify ``unused variable'' warnings.  */
3104  (void) yyvalue;
3105
3106  switch (yytype)
3107    {
3108      default:
3109        break;
3110    }
3111}
3112
3113
3114
3115/* The user can define YYPARSE_PARAM as the name of an argument to be passed
3116   into yyparse.  The argument should have type void *.
3117   It should actually point to an object.
3118   Grammar actions can access the variable by casting it
3119   to the proper pointer type.  */
3120
3121#ifdef YYPARSE_PARAM
3122# if defined (__STDC__) || defined (__cplusplus)
3123#  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
3124#  define YYPARSE_PARAM_DECL
3125# else
3126#  define YYPARSE_PARAM_ARG YYPARSE_PARAM
3127#  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
3128# endif
3129#else /* !YYPARSE_PARAM */
3130# define YYPARSE_PARAM_ARG
3131# define YYPARSE_PARAM_DECL
3132#endif /* !YYPARSE_PARAM */
3133
3134/* Prevent warning if -Wstrict-prototypes.  */
3135#ifdef __GNUC__
3136# ifdef YYPARSE_PARAM
3137int yyparse (void *);
3138# else
3139int yyparse (void);
3140# endif
3141#endif
3142
3143
3144
3145
3146int
3147yyparse (YYPARSE_PARAM_ARG)
3148     YYPARSE_PARAM_DECL
3149{
3150  /* The lookahead symbol.  */
3151int yychar;
3152
3153/* The semantic value of the lookahead symbol.  */
3154YYSTYPE yylval;
3155
3156/* Number of parse errors so far.  */
3157int yynerrs;
3158
3159  register int yystate;
3160  register int yyn;
3161  int yyresult;
3162  /* Number of tokens to shift before error messages enabled.  */
3163  int yyerrstatus;
3164  /* Lookahead token as an internal (translated) token number.  */
3165  int yychar1 = 0;
3166
3167  /* Three stacks and their tools:
3168     `yyss': related to states,
3169     `yyvs': related to semantic values,
3170     `yyls': related to locations.
3171
3172     Refer to the stacks thru separate pointers, to allow yyoverflow
3173     to reallocate them elsewhere.  */
3174
3175  /* The state stack.  */
3176  short	yyssa[YYINITDEPTH];
3177  short *yyss = yyssa;
3178  register short *yyssp;
3179
3180  /* The semantic value stack.  */
3181  YYSTYPE yyvsa[YYINITDEPTH];
3182  YYSTYPE *yyvs = yyvsa;
3183  register YYSTYPE *yyvsp;
3184
3185
3186
3187#define YYPOPSTACK   (yyvsp--, yyssp--)
3188
3189  YYSIZE_T yystacksize = YYINITDEPTH;
3190
3191  /* The variables used to return semantic value and location from the
3192     action routines.  */
3193  YYSTYPE yyval;
3194
3195
3196  /* When reducing, the number of symbols on the RHS of the reduced
3197     rule.  */
3198  int yylen;
3199
3200  YYDPRINTF ((stderr, "Starting parse\n"));
3201
3202  yystate = 0;
3203  yyerrstatus = 0;
3204  yynerrs = 0;
3205  yychar = YYEMPTY;		/* Cause a token to be read.  */
3206
3207  /* Initialize stack pointers.
3208     Waste one element of value and location stack
3209     so that they stay on the same level as the state stack.
3210     The wasted elements are never initialized.  */
3211
3212  yyssp = yyss;
3213  yyvsp = yyvs;
3214
3215  goto yysetstate;
3216
3217/*------------------------------------------------------------.
3218| yynewstate -- Push a new state, which is found in yystate.  |
3219`------------------------------------------------------------*/
3220 yynewstate:
3221  /* In all cases, when you get here, the value and location stacks
3222     have just been pushed. so pushing a state here evens the stacks.
3223     */
3224  yyssp++;
3225
3226 yysetstate:
3227  *yyssp = yystate;
3228
3229  if (yyssp >= yyss + yystacksize - 1)
3230    {
3231      /* Get the current used size of the three stacks, in elements.  */
3232      YYSIZE_T yysize = yyssp - yyss + 1;
3233
3234#ifdef yyoverflow
3235      {
3236	/* Give user a chance to reallocate the stack. Use copies of
3237	   these so that the &'s don't force the real ones into
3238	   memory.  */
3239	YYSTYPE *yyvs1 = yyvs;
3240	short *yyss1 = yyss;
3241
3242
3243	/* Each stack pointer address is followed by the size of the
3244	   data in use in that stack, in bytes.  This used to be a
3245	   conditional around just the two extra args, but that might
3246	   be undefined if yyoverflow is a macro.  */
3247	yyoverflow ("parser stack overflow",
3248		    &yyss1, yysize * sizeof (*yyssp),
3249		    &yyvs1, yysize * sizeof (*yyvsp),
3250
3251		    &yystacksize);
3252
3253	yyss = yyss1;
3254	yyvs = yyvs1;
3255      }
3256#else /* no yyoverflow */
3257# ifndef YYSTACK_RELOCATE
3258      goto yyoverflowlab;
3259# else
3260      /* Extend the stack our own way.  */
3261      if (yystacksize >= YYMAXDEPTH)
3262	goto yyoverflowlab;
3263      yystacksize *= 2;
3264      if (yystacksize > YYMAXDEPTH)
3265	yystacksize = YYMAXDEPTH;
3266
3267      {
3268	short *yyss1 = yyss;
3269	union yyalloc *yyptr =
3270	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3271	if (! yyptr)
3272	  goto yyoverflowlab;
3273	YYSTACK_RELOCATE (yyss);
3274	YYSTACK_RELOCATE (yyvs);
3275
3276#  undef YYSTACK_RELOCATE
3277	if (yyss1 != yyssa)
3278	  YYSTACK_FREE (yyss1);
3279      }
3280# endif
3281#endif /* no yyoverflow */
3282
3283      yyssp = yyss + yysize - 1;
3284      yyvsp = yyvs + yysize - 1;
3285
3286
3287      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3288		  (unsigned long int) yystacksize));
3289
3290      if (yyssp >= yyss + yystacksize - 1)
3291	YYABORT;
3292    }
3293
3294  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3295
3296  goto yybackup;
3297
3298/*-----------.
3299| yybackup.  |
3300`-----------*/
3301yybackup:
3302
3303/* Do appropriate processing given the current state.  */
3304/* Read a lookahead token if we need one and don't already have one.  */
3305/* yyresume: */
3306
3307  /* First try to decide what to do without reference to lookahead token.  */
3308
3309  yyn = yypact[yystate];
3310  if (yyn == YYPACT_NINF)
3311    goto yydefault;
3312
3313  /* Not known => get a lookahead token if don't already have one.  */
3314
3315  /* yychar is either YYEMPTY or YYEOF
3316     or a valid token in external form.  */
3317
3318  if (yychar == YYEMPTY)
3319    {
3320      YYDPRINTF ((stderr, "Reading a token: "));
3321      yychar = YYLEX;
3322    }
3323
3324  /* Convert token to internal form (in yychar1) for indexing tables with.  */
3325
3326  if (yychar <= 0)		/* This means end of input.  */
3327    {
3328      yychar1 = 0;
3329      yychar = YYEOF;		/* Don't call YYLEX any more.  */
3330
3331      YYDPRINTF ((stderr, "Now at end of input.\n"));
3332    }
3333  else
3334    {
3335      yychar1 = YYTRANSLATE (yychar);
3336
3337      /* We have to keep this `#if YYDEBUG', since we use variables
3338	 which are defined only if `YYDEBUG' is set.  */
3339      YYDPRINTF ((stderr, "Next token is "));
3340      YYDSYMPRINT ((stderr, yychar1, yylval));
3341      YYDPRINTF ((stderr, "\n"));
3342    }
3343
3344  /* If the proper action on seeing token YYCHAR1 is to reduce or to
3345     detect an error, take that action.  */
3346  yyn += yychar1;
3347  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
3348    goto yydefault;
3349  yyn = yytable[yyn];
3350  if (yyn <= 0)
3351    {
3352      if (yyn == 0 || yyn == YYTABLE_NINF)
3353	goto yyerrlab;
3354      yyn = -yyn;
3355      goto yyreduce;
3356    }
3357
3358  if (yyn == YYFINAL)
3359    YYACCEPT;
3360
3361  /* Shift the lookahead token.  */
3362  YYDPRINTF ((stderr, "Shifting token %d (%s), ",
3363	      yychar, yytname[yychar1]));
3364
3365  /* Discard the token being shifted unless it is eof.  */
3366  if (yychar != YYEOF)
3367    yychar = YYEMPTY;
3368
3369  *++yyvsp = yylval;
3370
3371
3372  /* Count tokens shifted since error; after three, turn off error
3373     status.  */
3374  if (yyerrstatus)
3375    yyerrstatus--;
3376
3377  yystate = yyn;
3378  goto yynewstate;
3379
3380
3381/*-----------------------------------------------------------.
3382| yydefault -- do the default action for the current state.  |
3383`-----------------------------------------------------------*/
3384yydefault:
3385  yyn = yydefact[yystate];
3386  if (yyn == 0)
3387    goto yyerrlab;
3388  goto yyreduce;
3389
3390
3391/*-----------------------------.
3392| yyreduce -- Do a reduction.  |
3393`-----------------------------*/
3394yyreduce:
3395  /* yyn is the number of a rule to reduce with.  */
3396  yylen = yyr2[yyn];
3397
3398  /* If YYLEN is nonzero, implement the default value of the action:
3399     `$$ = $1'.
3400
3401     Otherwise, the following line sets YYVAL to garbage.
3402     This behavior is undocumented and Bison
3403     users should not rely upon it.  Assigning to YYVAL
3404     unconditionally makes the parser a bit smaller, and it avoids a
3405     GCC warning that YYVAL may be used uninitialized.  */
3406  yyval = yyvsp[1-yylen];
3407
3408
3409
3410#if YYDEBUG
3411  /* We have to keep this `#if YYDEBUG', since we use variables which
3412     are defined only if `YYDEBUG' is set.  */
3413  if (yydebug)
3414    {
3415      int yyi;
3416
3417      YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
3418		 yyn - 1, yyrline[yyn]);
3419
3420      /* Print the symbols being reduced, and their result.  */
3421      for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
3422	YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
3423      YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
3424    }
3425#endif
3426  switch (yyn)
3427    {
3428        case 2:
3429#line 562 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3430    {
3431		  /* Register static variables with the garbage
3432		     collector.  */
3433		  ggc_add_root (&ctxp, 1,
3434				sizeof (struct parser_ctxt *),
3435				mark_parser_ctxt);
3436		  ggc_add_root (&ctxp_for_generation, 1,
3437				sizeof (struct parser_ctxt *),
3438				mark_parser_ctxt);
3439		}
3440    break;
3441
3442  case 3:
3443#line 573 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3444    {}
3445    break;
3446
3447  case 20:
3448#line 617 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3449    {
3450		  int osb = pop_current_osb (ctxp);
3451		  tree t = build_java_array_type ((yyvsp[-1].node), -1);
3452		  while (--osb)
3453		    t = build_unresolved_array_type (t);
3454		  yyval.node = t;
3455		}
3456    break;
3457
3458  case 21:
3459#line 625 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3460    {
3461		  int osb = pop_current_osb (ctxp);
3462		  tree t = yyvsp[-1].node;
3463		  while (osb--)
3464		    t = build_unresolved_array_type (t);
3465		  yyval.node = t;
3466		}
3467    break;
3468
3469  case 25:
3470#line 646 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3471    { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); }
3472    break;
3473
3474  case 27:
3475#line 655 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3476    {yyval.node = NULL;}
3477    break;
3478
3479  case 35:
3480#line 667 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3481    {
3482		  yyval.node = NULL;
3483		}
3484    break;
3485
3486  case 36:
3487#line 671 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3488    {
3489		  yyval.node = NULL;
3490		}
3491    break;
3492
3493  case 39:
3494#line 683 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3495    {
3496		  ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node);
3497		  register_package (ctxp->package);
3498		}
3499    break;
3500
3501  case 40:
3502#line 688 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3503    {yyerror ("Missing name"); RECOVER;}
3504    break;
3505
3506  case 41:
3507#line 690 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3508    {yyerror ("';' expected"); RECOVER;}
3509    break;
3510
3511  case 44:
3512#line 700 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3513    {
3514		  tree name = EXPR_WFL_NODE (yyvsp[-1].node), last_name;
3515		  int   i = IDENTIFIER_LENGTH (name)-1;
3516		  const char *last = &IDENTIFIER_POINTER (name)[i];
3517		  while (last != IDENTIFIER_POINTER (name))
3518		    {
3519		      if (last [0] == '.')
3520			break;
3521		      last--;
3522		    }
3523		  last_name = get_identifier (++last);
3524		  if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name))
3525		    {
3526		      tree err = find_name_in_single_imports (last_name);
3527		      if (err && err != name)
3528			parse_error_context
3529			  (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'",
3530			   IDENTIFIER_POINTER (name),
3531			   IDENTIFIER_POINTER (err));
3532		      else
3533			REGISTER_IMPORT (yyvsp[-1].node, last_name);
3534		    }
3535		  else
3536		    REGISTER_IMPORT (yyvsp[-1].node, last_name);
3537		}
3538    break;
3539
3540  case 45:
3541#line 726 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3542    {yyerror ("Missing name"); RECOVER;}
3543    break;
3544
3545  case 46:
3546#line 728 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3547    {yyerror ("';' expected"); RECOVER;}
3548    break;
3549
3550  case 47:
3551#line 733 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3552    {
3553		  tree name = EXPR_WFL_NODE (yyvsp[-3].node);
3554		  tree it;
3555		  /* Search for duplicates. */
3556		  for (it = ctxp->import_demand_list; it; it = TREE_CHAIN (it))
3557		    if (EXPR_WFL_NODE (TREE_PURPOSE (it)) == name)
3558		      break;
3559		  /* Don't import the same thing more than once, just ignore
3560		     duplicates (7.5.2) */
3561		  if (! it)
3562		    {
3563		      read_import_dir (yyvsp[-3].node);
3564		      ctxp->import_demand_list =
3565			chainon (ctxp->import_demand_list,
3566				 build_tree_list (yyvsp[-3].node, NULL_TREE));
3567		    }
3568		}
3569    break;
3570
3571  case 48:
3572#line 751 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3573    {yyerror ("'*' expected"); RECOVER;}
3574    break;
3575
3576  case 49:
3577#line 753 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3578    {yyerror ("';' expected"); RECOVER;}
3579    break;
3580
3581  case 50:
3582#line 758 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3583    { end_class_declaration (0); }
3584    break;
3585
3586  case 51:
3587#line 760 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3588    { end_class_declaration (0); }
3589    break;
3590
3591  case 53:
3592#line 763 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3593    {
3594		  YYERROR_NOW;
3595		  yyerror ("Class or interface declaration expected");
3596		}
3597    break;
3598
3599  case 54:
3600#line 772 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3601    {
3602		  yyval.value = (1 << yyvsp[0].value);
3603		}
3604    break;
3605
3606  case 55:
3607#line 776 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3608    {
3609		  int acc = (1 << yyvsp[0].value);
3610		  if (yyval.value & acc)
3611		    parse_error_context
3612		      (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice",
3613		       java_accstring_lookup (acc));
3614		  else
3615		    {
3616		      yyval.value |= acc;
3617		    }
3618		}
3619    break;
3620
3621  case 56:
3622#line 792 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3623    { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); }
3624    break;
3625
3626  case 57:
3627#line 794 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3628    {;}
3629    break;
3630
3631  case 58:
3632#line 796 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3633    { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); }
3634    break;
3635
3636  case 59:
3637#line 798 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3638    {;}
3639    break;
3640
3641  case 60:
3642#line 800 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3643    { yyerror ("Missing class name"); RECOVER; }
3644    break;
3645
3646  case 61:
3647#line 802 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3648    { yyerror ("Missing class name"); RECOVER; }
3649    break;
3650
3651  case 62:
3652#line 804 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3653    {
3654		  if (!ctxp->class_err) yyerror ("'{' expected");
3655		  DRECOVER(class1);
3656		}
3657    break;
3658
3659  case 63:
3660#line 809 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3661    { if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER; }
3662    break;
3663
3664  case 64:
3665#line 813 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3666    { yyval.node = NULL; }
3667    break;
3668
3669  case 65:
3670#line 815 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3671    { yyval.node = yyvsp[0].node; }
3672    break;
3673
3674  case 66:
3675#line 817 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3676    {yyerror ("'{' expected"); ctxp->class_err=1;}
3677    break;
3678
3679  case 67:
3680#line 819 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3681    {yyerror ("Missing super class name"); ctxp->class_err=1;}
3682    break;
3683
3684  case 68:
3685#line 823 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3686    { yyval.node = NULL_TREE; }
3687    break;
3688
3689  case 69:
3690#line 825 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3691    { yyval.node = yyvsp[0].node; }
3692    break;
3693
3694  case 70:
3695#line 827 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3696    {
3697		  ctxp->class_err=1;
3698		  yyerror ("Missing interface name");
3699		}
3700    break;
3701
3702  case 71:
3703#line 835 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3704    {
3705		  ctxp->interface_number = 1;
3706		  yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3707		}
3708    break;
3709
3710  case 72:
3711#line 840 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3712    {
3713		  ctxp->interface_number++;
3714		  yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3715		}
3716    break;
3717
3718  case 73:
3719#line 845 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3720    {yyerror ("Missing interface name"); RECOVER;}
3721    break;
3722
3723  case 74:
3724#line 850 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3725    {
3726		  /* Store the location of the `}' when doing xrefs */
3727		  if (flag_emit_xref)
3728		    DECL_END_SOURCE_LINE (GET_CPC ()) =
3729		      EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3730		  yyval.node = GET_CPC ();
3731		}
3732    break;
3733
3734  case 75:
3735#line 858 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3736    {
3737		  /* Store the location of the `}' when doing xrefs */
3738		  if (flag_emit_xref)
3739		    DECL_END_SOURCE_LINE (GET_CPC ()) =
3740		      EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3741		  yyval.node = GET_CPC ();
3742		}
3743    break;
3744
3745  case 81:
3746#line 877 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3747    {
3748		  if (yyvsp[0].node != empty_stmt_node)
3749		    {
3750		      TREE_CHAIN (yyvsp[0].node) = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
3751		      SET_CPC_INSTANCE_INITIALIZER_STMT (ctxp, yyvsp[0].node);
3752		    }
3753		}
3754    break;
3755
3756  case 84:
3757#line 890 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3758    { end_class_declaration (1); }
3759    break;
3760
3761  case 85:
3762#line 892 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3763    { end_class_declaration (1); }
3764    break;
3765
3766  case 87:
3767#line 899 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3768    { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); }
3769    break;
3770
3771  case 88:
3772#line 901 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3773    {
3774		  check_modifiers
3775		    ("Illegal modifier `%s' for field declaration",
3776		     yyvsp[-3].value, FIELD_MODIFIERS);
3777		  check_modifiers_consistency (yyvsp[-3].value);
3778		  register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node);
3779		}
3780    break;
3781
3782  case 90:
3783#line 914 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3784    { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); }
3785    break;
3786
3787  case 91:
3788#line 916 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3789    {yyerror ("Missing term"); RECOVER;}
3790    break;
3791
3792  case 92:
3793#line 921 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3794    { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); }
3795    break;
3796
3797  case 93:
3798#line 923 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3799    {
3800		  if (java_error_count)
3801		    yyvsp[0].node = NULL_TREE;
3802		  yyval.node = build_tree_list
3803		    (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node));
3804		}
3805    break;
3806
3807  case 94:
3808#line 930 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3809    {
3810		  yyerror ("Missing variable initializer");
3811		  yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
3812		  RECOVER;
3813		}
3814    break;
3815
3816  case 95:
3817#line 936 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3818    {
3819		  yyerror ("';' expected");
3820		  yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
3821		  RECOVER;
3822		}
3823    break;
3824
3825  case 97:
3826#line 946 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3827    { yyval.node = build_unresolved_array_type (yyvsp[-2].node); }
3828    break;
3829
3830  case 98:
3831#line 948 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3832    {yyerror ("Invalid declaration"); DRECOVER(vdi);}
3833    break;
3834
3835  case 99:
3836#line 950 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3837    {
3838		  yyerror ("']' expected");
3839		  DRECOVER(vdi);
3840		}
3841    break;
3842
3843  case 100:
3844#line 955 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3845    {yyerror ("Unbalanced ']'"); DRECOVER(vdi);}
3846    break;
3847
3848  case 103:
3849#line 966 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3850    {
3851		  current_function_decl = yyvsp[0].node;
3852		  if (current_function_decl
3853		      && TREE_CODE (current_function_decl) == FUNCTION_DECL)
3854		    source_start_java_method (current_function_decl);
3855		  else
3856		    current_function_decl = NULL_TREE;
3857		}
3858    break;
3859
3860  case 104:
3861#line 975 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3862    { finish_method_declaration (yyvsp[0].node); }
3863    break;
3864
3865  case 105:
3866#line 977 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3867    {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;}
3868    break;
3869
3870  case 106:
3871#line 982 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3872    { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); }
3873    break;
3874
3875  case 107:
3876#line 984 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3877    { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); }
3878    break;
3879
3880  case 108:
3881#line 986 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3882    { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); }
3883    break;
3884
3885  case 109:
3886#line 988 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3887    { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); }
3888    break;
3889
3890  case 110:
3891#line 990 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3892    {
3893		  yyerror ("Invalid method declaration, method name required");
3894		  RECOVER;
3895		}
3896    break;
3897
3898  case 111:
3899#line 995 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3900    {
3901		  yyerror ("Identifier expected");
3902		  RECOVER;
3903		}
3904    break;
3905
3906  case 112:
3907#line 1000 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3908    {
3909		  yyerror ("Identifier expected");
3910		  RECOVER;
3911		}
3912    break;
3913
3914  case 113:
3915#line 1005 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3916    {
3917		  yyerror ("Identifier expected");
3918		  RECOVER;
3919		}
3920    break;
3921
3922  case 114:
3923#line 1010 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3924    {
3925		  yyerror ("Invalid method declaration, return type required");
3926		  RECOVER;
3927		}
3928    break;
3929
3930  case 115:
3931#line 1018 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3932    {
3933		  ctxp->formal_parameter_number = 0;
3934		  yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE);
3935		}
3936    break;
3937
3938  case 116:
3939#line 1023 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3940    { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); }
3941    break;
3942
3943  case 117:
3944#line 1025 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3945    {
3946		  EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location;
3947		  TREE_PURPOSE (yyvsp[-2].node) =
3948		    build_unresolved_array_type (TREE_PURPOSE (yyvsp[-2].node));
3949		  parse_warning_context
3950		    (wfl_operator,
3951		     "Discouraged form of returned type specification");
3952		}
3953    break;
3954
3955  case 118:
3956#line 1034 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3957    {yyerror ("')' expected"); DRECOVER(method_declarator);}
3958    break;
3959
3960  case 119:
3961#line 1036 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3962    {yyerror ("']' expected"); RECOVER;}
3963    break;
3964
3965  case 120:
3966#line 1041 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3967    {
3968		  ctxp->formal_parameter_number = 1;
3969		}
3970    break;
3971
3972  case 121:
3973#line 1045 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3974    {
3975		  ctxp->formal_parameter_number += 1;
3976		  yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
3977		}
3978    break;
3979
3980  case 122:
3981#line 1050 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3982    { yyerror ("Missing formal parameter term"); RECOVER; }
3983    break;
3984
3985  case 123:
3986#line 1055 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3987    {
3988		  yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3989		}
3990    break;
3991
3992  case 124:
3993#line 1059 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
3994    {
3995		  yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3996		  ARG_FINAL_P (yyval.node) = 1;
3997		}
3998    break;
3999
4000  case 125:
4001#line 1064 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4002    {
4003		  yyerror ("Missing identifier"); RECOVER;
4004		  yyval.node = NULL_TREE;
4005		}
4006    break;
4007
4008  case 126:
4009#line 1069 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4010    {
4011		  yyerror ("Missing identifier"); RECOVER;
4012		  yyval.node = NULL_TREE;
4013		}
4014    break;
4015
4016  case 127:
4017#line 1077 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4018    {
4019		  check_modifiers ("Illegal modifier `%s'. Only `final' was expected here",
4020				   yyvsp[0].value, ACC_FINAL);
4021		  if (yyvsp[0].value != ACC_FINAL)
4022		    MODIFIER_WFL (FINAL_TK) = build_wfl_node (NULL_TREE);
4023		}
4024    break;
4025
4026  case 128:
4027#line 1086 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4028    { yyval.node = NULL_TREE; }
4029    break;
4030
4031  case 129:
4032#line 1088 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4033    { yyval.node = yyvsp[0].node; }
4034    break;
4035
4036  case 130:
4037#line 1090 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4038    {yyerror ("Missing class type term"); RECOVER;}
4039    break;
4040
4041  case 131:
4042#line 1095 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4043    { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); }
4044    break;
4045
4046  case 132:
4047#line 1097 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4048    { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); }
4049    break;
4050
4051  case 133:
4052#line 1099 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4053    {yyerror ("Missing class type term"); RECOVER;}
4054    break;
4055
4056  case 135:
4057#line 1104 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4058    { yyval.node = NULL_TREE; }
4059    break;
4060
4061  case 136:
4062#line 1110 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4063    {
4064		  TREE_CHAIN (yyvsp[0].node) = CPC_STATIC_INITIALIZER_STMT (ctxp);
4065		  SET_CPC_STATIC_INITIALIZER_STMT (ctxp, yyvsp[0].node);
4066		  current_static_block = NULL_TREE;
4067		}
4068    break;
4069
4070  case 137:
4071#line 1119 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4072    {
4073		  check_modifiers ("Illegal modifier `%s' for static initializer", yyvsp[0].value, ACC_STATIC);
4074		  /* Can't have a static initializer in an innerclass */
4075		  if (yyvsp[0].value | ACC_STATIC &&
4076		      GET_CPC_LIST () && !TOPLEVEL_CLASS_DECL_P (GET_CPC ()))
4077		    parse_error_context
4078		      (MODIFIER_WFL (STATIC_TK),
4079		       "Can't define static initializer in class `%s'. Static initializer can only be defined in top-level classes",
4080		       IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())));
4081		  SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
4082		}
4083    break;
4084
4085  case 138:
4086#line 1135 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4087    {
4088		  current_function_decl = yyvsp[0].node;
4089		  source_start_java_method (current_function_decl);
4090		}
4091    break;
4092
4093  case 139:
4094#line 1140 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4095    { finish_method_declaration (yyvsp[0].node); }
4096    break;
4097
4098  case 140:
4099#line 1145 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4100    { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); }
4101    break;
4102
4103  case 141:
4104#line 1147 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4105    { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); }
4106    break;
4107
4108  case 142:
4109#line 1152 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4110    {
4111		  ctxp->formal_parameter_number = 0;
4112		  yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE);
4113		}
4114    break;
4115
4116  case 143:
4117#line 1157 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4118    { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); }
4119    break;
4120
4121  case 144:
4122#line 1163 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4123    {
4124		  BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node;
4125		  yyval.node = yyvsp[0].node;
4126		}
4127    break;
4128
4129  case 145:
4130#line 1168 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4131    { yyval.node = yyvsp[0].node; }
4132    break;
4133
4134  case 146:
4135#line 1170 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4136    { yyval.node = yyvsp[0].node; }
4137    break;
4138
4139  case 147:
4140#line 1172 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4141    { yyval.node = yyvsp[0].node; }
4142    break;
4143
4144  case 149:
4145#line 1182 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4146    {
4147		  yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE);
4148		  yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node);
4149		  yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
4150		}
4151    break;
4152
4153  case 150:
4154#line 1188 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4155    {
4156		  yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node);
4157		  yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node);
4158		  yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
4159		}
4160    break;
4161
4162  case 151:
4163#line 1195 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4164    {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); }
4165    break;
4166
4167  case 152:
4168#line 1197 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4169    {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); }
4170    break;
4171
4172  case 153:
4173#line 1202 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4174    {
4175		  tree wfl = build_wfl_node (this_identifier_node);
4176		  EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
4177		  yyval.node = wfl;
4178		}
4179    break;
4180
4181  case 154:
4182#line 1208 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4183    {
4184		  tree wfl = build_wfl_node (super_identifier_node);
4185		  EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
4186		  yyval.node = wfl;
4187		}
4188    break;
4189
4190  case 155:
4191#line 1219 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4192    { create_interface (0, yyvsp[0].node, NULL_TREE); }
4193    break;
4194
4195  case 156:
4196#line 1221 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4197    { ; }
4198    break;
4199
4200  case 157:
4201#line 1223 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4202    { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); }
4203    break;
4204
4205  case 158:
4206#line 1225 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4207    { ; }
4208    break;
4209
4210  case 159:
4211#line 1227 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4212    { create_interface (0, yyvsp[-1].node, yyvsp[0].node);	}
4213    break;
4214
4215  case 160:
4216#line 1229 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4217    { ; }
4218    break;
4219
4220  case 161:
4221#line 1231 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4222    { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); }
4223    break;
4224
4225  case 162:
4226#line 1233 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4227    { ; }
4228    break;
4229
4230  case 163:
4231#line 1235 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4232    { yyerror ("'{' expected"); RECOVER; }
4233    break;
4234
4235  case 164:
4236#line 1237 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4237    { yyerror ("'{' expected"); RECOVER; }
4238    break;
4239
4240  case 165:
4241#line 1242 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4242    {
4243		  ctxp->interface_number = 1;
4244		  yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
4245		}
4246    break;
4247
4248  case 166:
4249#line 1247 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4250    {
4251		  ctxp->interface_number++;
4252		  yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
4253		}
4254    break;
4255
4256  case 167:
4257#line 1252 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4258    {yyerror ("Invalid interface type"); RECOVER;}
4259    break;
4260
4261  case 168:
4262#line 1254 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4263    {yyerror ("Missing term"); RECOVER;}
4264    break;
4265
4266  case 169:
4267#line 1259 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4268    { yyval.node = NULL_TREE; }
4269    break;
4270
4271  case 170:
4272#line 1261 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4273    { yyval.node = NULL_TREE; }
4274    break;
4275
4276  case 175:
4277#line 1273 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4278    { end_class_declaration (1); }
4279    break;
4280
4281  case 176:
4282#line 1275 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4283    { end_class_declaration (1); }
4284    break;
4285
4286  case 178:
4287#line 1284 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4288    {
4289		  check_abstract_method_header (yyvsp[-1].node);
4290		  current_function_decl = NULL_TREE; /* FIXME ? */
4291		}
4292    break;
4293
4294  case 179:
4295#line 1289 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4296    {yyerror ("';' expected"); RECOVER;}
4297    break;
4298
4299  case 180:
4300#line 1295 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4301    { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); }
4302    break;
4303
4304  case 181:
4305#line 1297 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4306    { yyval.node = build_new_array_init (yyvsp[-2].operator.location, NULL_TREE); }
4307    break;
4308
4309  case 182:
4310#line 1299 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4311    { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); }
4312    break;
4313
4314  case 183:
4315#line 1301 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4316    { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); }
4317    break;
4318
4319  case 184:
4320#line 1306 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4321    {
4322		  yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node),
4323				  yyvsp[0].node, NULL_TREE);
4324		}
4325    break;
4326
4327  case 185:
4328#line 1311 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4329    {
4330		  yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node);
4331		}
4332    break;
4333
4334  case 186:
4335#line 1315 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4336    {yyerror ("Missing term"); RECOVER;}
4337    break;
4338
4339  case 187:
4340#line 1321 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4341    {
4342		  /* Store the location of the `}' when doing xrefs */
4343		  if (current_function_decl && flag_emit_xref)
4344		    DECL_END_SOURCE_LINE (current_function_decl) =
4345		      EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
4346		  yyval.node = empty_stmt_node;
4347		}
4348    break;
4349
4350  case 188:
4351#line 1329 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4352    { yyval.node = yyvsp[0].node; }
4353    break;
4354
4355  case 189:
4356#line 1334 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4357    { enter_block (); }
4358    break;
4359
4360  case 190:
4361#line 1339 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4362    {
4363		  maybe_absorb_scoping_blocks ();
4364		  /* Store the location of the `}' when doing xrefs */
4365		  if (current_function_decl && flag_emit_xref)
4366		    DECL_END_SOURCE_LINE (current_function_decl) =
4367		      EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
4368		  yyval.node = exit_block ();
4369		  if (!BLOCK_SUBBLOCKS (yyval.node))
4370		    BLOCK_SUBBLOCKS (yyval.node) = empty_stmt_node;
4371		}
4372    break;
4373
4374  case 194:
4375#line 1359 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4376    { java_method_add_stmt (current_function_decl, yyvsp[0].node); }
4377    break;
4378
4379  case 195:
4380#line 1361 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4381    {
4382		  LOCAL_CLASS_P (TREE_TYPE (GET_CPC ())) = 1;
4383		  end_class_declaration (1);
4384		}
4385    break;
4386
4387  case 197:
4388#line 1373 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4389    { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); }
4390    break;
4391
4392  case 198:
4393#line 1375 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4394    { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); }
4395    break;
4396
4397  case 204:
4398#line 1385 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4399    { yyval.node = exit_block (); }
4400    break;
4401
4402  case 209:
4403#line 1394 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4404    { yyval.node = exit_block (); }
4405    break;
4406
4407  case 222:
4408#line 1414 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4409    {
4410		  if (flag_extraneous_semicolon
4411		      && ! current_static_block
4412		      && (! current_function_decl ||
4413			  /* Verify we're not in a inner class declaration */
4414			  (GET_CPC () != TYPE_NAME
4415			   (DECL_CONTEXT (current_function_decl)))))
4416
4417		    {
4418		      EXPR_WFL_SET_LINECOL (wfl_operator, lineno, -1);
4419		      parse_warning_context (wfl_operator, "An empty declaration is a deprecated feature that should not be used");
4420		    }
4421		  yyval.node = empty_stmt_node;
4422		}
4423    break;
4424
4425  case 223:
4426#line 1432 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4427    {
4428		  yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node),
4429					    EXPR_WFL_NODE (yyvsp[-1].node));
4430		  pushlevel (2);
4431		  push_labeled_block (yyval.node);
4432		  PUSH_LABELED_BLOCK (yyval.node);
4433		}
4434    break;
4435
4436  case 224:
4437#line 1443 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4438    { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); }
4439    break;
4440
4441  case 225:
4442#line 1445 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4443    {yyerror ("':' expected"); RECOVER;}
4444    break;
4445
4446  case 226:
4447#line 1450 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4448    { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); }
4449    break;
4450
4451  case 227:
4452#line 1456 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4453    {
4454		  /* We have a statement. Generate a WFL around it so
4455		     we can debug it */
4456		  yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0);
4457		  /* We know we have a statement, so set the debug
4458                     info to be eventually generate here. */
4459		  yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node);
4460		}
4461    break;
4462
4463  case 228:
4464#line 1465 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4465    {
4466		  YYNOT_TWICE yyerror ("Invalid expression statement");
4467		  DRECOVER (expr_stmt);
4468		}
4469    break;
4470
4471  case 229:
4472#line 1470 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4473    {
4474		  YYNOT_TWICE yyerror ("Invalid expression statement");
4475		  DRECOVER (expr_stmt);
4476		}
4477    break;
4478
4479  case 230:
4480#line 1475 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4481    {
4482		  YYNOT_TWICE yyerror ("Invalid expression statement");
4483		  DRECOVER (expr_stmt);
4484		}
4485    break;
4486
4487  case 231:
4488#line 1480 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4489    {yyerror ("')' expected"); RECOVER;}
4490    break;
4491
4492  case 232:
4493#line 1482 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4494    {
4495		  parse_ctor_invocation_error ();
4496		  RECOVER;
4497		}
4498    break;
4499
4500  case 233:
4501#line 1487 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4502    {yyerror ("')' expected"); RECOVER;}
4503    break;
4504
4505  case 234:
4506#line 1489 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4507    {
4508		  parse_ctor_invocation_error ();
4509		  RECOVER;
4510		}
4511    break;
4512
4513  case 235:
4514#line 1494 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4515    {yyerror ("'(' expected"); RECOVER;}
4516    break;
4517
4518  case 236:
4519#line 1496 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4520    {yyerror ("')' expected"); RECOVER;}
4521    break;
4522
4523  case 237:
4524#line 1498 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4525    {yyerror ("')' expected"); RECOVER;}
4526    break;
4527
4528  case 238:
4529#line 1500 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4530    {yyerror ("';' expected"); RECOVER;}
4531    break;
4532
4533  case 239:
4534#line 1502 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4535    {yyerror ("';' expected"); RECOVER;}
4536    break;
4537
4538  case 247:
4539#line 1517 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4540    {
4541		  yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node,
4542						yyvsp[0].node, NULL_TREE);
4543		}
4544    break;
4545
4546  case 248:
4547#line 1522 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4548    {yyerror ("'(' expected"); RECOVER;}
4549    break;
4550
4551  case 249:
4552#line 1524 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4553    {yyerror ("Missing term"); RECOVER;}
4554    break;
4555
4556  case 250:
4557#line 1526 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4558    {yyerror ("')' expected"); RECOVER;}
4559    break;
4560
4561  case 251:
4562#line 1531 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4563    { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); }
4564    break;
4565
4566  case 252:
4567#line 1536 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4568    { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); }
4569    break;
4570
4571  case 253:
4572#line 1541 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4573    {
4574		  enter_block ();
4575		}
4576    break;
4577
4578  case 254:
4579#line 1545 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4580    {
4581		  /* Make into "proper list" of COMPOUND_EXPRs.
4582		     I.e. make the last statement also have its own
4583		     COMPOUND_EXPR. */
4584		  maybe_absorb_scoping_blocks ();
4585		  TREE_OPERAND (yyvsp[-2].node, 1) = exit_block ();
4586		  yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-2].node), yyvsp[-2].node);
4587		}
4588    break;
4589
4590  case 255:
4591#line 1557 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4592    {
4593		  yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE);
4594		  EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
4595		}
4596    break;
4597
4598  case 256:
4599#line 1562 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4600    {yyerror ("'(' expected"); RECOVER;}
4601    break;
4602
4603  case 257:
4604#line 1564 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4605    {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);}
4606    break;
4607
4608  case 258:
4609#line 1566 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4610    {yyerror ("'{' expected"); RECOVER;}
4611    break;
4612
4613  case 259:
4614#line 1573 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4615    { yyval.node = NULL_TREE; }
4616    break;
4617
4618  case 260:
4619#line 1575 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4620    { yyval.node = NULL_TREE; }
4621    break;
4622
4623  case 261:
4624#line 1577 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4625    { yyval.node = NULL_TREE; }
4626    break;
4627
4628  case 262:
4629#line 1579 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4630    { yyval.node = NULL_TREE; }
4631    break;
4632
4633  case 268:
4634#line 1598 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4635    {
4636		  tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node);
4637		  EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location;
4638		  java_method_add_stmt (current_function_decl, lab);
4639		}
4640    break;
4641
4642  case 269:
4643#line 1604 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4644    {
4645		  tree lab = build (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
4646		  EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location;
4647		  java_method_add_stmt (current_function_decl, lab);
4648		}
4649    break;
4650
4651  case 270:
4652#line 1610 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4653    {yyerror ("Missing or invalid constant expression"); RECOVER;}
4654    break;
4655
4656  case 271:
4657#line 1612 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4658    {yyerror ("':' expected"); RECOVER;}
4659    break;
4660
4661  case 272:
4662#line 1614 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4663    {yyerror ("':' expected"); RECOVER;}
4664    break;
4665
4666  case 273:
4667#line 1619 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4668    {
4669		  tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
4670		  yyval.node = build_new_loop (body);
4671		}
4672    break;
4673
4674  case 274:
4675#line 1627 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4676    { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); }
4677    break;
4678
4679  case 275:
4680#line 1629 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4681    {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;}
4682    break;
4683
4684  case 276:
4685#line 1631 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4686    {yyerror ("Missing term and ')' expected"); RECOVER;}
4687    break;
4688
4689  case 277:
4690#line 1633 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4691    {yyerror ("')' expected"); RECOVER;}
4692    break;
4693
4694  case 278:
4695#line 1638 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4696    { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); }
4697    break;
4698
4699  case 279:
4700#line 1643 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4701    {
4702		  tree body = build_loop_body (0, NULL_TREE, 1);
4703		  yyval.node = build_new_loop (body);
4704		}
4705    break;
4706
4707  case 280:
4708#line 1652 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4709    { yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); }
4710    break;
4711
4712  case 281:
4713#line 1657 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4714    {
4715		  if (TREE_CODE_CLASS (TREE_CODE (yyvsp[-4].node)) == 'c')
4716		    yyvsp[-4].node = build_wfl_node (yyvsp[-4].node);
4717		  yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
4718		}
4719    break;
4720
4721  case 282:
4722#line 1663 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4723    {
4724		  yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
4725		  /* We have not condition, so we get rid of the EXIT_EXPR */
4726		  LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
4727		    empty_stmt_node;
4728		}
4729    break;
4730
4731  case 283:
4732#line 1670 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4733    {yyerror ("Invalid control expression"); RECOVER;}
4734    break;
4735
4736  case 284:
4737#line 1672 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4738    {yyerror ("Invalid update expression"); RECOVER;}
4739    break;
4740
4741  case 285:
4742#line 1674 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4743    {yyerror ("Invalid update expression"); RECOVER;}
4744    break;
4745
4746  case 286:
4747#line 1679 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4748    { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);}
4749    break;
4750
4751  case 287:
4752#line 1681 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4753    {
4754		  yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
4755		  /* We have not condition, so we get rid of the EXIT_EXPR */
4756		  LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
4757		    empty_stmt_node;
4758		}
4759    break;
4760
4761  case 288:
4762#line 1691 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4763    {
4764		  /* This scope defined for local variable that may be
4765                     defined within the scope of the for loop */
4766		  enter_block ();
4767		}
4768    break;
4769
4770  case 289:
4771#line 1697 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4772    {yyerror ("'(' expected"); DRECOVER(for_1);}
4773    break;
4774
4775  case 290:
4776#line 1699 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4777    {yyerror ("Invalid init statement"); RECOVER;}
4778    break;
4779
4780  case 291:
4781#line 1704 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4782    {
4783		  /* We now declare the loop body. The loop is
4784                     declared as a for loop. */
4785		  tree body = build_loop_body (0, NULL_TREE, 0);
4786		  yyval.node =  build_new_loop (body);
4787		  FOR_LOOP_P (yyval.node) = 1;
4788		  /* The loop is added to the current block the for
4789                     statement is defined within */
4790		  java_method_add_stmt (current_function_decl, yyval.node);
4791		}
4792    break;
4793
4794  case 292:
4795#line 1716 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4796    { yyval.node = empty_stmt_node; }
4797    break;
4798
4799  case 293:
4800#line 1718 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4801    {
4802		  /* Init statement recorded within the previously
4803                     defined block scope */
4804		  yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node);
4805		}
4806    break;
4807
4808  case 294:
4809#line 1724 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4810    {
4811		  /* Local variable are recorded within the previously
4812		     defined block scope */
4813		  yyval.node = NULL_TREE;
4814		}
4815    break;
4816
4817  case 295:
4818#line 1730 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4819    {yyerror ("';' expected"); DRECOVER(for_init_1);}
4820    break;
4821
4822  case 296:
4823#line 1734 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4824    {yyval.node = empty_stmt_node;}
4825    break;
4826
4827  case 297:
4828#line 1736 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4829    { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); }
4830    break;
4831
4832  case 298:
4833#line 1741 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4834    { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); }
4835    break;
4836
4837  case 299:
4838#line 1743 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4839    { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); }
4840    break;
4841
4842  case 300:
4843#line 1745 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4844    {yyerror ("Missing term"); RECOVER;}
4845    break;
4846
4847  case 301:
4848#line 1750 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4849    { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); }
4850    break;
4851
4852  case 302:
4853#line 1752 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4854    { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); }
4855    break;
4856
4857  case 303:
4858#line 1754 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4859    {yyerror ("Missing term"); RECOVER;}
4860    break;
4861
4862  case 304:
4863#line 1756 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4864    {yyerror ("';' expected"); RECOVER;}
4865    break;
4866
4867  case 305:
4868#line 1761 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4869    { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); }
4870    break;
4871
4872  case 306:
4873#line 1763 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4874    { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); }
4875    break;
4876
4877  case 307:
4878#line 1765 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4879    {yyerror ("Missing term"); RECOVER;}
4880    break;
4881
4882  case 308:
4883#line 1767 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4884    {yyerror ("';' expected"); RECOVER;}
4885    break;
4886
4887  case 309:
4888#line 1772 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4889    { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); }
4890    break;
4891
4892  case 310:
4893#line 1774 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4894    { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); }
4895    break;
4896
4897  case 311:
4898#line 1776 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4899    {yyerror ("Missing term"); RECOVER;}
4900    break;
4901
4902  case 312:
4903#line 1778 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4904    {yyerror ("';' expected"); RECOVER;}
4905    break;
4906
4907  case 313:
4908#line 1783 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4909    {
4910		  yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node);
4911		  EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
4912		}
4913    break;
4914
4915  case 314:
4916#line 1788 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4917    {yyerror ("Missing term"); RECOVER;}
4918    break;
4919
4920  case 315:
4921#line 1790 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4922    {yyerror ("';' expected"); RECOVER;}
4923    break;
4924
4925  case 316:
4926#line 1795 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4927    {
4928		  yyval.node = build_assertion (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[-1].node);
4929		}
4930    break;
4931
4932  case 317:
4933#line 1799 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4934    {
4935		  yyval.node = build_assertion (yyvsp[-2].operator.location, yyvsp[-1].node, NULL_TREE);
4936		}
4937    break;
4938
4939  case 318:
4940#line 1803 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4941    {yyerror ("Missing term"); RECOVER;}
4942    break;
4943
4944  case 319:
4945#line 1805 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4946    {yyerror ("';' expected"); RECOVER;}
4947    break;
4948
4949  case 320:
4950#line 1810 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4951    {
4952		  yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
4953		  EXPR_WFL_LINECOL (yyval.node) =
4954		    EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));
4955		}
4956    break;
4957
4958  case 321:
4959#line 1816 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4960    {yyerror ("'{' expected"); RECOVER;}
4961    break;
4962
4963  case 322:
4964#line 1818 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4965    {yyerror ("'(' expected"); RECOVER;}
4966    break;
4967
4968  case 323:
4969#line 1820 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4970    {yyerror ("Missing term"); RECOVER;}
4971    break;
4972
4973  case 324:
4974#line 1822 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4975    {yyerror ("Missing term"); RECOVER;}
4976    break;
4977
4978  case 325:
4979#line 1827 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4980    {
4981		  check_modifiers (
4982             "Illegal modifier `%s'. Only `synchronized' was expected here",
4983				   yyvsp[0].value, ACC_SYNCHRONIZED);
4984		  if (yyvsp[0].value != ACC_SYNCHRONIZED)
4985		    MODIFIER_WFL (SYNCHRONIZED_TK) =
4986		      build_wfl_node (NULL_TREE);
4987		}
4988    break;
4989
4990  case 326:
4991#line 1839 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4992    { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); }
4993    break;
4994
4995  case 327:
4996#line 1841 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
4997    { yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); }
4998    break;
4999
5000  case 328:
5001#line 1843 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5002    { yyval.node = build_try_finally_statement
5003		    (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location,
5004						       yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node);
5005		}
5006    break;
5007
5008  case 329:
5009#line 1848 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5010    {yyerror ("'{' expected"); DRECOVER (try_statement);}
5011    break;
5012
5013  case 331:
5014#line 1854 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5015    {
5016		  TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node;
5017		  yyval.node = yyvsp[0].node;
5018		}
5019    break;
5020
5021  case 332:
5022#line 1862 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5023    {
5024		  java_method_add_stmt (current_function_decl, yyvsp[0].node);
5025		  exit_block ();
5026		  yyval.node = yyvsp[-1].node;
5027		}
5028    break;
5029
5030  case 333:
5031#line 1871 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5032    {
5033		  /* We add a block to define a scope for
5034		     formal_parameter (CCBP). The formal parameter is
5035		     declared initialized by the appropriate function
5036		     call */
5037		  tree ccpb = enter_block ();
5038		  tree init = build_assignment
5039		    (ASSIGN_TK, yyvsp[-2].operator.location, TREE_PURPOSE (yyvsp[-1].node),
5040		     build (JAVA_EXC_OBJ_EXPR, ptr_type_node));
5041		  declare_local_variables (0, TREE_VALUE (yyvsp[-1].node),
5042					   build_tree_list (TREE_PURPOSE (yyvsp[-1].node),
5043							    init));
5044		  yyval.node = build1 (CATCH_EXPR, NULL_TREE, ccpb);
5045		  EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
5046		}
5047    break;
5048
5049  case 334:
5050#line 1887 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5051    {yyerror ("'(' expected"); RECOVER; yyval.node = NULL_TREE;}
5052    break;
5053
5054  case 335:
5055#line 1889 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5056    {
5057		  yyerror ("Missing term or ')' expected");
5058		  RECOVER; yyval.node = NULL_TREE;
5059		}
5060    break;
5061
5062  case 336:
5063#line 1894 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5064    {yyerror ("Missing term"); RECOVER; yyval.node = NULL_TREE;}
5065    break;
5066
5067  case 337:
5068#line 1899 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5069    { yyval.node = yyvsp[0].node; }
5070    break;
5071
5072  case 338:
5073#line 1901 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5074    {yyerror ("'{' expected"); RECOVER; }
5075    break;
5076
5077  case 342:
5078#line 1913 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5079    { yyval.node = build_this (yyvsp[0].operator.location); }
5080    break;
5081
5082  case 343:
5083#line 1915 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5084    {yyval.node = yyvsp[-1].node;}
5085    break;
5086
5087  case 349:
5088#line 1923 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5089    {
5090		  tree wfl = build_wfl_node (this_identifier_node);
5091		  yyval.node = make_qualified_primary (yyvsp[-2].node, wfl, EXPR_WFL_LINECOL (yyvsp[-2].node));
5092		}
5093    break;
5094
5095  case 350:
5096#line 1928 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5097    {yyerror ("')' expected"); RECOVER;}
5098    break;
5099
5100  case 351:
5101#line 1930 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5102    {yyerror ("'class' or 'this' expected" ); RECOVER;}
5103    break;
5104
5105  case 352:
5106#line 1932 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5107    {yyerror ("'class' expected" ); RECOVER;}
5108    break;
5109
5110  case 353:
5111#line 1934 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5112    {yyerror ("'class' expected" ); RECOVER;}
5113    break;
5114
5115  case 354:
5116#line 1939 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5117    { yyval.node = build_incomplete_class_ref (yyvsp[-1].operator.location, yyvsp[-2].node); }
5118    break;
5119
5120  case 355:
5121#line 1941 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5122    { yyval.node = build_incomplete_class_ref (yyvsp[-1].operator.location, yyvsp[-2].node); }
5123    break;
5124
5125  case 356:
5126#line 1943 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5127    { yyval.node = build_incomplete_class_ref (yyvsp[-1].operator.location, yyvsp[-2].node); }
5128    break;
5129
5130  case 357:
5131#line 1945 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5132    {
5133                   yyval.node = build_incomplete_class_ref (yyvsp[-1].operator.location,
5134                                                   void_type_node);
5135                }
5136    break;
5137
5138  case 358:
5139#line 1953 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5140    { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); }
5141    break;
5142
5143  case 359:
5144#line 1955 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5145    { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); }
5146    break;
5147
5148  case 361:
5149#line 1959 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5150    {
5151		  tree ctor = build_new_invocation (yyvsp[-2].node, NULL_TREE);
5152		  yyval.node = make_qualified_primary (yyvsp[-3].node, ctor,
5153					       EXPR_WFL_LINECOL (yyvsp[-3].node));
5154		}
5155    break;
5156
5157  case 363:
5158#line 1966 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5159    {
5160		  tree ctor = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node);
5161		  yyval.node = make_qualified_primary (yyvsp[-4].node, ctor,
5162					       EXPR_WFL_LINECOL (yyvsp[-4].node));
5163		}
5164    break;
5165
5166  case 365:
5167#line 1973 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5168    {yyerror ("'(' expected"); DRECOVER(new_1);}
5169    break;
5170
5171  case 366:
5172#line 1975 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5173    {yyerror ("'(' expected"); RECOVER;}
5174    break;
5175
5176  case 367:
5177#line 1977 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5178    {yyerror ("')' or term expected"); RECOVER;}
5179    break;
5180
5181  case 368:
5182#line 1979 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5183    {yyerror ("')' expected"); RECOVER;}
5184    break;
5185
5186  case 369:
5187#line 1981 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5188    {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;}
5189    break;
5190
5191  case 370:
5192#line 1983 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5193    {yyerror ("'(' expected"); RECOVER;}
5194    break;
5195
5196  case 371:
5197#line 1990 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5198    { create_anonymous_class (yyvsp[-4].operator.location, yyvsp[-3].node); }
5199    break;
5200
5201  case 372:
5202#line 1992 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5203    {
5204		  tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
5205		  EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL (yyvsp[-5].node);
5206
5207		  end_class_declaration (1);
5208
5209		  /* Now we can craft the new expression */
5210		  yyval.node = build_new_invocation (id, yyvsp[-3].node);
5211
5212		  /* Note that we can't possibly be here if
5213		     `class_type' is an interface (in which case the
5214		     anonymous class extends Object and implements
5215		     `class_type', hence its constructor can't have
5216		     arguments.) */
5217
5218		  /* Otherwise, the innerclass must feature a
5219		     constructor matching `argument_list'. Anonymous
5220		     classes are a bit special: it's impossible to
5221		     define constructor for them, hence constructors
5222		     must be generated following the hints provided by
5223		     the `new' expression. Whether a super constructor
5224		     of that nature exists or not is to be verified
5225		     later on in verify_constructor_super.
5226
5227		     It's during the expansion of a `new' statement
5228		     refering to an anonymous class that a ctor will
5229		     be generated for the anonymous class, with the
5230		     right arguments. */
5231
5232		}
5233    break;
5234
5235  case 373:
5236#line 2023 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5237    { create_anonymous_class (yyvsp[-3].operator.location, yyvsp[-2].node); }
5238    break;
5239
5240  case 374:
5241#line 2025 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5242    {
5243		  tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
5244		  EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL (yyvsp[-4].node);
5245
5246		  end_class_declaration (1);
5247
5248		  /* Now we can craft the new expression. The
5249                     statement doesn't need to be remember so that a
5250                     constructor can be generated, since its signature
5251                     is already known. */
5252		  yyval.node = build_new_invocation (id, NULL_TREE);
5253		}
5254    break;
5255
5256  case 375:
5257#line 2041 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5258    { yyval.node = yyvsp[-2].node; }
5259    break;
5260
5261  case 376:
5262#line 2043 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5263    { yyval.node = yyvsp[-2].node; }
5264    break;
5265
5266  case 377:
5267#line 2048 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5268    {
5269		  yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
5270		  ctxp->formal_parameter_number = 1;
5271		}
5272    break;
5273
5274  case 378:
5275#line 2053 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5276    {
5277		  ctxp->formal_parameter_number += 1;
5278		  yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
5279		}
5280    break;
5281
5282  case 379:
5283#line 2058 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5284    {yyerror ("Missing term"); RECOVER;}
5285    break;
5286
5287  case 380:
5288#line 2063 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5289    { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); }
5290    break;
5291
5292  case 381:
5293#line 2065 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5294    { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); }
5295    break;
5296
5297  case 382:
5298#line 2067 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5299    { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, pop_current_osb (ctxp));}
5300    break;
5301
5302  case 383:
5303#line 2069 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5304    { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, pop_current_osb (ctxp));}
5305    break;
5306
5307  case 384:
5308#line 2072 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5309    {
5310		  char *sig;
5311		  int osb = pop_current_osb (ctxp);
5312		  while (osb--)
5313		    obstack_grow (&temporary_obstack, "[]", 2);
5314		  obstack_1grow (&temporary_obstack, '\0');
5315		  sig = obstack_finish (&temporary_obstack);
5316		  yyval.node = build (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE,
5317			      yyvsp[-2].node, get_identifier (sig), yyvsp[0].node);
5318		}
5319    break;
5320
5321  case 385:
5322#line 2083 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5323    {
5324		  int osb = pop_current_osb (ctxp);
5325		  tree type = yyvsp[-2].node;
5326		  while (osb--)
5327		    type = build_java_array_type (type, -1);
5328		  yyval.node = build (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE,
5329			      build_pointer_type (type), NULL_TREE, yyvsp[0].node);
5330		}
5331    break;
5332
5333  case 386:
5334#line 2092 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5335    {yyerror ("'[' expected"); DRECOVER ("]");}
5336    break;
5337
5338  case 387:
5339#line 2094 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5340    {yyerror ("']' expected"); RECOVER;}
5341    break;
5342
5343  case 388:
5344#line 2099 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5345    { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); }
5346    break;
5347
5348  case 389:
5349#line 2101 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5350    { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); }
5351    break;
5352
5353  case 390:
5354#line 2106 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5355    {
5356		  if (JNUMERIC_TYPE_P (TREE_TYPE (yyvsp[-1].node)))
5357		    {
5358		      yyvsp[-1].node = build_wfl_node (yyvsp[-1].node);
5359		      TREE_TYPE (yyvsp[-1].node) = NULL_TREE;
5360		    }
5361		  EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
5362		  yyval.node = yyvsp[-1].node;
5363		}
5364    break;
5365
5366  case 391:
5367#line 2116 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5368    {yyerror ("']' expected"); RECOVER;}
5369    break;
5370
5371  case 392:
5372#line 2118 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5373    {
5374		  yyerror ("Missing term");
5375		  yyerror ("']' expected");
5376		  RECOVER;
5377		}
5378    break;
5379
5380  case 393:
5381#line 2127 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5382    {
5383		  int allocate = 0;
5384		  /* If not initialized, allocate memory for the osb
5385                     numbers stack */
5386		  if (!ctxp->osb_limit)
5387		    {
5388		      allocate = ctxp->osb_limit = 32;
5389		      ctxp->osb_depth = -1;
5390		    }
5391		  /* If capacity overflown, reallocate a bigger chunk */
5392		  else if (ctxp->osb_depth+1 == ctxp->osb_limit)
5393		    allocate = ctxp->osb_limit << 1;
5394
5395		  if (allocate)
5396		    {
5397		      allocate *= sizeof (int);
5398		      if (ctxp->osb_number)
5399			ctxp->osb_number = (int *)xrealloc (ctxp->osb_number,
5400							    allocate);
5401		      else
5402			ctxp->osb_number = (int *)xmalloc (allocate);
5403		    }
5404		  ctxp->osb_depth++;
5405		  CURRENT_OSB (ctxp) = 1;
5406		}
5407    break;
5408
5409  case 394:
5410#line 2153 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5411    { CURRENT_OSB (ctxp)++; }
5412    break;
5413
5414  case 395:
5415#line 2155 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5416    { yyerror ("']' expected"); RECOVER;}
5417    break;
5418
5419  case 396:
5420#line 2160 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5421    { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); }
5422    break;
5423
5424  case 397:
5425#line 2163 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5426    {
5427		  tree super_wfl = build_wfl_node (super_identifier_node);
5428		  EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location;
5429		  yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location);
5430		}
5431    break;
5432
5433  case 398:
5434#line 2169 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5435    {yyerror ("Field expected"); DRECOVER (super_field_acces);}
5436    break;
5437
5438  case 399:
5439#line 2174 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5440    { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); }
5441    break;
5442
5443  case 400:
5444#line 2176 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5445    { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); }
5446    break;
5447
5448  case 401:
5449#line 2178 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5450    {
5451		  if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR)
5452		    yyval.node = build_this_super_qualified_invocation
5453		      (1, yyvsp[-2].node, NULL_TREE, 0, yyvsp[-3].operator.location);
5454		  else
5455		    {
5456		      tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE);
5457		      yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location);
5458		    }
5459		}
5460    break;
5461
5462  case 402:
5463#line 2189 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5464    {
5465		  if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR)
5466		    yyval.node = build_this_super_qualified_invocation
5467		      (1, yyvsp[-3].node, yyvsp[-1].node, 0, yyvsp[-4].operator.location);
5468		  else
5469		    {
5470		      tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node);
5471		      yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location);
5472		    }
5473		}
5474    break;
5475
5476  case 403:
5477#line 2200 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5478    {
5479		  yyval.node = build_this_super_qualified_invocation
5480		    (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location);
5481		}
5482    break;
5483
5484  case 404:
5485#line 2205 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5486    {
5487		  yyval.node = build_this_super_qualified_invocation
5488		    (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location);
5489		}
5490    break;
5491
5492  case 405:
5493#line 2211 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5494    { yyerror ("'(' expected"); DRECOVER (method_invocation); }
5495    break;
5496
5497  case 406:
5498#line 2213 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5499    { yyerror ("'(' expected"); DRECOVER (method_invocation); }
5500    break;
5501
5502  case 407:
5503#line 2218 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5504    { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); }
5505    break;
5506
5507  case 408:
5508#line 2220 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5509    { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); }
5510    break;
5511
5512  case 409:
5513#line 2222 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5514    {
5515		  yyerror ("Missing term and ']' expected");
5516		  DRECOVER(array_access);
5517		}
5518    break;
5519
5520  case 410:
5521#line 2227 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5522    {
5523		  yyerror ("']' expected");
5524		  DRECOVER(array_access);
5525		}
5526    break;
5527
5528  case 411:
5529#line 2232 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5530    {
5531		  yyerror ("Missing term and ']' expected");
5532		  DRECOVER(array_access);
5533		}
5534    break;
5535
5536  case 412:
5537#line 2237 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5538    {
5539		  yyerror ("']' expected");
5540		  DRECOVER(array_access);
5541		}
5542    break;
5543
5544  case 417:
5545#line 2252 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5546    { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); }
5547    break;
5548
5549  case 418:
5550#line 2257 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5551    { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); }
5552    break;
5553
5554  case 421:
5555#line 2264 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5556    {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); }
5557    break;
5558
5559  case 423:
5560#line 2267 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5561    {yyerror ("Missing term"); RECOVER}
5562    break;
5563
5564  case 424:
5565#line 2272 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5566    {
5567		  error_if_numeric_overflow (yyvsp[0].node);
5568		  yyval.node = yyvsp[0].node;
5569		}
5570    break;
5571
5572  case 425:
5573#line 2277 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5574    {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); }
5575    break;
5576
5577  case 426:
5578#line 2279 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5579    {yyerror ("Missing term"); RECOVER}
5580    break;
5581
5582  case 427:
5583#line 2284 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5584    {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); }
5585    break;
5586
5587  case 428:
5588#line 2286 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5589    {yyerror ("Missing term"); RECOVER}
5590    break;
5591
5592  case 429:
5593#line 2291 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5594    {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); }
5595    break;
5596
5597  case 430:
5598#line 2293 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5599    {yyerror ("Missing term"); RECOVER}
5600    break;
5601
5602  case 432:
5603#line 2299 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5604    {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); }
5605    break;
5606
5607  case 433:
5608#line 2301 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5609    {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); }
5610    break;
5611
5612  case 435:
5613#line 2304 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5614    {yyerror ("Missing term"); RECOVER}
5615    break;
5616
5617  case 436:
5618#line 2306 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5619    {yyerror ("Missing term"); RECOVER}
5620    break;
5621
5622  case 437:
5623#line 2311 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5624    {
5625		  tree type = yyvsp[-3].node;
5626		  int osb = pop_current_osb (ctxp);
5627		  while (osb--)
5628		    type = build_java_array_type (type, -1);
5629		  yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node);
5630		}
5631    break;
5632
5633  case 438:
5634#line 2319 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5635    { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); }
5636    break;
5637
5638  case 439:
5639#line 2321 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5640    { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); }
5641    break;
5642
5643  case 440:
5644#line 2323 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5645    {
5646		  const char *ptr;
5647		  int osb = pop_current_osb (ctxp);
5648		  obstack_grow (&temporary_obstack,
5649				IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)),
5650				IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node)));
5651		  while (osb--)
5652		    obstack_grow (&temporary_obstack, "[]", 2);
5653		  obstack_1grow (&temporary_obstack, '\0');
5654		  ptr = obstack_finish (&temporary_obstack);
5655		  EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr);
5656		  yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node);
5657		}
5658    break;
5659
5660  case 441:
5661#line 2337 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5662    {yyerror ("']' expected, invalid type expression");}
5663    break;
5664
5665  case 442:
5666#line 2339 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5667    {
5668	          YYNOT_TWICE yyerror ("Invalid type expression"); RECOVER;
5669		  RECOVER;
5670		}
5671    break;
5672
5673  case 443:
5674#line 2344 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5675    {yyerror ("Missing term"); RECOVER;}
5676    break;
5677
5678  case 444:
5679#line 2346 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5680    {yyerror ("Missing term"); RECOVER;}
5681    break;
5682
5683  case 445:
5684#line 2348 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5685    {yyerror ("Missing term"); RECOVER;}
5686    break;
5687
5688  case 447:
5689#line 2354 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5690    {
5691		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token),
5692				    yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
5693		}
5694    break;
5695
5696  case 448:
5697#line 2359 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5698    {
5699		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5700				    yyvsp[-2].node, yyvsp[0].node);
5701		}
5702    break;
5703
5704  case 449:
5705#line 2364 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5706    {
5707		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5708				    yyvsp[-2].node, yyvsp[0].node);
5709		}
5710    break;
5711
5712  case 450:
5713#line 2369 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5714    {yyerror ("Missing term"); RECOVER;}
5715    break;
5716
5717  case 451:
5718#line 2371 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5719    {yyerror ("Missing term"); RECOVER;}
5720    break;
5721
5722  case 452:
5723#line 2373 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5724    {yyerror ("Missing term"); RECOVER;}
5725    break;
5726
5727  case 454:
5728#line 2379 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5729    {
5730		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5731				    yyvsp[-2].node, yyvsp[0].node);
5732		}
5733    break;
5734
5735  case 455:
5736#line 2384 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5737    {
5738		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5739				    yyvsp[-2].node, yyvsp[0].node);
5740		}
5741    break;
5742
5743  case 456:
5744#line 2389 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5745    {yyerror ("Missing term"); RECOVER;}
5746    break;
5747
5748  case 457:
5749#line 2391 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5750    {yyerror ("Missing term"); RECOVER;}
5751    break;
5752
5753  case 459:
5754#line 2397 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5755    {
5756		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5757				    yyvsp[-2].node, yyvsp[0].node);
5758		}
5759    break;
5760
5761  case 460:
5762#line 2402 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5763    {
5764		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5765				    yyvsp[-2].node, yyvsp[0].node);
5766		}
5767    break;
5768
5769  case 461:
5770#line 2407 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5771    {
5772		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5773				    yyvsp[-2].node, yyvsp[0].node);
5774		}
5775    break;
5776
5777  case 462:
5778#line 2412 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5779    {yyerror ("Missing term"); RECOVER;}
5780    break;
5781
5782  case 463:
5783#line 2414 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5784    {yyerror ("Missing term"); RECOVER;}
5785    break;
5786
5787  case 464:
5788#line 2416 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5789    {yyerror ("Missing term"); RECOVER;}
5790    break;
5791
5792  case 466:
5793#line 2422 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5794    {
5795		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5796				    yyvsp[-2].node, yyvsp[0].node);
5797		}
5798    break;
5799
5800  case 467:
5801#line 2427 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5802    {
5803		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5804				    yyvsp[-2].node, yyvsp[0].node);
5805		}
5806    break;
5807
5808  case 468:
5809#line 2432 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5810    {
5811		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5812				    yyvsp[-2].node, yyvsp[0].node);
5813		}
5814    break;
5815
5816  case 469:
5817#line 2437 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5818    {
5819		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5820				    yyvsp[-2].node, yyvsp[0].node);
5821		}
5822    break;
5823
5824  case 470:
5825#line 2442 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5826    { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); }
5827    break;
5828
5829  case 471:
5830#line 2444 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5831    {yyerror ("Missing term"); RECOVER;}
5832    break;
5833
5834  case 472:
5835#line 2446 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5836    {yyerror ("Missing term"); RECOVER;}
5837    break;
5838
5839  case 473:
5840#line 2448 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5841    {yyerror ("Missing term"); RECOVER;}
5842    break;
5843
5844  case 474:
5845#line 2450 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5846    {yyerror ("Missing term"); RECOVER;}
5847    break;
5848
5849  case 475:
5850#line 2452 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5851    {yyerror ("Invalid reference type"); RECOVER;}
5852    break;
5853
5854  case 477:
5855#line 2458 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5856    {
5857		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5858				    yyvsp[-2].node, yyvsp[0].node);
5859		}
5860    break;
5861
5862  case 478:
5863#line 2463 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5864    {
5865		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5866				    yyvsp[-2].node, yyvsp[0].node);
5867		}
5868    break;
5869
5870  case 479:
5871#line 2468 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5872    {yyerror ("Missing term"); RECOVER;}
5873    break;
5874
5875  case 480:
5876#line 2470 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5877    {yyerror ("Missing term"); RECOVER;}
5878    break;
5879
5880  case 482:
5881#line 2476 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5882    {
5883		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5884				    yyvsp[-2].node, yyvsp[0].node);
5885		}
5886    break;
5887
5888  case 483:
5889#line 2481 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5890    {yyerror ("Missing term"); RECOVER;}
5891    break;
5892
5893  case 485:
5894#line 2487 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5895    {
5896		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5897				    yyvsp[-2].node, yyvsp[0].node);
5898		}
5899    break;
5900
5901  case 486:
5902#line 2492 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5903    {yyerror ("Missing term"); RECOVER;}
5904    break;
5905
5906  case 488:
5907#line 2498 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5908    {
5909		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5910				    yyvsp[-2].node, yyvsp[0].node);
5911		}
5912    break;
5913
5914  case 489:
5915#line 2503 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5916    {yyerror ("Missing term"); RECOVER;}
5917    break;
5918
5919  case 491:
5920#line 2509 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5921    {
5922		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5923				    yyvsp[-2].node, yyvsp[0].node);
5924		}
5925    break;
5926
5927  case 492:
5928#line 2514 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5929    {yyerror ("Missing term"); RECOVER;}
5930    break;
5931
5932  case 494:
5933#line 2520 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5934    {
5935		  yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
5936				    yyvsp[-2].node, yyvsp[0].node);
5937		}
5938    break;
5939
5940  case 495:
5941#line 2525 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5942    {yyerror ("Missing term"); RECOVER;}
5943    break;
5944
5945  case 497:
5946#line 2531 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5947    {
5948		  yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
5949		  EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
5950		}
5951    break;
5952
5953  case 498:
5954#line 2536 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5955    {
5956		  YYERROR_NOW;
5957		  yyerror ("Missing term");
5958		  DRECOVER (1);
5959		}
5960    break;
5961
5962  case 499:
5963#line 2542 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5964    {yyerror ("Missing term"); DRECOVER (2);}
5965    break;
5966
5967  case 500:
5968#line 2544 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5969    {yyerror ("Missing term"); DRECOVER (3);}
5970    break;
5971
5972  case 503:
5973#line 2554 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5974    { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); }
5975    break;
5976
5977  case 504:
5978#line 2556 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
5979    {
5980		  YYNOT_TWICE yyerror ("Missing term");
5981		  DRECOVER (assign);
5982		}
5983    break;
5984
5985
5986    }
5987
5988/* Line 1016 of /usr/share/bison/yacc.c.  */
5989#line 5990 "p13913.c"
5990
5991  yyvsp -= yylen;
5992  yyssp -= yylen;
5993
5994
5995#if YYDEBUG
5996  if (yydebug)
5997    {
5998      short *yyssp1 = yyss - 1;
5999      YYFPRINTF (stderr, "state stack now");
6000      while (yyssp1 != yyssp)
6001	YYFPRINTF (stderr, " %d", *++yyssp1);
6002      YYFPRINTF (stderr, "\n");
6003    }
6004#endif
6005
6006  *++yyvsp = yyval;
6007
6008
6009  /* Now `shift' the result of the reduction.  Determine what state
6010     that goes to, based on the state we popped back to and the rule
6011     number reduced by.  */
6012
6013  yyn = yyr1[yyn];
6014
6015  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6016  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6017    yystate = yytable[yystate];
6018  else
6019    yystate = yydefgoto[yyn - YYNTOKENS];
6020
6021  goto yynewstate;
6022
6023
6024/*------------------------------------.
6025| yyerrlab -- here on detecting error |
6026`------------------------------------*/
6027yyerrlab:
6028  /* If not already recovering from an error, report this error.  */
6029  if (!yyerrstatus)
6030    {
6031      ++yynerrs;
6032#if YYERROR_VERBOSE
6033      yyn = yypact[yystate];
6034
6035      if (YYPACT_NINF < yyn && yyn < YYLAST)
6036	{
6037	  YYSIZE_T yysize = 0;
6038	  int yytype = YYTRANSLATE (yychar);
6039	  char *yymsg;
6040	  int yyx, yycount;
6041
6042	  yycount = 0;
6043	  /* Start YYX at -YYN if negative to avoid negative indexes in
6044	     YYCHECK.  */
6045	  for (yyx = yyn < 0 ? -yyn : 0;
6046	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
6047	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
6048	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
6049	  yysize += yystrlen ("parse error, unexpected ") + 1;
6050	  yysize += yystrlen (yytname[yytype]);
6051	  yymsg = (char *) YYSTACK_ALLOC (yysize);
6052	  if (yymsg != 0)
6053	    {
6054	      char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
6055	      yyp = yystpcpy (yyp, yytname[yytype]);
6056
6057	      if (yycount < 5)
6058		{
6059		  yycount = 0;
6060		  for (yyx = yyn < 0 ? -yyn : 0;
6061		       yyx < (int) (sizeof (yytname) / sizeof (char *));
6062		       yyx++)
6063		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
6064		      {
6065			const char *yyq = ! yycount ? ", expecting " : " or ";
6066			yyp = yystpcpy (yyp, yyq);
6067			yyp = yystpcpy (yyp, yytname[yyx]);
6068			yycount++;
6069		      }
6070		}
6071	      yyerror (yymsg);
6072	      YYSTACK_FREE (yymsg);
6073	    }
6074	  else
6075	    yyerror ("parse error; also virtual memory exhausted");
6076	}
6077      else
6078#endif /* YYERROR_VERBOSE */
6079	yyerror ("parse error");
6080    }
6081  goto yyerrlab1;
6082
6083
6084/*----------------------------------------------------.
6085| yyerrlab1 -- error raised explicitly by an action.  |
6086`----------------------------------------------------*/
6087yyerrlab1:
6088  if (yyerrstatus == 3)
6089    {
6090      /* If just tried and failed to reuse lookahead token after an
6091	 error, discard it.  */
6092
6093      /* Return failure if at end of input.  */
6094      if (yychar == YYEOF)
6095        {
6096	  /* Pop the error token.  */
6097          YYPOPSTACK;
6098	  /* Pop the rest of the stack.  */
6099	  while (yyssp > yyss)
6100	    {
6101	      YYDPRINTF ((stderr, "Error: popping "));
6102	      YYDSYMPRINT ((stderr,
6103			    yystos[*yyssp],
6104			    *yyvsp));
6105	      YYDPRINTF ((stderr, "\n"));
6106	      yydestruct (yystos[*yyssp], *yyvsp);
6107	      YYPOPSTACK;
6108	    }
6109	  YYABORT;
6110        }
6111
6112      YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
6113		  yychar, yytname[yychar1]));
6114      yydestruct (yychar1, yylval);
6115      yychar = YYEMPTY;
6116    }
6117
6118  /* Else will try to reuse lookahead token after shifting the error
6119     token.  */
6120
6121  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
6122
6123  for (;;)
6124    {
6125      yyn = yypact[yystate];
6126      if (yyn != YYPACT_NINF)
6127	{
6128	  yyn += YYTERROR;
6129	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6130	    {
6131	      yyn = yytable[yyn];
6132	      if (0 < yyn)
6133		break;
6134	    }
6135	}
6136
6137      /* Pop the current state because it cannot handle the error token.  */
6138      if (yyssp == yyss)
6139	YYABORT;
6140
6141      YYDPRINTF ((stderr, "Error: popping "));
6142      YYDSYMPRINT ((stderr,
6143		    yystos[*yyssp], *yyvsp));
6144      YYDPRINTF ((stderr, "\n"));
6145
6146      yydestruct (yystos[yystate], *yyvsp);
6147      yyvsp--;
6148      yystate = *--yyssp;
6149
6150
6151#if YYDEBUG
6152      if (yydebug)
6153	{
6154	  short *yyssp1 = yyss - 1;
6155	  YYFPRINTF (stderr, "Error: state stack now");
6156	  while (yyssp1 != yyssp)
6157	    YYFPRINTF (stderr, " %d", *++yyssp1);
6158	  YYFPRINTF (stderr, "\n");
6159	}
6160#endif
6161    }
6162
6163  if (yyn == YYFINAL)
6164    YYACCEPT;
6165
6166  YYDPRINTF ((stderr, "Shifting error token, "));
6167
6168  *++yyvsp = yylval;
6169
6170
6171  yystate = yyn;
6172  goto yynewstate;
6173
6174
6175/*-------------------------------------.
6176| yyacceptlab -- YYACCEPT comes here.  |
6177`-------------------------------------*/
6178yyacceptlab:
6179  yyresult = 0;
6180  goto yyreturn;
6181
6182/*-----------------------------------.
6183| yyabortlab -- YYABORT comes here.  |
6184`-----------------------------------*/
6185yyabortlab:
6186  yyresult = 1;
6187  goto yyreturn;
6188
6189#ifndef yyoverflow
6190/*----------------------------------------------.
6191| yyoverflowlab -- parser overflow comes here.  |
6192`----------------------------------------------*/
6193yyoverflowlab:
6194  yyerror ("parser stack overflow");
6195  yyresult = 2;
6196  /* Fall through.  */
6197#endif
6198
6199yyreturn:
6200#ifndef yyoverflow
6201  if (yyss != yyssa)
6202    YYSTACK_FREE (yyss);
6203#endif
6204  return yyresult;
6205}
6206
6207
6208#line 2581 "/home/gdr/gcc-3.3.5/gcc-3.3.5/gcc/java/parse.y"
6209
6210
6211/* Helper function to retrieve an OSB count. Should be used when the
6212   `dims:' rule is being used.  */
6213
6214static int
6215pop_current_osb (ctxp)
6216     struct parser_ctxt *ctxp;
6217{
6218  int to_return;
6219
6220  if (ctxp->osb_depth < 0)
6221    abort ();
6222
6223  to_return = CURRENT_OSB (ctxp);
6224  ctxp->osb_depth--;
6225
6226  return to_return;
6227}
6228
6229
6230
6231/* This section of the code deal with save/restoring parser contexts.
6232   Add mode documentation here. FIXME */
6233
6234/* Helper function. Create a new parser context. With
6235   COPY_FROM_PREVIOUS set to a nonzero value, content of the previous
6236   context is copied, otherwise, the new context is zeroed. The newly
6237   created context becomes the current one.  */
6238
6239static void
6240create_new_parser_context (copy_from_previous)
6241    int copy_from_previous;
6242{
6243  struct parser_ctxt *new;
6244
6245  new =  (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
6246  if (copy_from_previous)
6247    {
6248      memcpy ((PTR)new, (PTR)ctxp, sizeof (struct parser_ctxt));
6249      new->saved_data_ctx = 1;
6250    }
6251  else
6252    memset ((PTR) new, 0, sizeof (struct parser_ctxt));
6253
6254  new->next = ctxp;
6255  ctxp = new;
6256}
6257
6258/* Create a new parser context and make it the current one. */
6259
6260void
6261java_push_parser_context ()
6262{
6263  create_new_parser_context (0);
6264}
6265
6266void
6267java_pop_parser_context (generate)
6268     int generate;
6269{
6270  tree current;
6271  struct parser_ctxt *toFree, *next;
6272
6273  if (!ctxp)
6274    return;
6275
6276  toFree = ctxp;
6277  next = ctxp->next;
6278  if (next)
6279    {
6280      lineno = ctxp->lineno;
6281      current_class = ctxp->class_type;
6282    }
6283
6284  /* If the old and new lexers differ, then free the old one.  */
6285  if (ctxp->lexer && next && ctxp->lexer != next->lexer)
6286    java_destroy_lexer (ctxp->lexer);
6287
6288  /* Set the single import class file flag to 0 for the current list
6289     of imported things */
6290  for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
6291    IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_VALUE (current)) = 0;
6292
6293  /* And restore those of the previous context */
6294  if ((ctxp = next))		/* Assignment is really meant here */
6295    for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
6296      IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_VALUE (current)) = 1;
6297
6298  /* If we pushed a context to parse a class intended to be generated,
6299     we keep it so we can remember the class. What we could actually
6300     do is to just update a list of class names.  */
6301  if (generate)
6302    {
6303      toFree->next = ctxp_for_generation;
6304      ctxp_for_generation = toFree;
6305    }
6306  else
6307    free (toFree);
6308}
6309
6310/* Create a parser context for the use of saving some global
6311   variables.  */
6312
6313void
6314java_parser_context_save_global ()
6315{
6316  if (!ctxp)
6317    {
6318      java_push_parser_context ();
6319      ctxp->saved_data_ctx = 1;
6320    }
6321
6322  /* If this context already stores data, create a new one suitable
6323     for data storage. */
6324  else if (ctxp->saved_data)
6325    create_new_parser_context (1);
6326
6327  ctxp->lineno = lineno;
6328  ctxp->class_type = current_class;
6329  ctxp->filename = input_filename;
6330  ctxp->function_decl = current_function_decl;
6331  ctxp->saved_data = 1;
6332}
6333
6334/* Restore some global variables from the previous context. Make the
6335   previous context the current one.  */
6336
6337void
6338java_parser_context_restore_global ()
6339{
6340  lineno = ctxp->lineno;
6341  current_class = ctxp->class_type;
6342  input_filename = ctxp->filename;
6343  if (wfl_operator)
6344    {
6345      tree s;
6346      BUILD_FILENAME_IDENTIFIER_NODE (s, input_filename);
6347      EXPR_WFL_FILENAME_NODE (wfl_operator) = s;
6348    }
6349  current_function_decl = ctxp->function_decl;
6350  ctxp->saved_data = 0;
6351  if (ctxp->saved_data_ctx)
6352    java_pop_parser_context (0);
6353}
6354
6355/* Suspend vital data for the current class/function being parsed so
6356   that an other class can be parsed. Used to let local/anonymous
6357   classes be parsed.  */
6358
6359static void
6360java_parser_context_suspend ()
6361{
6362  /* This makes debugging through java_debug_context easier */
6363  static const char *const name = "<inner buffer context>";
6364
6365  /* Duplicate the previous context, use it to save the globals we're
6366     interested in */
6367  create_new_parser_context (1);
6368  ctxp->function_decl = current_function_decl;
6369  ctxp->class_type = current_class;
6370
6371  /* Then create a new context which inherits all data from the
6372     previous one. This will be the new current context  */
6373  create_new_parser_context (1);
6374
6375  /* Help debugging */
6376  ctxp->next->filename = name;
6377}
6378
6379/* Resume vital data for the current class/function being parsed so
6380   that an other class can be parsed. Used to let local/anonymous
6381   classes be parsed.  The trick is the data storing file position
6382   informations must be restored to their current value, so parsing
6383   can resume as if no context was ever saved. */
6384
6385static void
6386java_parser_context_resume ()
6387{
6388  struct parser_ctxt *old = ctxp;             /* This one is to be discarded */
6389  struct parser_ctxt *saver = old->next;      /* This one contain saved info */
6390  struct parser_ctxt *restored = saver->next; /* This one is the old current */
6391
6392  /* We need to inherit the list of classes to complete/generate */
6393  restored->classd_list = old->classd_list;
6394  restored->class_list = old->class_list;
6395
6396  /* Restore the current class and function from the saver */
6397  current_class = saver->class_type;
6398  current_function_decl = saver->function_decl;
6399
6400  /* Retrive the restored context */
6401  ctxp = restored;
6402
6403  /* Re-installed the data for the parsing to carry on */
6404  memcpy (&ctxp->marker_begining, &old->marker_begining,
6405	  (size_t)(&ctxp->marker_end - &ctxp->marker_begining));
6406
6407  /* Buffer context can now be discarded */
6408  free (saver);
6409  free (old);
6410}
6411
6412/* Add a new anchor node to which all statement(s) initializing static
6413   and non static initialized upon declaration field(s) will be
6414   linked.  */
6415
6416static void
6417java_parser_context_push_initialized_field ()
6418{
6419  tree node;
6420
6421  node = build_tree_list (NULL_TREE, NULL_TREE);
6422  TREE_CHAIN (node) = CPC_STATIC_INITIALIZER_LIST (ctxp);
6423  CPC_STATIC_INITIALIZER_LIST (ctxp) = node;
6424
6425  node = build_tree_list (NULL_TREE, NULL_TREE);
6426  TREE_CHAIN (node) = CPC_INITIALIZER_LIST (ctxp);
6427  CPC_INITIALIZER_LIST (ctxp) = node;
6428
6429  node = build_tree_list (NULL_TREE, NULL_TREE);
6430  TREE_CHAIN (node) = CPC_INSTANCE_INITIALIZER_LIST (ctxp);
6431  CPC_INSTANCE_INITIALIZER_LIST (ctxp) = node;
6432}
6433
6434/* Pop the lists of initialized field. If this lists aren't empty,
6435   remember them so we can use it to create and populate the finit$
6436   or <clinit> functions. */
6437
6438static void
6439java_parser_context_pop_initialized_field ()
6440{
6441  tree stmts;
6442  tree class_type = TREE_TYPE (GET_CPC ());
6443
6444  if (CPC_INITIALIZER_LIST (ctxp))
6445    {
6446      stmts = CPC_INITIALIZER_STMT (ctxp);
6447      CPC_INITIALIZER_LIST (ctxp) = TREE_CHAIN (CPC_INITIALIZER_LIST (ctxp));
6448      if (stmts && !java_error_count)
6449	TYPE_FINIT_STMT_LIST (class_type) = reorder_static_initialized (stmts);
6450    }
6451
6452  if (CPC_STATIC_INITIALIZER_LIST (ctxp))
6453    {
6454      stmts = CPC_STATIC_INITIALIZER_STMT (ctxp);
6455      CPC_STATIC_INITIALIZER_LIST (ctxp) =
6456	TREE_CHAIN (CPC_STATIC_INITIALIZER_LIST (ctxp));
6457      /* Keep initialization in order to enforce 8.5 */
6458      if (stmts && !java_error_count)
6459	TYPE_CLINIT_STMT_LIST (class_type) = nreverse (stmts);
6460    }
6461
6462  /* JDK 1.1 instance initializers */
6463  if (CPC_INSTANCE_INITIALIZER_LIST (ctxp))
6464    {
6465      stmts = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
6466      CPC_INSTANCE_INITIALIZER_LIST (ctxp) =
6467	TREE_CHAIN (CPC_INSTANCE_INITIALIZER_LIST (ctxp));
6468      if (stmts && !java_error_count)
6469	TYPE_II_STMT_LIST (class_type) = nreverse (stmts);
6470    }
6471}
6472
6473static tree
6474reorder_static_initialized (list)
6475     tree list;
6476{
6477  /* We have to keep things in order. The alias initializer have to
6478     come first, then the initialized regular field, in reverse to
6479     keep them in lexical order. */
6480  tree marker, previous = NULL_TREE;
6481  for (marker = list; marker; previous = marker, marker = TREE_CHAIN (marker))
6482    if (TREE_CODE (marker) == TREE_LIST
6483	&& !TREE_VALUE (marker) && !TREE_PURPOSE (marker))
6484      break;
6485
6486  /* No static initialized, the list is fine as is */
6487  if (!previous)
6488    list = TREE_CHAIN (marker);
6489
6490  /* No marker? reverse the whole list */
6491  else if (!marker)
6492    list = nreverse (list);
6493
6494  /* Otherwise, reverse what's after the marker and the new reordered
6495     sublist will replace the marker. */
6496  else
6497    {
6498      TREE_CHAIN (previous) = NULL_TREE;
6499      list = nreverse (list);
6500      list = chainon (TREE_CHAIN (marker), list);
6501    }
6502  return list;
6503}
6504
6505/* Helper functions to dump the parser context stack.  */
6506
6507#define TAB_CONTEXT(C) \
6508  {int i; for (i = 0; i < (C); i++) fputc (' ', stderr);}
6509
6510static void
6511java_debug_context_do (tab)
6512     int tab;
6513{
6514  struct parser_ctxt *copy = ctxp;
6515  while (copy)
6516    {
6517      TAB_CONTEXT (tab);
6518      fprintf (stderr, "ctxt: 0x%0lX\n", (unsigned long)copy);
6519      TAB_CONTEXT (tab);
6520      fprintf (stderr, "filename: %s\n", copy->filename);
6521      TAB_CONTEXT (tab);
6522      fprintf (stderr, "lineno: %d\n", copy->lineno);
6523      TAB_CONTEXT (tab);
6524      fprintf (stderr, "package: %s\n",
6525	       (copy->package ?
6526		IDENTIFIER_POINTER (copy->package) : "<none>"));
6527      TAB_CONTEXT (tab);
6528      fprintf (stderr, "context for saving: %d\n", copy->saved_data_ctx);
6529      TAB_CONTEXT (tab);
6530      fprintf (stderr, "saved data: %d\n", copy->saved_data);
6531      copy = copy->next;
6532      tab += 2;
6533    }
6534}
6535
6536/* Dump the stacked up parser contexts. Intended to be called from a
6537   debugger.  */
6538
6539void
6540java_debug_context ()
6541{
6542  java_debug_context_do (0);
6543}
6544
6545
6546
6547/* Flag for the error report routine to issue the error the first time
6548   it's called (overriding the default behavior which is to drop the
6549   first invocation and honor the second one, taking advantage of a
6550   richer context.  */
6551static int force_error = 0;
6552
6553/* Reporting an constructor invocation error.  */
6554static void
6555parse_ctor_invocation_error ()
6556{
6557  if (DECL_CONSTRUCTOR_P (current_function_decl))
6558    yyerror ("Constructor invocation must be first thing in a constructor");
6559  else
6560    yyerror ("Only constructors can invoke constructors");
6561}
6562
6563/* Reporting JDK1.1 features not implemented.  */
6564
6565static tree
6566parse_jdk1_1_error (msg)
6567    const char *msg;
6568{
6569  sorry (": `%s' JDK1.1(TM) feature", msg);
6570  java_error_count++;
6571  return empty_stmt_node;
6572}
6573
6574static int do_warning = 0;
6575
6576void
6577yyerror (msg)
6578     const char *msg;
6579{
6580  static java_lc elc;
6581  static int  prev_lineno;
6582  static const char *prev_msg;
6583
6584  int save_lineno;
6585  char *remainder, *code_from_source;
6586
6587  if (!force_error && prev_lineno == lineno)
6588    return;
6589
6590  /* Save current error location but report latter, when the context is
6591     richer.  */
6592  if (ctxp->java_error_flag == 0)
6593    {
6594      ctxp->java_error_flag = 1;
6595      elc = ctxp->elc;
6596      /* Do something to use the previous line if we're reaching the
6597	 end of the file... */
6598#ifdef VERBOSE_SKELETON
6599      printf ("* Error detected (%s)\n", (msg ? msg : "(null)"));
6600#endif
6601      return;
6602    }
6603
6604  /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
6605  if (!force_error && msg == prev_msg && prev_lineno == elc.line)
6606    return;
6607
6608  ctxp->java_error_flag = 0;
6609  if (do_warning)
6610    java_warning_count++;
6611  else
6612    java_error_count++;
6613
6614  if (elc.col == 0 && msg && msg[1] == ';')
6615    {
6616      elc.col  = ctxp->p_line->char_col-1;
6617      elc.line = ctxp->p_line->lineno;
6618    }
6619
6620  save_lineno = lineno;
6621  prev_lineno = lineno = elc.line;
6622  prev_msg = msg;
6623
6624  code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col);
6625  obstack_grow0 (&temporary_obstack,
6626		 code_from_source, strlen (code_from_source));
6627  remainder = obstack_finish (&temporary_obstack);
6628  if (do_warning)
6629    warning ("%s.\n%s", msg, remainder);
6630  else
6631    error ("%s.\n%s", msg, remainder);
6632
6633  /* This allow us to cheaply avoid an extra 'Invalid expression
6634     statement' error report when errors have been already reported on
6635     the same line. This occurs when we report an error but don't have
6636     a synchronization point other than ';', which
6637     expression_statement is the only one to take care of.  */
6638  ctxp->prevent_ese = lineno = save_lineno;
6639}
6640
6641static void
6642issue_warning_error_from_context (cl, msg, ap)
6643     tree cl;
6644     const char *msg;
6645     va_list ap;
6646{
6647  const char *saved, *saved_input_filename;
6648  char buffer [4096];
6649  vsprintf (buffer, msg, ap);
6650  force_error = 1;
6651
6652  ctxp->elc.line = EXPR_WFL_LINENO (cl);
6653  ctxp->elc.col  = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 :
6654		    (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl)));
6655
6656  /* We have a CL, that's a good reason for using it if it contains data */
6657  saved = ctxp->filename;
6658  if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl))
6659    ctxp->filename = EXPR_WFL_FILENAME (cl);
6660  saved_input_filename = input_filename;
6661  input_filename = ctxp->filename;
6662  java_error (NULL);
6663  java_error (buffer);
6664  ctxp->filename = saved;
6665  input_filename = saved_input_filename;
6666  force_error = 0;
6667}
6668
6669/* Issue an error message at a current source line CL */
6670
6671void
6672parse_error_context VPARAMS ((tree cl, const char *msg, ...))
6673{
6674  VA_OPEN (ap, msg);
6675  VA_FIXEDARG (ap, tree, cl);
6676  VA_FIXEDARG (ap, const char *, msg);
6677  issue_warning_error_from_context (cl, msg, ap);
6678  VA_CLOSE (ap);
6679}
6680
6681/* Issue a warning at a current source line CL */
6682
6683static void
6684parse_warning_context VPARAMS ((tree cl, const char *msg, ...))
6685{
6686  VA_OPEN (ap, msg);
6687  VA_FIXEDARG (ap, tree, cl);
6688  VA_FIXEDARG (ap, const char *, msg);
6689
6690  force_error = do_warning = 1;
6691  issue_warning_error_from_context (cl, msg, ap);
6692  do_warning = force_error = 0;
6693  VA_CLOSE (ap);
6694}
6695
6696static tree
6697find_expr_with_wfl (node)
6698     tree node;
6699{
6700  while (node)
6701    {
6702      char code;
6703      tree to_return;
6704
6705      switch (TREE_CODE (node))
6706	{
6707	case BLOCK:
6708	  node = BLOCK_EXPR_BODY (node);
6709	  continue;
6710
6711	case COMPOUND_EXPR:
6712	  to_return = find_expr_with_wfl (TREE_OPERAND (node, 0));
6713	  if (to_return)
6714	    return to_return;
6715	  node = TREE_OPERAND (node, 1);
6716	  continue;
6717
6718	case LOOP_EXPR:
6719	  node = TREE_OPERAND (node, 0);
6720	  continue;
6721
6722	case LABELED_BLOCK_EXPR:
6723	  node = TREE_OPERAND (node, 1);
6724	  continue;
6725
6726	default:
6727	  code = TREE_CODE_CLASS (TREE_CODE (node));
6728	  if (((code == '1') || (code == '2') || (code == 'e'))
6729	      && EXPR_WFL_LINECOL (node))
6730	    return node;
6731	  return NULL_TREE;
6732	}
6733    }
6734  return NULL_TREE;
6735}
6736
6737/* Issue a missing return statement error. Uses METHOD to figure the
6738   last line of the method the error occurs in.  */
6739
6740static void
6741missing_return_error (method)
6742     tree method;
6743{
6744  EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2);
6745  parse_error_context (wfl_operator, "Missing return statement");
6746}
6747
6748/* Issue an unreachable statement error. From NODE, find the next
6749   statement to report appropriately.  */
6750static void
6751unreachable_stmt_error (node)
6752     tree node;
6753{
6754  /* Browse node to find the next expression node that has a WFL. Use
6755     the location to report the error */
6756  if (TREE_CODE (node) == COMPOUND_EXPR)
6757    node = find_expr_with_wfl (TREE_OPERAND (node, 1));
6758  else
6759    node = find_expr_with_wfl (node);
6760
6761  if (node)
6762    {
6763      EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2);
6764      parse_error_context (wfl_operator, "Unreachable statement");
6765    }
6766  else
6767    abort ();
6768}
6769
6770int
6771java_report_errors ()
6772{
6773  if (java_error_count)
6774    fprintf (stderr, "%d error%s",
6775	     java_error_count, (java_error_count == 1 ? "" : "s"));
6776  if (java_warning_count)
6777    fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""),
6778	     java_warning_count, (java_warning_count == 1 ? "" : "s"));
6779  if (java_error_count || java_warning_count)
6780    putc ('\n', stderr);
6781  return java_error_count;
6782}
6783
6784static char *
6785java_accstring_lookup (flags)
6786     int flags;
6787{
6788  static char buffer [80];
6789#define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
6790
6791  /* Access modifier looked-up first for easier report on forbidden
6792     access. */
6793  if (flags & ACC_PUBLIC) COPY_RETURN ("public");
6794  if (flags & ACC_PRIVATE) COPY_RETURN ("private");
6795  if (flags & ACC_PROTECTED) COPY_RETURN ("protected");
6796  if (flags & ACC_STATIC) COPY_RETURN ("static");
6797  if (flags & ACC_FINAL) COPY_RETURN ("final");
6798  if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized");
6799  if (flags & ACC_VOLATILE) COPY_RETURN ("volatile");
6800  if (flags & ACC_TRANSIENT) COPY_RETURN ("transient");
6801  if (flags & ACC_NATIVE) COPY_RETURN ("native");
6802  if (flags & ACC_INTERFACE) COPY_RETURN ("interface");
6803  if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract");
6804
6805  buffer [0] = '\0';
6806  return buffer;
6807#undef COPY_RETURN
6808}
6809
6810/* Issuing error messages upon redefinition of classes, interfaces or
6811   variables. */
6812
6813static void
6814classitf_redefinition_error (context, id, decl, cl)
6815     const char *context;
6816     tree id, decl, cl;
6817{
6818  parse_error_context (cl, "%s `%s' already defined in %s:%d",
6819		       context, IDENTIFIER_POINTER (id),
6820		       DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
6821  /* Here we should point out where its redefined. It's a unicode. FIXME */
6822}
6823
6824static void
6825variable_redefinition_error (context, name, type, line)
6826     tree context, name, type;
6827     int line;
6828{
6829  const char *type_name;
6830
6831  /* Figure a proper name for type. We might haven't resolved it */
6832  if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type))
6833    type_name = IDENTIFIER_POINTER (TYPE_NAME (type));
6834  else
6835    type_name = lang_printable_name (type, 0);
6836
6837  parse_error_context (context,
6838		       "Variable `%s' is already defined in this method and was declared `%s %s' at line %d",
6839		       IDENTIFIER_POINTER (name),
6840		       type_name, IDENTIFIER_POINTER (name), line);
6841}
6842
6843/* If ANAME is terminated with `[]', it indicates an array. This
6844   function returns the number of `[]' found and if this number is
6845   greater than zero, it extracts the array type name and places it in
6846   the node pointed to by TRIMMED unless TRIMMED is null.  */
6847
6848static int
6849build_type_name_from_array_name (aname, trimmed)
6850     tree aname;
6851     tree *trimmed;
6852{
6853  const char *name = IDENTIFIER_POINTER (aname);
6854  int len = IDENTIFIER_LENGTH (aname);
6855  int array_dims;
6856
6857  STRING_STRIP_BRACKETS (name, len, array_dims);
6858
6859  if (array_dims && trimmed)
6860    *trimmed = get_identifier_with_length (name, len);
6861
6862  return array_dims;
6863}
6864
6865static tree
6866build_array_from_name (type, type_wfl, name, ret_name)
6867     tree type, type_wfl, name, *ret_name;
6868{
6869  int more_dims = 0;
6870
6871  /* Eventually get more dims */
6872  more_dims = build_type_name_from_array_name (name, &name);
6873
6874  /* If we have, then craft a new type for this variable */
6875  if (more_dims)
6876    {
6877      tree save = type;
6878
6879      /* If we have a pointer, use its type */
6880      if (TREE_CODE (type) == POINTER_TYPE)
6881        type = TREE_TYPE (type);
6882
6883      /* Building the first dimension of a primitive type uses this
6884         function */
6885      if (JPRIMITIVE_TYPE_P (type))
6886	{
6887	  type = build_java_array_type (type, -1);
6888	  more_dims--;
6889	}
6890      /* Otherwise, if we have a WFL for this type, use it (the type
6891         is already an array on an unresolved type, and we just keep
6892         on adding dimensions) */
6893      else if (type_wfl)
6894	{
6895	  type = type_wfl;
6896	  more_dims += build_type_name_from_array_name (TYPE_NAME (save),
6897							NULL);
6898	}
6899
6900      /* Add all the dimensions */
6901      while (more_dims--)
6902	type = build_unresolved_array_type (type);
6903
6904      /* The type may have been incomplete in the first place */
6905      if (type_wfl)
6906	type = obtain_incomplete_type (type);
6907    }
6908
6909  if (ret_name)
6910    *ret_name = name;
6911  return type;
6912}
6913
6914/* Build something that the type identifier resolver will identify as
6915   being an array to an unresolved type. TYPE_WFL is a WFL on a
6916   identifier. */
6917
6918static tree
6919build_unresolved_array_type (type_or_wfl)
6920     tree type_or_wfl;
6921{
6922  const char *ptr;
6923  tree wfl;
6924
6925  /* TYPE_OR_WFL might be an array on a resolved type. In this case,
6926     just create a array type */
6927  if (TREE_CODE (type_or_wfl) == RECORD_TYPE)
6928    return build_java_array_type (type_or_wfl, -1);
6929
6930  obstack_grow (&temporary_obstack,
6931		 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
6932		 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
6933  obstack_grow0 (&temporary_obstack, "[]", 2);
6934  ptr = obstack_finish (&temporary_obstack);
6935  wfl = build_expr_wfl (get_identifier (ptr),
6936			EXPR_WFL_FILENAME (type_or_wfl),
6937			EXPR_WFL_LINENO (type_or_wfl),
6938			EXPR_WFL_COLNO (type_or_wfl));
6939  /* Re-install the existing qualifications so that the type can be
6940     resolved properly. */
6941  EXPR_WFL_QUALIFICATION (wfl) = EXPR_WFL_QUALIFICATION (type_or_wfl);
6942  return wfl;
6943}
6944
6945static void
6946parser_add_interface (class_decl, interface_decl, wfl)
6947     tree class_decl, interface_decl, wfl;
6948{
6949  if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
6950    parse_error_context (wfl, "Interface `%s' repeated",
6951			 IDENTIFIER_POINTER (DECL_NAME (interface_decl)));
6952}
6953
6954/* Bulk of common class/interface checks. Return 1 if an error was
6955   encountered. TAG is 0 for a class, 1 for an interface.  */
6956
6957static int
6958check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl)
6959     int is_interface, flags;
6960     tree raw_name, qualified_name, decl, cl;
6961{
6962  tree node;
6963  int sca = 0;			/* Static class allowed */
6964  int icaf = 0;			/* Inner class allowed flags */
6965  int uaaf = CLASS_MODIFIERS;	/* Usually allowed access flags */
6966
6967  if (!quiet_flag)
6968    fprintf (stderr, " %s%s %s",
6969	     (CPC_INNER_P () ? "inner" : ""),
6970	     (is_interface ? "interface" : "class"),
6971	     IDENTIFIER_POINTER (qualified_name));
6972
6973  /* Scope of an interface/class type name:
6974       - Can't be imported by a single type import
6975       - Can't already exists in the package */
6976  if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name)
6977      && (node = find_name_in_single_imports (raw_name))
6978      && !CPC_INNER_P ())
6979    {
6980      parse_error_context
6981	(cl, "%s name `%s' clashes with imported type `%s'",
6982	 (is_interface ? "Interface" : "Class"),
6983	 IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node));
6984      return 1;
6985    }
6986  if (decl && CLASS_COMPLETE_P (decl))
6987    {
6988      classitf_redefinition_error ((is_interface ? "Interface" : "Class"),
6989				   qualified_name, decl, cl);
6990      return 1;
6991    }
6992
6993  if (check_inner_class_redefinition (raw_name, cl))
6994    return 1;
6995
6996  /* If public, file name should match class/interface name, except
6997     when dealing with an inner class */
6998  if (!CPC_INNER_P () && (flags & ACC_PUBLIC ))
6999    {
7000      const char *f;
7001
7002      for (f = &input_filename [strlen (input_filename)];
7003	   f != input_filename && ! IS_DIR_SEPARATOR (f[0]);
7004	   f--)
7005	;
7006      if (IS_DIR_SEPARATOR (f[0]))
7007	f++;
7008      if (strncmp (IDENTIFIER_POINTER (raw_name),
7009		   f , IDENTIFIER_LENGTH (raw_name)) ||
7010	  f [IDENTIFIER_LENGTH (raw_name)] != '.')
7011	parse_error_context
7012	  (cl, "Public %s `%s' must be defined in a file called `%s.java'",
7013			     (is_interface ? "interface" : "class"),
7014			     IDENTIFIER_POINTER (qualified_name),
7015			     IDENTIFIER_POINTER (raw_name));
7016    }
7017
7018  /* Static classes can be declared only in top level classes. Note:
7019     once static, a inner class is a top level class. */
7020  if (flags & ACC_STATIC)
7021    {
7022      /* Catch the specific error of declaring an class inner class
7023	 with no toplevel enclosing class. Prevent check_modifiers from
7024	 complaining a second time */
7025      if (CPC_INNER_P () && !TOPLEVEL_CLASS_DECL_P (GET_CPC()))
7026	{
7027	  parse_error_context (cl, "Inner class `%s' can't be static. Static classes can only occur in interfaces and top-level classes",
7028			       IDENTIFIER_POINTER (qualified_name));
7029	  sca = ACC_STATIC;
7030	}
7031      /* Else, in the context of a top-level class declaration, let
7032         `check_modifiers' do its job, otherwise, give it a go */
7033      else
7034	sca = (GET_CPC_LIST () ? ACC_STATIC : 0);
7035    }
7036
7037  /* Inner classes can be declared private or protected
7038     within their enclosing classes. */
7039  if (CPC_INNER_P ())
7040    {
7041      /* A class which is local to a block can't be public, private,
7042	 protected or static. But it is created final, so allow this
7043	 one. */
7044      if (current_function_decl)
7045	icaf = sca = uaaf = ACC_FINAL;
7046      else
7047	{
7048	  check_modifiers_consistency (flags);
7049	  icaf = ACC_PROTECTED;
7050	  if (! CLASS_INTERFACE (GET_CPC ()))
7051	    icaf |= ACC_PRIVATE;
7052	}
7053    }
7054
7055  if (is_interface)
7056    {
7057      if (CPC_INNER_P ())
7058	uaaf = INTERFACE_INNER_MODIFIERS;
7059      else
7060	uaaf = INTERFACE_MODIFIERS;
7061
7062      check_modifiers ("Illegal modifier `%s' for interface declaration",
7063		       flags, uaaf);
7064    }
7065  else
7066    check_modifiers ((current_function_decl ?
7067		      "Illegal modifier `%s' for local class declaration" :
7068		      "Illegal modifier `%s' for class declaration"),
7069		     flags, uaaf|sca|icaf);
7070  return 0;
7071}
7072
7073/* Construct a nested class name.  If the final component starts with
7074   a digit, return true.  Otherwise return false.  */
7075static int
7076make_nested_class_name (cpc_list)
7077     tree cpc_list;
7078{
7079  tree name;
7080
7081  if (!cpc_list)
7082    return 0;
7083
7084  make_nested_class_name (TREE_CHAIN (cpc_list));
7085
7086  /* Pick the qualified name when dealing with the first upmost
7087     enclosing class */
7088  name = (TREE_CHAIN (cpc_list)
7089	  ? TREE_PURPOSE (cpc_list) : DECL_NAME (TREE_VALUE (cpc_list)));
7090  obstack_grow (&temporary_obstack,
7091		IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name));
7092  obstack_1grow (&temporary_obstack, '$');
7093
7094  return ISDIGIT (IDENTIFIER_POINTER (name)[0]);
7095}
7096
7097/* Can't redefine a class already defined in an earlier scope. */
7098
7099static int
7100check_inner_class_redefinition (raw_name, cl)
7101     tree raw_name, cl;
7102{
7103  tree scope_list;
7104
7105  for (scope_list = GET_CPC_LIST (); scope_list;
7106       scope_list = GET_NEXT_ENCLOSING_CPC (scope_list))
7107    if (raw_name == GET_CPC_UN_NODE (scope_list))
7108      {
7109	parse_error_context
7110	  (cl, "The class name `%s' is already defined in this scope. An inner class may not have the same simple name as any of its enclosing classes",
7111	   IDENTIFIER_POINTER (raw_name));
7112	return 1;
7113      }
7114  return 0;
7115}
7116
7117/* Tries to find a decl for CLASS_TYPE within ENCLOSING. If we fail,
7118   we remember ENCLOSING and SUPER.  */
7119
7120static tree
7121resolve_inner_class (circularity_hash, cl, enclosing, super, class_type)
7122     htab_t circularity_hash;
7123     tree cl, *enclosing, *super, class_type;
7124{
7125  tree local_enclosing = *enclosing;
7126  tree local_super = NULL_TREE;
7127
7128  while (local_enclosing)
7129    {
7130      tree intermediate, decl;
7131
7132      *htab_find_slot (circularity_hash, local_enclosing, INSERT) =
7133	local_enclosing;
7134
7135      if ((decl = find_as_inner_class (local_enclosing, class_type, cl)))
7136	return decl;
7137
7138      intermediate = local_enclosing;
7139      /* Explore enclosing contexts. */
7140      while (INNER_CLASS_DECL_P (intermediate))
7141	{
7142	  intermediate = DECL_CONTEXT (intermediate);
7143	  if ((decl = find_as_inner_class (intermediate, class_type, cl)))
7144	    return decl;
7145	}
7146
7147      /* Now go to the upper classes, bail out if necessary. We will
7148	 analyze the returned SUPER and act accordingly (see
7149	 do_resolve_class.) */
7150      local_super = CLASSTYPE_SUPER (TREE_TYPE (local_enclosing));
7151      if (!local_super || local_super == object_type_node)
7152        break;
7153
7154      if (TREE_CODE (local_super) == POINTER_TYPE)
7155        local_super = do_resolve_class (NULL, local_super, NULL, NULL);
7156      else
7157	local_super = TYPE_NAME (local_super);
7158
7159      /* We may not have checked for circular inheritance yet, so do so
7160         here to prevent an infinite loop. */
7161      if (htab_find (circularity_hash, local_super) != NULL)
7162        {
7163          if (!cl)
7164            cl = lookup_cl (local_enclosing);
7165
7166          parse_error_context
7167            (cl, "Cyclic inheritance involving %s",
7168	     IDENTIFIER_POINTER (DECL_NAME (local_enclosing)));
7169	  local_enclosing = NULL_TREE;
7170        }
7171      else
7172	local_enclosing = local_super;
7173    }
7174
7175  /* We failed. Return LOCAL_SUPER and LOCAL_ENCLOSING. */
7176  *super = local_super;
7177  *enclosing = local_enclosing;
7178
7179  return NULL_TREE;
7180}
7181
7182/* Within ENCLOSING, find a decl for NAME and return it. NAME can be
7183   qualified. */
7184
7185static tree
7186find_as_inner_class (enclosing, name, cl)
7187     tree enclosing, name, cl;
7188{
7189  tree qual, to_return;
7190  if (!enclosing)
7191    return NULL_TREE;
7192
7193  name = TYPE_NAME (name);
7194
7195  /* First search: within the scope of `enclosing', search for name */
7196  if (QUALIFIED_P (name) && cl && EXPR_WFL_NODE (cl) == name)
7197    qual = EXPR_WFL_QUALIFICATION (cl);
7198  else if (cl)
7199    qual = build_tree_list (cl, NULL_TREE);
7200  else
7201    qual = build_tree_list (build_expr_wfl (name, NULL, 0, 0), NULL_TREE);
7202
7203  if ((to_return = find_as_inner_class_do (qual, enclosing)))
7204    return to_return;
7205
7206  /* We're dealing with a qualified name. Try to resolve thing until
7207     we get something that is an enclosing class. */
7208  if (QUALIFIED_P (name) && cl && EXPR_WFL_NODE (cl) == name)
7209    {
7210      tree acc = NULL_TREE, decl = NULL_TREE, ptr;
7211
7212      for (qual = EXPR_WFL_QUALIFICATION (cl); qual && !decl;
7213	   qual = TREE_CHAIN (qual))
7214	{
7215	  acc = merge_qualified_name (acc,
7216				      EXPR_WFL_NODE (TREE_PURPOSE (qual)));
7217	  BUILD_PTR_FROM_NAME (ptr, acc);
7218	  decl = do_resolve_class (NULL_TREE, ptr, NULL_TREE, cl);
7219	}
7220
7221      /* A NULL qual and a decl means that the search ended
7222         successfully?!? We have to do something then. FIXME */
7223
7224      if (decl)
7225	enclosing = decl;
7226      else
7227	qual = EXPR_WFL_QUALIFICATION (cl);
7228    }
7229  /* Otherwise, create a qual for the other part of the resolution. */
7230  else
7231    qual = build_tree_list (build_expr_wfl (name, NULL, 0, 0), NULL_TREE);
7232
7233  return find_as_inner_class_do (qual, enclosing);
7234}
7235
7236/* We go inside the list of sub classes and try to find a way
7237   through. */
7238
7239static tree
7240find_as_inner_class_do (qual, enclosing)
7241     tree qual, enclosing;
7242{
7243  if (!qual)
7244    return NULL_TREE;
7245
7246  for (; qual && enclosing; qual = TREE_CHAIN (qual))
7247    {
7248      tree name_to_match = EXPR_WFL_NODE (TREE_PURPOSE (qual));
7249      tree next_enclosing = NULL_TREE;
7250      tree inner_list;
7251
7252      for (inner_list = DECL_INNER_CLASS_LIST (enclosing);
7253           inner_list; inner_list = TREE_CHAIN (inner_list))
7254	{
7255	  if (TREE_VALUE (inner_list) == name_to_match)
7256	    {
7257	      next_enclosing = TREE_PURPOSE (inner_list);
7258	      break;
7259	    }
7260	}
7261      enclosing = next_enclosing;
7262    }
7263
7264  return (!qual && enclosing ? enclosing : NULL_TREE);
7265}
7266
7267/* Reach all inner classes and tie their unqualified name to a
7268   DECL. */
7269
7270static void
7271set_nested_class_simple_name_value (outer, set)
7272     tree outer;
7273     int set;
7274{
7275  tree l;
7276
7277  for (l = DECL_INNER_CLASS_LIST (outer); l; l = TREE_CHAIN (l))
7278    IDENTIFIER_GLOBAL_VALUE (TREE_VALUE (l)) = (set ?
7279						TREE_PURPOSE (l) : NULL_TREE);
7280}
7281
7282static void
7283link_nested_class_to_enclosing ()
7284{
7285  if (GET_ENCLOSING_CPC ())
7286    {
7287      tree enclosing = GET_ENCLOSING_CPC_CONTEXT ();
7288      DECL_INNER_CLASS_LIST (enclosing) =
7289	tree_cons (GET_CPC (), GET_CPC_UN (),
7290		   DECL_INNER_CLASS_LIST (enclosing));
7291    }
7292}
7293
7294static tree
7295maybe_make_nested_class_name (name)
7296     tree name;
7297{
7298  tree id = NULL_TREE;
7299
7300  if (CPC_INNER_P ())
7301    {
7302      /* If we're in a function, we must append a number to create the
7303	 nested class name.  However, we don't do this if the class we
7304	 are constructing is anonymous, because in that case we'll
7305	 already have a number as the class name.  */
7306      if (! make_nested_class_name (GET_CPC_LIST ())
7307	  && current_function_decl != NULL_TREE
7308	  && ! ISDIGIT (IDENTIFIER_POINTER (name)[0]))
7309	{
7310	  char buf[10];
7311	  sprintf (buf, "%d", anonymous_class_counter);
7312	  ++anonymous_class_counter;
7313	  obstack_grow (&temporary_obstack, buf, strlen (buf));
7314	  obstack_1grow (&temporary_obstack, '$');
7315	}
7316      obstack_grow0 (&temporary_obstack,
7317		     IDENTIFIER_POINTER (name),
7318		     IDENTIFIER_LENGTH (name));
7319      id = get_identifier (obstack_finish (&temporary_obstack));
7320      if (ctxp->package)
7321	QUALIFIED_P (id) = 1;
7322    }
7323  return id;
7324}
7325
7326/* If DECL is NULL, create and push a new DECL, record the current
7327   line CL and do other maintenance things.  */
7328
7329static tree
7330maybe_create_class_interface_decl (decl, raw_name, qualified_name, cl)
7331     tree decl, raw_name, qualified_name, cl;
7332{
7333  if (!decl)
7334    decl = push_class (make_class (), qualified_name);
7335
7336  /* Take care of the file and line business */
7337  DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
7338  /* If we're emiting xrefs, store the line/col number information */
7339  if (flag_emit_xref)
7340    DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (cl);
7341  else
7342    DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
7343  CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
7344  CLASS_PARSED_P (TREE_TYPE (decl)) = 1;
7345  CLASS_FROM_CURRENTLY_COMPILED_P (TREE_TYPE (decl)) =
7346    IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
7347
7348  PUSH_CPC (decl, raw_name);
7349  DECL_CONTEXT (decl) = GET_ENCLOSING_CPC_CONTEXT ();
7350
7351  /* Link the declaration to the already seen ones */
7352  TREE_CHAIN (decl) = ctxp->class_list;
7353  ctxp->class_list = decl;
7354
7355  /* Create a new nodes in the global lists */
7356  gclass_list = tree_cons (NULL_TREE, decl, gclass_list);
7357  all_class_list = tree_cons (NULL_TREE, decl, all_class_list);
7358
7359  /* Install a new dependency list element */
7360  create_jdep_list (ctxp);
7361
7362  SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
7363			  IDENTIFIER_POINTER (qualified_name)));
7364  return decl;
7365}
7366
7367static void
7368add_superinterfaces (decl, interface_list)
7369     tree decl, interface_list;
7370{
7371  tree node;
7372  /* Superinterface(s): if present and defined, parser_check_super_interface ()
7373     takes care of ensuring that:
7374       - This is an accessible interface type,
7375       - Circularity detection.
7376   parser_add_interface is then called. If present but not defined,
7377   the check operation is delayed until the super interface gets
7378   defined.  */
7379  for (node = interface_list; node; node = TREE_CHAIN (node))
7380    {
7381      tree current = TREE_PURPOSE (node);
7382      tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current));
7383      if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl)))
7384	{
7385	  if (!parser_check_super_interface (idecl, decl, current))
7386	    parser_add_interface (decl, idecl, current);
7387	}
7388      else
7389	register_incomplete_type (JDEP_INTERFACE,
7390				  current, decl, NULL_TREE);
7391    }
7392}
7393
7394/* Create an interface in pass1 and return its decl. Return the
7395   interface's decl in pass 2.  */
7396
7397static tree
7398create_interface (flags, id, super)
7399     int flags;
7400     tree id, super;
7401{
7402  tree raw_name = EXPR_WFL_NODE (id);
7403  tree q_name = parser_qualified_classname (raw_name);
7404  tree decl = IDENTIFIER_CLASS_VALUE (q_name);
7405
7406  /* Certain syntax errors are making SUPER be like ID. Avoid this
7407     case. */
7408  if (ctxp->class_err && id == super)
7409    super = NULL;
7410
7411  EXPR_WFL_NODE (id) = q_name;	/* Keep source location, even if refined. */
7412
7413  /* Basic checks: scope, redefinition, modifiers */
7414  if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id))
7415    {
7416      PUSH_ERROR ();
7417      return NULL_TREE;
7418    }
7419
7420  /* Suspend the current parsing context if we're parsing an inner
7421     interface */
7422  if (CPC_INNER_P ())
7423    {
7424      java_parser_context_suspend ();
7425      /* Interface members are public. */
7426      if (CLASS_INTERFACE (GET_CPC ()))
7427	flags |= ACC_PUBLIC;
7428    }
7429
7430  /* Push a new context for (static) initialized upon declaration fields */
7431  java_parser_context_push_initialized_field ();
7432
7433  /* Interface modifiers check
7434       - public/abstract allowed (already done at that point)
7435       - abstract is obsolete (comes first, it's a warning, or should be)
7436       - Can't use twice the same (checked in the modifier rule) */
7437  if ((flags & ACC_ABSTRACT) && flag_redundant)
7438    parse_warning_context
7439      (MODIFIER_WFL (ABSTRACT_TK),
7440       "Redundant use of `abstract' modifier. Interface `%s' is implicitly abstract", IDENTIFIER_POINTER (raw_name));
7441
7442  /* Create a new decl if DECL is NULL, otherwise fix it */
7443  decl = maybe_create_class_interface_decl (decl, raw_name, q_name, id);
7444
7445  /* Set super info and mark the class a complete */
7446  set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl),
7447		  object_type_node, ctxp->interface_number);
7448  ctxp->interface_number = 0;
7449  CLASS_COMPLETE_P (decl) = 1;
7450  add_superinterfaces (decl, super);
7451
7452  return decl;
7453}
7454
7455/* Patch anonymous class CLASS, by either extending or implementing
7456   DEP.  */
7457
7458static void
7459patch_anonymous_class (type_decl, class_decl, wfl)
7460    tree type_decl, class_decl, wfl;
7461{
7462  tree class = TREE_TYPE (class_decl);
7463  tree type =  TREE_TYPE (type_decl);
7464  tree binfo = TYPE_BINFO (class);
7465
7466  /* If it's an interface, implement it */
7467  if (CLASS_INTERFACE (type_decl))
7468    {
7469      tree s_binfo;
7470      int length;
7471
7472      if (parser_check_super_interface (type_decl, class_decl, wfl))
7473	return;
7474
7475      s_binfo = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (class)), 0);
7476      length = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (class))+1;
7477      TYPE_BINFO_BASETYPES (class) = make_tree_vec (length);
7478      TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (class)), 0) = s_binfo;
7479      /* And add the interface */
7480      parser_add_interface (class_decl, type_decl, wfl);
7481    }
7482  /* Otherwise, it's a type we want to extend */
7483  else
7484    {
7485      if (parser_check_super (type_decl, class_decl, wfl))
7486	return;
7487      BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (binfo), 0)) = type;
7488    }
7489}
7490
7491static tree
7492create_anonymous_class (location, type_name)
7493    int location;
7494    tree type_name;
7495{
7496  char buffer [80];
7497  tree super = NULL_TREE, itf = NULL_TREE;
7498  tree id, type_decl, class;
7499
7500  /* The unqualified name of the anonymous class. It's just a number. */
7501  sprintf (buffer, "%d", anonymous_class_counter++);
7502  id = build_wfl_node (get_identifier (buffer));
7503  EXPR_WFL_LINECOL (id) = location;
7504
7505  /* We know about the type to extend/implement. We go ahead */
7506  if ((type_decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (type_name))))
7507    {
7508      /* Create a class which either implements on extends the designated
7509	 class. The class bears an innacessible name. */
7510      if (CLASS_INTERFACE (type_decl))
7511	{
7512	  /* It's OK to modify it here. It's been already used and
7513             shouldn't be reused */
7514	  ctxp->interface_number = 1;
7515	  /* Interfaces should presented as a list of WFLs */
7516	  itf = build_tree_list (type_name, NULL_TREE);
7517	}
7518      else
7519	super = type_name;
7520    }
7521
7522  class = create_class (ACC_FINAL, id, super, itf);
7523
7524  /* We didn't know anything about the stuff. We register a dependence. */
7525  if (!type_decl)
7526    register_incomplete_type (JDEP_ANONYMOUS, type_name, class, NULL_TREE);
7527
7528  ANONYMOUS_CLASS_P (TREE_TYPE (class)) = 1;
7529  return class;
7530}
7531
7532/* Create a class in pass1 and return its decl. Return class
7533   interface's decl in pass 2.  */
7534
7535static tree
7536create_class (flags, id, super, interfaces)
7537     int flags;
7538     tree id, super, interfaces;
7539{
7540  tree raw_name = EXPR_WFL_NODE (id);
7541  tree class_id, decl;
7542  tree super_decl_type;
7543
7544  /* Certain syntax errors are making SUPER be like ID. Avoid this
7545     case. */
7546  if (ctxp->class_err && id == super)
7547    super = NULL;
7548
7549  class_id = parser_qualified_classname (raw_name);
7550  decl = IDENTIFIER_CLASS_VALUE (class_id);
7551  EXPR_WFL_NODE (id) = class_id;
7552
7553  /* Basic check: scope, redefinition, modifiers */
7554  if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id))
7555    {
7556      PUSH_ERROR ();
7557      return NULL_TREE;
7558    }
7559
7560  /* Suspend the current parsing context if we're parsing an inner
7561     class or an anonymous class. */
7562  if (CPC_INNER_P ())
7563    {
7564      java_parser_context_suspend ();
7565      /* Interface members are public. */
7566      if (CLASS_INTERFACE (GET_CPC ()))
7567	flags |= ACC_PUBLIC;
7568    }
7569
7570  /* Push a new context for (static) initialized upon declaration fields */
7571  java_parser_context_push_initialized_field ();
7572
7573  /* Class modifier check:
7574       - Allowed modifier (already done at that point)
7575       - abstract AND final forbidden
7576       - Public classes defined in the correct file */
7577  if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
7578    parse_error_context
7579      (id, "Class `%s' can't be declared both abstract and final",
7580       IDENTIFIER_POINTER (raw_name));
7581
7582  /* Create a new decl if DECL is NULL, otherwise fix it */
7583  decl = maybe_create_class_interface_decl (decl, raw_name, class_id, id);
7584
7585  /* If SUPER exists, use it, otherwise use Object */
7586  if (super)
7587    {
7588      /* Can't extend java.lang.Object */
7589      if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
7590	{
7591	  parse_error_context (id, "Can't extend `java.lang.Object'");
7592	  return NULL_TREE;
7593	}
7594
7595      super_decl_type =
7596	register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE);
7597    }
7598  else if (TREE_TYPE (decl) != object_type_node)
7599    super_decl_type = object_type_node;
7600  /* We're defining java.lang.Object */
7601  else
7602    super_decl_type = NULL_TREE;
7603
7604  /* A class nested in an interface is implicitly static. */
7605  if (INNER_CLASS_DECL_P (decl)
7606      && CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (DECL_CONTEXT (decl)))))
7607    {
7608      flags |= ACC_STATIC;
7609    }
7610
7611  /* Set super info and mark the class as complete. */
7612  set_super_info (flags, TREE_TYPE (decl), super_decl_type,
7613		  ctxp->interface_number);
7614  ctxp->interface_number = 0;
7615  CLASS_COMPLETE_P (decl) = 1;
7616  add_superinterfaces (decl, interfaces);
7617
7618  /* Add the private this$<n> field, Replicate final locals still in
7619     scope as private final fields mangled like val$<local_name>.
7620     This doesn't not occur for top level (static) inner classes. */
7621  if (PURE_INNER_CLASS_DECL_P (decl))
7622    add_inner_class_fields (decl, current_function_decl);
7623
7624  /* If doing xref, store the location at which the inherited class
7625     (if any) was seen. */
7626  if (flag_emit_xref && super)
7627    DECL_INHERITED_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (super);
7628
7629  /* Eventually sets the @deprecated tag flag */
7630  CHECK_DEPRECATED (decl);
7631
7632  /* Reset the anonymous class counter when declaring non inner classes */
7633  if (!INNER_CLASS_DECL_P (decl))
7634    anonymous_class_counter = 1;
7635
7636  return decl;
7637}
7638
7639/* End a class declaration: register the statements used to create
7640   finit$ and <clinit>, pop the current class and resume the prior
7641   parser context if necessary.  */
7642
7643static void
7644end_class_declaration (resume)
7645     int resume;
7646{
7647  /* If an error occurred, context weren't pushed and won't need to be
7648     popped by a resume. */
7649  int no_error_occurred = ctxp->next && GET_CPC () != error_mark_node;
7650
7651  if (GET_CPC () != error_mark_node)
7652    dump_java_tree (TDI_class, GET_CPC ());
7653
7654  java_parser_context_pop_initialized_field ();
7655  POP_CPC ();
7656  if (resume && no_error_occurred)
7657    java_parser_context_resume ();
7658
7659  /* We're ending a class declaration, this is a good time to reset
7660     the interface cout. Note that might have been already done in
7661     create_interface, but if at that time an inner class was being
7662     dealt with, the interface count was reset in a context created
7663     for the sake of handling inner classes declaration. */
7664  ctxp->interface_number = 0;
7665}
7666
7667static void
7668add_inner_class_fields (class_decl, fct_decl)
7669     tree class_decl;
7670     tree fct_decl;
7671{
7672  tree block, marker, f;
7673
7674  f = add_field (TREE_TYPE (class_decl),
7675		 build_current_thisn (TREE_TYPE (class_decl)),
7676		 build_pointer_type (TREE_TYPE (DECL_CONTEXT (class_decl))),
7677		 ACC_PRIVATE);
7678  FIELD_THISN (f) = 1;
7679
7680  if (!fct_decl)
7681    return;
7682
7683  for (block = GET_CURRENT_BLOCK (fct_decl);
7684       block && TREE_CODE (block) == BLOCK; block = BLOCK_SUPERCONTEXT (block))
7685    {
7686      tree decl;
7687      for (decl = BLOCK_EXPR_DECLS (block); decl; decl = TREE_CHAIN (decl))
7688	{
7689	  tree name, pname;
7690	  tree wfl, init, list;
7691
7692	  /* Avoid non final arguments. */
7693	  if (!LOCAL_FINAL_P (decl))
7694	    continue;
7695
7696	  MANGLE_OUTER_LOCAL_VARIABLE_NAME (name, DECL_NAME (decl));
7697	  MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID (pname, DECL_NAME (decl));
7698	  wfl = build_wfl_node (name);
7699	  init = build_wfl_node (pname);
7700	  /* Build an initialization for the field: it will be
7701	     initialized by a parameter added to finit$, bearing a
7702	     mangled name of the field itself (param$<n>.) The
7703	     parameter is provided to finit$ by the constructor
7704	     invoking it (hence the constructor will also feature a
7705	     hidden parameter, set to the value of the outer context
7706	     local at the time the inner class is created.)
7707
7708	     Note: we take into account all possible locals that can
7709	     be accessed by the inner class. It's actually not trivial
7710	     to minimize these aliases down to the ones really
7711	     used. One way to do that would be to expand all regular
7712	     methods first, then finit$ to get a picture of what's
7713	     used.  It works with the exception that we would have to
7714	     go back on all constructor invoked in regular methods to
7715	     have their invokation reworked (to include the right amount
7716	     of alias initializer parameters.)
7717
7718	     The only real way around, I think, is a first pass to
7719	     identify locals really used in the inner class. We leave
7720	     the flag FIELD_LOCAL_ALIAS_USED around for that future
7721	     use.
7722
7723	     On the other hand, it only affect local inner classes,
7724	     whose constructors (and finit$ call) will be featuring
7725	     unecessary arguments. It's easy for a developper to keep
7726	     this number of parameter down by using the `final'
7727	     keyword only when necessary. For the time being, we can
7728	     issue a warning on unecessary finals. FIXME */
7729	  init = build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (wfl),
7730				   wfl, init);
7731
7732	  /* Register the field. The TREE_LIST holding the part
7733	     initialized/initializer will be marked ARG_FINAL_P so
7734	     that the created field can be marked
7735	     FIELD_LOCAL_ALIAS. */
7736	  list = build_tree_list (wfl, init);
7737	  ARG_FINAL_P (list) = 1;
7738	  register_fields (ACC_PRIVATE | ACC_FINAL, TREE_TYPE (decl), list);
7739	}
7740    }
7741
7742  if (!CPC_INITIALIZER_STMT (ctxp))
7743    return;
7744
7745  /* If we ever registered an alias field, insert and marker to
7746     remeber where the list ends. The second part of the list (the one
7747     featuring initialized fields) so it can be later reversed to
7748     enforce 8.5. The marker will be removed during that operation. */
7749  marker = build_tree_list (NULL_TREE, NULL_TREE);
7750  TREE_CHAIN (marker) = CPC_INITIALIZER_STMT (ctxp);
7751  SET_CPC_INITIALIZER_STMT (ctxp, marker);
7752}
7753
7754/* Can't use lookup_field () since we don't want to load the class and
7755   can't set the CLASS_LOADED_P flag */
7756
7757static tree
7758find_field (class, name)
7759     tree class;
7760     tree name;
7761{
7762  tree decl;
7763  for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl))
7764    {
7765      if (DECL_NAME (decl) == name)
7766	return decl;
7767    }
7768  return NULL_TREE;
7769}
7770
7771/* Wrap around lookup_field that doesn't potentially upset the value
7772   of CLASS */
7773
7774static tree
7775lookup_field_wrapper (class, name)
7776     tree class, name;
7777{
7778  tree type = class;
7779  tree decl = NULL_TREE;
7780  java_parser_context_save_global ();
7781
7782  /* Last chance: if we're within the context of an inner class, we
7783     might be trying to access a local variable defined in an outer
7784     context. We try to look for it now. */
7785  if (INNER_CLASS_TYPE_P (class) && TREE_CODE (name) == IDENTIFIER_NODE)
7786    {
7787      tree new_name;
7788      MANGLE_OUTER_LOCAL_VARIABLE_NAME (new_name, name);
7789      decl = lookup_field (&type, new_name);
7790      if (decl && decl != error_mark_node)
7791	FIELD_LOCAL_ALIAS_USED (decl) = 1;
7792    }
7793  if (!decl || decl == error_mark_node)
7794    {
7795      type = class;
7796      decl = lookup_field (&type, name);
7797    }
7798
7799  /* If the field still hasn't been found, try the next enclosing context. */
7800  if (!decl && INNER_CLASS_TYPE_P (class))
7801    {
7802      tree outer_type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class)));
7803      decl = lookup_field_wrapper (outer_type, name);
7804    }
7805
7806  java_parser_context_restore_global ();
7807  return decl == error_mark_node ? NULL : decl;
7808}
7809
7810/* Find duplicate field within the same class declarations and report
7811   the error. Returns 1 if a duplicated field was found, 0
7812   otherwise.  */
7813
7814static int
7815duplicate_declaration_error_p (new_field_name, new_type, cl)
7816     tree new_field_name, new_type, cl;
7817{
7818  /* This might be modified to work with method decl as well */
7819  tree decl = find_field (TREE_TYPE (GET_CPC ()), new_field_name);
7820  if (decl)
7821    {
7822      char *t1 = xstrdup (purify_type_name
7823			 ((TREE_CODE (new_type) == POINTER_TYPE
7824			   && TREE_TYPE (new_type) == NULL_TREE) ?
7825			  IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
7826			  lang_printable_name (new_type, 1)));
7827      /* The type may not have been completed by the time we report
7828	 the error */
7829      char *t2 = xstrdup (purify_type_name
7830			 ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
7831			   && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
7832			  IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
7833			  lang_printable_name (TREE_TYPE (decl), 1)));
7834      parse_error_context
7835	(cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
7836	 t1, IDENTIFIER_POINTER (new_field_name),
7837	 t2, IDENTIFIER_POINTER (DECL_NAME (decl)),
7838	 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
7839      free (t1);
7840      free (t2);
7841      return 1;
7842    }
7843  return 0;
7844}
7845
7846/* Field registration routine. If TYPE doesn't exist, field
7847   declarations are linked to the undefined TYPE dependency list, to
7848   be later resolved in java_complete_class () */
7849
7850static void
7851register_fields (flags, type, variable_list)
7852     int flags;
7853     tree type, variable_list;
7854{
7855  tree current, saved_type;
7856  tree class_type = NULL_TREE;
7857  int saved_lineno = lineno;
7858  int must_chain = 0;
7859  tree wfl = NULL_TREE;
7860
7861  if (GET_CPC ())
7862    class_type = TREE_TYPE (GET_CPC ());
7863
7864  if (!class_type || class_type == error_mark_node)
7865    return;
7866
7867  /* If we're adding fields to interfaces, those fields are public,
7868     static, final */
7869  if (CLASS_INTERFACE (TYPE_NAME (class_type)))
7870    {
7871      OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK),
7872				 flags, ACC_PUBLIC, "interface field(s)");
7873      OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
7874				 flags, ACC_STATIC, "interface field(s)");
7875      OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
7876				 flags, ACC_FINAL, "interface field(s)");
7877      check_modifiers ("Illegal interface member modifier `%s'", flags,
7878		       INTERFACE_FIELD_MODIFIERS);
7879      flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL);
7880    }
7881
7882  /* Obtain a suitable type for resolution, if necessary */
7883  SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain);
7884
7885  /* If TYPE is fully resolved and we don't have a reference, make one */
7886  PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
7887
7888  for (current = variable_list, saved_type = type; current;
7889       current = TREE_CHAIN (current), type = saved_type)
7890    {
7891      tree real_type;
7892      tree field_decl;
7893      tree cl = TREE_PURPOSE (current);
7894      tree init = TREE_VALUE (current);
7895      tree current_name = EXPR_WFL_NODE (cl);
7896
7897      /* Can't declare non-final static fields in inner classes */
7898      if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (class_type)
7899          && !(flags & ACC_FINAL))
7900	parse_error_context
7901          (cl, "Field `%s' can't be static in inner class `%s' unless it is final",
7902	   IDENTIFIER_POINTER (EXPR_WFL_NODE (cl)),
7903	   lang_printable_name (class_type, 0));
7904
7905      /* Process NAME, as it may specify extra dimension(s) for it */
7906      type = build_array_from_name (type, wfl, current_name, &current_name);
7907
7908      /* Type adjustment. We may have just readjusted TYPE because
7909	 the variable specified more dimensions. Make sure we have
7910	 a reference if we can and don't have one already. Also
7911	 change the name if we have an init. */
7912      if (type != saved_type)
7913	{
7914	  PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
7915	  if (init)
7916	    EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name;
7917	}
7918
7919      real_type = GET_REAL_TYPE (type);
7920      /* Check for redeclarations */
7921      if (duplicate_declaration_error_p (current_name, real_type, cl))
7922	continue;
7923
7924      /* Set lineno to the line the field was found and create a
7925         declaration for it. Eventually sets the @deprecated tag flag. */
7926      if (flag_emit_xref)
7927	lineno = EXPR_WFL_LINECOL (cl);
7928      else
7929	lineno = EXPR_WFL_LINENO (cl);
7930      field_decl = add_field (class_type, current_name, real_type, flags);
7931      CHECK_DEPRECATED (field_decl);
7932
7933      /* If the field denotes a final instance variable, then we
7934	 allocate a LANG_DECL_SPECIFIC part to keep track of its
7935	 initialization. We also mark whether the field was
7936	 initialized upon its declaration. We don't do that if the
7937	 created field is an alias to a final local. */
7938      if (!ARG_FINAL_P (current) && (flags & ACC_FINAL))
7939	{
7940	  MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field_decl);
7941	  DECL_FIELD_FINAL_WFL (field_decl) = cl;
7942	}
7943
7944      /* If the couple initializer/initialized is marked ARG_FINAL_P,
7945	 we mark the created field FIELD_LOCAL_ALIAS, so that we can
7946	 hide parameters to this inner class finit$ and
7947	 constructors. It also means that the field isn't final per
7948	 say. */
7949      if (ARG_FINAL_P (current))
7950	{
7951	  FIELD_LOCAL_ALIAS (field_decl) = 1;
7952	  FIELD_FINAL (field_decl) = 0;
7953	}
7954
7955      /* Check if we must chain. */
7956      if (must_chain)
7957	register_incomplete_type (JDEP_FIELD, wfl, field_decl, type);
7958
7959      /* If we have an initialization value tied to the field */
7960      if (init)
7961	{
7962	  /* The field is declared static */
7963	  if (flags & ACC_STATIC)
7964	    {
7965	      /* We include the field and its initialization part into
7966		 a list used to generate <clinit>. After <clinit> is
7967		 walked, field initializations will be processed and
7968		 fields initialized with known constants will be taken
7969		 out of <clinit> and have their DECL_INITIAL set
7970		 appropriately. */
7971	      TREE_CHAIN (init) = CPC_STATIC_INITIALIZER_STMT (ctxp);
7972	      SET_CPC_STATIC_INITIALIZER_STMT (ctxp, init);
7973	      if (TREE_OPERAND (init, 1)
7974		  && TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT)
7975		TREE_STATIC (TREE_OPERAND (init, 1)) = 1;
7976	    }
7977	  /* A non-static field declared with an immediate initialization is
7978	     to be initialized in <init>, if any.  This field is remembered
7979	     to be processed at the time of the generation of <init>. */
7980	  else
7981	    {
7982	      TREE_CHAIN (init) = CPC_INITIALIZER_STMT (ctxp);
7983	      SET_CPC_INITIALIZER_STMT (ctxp, init);
7984	    }
7985	  MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
7986	  DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1);
7987	}
7988    }
7989  lineno = saved_lineno;
7990}
7991
7992/* Generate finit$, using the list of initialized fields to populate
7993   its body. finit$'s parameter(s) list is adjusted to include the
7994   one(s) used to initialized the field(s) caching outer context
7995   local(s).  */
7996
7997static tree
7998generate_finit (class_type)
7999     tree class_type;
8000{
8001  int count = 0;
8002  tree list = TYPE_FINIT_STMT_LIST (class_type);
8003  tree mdecl, current, parms;
8004
8005  parms = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION,
8006						  class_type, NULL_TREE,
8007						  &count);
8008  CRAFTED_PARAM_LIST_FIXUP (parms);
8009  mdecl = create_artificial_method (class_type, ACC_PRIVATE, void_type_node,
8010				    finit_identifier_node, parms);
8011  fix_method_argument_names (parms, mdecl);
8012  layout_class_method (class_type, CLASSTYPE_SUPER (class_type),
8013		       mdecl, NULL_TREE);
8014  DECL_FUNCTION_NAP (mdecl) = count;
8015  start_artificial_method_body (mdecl);
8016
8017  for (current = list; current; current = TREE_CHAIN (current))
8018    java_method_add_stmt (mdecl,
8019			  build_debugable_stmt (EXPR_WFL_LINECOL (current),
8020						current));
8021  end_artificial_method_body (mdecl);
8022  return mdecl;
8023}
8024
8025/* Generate a function to run the instance initialization code. The
8026   private method is called `instinit$'. Unless we're dealing with an
8027   anonymous class, we determine whether all ctors of CLASS_TYPE
8028   declare a checked exception in their `throws' clause in order to
8029   see whether it's necessary to encapsulate the instance initializer
8030   statements in a try/catch/rethrow sequence.  */
8031
8032static tree
8033generate_instinit (class_type)
8034     tree class_type;
8035{
8036  tree current;
8037  tree compound = NULL_TREE;
8038  tree parms = tree_cons (this_identifier_node,
8039			  build_pointer_type (class_type), end_params_node);
8040  tree mdecl = create_artificial_method (class_type, ACC_PRIVATE,
8041					 void_type_node,
8042					 instinit_identifier_node, parms);
8043
8044  layout_class_method (class_type, CLASSTYPE_SUPER (class_type),
8045		       mdecl, NULL_TREE);
8046
8047  /* Gather all the statements in a compound */
8048  for (current = TYPE_II_STMT_LIST (class_type);
8049       current; current = TREE_CHAIN (current))
8050    compound = add_stmt_to_compound (compound, NULL_TREE, current);
8051
8052  /* We need to encapsulate COMPOUND by a try/catch statement to
8053     rethrow exceptions that might occur in the instance initializer.
8054     We do that only if all ctors of CLASS_TYPE are set to catch a
8055     checked exception. This doesn't apply to anonymous classes (since
8056     they don't have declared ctors.) */
8057  if (!ANONYMOUS_CLASS_P (class_type) &&
8058      ctors_unchecked_throws_clause_p (class_type))
8059    {
8060      compound = encapsulate_with_try_catch (0, exception_type_node, compound,
8061					     build1 (THROW_EXPR, NULL_TREE,
8062						     build_wfl_node (wpv_id)));
8063      DECL_FUNCTION_THROWS (mdecl) = build_tree_list (NULL_TREE,
8064						      exception_type_node);
8065    }
8066
8067  start_artificial_method_body (mdecl);
8068  java_method_add_stmt (mdecl, compound);
8069  end_artificial_method_body (mdecl);
8070
8071  return mdecl;
8072}
8073
8074/* FIXME */
8075static tree
8076build_instinit_invocation (class_type)
8077     tree class_type;
8078{
8079  tree to_return = NULL_TREE;
8080
8081  if (TYPE_II_STMT_LIST (class_type))
8082    {
8083      tree parm = build_tree_list (NULL_TREE,
8084				   build_wfl_node (this_identifier_node));
8085      to_return =
8086	build_method_invocation (build_wfl_node (instinit_identifier_node),
8087				 parm);
8088    }
8089  return to_return;
8090}
8091
8092/* Shared accros method_declarator and method_header to remember the
8093   patch stage that was reached during the declaration of the method.
8094   A method DECL is built differently is there is no patch
8095   (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
8096   pending on the currently defined method.  */
8097
8098static int patch_stage;
8099
8100/* Check the method declaration and add the method to its current
8101   class.  If the argument list is known to contain incomplete types,
8102   the method is partially added and the registration will be resume
8103   once the method arguments resolved. If TYPE is NULL, we're dealing
8104   with a constructor.  */
8105
8106static tree
8107method_header (flags, type, mdecl, throws)
8108     int flags;
8109     tree type, mdecl, throws;
8110{
8111  tree type_wfl = NULL_TREE;
8112  tree meth_name = NULL_TREE;
8113  tree current, orig_arg, this_class = NULL;
8114  tree id, meth;
8115  int saved_lineno;
8116  int constructor_ok = 0, must_chain;
8117  int count;
8118
8119  if (mdecl == error_mark_node)
8120    return error_mark_node;
8121  meth = TREE_VALUE (mdecl);
8122  id = TREE_PURPOSE (mdecl);
8123
8124  check_modifiers_consistency (flags);
8125
8126  if (GET_CPC ())
8127    this_class = TREE_TYPE (GET_CPC ());
8128
8129  if (!this_class || this_class == error_mark_node)
8130    return NULL_TREE;
8131
8132  /* There are some forbidden modifiers for an abstract method and its
8133     class must be abstract as well.  */
8134  if (type && (flags & ACC_ABSTRACT))
8135    {
8136      ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private");
8137      ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static");
8138      ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final");
8139      ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native");
8140      ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED, id, "Synchronized");
8141      ABSTRACT_CHECK (flags, ACC_STRICT, id, "Strictfp");
8142      if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
8143	  && !CLASS_INTERFACE (TYPE_NAME (this_class)))
8144	parse_error_context
8145	  (id, "Class `%s' must be declared abstract to define abstract method `%s'",
8146	   IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())),
8147	   IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
8148    }
8149
8150  /* A native method can't be strictfp.  */
8151  if ((flags & ACC_NATIVE) && (flags & ACC_STRICT))
8152    parse_error_context (id, "native method `%s' can't be strictfp",
8153			 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
8154  /* No such thing as a transient or volatile method.  */
8155  if ((flags & ACC_TRANSIENT))
8156    parse_error_context (id, "method `%s' can't be transient",
8157			 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
8158  if ((flags & ACC_VOLATILE))
8159    parse_error_context (id, "method `%s' can't be volatile",
8160			 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
8161
8162  /* Things to be checked when declaring a constructor */
8163  if (!type)
8164    {
8165      int ec = java_error_count;
8166      /* 8.6: Constructor declarations: we might be trying to define a
8167         method without specifying a return type. */
8168      if (EXPR_WFL_NODE (id) != GET_CPC_UN ())
8169	parse_error_context
8170	  (id, "Invalid method declaration, return type required");
8171      /* 8.6.3: Constructor modifiers */
8172      else
8173	{
8174	  JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract");
8175	  JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static");
8176	  JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final");
8177	  JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native");
8178	  JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized");
8179	  JCONSTRUCTOR_CHECK (flags, ACC_STRICT, id, "strictfp");
8180	}
8181      /* If we found error here, we don't consider it's OK to tread
8182	 the method definition as a constructor, for the rest of this
8183	 function */
8184      if (ec == java_error_count)
8185	constructor_ok = 1;
8186    }
8187
8188  /* Method declared within the scope of an interface are implicitly
8189     abstract and public. Conflicts with other erroneously provided
8190     modifiers are checked right after. */
8191
8192  if (CLASS_INTERFACE (TYPE_NAME (this_class)))
8193    {
8194      /* If FLAGS isn't set because of a modifier, turn the
8195	 corresponding modifier WFL to NULL so we issue a warning on
8196	 the obsolete use of the modifier */
8197      if (!(flags & ACC_PUBLIC))
8198        MODIFIER_WFL (PUBLIC_TK) = NULL;
8199      if (!(flags & ACC_ABSTRACT))
8200        MODIFIER_WFL (ABSTRACT_TK) = NULL;
8201      flags |= ACC_PUBLIC;
8202      flags |= ACC_ABSTRACT;
8203    }
8204
8205  /* Inner class can't declare static methods */
8206  if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (this_class))
8207    {
8208      parse_error_context
8209	(id, "Method `%s' can't be static in inner class `%s'. Only members of interfaces and top-level classes can be static",
8210	 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)),
8211	 lang_printable_name (this_class, 0));
8212    }
8213
8214  /* Modifiers context reset moved up, so abstract method declaration
8215     modifiers can be later checked.  */
8216
8217  /* Set constructor returned type to void and method name to <init>,
8218     unless we found an error identifier the constructor (in which
8219     case we retain the original name) */
8220  if (!type)
8221    {
8222      type = void_type_node;
8223      if (constructor_ok)
8224	meth_name = init_identifier_node;
8225    }
8226  else
8227    meth_name = EXPR_WFL_NODE (id);
8228
8229  /* Do the returned type resolution and registration if necessary */
8230  SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
8231
8232  if (meth_name)
8233    type = build_array_from_name (type, type_wfl, meth_name, &meth_name);
8234  EXPR_WFL_NODE (id) = meth_name;
8235  PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
8236
8237  if (must_chain)
8238    {
8239      patch_stage = JDEP_METHOD_RETURN;
8240      register_incomplete_type (patch_stage, type_wfl, id, type);
8241      TREE_TYPE (meth) = GET_REAL_TYPE (type);
8242    }
8243  else
8244    TREE_TYPE (meth) = type;
8245
8246  saved_lineno = lineno;
8247  /* When defining an abstract or interface method, the curly
8248     bracket at level 1 doesn't exist because there is no function
8249     body */
8250  lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
8251	    EXPR_WFL_LINENO (id));
8252
8253  /* Remember the original argument list */
8254  orig_arg = TYPE_ARG_TYPES (meth);
8255
8256  if (patch_stage)		/* includes ret type and/or all args */
8257    {
8258      jdep *jdep;
8259      meth = add_method_1 (this_class, flags, meth_name, meth);
8260      /* Patch for the return type */
8261      if (patch_stage == JDEP_METHOD_RETURN)
8262	{
8263	  jdep = CLASSD_LAST (ctxp->classd_list);
8264	  JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth));
8265	}
8266      /* This is the stop JDEP. METH allows the function's signature
8267	 to be computed. */
8268      register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE);
8269    }
8270  else
8271    meth = add_method (this_class, flags, meth_name,
8272		       build_java_signature (meth));
8273
8274  /* Remember final parameters */
8275  MARK_FINAL_PARMS (meth, orig_arg);
8276
8277  /* Fix the method argument list so we have the argument name
8278     information */
8279  fix_method_argument_names (orig_arg, meth);
8280
8281  /* Register the parameter number and re-install the current line
8282     number */
8283  DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1;
8284  lineno = saved_lineno;
8285
8286  /* Register exception specified by the `throws' keyword for
8287     resolution and set the method decl appropriate field to the list.
8288     Note: the grammar ensures that what we get here are class
8289     types. */
8290  if (throws)
8291    {
8292      throws = nreverse (throws);
8293      for (current = throws; current; current = TREE_CHAIN (current))
8294	{
8295	  register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current),
8296				    NULL_TREE, NULL_TREE);
8297	  JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
8298	    &TREE_VALUE (current);
8299	}
8300      DECL_FUNCTION_THROWS (meth) = throws;
8301    }
8302
8303  if (TREE_TYPE (GET_CPC ()) != object_type_node)
8304    DECL_FUNCTION_WFL (meth) = id;
8305
8306  /* Set the flag if we correctly processed a constructor */
8307  if (constructor_ok)
8308    {
8309      DECL_CONSTRUCTOR_P (meth) = 1;
8310      /* Compute and store the number of artificial parameters declared
8311	 for this constructor */
8312      for (count = 0, current = TYPE_FIELDS (this_class); current;
8313	   current = TREE_CHAIN (current))
8314	if (FIELD_LOCAL_ALIAS (current))
8315	  count++;
8316      DECL_FUNCTION_NAP (meth) = count;
8317    }
8318
8319  /* Eventually set the @deprecated tag flag */
8320  CHECK_DEPRECATED (meth);
8321
8322  /* If doing xref, store column and line number information instead
8323     of the line number only. */
8324  if (flag_emit_xref)
8325    DECL_SOURCE_LINE (meth) = EXPR_WFL_LINECOL (id);
8326
8327  return meth;
8328}
8329
8330static void
8331fix_method_argument_names (orig_arg, meth)
8332    tree orig_arg, meth;
8333{
8334  tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth));
8335  if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE)
8336    {
8337      TREE_PURPOSE (arg) = this_identifier_node;
8338      arg = TREE_CHAIN (arg);
8339    }
8340  while (orig_arg != end_params_node)
8341    {
8342      TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg);
8343      orig_arg = TREE_CHAIN (orig_arg);
8344      arg = TREE_CHAIN (arg);
8345    }
8346}
8347
8348/* Complete the method declaration with METHOD_BODY.  */
8349
8350static void
8351finish_method_declaration (method_body)
8352     tree method_body;
8353{
8354  int flags;
8355
8356  if (!current_function_decl)
8357    return;
8358
8359  flags = get_access_flags_from_decl (current_function_decl);
8360
8361  /* 8.4.5 Method Body */
8362  if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
8363    {
8364      tree name = DECL_NAME (current_function_decl);
8365      parse_error_context (DECL_FUNCTION_WFL (current_function_decl),
8366			   "%s method `%s' can't have a body defined",
8367			   (METHOD_NATIVE (current_function_decl) ?
8368			    "Native" : "Abstract"),
8369			   IDENTIFIER_POINTER (name));
8370      method_body = NULL_TREE;
8371    }
8372  else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body)
8373    {
8374      tree name = DECL_NAME (current_function_decl);
8375      parse_error_context
8376	(DECL_FUNCTION_WFL (current_function_decl),
8377	 "Non native and non abstract method `%s' must have a body defined",
8378	 IDENTIFIER_POINTER (name));
8379      method_body = NULL_TREE;
8380    }
8381
8382  if (flag_emit_class_files && method_body
8383      && TREE_CODE (method_body) == NOP_EXPR
8384      && TREE_TYPE (current_function_decl)
8385      && TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node)
8386    method_body = build1 (RETURN_EXPR, void_type_node, NULL);
8387
8388  BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body;
8389  maybe_absorb_scoping_blocks ();
8390  /* Exit function's body */
8391  exit_block ();
8392  /* Merge last line of the function with first line, directly in the
8393     function decl. It will be used to emit correct debug info. */
8394  if (!flag_emit_xref)
8395    DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1);
8396
8397  /* Since function's argument's list are shared, reset the
8398     ARG_FINAL_P parameter that might have been set on some of this
8399     function parameters. */
8400  UNMARK_FINAL_PARMS (current_function_decl);
8401
8402  /* So we don't have an irrelevant function declaration context for
8403     the next static block we'll see. */
8404  current_function_decl = NULL_TREE;
8405}
8406
8407/* Build a an error message for constructor circularity errors.  */
8408
8409static char *
8410constructor_circularity_msg (from, to)
8411     tree from, to;
8412{
8413  static char string [4096];
8414  char *t = xstrdup (lang_printable_name (from, 0));
8415  sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
8416  free (t);
8417  return string;
8418}
8419
8420/* Verify a circular call to METH. Return 1 if an error is found, 0
8421   otherwise.  */
8422
8423static GTY(()) tree vcc_list;
8424static int
8425verify_constructor_circularity (meth, current)
8426     tree meth, current;
8427{
8428  tree c;
8429
8430  for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
8431    {
8432      if (TREE_VALUE (c) == meth)
8433	{
8434	  char *t;
8435	  if (vcc_list)
8436	    {
8437	      tree liste;
8438	      vcc_list = nreverse (vcc_list);
8439	      for (liste = vcc_list; liste; liste = TREE_CHAIN (liste))
8440		{
8441		  parse_error_context
8442		    (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
8443		     constructor_circularity_msg
8444		      (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
8445		  java_error_count--;
8446		}
8447	    }
8448	  t = xstrdup (lang_printable_name (meth, 0));
8449	  parse_error_context (TREE_PURPOSE (c),
8450			       "%s: recursive invocation of constructor `%s'",
8451			       constructor_circularity_msg (current, meth), t);
8452	  free (t);
8453	  vcc_list = NULL_TREE;
8454	  return 1;
8455	}
8456    }
8457  for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
8458    {
8459      vcc_list = tree_cons (c, current, vcc_list);
8460      if (verify_constructor_circularity (meth, TREE_VALUE (c)))
8461	return 1;
8462      vcc_list = TREE_CHAIN (vcc_list);
8463    }
8464  return 0;
8465}
8466
8467/* Check modifiers that can be declared but exclusively */
8468
8469static void
8470check_modifiers_consistency (flags)
8471     int flags;
8472{
8473  int acc_count = 0;
8474  tree cl = NULL_TREE;
8475
8476  THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, PUBLIC_TK, acc_count, cl);
8477  THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, PRIVATE_TK, acc_count, cl);
8478  THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, PROTECTED_TK, acc_count, cl);
8479  if (acc_count > 1)
8480    parse_error_context
8481      (cl, "Inconsistent member declaration.  At most one of `public', `private', or `protected' may be specified");
8482
8483  acc_count = 0;
8484  cl = NULL_TREE;
8485  THIS_MODIFIER_ONLY (flags, ACC_FINAL, FINAL_TK, acc_count, cl);
8486  THIS_MODIFIER_ONLY (flags, ACC_VOLATILE, VOLATILE_TK, acc_count, cl);
8487  if (acc_count > 1)
8488    parse_error_context (cl,
8489			 "Inconsistent member declaration.  At most one of `final' or `volatile' may be specified");
8490}
8491
8492/* Check the methode header METH for abstract specifics features */
8493
8494static void
8495check_abstract_method_header (meth)
8496     tree meth;
8497{
8498  int flags = get_access_flags_from_decl (meth);
8499
8500  OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags,
8501			      ACC_ABSTRACT, "abstract method",
8502			      IDENTIFIER_POINTER (DECL_NAME (meth)));
8503  OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags,
8504			      ACC_PUBLIC, "abstract method",
8505			      IDENTIFIER_POINTER (DECL_NAME (meth)));
8506
8507  check_modifiers ("Illegal modifier `%s' for interface method",
8508		  flags, INTERFACE_METHOD_MODIFIERS);
8509}
8510
8511/* Create a FUNCTION_TYPE node and start augmenting it with the
8512   declared function arguments. Arguments type that can't be resolved
8513   are left as they are, but the returned node is marked as containing
8514   incomplete types.  */
8515
8516static tree
8517method_declarator (id, list)
8518     tree id, list;
8519{
8520  tree arg_types = NULL_TREE, current, node;
8521  tree meth = make_node (FUNCTION_TYPE);
8522  jdep *jdep;
8523
8524  patch_stage = JDEP_NO_PATCH;
8525
8526  if (GET_CPC () == error_mark_node)
8527    return error_mark_node;
8528
8529  /* If we're dealing with an inner class constructor, we hide the
8530     this$<n> decl in the name field of its parameter declaration.  We
8531     also might have to hide the outer context local alias
8532     initializers. Not done when the class is a toplevel class. */
8533  if (PURE_INNER_CLASS_DECL_P (GET_CPC ())
8534      && EXPR_WFL_NODE (id) == GET_CPC_UN ())
8535    {
8536      tree aliases_list, type, thisn;
8537      /* First the aliases, linked to the regular parameters */
8538      aliases_list =
8539	build_alias_initializer_parameter_list (AIPL_FUNCTION_DECLARATION,
8540						TREE_TYPE (GET_CPC ()),
8541						NULL_TREE, NULL);
8542      list = chainon (nreverse (aliases_list), list);
8543
8544      /* Then this$<n> */
8545      type = TREE_TYPE (DECL_CONTEXT (GET_CPC ()));
8546      thisn = build_current_thisn (TREE_TYPE (GET_CPC ()));
8547      list = tree_cons (build_wfl_node (thisn), build_pointer_type (type),
8548			list);
8549    }
8550
8551  for (current = list; current; current = TREE_CHAIN (current))
8552    {
8553      int must_chain = 0;
8554      tree wfl_name = TREE_PURPOSE (current);
8555      tree type = TREE_VALUE (current);
8556      tree name = EXPR_WFL_NODE (wfl_name);
8557      tree already, arg_node;
8558      tree type_wfl = NULL_TREE;
8559      tree real_type;
8560
8561      /* Obtain a suitable type for resolution, if necessary */
8562      SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
8563
8564      /* Process NAME, as it may specify extra dimension(s) for it */
8565      type = build_array_from_name (type, type_wfl, name, &name);
8566      EXPR_WFL_NODE (wfl_name) = name;
8567
8568      real_type = GET_REAL_TYPE (type);
8569      if (TREE_CODE (real_type) == RECORD_TYPE)
8570	{
8571	  real_type = promote_type (real_type);
8572	  if (TREE_CODE (type) == TREE_LIST)
8573	    TREE_PURPOSE (type) = real_type;
8574	}
8575
8576      /* Check redefinition */
8577      for (already = arg_types; already; already = TREE_CHAIN (already))
8578	if (TREE_PURPOSE (already) == name)
8579	  {
8580	    parse_error_context
8581	      (wfl_name, "Variable `%s' is used more than once in the argument list of method `%s'",
8582	       IDENTIFIER_POINTER (name),
8583	       IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
8584	    break;
8585	  }
8586
8587      /* If we've an incomplete argument type, we know there is a location
8588	 to patch when the type get resolved, later.  */
8589      jdep = NULL;
8590      if (must_chain)
8591	{
8592	  patch_stage = JDEP_METHOD;
8593	  type = register_incomplete_type (patch_stage,
8594					   type_wfl, wfl_name, type);
8595	  jdep = CLASSD_LAST (ctxp->classd_list);
8596	  JDEP_MISC (jdep) = id;
8597	}
8598
8599      /* The argument node: a name and a (possibly) incomplete type.  */
8600      arg_node = build_tree_list (name, real_type);
8601      /* Remeber arguments declared final. */
8602      ARG_FINAL_P (arg_node) = ARG_FINAL_P (current);
8603
8604      if (jdep)
8605	JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node);
8606      TREE_CHAIN (arg_node) = arg_types;
8607      arg_types = arg_node;
8608    }
8609  TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node);
8610  node = build_tree_list (id, meth);
8611  return node;
8612}
8613
8614static int
8615unresolved_type_p (wfl, returned)
8616     tree wfl;
8617     tree *returned;
8618
8619{
8620  if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
8621    {
8622      if (returned)
8623	{
8624	  tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
8625	  if (decl && current_class && (decl == TYPE_NAME (current_class)))
8626	    *returned = TREE_TYPE (decl);
8627	  else if (GET_CPC_UN () == EXPR_WFL_NODE (wfl))
8628	    *returned = TREE_TYPE (GET_CPC ());
8629	  else
8630	    *returned = NULL_TREE;
8631	}
8632      return 1;
8633    }
8634  if (returned)
8635    *returned = wfl;
8636  return 0;
8637}
8638
8639/* From NAME, build a qualified identifier node using the
8640   qualification from the current package definition. */
8641
8642static tree
8643parser_qualified_classname (name)
8644     tree name;
8645{
8646  tree nested_class_name;
8647
8648  if ((nested_class_name = maybe_make_nested_class_name (name)))
8649    return nested_class_name;
8650
8651  if (ctxp->package)
8652    return merge_qualified_name (ctxp->package, name);
8653  else
8654    return name;
8655}
8656
8657/* Called once the type a interface extends is resolved. Returns 0 if
8658   everything is OK.  */
8659
8660static int
8661parser_check_super_interface (super_decl, this_decl, this_wfl)
8662     tree super_decl, this_decl, this_wfl;
8663{
8664  tree super_type = TREE_TYPE (super_decl);
8665
8666  /* Has to be an interface */
8667  if (!CLASS_INTERFACE (super_decl))
8668    {
8669      parse_error_context
8670	(this_wfl, "%s `%s' can't implement/extend %s `%s'",
8671	 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
8672	  "Interface" : "Class"),
8673	 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
8674	 (TYPE_ARRAY_P (super_type) ? "array" : "class"),
8675	 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
8676      return 1;
8677    }
8678
8679  /* Check top-level interface access. Inner classes are subject to member
8680     access rules (6.6.1). */
8681  if (! INNER_CLASS_P (super_type)
8682      && check_pkg_class_access (DECL_NAME (super_decl),
8683				 lookup_cl (this_decl), true))
8684    return 1;
8685
8686  SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
8687			  IDENTIFIER_POINTER (DECL_NAME (this_decl)),
8688			  IDENTIFIER_POINTER (DECL_NAME (super_decl))));
8689  return 0;
8690}
8691
8692/* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
8693   0 if everthing is OK.  */
8694
8695static int
8696parser_check_super (super_decl, this_decl, wfl)
8697     tree super_decl, this_decl, wfl;
8698{
8699  tree super_type = TREE_TYPE (super_decl);
8700
8701  /* SUPER should be a CLASS (neither an array nor an interface) */
8702  if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type)))
8703    {
8704      parse_error_context
8705	(wfl, "Class `%s' can't subclass %s `%s'",
8706	 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
8707	 (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"),
8708	 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
8709      return 1;
8710    }
8711
8712  if (CLASS_FINAL (TYPE_NAME (super_type)))
8713    {
8714      parse_error_context (wfl, "Can't subclass final classes: %s",
8715			   IDENTIFIER_POINTER (DECL_NAME (super_decl)));
8716      return 1;
8717    }
8718
8719  /* Check top-level class scope. Inner classes are subject to member access
8720     rules (6.6.1). */
8721  if (! INNER_CLASS_P (super_type)
8722      && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true)))
8723    return 1;
8724
8725  SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
8726			  IDENTIFIER_POINTER (DECL_NAME (this_decl)),
8727			  IDENTIFIER_POINTER (DECL_NAME (super_decl))));
8728  return 0;
8729}
8730
8731/* Create a new dependency list and link it (in a LIFO manner) to the
8732   CTXP list of type dependency list.  */
8733
8734static void
8735create_jdep_list (ctxp)
8736     struct parser_ctxt *ctxp;
8737{
8738  jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist));
8739  new->first = new->last = NULL;
8740  new->next = ctxp->classd_list;
8741  ctxp->classd_list = new;
8742}
8743
8744static jdeplist *
8745reverse_jdep_list (ctxp)
8746     struct parser_ctxt *ctxp;
8747{
8748  register jdeplist *prev = NULL, *current, *next;
8749  for (current = ctxp->classd_list; current; current = next)
8750    {
8751      next = current->next;
8752      current->next = prev;
8753      prev = current;
8754    }
8755  return prev;
8756}
8757
8758/* Create a fake pointer based on the ID stored in
8759   TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
8760   registered again. */
8761
8762static tree
8763obtain_incomplete_type (type_name)
8764     tree type_name;
8765{
8766  tree ptr = NULL_TREE, name;
8767
8768  if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION)
8769    name = EXPR_WFL_NODE (type_name);
8770  else if (INCOMPLETE_TYPE_P (type_name))
8771    name = TYPE_NAME (type_name);
8772  else
8773    abort ();
8774
8775  BUILD_PTR_FROM_NAME (ptr, name);
8776  layout_type (ptr);
8777
8778  return ptr;
8779}
8780
8781/* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
8782   non NULL instead of computing a new fake type based on WFL. The new
8783   dependency is inserted in the current type dependency list, in FIFO
8784   manner.  */
8785
8786static tree
8787register_incomplete_type (kind, wfl, decl, ptr)
8788     int kind;
8789     tree wfl, decl, ptr;
8790{
8791  jdep *new = (jdep *)xmalloc (sizeof (jdep));
8792
8793  if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */
8794    ptr = obtain_incomplete_type (wfl);
8795
8796  JDEP_KIND (new) = kind;
8797  JDEP_DECL (new) = decl;
8798  JDEP_TO_RESOLVE (new) = ptr;
8799  JDEP_WFL (new) = wfl;
8800  JDEP_CHAIN (new) = NULL;
8801  JDEP_MISC (new) = NULL_TREE;
8802  /* For some dependencies, set the enclosing class of the current
8803     class to be the enclosing context */
8804  if ((kind == JDEP_INTERFACE  || kind == JDEP_ANONYMOUS)
8805      && GET_ENCLOSING_CPC ())
8806    JDEP_ENCLOSING (new) = TREE_VALUE (GET_ENCLOSING_CPC ());
8807  else if (kind == JDEP_SUPER)
8808    JDEP_ENCLOSING (new) = (GET_ENCLOSING_CPC () ?
8809			    TREE_VALUE (GET_ENCLOSING_CPC ()) : NULL_TREE);
8810  else
8811    JDEP_ENCLOSING (new) = GET_CPC ();
8812  JDEP_GET_PATCH (new) = (tree *)NULL;
8813
8814  JDEP_INSERT (ctxp->classd_list, new);
8815
8816  return ptr;
8817}
8818
8819/* This checks for circular references with innerclasses. We start
8820   from SOURCE and should never reach TARGET. Extended/implemented
8821   types in SOURCE have their enclosing context checked not to reach
8822   TARGET. When the last enclosing context of SOURCE is reached, its
8823   extended/implemented types are also checked not to reach TARGET.
8824   In case of error, WFL of the offending type is returned; NULL_TREE
8825   otherwise.  */
8826
8827static tree
8828check_inner_circular_reference (source, target)
8829     tree source;
8830     tree target;
8831{
8832  tree basetype_vec = TYPE_BINFO_BASETYPES (source);
8833  tree ctx, cl;
8834  int i;
8835
8836  if (!basetype_vec)
8837    return NULL_TREE;
8838
8839  for (i = 0; i < TREE_VEC_LENGTH (basetype_vec); i++)
8840    {
8841      tree su;
8842
8843      /* We can end up with a NULL_TREE or an incomplete type here if
8844	 we encountered previous type resolution errors. It's safe to
8845	 simply ignore these cases.  */
8846      if (TREE_VEC_ELT (basetype_vec, i) == NULL_TREE)
8847	continue;
8848      su = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
8849      if (INCOMPLETE_TYPE_P (su))
8850	continue;
8851
8852      if (inherits_from_p (su, target))
8853	return lookup_cl (TYPE_NAME (su));
8854
8855      for (ctx = DECL_CONTEXT (TYPE_NAME (su)); ctx; ctx = DECL_CONTEXT (ctx))
8856	{
8857	  /* An enclosing context shouldn't be TARGET */
8858	  if (ctx == TYPE_NAME (target))
8859	    return lookup_cl (TYPE_NAME (su));
8860
8861	  /* When we reach the enclosing last context, start a check
8862	     on it, with the same target */
8863	  if (! DECL_CONTEXT (ctx) &&
8864	      (cl = check_inner_circular_reference (TREE_TYPE (ctx), target)))
8865	    return cl;
8866	}
8867    }
8868  return NULL_TREE;
8869}
8870
8871/* Explore TYPE's `extends' clause member(s) and return the WFL of the
8872   offending type if a circularity is detected. NULL_TREE is returned
8873   otherwise. TYPE can be an interface or a class.   */
8874
8875static tree
8876check_circular_reference (type)
8877     tree type;
8878{
8879  tree basetype_vec = TYPE_BINFO_BASETYPES (type);
8880  int i;
8881
8882  if (!basetype_vec)
8883    return NULL_TREE;
8884
8885  if (! CLASS_INTERFACE (TYPE_NAME (type)))
8886    {
8887      if (inherits_from_p (CLASSTYPE_SUPER (type), type))
8888	return lookup_cl (TYPE_NAME (type));
8889      return NULL_TREE;
8890    }
8891
8892  for (i = 0; i < TREE_VEC_LENGTH (basetype_vec); i++)
8893    {
8894      tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
8895      if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node
8896	  && interface_of_p (type, BINFO_TYPE (vec_elt)))
8897	return lookup_cl (TYPE_NAME (BINFO_TYPE (vec_elt)));
8898    }
8899  return NULL_TREE;
8900}
8901
8902void
8903java_check_circular_reference ()
8904{
8905  tree current;
8906  for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
8907    {
8908      tree type = TREE_TYPE (current);
8909      tree cl;
8910
8911      cl = check_circular_reference (type);
8912      if (! cl)
8913	cl = check_inner_circular_reference (type, type);
8914      if (cl)
8915	parse_error_context (cl, "Cyclic class inheritance%s",
8916			     (cyclic_inheritance_report ?
8917			      cyclic_inheritance_report : ""));
8918    }
8919}
8920
8921/* Augment the parameter list PARM with parameters crafted to
8922   initialize outer context locals aliases. Through ARTIFICIAL, a
8923   count is kept of the number of crafted parameters. MODE governs
8924   what eventually gets created: something suitable for a function
8925   creation or a function invocation, either the constructor or
8926   finit$.  */
8927
8928static tree
8929build_alias_initializer_parameter_list (mode, class_type, parm, artificial)
8930    int mode;
8931    tree class_type, parm;
8932    int *artificial;
8933{
8934  tree field;
8935  tree additional_parms = NULL_TREE;
8936
8937  for (field = TYPE_FIELDS (class_type); field; field = TREE_CHAIN (field))
8938    if (FIELD_LOCAL_ALIAS (field))
8939      {
8940	const char *buffer = IDENTIFIER_POINTER (DECL_NAME (field));
8941	tree purpose = NULL_TREE, value = NULL_TREE, name = NULL_TREE;
8942	tree mangled_id;
8943
8944	switch (mode)
8945	  {
8946	  case AIPL_FUNCTION_DECLARATION:
8947	    MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
8948							 &buffer [4]);
8949	    purpose = build_wfl_node (mangled_id);
8950	    if (TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE)
8951	      value = build_wfl_node (TYPE_NAME (TREE_TYPE (field)));
8952	    else
8953	      value = TREE_TYPE (field);
8954	    break;
8955
8956	  case AIPL_FUNCTION_CREATION:
8957	    MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (purpose,
8958							 &buffer [4]);
8959	    value = TREE_TYPE (field);
8960	    break;
8961
8962	  case AIPL_FUNCTION_FINIT_INVOCATION:
8963	    MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
8964							 &buffer [4]);
8965	    /* Now, this is wrong. purpose should always be the NAME
8966	       of something and value its matching value (decl, type,
8967	       etc...) FIXME -- but there is a lot to fix. */
8968
8969	    /* When invoked for this kind of operation, we already
8970	       know whether a field is used or not. */
8971	    purpose = TREE_TYPE (field);
8972	    value = build_wfl_node (mangled_id);
8973	    break;
8974
8975	  case AIPL_FUNCTION_CTOR_INVOCATION:
8976	    /* There are two case: the constructor invokation happends
8977	       outside the local inner, in which case, locales from the outer
8978	       context are directly used.
8979
8980	       Otherwise, we fold to using the alias directly. */
8981	    if (class_type == current_class)
8982	      value = field;
8983	    else
8984	      {
8985		name = get_identifier (&buffer[4]);
8986		value = IDENTIFIER_LOCAL_VALUE (name);
8987	      }
8988	    break;
8989	  }
8990	additional_parms = tree_cons (purpose, value, additional_parms);
8991	if (artificial)
8992	  *artificial +=1;
8993      }
8994  if (additional_parms)
8995    {
8996      if (ANONYMOUS_CLASS_P (class_type)
8997          && mode == AIPL_FUNCTION_CTOR_INVOCATION)
8998        additional_parms = nreverse (additional_parms);
8999      parm = chainon (additional_parms, parm);
9000    }
9001
9002   return parm;
9003}
9004
9005/* Craft a constructor for CLASS_DECL -- what we should do when none
9006   where found. ARGS is non NULL when a special signature must be
9007   enforced. This is the case for anonymous classes.  */
9008
9009static tree
9010craft_constructor (class_decl, args)
9011     tree class_decl, args;
9012{
9013  tree class_type = TREE_TYPE (class_decl);
9014  tree parm = NULL_TREE;
9015  int flags = (get_access_flags_from_decl (class_decl) & ACC_PUBLIC ?
9016	       ACC_PUBLIC : 0);
9017  int i = 0, artificial = 0;
9018  tree decl, ctor_name;
9019  char buffer [80];
9020
9021  /* The constructor name is <init> unless we're dealing with an
9022     anonymous class, in which case the name will be fixed after having
9023     be expanded. */
9024  if (ANONYMOUS_CLASS_P (class_type))
9025    ctor_name = DECL_NAME (class_decl);
9026  else
9027    ctor_name = init_identifier_node;
9028
9029  /* If we're dealing with an inner class constructor, we hide the
9030     this$<n> decl in the name field of its parameter declaration. */
9031  if (PURE_INNER_CLASS_TYPE_P (class_type))
9032    {
9033      tree type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class_type)));
9034      parm = tree_cons (build_current_thisn (class_type),
9035			build_pointer_type (type), parm);
9036
9037      /* Some more arguments to be hidden here. The values of the local
9038	 variables of the outer context that the inner class needs to see. */
9039      parm = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION,
9040						     class_type, parm,
9041						     &artificial);
9042    }
9043
9044  /* Then if there are any args to be enforced, enforce them now */
9045  for (; args && args != end_params_node; args = TREE_CHAIN (args))
9046    {
9047      sprintf (buffer, "parm%d", i++);
9048      parm = tree_cons (get_identifier (buffer), TREE_VALUE (args), parm);
9049    }
9050
9051  CRAFTED_PARAM_LIST_FIXUP (parm);
9052  decl = create_artificial_method (class_type, flags, void_type_node,
9053				   ctor_name, parm);
9054  fix_method_argument_names (parm, decl);
9055  /* Now, mark the artificial parameters. */
9056  DECL_FUNCTION_NAP (decl) = artificial;
9057  DECL_FUNCTION_SYNTHETIC_CTOR (decl) = DECL_CONSTRUCTOR_P (decl) = 1;
9058  return decl;
9059}
9060
9061
9062/* Fix the constructors. This will be called right after circular
9063   references have been checked. It is necessary to fix constructors
9064   early even if no code generation will take place for that class:
9065   some generated constructor might be required by the class whose
9066   compilation triggered this one to be simply loaded.  */
9067
9068void
9069java_fix_constructors ()
9070{
9071  tree current;
9072
9073  for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
9074    {
9075      tree class_type = TREE_TYPE (current);
9076      int saw_ctor = 0;
9077      tree decl;
9078
9079      if (CLASS_INTERFACE (TYPE_NAME (class_type)))
9080	continue;
9081
9082      current_class = class_type;
9083      for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
9084	{
9085	  if (DECL_CONSTRUCTOR_P (decl))
9086	    {
9087	      fix_constructors (decl);
9088	      saw_ctor = 1;
9089	    }
9090	}
9091
9092      /* Anonymous class constructor can't be generated that early. */
9093      if (!saw_ctor && !ANONYMOUS_CLASS_P (class_type))
9094	craft_constructor (current, NULL_TREE);
9095    }
9096}
9097
9098/* safe_layout_class just makes sure that we can load a class without
9099   disrupting the current_class, input_file, lineno, etc, information
9100   about the class processed currently.  */
9101
9102void
9103safe_layout_class (class)
9104     tree class;
9105{
9106  tree save_current_class = current_class;
9107  const char *save_input_filename = input_filename;
9108  int save_lineno = lineno;
9109
9110  layout_class (class);
9111
9112  current_class = save_current_class;
9113  input_filename = save_input_filename;
9114  lineno = save_lineno;
9115}
9116
9117static tree
9118jdep_resolve_class (dep)
9119     jdep *dep;
9120{
9121  tree decl;
9122
9123  if (JDEP_RESOLVED_P (dep))
9124    decl = JDEP_RESOLVED_DECL (dep);
9125  else
9126    {
9127      decl = resolve_class (JDEP_ENCLOSING (dep), JDEP_TO_RESOLVE (dep),
9128			    JDEP_DECL (dep), JDEP_WFL (dep));
9129      JDEP_RESOLVED (dep, decl);
9130    }
9131
9132  if (!decl)
9133    complete_class_report_errors (dep);
9134  else if (PURE_INNER_CLASS_DECL_P (decl))
9135    {
9136      tree inner = TREE_TYPE (decl);
9137      if (! CLASS_LOADED_P (inner))
9138	{
9139	  safe_layout_class (inner);
9140	  if (TYPE_SIZE (inner) == error_mark_node)
9141	    TYPE_SIZE (inner) = NULL_TREE;
9142	}
9143      check_inner_class_access (decl, JDEP_ENCLOSING (dep), JDEP_WFL (dep));
9144    }
9145  return decl;
9146}
9147
9148/* Complete unsatisfied class declaration and their dependencies */
9149
9150void
9151java_complete_class ()
9152{
9153  tree cclass;
9154  jdeplist *cclassd;
9155  int error_found;
9156  tree type;
9157
9158  /* Process imports */
9159  process_imports ();
9160
9161  /* Reverse things so we have the right order */
9162  ctxp->class_list = nreverse (ctxp->class_list);
9163  ctxp->classd_list = reverse_jdep_list (ctxp);
9164
9165  for (cclassd = ctxp->classd_list, cclass = ctxp->class_list;
9166       cclass && cclassd;
9167       cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd))
9168    {
9169      jdep *dep;
9170
9171      /* We keep the compilation unit imports in the class so that
9172	 they can be used later to resolve type dependencies that
9173	 aren't necessary to solve now. */
9174      TYPE_IMPORT_LIST (TREE_TYPE (cclass)) = ctxp->import_list;
9175      TYPE_IMPORT_DEMAND_LIST (TREE_TYPE (cclass)) = ctxp->import_demand_list;
9176
9177      for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep))
9178	{
9179	  tree decl;
9180	  if (!(decl = jdep_resolve_class (dep)))
9181	    continue;
9182
9183	  /* Now it's time to patch */
9184	  switch (JDEP_KIND (dep))
9185	    {
9186	    case JDEP_SUPER:
9187	      /* Simply patch super */
9188	      if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
9189		continue;
9190	      BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
9191	        (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
9192	      break;
9193
9194	    case JDEP_FIELD:
9195	      {
9196		/* We do part of the job done in add_field */
9197		tree field_decl = JDEP_DECL (dep);
9198		tree field_type = TREE_TYPE (decl);
9199		if (TREE_CODE (field_type) == RECORD_TYPE)
9200		  field_type = promote_type (field_type);
9201		TREE_TYPE (field_decl) = field_type;
9202		DECL_ALIGN (field_decl) = 0;
9203		DECL_USER_ALIGN (field_decl) = 0;
9204		layout_decl (field_decl, 0);
9205		SOURCE_FRONTEND_DEBUG
9206		  (("Completed field/var decl `%s' with `%s'",
9207		    IDENTIFIER_POINTER (DECL_NAME (field_decl)),
9208		    IDENTIFIER_POINTER (DECL_NAME (decl))));
9209		break;
9210	      }
9211	    case JDEP_METHOD:	/* We start patching a method */
9212	    case JDEP_METHOD_RETURN:
9213	      error_found = 0;
9214	      while (1)
9215		{
9216		  if (decl)
9217		    {
9218		      type = TREE_TYPE(decl);
9219		      if (TREE_CODE (type) == RECORD_TYPE)
9220			type = promote_type (type);
9221		      JDEP_APPLY_PATCH (dep, type);
9222		      SOURCE_FRONTEND_DEBUG
9223			(((JDEP_KIND (dep) == JDEP_METHOD_RETURN ?
9224			   "Completing fct `%s' with ret type `%s'":
9225			   "Completing arg `%s' with type `%s'"),
9226			  IDENTIFIER_POINTER (EXPR_WFL_NODE
9227					      (JDEP_DECL_WFL (dep))),
9228			  IDENTIFIER_POINTER (DECL_NAME (decl))));
9229		    }
9230		  else
9231		    error_found = 1;
9232		  dep = JDEP_CHAIN (dep);
9233		  if (JDEP_KIND (dep) == JDEP_METHOD_END)
9234		    break;
9235		  else
9236		    decl = jdep_resolve_class (dep);
9237		}
9238	      if (!error_found)
9239		{
9240		  tree mdecl = JDEP_DECL (dep), signature;
9241		  /* Recompute and reset the signature, check first that
9242		     all types are now defined. If they're not,
9243		     don't build the signature. */
9244		  if (check_method_types_complete (mdecl))
9245		    {
9246		      signature = build_java_signature (TREE_TYPE (mdecl));
9247		      set_java_signature (TREE_TYPE (mdecl), signature);
9248		    }
9249		}
9250	      else
9251		continue;
9252	      break;
9253
9254	    case JDEP_INTERFACE:
9255	      if (parser_check_super_interface (decl, JDEP_DECL (dep),
9256						JDEP_WFL (dep)))
9257		continue;
9258	      parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep));
9259	      break;
9260
9261	    case JDEP_PARM:
9262	    case JDEP_VARIABLE:
9263	      type = TREE_TYPE(decl);
9264	      if (TREE_CODE (type) == RECORD_TYPE)
9265		type = promote_type (type);
9266	      JDEP_APPLY_PATCH (dep, type);
9267	      break;
9268
9269	    case JDEP_TYPE:
9270	      JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
9271	      SOURCE_FRONTEND_DEBUG
9272		(("Completing a random type dependency on a '%s' node",
9273		  tree_code_name [TREE_CODE (JDEP_DECL (dep))]));
9274	      break;
9275
9276	    case JDEP_EXCEPTION:
9277	      JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
9278	      SOURCE_FRONTEND_DEBUG
9279		(("Completing `%s' `throws' argument node",
9280		  IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))));
9281	      break;
9282
9283	    case JDEP_ANONYMOUS:
9284	      patch_anonymous_class (decl, JDEP_DECL (dep), JDEP_WFL (dep));
9285	      break;
9286
9287	    default:
9288	      abort ();
9289	    }
9290	}
9291    }
9292  return;
9293}
9294
9295/* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
9296   array.  */
9297
9298static tree
9299resolve_class (enclosing, class_type, decl, cl)
9300     tree enclosing, class_type, decl, cl;
9301{
9302  tree tname = TYPE_NAME (class_type);
9303  tree resolved_type = TREE_TYPE (class_type);
9304  int array_dims = 0;
9305  tree resolved_type_decl;
9306
9307  if (resolved_type != NULL_TREE)
9308    {
9309      tree resolved_type_decl = TYPE_NAME (resolved_type);
9310      if (resolved_type_decl == NULL_TREE
9311	  || TREE_CODE (resolved_type_decl) == IDENTIFIER_NODE)
9312	{
9313	  resolved_type_decl = build_decl (TYPE_DECL,
9314					   TYPE_NAME (class_type),
9315					   resolved_type);
9316	}
9317      return resolved_type_decl;
9318    }
9319
9320  /* 1- Check to see if we have an array. If true, find what we really
9321     want to resolve  */
9322  if ((array_dims = build_type_name_from_array_name (tname,
9323						     &TYPE_NAME (class_type))))
9324    WFL_STRIP_BRACKET (cl, cl);
9325
9326  /* 2- Resolve the bare type */
9327  if (!(resolved_type_decl = do_resolve_class (enclosing, class_type,
9328					       decl, cl)))
9329    return NULL_TREE;
9330  resolved_type = TREE_TYPE (resolved_type_decl);
9331
9332  /* 3- If we have an array, reconstruct the array down to its nesting */
9333  if (array_dims)
9334    {
9335      for (; array_dims; array_dims--)
9336	resolved_type = build_java_array_type (resolved_type, -1);
9337      resolved_type_decl = TYPE_NAME (resolved_type);
9338    }
9339  TREE_TYPE (class_type) = resolved_type;
9340  return resolved_type_decl;
9341}
9342
9343/* Effectively perform the resolution of class CLASS_TYPE.  DECL or CL
9344   are used to report error messages; CL must either be NULL_TREE or a
9345   WFL wrapping a class.  Do not try to replace TYPE_NAME (class_type)
9346   by a variable, since it is changed by find_in_imports{_on_demand}
9347   and (but it doesn't really matter) qualify_and_find.  */
9348
9349tree
9350do_resolve_class (enclosing, class_type, decl, cl)
9351     tree enclosing, class_type, decl, cl;
9352{
9353  tree new_class_decl = NULL_TREE, super = NULL_TREE;
9354  tree saved_enclosing_type = enclosing ? TREE_TYPE (enclosing) : NULL_TREE;
9355  tree decl_result;
9356  htab_t circularity_hash;
9357
9358  if (QUALIFIED_P (TYPE_NAME (class_type)))
9359    {
9360      /* If the type name is of the form `Q . Id', then Q is either a
9361	 package name or a class name.  First we try to find Q as a
9362	 class and then treat Id as a member type.  If we can't find Q
9363	 as a class then we fall through.  */
9364      tree q, left, left_type, right;
9365      if (breakdown_qualified (&left, &right, TYPE_NAME (class_type)) == 0)
9366	{
9367	  BUILD_PTR_FROM_NAME (left_type, left);
9368	  q = do_resolve_class (enclosing, left_type, decl, cl);
9369	  if (q)
9370	    {
9371	      enclosing = q;
9372	      saved_enclosing_type = TREE_TYPE (q);
9373	      BUILD_PTR_FROM_NAME (class_type, right);
9374	    }
9375	}
9376    }
9377
9378  if (enclosing)
9379    {
9380      /* This hash table is used to register the classes we're going
9381	 through when searching the current class as an inner class, in
9382	 order to detect circular references. Remember to free it before
9383	 returning the section 0- of this function. */
9384      circularity_hash = htab_create (20, htab_hash_pointer, htab_eq_pointer,
9385				      NULL);
9386
9387      /* 0- Search in the current class as an inner class.
9388	 Maybe some code here should be added to load the class or
9389	 something, at least if the class isn't an inner class and ended
9390	 being loaded from class file. FIXME. */
9391      while (enclosing)
9392	{
9393	  new_class_decl = resolve_inner_class (circularity_hash, cl, &enclosing,
9394						&super, class_type);
9395	  if (new_class_decl)
9396	    break;
9397
9398	  /* If we haven't found anything because SUPER reached Object and
9399	     ENCLOSING happens to be an innerclass, try the enclosing context. */
9400	  if ((!super || super == object_type_node) &&
9401	      enclosing && INNER_CLASS_DECL_P (enclosing))
9402	    enclosing = DECL_CONTEXT (enclosing);
9403	  else
9404	    enclosing = NULL_TREE;
9405	}
9406
9407      htab_delete (circularity_hash);
9408
9409      if (new_class_decl)
9410	return new_class_decl;
9411    }
9412
9413  /* 1- Check for the type in single imports. This will change
9414     TYPE_NAME() if something relevant is found */
9415  find_in_imports (saved_enclosing_type, class_type);
9416
9417  /* 2- And check for the type in the current compilation unit */
9418  if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
9419    {
9420      if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
9421	  !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
9422	load_class (TYPE_NAME (class_type), 0);
9423      return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
9424    }
9425
9426  /* 3- Search according to the current package definition */
9427  if (!QUALIFIED_P (TYPE_NAME (class_type)))
9428    {
9429      if ((new_class_decl = qualify_and_find (class_type, ctxp->package,
9430					     TYPE_NAME (class_type))))
9431	return new_class_decl;
9432    }
9433
9434  /* 4- Check the import on demands. Don't allow bar.baz to be
9435     imported from foo.* */
9436  if (!QUALIFIED_P (TYPE_NAME (class_type)))
9437    if (find_in_imports_on_demand (saved_enclosing_type, class_type))
9438      return NULL_TREE;
9439
9440  /* If found in find_in_imports_on_demand, the type has already been
9441     loaded. */
9442  if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
9443    return new_class_decl;
9444
9445  /* 5- Try with a name qualified with the package name we've seen so far */
9446  if (!QUALIFIED_P (TYPE_NAME (class_type)))
9447    {
9448      tree package;
9449
9450      /* If there is a current package (ctxp->package), it's the first
9451	 element of package_list and we can skip it. */
9452      for (package = (ctxp->package ?
9453		      TREE_CHAIN (package_list) : package_list);
9454	   package; package = TREE_CHAIN (package))
9455	if ((new_class_decl = qualify_and_find (class_type,
9456					       TREE_PURPOSE (package),
9457					       TYPE_NAME (class_type))))
9458	  return new_class_decl;
9459    }
9460
9461  /* 5- Check another compilation unit that bears the name of type */
9462  load_class (TYPE_NAME (class_type), 0);
9463
9464  if (!cl)
9465    cl = lookup_cl (decl);
9466
9467  /* If we don't have a value for CL, then we're being called recursively.
9468     We can't check package access just yet, but it will be taken care of
9469     by the caller. */
9470  if (cl)
9471    {
9472      if (check_pkg_class_access (TYPE_NAME (class_type), cl, true))
9473        return NULL_TREE;
9474    }
9475
9476  /* 6- Last call for a resolution */
9477  decl_result = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
9478
9479  /* The final lookup might have registered a.b.c into a.b$c If we
9480     failed at the first lookup, progressively change the name if
9481     applicable and use the matching DECL instead. */
9482  if (!decl_result && QUALIFIED_P (TYPE_NAME (class_type)))
9483    {
9484      char *separator;
9485      tree name = TYPE_NAME (class_type);
9486      char *namebuffer = alloca (IDENTIFIER_LENGTH (name) + 1);
9487
9488      strcpy (namebuffer, IDENTIFIER_POINTER (name));
9489
9490      do {
9491
9492       /* Reach the last '.', and if applicable, replace it by a `$' and
9493          see if this exists as a type. */
9494       if ((separator = strrchr (namebuffer, '.')))
9495         {
9496           *separator = '$';
9497           name = get_identifier (namebuffer);
9498           decl_result = IDENTIFIER_CLASS_VALUE (name);
9499         }
9500      } while (!decl_result && separator);
9501    }
9502  return decl_result;
9503}
9504
9505static tree
9506qualify_and_find (class_type, package, name)
9507     tree class_type, package, name;
9508{
9509  tree new_qualified = merge_qualified_name (package, name);
9510  tree new_class_decl;
9511
9512  if (!IDENTIFIER_CLASS_VALUE (new_qualified))
9513    load_class (new_qualified, 0);
9514  if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_qualified)))
9515    {
9516      if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
9517	  !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
9518	load_class (new_qualified, 0);
9519      TYPE_NAME (class_type) = new_qualified;
9520      return IDENTIFIER_CLASS_VALUE (new_qualified);
9521    }
9522  return NULL_TREE;
9523}
9524
9525/* Resolve NAME and lay it out (if not done and if not the current
9526   parsed class). Return a decl node. This function is meant to be
9527   called when type resolution is necessary during the walk pass.  */
9528
9529static tree
9530resolve_and_layout (something, cl)
9531     tree something;
9532     tree cl;
9533{
9534  tree decl, decl_type;
9535
9536  /* Don't do that on the current class */
9537  if (something == current_class)
9538    return TYPE_NAME (current_class);
9539
9540  /* Don't do anything for void and other primitive types */
9541  if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
9542    return NULL_TREE;
9543
9544  /* Pointer types can be reall pointer types or fake pointers. When
9545     finding a real pointer, recheck for primitive types */
9546  if (TREE_CODE (something) == POINTER_TYPE)
9547    {
9548      if (TREE_TYPE (something))
9549	{
9550	  something = TREE_TYPE (something);
9551	  if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
9552	    return NULL_TREE;
9553	}
9554      else
9555	something = TYPE_NAME (something);
9556    }
9557
9558  /* Don't do anything for arrays of primitive types */
9559  if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something)
9560      && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something)))
9561    return NULL_TREE;
9562
9563  /* Something might be a WFL */
9564  if (TREE_CODE (something) == EXPR_WITH_FILE_LOCATION)
9565    something = EXPR_WFL_NODE (something);
9566
9567  /* Otherwise, if something is not and IDENTIFIER_NODE, it can be a a
9568     TYPE_DECL or a real TYPE */
9569  else if (TREE_CODE (something) != IDENTIFIER_NODE)
9570    something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ?
9571	    DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something));
9572
9573  if (!(decl = resolve_no_layout (something, cl)))
9574    return NULL_TREE;
9575
9576  /* Resolve and layout if necessary */
9577  decl_type = TREE_TYPE (decl);
9578  layout_class_methods (decl_type);
9579  /* Check methods */
9580  if (CLASS_FROM_SOURCE_P (decl_type))
9581    java_check_methods (decl);
9582  /* Layout the type if necessary */
9583  if (decl_type != current_class && !CLASS_LOADED_P (decl_type))
9584    safe_layout_class (decl_type);
9585
9586  return decl;
9587}
9588
9589/* Resolve a class, returns its decl but doesn't perform any
9590   layout. The current parsing context is saved and restored */
9591
9592static tree
9593resolve_no_layout (name, cl)
9594     tree name, cl;
9595{
9596  tree ptr, decl;
9597  BUILD_PTR_FROM_NAME (ptr, name);
9598  java_parser_context_save_global ();
9599  decl = resolve_class (TYPE_NAME (current_class), ptr, NULL_TREE, cl);
9600  java_parser_context_restore_global ();
9601
9602  return decl;
9603}
9604
9605/* Called when reporting errors. Skip the '[]'s in a complex array
9606   type description that failed to be resolved. purify_type_name can't
9607   use an identifier tree.  */
9608
9609static const char *
9610purify_type_name (name)
9611     const char *name;
9612{
9613  int len = strlen (name);
9614  int bracket_found;
9615
9616  STRING_STRIP_BRACKETS (name, len, bracket_found);
9617  if (bracket_found)
9618    {
9619      char *stripped_name = xmemdup (name, len, len+1);
9620      stripped_name [len] = '\0';
9621      return stripped_name;
9622    }
9623  return name;
9624}
9625
9626/* The type CURRENT refers to can't be found. We print error messages.  */
9627
9628static void
9629complete_class_report_errors (dep)
9630     jdep *dep;
9631{
9632  const char *name;
9633
9634  if (!JDEP_WFL (dep))
9635    return;
9636
9637  name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)));
9638  switch (JDEP_KIND (dep))
9639    {
9640    case JDEP_SUPER:
9641      parse_error_context
9642	(JDEP_WFL (dep), "Superclass `%s' of class `%s' not found",
9643	 purify_type_name (name),
9644	 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
9645      break;
9646    case JDEP_FIELD:
9647      parse_error_context
9648	(JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'",
9649	 purify_type_name (name),
9650	 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
9651      break;
9652    case JDEP_METHOD:		/* Covers arguments */
9653      parse_error_context
9654	(JDEP_WFL (dep), "Type `%s' not found in the declaration of the argument `%s' of method `%s'",
9655	 purify_type_name (name),
9656	 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))),
9657	 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep))));
9658      break;
9659    case JDEP_METHOD_RETURN:	/* Covers return type */
9660      parse_error_context
9661	(JDEP_WFL (dep), "Type `%s' not found in the declaration of the return type of method `%s'",
9662	 purify_type_name (name),
9663	 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
9664      break;
9665    case JDEP_INTERFACE:
9666      parse_error_context
9667	(JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found",
9668	 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
9669	 (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")),
9670	 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
9671      break;
9672    case JDEP_VARIABLE:
9673      parse_error_context
9674	(JDEP_WFL (dep), "Type `%s' not found in the declaration of the local variable `%s'",
9675	 purify_type_name (IDENTIFIER_POINTER
9676			   (EXPR_WFL_NODE (JDEP_WFL (dep)))),
9677	 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
9678      break;
9679    case JDEP_EXCEPTION:	/* As specified by `throws' */
9680      parse_error_context
9681	  (JDEP_WFL (dep), "Class `%s' not found in `throws'",
9682	 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))));
9683      break;
9684    default:
9685      /* Fix for -Wall. Just break doing nothing. The error will be
9686         caught later */
9687      break;
9688    }
9689}
9690
9691/* Return a static string containing the DECL prototype string. If
9692   DECL is a constructor, use the class name instead of the form
9693   <init> */
9694
9695static const char *
9696get_printable_method_name (decl)
9697     tree decl;
9698{
9699  const char *to_return;
9700  tree name = NULL_TREE;
9701
9702  if (DECL_CONSTRUCTOR_P (decl))
9703    {
9704      name = DECL_NAME (decl);
9705      DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
9706    }
9707
9708  to_return = lang_printable_name (decl, 0);
9709  if (DECL_CONSTRUCTOR_P (decl))
9710    DECL_NAME (decl) = name;
9711
9712  return to_return;
9713}
9714
9715/* Track method being redefined inside the same class. As a side
9716   effect, set DECL_NAME to an IDENTIFIER (prior entering this
9717   function it's a FWL, so we can track errors more accurately.)  */
9718
9719static int
9720check_method_redefinition (class, method)
9721     tree class, method;
9722{
9723  tree redef, sig;
9724
9725  /* There's no need to verify <clinit> and finit$ and instinit$ */
9726  if (DECL_CLINIT_P (method)
9727      || DECL_FINIT_P (method) || DECL_INSTINIT_P (method))
9728    return 0;
9729
9730  sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
9731  for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
9732    {
9733      if (redef == method)
9734	break;
9735      if (DECL_NAME (redef) == DECL_NAME (method)
9736	  && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef))
9737	  && !DECL_ARTIFICIAL (method))
9738	{
9739	  parse_error_context
9740	    (DECL_FUNCTION_WFL (method), "Duplicate %s declaration `%s'",
9741	     (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
9742	     get_printable_method_name (redef));
9743	  return 1;
9744	}
9745    }
9746  return 0;
9747}
9748
9749/* Return 1 if check went ok, 0 otherwise.  */
9750static int
9751check_abstract_method_definitions (do_interface, class_decl, type)
9752     int do_interface;
9753     tree class_decl, type;
9754{
9755  tree class = TREE_TYPE (class_decl);
9756  tree method, end_type;
9757  int ok = 1;
9758
9759  end_type = (do_interface ? object_type_node : type);
9760  for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
9761    {
9762      tree other_super, other_method, method_sig, method_name;
9763      int found = 0;
9764      int end_type_reached = 0;
9765
9766      if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
9767	continue;
9768
9769      /* Now verify that somewhere in between TYPE and CLASS,
9770	 abstract method METHOD gets a non abstract definition
9771	 that is inherited by CLASS.  */
9772
9773      method_sig = build_java_signature (TREE_TYPE (method));
9774      method_name = DECL_NAME (method);
9775      if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
9776	method_name = EXPR_WFL_NODE (method_name);
9777
9778      other_super = class;
9779      do {
9780	if (other_super == end_type)
9781	  end_type_reached = 1;
9782
9783	/* Method search */
9784	for (other_method = TYPE_METHODS (other_super); other_method;
9785            other_method = TREE_CHAIN (other_method))
9786	  {
9787	    tree s = build_java_signature (TREE_TYPE (other_method));
9788	    tree other_name = DECL_NAME (other_method);
9789
9790	    if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
9791	      other_name = EXPR_WFL_NODE (other_name);
9792	    if (!DECL_CLINIT_P (other_method)
9793		&& !DECL_CONSTRUCTOR_P (other_method)
9794		&& method_name == other_name
9795		&& method_sig == s
9796		&& !METHOD_ABSTRACT (other_method))
9797             {
9798               found = 1;
9799               break;
9800             }
9801	  }
9802	other_super = CLASSTYPE_SUPER (other_super);
9803      } while (!end_type_reached);
9804
9805      /* Report that abstract METHOD didn't find an implementation
9806	 that CLASS can use. */
9807      if (!found)
9808	{
9809	  char *t = xstrdup (lang_printable_name
9810			    (TREE_TYPE (TREE_TYPE (method)), 0));
9811	  tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
9812
9813	  parse_error_context
9814	    (lookup_cl (class_decl),
9815	     "Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract",
9816	     IDENTIFIER_POINTER (DECL_NAME (class_decl)),
9817	     t, lang_printable_name (method, 0),
9818	     (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
9819	      "interface" : "class"),
9820	     IDENTIFIER_POINTER (ccn),
9821	     (CLASS_INTERFACE (class_decl) ? "interface" : "class"),
9822	     IDENTIFIER_POINTER (DECL_NAME (class_decl)));
9823	  ok = 0;
9824	  free (t);
9825	}
9826    }
9827
9828  if (ok && do_interface)
9829    {
9830      /* Check for implemented interfaces. */
9831      int i;
9832      tree vector = TYPE_BINFO_BASETYPES (type);
9833      for (i = 1; ok && vector && i < TREE_VEC_LENGTH (vector); i++)
9834	{
9835	  tree super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
9836	  ok = check_abstract_method_definitions (1, class_decl, super);
9837	}
9838    }
9839
9840  return ok;
9841}
9842
9843/* Check that CLASS_DECL somehow implements all inherited abstract
9844   methods.  */
9845
9846static void
9847java_check_abstract_method_definitions (class_decl)
9848     tree class_decl;
9849{
9850  tree class = TREE_TYPE (class_decl);
9851  tree super, vector;
9852  int i;
9853
9854  if (CLASS_ABSTRACT (class_decl))
9855    return;
9856
9857  /* Check for inherited types */
9858  super = class;
9859  do {
9860    super = CLASSTYPE_SUPER (super);
9861    check_abstract_method_definitions (0, class_decl, super);
9862  } while (super != object_type_node);
9863
9864  /* Check for implemented interfaces. */
9865  vector = TYPE_BINFO_BASETYPES (class);
9866  for (i = 1; i < TREE_VEC_LENGTH (vector); i++)
9867    {
9868      super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
9869      check_abstract_method_definitions (1, class_decl, super);
9870    }
9871}
9872
9873/* Check all the types method DECL uses and return 1 if all of them
9874   are now complete, 0 otherwise. This is used to check whether its
9875   safe to build a method signature or not.  */
9876
9877static int
9878check_method_types_complete (decl)
9879     tree decl;
9880{
9881  tree type = TREE_TYPE (decl);
9882  tree args;
9883
9884  if (!INCOMPLETE_TYPE_P (TREE_TYPE (type)))
9885    return 0;
9886
9887  args = TYPE_ARG_TYPES (type);
9888  if (TREE_CODE (type) == METHOD_TYPE)
9889    args = TREE_CHAIN (args);
9890  for (; args != end_params_node; args = TREE_CHAIN (args))
9891    if (INCOMPLETE_TYPE_P (TREE_VALUE (args)))
9892      return 0;
9893
9894  return 1;
9895}
9896
9897/* Visible interface to check methods contained in CLASS_DECL */
9898
9899void
9900java_check_methods (class_decl)
9901     tree class_decl;
9902{
9903  if (CLASS_METHOD_CHECKED_P (TREE_TYPE (class_decl)))
9904    return;
9905
9906  if (CLASS_INTERFACE (class_decl))
9907    java_check_abstract_methods (class_decl);
9908  else
9909    java_check_regular_methods (class_decl);
9910
9911  CLASS_METHOD_CHECKED_P (TREE_TYPE (class_decl)) = 1;
9912}
9913
9914/* Check all the methods of CLASS_DECL. Methods are first completed
9915   then checked according to regular method existence rules.  If no
9916   constructor for CLASS_DECL were encountered, then build its
9917   declaration.  */
9918
9919static void
9920java_check_regular_methods (class_decl)
9921     tree class_decl;
9922{
9923  int saw_constructor = ANONYMOUS_CLASS_P (TREE_TYPE (class_decl));
9924  tree method;
9925  tree class = TREE_TYPE (class_decl);
9926  tree found = NULL_TREE;
9927  tree mthrows;
9928
9929  /* It is not necessary to check methods defined in java.lang.Object */
9930  if (class == object_type_node)
9931    return;
9932
9933  if (!TYPE_NVIRTUALS (class))
9934    TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
9935
9936  /* Should take interfaces into account. FIXME */
9937  for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method))
9938    {
9939      tree sig;
9940      tree method_wfl = DECL_FUNCTION_WFL (method);
9941      int aflags;
9942
9943      /* Check for redefinitions */
9944      if (check_method_redefinition (class, method))
9945	continue;
9946
9947      /* We verify things thrown by the method.  They must inherit from
9948	 java.lang.Throwable.  */
9949      for (mthrows = DECL_FUNCTION_THROWS (method);
9950	   mthrows; mthrows = TREE_CHAIN (mthrows))
9951	{
9952	  if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node))
9953	    parse_error_context
9954	      (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be a subclass of class `java.lang.Throwable'",
9955	       IDENTIFIER_POINTER
9956	         (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
9957	}
9958
9959      /* If we see one constructor a mark so we don't generate the
9960	 default one.  Also skip other verifications: constructors
9961	 can't be inherited hence hidden or overridden.  */
9962      if (DECL_CONSTRUCTOR_P (method))
9963	{
9964	  saw_constructor = 1;
9965	  continue;
9966	}
9967
9968      sig = build_java_argument_signature (TREE_TYPE (method));
9969      found = lookup_argument_method2 (class, DECL_NAME (method), sig);
9970
9971      /* Inner class can't declare static methods */
9972      if (METHOD_STATIC (method) && !TOPLEVEL_CLASS_DECL_P (class_decl))
9973	{
9974	  char *t = xstrdup (lang_printable_name (class, 0));
9975	  parse_error_context
9976	    (method_wfl, "Method `%s' can't be static in inner class `%s'. Only members of interfaces and top-level classes can be static",
9977	     lang_printable_name (method, 0), t);
9978	  free (t);
9979	}
9980
9981      /* Nothing overrides or it's a private method. */
9982      if (!found)
9983	continue;
9984      if (METHOD_PRIVATE (found))
9985	{
9986	  found = NULL_TREE;
9987	  continue;
9988	}
9989
9990      /* If `found' is declared in an interface, make sure the
9991	 modifier matches. */
9992      if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
9993	  && clinit_identifier_node != DECL_NAME (found)
9994	  && !METHOD_PUBLIC (method))
9995	{
9996	  tree found_decl = TYPE_NAME (DECL_CONTEXT (found));
9997	  parse_error_context (method_wfl, "Class `%s' must override `%s' with a public method in order to implement interface `%s'",
9998			       IDENTIFIER_POINTER (DECL_NAME (class_decl)),
9999			       lang_printable_name (method, 0),
10000			       IDENTIFIER_POINTER (DECL_NAME (found_decl)));
10001	}
10002
10003      /* Can't override a method with the same name and different return
10004	 types. */
10005      if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
10006	{
10007	  char *t = xstrdup
10008	    (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
10009	  parse_error_context
10010	    (method_wfl,
10011	     "Method `%s' was defined with return type `%s' in class `%s'",
10012	     lang_printable_name (found, 0), t,
10013	     IDENTIFIER_POINTER
10014	       (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
10015	  free (t);
10016	}
10017
10018      aflags = get_access_flags_from_decl (found);
10019
10020      /* Can't override final. Can't override static. */
10021      if (METHOD_FINAL (found) || METHOD_STATIC (found))
10022	{
10023	  /* Static *can* override static */
10024	  if (METHOD_STATIC (found) && METHOD_STATIC (method))
10025	    continue;
10026	  parse_error_context
10027	    (method_wfl,
10028	     "%s methods can't be overriden. Method `%s' is %s in class `%s'",
10029	     (METHOD_FINAL (found) ? "Final" : "Static"),
10030	     lang_printable_name (found, 0),
10031	     (METHOD_FINAL (found) ? "final" : "static"),
10032	     IDENTIFIER_POINTER
10033	       (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
10034	  continue;
10035	}
10036
10037      /* Static method can't override instance method. */
10038      if (METHOD_STATIC (method))
10039	{
10040	  parse_error_context
10041	    (method_wfl,
10042	     "Instance methods can't be overriden by a static method. Method `%s' is an instance method in class `%s'",
10043	     lang_printable_name (found, 0),
10044	     IDENTIFIER_POINTER
10045	       (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
10046	  continue;
10047	}
10048
10049      /* - Overriding/hiding public must be public
10050	 - Overriding/hiding protected must be protected or public
10051         - If the overriden or hidden method has default (package)
10052           access, then the overriding or hiding method must not be
10053           private; otherwise, a compile-time error occurs.  If
10054           `found' belongs to an interface, things have been already
10055           taken care of.  */
10056      if (!CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
10057	  && ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method))
10058	      || (METHOD_PROTECTED (found)
10059		  && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method)))
10060	      || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC))
10061		  && METHOD_PRIVATE (method))))
10062	{
10063	  parse_error_context
10064	    (method_wfl,
10065	     "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 0),
10066	     (METHOD_PUBLIC (method) ? "public" :
10067	      (METHOD_PRIVATE (method) ? "private" : "protected")),
10068	     IDENTIFIER_POINTER (DECL_NAME
10069				 (TYPE_NAME (DECL_CONTEXT (found)))));
10070	  continue;
10071	}
10072
10073      /* Overriding methods must have compatible `throws' clauses on checked
10074	 exceptions, if any */
10075      check_throws_clauses (method, method_wfl, found);
10076
10077      /* Inheriting multiple methods with the same signature. FIXME */
10078    }
10079
10080  if (!TYPE_NVIRTUALS (class))
10081    TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
10082
10083  /* Search for inherited abstract method not yet implemented in this
10084     class.  */
10085  java_check_abstract_method_definitions (class_decl);
10086
10087  if (!saw_constructor)
10088    abort ();
10089}
10090
10091/* Return a nonzero value if the `throws' clause of METHOD (if any)
10092   is incompatible with the `throws' clause of FOUND (if any).  */
10093
10094static void
10095check_throws_clauses (method, method_wfl, found)
10096     tree method, method_wfl, found;
10097{
10098  tree mthrows, fthrows;
10099
10100  /* Can't check these things with class loaded from bytecode. FIXME */
10101  if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found)))
10102    return;
10103
10104  for (mthrows = DECL_FUNCTION_THROWS (method);
10105       mthrows; mthrows = TREE_CHAIN (mthrows))
10106    {
10107      /* We don't verify unchecked expressions */
10108      if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows)))
10109	continue;
10110      /* Checked expression must be compatible */
10111      for (fthrows = DECL_FUNCTION_THROWS (found);
10112	   fthrows; fthrows = TREE_CHAIN (fthrows))
10113	if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows)))
10114	  break;
10115      if (!fthrows)
10116	{
10117	  parse_error_context
10118	    (method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'",
10119	     IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
10120	     lang_printable_name (found, 0),
10121	     IDENTIFIER_POINTER
10122	       (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
10123	}
10124    }
10125}
10126
10127/* Check abstract method of interface INTERFACE */
10128
10129static void
10130java_check_abstract_methods (interface_decl)
10131     tree interface_decl;
10132{
10133  int i, n;
10134  tree method, basetype_vec, found;
10135  tree interface = TREE_TYPE (interface_decl);
10136
10137  for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method))
10138    {
10139      /* 2- Check for double definition inside the defining interface */
10140      if (check_method_redefinition (interface, method))
10141	continue;
10142
10143      /* 3- Overriding is OK as far as we preserve the return type and
10144	 the thrown exceptions (FIXME) */
10145      found = lookup_java_interface_method2 (interface, method);
10146      if (found)
10147	{
10148	  char *t;
10149	  t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
10150	  parse_error_context
10151	    (DECL_FUNCTION_WFL (found),
10152	     "Method `%s' was defined with return type `%s' in class `%s'",
10153	     lang_printable_name (found, 0), t,
10154	     IDENTIFIER_POINTER
10155	       (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
10156	  free (t);
10157	  continue;
10158	}
10159    }
10160
10161  /* 4- Inherited methods can't differ by their returned types */
10162  if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface)))
10163    return;
10164  n = TREE_VEC_LENGTH (basetype_vec);
10165  for (i = 0; i < n; i++)
10166    {
10167      tree sub_interface_method, sub_interface;
10168      tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
10169      if (!vec_elt)
10170	continue;
10171      sub_interface = BINFO_TYPE (vec_elt);
10172      for (sub_interface_method = TYPE_METHODS (sub_interface);
10173	   sub_interface_method;
10174	   sub_interface_method = TREE_CHAIN (sub_interface_method))
10175	{
10176	  found = lookup_java_interface_method2 (interface,
10177						 sub_interface_method);
10178	  if (found && (found != sub_interface_method))
10179	    {
10180	      parse_error_context
10181		(lookup_cl (sub_interface_method),
10182		 "Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'",
10183		 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
10184		 lang_printable_name (found, 0),
10185		 IDENTIFIER_POINTER
10186		   (DECL_NAME (TYPE_NAME
10187			       (DECL_CONTEXT (sub_interface_method)))),
10188		 IDENTIFIER_POINTER
10189	           (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
10190	    }
10191	}
10192    }
10193}
10194
10195/* Lookup methods in interfaces using their name and partial
10196   signature. Return a matching method only if their types differ.  */
10197
10198static tree
10199lookup_java_interface_method2 (class, method_decl)
10200     tree class, method_decl;
10201{
10202  int i, n;
10203  tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return;
10204
10205  if (!basetype_vec)
10206    return NULL_TREE;
10207
10208  n = TREE_VEC_LENGTH (basetype_vec);
10209  for (i = 0; i < n; i++)
10210    {
10211      tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return;
10212      if ((BINFO_TYPE (vec_elt) != object_type_node)
10213	  && (to_return =
10214	      lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1)))
10215	return to_return;
10216    }
10217  for (i = 0; i < n; i++)
10218    {
10219      to_return = lookup_java_interface_method2
10220	(BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl);
10221      if (to_return)
10222	return to_return;
10223    }
10224
10225  return NULL_TREE;
10226}
10227
10228/* Lookup method using their name and partial signature. Return a
10229   matching method only if their types differ.  */
10230
10231static tree
10232lookup_java_method2 (clas, method_decl, do_interface)
10233     tree clas, method_decl;
10234     int do_interface;
10235{
10236  tree method, method_signature, method_name, method_type, name;
10237
10238  method_signature = build_java_argument_signature (TREE_TYPE (method_decl));
10239  name = DECL_NAME (method_decl);
10240  method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
10241		 EXPR_WFL_NODE (name) : name);
10242  method_type = TREE_TYPE (TREE_TYPE (method_decl));
10243
10244  while (clas != NULL_TREE)
10245    {
10246      for (method = TYPE_METHODS (clas);
10247	   method != NULL_TREE;  method = TREE_CHAIN (method))
10248	{
10249	  tree method_sig = build_java_argument_signature (TREE_TYPE (method));
10250	  tree name = DECL_NAME (method);
10251	  if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
10252	       EXPR_WFL_NODE (name) : name) == method_name
10253	      && method_sig == method_signature
10254	      && TREE_TYPE (TREE_TYPE (method)) != method_type)
10255	    return method;
10256	}
10257      clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas));
10258    }
10259  return NULL_TREE;
10260}
10261
10262/* Return the line that matches DECL line number, and try its best to
10263   position the column number. Used during error reports.  */
10264
10265static GTY(()) tree cl_v;
10266static tree
10267lookup_cl (decl)
10268     tree decl;
10269{
10270  char *line, *found;
10271
10272  if (!decl)
10273    return NULL_TREE;
10274
10275  if (cl_v == NULL_TREE)
10276    {
10277      cl_v = build_expr_wfl (NULL_TREE, NULL, 0, 0);
10278    }
10279
10280  EXPR_WFL_FILENAME_NODE (cl_v) = get_identifier (DECL_SOURCE_FILE (decl));
10281  EXPR_WFL_SET_LINECOL (cl_v, DECL_SOURCE_LINE_FIRST (decl), -1);
10282
10283  line = java_get_line_col (EXPR_WFL_FILENAME (cl_v),
10284			    EXPR_WFL_LINENO (cl_v), EXPR_WFL_COLNO (cl_v));
10285
10286  found = strstr ((const char *)line,
10287		  (const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
10288  if (found)
10289    EXPR_WFL_SET_LINECOL (cl_v, EXPR_WFL_LINENO (cl_v), found - line);
10290
10291  return cl_v;
10292}
10293
10294/* Look for a simple name in the single-type import list */
10295
10296static tree
10297find_name_in_single_imports (name)
10298     tree name;
10299{
10300  tree node;
10301
10302  for (node = ctxp->import_list; node; node = TREE_CHAIN (node))
10303    if (TREE_VALUE (node) == name)
10304      return (EXPR_WFL_NODE (TREE_PURPOSE (node)));
10305
10306  return NULL_TREE;
10307}
10308
10309/* Process all single-type import. */
10310
10311static int
10312process_imports ()
10313{
10314  tree import;
10315  int error_found;
10316
10317  for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
10318    {
10319      tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
10320      char *original_name;
10321
10322      obstack_grow0 (&temporary_obstack,
10323		     IDENTIFIER_POINTER (to_be_found),
10324		     IDENTIFIER_LENGTH (to_be_found));
10325      original_name = obstack_finish (&temporary_obstack);
10326
10327      /* Don't load twice something already defined. */
10328      if (IDENTIFIER_CLASS_VALUE (to_be_found))
10329	continue;
10330
10331      while (1)
10332	{
10333	  tree left;
10334
10335	  QUALIFIED_P (to_be_found) = 1;
10336	  load_class (to_be_found, 0);
10337	  error_found =
10338	    check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true);
10339
10340	  /* We found it, we can bail out */
10341	  if (IDENTIFIER_CLASS_VALUE (to_be_found))
10342	    break;
10343
10344	  /* We haven't found it. Maybe we're trying to access an
10345	     inner class.  The only way for us to know is to try again
10346	     after having dropped a qualifier. If we can't break it further,
10347	     we have an error. */
10348	  if (breakdown_qualified (&left, NULL, to_be_found))
10349	    break;
10350
10351	  to_be_found = left;
10352	}
10353      if (!IDENTIFIER_CLASS_VALUE (to_be_found))
10354	{
10355	  parse_error_context (TREE_PURPOSE (import),
10356			       "Class or interface `%s' not found in import",
10357			       original_name);
10358	  error_found = 1;
10359	}
10360
10361      obstack_free (&temporary_obstack, original_name);
10362      if (error_found)
10363	return 1;
10364    }
10365  return 0;
10366}
10367
10368/* Possibly find and mark a class imported by a single-type import
10369   statement.  */
10370
10371static void
10372find_in_imports (enclosing_type, class_type)
10373     tree enclosing_type;
10374     tree class_type;
10375{
10376  tree import = (enclosing_type ? TYPE_IMPORT_LIST (enclosing_type) :
10377		 ctxp->import_list);
10378  while (import)
10379    {
10380      if (TREE_VALUE (import) == TYPE_NAME (class_type))
10381	{
10382	  TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import));
10383	  QUALIFIED_P (TYPE_NAME (class_type)) = 1;
10384	  return;
10385	}
10386      import = TREE_CHAIN (import);
10387    }
10388}
10389
10390static int
10391note_possible_classname (name, len)
10392     const char *name;
10393     int len;
10394{
10395  tree node;
10396  if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0)
10397    len = len - 5;
10398  else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0)
10399    len = len - 6;
10400  else
10401    return 0;
10402  node = ident_subst (name, len, "", '/', '.', "");
10403  IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
10404  QUALIFIED_P (node) = strchr (name, '/') ? 1 : 0;
10405  return 1;
10406}
10407
10408/* Read a import directory, gathering potential match for further type
10409   references. Indifferently reads a filesystem or a ZIP archive
10410   directory.  */
10411
10412static void
10413read_import_dir (wfl)
10414     tree wfl;
10415{
10416  tree package_id = EXPR_WFL_NODE (wfl);
10417  const char *package_name = IDENTIFIER_POINTER (package_id);
10418  int package_length = IDENTIFIER_LENGTH (package_id);
10419  DIR *dirp = NULL;
10420  JCF *saved_jcf = current_jcf;
10421
10422  int found = 0;
10423  int k;
10424  void *entry;
10425  struct buffer filename[1];
10426
10427  if (IS_AN_IMPORT_ON_DEMAND_P (package_id))
10428    return;
10429  IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1;
10430
10431  BUFFER_INIT (filename);
10432  buffer_grow (filename, package_length + 100);
10433
10434  for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
10435    {
10436      const char *entry_name = jcf_path_name (entry);
10437      int entry_length = strlen (entry_name);
10438      if (jcf_path_is_zipfile (entry))
10439	{
10440	  ZipFile *zipf;
10441	  buffer_grow (filename, entry_length);
10442	  memcpy (filename->data, entry_name, entry_length - 1);
10443	  filename->data[entry_length-1] = '\0';
10444	  zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry));
10445	  if (zipf == NULL)
10446	    error ("malformed .zip archive in CLASSPATH: %s", entry_name);
10447	  else
10448	    {
10449	      ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory;
10450	      BUFFER_RESET (filename);
10451	      for (k = 0; k < package_length; k++)
10452		{
10453		  char ch = package_name[k];
10454		  *filename->ptr++ = ch == '.' ? '/' : ch;
10455		}
10456	      *filename->ptr++ = '/';
10457
10458	      for (k = 0; k < zipf->count;  k++, zipd = ZIPDIR_NEXT (zipd))
10459		{
10460		  const char *current_entry = ZIPDIR_FILENAME (zipd);
10461		  int current_entry_len = zipd->filename_length;
10462
10463		  if (current_entry_len >= BUFFER_LENGTH (filename)
10464		      && strncmp (filename->data, current_entry,
10465				  BUFFER_LENGTH (filename)) != 0)
10466		    continue;
10467		  found |= note_possible_classname (current_entry,
10468						    current_entry_len);
10469		}
10470	    }
10471	}
10472      else
10473	{
10474	  BUFFER_RESET (filename);
10475	  buffer_grow (filename, entry_length + package_length + 4);
10476	  strcpy (filename->data, entry_name);
10477	  filename->ptr = filename->data + entry_length;
10478	  for (k = 0; k < package_length; k++)
10479	    {
10480	      char ch = package_name[k];
10481	      *filename->ptr++ = ch == '.' ? '/' : ch;
10482	    }
10483	  *filename->ptr = '\0';
10484
10485	  dirp = opendir (filename->data);
10486	  if (dirp == NULL)
10487	    continue;
10488	  *filename->ptr++ = '/';
10489	  for (;;)
10490	    {
10491	      int len;
10492	      const char *d_name;
10493	      struct dirent *direntp = readdir (dirp);
10494	      if (!direntp)
10495		break;
10496	      d_name = direntp->d_name;
10497	      len = strlen (direntp->d_name);
10498	      buffer_grow (filename, len+1);
10499	      strcpy (filename->ptr, d_name);
10500	      found |= note_possible_classname (filename->data + entry_length,
10501						package_length+len+1);
10502	    }
10503	  if (dirp)
10504	    closedir (dirp);
10505	}
10506    }
10507
10508  free (filename->data);
10509
10510  /* Here we should have a unified way of retrieving an entry, to be
10511     indexed. */
10512  if (!found)
10513    {
10514      static int first = 1;
10515      if (first)
10516	{
10517	  error ("Can't find default package `%s'. Check the CLASSPATH environment variable and the access to the archives", package_name);
10518	  java_error_count++;
10519	  first = 0;
10520	}
10521      else
10522	parse_error_context (wfl, "Package `%s' not found in import",
10523			     package_name);
10524      current_jcf = saved_jcf;
10525      return;
10526    }
10527  current_jcf = saved_jcf;
10528}
10529
10530/* Possibly find a type in the import on demands specified
10531   types. Returns 1 if an error occurred, 0 otherwise. Run through the
10532   entire list, to detected potential double definitions.  */
10533
10534static int
10535find_in_imports_on_demand (enclosing_type, class_type)
10536     tree enclosing_type;
10537     tree class_type;
10538{
10539  tree class_type_name = TYPE_NAME (class_type);
10540  tree import = (enclosing_type ? TYPE_IMPORT_DEMAND_LIST (enclosing_type) :
10541		  ctxp->import_demand_list);
10542  tree cl = NULL_TREE;
10543  int seen_once = -1;	/* -1 when not set, 1 if seen once, >1 otherwise. */
10544  int to_return = -1;	/* -1 when not set, 0 or 1 otherwise */
10545  tree node;
10546
10547  for (; import; import = TREE_CHAIN (import))
10548    {
10549      int saved_lineno = lineno;
10550      int access_check;
10551      const char *id_name;
10552      tree decl, type_name_copy;
10553
10554      obstack_grow (&temporary_obstack,
10555		    IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
10556		    IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
10557      obstack_1grow (&temporary_obstack, '.');
10558      obstack_grow0 (&temporary_obstack,
10559		     IDENTIFIER_POINTER (class_type_name),
10560		     IDENTIFIER_LENGTH (class_type_name));
10561      id_name = obstack_finish (&temporary_obstack);
10562
10563      if (! (node = maybe_get_identifier (id_name)))
10564	continue;
10565
10566      /* Setup lineno so that it refers to the line of the import (in
10567	 case we parse a class file and encounter errors */
10568      lineno = EXPR_WFL_LINENO (TREE_PURPOSE (import));
10569
10570      type_name_copy = TYPE_NAME (class_type);
10571      TYPE_NAME (class_type) = node;
10572      QUALIFIED_P (node) = 1;
10573      decl = IDENTIFIER_CLASS_VALUE (node);
10574      access_check = -1;
10575      /* If there is no DECL set for the class or if the class isn't
10576	 loaded and not seen in source yet, then load */
10577      if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl))
10578		    && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl))))
10579	{
10580	  load_class (node, 0);
10581	  decl = IDENTIFIER_CLASS_VALUE (node);
10582	}
10583      if (decl && ! INNER_CLASS_P (TREE_TYPE (decl)))
10584	access_check = check_pkg_class_access (node, TREE_PURPOSE (import),
10585					       false);
10586      else
10587	/* 6.6.1: Inner classes are subject to member access rules. */
10588	access_check = 0;
10589
10590      lineno = saved_lineno;
10591
10592      /* If the loaded class is not accessible or couldn't be loaded,
10593	 we restore the original TYPE_NAME and process the next
10594	 import. */
10595      if (access_check || !decl)
10596	{
10597	  TYPE_NAME (class_type) = type_name_copy;
10598	  continue;
10599	}
10600
10601      /* If the loaded class is accessible, we keep a tab on it to
10602	 detect and report multiple inclusions. */
10603      if (IS_A_CLASSFILE_NAME (node))
10604	{
10605	  if (seen_once < 0)
10606	    {
10607	      cl = TREE_PURPOSE (import);
10608	      seen_once = 1;
10609	    }
10610	  else if (seen_once >= 0)
10611	    {
10612	      tree location = (cl ? cl : TREE_PURPOSE (import));
10613	      tree package = (cl ? EXPR_WFL_NODE (cl) :
10614			      EXPR_WFL_NODE (TREE_PURPOSE (import)));
10615	      seen_once++;
10616	      parse_error_context
10617		(location,
10618		 "Type `%s' also potentially defined in package `%s'",
10619		 IDENTIFIER_POINTER (TYPE_NAME (class_type)),
10620		 IDENTIFIER_POINTER (package));
10621	    }
10622	}
10623      to_return = access_check;
10624    }
10625
10626  if (seen_once == 1)
10627    return to_return;
10628  else
10629    return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
10630}
10631
10632/* Add package NAME to the list of packages encountered so far. To
10633   speed up class lookup in do_resolve_class, we make sure a
10634   particular package is added only once.  */
10635
10636static void
10637register_package (name)
10638     tree name;
10639{
10640  static htab_t pht;
10641  PTR *e;
10642
10643  if (pht == NULL)
10644    pht = htab_create (50, htab_hash_pointer, htab_eq_pointer, NULL);
10645
10646  e = htab_find_slot (pht, name, INSERT);
10647  if (*e == NULL)
10648    {
10649      package_list = chainon (package_list, build_tree_list (name, NULL));
10650      *e = name;
10651    }
10652}
10653
10654static tree
10655resolve_package (pkg, next, type_name)
10656     tree pkg, *next, *type_name;
10657{
10658  tree current;
10659  tree decl = NULL_TREE;
10660  *type_name = NULL_TREE;
10661
10662  /* The trick is to determine when the package name stops and were
10663     the name of something contained in the package starts. Then we
10664     return a fully qualified name of what we want to get. */
10665
10666  *next = EXPR_WFL_QUALIFICATION (pkg);
10667
10668  /* Try to progressively construct a type name */
10669  if (TREE_CODE (pkg) == EXPR_WITH_FILE_LOCATION)
10670    for (current = EXPR_WFL_QUALIFICATION (pkg);
10671	 current; current = TREE_CHAIN (current))
10672      {
10673	/* If we don't have what we're expecting, exit now. TYPE_NAME
10674	   will be null and the error caught later. */
10675	if (TREE_CODE (QUAL_WFL (current)) != EXPR_WITH_FILE_LOCATION)
10676	  break;
10677	*type_name =
10678	  merge_qualified_name (*type_name, EXPR_WFL_NODE (QUAL_WFL (current)));
10679	if ((decl = resolve_no_layout (*type_name, NULL_TREE)))
10680	  {
10681	    /* resolve_package should be used in a loop, hence we
10682	       point at this one to naturally process the next one at
10683	       the next iteration. */
10684	    *next = current;
10685	    break;
10686	  }
10687      }
10688  return decl;
10689}
10690
10691
10692/* Check accessibility of inner classes according to member access rules.
10693   DECL is the inner class, ENCLOSING_DECL is the class from which the
10694   access is being attempted. */
10695
10696static void
10697check_inner_class_access (decl, enclosing_decl, cl)
10698     tree decl, enclosing_decl, cl;
10699{
10700  const char *access;
10701  tree enclosing_decl_type;
10702
10703  /* We don't issue an error message when CL is null. CL can be null
10704     as a result of processing a JDEP crafted by source_start_java_method
10705     for the purpose of patching its parm decl. But the error would
10706     have been already trapped when fixing the method's signature.
10707     DECL can also be NULL in case of earlier errors. */
10708  if (!decl || !cl)
10709    return;
10710
10711  enclosing_decl_type = TREE_TYPE (enclosing_decl);
10712
10713  if (CLASS_PRIVATE (decl))
10714    {
10715      /* Access is permitted only within the body of the top-level
10716         class in which DECL is declared. */
10717      tree top_level = decl;
10718      while (DECL_CONTEXT (top_level))
10719        top_level = DECL_CONTEXT (top_level);
10720      while (DECL_CONTEXT (enclosing_decl))
10721        enclosing_decl = DECL_CONTEXT (enclosing_decl);
10722      if (top_level == enclosing_decl)
10723        return;
10724      access = "private";
10725    }
10726  else if (CLASS_PROTECTED (decl))
10727    {
10728      tree decl_context;
10729      /* Access is permitted from within the same package... */
10730      if (in_same_package (decl, enclosing_decl))
10731        return;
10732
10733      /* ... or from within the body of a subtype of the context in which
10734         DECL is declared. */
10735      decl_context = DECL_CONTEXT (decl);
10736      while (enclosing_decl)
10737        {
10738	  if (CLASS_INTERFACE (decl))
10739	    {
10740	      if (interface_of_p (TREE_TYPE (decl_context),
10741				  enclosing_decl_type))
10742		return;
10743	    }
10744	  else
10745	    {
10746	      /* Eww. The order of the arguments is different!! */
10747	      if (inherits_from_p (enclosing_decl_type,
10748				   TREE_TYPE (decl_context)))
10749		return;
10750	    }
10751	  enclosing_decl = DECL_CONTEXT (enclosing_decl);
10752	}
10753      access = "protected";
10754    }
10755  else if (! CLASS_PUBLIC (decl))
10756    {
10757      /* Access is permitted only from within the same package as DECL. */
10758      if (in_same_package (decl, enclosing_decl))
10759        return;
10760      access = "non-public";
10761    }
10762  else
10763    /* Class is public. */
10764    return;
10765
10766  parse_error_context (cl, "Nested %s %s is %s; cannot be accessed from here",
10767		       (CLASS_INTERFACE (decl) ? "interface" : "class"),
10768		       lang_printable_name (decl, 0), access);
10769}
10770
10771/* Accessibility check for top-level classes. If CLASS_NAME is in a
10772   foreign package, it must be PUBLIC. Return 0 if no access
10773   violations were found, 1 otherwise. If VERBOSE is true and an error
10774   was found, it is reported and accounted for.  */
10775
10776static int
10777check_pkg_class_access (class_name, cl, verbose)
10778     tree class_name;
10779     tree cl;
10780     bool verbose;
10781{
10782  tree type;
10783
10784  if (!IDENTIFIER_CLASS_VALUE (class_name))
10785    return 0;
10786
10787  if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name))))
10788    return 0;
10789
10790  if (!CLASS_PUBLIC (TYPE_NAME (type)))
10791    {
10792      /* Access to a private class within the same package is
10793         allowed. */
10794      tree l, r;
10795      breakdown_qualified (&l, &r, class_name);
10796      if (!QUALIFIED_P (class_name) && !ctxp->package)
10797	/* Both in the empty package. */
10798        return 0;
10799      if (l == ctxp->package)
10800	/* Both in the same package. */
10801	return 0;
10802
10803      if (verbose)
10804	parse_error_context
10805	  (cl, "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed",
10806	   (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
10807	   IDENTIFIER_POINTER (class_name));
10808      return 1;
10809    }
10810  return 0;
10811}
10812
10813/* Local variable declaration. */
10814
10815static void
10816declare_local_variables (modifier, type, vlist)
10817     int modifier;
10818     tree type;
10819     tree vlist;
10820{
10821  tree decl, current, saved_type;
10822  tree type_wfl = NULL_TREE;
10823  int must_chain = 0;
10824  int final_p = 0;
10825
10826  /* Push a new block if statements were seen between the last time we
10827     pushed a block and now. Keep a count of blocks to close */
10828  if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl)))
10829    {
10830      tree b = enter_block ();
10831      BLOCK_IS_IMPLICIT (b) = 1;
10832    }
10833
10834  if (modifier)
10835    {
10836      size_t i;
10837      for (i = 0; i < ARRAY_SIZE (ctxp->modifier_ctx); i++)
10838	if (1 << i & modifier)
10839	  break;
10840      if (modifier == ACC_FINAL)
10841	final_p = 1;
10842      else
10843	{
10844	  parse_error_context
10845	    (ctxp->modifier_ctx [i],
10846	     "Only `final' is allowed as a local variables modifier");
10847	  return;
10848	}
10849    }
10850
10851  /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
10852     hold the TYPE value if a new incomplete has to be created (as
10853     opposed to being found already existing and reused). */
10854  SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
10855
10856  /* If TYPE is fully resolved and we don't have a reference, make one */
10857  PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
10858
10859  /* Go through all the declared variables */
10860  for (current = vlist, saved_type = type; current;
10861       current = TREE_CHAIN (current), type = saved_type)
10862    {
10863      tree other, real_type;
10864      tree wfl  = TREE_PURPOSE (current);
10865      tree name = EXPR_WFL_NODE (wfl);
10866      tree init = TREE_VALUE (current);
10867
10868      /* Process NAME, as it may specify extra dimension(s) for it */
10869      type = build_array_from_name (type, type_wfl, name, &name);
10870
10871      /* Variable redefinition check */
10872      if ((other = lookup_name_in_blocks (name)))
10873	{
10874	  variable_redefinition_error (wfl, name, TREE_TYPE (other),
10875				       DECL_SOURCE_LINE (other));
10876	  continue;
10877	}
10878
10879      /* Type adjustment. We may have just readjusted TYPE because
10880	 the variable specified more dimensions. Make sure we have
10881	 a reference if we can and don't have one already. */
10882      PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
10883
10884      real_type = GET_REAL_TYPE (type);
10885      /* Never layout this decl. This will be done when its scope
10886	 will be entered */
10887      decl = build_decl (VAR_DECL, name, real_type);
10888      MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
10889      DECL_FINAL (decl) = final_p;
10890      BLOCK_CHAIN_DECL (decl);
10891
10892      /* If doing xreferencing, replace the line number with the WFL
10893         compound value */
10894      if (flag_emit_xref)
10895	DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl);
10896
10897      /* Don't try to use an INIT statement when an error was found */
10898      if (init && java_error_count)
10899	init = NULL_TREE;
10900
10901      /* Add the initialization function to the current function's code */
10902      if (init)
10903	{
10904	  /* Name might have been readjusted */
10905	  EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name;
10906	  MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
10907	  java_method_add_stmt (current_function_decl,
10908				build_debugable_stmt (EXPR_WFL_LINECOL (init),
10909						      init));
10910	}
10911
10912      /* Setup dependency the type of the decl */
10913      if (must_chain)
10914	{
10915	  jdep *dep;
10916	  register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type);
10917	  dep = CLASSD_LAST (ctxp->classd_list);
10918	  JDEP_GET_PATCH (dep) = &TREE_TYPE (decl);
10919	}
10920    }
10921  SOURCE_FRONTEND_DEBUG (("Defined locals"));
10922}
10923
10924/* Called during parsing. Build decls from argument list.  */
10925
10926static void
10927source_start_java_method (fndecl)
10928     tree fndecl;
10929{
10930  tree tem;
10931  tree parm_decl;
10932  int i;
10933
10934  if (!fndecl)
10935    return;
10936
10937  current_function_decl = fndecl;
10938
10939  /* New scope for the function */
10940  enter_block ();
10941  for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
10942       tem != end_params_node; tem = TREE_CHAIN (tem), i++)
10943    {
10944      tree type = TREE_VALUE (tem);
10945      tree name = TREE_PURPOSE (tem);
10946
10947      /* If type is incomplete. Create an incomplete decl and ask for
10948	 the decl to be patched later */
10949      if (INCOMPLETE_TYPE_P (type))
10950	{
10951	  jdep *jdep;
10952	  tree real_type = GET_REAL_TYPE (type);
10953	  parm_decl = build_decl (PARM_DECL, name, real_type);
10954	  type = obtain_incomplete_type (type);
10955	  register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type);
10956	  jdep = CLASSD_LAST (ctxp->classd_list);
10957	  JDEP_MISC (jdep) = name;
10958	  JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl);
10959	}
10960      else
10961	parm_decl = build_decl (PARM_DECL, name, type);
10962
10963      /* Remember if a local variable was declared final (via its
10964         TREE_LIST of type/name.) Set DECL_FINAL accordingly. */
10965      if (ARG_FINAL_P (tem))
10966	{
10967	  MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (parm_decl);
10968	  DECL_FINAL (parm_decl) = 1;
10969	}
10970
10971      BLOCK_CHAIN_DECL (parm_decl);
10972    }
10973  tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
10974  BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) =
10975    nreverse (tem);
10976  DECL_ARG_SLOT_COUNT (current_function_decl) = i;
10977  DECL_MAX_LOCALS (current_function_decl) = i;
10978}
10979
10980/* Called during parsing. Creates an artificial method declaration.  */
10981
10982static tree
10983create_artificial_method (class, flags, type, name, args)
10984     tree class;
10985     int flags;
10986     tree type, name, args;
10987{
10988  tree mdecl;
10989
10990  java_parser_context_save_global ();
10991  lineno = 0;
10992  mdecl = make_node (FUNCTION_TYPE);
10993  TREE_TYPE (mdecl) = type;
10994  TYPE_ARG_TYPES (mdecl) = args;
10995  mdecl = add_method (class, flags, name, build_java_signature (mdecl));
10996  java_parser_context_restore_global ();
10997  DECL_ARTIFICIAL (mdecl) = 1;
10998  return mdecl;
10999}
11000
11001/* Starts the body if an artificial method.  */
11002
11003static void
11004start_artificial_method_body (mdecl)
11005     tree mdecl;
11006{
11007  DECL_SOURCE_LINE (mdecl) = 1;
11008  DECL_SOURCE_LINE_MERGE (mdecl, 1);
11009  source_start_java_method (mdecl);
11010  enter_block ();
11011}
11012
11013static void
11014end_artificial_method_body (mdecl)
11015     tree mdecl;
11016{
11017  /* exit_block modifies DECL_FUNCTION_BODY (current_function_decl).
11018     It has to be evaluated first. (if mdecl is current_function_decl,
11019     we have an undefined behavior if no temporary variable is used.) */
11020  tree b = exit_block ();
11021  BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = b;
11022  exit_block ();
11023}
11024
11025/* Dump a tree of some kind.  This is a convenience wrapper for the
11026   dump_* functions in tree-dump.c.  */
11027static void
11028dump_java_tree (phase, t)
11029     enum tree_dump_index phase;
11030     tree t;
11031{
11032  FILE *stream;
11033  int flags;
11034
11035  stream = dump_begin (phase, &flags);
11036  flags |= TDF_SLIM;
11037  if (stream)
11038    {
11039      dump_node (t, flags, stream);
11040      dump_end (phase, stream);
11041    }
11042}
11043
11044/* Terminate a function and expand its body.  */
11045
11046static void
11047source_end_java_method ()
11048{
11049  tree fndecl = current_function_decl;
11050
11051  if (!fndecl)
11052    return;
11053
11054  java_parser_context_save_global ();
11055  lineno = ctxp->last_ccb_indent1;
11056
11057  /* Turn function bodies with only a NOP expr null, so they don't get
11058     generated at all and we won't get warnings when using the -W
11059     -Wall flags. */
11060  if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node)
11061    BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
11062
11063  /* We've generated all the trees for this function, and it has been
11064     patched.  Dump it to a file if the user requested it.  */
11065  dump_java_tree (TDI_original, fndecl);
11066
11067  java_optimize_inline (fndecl);
11068
11069  /* Generate function's code */
11070  if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
11071      && ! flag_emit_class_files
11072      && ! flag_emit_xref)
11073    expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)));
11074
11075  /* pop out of its parameters */
11076  pushdecl_force_head (DECL_ARGUMENTS (fndecl));
11077  poplevel (1, 0, 1);
11078  BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
11079
11080  /* Generate rtl for function exit.  */
11081  if (! flag_emit_class_files && ! flag_emit_xref)
11082    {
11083      lineno = DECL_SOURCE_LINE_LAST (fndecl);
11084      expand_function_end (input_filename, lineno, 0);
11085
11086      DECL_SOURCE_LINE (fndecl) = DECL_SOURCE_LINE_FIRST (fndecl);
11087
11088      /* Run the optimizers and output assembler code for this function. */
11089      rest_of_compilation (fndecl);
11090    }
11091
11092  current_function_decl = NULL_TREE;
11093  java_parser_context_restore_global ();
11094}
11095
11096/* Record EXPR in the current function block. Complements compound
11097   expression second operand if necessary.  */
11098
11099tree
11100java_method_add_stmt (fndecl, expr)
11101     tree fndecl, expr;
11102{
11103  if (!GET_CURRENT_BLOCK (fndecl))
11104    return NULL_TREE;
11105  return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
11106}
11107
11108static tree
11109add_stmt_to_block (b, type, stmt)
11110     tree b, type, stmt;
11111{
11112  tree body = BLOCK_EXPR_BODY (b), c;
11113
11114  if (java_error_count)
11115    return body;
11116
11117  if ((c = add_stmt_to_compound (body, type, stmt)) == body)
11118    return body;
11119
11120  BLOCK_EXPR_BODY (b) = c;
11121  TREE_SIDE_EFFECTS (c) = 1;
11122  return c;
11123}
11124
11125/* Add STMT to EXISTING if possible, otherwise create a new
11126   COMPOUND_EXPR and add STMT to it. */
11127
11128static tree
11129add_stmt_to_compound (existing, type, stmt)
11130     tree existing, type, stmt;
11131{
11132  /* Keep track of this for inlining.  */
11133  if (current_function_decl)
11134    ++DECL_NUM_STMTS (current_function_decl);
11135
11136  if (existing)
11137    return build (COMPOUND_EXPR, type, existing, stmt);
11138  else
11139    return stmt;
11140}
11141
11142void java_layout_seen_class_methods ()
11143{
11144  tree previous_list = all_class_list;
11145  tree end = NULL_TREE;
11146  tree current;
11147
11148  while (1)
11149    {
11150      for (current = previous_list;
11151	   current != end; current = TREE_CHAIN (current))
11152	layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
11153
11154      if (previous_list != all_class_list)
11155	{
11156	  end = previous_list;
11157	  previous_list = all_class_list;
11158	}
11159      else
11160	break;
11161    }
11162}
11163
11164static GTY(()) tree stop_reordering;
11165void
11166java_reorder_fields ()
11167{
11168  tree current;
11169
11170  for (current = gclass_list; current; current = TREE_CHAIN (current))
11171    {
11172      current_class = TREE_TYPE (TREE_VALUE (current));
11173
11174      if (current_class == stop_reordering)
11175	break;
11176
11177      /* Reverse the fields, but leave the dummy field in front.
11178	 Fields are already ordered for Object and Class */
11179      if (TYPE_FIELDS (current_class) && current_class != object_type_node
11180	  && current_class != class_type_node)
11181      {
11182	/* If the dummy field is there, reverse the right fields and
11183	   just layout the type for proper fields offset */
11184	if (!DECL_NAME (TYPE_FIELDS (current_class)))
11185	  {
11186	    tree fields = TYPE_FIELDS (current_class);
11187	    TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields));
11188	    TYPE_SIZE (current_class) = NULL_TREE;
11189	  }
11190	/* We don't have a dummy field, we need to layout the class,
11191           after having reversed the fields */
11192	else
11193	  {
11194	    TYPE_FIELDS (current_class) =
11195	      nreverse (TYPE_FIELDS (current_class));
11196	    TYPE_SIZE (current_class) = NULL_TREE;
11197	  }
11198      }
11199    }
11200  /* There are cases were gclass_list will be empty. */
11201  if (gclass_list)
11202    stop_reordering = TREE_TYPE (TREE_VALUE (gclass_list));
11203}
11204
11205/* Layout the methods of all classes loaded in one way or another.
11206   Check methods of source parsed classes. Then reorder the
11207   fields and layout the classes or the type of all source parsed
11208   classes */
11209
11210void
11211java_layout_classes ()
11212{
11213  tree current;
11214  int save_error_count = java_error_count;
11215
11216  /* Layout the methods of all classes seen so far */
11217  java_layout_seen_class_methods ();
11218  java_parse_abort_on_error ();
11219  all_class_list = NULL_TREE;
11220
11221  /* Then check the methods of all parsed classes */
11222  for (current = gclass_list; current; current = TREE_CHAIN (current))
11223    if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current))))
11224      java_check_methods (TREE_VALUE (current));
11225  java_parse_abort_on_error ();
11226
11227  for (current = gclass_list; current; current = TREE_CHAIN (current))
11228    {
11229      current_class = TREE_TYPE (TREE_VALUE (current));
11230      layout_class (current_class);
11231
11232      /* Error reported by the caller */
11233      if (java_error_count)
11234	return;
11235    }
11236
11237  /* We might have reloaded classes durign the process of laying out
11238     classes for code generation. We must layout the methods of those
11239     late additions, as constructor checks might use them */
11240  java_layout_seen_class_methods ();
11241  java_parse_abort_on_error ();
11242}
11243
11244/* Expand methods in the current set of classes rememebered for
11245   generation.  */
11246
11247static void
11248java_complete_expand_classes ()
11249{
11250  tree current;
11251
11252  do_not_fold = flag_emit_xref;
11253
11254  for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
11255    if (!INNER_CLASS_DECL_P (current))
11256      java_complete_expand_class (current);
11257}
11258
11259/* Expand the methods found in OUTER, starting first by OUTER's inner
11260   classes, if any.  */
11261
11262static void
11263java_complete_expand_class (outer)
11264     tree outer;
11265{
11266  tree inner_list;
11267
11268  set_nested_class_simple_name_value (outer, 1); /* Set */
11269
11270  /* We need to go after all inner classes and start expanding them,
11271     starting with most nested ones. We have to do that because nested
11272     classes might add functions to outer classes */
11273
11274  for (inner_list = DECL_INNER_CLASS_LIST (outer);
11275       inner_list; inner_list = TREE_CHAIN (inner_list))
11276    java_complete_expand_class (TREE_PURPOSE (inner_list));
11277
11278  java_complete_expand_methods (outer);
11279  set_nested_class_simple_name_value (outer, 0); /* Reset */
11280}
11281
11282/* Expand methods registered in CLASS_DECL. The general idea is that
11283   we expand regular methods first. This allows us get an estimate on
11284   how outer context local alias fields are really used so we can add
11285   to the constructor just enough code to initialize them properly (it
11286   also lets us generate finit$ correctly.) Then we expand the
11287   constructors and then <clinit>.  */
11288
11289static void
11290java_complete_expand_methods (class_decl)
11291     tree class_decl;
11292{
11293  tree clinit, decl, first_decl;
11294
11295  current_class = TREE_TYPE (class_decl);
11296
11297  /* Initialize a new constant pool */
11298  init_outgoing_cpool ();
11299
11300  /* Pre-expand <clinit> to figure whether we really need it or
11301     not. If we do need it, we pre-expand the static fields so they're
11302     ready to be used somewhere else. <clinit> will be fully expanded
11303     after we processed the constructors. */
11304  first_decl = TYPE_METHODS (current_class);
11305  clinit = maybe_generate_pre_expand_clinit (current_class);
11306
11307  /* Then generate finit$ (if we need to) because constructors will
11308   try to use it.*/
11309  if (TYPE_FINIT_STMT_LIST (current_class))
11310    java_complete_expand_method (generate_finit (current_class));
11311
11312  /* Then generate instinit$ (if we need to) because constructors will
11313     try to use it. */
11314  if (TYPE_II_STMT_LIST (current_class))
11315    java_complete_expand_method (generate_instinit (current_class));
11316
11317  /* Now do the constructors */
11318  for (decl = first_decl ; !java_error_count && decl; decl = TREE_CHAIN (decl))
11319    {
11320      int no_body;
11321
11322      if (!DECL_CONSTRUCTOR_P (decl))
11323	continue;
11324
11325      no_body = !DECL_FUNCTION_BODY (decl);
11326      /* Don't generate debug info on line zero when expanding a
11327	 generated constructor. */
11328      if (no_body)
11329	restore_line_number_status (1);
11330
11331      java_complete_expand_method (decl);
11332
11333      if (no_body)
11334	restore_line_number_status (0);
11335    }
11336
11337  /* First, do the ordinary methods. */
11338  for (decl = first_decl; decl; decl = TREE_CHAIN (decl))
11339    {
11340      /* Ctors aren't part of this batch. */
11341      if (DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl))
11342	continue;
11343
11344      /* Skip abstract or native methods -- but do handle native
11345 	 methods when generating JNI stubs.  */
11346      if (METHOD_ABSTRACT (decl) || (! flag_jni && METHOD_NATIVE (decl)))
11347	{
11348	  DECL_FUNCTION_BODY (decl) = NULL_TREE;
11349	  continue;
11350	}
11351
11352      if (METHOD_NATIVE (decl))
11353 	{
11354 	  tree body;
11355	  current_function_decl = decl;
11356	  body = build_jni_stub (decl);
11357 	  BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl)) = body;
11358 	}
11359
11360      java_complete_expand_method (decl);
11361    }
11362
11363  /* If there is indeed a <clinit>, fully expand it now */
11364  if (clinit)
11365    {
11366      /* Prevent the use of `this' inside <clinit> */
11367      ctxp->explicit_constructor_p = 1;
11368      java_complete_expand_method (clinit);
11369      ctxp->explicit_constructor_p = 0;
11370    }
11371
11372  /* We might have generated a class$ that we now want to expand */
11373  if (TYPE_DOT_CLASS (current_class))
11374    java_complete_expand_method (TYPE_DOT_CLASS (current_class));
11375
11376  /* Now verify constructor circularity (stop after the first one we
11377     prove wrong.) */
11378  if (!CLASS_INTERFACE (class_decl))
11379    for (decl = TYPE_METHODS (current_class); decl; decl = TREE_CHAIN (decl))
11380      if (DECL_CONSTRUCTOR_P (decl)
11381	  && verify_constructor_circularity (decl, decl))
11382	break;
11383
11384  /* Save the constant pool. We'll need to restore it later. */
11385  TYPE_CPOOL (current_class) = outgoing_cpool;
11386}
11387
11388/* Attempt to create <clinit>. Pre-expand static fields so they can be
11389   safely used in some other methods/constructors.  */
11390
11391static tree
11392maybe_generate_pre_expand_clinit (class_type)
11393     tree class_type;
11394{
11395  tree current, mdecl;
11396
11397  if (!TYPE_CLINIT_STMT_LIST (class_type))
11398    return NULL_TREE;
11399
11400  /* Go through all static fields and pre expand them */
11401  for (current = TYPE_FIELDS (class_type); current;
11402       current = TREE_CHAIN (current))
11403    if (FIELD_STATIC (current))
11404      build_field_ref (NULL_TREE, class_type, DECL_NAME (current));
11405
11406  /* Then build the <clinit> method */
11407  mdecl = create_artificial_method (class_type, ACC_STATIC, void_type_node,
11408				    clinit_identifier_node, end_params_node);
11409  layout_class_method (class_type, CLASSTYPE_SUPER (class_type),
11410		       mdecl, NULL_TREE);
11411  start_artificial_method_body (mdecl);
11412
11413  /* We process the list of assignment we produced as the result of
11414     the declaration of initialized static field and add them as
11415     statement to the <clinit> method. */
11416  for (current = TYPE_CLINIT_STMT_LIST (class_type); current;
11417       current = TREE_CHAIN (current))
11418    {
11419      tree stmt = current;
11420      /* We build the assignment expression that will initialize the
11421	 field to its value. There are strict rules on static
11422	 initializers (8.5). FIXME */
11423      if (TREE_CODE (stmt) != BLOCK && stmt != empty_stmt_node)
11424	stmt = build_debugable_stmt (EXPR_WFL_LINECOL (stmt), stmt);
11425      java_method_add_stmt (mdecl, stmt);
11426    }
11427
11428  end_artificial_method_body (mdecl);
11429
11430  /* Now we want to place <clinit> as the last method (because we need
11431     it at least for interface so that it doesn't interfere with the
11432     dispatch table based lookup. */
11433  if (TREE_CHAIN (TYPE_METHODS (class_type)))
11434    {
11435      current = TREE_CHAIN (TYPE_METHODS (class_type));
11436      TYPE_METHODS (class_type) = current;
11437
11438      while (TREE_CHAIN (current))
11439	current = TREE_CHAIN (current);
11440
11441      TREE_CHAIN (current) = mdecl;
11442      TREE_CHAIN (mdecl) = NULL_TREE;
11443    }
11444
11445  return mdecl;
11446}
11447
11448/* Analyzes a method body and look for something that isn't a
11449   MODIFY_EXPR with a constant value.  */
11450
11451static int
11452analyze_clinit_body (this_class, bbody)
11453     tree this_class, bbody;
11454{
11455  while (bbody)
11456    switch (TREE_CODE (bbody))
11457      {
11458      case BLOCK:
11459	bbody = BLOCK_EXPR_BODY (bbody);
11460	break;
11461
11462      case EXPR_WITH_FILE_LOCATION:
11463	bbody = EXPR_WFL_NODE (bbody);
11464	break;
11465
11466      case COMPOUND_EXPR:
11467	if (analyze_clinit_body (this_class, TREE_OPERAND (bbody, 0)))
11468	  return 1;
11469	bbody = TREE_OPERAND (bbody, 1);
11470	break;
11471
11472      case MODIFY_EXPR:
11473	/* If we're generating to class file and we're dealing with an
11474	   array initialization, we return 1 to keep <clinit> */
11475	if (TREE_CODE (TREE_OPERAND (bbody, 1)) == NEW_ARRAY_INIT
11476	    && flag_emit_class_files)
11477	  return 1;
11478
11479	/* There are a few cases where we're required to keep
11480	   <clinit>:
11481	   - If this is an assignment whose operand is not constant,
11482	   - If this is an assignment to a non-initialized field,
11483	   - If this field is not a member of the current class.
11484	*/
11485	return (! TREE_CONSTANT (TREE_OPERAND (bbody, 1))
11486		|| ! DECL_INITIAL (TREE_OPERAND (bbody, 0))
11487		|| DECL_CONTEXT (TREE_OPERAND (bbody, 0)) != this_class);
11488
11489      default:
11490	return 1;
11491      }
11492  return 0;
11493}
11494
11495
11496/* See whether we could get rid of <clinit>. Criteria are: all static
11497   final fields have constant initial values and the body of <clinit>
11498   is empty. Return 1 if <clinit> was discarded, 0 otherwise. */
11499
11500static int
11501maybe_yank_clinit (mdecl)
11502     tree mdecl;
11503{
11504  tree type, current;
11505  tree fbody, bbody;
11506
11507  if (!DECL_CLINIT_P (mdecl))
11508    return 0;
11509
11510  /* If the body isn't empty, then we keep <clinit>. Note that if
11511     we're emitting classfiles, this isn't enough not to rule it
11512     out. */
11513  fbody = DECL_FUNCTION_BODY (mdecl);
11514  bbody = BLOCK_EXPR_BODY (fbody);
11515  if (bbody && bbody != error_mark_node)
11516    bbody = BLOCK_EXPR_BODY (bbody);
11517  else
11518    return 0;
11519  if (bbody && ! flag_emit_class_files && bbody != empty_stmt_node)
11520    return 0;
11521
11522  type = DECL_CONTEXT (mdecl);
11523  current = TYPE_FIELDS (type);
11524
11525  for (current = (current ? TREE_CHAIN (current) : current);
11526       current; current = TREE_CHAIN (current))
11527    {
11528      tree f_init;
11529
11530      /* We're not interested in non-static fields.  */
11531      if (!FIELD_STATIC (current))
11532	continue;
11533
11534      /* Nor in fields without initializers. */
11535      f_init = DECL_INITIAL (current);
11536      if (f_init == NULL_TREE)
11537	continue;
11538
11539      /* Anything that isn't String or a basic type is ruled out -- or
11540	 if we know how to deal with it (when doing things natively) we
11541	 should generated an empty <clinit> so that SUID are computed
11542	 correctly. */
11543      if (! JSTRING_TYPE_P (TREE_TYPE (current))
11544	  && ! JNUMERIC_TYPE_P (TREE_TYPE (current)))
11545	return 0;
11546
11547      if (! FIELD_FINAL (current) || ! TREE_CONSTANT (f_init))
11548	return 0;
11549    }
11550
11551  /* Now we analyze the method body and look for something that
11552     isn't a MODIFY_EXPR */
11553  if (bbody != empty_stmt_node && analyze_clinit_body (type, bbody))
11554    return 0;
11555
11556  /* Get rid of <clinit> in the class' list of methods */
11557  if (TYPE_METHODS (type) == mdecl)
11558    TYPE_METHODS (type) = TREE_CHAIN (mdecl);
11559  else
11560    for (current = TYPE_METHODS (type); current;
11561	 current = TREE_CHAIN (current))
11562      if (TREE_CHAIN (current) == mdecl)
11563	{
11564	  TREE_CHAIN (current) = TREE_CHAIN (mdecl);
11565	  break;
11566	}
11567
11568  return 1;
11569}
11570
11571/* Install the argument from MDECL. Suitable to completion and
11572   expansion of mdecl's body.  */
11573
11574static void
11575start_complete_expand_method (mdecl)
11576     tree mdecl;
11577{
11578  tree tem;
11579
11580  pushlevel (1);		/* Prepare for a parameter push */
11581  tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
11582  DECL_ARGUMENTS (mdecl) = tem;
11583
11584  for (; tem; tem = TREE_CHAIN (tem))
11585    {
11586      /* TREE_CHAIN (tem) will change after pushdecl. */
11587      tree next = TREE_CHAIN (tem);
11588      tree type = TREE_TYPE (tem);
11589      if (PROMOTE_PROTOTYPES
11590	  && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
11591	  && INTEGRAL_TYPE_P (type))
11592	type = integer_type_node;
11593      DECL_ARG_TYPE (tem) = type;
11594      layout_decl (tem, 0);
11595      pushdecl (tem);
11596      /* Re-install the next so that the list is kept and the loop
11597	 advances. */
11598      TREE_CHAIN (tem) = next;
11599    }
11600  pushdecl_force_head (DECL_ARGUMENTS (mdecl));
11601  lineno = DECL_SOURCE_LINE_FIRST (mdecl);
11602  build_result_decl (mdecl);
11603}
11604
11605
11606/* Complete and expand a method.  */
11607
11608static void
11609java_complete_expand_method (mdecl)
11610     tree mdecl;
11611{
11612  tree fbody, block_body, exception_copy;
11613
11614  current_function_decl = mdecl;
11615  /* Fix constructors before expanding them */
11616  if (DECL_CONSTRUCTOR_P (mdecl))
11617    fix_constructors (mdecl);
11618
11619  /* Expand functions that have a body */
11620  if (!DECL_FUNCTION_BODY (mdecl))
11621    return;
11622
11623  fbody = DECL_FUNCTION_BODY (mdecl);
11624  block_body = BLOCK_EXPR_BODY (fbody);
11625  exception_copy = NULL_TREE;
11626
11627  current_function_decl = mdecl;
11628
11629  if (! quiet_flag)
11630    fprintf (stderr, " [%s.",
11631	     lang_printable_name (DECL_CONTEXT (mdecl), 0));
11632  announce_function (mdecl);
11633  if (! quiet_flag)
11634    fprintf (stderr, "]");
11635
11636  /* Prepare the function for tree completion */
11637  start_complete_expand_method (mdecl);
11638
11639  /* Install the current this */
11640  current_this = (!METHOD_STATIC (mdecl) ?
11641		  BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
11642
11643  /* Purge the `throws' list of unchecked exceptions (we save a copy
11644     of the list and re-install it later.) */
11645  exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl));
11646  purge_unchecked_exceptions (mdecl);
11647
11648  /* Install exceptions thrown with `throws' */
11649  PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
11650
11651  if (block_body != NULL_TREE)
11652    {
11653      block_body = java_complete_tree (block_body);
11654
11655      /* Before we check initialization, attached all class initialization
11656	 variable to the block_body */
11657      htab_traverse (DECL_FUNCTION_INIT_TEST_TABLE (mdecl),
11658		     attach_init_test_initialization_flags, block_body);
11659
11660      if (! flag_emit_xref && ! METHOD_NATIVE (mdecl))
11661	{
11662	  check_for_initialization (block_body, mdecl);
11663
11664	  /* Go through all the flags marking the initialization of
11665	     static variables and see whether they're definitively
11666	     assigned, in which case the type is remembered as
11667	     definitively initialized in MDECL. */
11668	  if (STATIC_CLASS_INIT_OPT_P ())
11669	    {
11670	      /* Always register the context as properly initialized in
11671		 MDECL. This used with caution helps removing extra
11672		 initialization of self. */
11673	      if (METHOD_STATIC (mdecl))
11674		{
11675		  *(htab_find_slot
11676		    (DECL_FUNCTION_INITIALIZED_CLASS_TABLE (mdecl),
11677		     DECL_CONTEXT (mdecl), INSERT)) = DECL_CONTEXT (mdecl);
11678		}
11679	    }
11680	}
11681      ctxp->explicit_constructor_p = 0;
11682    }
11683
11684  BLOCK_EXPR_BODY (fbody) = block_body;
11685
11686  /* If we saw a return but couldn't evaluate it properly, we'll have
11687     an error_mark_node here. */
11688  if (block_body != error_mark_node
11689      && (block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body))
11690      && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE
11691      && !flag_emit_xref)
11692    missing_return_error (current_function_decl);
11693
11694  /* See if we can get rid of <clinit> if MDECL happens to be <clinit> */
11695  maybe_yank_clinit (mdecl);
11696
11697  /* Pop the current level, with special measures if we found errors. */
11698  if (java_error_count)
11699    pushdecl_force_head (DECL_ARGUMENTS (mdecl));
11700  poplevel (1, 0, 1);
11701
11702  /* Pop the exceptions and sanity check */
11703  POP_EXCEPTIONS();
11704  if (currently_caught_type_list)
11705    abort ();
11706
11707  /* Restore the copy of the list of exceptions if emitting xrefs. */
11708  DECL_FUNCTION_THROWS (mdecl) = exception_copy;
11709}
11710
11711/* For with each class for which there's code to generate. */
11712
11713static void
11714java_expand_method_bodies (class)
11715     tree class;
11716{
11717  tree decl;
11718  for (decl = TYPE_METHODS (class); decl; decl = TREE_CHAIN (decl))
11719    {
11720      if (!DECL_FUNCTION_BODY (decl))
11721	continue;
11722
11723      current_function_decl = decl;
11724
11725      /* Save the function for inlining.  */
11726      if (flag_inline_trees)
11727	DECL_SAVED_TREE (decl) =
11728	  BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl));
11729
11730      /* It's time to assign the variable flagging static class
11731	 initialization based on which classes invoked static methods
11732	 are definitely initializing. This should be flagged. */
11733      if (STATIC_CLASS_INIT_OPT_P ())
11734	{
11735	  tree list = DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (decl);
11736	  for (; list != NULL_TREE;  list = TREE_CHAIN (list))
11737	    {
11738	      /* Executed for each statement calling a static function.
11739		 LIST is a TREE_LIST whose PURPOSE is the called function
11740		 and VALUE is a compound whose second operand can be patched
11741		 with static class initialization flag assignments.  */
11742
11743	      tree called_method = TREE_PURPOSE (list);
11744	      tree compound = TREE_VALUE (list);
11745	      tree assignment_compound_list
11746		= build_tree_list (called_method, NULL);
11747
11748	      /* For each class definitely initialized in
11749		 CALLED_METHOD, fill ASSIGNMENT_COMPOUND with
11750		 assignment to the class initialization flag. */
11751	      htab_traverse (DECL_FUNCTION_INITIALIZED_CLASS_TABLE (called_method),
11752			     emit_test_initialization,
11753			     assignment_compound_list);
11754
11755	      if (TREE_VALUE (assignment_compound_list))
11756		TREE_OPERAND (compound, 1)
11757		  = TREE_VALUE (assignment_compound_list);
11758	    }
11759	}
11760
11761      /* Prepare the function for RTL expansion */
11762      start_complete_expand_method (decl);
11763
11764      /* Expand function start, generate initialization flag
11765	 assignment, and handle synchronized methods. */
11766      complete_start_java_method (decl);
11767
11768      /* Expand the rest of the function body and terminate
11769         expansion. */
11770      source_end_java_method ();
11771    }
11772}
11773
11774
11775
11776/* This section of the code deals with accessing enclosing context
11777   fields either directly by using the relevant access to this$<n> or
11778   by invoking an access method crafted for that purpose.  */
11779
11780/* Build the necessary access from an inner class to an outer
11781   class. This routine could be optimized to cache previous result
11782   (decl, current_class and returned access).  When an access method
11783   needs to be generated, it always takes the form of a read. It might
11784   be later turned into a write by calling outer_field_access_fix.  */
11785
11786static tree
11787build_outer_field_access (id, decl)
11788     tree id, decl;
11789{
11790  tree access = NULL_TREE;
11791  tree ctx = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current_class)));
11792  tree decl_ctx = DECL_CONTEXT (decl);
11793
11794  /* If the immediate enclosing context of the current class is the
11795     field decl's class or inherits from it; build the access as
11796     `this$<n>.<field>'. Note that we will break the `private' barrier
11797     if we're not emitting bytecodes. */
11798  if ((ctx == decl_ctx || inherits_from_p (ctx, decl_ctx))
11799      && (!FIELD_PRIVATE (decl) || !flag_emit_class_files ))
11800    {
11801      tree thisn = build_current_thisn (current_class);
11802      access = make_qualified_primary (build_wfl_node (thisn),
11803				       id, EXPR_WFL_LINECOL (id));
11804    }
11805  /* Otherwise, generate access methods to outer this and access the
11806     field (either using an access method or by direct access.) */
11807  else
11808    {
11809      int lc = EXPR_WFL_LINECOL (id);
11810
11811      /* Now we chain the required number of calls to the access$0 to
11812	 get a hold to the enclosing instance we need, and then we
11813	 build the field access. */
11814      access = build_access_to_thisn (current_class, decl_ctx, lc);
11815
11816      /* If the field is private and we're generating bytecode, then
11817         we generate an access method */
11818      if (FIELD_PRIVATE (decl) && flag_emit_class_files )
11819	{
11820	  tree name = build_outer_field_access_methods (decl);
11821	  access = build_outer_field_access_expr (lc, decl_ctx,
11822						  name, access, NULL_TREE);
11823	}
11824      /* Otherwise we use `access$(this$<j>). ... access$(this$<i>).<field>'.
11825	 Once again we break the `private' access rule from a foreign
11826	 class. */
11827      else
11828	access = make_qualified_primary (access, id, lc);
11829    }
11830  return resolve_expression_name (access, NULL);
11831}
11832
11833/* Return a nonzero value if NODE describes an outer field inner
11834   access.  */
11835
11836static int
11837outer_field_access_p (type, decl)
11838    tree type, decl;
11839{
11840  if (!INNER_CLASS_TYPE_P (type)
11841      || TREE_CODE (decl) != FIELD_DECL
11842      || DECL_CONTEXT (decl) == type)
11843    return 0;
11844
11845  /* If the inner class extends the declaration context of the field
11846     we're try to acces, then this isn't an outer field access */
11847  if (inherits_from_p (type, DECL_CONTEXT (decl)))
11848    return 0;
11849
11850  for (type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))); ;
11851       type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))))
11852    {
11853      if (type == DECL_CONTEXT (decl))
11854	return 1;
11855
11856      if (!DECL_CONTEXT (TYPE_NAME (type)))
11857	{
11858	  /* Before we give up, see whether the field is inherited from
11859	     the enclosing context we're considering. */
11860	  if (inherits_from_p (type, DECL_CONTEXT (decl)))
11861	    return 1;
11862	  break;
11863	}
11864    }
11865
11866  return 0;
11867}
11868
11869/* Return a nonzero value if NODE represents an outer field inner
11870   access that was been already expanded. As a side effect, it returns
11871   the name of the field being accessed and the argument passed to the
11872   access function, suitable for a regeneration of the access method
11873   call if necessary. */
11874
11875static int
11876outer_field_expanded_access_p (node, name, arg_type, arg)
11877    tree node, *name, *arg_type, *arg;
11878{
11879  int identified = 0;
11880
11881  if (TREE_CODE (node) != CALL_EXPR)
11882    return 0;
11883
11884  /* Well, gcj generates slightly different tree nodes when compiling
11885     to native or bytecodes. It's the case for function calls. */
11886
11887  if (flag_emit_class_files
11888      && TREE_CODE (node) == CALL_EXPR
11889      && OUTER_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (TREE_OPERAND (node, 0))))
11890    identified = 1;
11891  else if (!flag_emit_class_files)
11892    {
11893      node = TREE_OPERAND (node, 0);
11894
11895      if (node && TREE_OPERAND (node, 0)
11896	  && TREE_CODE (TREE_OPERAND (node, 0)) == ADDR_EXPR)
11897	{
11898	  node = TREE_OPERAND (node, 0);
11899	  if (TREE_OPERAND (node, 0)
11900	      && TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL
11901	      && (OUTER_FIELD_ACCESS_IDENTIFIER_P
11902		  (DECL_NAME (TREE_OPERAND (node, 0)))))
11903	    identified = 1;
11904	}
11905    }
11906
11907  if (identified && name && arg_type && arg)
11908    {
11909      tree argument = TREE_OPERAND (node, 1);
11910      *name = DECL_NAME (TREE_OPERAND (node, 0));
11911      *arg_type = TREE_TYPE (TREE_TYPE (TREE_VALUE (argument)));
11912      *arg = TREE_VALUE (argument);
11913    }
11914  return identified;
11915}
11916
11917/* Detect in NODE an outer field read access from an inner class and
11918   transform it into a write with RHS as an argument. This function is
11919   called from the java_complete_lhs when an assignment to a LHS can
11920   be identified. */
11921
11922static tree
11923outer_field_access_fix (wfl, node, rhs)
11924    tree wfl, node, rhs;
11925{
11926  tree name, arg_type, arg;
11927
11928  if (outer_field_expanded_access_p (node, &name, &arg_type, &arg))
11929    {
11930      node = build_outer_field_access_expr (EXPR_WFL_LINECOL (wfl),
11931					    arg_type, name, arg, rhs);
11932      return java_complete_tree (node);
11933    }
11934  return NULL_TREE;
11935}
11936
11937/* Construct the expression that calls an access method:
11938     <type>.access$<n>(<arg1> [, <arg2>]);
11939
11940   ARG2 can be NULL and will be omitted in that case. It will denote a
11941   read access.  */
11942
11943static tree
11944build_outer_field_access_expr (lc, type, access_method_name, arg1, arg2)
11945    int lc;
11946    tree type, access_method_name, arg1, arg2;
11947{
11948  tree args, cn, access;
11949
11950  args = arg1 ? arg1 :
11951    build_wfl_node (build_current_thisn (current_class));
11952  args = build_tree_list (NULL_TREE, args);
11953
11954  if (arg2)
11955    args = tree_cons (NULL_TREE, arg2, args);
11956
11957  access = build_method_invocation (build_wfl_node (access_method_name), args);
11958  cn = build_wfl_node (DECL_NAME (TYPE_NAME (type)));
11959  return make_qualified_primary (cn, access, lc);
11960}
11961
11962static tree
11963build_new_access_id ()
11964{
11965  static int access_n_counter = 1;
11966  char buffer [128];
11967
11968  sprintf (buffer, "access$%d", access_n_counter++);
11969  return get_identifier (buffer);
11970}
11971
11972/* Create the static access functions for the outer field DECL. We define a
11973   read:
11974     TREE_TYPE (<field>) access$<n> (DECL_CONTEXT (<field>) inst$) {
11975       return inst$.field;
11976     }
11977   and a write access:
11978     TREE_TYPE (<field>) access$<n> (DECL_CONTEXT (<field>) inst$,
11979                                     TREE_TYPE (<field>) value$) {
11980       return inst$.field = value$;
11981     }
11982   We should have a usage flags on the DECL so we can lazily turn the ones
11983   we're using for code generation. FIXME.
11984*/
11985
11986static tree
11987build_outer_field_access_methods (decl)
11988    tree decl;
11989{
11990  tree id, args, stmt, mdecl;
11991
11992  if (FIELD_INNER_ACCESS_P (decl))
11993    return FIELD_INNER_ACCESS (decl);
11994
11995  MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
11996
11997  /* Create the identifier and a function named after it. */
11998  id = build_new_access_id ();
11999
12000  /* The identifier is marked as bearing the name of a generated write
12001     access function for outer field accessed from inner classes. */
12002  OUTER_FIELD_ACCESS_IDENTIFIER_P (id) = 1;
12003
12004  /* Create the read access */
12005  args = build_tree_list (inst_id, build_pointer_type (DECL_CONTEXT (decl)));
12006  TREE_CHAIN (args) = end_params_node;
12007  stmt = make_qualified_primary (build_wfl_node (inst_id),
12008				 build_wfl_node (DECL_NAME (decl)), 0);
12009  stmt = build_return (0, stmt);
12010  mdecl = build_outer_field_access_method (DECL_CONTEXT (decl),
12011					   TREE_TYPE (decl), id, args, stmt);
12012  DECL_FUNCTION_ACCESS_DECL (mdecl) = decl;
12013
12014  /* Create the write access method. No write access for final variable */
12015  if (!FIELD_FINAL (decl))
12016    {
12017      args = build_tree_list (inst_id,
12018			      build_pointer_type (DECL_CONTEXT (decl)));
12019      TREE_CHAIN (args) = build_tree_list (wpv_id, TREE_TYPE (decl));
12020      TREE_CHAIN (TREE_CHAIN (args)) = end_params_node;
12021      stmt = make_qualified_primary (build_wfl_node (inst_id),
12022				     build_wfl_node (DECL_NAME (decl)), 0);
12023      stmt = build_return (0, build_assignment (ASSIGN_TK, 0, stmt,
12024						build_wfl_node (wpv_id)));
12025      mdecl = build_outer_field_access_method (DECL_CONTEXT (decl),
12026					       TREE_TYPE (decl), id,
12027					       args, stmt);
12028    }
12029  DECL_FUNCTION_ACCESS_DECL (mdecl) = decl;
12030
12031  /* Return the access name */
12032  return FIELD_INNER_ACCESS (decl) = id;
12033}
12034
12035/* Build an field access method NAME.  */
12036
12037static tree
12038build_outer_field_access_method (class, type, name, args, body)
12039    tree class, type, name, args, body;
12040{
12041  tree saved_current_function_decl, mdecl;
12042
12043  /* Create the method */
12044  mdecl = create_artificial_method (class, ACC_STATIC, type, name, args);
12045  fix_method_argument_names (args, mdecl);
12046  layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
12047
12048  /* Attach the method body. */
12049  saved_current_function_decl = current_function_decl;
12050  start_artificial_method_body (mdecl);
12051  java_method_add_stmt (mdecl, body);
12052  end_artificial_method_body (mdecl);
12053  current_function_decl = saved_current_function_decl;
12054
12055  return mdecl;
12056}
12057
12058
12059/* This section deals with building access function necessary for
12060   certain kinds of method invocation from inner classes.  */
12061
12062static tree
12063build_outer_method_access_method (decl)
12064    tree decl;
12065{
12066  tree saved_current_function_decl, mdecl;
12067  tree args = NULL_TREE, call_args = NULL_TREE;
12068  tree carg, id, body, class;
12069  char buffer [80];
12070  int parm_id_count = 0;
12071
12072  /* Test this abort with an access to a private field */
12073  if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "access$"))
12074    abort ();
12075
12076  /* Check the cache first */
12077  if (DECL_FUNCTION_INNER_ACCESS (decl))
12078    return DECL_FUNCTION_INNER_ACCESS (decl);
12079
12080  class = DECL_CONTEXT (decl);
12081
12082  /* Obtain an access identifier and mark it */
12083  id = build_new_access_id ();
12084  OUTER_FIELD_ACCESS_IDENTIFIER_P (id) = 1;
12085
12086  carg = TYPE_ARG_TYPES (TREE_TYPE (decl));
12087  /* Create the arguments, as much as the original */
12088  for (; carg && carg != end_params_node;
12089       carg = TREE_CHAIN (carg))
12090    {
12091      sprintf (buffer, "write_parm_value$%d", parm_id_count++);
12092      args = chainon (args, build_tree_list (get_identifier (buffer),
12093					     TREE_VALUE (carg)));
12094    }
12095  args = chainon (args, end_params_node);
12096
12097  /* Create the method */
12098  mdecl = create_artificial_method (class, ACC_STATIC,
12099				    TREE_TYPE (TREE_TYPE (decl)), id, args);
12100  layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
12101  /* There is a potential bug here. We should be able to use
12102     fix_method_argument_names, but then arg names get mixed up and
12103     eventually a constructor will have its this$0 altered and the
12104     outer context won't be assignment properly. The test case is
12105     stub.java FIXME */
12106  TYPE_ARG_TYPES (TREE_TYPE (mdecl)) = args;
12107
12108  /* Attach the method body. */
12109  saved_current_function_decl = current_function_decl;
12110  start_artificial_method_body (mdecl);
12111
12112  /* The actual method invocation uses the same args. When invoking a
12113     static methods that way, we don't want to skip the first
12114     argument. */
12115  carg = args;
12116  if (!METHOD_STATIC (decl))
12117    carg = TREE_CHAIN (carg);
12118  for (; carg && carg != end_params_node; carg = TREE_CHAIN (carg))
12119    call_args = tree_cons (NULL_TREE, build_wfl_node (TREE_PURPOSE (carg)),
12120			   call_args);
12121
12122  body = build_method_invocation (build_wfl_node (DECL_NAME (decl)),
12123				  call_args);
12124  if (!METHOD_STATIC (decl))
12125    body = make_qualified_primary (build_wfl_node (TREE_PURPOSE (args)),
12126				   body, 0);
12127  if (TREE_TYPE (TREE_TYPE (decl)) != void_type_node)
12128    body = build_return (0, body);
12129  java_method_add_stmt (mdecl,body);
12130  end_artificial_method_body (mdecl);
12131  current_function_decl = saved_current_function_decl;
12132
12133  /* Back tag the access function so it know what it accesses */
12134  DECL_FUNCTION_ACCESS_DECL (decl) = mdecl;
12135
12136  /* Tag the current method so it knows it has an access generated */
12137  return DECL_FUNCTION_INNER_ACCESS (decl) = mdecl;
12138}
12139
12140
12141/* This section of the code deals with building expressions to access
12142   the enclosing instance of an inner class. The enclosing instance is
12143   kept in a generated field called this$<n>, with <n> being the
12144   inner class nesting level (starting from 0.)  */
12145
12146/* Build an access to a given this$<n>, always chaining access call to
12147   others. Access methods to this$<n> are build on the fly if
12148   necessary. This CAN'T be used to solely access this$<n-1> from
12149   this$<n> (which alway yield to special cases and optimization, see
12150   for example build_outer_field_access).  */
12151
12152static tree
12153build_access_to_thisn (from, to, lc)
12154     tree from, to;
12155     int lc;
12156{
12157  tree access = NULL_TREE;
12158
12159  while (from != to && PURE_INNER_CLASS_TYPE_P (from))
12160    {
12161      if (!access)
12162        {
12163          access = build_current_thisn (from);
12164          access = build_wfl_node (access);
12165        }
12166      else
12167	{
12168	  tree access0_wfl, cn;
12169
12170	  maybe_build_thisn_access_method (from);
12171	  access0_wfl = build_wfl_node (access0_identifier_node);
12172	  cn = build_wfl_node (DECL_NAME (TYPE_NAME (from)));
12173	  EXPR_WFL_LINECOL (access0_wfl) = lc;
12174	  access = build_tree_list (NULL_TREE, access);
12175	  access = build_method_invocation (access0_wfl, access);
12176	  access = make_qualified_primary (cn, access, lc);
12177	}
12178
12179      /* If FROM isn't an inner class, that's fine, we've done enough.
12180         What we're looking for can be accessed from there.  */
12181      from = DECL_CONTEXT (TYPE_NAME (from));
12182      if (!from)
12183	break;
12184      from = TREE_TYPE (from);
12185    }
12186  return access;
12187}
12188
12189/* Build an access function to the this$<n> local to TYPE. NULL_TREE
12190   is returned if nothing needs to be generated. Otherwise, the method
12191   generated and a method decl is returned.
12192
12193   NOTE: These generated methods should be declared in a class file
12194   attribute so that they can't be referred to directly.  */
12195
12196static tree
12197maybe_build_thisn_access_method (type)
12198    tree type;
12199{
12200  tree mdecl, args, stmt, rtype;
12201  tree saved_current_function_decl;
12202
12203  /* If TYPE is a top-level class, no access method is required.
12204     If there already is such an access method, bail out. */
12205  if (CLASS_ACCESS0_GENERATED_P (type) || !PURE_INNER_CLASS_TYPE_P (type))
12206    return NULL_TREE;
12207
12208  /* We generate the method. The method looks like:
12209     static <outer_of_type> access$0 (<type> inst$) { return inst$.this$<n>; }
12210  */
12211  args = build_tree_list (inst_id, build_pointer_type (type));
12212  TREE_CHAIN (args) = end_params_node;
12213  rtype = build_pointer_type (TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))));
12214  mdecl = create_artificial_method (type, ACC_STATIC, rtype,
12215				    access0_identifier_node, args);
12216  fix_method_argument_names (args, mdecl);
12217  layout_class_method (type, NULL_TREE, mdecl, NULL_TREE);
12218  stmt = build_current_thisn (type);
12219  stmt = make_qualified_primary (build_wfl_node (inst_id),
12220				 build_wfl_node (stmt), 0);
12221  stmt = build_return (0, stmt);
12222
12223  saved_current_function_decl = current_function_decl;
12224  start_artificial_method_body (mdecl);
12225  java_method_add_stmt (mdecl, stmt);
12226  end_artificial_method_body (mdecl);
12227  current_function_decl = saved_current_function_decl;
12228
12229  CLASS_ACCESS0_GENERATED_P (type) = 1;
12230
12231  return mdecl;
12232}
12233
12234/* Craft an correctly numbered `this$<n>'string. this$0 is used for
12235   the first level of innerclassing. this$1 for the next one, etc...
12236   This function can be invoked with TYPE to NULL, available and then
12237   has to count the parser context.  */
12238
12239static GTY(()) tree saved_thisn;
12240static GTY(()) tree saved_type;
12241
12242static tree
12243build_current_thisn (type)
12244    tree type;
12245{
12246  static int saved_i = -1;
12247  static int saved_type_i = 0;
12248  tree decl;
12249  char buffer [24];
12250  int i = 0;
12251
12252  if (type)
12253    {
12254      if (type == saved_type)
12255	i = saved_type_i;
12256      else
12257	{
12258	  for (i = -1, decl = DECL_CONTEXT (TYPE_NAME (type));
12259	       decl; decl = DECL_CONTEXT (decl), i++)
12260	    ;
12261
12262	  saved_type = type;
12263	  saved_type_i = i;
12264	}
12265    }
12266  else
12267    i = list_length (GET_CPC_LIST ())-2;
12268
12269  if (i == saved_i)
12270    return saved_thisn;
12271
12272  sprintf (buffer, "this$%d", i);
12273  saved_i = i;
12274  saved_thisn = get_identifier (buffer);
12275  return saved_thisn;
12276}
12277
12278/* Return the assignement to the hidden enclosing context `this$<n>'
12279   by the second incoming parameter to the innerclass constructor. The
12280   form used is `this.this$<n> = this$<n>;'.  */
12281
12282static tree
12283build_thisn_assign ()
12284{
12285  if (current_class && PURE_INNER_CLASS_TYPE_P (current_class))
12286    {
12287      tree thisn = build_current_thisn (current_class);
12288      tree lhs = make_qualified_primary (build_wfl_node (this_identifier_node),
12289					 build_wfl_node (thisn), 0);
12290      tree rhs = build_wfl_node (thisn);
12291      EXPR_WFL_SET_LINECOL (lhs, lineno, 0);
12292      return build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (lhs), lhs, rhs);
12293    }
12294  return NULL_TREE;
12295}
12296
12297
12298/* Building the synthetic `class$' used to implement the `.class' 1.1
12299   extension for non primitive types. This method looks like:
12300
12301    static Class class$(String type) throws NoClassDefFoundError
12302    {
12303      try {return (java.lang.Class.forName (String));}
12304      catch (ClassNotFoundException e) {
12305        throw new NoClassDefFoundError(e.getMessage());}
12306    } */
12307
12308static GTY(()) tree get_message_wfl;
12309static GTY(()) tree type_parm_wfl;
12310
12311static tree
12312build_dot_class_method (class)
12313     tree class;
12314{
12315#define BWF(S) build_wfl_node (get_identifier ((S)))
12316#define MQN(X,Y) make_qualified_name ((X), (Y), 0)
12317  tree args, tmp, saved_current_function_decl, mdecl;
12318  tree stmt, throw_stmt;
12319
12320  if (!get_message_wfl)
12321    {
12322      get_message_wfl = build_wfl_node (get_identifier ("getMessage"));
12323      type_parm_wfl = build_wfl_node (get_identifier ("type$"));
12324    }
12325
12326  /* Build the arguments */
12327  args = build_tree_list (get_identifier ("type$"),
12328			  build_pointer_type (string_type_node));
12329  TREE_CHAIN (args) = end_params_node;
12330
12331  /* Build the qualified name java.lang.Class.forName */
12332  tmp = MQN (MQN (MQN (BWF ("java"),
12333		       BWF ("lang")), BWF ("Class")), BWF ("forName"));
12334  load_class (class_not_found_type_node, 1);
12335  load_class (no_class_def_found_type_node, 1);
12336
12337  /* Create the "class$" function */
12338  mdecl = create_artificial_method (class, ACC_STATIC,
12339				    build_pointer_type (class_type_node),
12340				    classdollar_identifier_node, args);
12341  DECL_FUNCTION_THROWS (mdecl) =
12342    build_tree_list (NULL_TREE, no_class_def_found_type_node);
12343
12344  /* We start by building the try block. We need to build:
12345       return (java.lang.Class.forName (type)); */
12346  stmt = build_method_invocation (tmp,
12347				  build_tree_list (NULL_TREE, type_parm_wfl));
12348  stmt = build_return (0, stmt);
12349
12350  /* Now onto the catch block. We start by building the expression
12351     throwing a new exception: throw new NoClassDefFoundError (_.getMessage) */
12352  throw_stmt = make_qualified_name (build_wfl_node (wpv_id),
12353				    get_message_wfl, 0);
12354  throw_stmt = build_method_invocation (throw_stmt, NULL_TREE);
12355
12356  /* Build new NoClassDefFoundError (_.getMessage) */
12357  throw_stmt = build_new_invocation
12358    (build_wfl_node (get_identifier ("NoClassDefFoundError")),
12359     build_tree_list (build_pointer_type (string_type_node), throw_stmt));
12360
12361  /* Build the throw, (it's too early to use BUILD_THROW) */
12362  throw_stmt = build1 (THROW_EXPR, NULL_TREE, throw_stmt);
12363
12364  /* Encapsulate STMT in a try block. The catch clause executes THROW_STMT */
12365  stmt = encapsulate_with_try_catch (0, class_not_found_type_node,
12366				     stmt, throw_stmt);
12367
12368  fix_method_argument_names (args, mdecl);
12369  layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
12370  saved_current_function_decl = current_function_decl;
12371  start_artificial_method_body (mdecl);
12372  java_method_add_stmt (mdecl, stmt);
12373  end_artificial_method_body (mdecl);
12374  current_function_decl = saved_current_function_decl;
12375  TYPE_DOT_CLASS (class) = mdecl;
12376
12377  return mdecl;
12378}
12379
12380static tree
12381build_dot_class_method_invocation (type)
12382     tree type;
12383{
12384  tree sig_id, s;
12385
12386  if (TYPE_ARRAY_P (type))
12387    sig_id = build_java_signature (type);
12388  else
12389    sig_id = DECL_NAME (TYPE_NAME (type));
12390
12391  /* Ensure that the proper name separator is used */
12392  sig_id = unmangle_classname (IDENTIFIER_POINTER (sig_id),
12393			       IDENTIFIER_LENGTH (sig_id));
12394
12395  s = build_string (IDENTIFIER_LENGTH (sig_id),
12396		    IDENTIFIER_POINTER (sig_id));
12397  return build_method_invocation (build_wfl_node (classdollar_identifier_node),
12398				  build_tree_list (NULL_TREE, s));
12399}
12400
12401/* This section of the code deals with constructor.  */
12402
12403/* Craft a body for default constructor. Patch existing constructor
12404   bodies with call to super() and field initialization statements if
12405   necessary.  */
12406
12407static void
12408fix_constructors (mdecl)
12409     tree mdecl;
12410{
12411  tree iii;			/* Instance Initializer Invocation */
12412  tree body = DECL_FUNCTION_BODY (mdecl);
12413  tree thisn_assign, compound = NULL_TREE;
12414  tree class_type = DECL_CONTEXT (mdecl);
12415
12416  if (DECL_FIXED_CONSTRUCTOR_P (mdecl))
12417    return;
12418  DECL_FIXED_CONSTRUCTOR_P (mdecl) = 1;
12419
12420  if (!body)
12421    {
12422      /* It is an error for the compiler to generate a default
12423	 constructor if the superclass doesn't have a constructor that
12424	 takes no argument, or the same args for an anonymous class */
12425      if (verify_constructor_super (mdecl))
12426	{
12427	  tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (class_type));
12428	  tree save = DECL_NAME (mdecl);
12429	  const char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
12430	  DECL_NAME (mdecl) = DECL_NAME (sclass_decl);
12431	  parse_error_context
12432	    (lookup_cl (TYPE_NAME (class_type)),
12433	     "No constructor matching `%s' found in class `%s'",
12434	     lang_printable_name (mdecl, 0), n);
12435	  DECL_NAME (mdecl) = save;
12436	}
12437
12438      /* The constructor body must be crafted by hand. It's the
12439	 constructor we defined when we realize we didn't have the
12440	 CLASSNAME() constructor */
12441      start_artificial_method_body (mdecl);
12442
12443      /* Insert an assignment to the this$<n> hidden field, if
12444         necessary */
12445      if ((thisn_assign = build_thisn_assign ()))
12446	java_method_add_stmt (mdecl, thisn_assign);
12447
12448      /* We don't generate a super constructor invocation if we're
12449	 compiling java.lang.Object. build_super_invocation takes care
12450	 of that. */
12451      java_method_add_stmt (mdecl, build_super_invocation (mdecl));
12452
12453      /* FIXME */
12454      if ((iii = build_instinit_invocation (class_type)))
12455	java_method_add_stmt (mdecl, iii);
12456
12457      end_artificial_method_body (mdecl);
12458    }
12459  /* Search for an explicit constructor invocation */
12460  else
12461    {
12462      int found = 0;
12463      int invokes_this = 0;
12464      tree found_call = NULL_TREE;
12465      tree main_block = BLOCK_EXPR_BODY (body);
12466
12467      while (body)
12468	switch (TREE_CODE (body))
12469	  {
12470	  case CALL_EXPR:
12471	    found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
12472	    if (CALL_THIS_CONSTRUCTOR_P (body))
12473	      invokes_this = 1;
12474	    body = NULL_TREE;
12475	    break;
12476	  case COMPOUND_EXPR:
12477	  case EXPR_WITH_FILE_LOCATION:
12478	    found_call = body;
12479	    body = TREE_OPERAND (body, 0);
12480	    break;
12481	  case BLOCK:
12482	    found_call = body;
12483	    body = BLOCK_EXPR_BODY (body);
12484	    break;
12485	  default:
12486	    found = 0;
12487	    body = NULL_TREE;
12488	  }
12489
12490      /* Generate the assignment to this$<n>, if necessary */
12491      if ((thisn_assign = build_thisn_assign ()))
12492        compound = add_stmt_to_compound (compound, NULL_TREE, thisn_assign);
12493
12494      /* The constructor is missing an invocation of super() */
12495      if (!found)
12496	compound = add_stmt_to_compound (compound, NULL_TREE,
12497                                         build_super_invocation (mdecl));
12498      /* Explicit super() invokation should take place before the
12499         instance initializer blocks. */
12500      else
12501	{
12502	  compound = add_stmt_to_compound (compound, NULL_TREE,
12503					   TREE_OPERAND (found_call, 0));
12504	  TREE_OPERAND (found_call, 0) = empty_stmt_node;
12505	}
12506
12507      DECL_INIT_CALLS_THIS (mdecl) = invokes_this;
12508
12509      /* Insert the instance initializer block right after. */
12510      if (!invokes_this && (iii = build_instinit_invocation (class_type)))
12511	compound = add_stmt_to_compound (compound, NULL_TREE, iii);
12512
12513      /* Fix the constructor main block if we're adding extra stmts */
12514      if (compound)
12515	{
12516	  compound = add_stmt_to_compound (compound, NULL_TREE,
12517					   BLOCK_EXPR_BODY (main_block));
12518	  BLOCK_EXPR_BODY (main_block) = compound;
12519	}
12520    }
12521}
12522
12523/* Browse constructors in the super class, searching for a constructor
12524   that doesn't take any argument. Return 0 if one is found, 1
12525   otherwise.  If the current class is an anonymous inner class, look
12526   for something that has the same signature. */
12527
12528static int
12529verify_constructor_super (mdecl)
12530     tree mdecl;
12531{
12532  tree class = CLASSTYPE_SUPER (current_class);
12533  int super_inner = PURE_INNER_CLASS_TYPE_P (class);
12534  tree sdecl;
12535
12536  if (!class)
12537    return 0;
12538
12539  if (ANONYMOUS_CLASS_P (current_class))
12540    {
12541      tree mdecl_arg_type;
12542      SKIP_THIS_AND_ARTIFICIAL_PARMS (mdecl_arg_type, mdecl);
12543      for (sdecl = TYPE_METHODS (class); sdecl; sdecl = TREE_CHAIN (sdecl))
12544	if (DECL_CONSTRUCTOR_P (sdecl))
12545	  {
12546	    tree m_arg_type;
12547	    tree arg_type = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
12548	    if (super_inner)
12549	      arg_type = TREE_CHAIN (arg_type);
12550	    for (m_arg_type = mdecl_arg_type;
12551		 (arg_type != end_params_node
12552		  && m_arg_type != end_params_node);
12553		 arg_type = TREE_CHAIN (arg_type),
12554		   m_arg_type = TREE_CHAIN (m_arg_type))
12555	      if (!valid_method_invocation_conversion_p
12556		     (TREE_VALUE (arg_type),
12557		      TREE_VALUE (m_arg_type)))
12558		break;
12559
12560	    if (arg_type == end_params_node && m_arg_type == end_params_node)
12561	      return 0;
12562	  }
12563    }
12564  else
12565    {
12566      for (sdecl = TYPE_METHODS (class); sdecl; sdecl = TREE_CHAIN (sdecl))
12567	{
12568	  tree arg = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
12569	  if (super_inner)
12570	    arg = TREE_CHAIN (arg);
12571	  if (DECL_CONSTRUCTOR_P (sdecl) && arg == end_params_node)
12572	    return 0;
12573	}
12574    }
12575  return 1;
12576}
12577
12578/* Generate code for all context remembered for code generation.  */
12579
12580static GTY(()) tree reversed_class_list;
12581void
12582java_expand_classes ()
12583{
12584  int save_error_count = 0;
12585  static struct parser_ctxt *cur_ctxp = NULL;
12586
12587  java_parse_abort_on_error ();
12588  if (!(ctxp = ctxp_for_generation))
12589    return;
12590  java_layout_classes ();
12591  java_parse_abort_on_error ();
12592
12593  for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
12594    {
12595      ctxp = cur_ctxp;
12596      input_filename = ctxp->filename;
12597      lang_init_source (2);	       /* Error msgs have method prototypes */
12598      java_complete_expand_classes (); /* Complete and expand classes */
12599      java_parse_abort_on_error ();
12600    }
12601  input_filename = main_input_filename;
12602
12603
12604  /* Find anonymous classes and expand their constructor. This extra pass is
12605     neccessary because the constructor itself is only generated when the
12606     method in which it is defined is expanded. */
12607  for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
12608    {
12609      tree current;
12610      ctxp = cur_ctxp;
12611      for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
12612	{
12613	  current_class = TREE_TYPE (current);
12614	  if (ANONYMOUS_CLASS_P (current_class))
12615	    {
12616	      tree d;
12617	      for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d))
12618		{
12619		  if (DECL_CONSTRUCTOR_P (d))
12620		    {
12621		      restore_line_number_status (1);
12622		      java_complete_expand_method (d);
12623		      restore_line_number_status (0);
12624		      break;	/* There is only one constructor. */
12625		    }
12626		}
12627	    }
12628	}
12629    }
12630
12631  /* Expanding the constructors of anonymous classes generates access
12632     methods.  Scan all the methods looking for null DECL_RESULTs --
12633     this will be the case if a method hasn't been expanded.  */
12634  for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
12635    {
12636      tree current;
12637      ctxp = cur_ctxp;
12638      for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
12639	{
12640	  tree d;
12641	  current_class = TREE_TYPE (current);
12642	  for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d))
12643	    {
12644	      if (DECL_RESULT (d) == NULL_TREE)
12645		{
12646		  restore_line_number_status (1);
12647		  java_complete_expand_method (d);
12648		  restore_line_number_status (0);
12649		}
12650	    }
12651	}
12652    }
12653
12654  /* ???  Instead of all this we could iterate around the list of
12655     classes until there were no more un-expanded methods.  It would
12656     take a little longer -- one pass over the whole list of methods
12657     -- but it would be simpler.  Like this:  */
12658#if 0
12659    {
12660      int something_changed;
12661
12662      do
12663	{
12664	  something_changed = 0;
12665	  for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
12666	    {
12667	      tree current;
12668	      ctxp = cur_ctxp;
12669	      for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
12670		{
12671		  tree d;
12672		  current_class = TREE_TYPE (current);
12673		  for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d))
12674		    {
12675		      if (DECL_RESULT (d) == NULL_TREE)
12676			{
12677			  something_changed = 1;
12678			  restore_line_number_status (1);
12679			  java_complete_expand_method (d);
12680			  restore_line_number_status (0);
12681			}
12682		    }
12683		}
12684	    }
12685	}
12686      while (something_changed);
12687    }
12688#endif
12689
12690  /* If we've found error at that stage, don't try to generate
12691     anything, unless we're emitting xrefs or checking the syntax only
12692     (but not using -fsyntax-only for the purpose of generating
12693     bytecode. */
12694  if (java_error_count && !flag_emit_xref
12695      && (!flag_syntax_only && !flag_emit_class_files))
12696    return;
12697
12698  /* Now things are stable, go for generation of the class data. */
12699
12700  /* We pessimistically marked all fields external until we knew
12701     what set of classes we were planning to compile.  Now mark
12702     those that will be generated locally as not external.  */
12703  for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
12704    {
12705      tree current;
12706      ctxp = cur_ctxp;
12707      for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
12708	{
12709	  tree class = TREE_TYPE (current);
12710	  tree field;
12711	  for (field = TYPE_FIELDS (class); field ; field = TREE_CHAIN (field))
12712	    if (FIELD_STATIC (field))
12713	      DECL_EXTERNAL (field) = 0;
12714	}
12715    }
12716
12717  /* Compile the classes.  */
12718  for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
12719    {
12720      tree current;
12721      reversed_class_list = NULL;
12722
12723      ctxp = cur_ctxp;
12724
12725      /* We write out the classes in reverse order.  This ensures that
12726	 inner classes are written before their containing classes,
12727	 which is important for parallel builds.  Otherwise, the
12728	 class file for the outer class may be found, but the class
12729	 file for the inner class may not be present.  In that
12730	 situation, the compiler cannot fall back to the original
12731	 source, having already read the outer class, so we must
12732	 prevent that situation.  */
12733      for (current = ctxp->class_list;
12734	   current;
12735	   current = TREE_CHAIN (current))
12736	reversed_class_list
12737	  = tree_cons (NULL_TREE, current, reversed_class_list);
12738
12739      for (current = reversed_class_list;
12740	   current;
12741	   current = TREE_CHAIN (current))
12742	{
12743	  current_class = TREE_TYPE (TREE_VALUE (current));
12744	  outgoing_cpool = TYPE_CPOOL (current_class);
12745	  if (flag_emit_class_files)
12746	    write_classfile (current_class);
12747	  if (flag_emit_xref)
12748	    expand_xref (current_class);
12749	  else if (! flag_syntax_only)
12750	    {
12751	      java_expand_method_bodies (current_class);
12752	      finish_class ();
12753	    }
12754	}
12755    }
12756}
12757
12758/* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
12759   a tree list node containing RIGHT. Fore coming RIGHTs will be
12760   chained to this hook. LOCATION contains the location of the
12761   separating `.' operator.  */
12762
12763static tree
12764make_qualified_primary (primary, right, location)
12765     tree primary, right;
12766     int location;
12767{
12768  tree wfl;
12769
12770  if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
12771    wfl = build_wfl_wrap (primary, location);
12772  else
12773    {
12774      wfl = primary;
12775      /* If wfl wasn't qualified, we build a first anchor */
12776      if (!EXPR_WFL_QUALIFICATION (wfl))
12777	EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (wfl, NULL_TREE);
12778    }
12779
12780  /* And chain them */
12781  EXPR_WFL_LINECOL (right) = location;
12782  chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE));
12783  PRIMARY_P (wfl) =  1;
12784  return wfl;
12785}
12786
12787/* Simple merge of two name separated by a `.' */
12788
12789static tree
12790merge_qualified_name (left, right)
12791     tree left, right;
12792{
12793  tree node;
12794  if (!left && !right)
12795    return NULL_TREE;
12796
12797  if (!left)
12798    return right;
12799
12800  if (!right)
12801    return left;
12802
12803  obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left),
12804		IDENTIFIER_LENGTH (left));
12805  obstack_1grow (&temporary_obstack, '.');
12806  obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right),
12807		 IDENTIFIER_LENGTH (right));
12808  node =  get_identifier (obstack_base (&temporary_obstack));
12809  obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
12810  QUALIFIED_P (node) = 1;
12811  return node;
12812}
12813
12814/* Merge the two parts of a qualified name into LEFT.  Set the
12815   location information of the resulting node to LOCATION, usually
12816   inherited from the location information of the `.' operator. */
12817
12818static tree
12819make_qualified_name (left, right, location)
12820     tree left, right;
12821     int location;
12822{
12823#ifdef USE_COMPONENT_REF
12824  tree node = build (COMPONENT_REF, NULL_TREE, left, right);
12825  EXPR_WFL_LINECOL (node) = location;
12826  return node;
12827#else
12828  tree left_id = EXPR_WFL_NODE (left);
12829  tree right_id = EXPR_WFL_NODE (right);
12830  tree wfl, merge;
12831
12832  merge = merge_qualified_name (left_id, right_id);
12833
12834  /* Left wasn't qualified and is now qualified */
12835  if (!QUALIFIED_P (left_id))
12836    {
12837      tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0);
12838      EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left);
12839      EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
12840    }
12841
12842  wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0);
12843  EXPR_WFL_LINECOL (wfl) = location;
12844  chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE));
12845
12846  EXPR_WFL_NODE (left) = merge;
12847  return left;
12848#endif
12849}
12850
12851/* Extract the last identifier component of the qualified in WFL. The
12852   last identifier is removed from the linked list */
12853
12854static tree
12855cut_identifier_in_qualified (wfl)
12856     tree wfl;
12857{
12858  tree q;
12859  tree previous = NULL_TREE;
12860  for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q))
12861    if (!TREE_CHAIN (q))
12862      {
12863	if (!previous)
12864	  /* Operating on a non qualified qualified WFL.  */
12865	  abort ();
12866
12867	TREE_CHAIN (previous) = NULL_TREE;
12868	return TREE_PURPOSE (q);
12869      }
12870}
12871
12872/* Resolve the expression name NAME. Return its decl.  */
12873
12874static tree
12875resolve_expression_name (id, orig)
12876     tree id;
12877     tree *orig;
12878{
12879  tree name = EXPR_WFL_NODE (id);
12880  tree decl;
12881
12882  /* 6.5.5.1: Simple expression names */
12883  if (!PRIMARY_P (id) && !QUALIFIED_P (name))
12884    {
12885      /* 15.13.1: NAME can appear within the scope of a local variable
12886         declaration */
12887      if ((decl = IDENTIFIER_LOCAL_VALUE (name)))
12888        return decl;
12889
12890      /* 15.13.1: NAME can appear within a class declaration */
12891      else
12892        {
12893	  decl = lookup_field_wrapper (current_class, name);
12894	  if (decl)
12895	    {
12896	      tree access = NULL_TREE;
12897	      int fs = FIELD_STATIC (decl);
12898
12899	      /* If we're accessing an outer scope local alias, make
12900		 sure we change the name of the field we're going to
12901		 build access to. */
12902	      if (FIELD_LOCAL_ALIAS_USED (decl))
12903		name = DECL_NAME (decl);
12904
12905	      /* Instance variable (8.3.1.1) can't appear within
12906		 static method, static initializer or initializer for
12907		 a static variable. */
12908	      if (!fs && METHOD_STATIC (current_function_decl))
12909	        {
12910		  static_ref_err (id, name, current_class);
12911		  return error_mark_node;
12912		}
12913	      /* Instance variables can't appear as an argument of
12914		 an explicit constructor invocation */
12915	      if (!fs && ctxp->explicit_constructor_p
12916		  && !enclosing_context_p (DECL_CONTEXT (decl), current_class))
12917		{
12918		  parse_error_context
12919		    (id, "Can't reference `%s' before the superclass constructor has been called", IDENTIFIER_POINTER (name));
12920		  return error_mark_node;
12921		}
12922
12923	      /* If we're processing an inner class and we're trying
12924		 to access a field belonging to an outer class, build
12925		 the access to the field */
12926	      if (!fs && outer_field_access_p (current_class, decl))
12927		{
12928		  if (CLASS_STATIC (TYPE_NAME (current_class)))
12929		    {
12930		      static_ref_err (id, DECL_NAME (decl), current_class);
12931		      return error_mark_node;
12932		    }
12933		  access = build_outer_field_access (id, decl);
12934		  if (orig)
12935		    *orig = access;
12936		  return access;
12937		}
12938
12939	      /* Otherwise build what it takes to access the field */
12940	      access = build_field_ref ((fs ? NULL_TREE : current_this),
12941					DECL_CONTEXT (decl), name);
12942	      if (fs)
12943		access = maybe_build_class_init_for_field (decl, access);
12944	      /* We may be asked to save the real field access node */
12945	      if (orig)
12946		*orig = access;
12947	      /* And we return what we got */
12948	      return access;
12949	    }
12950	  /* Fall down to error report on undefined variable */
12951	}
12952    }
12953  /* 6.5.5.2 Qualified Expression Names */
12954  else
12955    {
12956      if (orig)
12957	*orig = NULL_TREE;
12958      qualify_ambiguous_name (id);
12959      /* 15.10.1 Field Access Using a Primary and/or Expression Name */
12960      /* 15.10.2: Accessing Superclass Members using super */
12961      return resolve_field_access (id, orig, NULL);
12962    }
12963
12964  /* We've got an error here */
12965  if (INNER_CLASS_TYPE_P (current_class))
12966    parse_error_context (id,
12967			 "Local variable `%s' can't be accessed from within the inner class `%s' unless it is declared final",
12968			 IDENTIFIER_POINTER (name),
12969			 IDENTIFIER_POINTER (DECL_NAME
12970					     (TYPE_NAME (current_class))));
12971  else
12972    parse_error_context (id, "Undefined variable `%s'",
12973			 IDENTIFIER_POINTER (name));
12974
12975  return error_mark_node;
12976}
12977
12978static void
12979static_ref_err (wfl, field_id, class_type)
12980    tree wfl, field_id, class_type;
12981{
12982  parse_error_context
12983    (wfl,
12984     "Can't make a static reference to nonstatic variable `%s' in class `%s'",
12985     IDENTIFIER_POINTER (field_id),
12986     IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))));
12987}
12988
12989/* 15.10.1 Field Access Using a Primary and/or Expression Name.
12990   We return something suitable to generate the field access. We also
12991   return the field decl in FIELD_DECL and its type in FIELD_TYPE.  If
12992   recipient's address can be null. */
12993
12994static tree
12995resolve_field_access (qual_wfl, field_decl, field_type)
12996     tree qual_wfl;
12997     tree *field_decl, *field_type;
12998{
12999  int is_static = 0;
13000  tree field_ref;
13001  tree decl, where_found, type_found;
13002
13003  if (resolve_qualified_expression_name (qual_wfl, &decl,
13004					 &where_found, &type_found))
13005    return error_mark_node;
13006
13007  /* Resolve the LENGTH field of an array here */
13008  if (DECL_P (decl) && DECL_NAME (decl) == length_identifier_node
13009      && type_found && TYPE_ARRAY_P (type_found)
13010      && ! flag_emit_class_files && ! flag_emit_xref)
13011    {
13012      tree length = build_java_array_length_access (where_found);
13013      field_ref = length;
13014
13015      /* In case we're dealing with a static array, we need to
13016	 initialize its class before the array length can be fetched.
13017	 It's also a good time to create a DECL_RTL for the field if
13018	 none already exists, otherwise if the field was declared in a
13019	 class found in an external file and hasn't been (and won't
13020	 be) accessed for its value, none will be created. */
13021      if (TREE_CODE (where_found) == VAR_DECL && FIELD_STATIC (where_found))
13022	{
13023	  build_static_field_ref (where_found);
13024	  field_ref = build_class_init (DECL_CONTEXT (where_found), field_ref);
13025	}
13026    }
13027  /* We might have been trying to resolve field.method(). In which
13028     case, the resolution is over and decl is the answer */
13029  else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
13030    field_ref = decl;
13031  else if (JDECL_P (decl))
13032    {
13033      if (!type_found)
13034	type_found = DECL_CONTEXT (decl);
13035      is_static = FIELD_STATIC (decl);
13036      field_ref = build_field_ref ((is_static && !flag_emit_xref?
13037				    NULL_TREE : where_found),
13038				   type_found, DECL_NAME (decl));
13039      if (field_ref == error_mark_node)
13040	return error_mark_node;
13041      if (is_static)
13042	field_ref = maybe_build_class_init_for_field (decl, field_ref);
13043
13044      /* If we're looking at a static field, we may need to generate a
13045	 class initialization for it.  This can happen when the access
13046	 looks like `field.ref', where `field' is a static field in an
13047	 interface we implement.  */
13048      if (!flag_emit_class_files
13049	  && !flag_emit_xref
13050	  && TREE_CODE (where_found) == VAR_DECL
13051	  && FIELD_STATIC (where_found))
13052	{
13053	  build_static_field_ref (where_found);
13054	  field_ref = build_class_init (DECL_CONTEXT (where_found), field_ref);
13055	}
13056    }
13057  else
13058    field_ref = decl;
13059
13060  if (field_decl)
13061    *field_decl = decl;
13062  if (field_type)
13063    *field_type = (QUAL_DECL_TYPE (decl) ?
13064		   QUAL_DECL_TYPE (decl) : TREE_TYPE (decl));
13065  return field_ref;
13066}
13067
13068/* If NODE is an access to f static field, strip out the class
13069   initialization part and return the field decl, otherwise, return
13070   NODE. */
13071
13072static tree
13073strip_out_static_field_access_decl (node)
13074    tree node;
13075{
13076  if (TREE_CODE (node) == COMPOUND_EXPR)
13077    {
13078      tree op1 = TREE_OPERAND (node, 1);
13079      if (TREE_CODE (op1) == COMPOUND_EXPR)
13080	 {
13081	   tree call = TREE_OPERAND (op1, 0);
13082	   if (TREE_CODE (call) == CALL_EXPR
13083	       && TREE_CODE (TREE_OPERAND (call, 0)) == ADDR_EXPR
13084	       && TREE_OPERAND (TREE_OPERAND (call, 0), 0)
13085	       == soft_initclass_node)
13086	     return TREE_OPERAND (op1, 1);
13087	 }
13088      else if (JDECL_P (op1))
13089	return op1;
13090    }
13091  return node;
13092}
13093
13094/* 6.5.5.2: Qualified Expression Names */
13095
13096static int
13097resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
13098     tree wfl;
13099     tree *found_decl, *type_found, *where_found;
13100{
13101  int from_type = 0;		/* Field search initiated from a type */
13102  int from_super = 0, from_cast = 0, from_qualified_this = 0;
13103  int previous_call_static = 0;
13104  int is_static;
13105  tree decl = NULL_TREE, type = NULL_TREE, q;
13106  /* For certain for of inner class instantiation */
13107  tree saved_current, saved_this;
13108#define RESTORE_THIS_AND_CURRENT_CLASS 				\
13109  { current_class = saved_current; current_this = saved_this;}
13110
13111  *type_found = *where_found = NULL_TREE;
13112
13113  for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
13114    {
13115      tree qual_wfl = QUAL_WFL (q);
13116      tree ret_decl;		/* for EH checking */
13117      int location;		/* for EH checking */
13118
13119      /* 15.10.1 Field Access Using a Primary */
13120      switch (TREE_CODE (qual_wfl))
13121	{
13122	case CALL_EXPR:
13123	case NEW_CLASS_EXPR:
13124	  /* If the access to the function call is a non static field,
13125	     build the code to access it. */
13126	  if (JDECL_P (decl) && !FIELD_STATIC (decl))
13127	    {
13128	      decl = maybe_access_field (decl, *where_found,
13129					 DECL_CONTEXT (decl));
13130	      if (decl == error_mark_node)
13131		return 1;
13132	    }
13133
13134	  /* And code for the function call */
13135	  if (complete_function_arguments (qual_wfl))
13136	    return 1;
13137
13138	  /* We might have to setup a new current class and a new this
13139	     for the search of an inner class, relative to the type of
13140	     a expression resolved as `decl'. The current values are
13141	     saved and restored shortly after */
13142	  saved_current = current_class;
13143	  saved_this = current_this;
13144	  if (decl
13145	      && (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR
13146		  || from_qualified_this))
13147	    {
13148	      /* If we still have `from_qualified_this', we have the form
13149		 <T>.this.f() and we need to build <T>.this */
13150	      if (from_qualified_this)
13151		{
13152		  decl = build_access_to_thisn (current_class, type, 0);
13153		  decl = java_complete_tree (decl);
13154		  type = TREE_TYPE (TREE_TYPE (decl));
13155		}
13156	      current_class = type;
13157	      current_this = decl;
13158	      from_qualified_this = 0;
13159	    }
13160
13161	  if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
13162	    CALL_USING_SUPER (qual_wfl) = 1;
13163	  location = (TREE_CODE (qual_wfl) == CALL_EXPR ?
13164		      EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0);
13165	  *where_found = patch_method_invocation (qual_wfl, decl, type,
13166						  from_super,
13167						  &is_static, &ret_decl);
13168	  from_super = 0;
13169	  if (*where_found == error_mark_node)
13170	    {
13171	      RESTORE_THIS_AND_CURRENT_CLASS;
13172	      return 1;
13173	    }
13174	  *type_found = type = QUAL_DECL_TYPE (*where_found);
13175
13176	  *where_found = force_evaluation_order (*where_found);
13177
13178	  /* If we're creating an inner class instance, check for that
13179	     an enclosing instance is in scope */
13180	  if (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR
13181	      && INNER_ENCLOSING_SCOPE_CHECK (type))
13182	    {
13183	      parse_error_context
13184		(qual_wfl, "No enclosing instance for inner class `%s' is in scope%s",
13185		 lang_printable_name (type, 0),
13186		 (!current_this ? "" :
13187		  "; an explicit one must be provided when creating this inner class"));
13188	      RESTORE_THIS_AND_CURRENT_CLASS;
13189	      return 1;
13190	    }
13191
13192	  /* In case we had to change then to resolve a inner class
13193	     instantiation using a primary qualified by a `new' */
13194	  RESTORE_THIS_AND_CURRENT_CLASS;
13195
13196	  /* EH check. No check on access$<n> functions */
13197	  if (location
13198	      && !OUTER_FIELD_ACCESS_IDENTIFIER_P
13199	            (DECL_NAME (current_function_decl)))
13200	    check_thrown_exceptions (location, ret_decl);
13201
13202	  /* If the previous call was static and this one is too,
13203	     build a compound expression to hold the two (because in
13204	     that case, previous function calls aren't transported as
13205	     forcoming function's argument. */
13206	  if (previous_call_static && is_static)
13207	    {
13208	      decl = build (COMPOUND_EXPR, TREE_TYPE (*where_found),
13209			    decl, *where_found);
13210	      TREE_SIDE_EFFECTS (decl) = 1;
13211	    }
13212	  else
13213	    {
13214	      previous_call_static = is_static;
13215	      decl = *where_found;
13216	    }
13217	  from_type = 0;
13218	  continue;
13219
13220	case NEW_ARRAY_EXPR:
13221	case NEW_ANONYMOUS_ARRAY_EXPR:
13222	  *where_found = decl = java_complete_tree (qual_wfl);
13223	  if (decl == error_mark_node)
13224	    return 1;
13225	  *type_found = type = QUAL_DECL_TYPE (decl);
13226	  continue;
13227
13228	case CONVERT_EXPR:
13229	  *where_found = decl = java_complete_tree (qual_wfl);
13230	  if (decl == error_mark_node)
13231	    return 1;
13232	  *type_found = type = QUAL_DECL_TYPE (decl);
13233	  from_cast = 1;
13234	  continue;
13235
13236	case CONDITIONAL_EXPR:
13237	case STRING_CST:
13238	case MODIFY_EXPR:
13239	  *where_found = decl = java_complete_tree (qual_wfl);
13240	  if (decl == error_mark_node)
13241	    return 1;
13242	  *type_found = type = QUAL_DECL_TYPE (decl);
13243	  continue;
13244
13245	case ARRAY_REF:
13246	  /* If the access to the function call is a non static field,
13247	     build the code to access it. */
13248	  if (JDECL_P (decl) && !FIELD_STATIC (decl))
13249	    {
13250	      decl = maybe_access_field (decl, *where_found, type);
13251	      if (decl == error_mark_node)
13252		return 1;
13253	    }
13254	  /* And code for the array reference expression */
13255	  decl = java_complete_tree (qual_wfl);
13256	  if (decl == error_mark_node)
13257	    return 1;
13258	  type = QUAL_DECL_TYPE (decl);
13259	  continue;
13260
13261	case PLUS_EXPR:
13262	  if ((decl = java_complete_tree (qual_wfl)) == error_mark_node)
13263	    return 1;
13264	  if ((type = patch_string (decl)))
13265	    decl = type;
13266	  *where_found = QUAL_RESOLUTION (q) = decl;
13267	  *type_found = type = TREE_TYPE (decl);
13268	  break;
13269
13270	case CLASS_LITERAL:
13271	  if ((decl = java_complete_tree (qual_wfl)) == error_mark_node)
13272	    return 1;
13273	  *where_found = QUAL_RESOLUTION (q) = decl;
13274	  *type_found = type = TREE_TYPE (decl);
13275	  break;
13276
13277	default:
13278	  /* Fix for -Wall Just go to the next statement. Don't
13279             continue */
13280	  break;
13281	}
13282
13283      /* If we fall here, we weren't processing a (static) function call. */
13284      previous_call_static = 0;
13285
13286      /* It can be the keyword THIS */
13287      if (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION
13288	  && EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
13289	{
13290	  if (!current_this)
13291	    {
13292	      parse_error_context
13293		(wfl, "Keyword `this' used outside allowed context");
13294	      return 1;
13295	    }
13296	  if (ctxp->explicit_constructor_p
13297	      && type == current_class)
13298	    {
13299	      parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called");
13300	      return 1;
13301	    }
13302	  /* We have to generate code for intermediate access */
13303	  if (!from_type || TREE_TYPE (TREE_TYPE (current_this)) == type)
13304	    {
13305	      *where_found = decl = current_this;
13306	      *type_found = type = QUAL_DECL_TYPE (decl);
13307	    }
13308	  /* We're trying to access the this from somewhere else. Make sure
13309	     it's allowed before doing so. */
13310	  else
13311	    {
13312	      if (!enclosing_context_p (type, current_class))
13313		{
13314		  char *p  = xstrdup (lang_printable_name (type, 0));
13315		  parse_error_context (qual_wfl, "Can't use variable `%s.this': type `%s' isn't an outer type of type `%s'",
13316				       p, p,
13317				       lang_printable_name (current_class, 0));
13318		  free (p);
13319		  return 1;
13320		}
13321	      from_qualified_this = 1;
13322	      /* If there's nothing else after that, we need to
13323                 produce something now, otherwise, the section of the
13324                 code that needs to produce <T>.this will generate
13325                 what is necessary. */
13326	      if (!TREE_CHAIN (q))
13327		{
13328		  decl = build_access_to_thisn (current_class, type, 0);
13329		  *where_found = decl = java_complete_tree (decl);
13330		  *type_found = type = TREE_TYPE (decl);
13331		}
13332	    }
13333
13334	  from_type = 0;
13335	  continue;
13336	}
13337
13338      /* 15.10.2 Accessing Superclass Members using SUPER */
13339      if (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION
13340	  && EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
13341	{
13342	  tree node;
13343	  /* Check on the restricted use of SUPER */
13344	  if (METHOD_STATIC (current_function_decl)
13345	      || current_class == object_type_node)
13346	    {
13347	      parse_error_context
13348		(wfl, "Keyword `super' used outside allowed context");
13349	      return 1;
13350	    }
13351	  /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
13352	  node = build_cast (EXPR_WFL_LINECOL (qual_wfl),
13353			     CLASSTYPE_SUPER (current_class),
13354			     build_this (EXPR_WFL_LINECOL (qual_wfl)));
13355	  *where_found = decl = java_complete_tree (node);
13356	  if (decl == error_mark_node)
13357	    return 1;
13358	  *type_found = type = QUAL_DECL_TYPE (decl);
13359	  from_super = from_type = 1;
13360	  continue;
13361	}
13362
13363      /* 15.13.1: Can't search for field name in packages, so we
13364	 assume a variable/class name was meant. */
13365      if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
13366	{
13367	  tree name;
13368	  if ((decl = resolve_package (wfl, &q, &name)))
13369	    {
13370	      tree list;
13371	      *where_found = decl;
13372
13373	      /* We want to be absolutely sure that the class is laid
13374                 out. We're going to search something inside it. */
13375	      *type_found = type = TREE_TYPE (decl);
13376	      layout_class (type);
13377	      from_type = 1;
13378
13379	      /* Fix them all the way down, if any are left. */
13380	      if (q)
13381		{
13382		  list = TREE_CHAIN (q);
13383		  while (list)
13384		    {
13385		      RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (list)) = 1;
13386		      RESOLVE_PACKAGE_NAME_P (QUAL_WFL (list)) = 0;
13387		      list = TREE_CHAIN (list);
13388		    }
13389		}
13390	    }
13391	  else
13392	    {
13393	      if (from_super || from_cast)
13394		parse_error_context
13395		  ((from_cast ? qual_wfl : wfl),
13396		   "No variable `%s' defined in class `%s'",
13397		   IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
13398		   lang_printable_name (type, 0));
13399	      else
13400		parse_error_context
13401		  (qual_wfl, "Undefined variable or class name: `%s'",
13402		   IDENTIFIER_POINTER (name));
13403	      return 1;
13404	    }
13405	}
13406
13407      /* We have a type name. It's been already resolved when the
13408	 expression was qualified. */
13409      else if (RESOLVE_TYPE_NAME_P (qual_wfl) && QUAL_RESOLUTION (q))
13410	{
13411	  decl = QUAL_RESOLUTION (q);
13412
13413	  /* Sneak preview. If next we see a `new', we're facing a
13414	     qualification with resulted in a type being selected
13415	     instead of a field.  Report the error */
13416	  if(TREE_CHAIN (q)
13417	     && TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR)
13418	    {
13419	      parse_error_context (qual_wfl, "Undefined variable `%s'",
13420				   IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
13421	      return 1;
13422	    }
13423
13424	  if (not_accessible_p (TREE_TYPE (decl), decl, type, 0))
13425	    {
13426	      parse_error_context
13427		(qual_wfl, "Can't access %s field `%s.%s' from `%s'",
13428		 java_accstring_lookup (get_access_flags_from_decl (decl)),
13429		 GET_TYPE_NAME (type),
13430		 IDENTIFIER_POINTER (DECL_NAME (decl)),
13431		 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
13432	      return 1;
13433	    }
13434	  check_deprecation (qual_wfl, decl);
13435
13436	  type = TREE_TYPE (decl);
13437	  from_type = 1;
13438	}
13439      /* We resolve an expression name */
13440      else
13441	{
13442	  tree field_decl = NULL_TREE;
13443
13444	  /* If there exists an early resolution, use it. That occurs
13445	     only once and we know that there are more things to
13446	     come. Don't do that when processing something after SUPER
13447	     (we need more thing to be put in place below */
13448	  if (!from_super && QUAL_RESOLUTION (q))
13449	    {
13450	      decl = QUAL_RESOLUTION (q);
13451	      if (!type)
13452		{
13453		  if (TREE_CODE (decl) == FIELD_DECL && !FIELD_STATIC (decl))
13454		    {
13455		      if (current_this)
13456			*where_found = current_this;
13457		      else
13458			{
13459			  static_ref_err (qual_wfl, DECL_NAME (decl),
13460					  current_class);
13461			  return 1;
13462			}
13463                      if (outer_field_access_p (current_class, decl))
13464                        decl = build_outer_field_access (qual_wfl, decl);
13465		    }
13466		  else
13467		    {
13468		      *where_found = TREE_TYPE (decl);
13469		      if (TREE_CODE (*where_found) == POINTER_TYPE)
13470			*where_found = TREE_TYPE (*where_found);
13471		    }
13472		}
13473	    }
13474
13475	  /* Report and error if we're using a numerical litteral as a
13476             qualifier. It can only be an INTEGER_CST. */
13477	  else if (TREE_CODE (qual_wfl) == INTEGER_CST)
13478	    {
13479	      parse_error_context
13480		(wfl, "Can't use type `%s' as a qualifier",
13481		 lang_printable_name (TREE_TYPE (qual_wfl), 0));
13482	      return 1;
13483	    }
13484
13485	  /* We have to search for a field, knowing the type of its
13486             container. The flag FROM_TYPE indicates that we resolved
13487             the last member of the expression as a type name, which
13488             means that for the resolution of this field, we'll look
13489             for other errors than if it was resolved as a member of
13490             an other field. */
13491	  else
13492	    {
13493	      int is_static;
13494	      tree field_decl_type; /* For layout */
13495
13496	      if (!from_type && !JREFERENCE_TYPE_P (type))
13497		{
13498		  parse_error_context
13499		    (qual_wfl, "Attempt to reference field `%s' in `%s %s'",
13500		     IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
13501		     lang_printable_name (type, 0),
13502		     IDENTIFIER_POINTER (DECL_NAME (decl)));
13503		  return 1;
13504		}
13505
13506	      field_decl = lookup_field_wrapper (type,
13507						 EXPR_WFL_NODE (qual_wfl));
13508
13509	      /* Maybe what we're trying to access to is an inner
13510		 class, only if decl is a TYPE_DECL. */
13511	      if (!field_decl && TREE_CODE (decl) == TYPE_DECL)
13512		{
13513		  tree ptr, inner_decl;
13514
13515		  BUILD_PTR_FROM_NAME (ptr, EXPR_WFL_NODE (qual_wfl));
13516		  inner_decl = resolve_class (decl, ptr, NULL_TREE, qual_wfl);
13517		  if (inner_decl)
13518		    {
13519		      check_inner_class_access (inner_decl, decl, qual_wfl);
13520		      type = TREE_TYPE (inner_decl);
13521		      decl = inner_decl;
13522		      from_type = 1;
13523		      continue;
13524		    }
13525		}
13526
13527	      if (field_decl == NULL_TREE)
13528		{
13529		  parse_error_context
13530		    (qual_wfl, "No variable `%s' defined in type `%s'",
13531		     IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
13532		     GET_TYPE_NAME (type));
13533		  return 1;
13534		}
13535	      if (field_decl == error_mark_node)
13536		return 1;
13537
13538	      /* Layout the type of field_decl, since we may need
13539                 it. Don't do primitive types or loaded classes. The
13540                 situation of non primitive arrays may not handled
13541                 properly here. FIXME */
13542	      if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE)
13543		field_decl_type = TREE_TYPE (TREE_TYPE (field_decl));
13544	      else
13545		field_decl_type = TREE_TYPE (field_decl);
13546	      if (!JPRIMITIVE_TYPE_P (field_decl_type)
13547		  && !CLASS_LOADED_P (field_decl_type)
13548		  && !TYPE_ARRAY_P (field_decl_type))
13549		resolve_and_layout (field_decl_type, NULL_TREE);
13550
13551	      /* Check on accessibility here */
13552	      if (not_accessible_p (current_class, field_decl,
13553				    DECL_CONTEXT (field_decl), from_super))
13554		{
13555		  parse_error_context
13556		    (qual_wfl,
13557		     "Can't access %s field `%s.%s' from `%s'",
13558		     java_accstring_lookup
13559		       (get_access_flags_from_decl (field_decl)),
13560		     GET_TYPE_NAME (type),
13561		     IDENTIFIER_POINTER (DECL_NAME (field_decl)),
13562		     IDENTIFIER_POINTER
13563		       (DECL_NAME (TYPE_NAME (current_class))));
13564		  return 1;
13565		}
13566	      check_deprecation (qual_wfl, field_decl);
13567
13568	      /* There are things to check when fields are accessed
13569	         from type. There are no restrictions on a static
13570	         declaration of the field when it is accessed from an
13571	         interface */
13572	      is_static = FIELD_STATIC (field_decl);
13573	      if (!from_super && from_type
13574		  && !TYPE_INTERFACE_P (type)
13575		  && !is_static
13576		  && (current_function_decl
13577		      && METHOD_STATIC (current_function_decl)))
13578		{
13579		  static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type);
13580		  return 1;
13581		}
13582	      from_cast = from_super = 0;
13583
13584	      /* It's an access from a type but it isn't static, we
13585		 make it relative to `this'. */
13586	      if (!is_static && from_type)
13587		decl = current_this;
13588
13589	      /* If we need to generate something to get a proper
13590		 handle on what this field is accessed from, do it
13591		 now. */
13592	      if (!is_static)
13593		{
13594		  decl = maybe_access_field (decl, *where_found, *type_found);
13595		  if (decl == error_mark_node)
13596		    return 1;
13597		}
13598
13599	      /* We want to keep the location were found it, and the type
13600		 we found. */
13601	      *where_found = decl;
13602	      *type_found = type;
13603
13604	      /* Generate the correct expression for field access from
13605		 qualified this */
13606	      if (from_qualified_this)
13607		{
13608		  field_decl = build_outer_field_access (qual_wfl, field_decl);
13609		  from_qualified_this = 0;
13610		}
13611
13612	      /* This is the decl found and eventually the next one to
13613		 search from */
13614	      decl = field_decl;
13615	    }
13616	  from_type = 0;
13617	  type = QUAL_DECL_TYPE (decl);
13618
13619	  /* Sneak preview. If decl is qualified by a `new', report
13620             the error here to be accurate on the peculiar construct */
13621	  if (TREE_CHAIN (q)
13622	      && TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR
13623	      && !JREFERENCE_TYPE_P (type))
13624	    {
13625	      parse_error_context (qual_wfl, "Attempt to reference field `new' in a `%s'",
13626				   lang_printable_name (type, 0));
13627	      return 1;
13628	    }
13629	}
13630      /* `q' might have changed due to a after package resolution
13631         re-qualification */
13632      if (!q)
13633	break;
13634    }
13635  *found_decl = decl;
13636  return 0;
13637}
13638
13639/* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
13640   can't be accessed from REFERENCE (a record type). If MEMBER
13641   features a protected access, we then use WHERE which, if non null,
13642   holds the type of MEMBER's access that is checked against
13643   6.6.2.1. This function should be used when decl is a field or a
13644   method.  */
13645
13646static int
13647not_accessible_p (reference, member, where, from_super)
13648     tree reference, member;
13649     tree where;
13650     int from_super;
13651{
13652  int access_flag = get_access_flags_from_decl (member);
13653
13654  /* Inner classes are processed by check_inner_class_access */
13655  if (INNER_CLASS_TYPE_P (reference))
13656    return 0;
13657
13658  /* Access always granted for members declared public */
13659  if (access_flag & ACC_PUBLIC)
13660    return 0;
13661
13662  /* Check access on protected members */
13663  if (access_flag & ACC_PROTECTED)
13664    {
13665      /* Access granted if it occurs from within the package
13666         containing the class in which the protected member is
13667         declared */
13668      if (class_in_current_package (DECL_CONTEXT (member)))
13669	return 0;
13670
13671      /* If accessed with the form `super.member', then access is granted */
13672      if (from_super)
13673	return 0;
13674
13675      /* If where is active, access was made through a
13676	 qualifier. Access is granted if the type of the qualifier is
13677	 or is a sublass of the type the access made from (6.6.2.1.)  */
13678      if (where && !inherits_from_p (reference, where))
13679	return 1;
13680
13681      /* Otherwise, access is granted if occurring from the class where
13682	 member is declared or a subclass of it. Find the right
13683	 context to perform the check */
13684      if (PURE_INNER_CLASS_TYPE_P (reference))
13685        {
13686          while (INNER_CLASS_TYPE_P (reference))
13687            {
13688              if (inherits_from_p (reference, DECL_CONTEXT (member)))
13689                return 0;
13690              reference = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (reference)));
13691            }
13692        }
13693      if (inherits_from_p (reference, DECL_CONTEXT (member)))
13694	return 0;
13695      return 1;
13696    }
13697
13698  /* Check access on private members. Access is granted only if it
13699     occurs from within the class in which it is declared -- that does
13700     it for innerclasses too. */
13701  if (access_flag & ACC_PRIVATE)
13702    {
13703      if (reference == DECL_CONTEXT (member))
13704	return 0;
13705      if (enclosing_context_p (reference, DECL_CONTEXT (member)))
13706	return 0;
13707      return 1;
13708    }
13709
13710  /* Default access are permitted only when occurring within the
13711     package in which the type (REFERENCE) is declared. In other words,
13712     REFERENCE is defined in the current package */
13713  if (ctxp->package)
13714    return !class_in_current_package (reference);
13715
13716  /* Otherwise, access is granted */
13717  return 0;
13718}
13719
13720/* Test deprecated decl access.  */
13721static void
13722check_deprecation (wfl, decl)
13723     tree wfl, decl;
13724{
13725  const char *file = DECL_SOURCE_FILE (decl);
13726  /* Complain if the field is deprecated and the file it was defined
13727     in isn't compiled at the same time the file which contains its
13728     use is */
13729  if (DECL_DEPRECATED (decl)
13730      && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file)))
13731    {
13732      char the [20];
13733      switch (TREE_CODE (decl))
13734	{
13735	case FUNCTION_DECL:
13736	  strcpy (the, "method");
13737	  break;
13738	case FIELD_DECL:
13739	case VAR_DECL:
13740	  strcpy (the, "field");
13741	  break;
13742	case TYPE_DECL:
13743	  parse_warning_context (wfl, "The class `%s' has been deprecated",
13744				 IDENTIFIER_POINTER (DECL_NAME (decl)));
13745	  return;
13746	default:
13747	  abort ();
13748	}
13749      /* Don't issue a message if the context as been deprecated as a
13750         whole. */
13751      if (! CLASS_DEPRECATED (TYPE_NAME (DECL_CONTEXT (decl))))
13752	parse_warning_context
13753	  (wfl, "The %s `%s' in class `%s' has been deprecated",
13754	   the, lang_printable_name (decl, 0),
13755	   IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)))));
13756    }
13757}
13758
13759/* Returns 1 if class was declared in the current package, 0 otherwise */
13760
13761static GTY(()) tree cicp_cache;
13762static int
13763class_in_current_package (class)
13764     tree class;
13765{
13766  int qualified_flag;
13767  tree left;
13768
13769  if (cicp_cache == class)
13770    return 1;
13771
13772  qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
13773
13774  /* If the current package is empty and the name of CLASS is
13775     qualified, class isn't in the current package.  If there is a
13776     current package and the name of the CLASS is not qualified, class
13777     isn't in the current package */
13778  if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag))
13779    return 0;
13780
13781  /* If there is not package and the name of CLASS isn't qualified,
13782     they belong to the same unnamed package */
13783  if (!ctxp->package && !qualified_flag)
13784    return 1;
13785
13786  /* Compare the left part of the name of CLASS with the package name */
13787  breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
13788  if (ctxp->package == left)
13789    {
13790      cicp_cache = class;
13791      return 1;
13792    }
13793  return 0;
13794}
13795
13796/* This function may generate code to access DECL from WHERE. This is
13797   done only if certain conditions meet.  */
13798
13799static tree
13800maybe_access_field (decl, where, type)
13801  tree decl, where, type;
13802{
13803  if (TREE_CODE (decl) == FIELD_DECL && decl != current_this
13804      && !FIELD_STATIC (decl))
13805    decl = build_field_ref (where ? where : current_this,
13806			    (type ? type : DECL_CONTEXT (decl)),
13807			    DECL_NAME (decl));
13808  return decl;
13809}
13810
13811/* Build a method invocation, by patching PATCH. If non NULL
13812   and according to the situation, PRIMARY and WHERE may be
13813   used. IS_STATIC is set to 1 if the invoked function is static. */
13814
13815static tree
13816patch_method_invocation (patch, primary, where, from_super,
13817                        is_static, ret_decl)
13818     tree patch, primary, where;
13819     int from_super;
13820     int *is_static;
13821     tree *ret_decl;
13822{
13823  tree wfl = TREE_OPERAND (patch, 0);
13824  tree args = TREE_OPERAND (patch, 1);
13825  tree name = EXPR_WFL_NODE (wfl);
13826  tree list;
13827  int is_static_flag = 0;
13828  int is_super_init = 0;
13829  tree this_arg = NULL_TREE;
13830  int is_array_clone_call = 0;
13831
13832  /* Should be overriden if everything goes well. Otherwise, if
13833     something fails, it should keep this value. It stop the
13834     evaluation of a bogus assignment. See java_complete_tree,
13835     MODIFY_EXPR: for the reasons why we sometimes want to keep on
13836     evaluating an assignment */
13837  TREE_TYPE (patch) = error_mark_node;
13838
13839  /* Since lookup functions are messing with line numbers, save the
13840     context now.  */
13841  java_parser_context_save_global ();
13842
13843  /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
13844
13845  /* Resolution of qualified name, excluding constructors */
13846  if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch))
13847    {
13848      tree identifier, identifier_wfl, type, resolved;
13849      /* Extract the last IDENTIFIER of the qualified
13850	 expression. This is a wfl and we will use it's location
13851	 data during error report. */
13852      identifier_wfl = cut_identifier_in_qualified (wfl);
13853      identifier = EXPR_WFL_NODE (identifier_wfl);
13854
13855      /* Given the context, IDENTIFIER is syntactically qualified
13856	 as a MethodName. We need to qualify what's before */
13857      qualify_ambiguous_name (wfl);
13858      resolved = resolve_field_access (wfl, NULL, NULL);
13859
13860      if (TREE_CODE (resolved) == VAR_DECL && FIELD_STATIC (resolved)
13861         && FIELD_FINAL (resolved)
13862         && !inherits_from_p (DECL_CONTEXT (resolved), current_class)
13863         && !flag_emit_class_files && !flag_emit_xref)
13864       resolved = build_class_init (DECL_CONTEXT (resolved), resolved);
13865
13866      if (resolved == error_mark_node)
13867	PATCH_METHOD_RETURN_ERROR ();
13868
13869      type = GET_SKIP_TYPE (resolved);
13870      resolve_and_layout (type, NULL_TREE);
13871
13872      if (JPRIMITIVE_TYPE_P (type))
13873        {
13874	  parse_error_context
13875	    (identifier_wfl,
13876	     "Can't invoke a method on primitive type `%s'",
13877	     IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
13878	  PATCH_METHOD_RETURN_ERROR ();
13879	}
13880
13881      list = lookup_method_invoke (0, identifier_wfl, type, identifier, args);
13882      args = nreverse (args);
13883
13884      /* We're resolving a call from a type */
13885      if (TREE_CODE (resolved) == TYPE_DECL)
13886	{
13887	  if (CLASS_INTERFACE (resolved))
13888	    {
13889	      parse_error_context
13890		(identifier_wfl,
13891		"Can't make static reference to method `%s' in interface `%s'",
13892		 IDENTIFIER_POINTER (identifier),
13893		 IDENTIFIER_POINTER (name));
13894	      PATCH_METHOD_RETURN_ERROR ();
13895	    }
13896	  if (list && !METHOD_STATIC (list))
13897	    {
13898	      char *fct_name = xstrdup (lang_printable_name (list, 0));
13899	      parse_error_context
13900		(identifier_wfl,
13901		 "Can't make static reference to method `%s %s' in class `%s'",
13902		 lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
13903		 fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
13904	      free (fct_name);
13905	      PATCH_METHOD_RETURN_ERROR ();
13906	    }
13907	}
13908      else
13909	this_arg = primary = resolved;
13910
13911      if (TYPE_ARRAY_P (type) && identifier == get_identifier ("clone"))
13912        is_array_clone_call = 1;
13913
13914      /* IDENTIFIER_WFL will be used to report any problem further */
13915      wfl = identifier_wfl;
13916    }
13917  /* Resolution of simple names, names generated after a primary: or
13918     constructors */
13919  else
13920    {
13921      tree class_to_search = NULL_TREE;
13922      int lc;			/* Looking for Constructor */
13923
13924      /* We search constructor in their target class */
13925      if (CALL_CONSTRUCTOR_P (patch))
13926	{
13927	  if (TREE_CODE (patch) == NEW_CLASS_EXPR)
13928	    class_to_search = EXPR_WFL_NODE (wfl);
13929	  else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
13930		   this_identifier_node)
13931	    class_to_search = NULL_TREE;
13932	  else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
13933		   super_identifier_node)
13934	    {
13935	      is_super_init = 1;
13936	      if (CLASSTYPE_SUPER (current_class))
13937		class_to_search =
13938		  DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class)));
13939	      else
13940		{
13941		  parse_error_context (wfl, "Can't invoke super constructor on java.lang.Object");
13942		  PATCH_METHOD_RETURN_ERROR ();
13943		}
13944	    }
13945
13946	  /* Class to search is NULL if we're searching the current one */
13947	  if (class_to_search)
13948	    {
13949	      class_to_search = resolve_and_layout (class_to_search, wfl);
13950
13951	      if (!class_to_search)
13952		{
13953		  parse_error_context
13954		    (wfl, "Class `%s' not found in type declaration",
13955		     IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
13956		  PATCH_METHOD_RETURN_ERROR ();
13957		}
13958
13959	      /* Can't instantiate an abstract class, but we can
13960	         invoke it's constructor. It's use within the `new'
13961	         context is denied here. */
13962	      if (CLASS_ABSTRACT (class_to_search)
13963		  && TREE_CODE (patch) == NEW_CLASS_EXPR)
13964		{
13965		  parse_error_context
13966		    (wfl, "Class `%s' is an abstract class. It can't be instantiated",
13967		     IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
13968		  PATCH_METHOD_RETURN_ERROR ();
13969		}
13970
13971	      class_to_search = TREE_TYPE (class_to_search);
13972	    }
13973	  else
13974	    class_to_search = current_class;
13975	  lc = 1;
13976	}
13977      /* This is a regular search in the local class, unless an
13978         alternate class is specified. */
13979      else
13980	{
13981	  if (where != NULL_TREE)
13982	    class_to_search = where;
13983	  else if (QUALIFIED_P (name))
13984	    class_to_search = current_class;
13985	  else
13986	    {
13987	      class_to_search = current_class;
13988
13989	      for (;;)
13990		{
13991		  if (has_method (class_to_search, name))
13992		    break;
13993		  if (! INNER_CLASS_TYPE_P (class_to_search))
13994		    {
13995		      parse_error_context (wfl,
13996					   "No method named `%s' in scope",
13997					   IDENTIFIER_POINTER (name));
13998		      PATCH_METHOD_RETURN_ERROR ();
13999		    }
14000		  class_to_search
14001		    = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class_to_search)));
14002		}
14003	    }
14004	  lc = 0;
14005	}
14006
14007      /* NAME is a simple identifier or comes from a primary. Search
14008	 in the class whose declaration contain the method being
14009	 invoked. */
14010      resolve_and_layout (class_to_search, NULL_TREE);
14011
14012      list = lookup_method_invoke (lc, wfl, class_to_search, name, args);
14013      /* Don't continue if no method were found, as the next statement
14014         can't be executed then. */
14015      if (!list)
14016	PATCH_METHOD_RETURN_ERROR ();
14017
14018      if (TYPE_ARRAY_P (class_to_search)
14019          && DECL_NAME (list) == get_identifier ("clone"))
14020        is_array_clone_call = 1;
14021
14022      /* Check for static reference if non static methods */
14023      if (check_for_static_method_reference (wfl, patch, list,
14024					     class_to_search, primary))
14025	PATCH_METHOD_RETURN_ERROR ();
14026
14027      /* Check for inner classes creation from illegal contexts */
14028      if (lc && (INNER_CLASS_TYPE_P (class_to_search)
14029		 && !CLASS_STATIC (TYPE_NAME (class_to_search)))
14030	  && INNER_ENCLOSING_SCOPE_CHECK (class_to_search)
14031	  && !DECL_INIT_P (current_function_decl))
14032	{
14033	  parse_error_context
14034	    (wfl, "No enclosing instance for inner class `%s' is in scope%s",
14035	     lang_printable_name (class_to_search, 0),
14036	     (!current_this ? "" :
14037	      "; an explicit one must be provided when creating this inner class"));
14038	  PATCH_METHOD_RETURN_ERROR ();
14039	}
14040
14041      /* Non static methods are called with the current object extra
14042	 argument. If patch a `new TYPE()', the argument is the value
14043	 returned by the object allocator. If method is resolved as a
14044	 primary, use the primary otherwise use the current THIS. */
14045      args = nreverse (args);
14046      if (TREE_CODE (patch) != NEW_CLASS_EXPR)
14047	{
14048	  this_arg = primary ? primary : current_this;
14049
14050	  /* If we're using an access method, things are different.
14051	     There are two familly of cases:
14052
14053	     1) We're not generating bytecodes:
14054
14055	     - LIST is non static. It's invocation is transformed from
14056	       x(a1,...,an) into this$<n>.x(a1,....an).
14057	     - LIST is static. It's invocation is transformed from
14058	       x(a1,...,an) into TYPE_OF(this$<n>).x(a1,....an)
14059
14060	     2) We're generating bytecodes:
14061
14062	     - LIST is non static. It's invocation is transformed from
14063	       x(a1,....,an) into access$<n>(this$<n>,a1,...,an).
14064	     - LIST is static. It's invocation is transformed from
14065	       x(a1,....,an) into TYPE_OF(this$<n>).x(a1,....an).
14066
14067	     Of course, this$<n> can be abitrary complex, ranging from
14068	     this$0 (the immediate outer context) to
14069	     access$0(access$0(...(this$0))).
14070
14071	     maybe_use_access_method returns a nonzero value if the
14072	     this_arg has to be moved into the (then generated) stub
14073	     argument list. In the meantime, the selected function
14074	     might have be replaced by a generated stub. */
14075	  if (!primary &&
14076	      maybe_use_access_method (is_super_init, &list, &this_arg))
14077	    {
14078	      args = tree_cons (NULL_TREE, this_arg, args);
14079	      this_arg = NULL_TREE; /* So it doesn't get chained twice */
14080	    }
14081	}
14082    }
14083
14084  /* Merge point of all resolution schemes. If we have nothing, this
14085     is an error, already signaled */
14086  if (!list)
14087    PATCH_METHOD_RETURN_ERROR ();
14088
14089  /* Check accessibility, position the is_static flag, build and
14090     return the call */
14091  if (not_accessible_p (DECL_CONTEXT (current_function_decl), list,
14092			(primary ? TREE_TYPE (TREE_TYPE (primary)) :
14093			 NULL_TREE), from_super)
14094      /* Calls to clone() on array types are permitted as a special-case. */
14095      && !is_array_clone_call)
14096    {
14097      const char *const fct_name = IDENTIFIER_POINTER (DECL_NAME (list));
14098      const char *const access =
14099	java_accstring_lookup (get_access_flags_from_decl (list));
14100      const char *const klass =
14101	IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list))));
14102      const char *const refklass =
14103	IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)));
14104      const char *const what = (DECL_CONSTRUCTOR_P (list)
14105				? "constructor" : "method");
14106      /* FIXME: WFL yields the wrong message here but I don't know
14107	 what else to use.  */
14108      parse_error_context (wfl,
14109			   "Can't access %s %s `%s.%s' from `%s'",
14110			   access, what, klass, fct_name, refklass);
14111      PATCH_METHOD_RETURN_ERROR ();
14112    }
14113
14114  /* Deprecation check: check whether the method being invoked or the
14115     instance-being-created's type are deprecated. */
14116  if (TREE_CODE (patch) == NEW_CLASS_EXPR)
14117    check_deprecation (wfl, TYPE_NAME (DECL_CONTEXT (list)));
14118  else
14119    check_deprecation (wfl, list);
14120
14121  /* If invoking a innerclass constructor, there are hidden parameters
14122     to pass */
14123  if (TREE_CODE (patch) == NEW_CLASS_EXPR
14124      && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
14125    {
14126      /* And make sure we add the accessed local variables to be saved
14127	 in field aliases. */
14128      args = build_alias_initializer_parameter_list
14129	(AIPL_FUNCTION_CTOR_INVOCATION, DECL_CONTEXT (list), args, NULL);
14130
14131      /* Secretly pass the current_this/primary as a second argument */
14132      if (primary || current_this)
14133	{
14134	  tree extra_arg;
14135	  tree this_type = (current_this ?
14136			    TREE_TYPE (TREE_TYPE (current_this)) : NULL_TREE);
14137	  /* Method's (list) enclosing context */
14138	  tree mec = DECL_CONTEXT (TYPE_NAME (DECL_CONTEXT (list)));
14139	  /* If we have a primary, use it. */
14140	  if (primary)
14141	    extra_arg = primary;
14142	  /* The current `this' is an inner class but isn't a direct
14143	     enclosing context for the inner class we're trying to
14144	     create. Build an access to the proper enclosing context
14145	     and use it. */
14146	  else if (current_this && PURE_INNER_CLASS_TYPE_P (this_type)
14147		   && this_type != TREE_TYPE (mec))
14148	    {
14149
14150	      extra_arg = build_access_to_thisn (current_class,
14151						 TREE_TYPE (mec), 0);
14152	      extra_arg = java_complete_tree (extra_arg);
14153	    }
14154	  /* Otherwise, just use the current `this' as an enclosing
14155             context. */
14156	  else
14157	    extra_arg = current_this;
14158	  args = tree_cons (NULL_TREE, extra_arg, args);
14159	}
14160      else
14161	args = tree_cons (NULL_TREE, integer_zero_node, args);
14162    }
14163
14164  /* This handles the situation where a constructor invocation needs
14165     to have an enclosing context passed as a second parameter (the
14166     constructor is one of an inner class). */
14167  if ((is_super_init ||
14168       (TREE_CODE (patch) == CALL_EXPR && name == this_identifier_node))
14169      && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
14170    {
14171      tree dest = TYPE_NAME (DECL_CONTEXT (list));
14172      tree extra_arg =
14173	build_access_to_thisn (current_class, DECL_CONTEXT (dest), 0);
14174      extra_arg = java_complete_tree (extra_arg);
14175      args = tree_cons (NULL_TREE, extra_arg, args);
14176    }
14177
14178  is_static_flag = METHOD_STATIC (list);
14179  if (! is_static_flag && this_arg != NULL_TREE)
14180    args = tree_cons (NULL_TREE, this_arg, args);
14181
14182  /* In the context of an explicit constructor invocation, we can't
14183     invoke any method relying on `this'. Exceptions are: we're
14184     invoking a static function, primary exists and is not the current
14185     this, we're creating a new object. */
14186  if (ctxp->explicit_constructor_p
14187      && !is_static_flag
14188      && (!primary || primary == current_this)
14189      && (TREE_CODE (patch) != NEW_CLASS_EXPR))
14190    {
14191      parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called");
14192      PATCH_METHOD_RETURN_ERROR ();
14193    }
14194  java_parser_context_restore_global ();
14195  if (is_static)
14196    *is_static = is_static_flag;
14197  /* Sometimes, we want the decl of the selected method. Such as for
14198     EH checking */
14199  if (ret_decl)
14200    *ret_decl = list;
14201  patch = patch_invoke (patch, list, args);
14202
14203  /* Now is a good time to insert the call to finit$ */
14204  if (is_super_init && CLASS_HAS_FINIT_P (current_class))
14205    {
14206      tree finit_parms, finit_call;
14207
14208      /* Prepare to pass hidden parameters to finit$, if any. */
14209      finit_parms = build_alias_initializer_parameter_list
14210	(AIPL_FUNCTION_FINIT_INVOCATION, current_class, NULL_TREE, NULL);
14211
14212      finit_call =
14213	build_method_invocation (build_wfl_node (finit_identifier_node),
14214				 finit_parms);
14215
14216      /* Generate the code used to initialize fields declared with an
14217	 initialization statement and build a compound statement along
14218	 with the super constructor invocation. */
14219      CAN_COMPLETE_NORMALLY (patch) = 1;
14220      patch = build (COMPOUND_EXPR, void_type_node, patch,
14221		     java_complete_tree (finit_call));
14222    }
14223  return patch;
14224}
14225
14226/* Check that we're not trying to do a static reference to a method in
14227   non static method. Return 1 if it's the case, 0 otherwise. */
14228
14229static int
14230check_for_static_method_reference (wfl, node, method, where, primary)
14231     tree wfl, node, method, where, primary;
14232{
14233  if (METHOD_STATIC (current_function_decl)
14234      && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
14235    {
14236      char *fct_name = xstrdup (lang_printable_name (method, 0));
14237      parse_error_context
14238	(wfl, "Can't make static reference to method `%s %s' in class `%s'",
14239	 lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
14240	 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where))));
14241      free (fct_name);
14242      return 1;
14243    }
14244  return 0;
14245}
14246
14247/* Fix the invocation of *MDECL if necessary in the case of a
14248   invocation from an inner class. *THIS_ARG might be modified
14249   appropriately and an alternative access to *MDECL might be
14250   returned.  */
14251
14252static int
14253maybe_use_access_method (is_super_init, mdecl, this_arg)
14254     int is_super_init;
14255     tree *mdecl, *this_arg;
14256{
14257  tree ctx;
14258  tree md = *mdecl, ta = *this_arg;
14259  int to_return = 0;
14260  int non_static_context = !METHOD_STATIC (md);
14261
14262  if (is_super_init
14263      || DECL_CONTEXT (md) == current_class
14264      || !PURE_INNER_CLASS_TYPE_P (current_class)
14265      || DECL_FINIT_P (md)
14266      || DECL_INSTINIT_P (md))
14267    return 0;
14268
14269  /* If we're calling a method found in an enclosing class, generate
14270     what it takes to retrieve the right this. Don't do that if we're
14271     invoking a static method. Note that if MD's type is unrelated to
14272     CURRENT_CLASS, then the current this can be used. */
14273
14274  if (non_static_context && DECL_CONTEXT (md) != object_type_node)
14275    {
14276      ctx = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current_class)));
14277      if (inherits_from_p (ctx, DECL_CONTEXT (md)))
14278	{
14279	  ta = build_current_thisn (current_class);
14280	  ta = build_wfl_node (ta);
14281	}
14282      else
14283	{
14284	  tree type = ctx;
14285	  while (type)
14286	    {
14287	      maybe_build_thisn_access_method (type);
14288	      if (inherits_from_p (type, DECL_CONTEXT (md)))
14289		{
14290		  ta = build_access_to_thisn (ctx, type, 0);
14291		  break;
14292		}
14293	      type = (DECL_CONTEXT (TYPE_NAME (type)) ?
14294		      TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))) : NULL_TREE);
14295	    }
14296	}
14297      ta = java_complete_tree (ta);
14298    }
14299
14300  /* We might have to use an access method to get to MD. We can
14301     break the method access rule as far as we're not generating
14302     bytecode */
14303  if (METHOD_PRIVATE (md) && flag_emit_class_files)
14304    {
14305      md = build_outer_method_access_method (md);
14306      to_return = 1;
14307    }
14308
14309  *mdecl = md;
14310  *this_arg = ta;
14311
14312  /* Returnin a nonzero value indicates we were doing a non static
14313     method invokation that is now a static invocation. It will have
14314     callee displace `this' to insert it in the regular argument
14315     list. */
14316  return (non_static_context && to_return);
14317}
14318
14319/* Patch an invoke expression METHOD and ARGS, based on its invocation
14320   mode.  */
14321
14322static tree
14323patch_invoke (patch, method, args)
14324     tree patch, method, args;
14325{
14326  tree dtable, func;
14327  tree original_call, t, ta;
14328  tree check = NULL_TREE;
14329
14330  /* Last step for args: convert build-in types. If we're dealing with
14331     a new TYPE() type call, the first argument to the constructor
14332     isn't found in the incoming argument list, but delivered by
14333     `new' */
14334  t = TYPE_ARG_TYPES (TREE_TYPE (method));
14335  if (TREE_CODE (patch) == NEW_CLASS_EXPR)
14336    t = TREE_CHAIN (t);
14337  for (ta = args; t != end_params_node && ta;
14338       t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
14339    if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
14340	TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
14341      TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
14342
14343  /* Resolve unresolved returned type isses */
14344  t = TREE_TYPE (TREE_TYPE (method));
14345  if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t)))
14346    resolve_and_layout (TREE_TYPE (t), NULL);
14347
14348  if (flag_emit_class_files || flag_emit_xref)
14349    func = method;
14350  else
14351    {
14352      switch (invocation_mode (method, CALL_USING_SUPER (patch)))
14353	{
14354	case INVOKE_VIRTUAL:
14355	  dtable = invoke_build_dtable (0, args);
14356	  func = build_invokevirtual (dtable, method);
14357	  break;
14358
14359	case INVOKE_NONVIRTUAL:
14360	  /* If the object for the method call is null, we throw an
14361	     exception.  We don't do this if the object is the current
14362	     method's `this'.  In other cases we just rely on an
14363	     optimization pass to eliminate redundant checks.  */
14364	  if (TREE_VALUE (args) != current_this)
14365	    {
14366	      /* We use a save_expr here to make sure we only evaluate
14367		 the new `self' expression once.  */
14368	      tree save_arg = save_expr (TREE_VALUE (args));
14369	      TREE_VALUE (args) = save_arg;
14370	      check = java_check_reference (save_arg, 1);
14371	    }
14372	  /* Fall through.  */
14373
14374	case INVOKE_SUPER:
14375	case INVOKE_STATIC:
14376	  {
14377	    tree signature = build_java_signature (TREE_TYPE (method));
14378	    func = build_known_method_ref (method, TREE_TYPE (method),
14379					   DECL_CONTEXT (method),
14380					   signature, args);
14381	  }
14382	  break;
14383
14384	case INVOKE_INTERFACE:
14385	  dtable = invoke_build_dtable (1, args);
14386	  func = build_invokeinterface (dtable, method);
14387	  break;
14388
14389	default:
14390	  abort ();
14391	}
14392
14393      /* Ensure self_type is initialized, (invokestatic). FIXME */
14394      func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func);
14395    }
14396
14397  TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method));
14398  TREE_OPERAND (patch, 0) = func;
14399  TREE_OPERAND (patch, 1) = args;
14400  patch = check_for_builtin (method, patch);
14401  original_call = patch;
14402
14403  /* We're processing a `new TYPE ()' form. New is called and its
14404     returned value is the first argument to the constructor. We build
14405     a COMPOUND_EXPR and use saved expression so that the overall NEW
14406     expression value is a pointer to a newly created and initialized
14407     class. */
14408  if (TREE_CODE (original_call) == NEW_CLASS_EXPR)
14409    {
14410      tree class = DECL_CONTEXT (method);
14411      tree c1, saved_new, size, new;
14412      tree alloc_node;
14413
14414      if (flag_emit_class_files || flag_emit_xref)
14415	{
14416	  TREE_TYPE (patch) = build_pointer_type (class);
14417	  return patch;
14418	}
14419      if (!TYPE_SIZE (class))
14420	safe_layout_class (class);
14421      size = size_in_bytes (class);
14422      alloc_node =
14423	(class_has_finalize_method (class) ? alloc_object_node
14424		  			   : alloc_no_finalizer_node);
14425      new = build (CALL_EXPR, promote_type (class),
14426		   build_address_of (alloc_node),
14427		   tree_cons (NULL_TREE, build_class_ref (class),
14428			      build_tree_list (NULL_TREE,
14429					       size_in_bytes (class))),
14430		   NULL_TREE);
14431      saved_new = save_expr (new);
14432      c1 = build_tree_list (NULL_TREE, saved_new);
14433      TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1);
14434      TREE_OPERAND (original_call, 1) = c1;
14435      TREE_SET_CODE (original_call, CALL_EXPR);
14436      patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
14437    }
14438
14439  /* If CHECK is set, then we are building a check to see if the object
14440     is NULL.  */
14441  if (check != NULL_TREE)
14442    {
14443      /* We have to call force_evaluation_order now because creating a
14444 	 COMPOUND_EXPR wraps the arg list in a way that makes it
14445 	 unrecognizable by force_evaluation_order later.  Yuk.  */
14446      patch = build (COMPOUND_EXPR, TREE_TYPE (patch), check,
14447 		     force_evaluation_order (patch));
14448      TREE_SIDE_EFFECTS (patch) = 1;
14449    }
14450
14451  /* In order to be able to modify PATCH later, we SAVE_EXPR it and
14452     put it as the first expression of a COMPOUND_EXPR. The second
14453     expression being an empty statement to be later patched if
14454     necessary. We remember a TREE_LIST (the PURPOSE is the method,
14455     the VALUE is the compound) in a hashtable and return a
14456     COMPOUND_EXPR built so that the result of the evaluation of the
14457     original PATCH node is returned. */
14458  if (STATIC_CLASS_INIT_OPT_P ()
14459      && current_function_decl && METHOD_STATIC (method))
14460    {
14461      tree list;
14462      tree fndecl = current_function_decl;
14463      /* We have to call force_evaluation_order now because creating a
14464	 COMPOUND_EXPR wraps the arg list in a way that makes it
14465	 unrecognizable by force_evaluation_order later.  Yuk.  */
14466      tree save = save_expr (force_evaluation_order (patch));
14467      tree type = TREE_TYPE (patch);
14468
14469      patch = build (COMPOUND_EXPR, type, save, empty_stmt_node);
14470      list = tree_cons (method, patch,
14471			DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl));
14472
14473      DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl) = list;
14474
14475      patch = build (COMPOUND_EXPR, type, patch, save);
14476    }
14477
14478  return patch;
14479}
14480
14481static int
14482invocation_mode (method, super)
14483     tree method;
14484     int super;
14485{
14486  int access = get_access_flags_from_decl (method);
14487
14488  if (super)
14489    return INVOKE_SUPER;
14490
14491  if (access & ACC_STATIC)
14492    return INVOKE_STATIC;
14493
14494  /* We have to look for a constructor before we handle nonvirtual
14495     calls; otherwise the constructor will look nonvirtual.  */
14496  if (DECL_CONSTRUCTOR_P (method))
14497    return INVOKE_STATIC;
14498
14499  if (access & ACC_FINAL || access & ACC_PRIVATE)
14500    return INVOKE_NONVIRTUAL;
14501
14502  if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
14503    return INVOKE_NONVIRTUAL;
14504
14505  if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
14506    return INVOKE_INTERFACE;
14507
14508  return INVOKE_VIRTUAL;
14509}
14510
14511/* Retrieve a refined list of matching methods. It covers the step
14512   15.11.2 (Compile-Time Step 2) */
14513
14514static tree
14515lookup_method_invoke (lc, cl, class, name, arg_list)
14516     int lc;
14517     tree cl;
14518     tree class, name, arg_list;
14519{
14520  tree atl = end_params_node;		/* Arg Type List */
14521  tree method, signature, list, node;
14522  const char *candidates;		/* Used for error report */
14523  char *dup;
14524
14525  /* Fix the arguments */
14526  for (node = arg_list; node; node = TREE_CHAIN (node))
14527    {
14528      tree current_arg = TREE_TYPE (TREE_VALUE (node));
14529      /* Non primitive type may have to be resolved */
14530      if (!JPRIMITIVE_TYPE_P (current_arg))
14531	resolve_and_layout (current_arg, NULL_TREE);
14532      /* And promoted */
14533      if (TREE_CODE (current_arg) == RECORD_TYPE)
14534        current_arg = promote_type (current_arg);
14535      atl = tree_cons (NULL_TREE, current_arg, atl);
14536    }
14537
14538  /* Presto. If we're dealing with an anonymous class and a
14539     constructor call, generate the right constructor now, since we
14540     know the arguments' types. */
14541
14542  if (lc && ANONYMOUS_CLASS_P (class))
14543    {
14544      tree saved_current_class;
14545      tree mdecl = craft_constructor (TYPE_NAME (class), atl);
14546      saved_current_class = current_class;
14547      current_class = class;
14548      fix_constructors (mdecl);
14549      current_class = saved_current_class;
14550    }
14551
14552  /* Find all candidates and then refine the list, searching for the
14553     most specific method. */
14554  list = find_applicable_accessible_methods_list (lc, class, name, atl);
14555  list = find_most_specific_methods_list (list);
14556  if (list && !TREE_CHAIN (list))
14557    return TREE_VALUE (list);
14558
14559  /* Issue an error. List candidates if any. Candidates are listed
14560     only if accessible (non accessible methods may end-up here for
14561     the sake of a better error report). */
14562  candidates = NULL;
14563  if (list)
14564    {
14565      tree current;
14566      obstack_grow (&temporary_obstack, ". Candidates are:\n", 18);
14567      for (current = list; current; current = TREE_CHAIN (current))
14568	{
14569	  tree cm = TREE_VALUE (current);
14570	  char string [4096];
14571	  if (!cm || not_accessible_p (class, cm, NULL_TREE, 0))
14572	    continue;
14573	  sprintf
14574	    (string, "  `%s' in `%s'%s",
14575	     get_printable_method_name (cm),
14576	     IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))),
14577	     (TREE_CHAIN (current) ? "\n" : ""));
14578	  obstack_grow (&temporary_obstack, string, strlen (string));
14579	}
14580      obstack_1grow (&temporary_obstack, '\0');
14581      candidates = obstack_finish (&temporary_obstack);
14582    }
14583  /* Issue the error message */
14584  method = make_node (FUNCTION_TYPE);
14585  TYPE_ARG_TYPES (method) = atl;
14586  signature = build_java_argument_signature (method);
14587  dup = xstrdup (lang_printable_name (class, 0));
14588  parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s",
14589		       (lc ? "constructor" : "method"),
14590		       (lc ? dup : IDENTIFIER_POINTER (name)),
14591		       IDENTIFIER_POINTER (signature), dup,
14592		       (candidates ? candidates : ""));
14593  free (dup);
14594  return NULL_TREE;
14595}
14596
14597/* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
14598   when we're looking for a constructor. */
14599
14600static tree
14601find_applicable_accessible_methods_list (lc, class, name, arglist)
14602     int lc;
14603     tree class, name, arglist;
14604{
14605  static htab_t searched_classes;
14606  static int search_not_done = 0;
14607  tree list = NULL_TREE, all_list = NULL_TREE;
14608
14609  /* Check the hash table to determine if this class has been searched
14610     already. */
14611  if (searched_classes)
14612    {
14613      if (htab_find (searched_classes, class) != NULL)
14614	return NULL;
14615    }
14616  else
14617    {
14618      searched_classes = htab_create (10, htab_hash_pointer,
14619				      htab_eq_pointer, NULL);
14620    }
14621
14622  search_not_done++;
14623  *htab_find_slot (searched_classes, class, INSERT) = class;
14624
14625  if (!CLASS_LOADED_P (class) && !CLASS_FROM_SOURCE_P (class))
14626    {
14627      load_class (class, 1);
14628      safe_layout_class (class);
14629    }
14630
14631  /* Search interfaces */
14632  if (TREE_CODE (TYPE_NAME (class)) == TYPE_DECL
14633      && CLASS_INTERFACE (TYPE_NAME (class)))
14634    {
14635      int i, n;
14636      tree basetype_vec = TYPE_BINFO_BASETYPES (class);
14637      search_applicable_methods_list (lc, TYPE_METHODS (class),
14638				      name, arglist, &list, &all_list);
14639      n = TREE_VEC_LENGTH (basetype_vec);
14640      for (i = 1; i < n; i++)
14641	{
14642	  tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
14643	  tree rlist;
14644
14645	  rlist = find_applicable_accessible_methods_list (lc,  t, name,
14646							   arglist);
14647	  list = chainon (rlist, list);
14648	}
14649    }
14650  /* Search classes */
14651  else
14652    {
14653      search_applicable_methods_list (lc, TYPE_METHODS (class),
14654				      name, arglist, &list, &all_list);
14655
14656      /* When looking finit$, class$ or instinit$, we turn LC to 1 so
14657	 that we only search in class. Note that we should have found
14658	 something at this point. */
14659      if (ID_FINIT_P (name) || ID_CLASSDOLLAR_P (name) || ID_INSTINIT_P (name))
14660	{
14661	  lc = 1;
14662	  if (!list)
14663	    abort ();
14664	}
14665
14666      /* We must search all interfaces of this class */
14667      if (!lc)
14668      {
14669	tree basetype_vec = TYPE_BINFO_BASETYPES (class);
14670	int n = TREE_VEC_LENGTH (basetype_vec), i;
14671	for (i = 1; i < n; i++)
14672	  {
14673	    tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
14674	    if (t != object_type_node)
14675	      {
14676		tree rlist
14677		  = find_applicable_accessible_methods_list (lc, t,
14678							     name, arglist);
14679		list = chainon (rlist, list);
14680	      }
14681	  }
14682      }
14683
14684      /* Search superclass */
14685      if (!lc && CLASSTYPE_SUPER (class) != NULL_TREE)
14686	{
14687          tree rlist;
14688          class = CLASSTYPE_SUPER (class);
14689          rlist = find_applicable_accessible_methods_list (lc, class,
14690                                                           name, arglist);
14691          list = chainon (rlist, list);
14692        }
14693    }
14694
14695  search_not_done--;
14696
14697  /* We're done. Reset the searched classes list and finally search
14698     java.lang.Object if it wasn't searched already. */
14699  if (!search_not_done)
14700    {
14701      if (!lc
14702	  && TYPE_METHODS (object_type_node)
14703	  && htab_find (searched_classes, object_type_node) == NULL)
14704	{
14705          search_applicable_methods_list (lc,
14706                                          TYPE_METHODS (object_type_node),
14707                                          name, arglist, &list, &all_list);
14708        }
14709      htab_delete (searched_classes);
14710      searched_classes = NULL;
14711    }
14712
14713  /* Either return the list obtained or all selected (but
14714     inaccessible) methods for better error report. */
14715  return (!list ? all_list : list);
14716}
14717
14718/* Effectively search for the appropriate method in method */
14719
14720static void
14721search_applicable_methods_list (lc, method, name, arglist, list, all_list)
14722     int lc;
14723     tree method, name, arglist;
14724     tree *list, *all_list;
14725{
14726  for (; method; method = TREE_CHAIN (method))
14727    {
14728      /* When dealing with constructor, stop here, otherwise search
14729         other classes */
14730      if (lc && !DECL_CONSTRUCTOR_P (method))
14731	continue;
14732      else if (!lc && (DECL_CONSTRUCTOR_P (method)
14733		       || (DECL_NAME (method) != name)))
14734	continue;
14735
14736      if (argument_types_convertible (method, arglist))
14737	{
14738	  /* Retain accessible methods only */
14739	  if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
14740				 method, NULL_TREE, 0))
14741	    *list = tree_cons (NULL_TREE, method, *list);
14742	  else
14743	    /* Also retain all selected method here */
14744	    *all_list = tree_cons (NULL_TREE, method, *list);
14745	}
14746    }
14747}
14748
14749/* 15.11.2.2 Choose the Most Specific Method */
14750
14751static tree
14752find_most_specific_methods_list (list)
14753     tree list;
14754{
14755  int max = 0;
14756  int abstract, candidates;
14757  tree current, new_list = NULL_TREE;
14758  for (current = list; current; current = TREE_CHAIN (current))
14759    {
14760      tree method;
14761      DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0;
14762
14763      for (method = list; method; method = TREE_CHAIN (method))
14764	{
14765	  tree method_v, current_v;
14766	  /* Don't test a method against itself */
14767	  if (method == current)
14768	    continue;
14769
14770	  method_v = TREE_VALUE (method);
14771	  current_v = TREE_VALUE (current);
14772
14773	  /* Compare arguments and location where methods where declared */
14774	  if (argument_types_convertible (method_v, current_v))
14775	    {
14776	      if (valid_method_invocation_conversion_p
14777		  (DECL_CONTEXT (method_v), DECL_CONTEXT (current_v))
14778		  || (INNER_CLASS_TYPE_P (DECL_CONTEXT (current_v))
14779		      && enclosing_context_p (DECL_CONTEXT (method_v),
14780					      DECL_CONTEXT (current_v))))
14781		{
14782		  int v = (DECL_SPECIFIC_COUNT (current_v) +=
14783		    (INNER_CLASS_TYPE_P (DECL_CONTEXT (current_v)) ? 2 : 1));
14784		  max = (v > max ? v : max);
14785		}
14786	    }
14787	}
14788    }
14789
14790  /* Review the list and select the maximally specific methods */
14791  for (current = list, abstract = -1, candidates = -1;
14792       current; current = TREE_CHAIN (current))
14793    if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
14794      {
14795	new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
14796	abstract += (METHOD_ABSTRACT (TREE_VALUE (current)) ? 1 : 0);
14797	candidates++;
14798      }
14799
14800  /* If we have several and they're all abstract, just pick the
14801     closest one. */
14802  if (candidates > 0 && (candidates == abstract))
14803    {
14804      new_list = nreverse (new_list);
14805      TREE_CHAIN (new_list) = NULL_TREE;
14806    }
14807
14808  /* We have several (we couldn't find a most specific), all but one
14809     are abstract, we pick the only non abstract one. */
14810  if (candidates > 0 && (candidates == abstract+1))
14811    {
14812      for (current = new_list; current; current = TREE_CHAIN (current))
14813	if (!METHOD_ABSTRACT (TREE_VALUE (current)))
14814	  {
14815	    TREE_CHAIN (current) = NULL_TREE;
14816	    new_list = current;
14817	  }
14818    }
14819
14820  /* If we can't find one, lower expectations and try to gather multiple
14821     maximally specific methods */
14822  while (!new_list && max)
14823    {
14824      while (--max > 0)
14825	{
14826	  if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
14827	    new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
14828	}
14829    }
14830
14831  return new_list;
14832}
14833
14834/* Make sure that the type of each M2_OR_ARGLIST arguments can be
14835   converted by method invocation conversion (5.3) to the type of the
14836   corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
14837   to change less often than M1. */
14838
14839static GTY(()) tree m2_arg_value;
14840static GTY(()) tree m2_arg_cache;
14841
14842static int
14843argument_types_convertible (m1, m2_or_arglist)
14844    tree m1, m2_or_arglist;
14845{
14846  register tree m1_arg, m2_arg;
14847
14848  SKIP_THIS_AND_ARTIFICIAL_PARMS (m1_arg, m1)
14849
14850  if (m2_arg_value == m2_or_arglist)
14851    m2_arg = m2_arg_cache;
14852  else
14853    {
14854      /* M2_OR_ARGLIST can be a function DECL or a raw list of
14855         argument types */
14856      if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL)
14857	{
14858	  m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist));
14859	  if (!METHOD_STATIC (m2_or_arglist))
14860	    m2_arg = TREE_CHAIN (m2_arg);
14861	}
14862      else
14863	m2_arg = m2_or_arglist;
14864
14865      m2_arg_value = m2_or_arglist;
14866      m2_arg_cache = m2_arg;
14867    }
14868
14869  while (m1_arg != end_params_node && m2_arg != end_params_node)
14870    {
14871      resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE);
14872      if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg),
14873						 TREE_VALUE (m2_arg)))
14874	break;
14875      m1_arg = TREE_CHAIN (m1_arg);
14876      m2_arg = TREE_CHAIN (m2_arg);
14877    }
14878  return m1_arg == end_params_node && m2_arg == end_params_node;
14879}
14880
14881/* Qualification routines */
14882
14883static void
14884qualify_ambiguous_name (id)
14885     tree id;
14886{
14887  tree qual, qual_wfl, name = NULL_TREE, decl, ptr_type = NULL_TREE,
14888    saved_current_class;
14889  int again, super_found = 0, this_found = 0, new_array_found = 0;
14890  int code;
14891
14892  /* We first qualify the first element, then derive qualification of
14893     others based on the first one. If the first element is qualified
14894     by a resolution (field or type), this resolution is stored in the
14895     QUAL_RESOLUTION of the qual element being examined. We need to
14896     save the current_class since the use of SUPER might change the
14897     its value. */
14898  saved_current_class = current_class;
14899  qual = EXPR_WFL_QUALIFICATION (id);
14900  do {
14901
14902    /* Simple qualified expression feature a qual_wfl that is a
14903       WFL. Expression derived from a primary feature more complicated
14904       things like a CALL_EXPR. Expression from primary need to be
14905       worked out to extract the part on which the qualification will
14906       take place. */
14907    qual_wfl = QUAL_WFL (qual);
14908    switch (TREE_CODE (qual_wfl))
14909      {
14910      case CALL_EXPR:
14911	qual_wfl = TREE_OPERAND (qual_wfl, 0);
14912	if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION
14913	    || (EXPR_WFL_QUALIFICATION (qual_wfl)
14914		&& TREE_CODE (EXPR_WFL_QUALIFICATION (qual_wfl)) == TREE_LIST))
14915	  {
14916	    qual = EXPR_WFL_QUALIFICATION (qual_wfl);
14917	    qual_wfl = QUAL_WFL (qual);
14918	  }
14919	break;
14920      case NEW_ARRAY_EXPR:
14921      case NEW_ANONYMOUS_ARRAY_EXPR:
14922	qual = TREE_CHAIN (qual);
14923	again = new_array_found = 1;
14924	continue;
14925      case CONVERT_EXPR:
14926	break;
14927      case NEW_CLASS_EXPR:
14928	qual_wfl = TREE_OPERAND (qual_wfl, 0);
14929	break;
14930      case ARRAY_REF:
14931	while (TREE_CODE (qual_wfl) == ARRAY_REF)
14932	  qual_wfl = TREE_OPERAND (qual_wfl, 0);
14933	break;
14934      case STRING_CST:
14935	qual = TREE_CHAIN (qual);
14936	qual_wfl = QUAL_WFL (qual);
14937	break;
14938      case CLASS_LITERAL:
14939	qual = TREE_CHAIN (qual);
14940	qual_wfl = QUAL_WFL (qual);
14941      break;
14942      default:
14943	/* Fix for -Wall. Just break doing nothing */
14944	break;
14945      }
14946
14947    ptr_type = current_class;
14948    again = 0;
14949    code = TREE_CODE (qual_wfl);
14950
14951    /* Pos evaluation: non WFL leading expression nodes */
14952    if (code == CONVERT_EXPR
14953	&& TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
14954      name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
14955
14956    else if (code == INTEGER_CST)
14957      name = qual_wfl;
14958
14959    else if (code == CONVERT_EXPR &&
14960	     TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
14961      name = TREE_OPERAND (qual_wfl, 0);
14962
14963    else if (code == CONVERT_EXPR
14964	     && TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == CALL_EXPR
14965	     && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (qual_wfl, 0), 0))
14966		 == EXPR_WITH_FILE_LOCATION))
14967      name = TREE_OPERAND (TREE_OPERAND (qual_wfl, 0), 0);
14968
14969    else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) &&
14970	     TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
14971      name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
14972
14973    else if (code == TREE_LIST)
14974      name = EXPR_WFL_NODE (TREE_PURPOSE (qual_wfl));
14975
14976    else if (code == STRING_CST || code == CONDITIONAL_EXPR
14977	     || code == PLUS_EXPR)
14978      {
14979	qual = TREE_CHAIN (qual);
14980	qual_wfl = QUAL_WFL (qual);
14981	again = 1;
14982      }
14983    else
14984      {
14985	name = EXPR_WFL_NODE (qual_wfl);
14986	if (!name)
14987	  {
14988	    qual = EXPR_WFL_QUALIFICATION (qual_wfl);
14989	    again = 1;
14990	  }
14991      }
14992
14993    /* If we have a THIS (from a primary), we set the context accordingly */
14994    if (name == this_identifier_node)
14995      {
14996	/* This isn't really elegant. One more added irregularity
14997	   before I start using COMPONENT_REF (hopefully very soon.)  */
14998	if (TREE_CODE (TREE_PURPOSE (qual)) == ARRAY_REF
14999	    && TREE_CODE (TREE_OPERAND (TREE_PURPOSE (qual), 0)) ==
15000	       EXPR_WITH_FILE_LOCATION
15001	    && EXPR_WFL_NODE (TREE_OPERAND (TREE_PURPOSE (qual), 0)) ==
15002	       this_identifier_node)
15003	    {
15004	      qual = TREE_OPERAND (TREE_PURPOSE (qual), 0);
15005	      qual = EXPR_WFL_QUALIFICATION (qual);
15006	    }
15007	qual = TREE_CHAIN (qual);
15008	qual_wfl = QUAL_WFL (qual);
15009	if (TREE_CODE (qual_wfl) == CALL_EXPR)
15010	  again = 1;
15011	else if (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION)
15012	  name = EXPR_WFL_NODE (qual_wfl);
15013	else if (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR)
15014	  name = TREE_OPERAND (qual_wfl, 0);
15015	this_found = 1;
15016      }
15017    /* If we have a SUPER, we set the context accordingly */
15018    if (name == super_identifier_node)
15019      {
15020	current_class = CLASSTYPE_SUPER (ptr_type);
15021	/* Check that there is such a thing as a super class. If not,
15022	   return.  The error will be caught later on, during the
15023	   resolution */
15024	if (!current_class)
15025	  {
15026	    current_class = saved_current_class;
15027	    return;
15028	  }
15029	qual = TREE_CHAIN (qual);
15030	/* Do one more interation to set things up */
15031	super_found = again = 1;
15032      }
15033  } while (again);
15034
15035  /* If name appears within the scope of a local variable declaration
15036     or parameter declaration, then it is an expression name. We don't
15037     carry this test out if we're in the context of the use of SUPER
15038     or THIS */
15039  if (!this_found && !super_found
15040      && TREE_CODE (name) != STRING_CST && TREE_CODE (name) != INTEGER_CST
15041      && (decl = IDENTIFIER_LOCAL_VALUE (name)))
15042    {
15043      RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
15044      QUAL_RESOLUTION (qual) = decl;
15045    }
15046
15047  /* If within the class/interface NAME was found to be used there
15048     exists a (possibly inherited) field named NAME, then this is an
15049     expression name. If we saw a NEW_ARRAY_EXPR before and want to
15050     address length, it is OK. */
15051  else if ((decl = lookup_field_wrapper (ptr_type, name))
15052	   || name == length_identifier_node)
15053    {
15054      RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
15055      QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
15056    }
15057
15058  /* We reclassify NAME as yielding to a type name resolution if:
15059     - NAME is a class/interface declared within the compilation
15060       unit containing NAME,
15061     - NAME is imported via a single-type-import declaration,
15062     - NAME is declared in an another compilation unit of the package
15063       of the compilation unit containing NAME,
15064     - NAME is declared by exactly on type-import-on-demand declaration
15065     of the compilation unit containing NAME.
15066     - NAME is actually a STRING_CST.
15067     This can't happen if the expression was qualified by `this.' */
15068  else if (! this_found &&
15069	   (TREE_CODE (name) == STRING_CST ||
15070	    TREE_CODE (name) == INTEGER_CST ||
15071	    (decl = resolve_and_layout (name, NULL_TREE))))
15072    {
15073      RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
15074      QUAL_RESOLUTION (qual) = decl;
15075    }
15076
15077  /* Method call, array references and cast are expression name */
15078  else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
15079	   || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF
15080	   || TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR
15081	   || TREE_CODE (QUAL_WFL (qual)) == MODIFY_EXPR)
15082    RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
15083
15084  /* Check here that NAME isn't declared by more than one
15085     type-import-on-demand declaration of the compilation unit
15086     containing NAME. FIXME */
15087
15088  /* Otherwise, NAME is reclassified as a package name */
15089  else
15090    RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
15091
15092  /* Propagate the qualification accross other components of the
15093     qualified name */
15094  for (qual = TREE_CHAIN (qual); qual;
15095       qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual))
15096    {
15097      if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
15098	RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1;
15099      else
15100	RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1;
15101    }
15102
15103  /* Store the global qualification for the ambiguous part of ID back
15104     into ID fields */
15105  if (RESOLVE_EXPRESSION_NAME_P (qual_wfl))
15106    RESOLVE_EXPRESSION_NAME_P (id) = 1;
15107  else if (RESOLVE_TYPE_NAME_P (qual_wfl))
15108    RESOLVE_TYPE_NAME_P (id) = 1;
15109  else if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
15110    RESOLVE_PACKAGE_NAME_P (id) = 1;
15111
15112  /* Restore the current class */
15113  current_class = saved_current_class;
15114}
15115
15116static int
15117breakdown_qualified (left, right, source)
15118    tree *left, *right, source;
15119{
15120  char *p, *base;
15121  int l = IDENTIFIER_LENGTH (source);
15122
15123  base = alloca (l + 1);
15124  memcpy (base, IDENTIFIER_POINTER (source), l + 1);
15125
15126  /* Breakdown NAME into REMAINDER . IDENTIFIER.  */
15127  p = base + l - 1;
15128  while (*p != '.' && p != base)
15129    p--;
15130
15131  /* We didn't find a '.'. Return an error.  */
15132  if (p == base)
15133    return 1;
15134
15135  *p = '\0';
15136  if (right)
15137    *right = get_identifier (p+1);
15138  *left = get_identifier (base);
15139
15140  return 0;
15141}
15142
15143/* Return TRUE if two classes are from the same package. */
15144
15145static int
15146in_same_package (name1, name2)
15147  tree name1, name2;
15148{
15149  tree tmp;
15150  tree pkg1;
15151  tree pkg2;
15152
15153  if (TREE_CODE (name1) == TYPE_DECL)
15154    name1 = DECL_NAME (name1);
15155  if (TREE_CODE (name2) == TYPE_DECL)
15156    name2 = DECL_NAME (name2);
15157
15158  if (QUALIFIED_P (name1) != QUALIFIED_P (name2))
15159    /* One in empty package. */
15160    return 0;
15161
15162  if (QUALIFIED_P (name1) == 0 && QUALIFIED_P (name2) == 0)
15163    /* Both in empty package. */
15164    return 1;
15165
15166  breakdown_qualified (&pkg1, &tmp, name1);
15167  breakdown_qualified (&pkg2, &tmp, name2);
15168
15169  return (pkg1 == pkg2);
15170}
15171
15172/* Patch tree nodes in a function body. When a BLOCK is found, push
15173   local variable decls if present.
15174   Same as java_complete_lhs, but does resolve static finals to values. */
15175
15176static tree
15177java_complete_tree (node)
15178     tree node;
15179{
15180  node = java_complete_lhs (node);
15181  if (JDECL_P (node) && CLASS_FINAL_VARIABLE_P (node)
15182      && DECL_INITIAL (node) != NULL_TREE
15183      && !flag_emit_xref)
15184    {
15185      tree value = fold_constant_for_init (node, node);
15186      if (value != NULL_TREE)
15187	return value;
15188    }
15189  return node;
15190}
15191
15192static tree
15193java_stabilize_reference (node)
15194     tree node;
15195{
15196  if (TREE_CODE (node) == COMPOUND_EXPR)
15197    {
15198      tree op0 = TREE_OPERAND (node, 0);
15199      tree op1 = TREE_OPERAND (node, 1);
15200      TREE_OPERAND (node, 0) = save_expr (op0);
15201      TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
15202      return node;
15203    }
15204  return stabilize_reference (node);
15205}
15206
15207/* Patch tree nodes in a function body. When a BLOCK is found, push
15208   local variable decls if present.
15209   Same as java_complete_tree, but does not resolve static finals to values. */
15210
15211static tree
15212java_complete_lhs (node)
15213     tree node;
15214{
15215  tree nn, cn, wfl_op1, wfl_op2, wfl_op3;
15216  int flag;
15217
15218  /* CONVERT_EXPR always has its type set, even though it needs to be
15219     worked out. */
15220  if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR)
15221    return node;
15222
15223  /* The switch block implements cases processing container nodes
15224     first.  Contained nodes are always written back. Leaves come
15225     next and return a value. */
15226  switch (TREE_CODE (node))
15227    {
15228    case BLOCK:
15229
15230      /* 1- Block section.
15231	 Set the local values on decl names so we can identify them
15232	 faster when they're referenced. At that stage, identifiers
15233	 are legal so we don't check for declaration errors. */
15234      for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
15235	{
15236	  DECL_CONTEXT (cn) = current_function_decl;
15237	  IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn;
15238	}
15239      if (BLOCK_EXPR_BODY (node) == NULL_TREE)
15240	  CAN_COMPLETE_NORMALLY (node) = 1;
15241      else
15242	{
15243	  tree stmt = BLOCK_EXPR_BODY (node);
15244	  tree *ptr;
15245	  int error_seen = 0;
15246	  if (TREE_CODE (stmt) == COMPOUND_EXPR)
15247	    {
15248	      /* Re-order from (((A; B); C); ...; Z) to
15249		 (A; (B; (C ; (...; Z)))).
15250		 This makes it easier to scan the statements left-to-right
15251		 without using recursion (which might overflow the stack
15252		 if the block has many statements. */
15253	      for (;;)
15254		{
15255		  tree left = TREE_OPERAND (stmt, 0);
15256		  if (TREE_CODE (left) != COMPOUND_EXPR)
15257		    break;
15258		  TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1);
15259		  TREE_OPERAND (left, 1) = stmt;
15260		  stmt = left;
15261		}
15262	      BLOCK_EXPR_BODY (node) = stmt;
15263	    }
15264
15265	  /* Now do the actual complete, without deep recursion for
15266             long blocks. */
15267	  ptr = &BLOCK_EXPR_BODY (node);
15268	  while (TREE_CODE (*ptr) == COMPOUND_EXPR
15269		 && TREE_OPERAND (*ptr, 1) != empty_stmt_node)
15270	    {
15271	      tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
15272	      tree *next = &TREE_OPERAND (*ptr, 1);
15273	      TREE_OPERAND (*ptr, 0) = cur;
15274	      if (cur == empty_stmt_node)
15275		{
15276		  /* Optimization;  makes it easier to detect empty bodies.
15277		     Most useful for <clinit> with all-constant initializer. */
15278		  *ptr = *next;
15279		  continue;
15280		}
15281	      if (TREE_CODE (cur) == ERROR_MARK)
15282		error_seen++;
15283	      else if (! CAN_COMPLETE_NORMALLY (cur))
15284		{
15285		  wfl_op2 = *next;
15286		  for (;;)
15287		    {
15288		      if (TREE_CODE (wfl_op2) == BLOCK)
15289			wfl_op2 = BLOCK_EXPR_BODY (wfl_op2);
15290		      else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR)
15291			wfl_op2 = TREE_OPERAND (wfl_op2, 0);
15292		      else
15293			break;
15294		    }
15295		  if (TREE_CODE (wfl_op2) != CASE_EXPR
15296		      && TREE_CODE (wfl_op2) != DEFAULT_EXPR)
15297		    unreachable_stmt_error (*ptr);
15298		}
15299	      ptr = next;
15300	    }
15301	  *ptr = java_complete_tree (*ptr);
15302
15303	  if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0)
15304	    return error_mark_node;
15305	  CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr);
15306	}
15307      /* Turn local bindings to null */
15308      for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
15309	IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE;
15310
15311      TREE_TYPE (node) = void_type_node;
15312      break;
15313
15314      /* 2- They are expressions but ultimately deal with statements */
15315
15316    case THROW_EXPR:
15317      wfl_op1 = TREE_OPERAND (node, 0);
15318      COMPLETE_CHECK_OP_0 (node);
15319      /* 14.19 A throw statement cannot complete normally. */
15320      CAN_COMPLETE_NORMALLY (node) = 0;
15321      return patch_throw_statement (node, wfl_op1);
15322
15323    case SYNCHRONIZED_EXPR:
15324      wfl_op1 = TREE_OPERAND (node, 0);
15325      return patch_synchronized_statement (node, wfl_op1);
15326
15327    case TRY_EXPR:
15328      return patch_try_statement (node);
15329
15330    case TRY_FINALLY_EXPR:
15331      COMPLETE_CHECK_OP_0 (node);
15332      COMPLETE_CHECK_OP_1 (node);
15333      if (TREE_OPERAND (node, 0) == empty_stmt_node)
15334	return TREE_OPERAND (node, 1);
15335      if (TREE_OPERAND (node, 1) == empty_stmt_node)
15336	return TREE_OPERAND (node, 0);
15337      CAN_COMPLETE_NORMALLY (node)
15338	= (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0))
15339	   && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)));
15340      TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 0));
15341      return node;
15342
15343    case LABELED_BLOCK_EXPR:
15344      PUSH_LABELED_BLOCK (node);
15345      if (LABELED_BLOCK_BODY (node))
15346	COMPLETE_CHECK_OP_1 (node);
15347      TREE_TYPE (node) = void_type_node;
15348      POP_LABELED_BLOCK ();
15349
15350      if (LABELED_BLOCK_BODY (node) == empty_stmt_node)
15351	{
15352	  LABELED_BLOCK_BODY (node) = NULL_TREE;
15353	  CAN_COMPLETE_NORMALLY (node) = 1;
15354	}
15355      else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node)))
15356	CAN_COMPLETE_NORMALLY (node) = 1;
15357      return node;
15358
15359    case EXIT_BLOCK_EXPR:
15360      /* We don't complete operand 1, because it's the return value of
15361         the EXIT_BLOCK_EXPR which doesn't exist it Java */
15362      return patch_bc_statement (node);
15363
15364    case CASE_EXPR:
15365      cn = java_complete_tree (TREE_OPERAND (node, 0));
15366      if (cn == error_mark_node)
15367	return cn;
15368
15369      /* First, the case expression must be constant. Values of final
15370         fields are accepted. */
15371      cn = fold (cn);
15372      if ((TREE_CODE (cn) == COMPOUND_EXPR || TREE_CODE (cn) == COMPONENT_REF)
15373	  && JDECL_P (TREE_OPERAND (cn, 1))
15374	  && FIELD_FINAL (TREE_OPERAND (cn, 1))
15375	  && DECL_INITIAL (TREE_OPERAND (cn, 1)))
15376	{
15377	  cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
15378				       TREE_OPERAND (cn, 1));
15379	}
15380      /* Accept final locals too. */
15381      else if (TREE_CODE (cn) == VAR_DECL && DECL_FINAL (cn))
15382	cn = fold_constant_for_init (DECL_INITIAL (cn), cn);
15383
15384      if (!TREE_CONSTANT (cn) && !flag_emit_xref)
15385	{
15386	  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
15387	  parse_error_context (node, "Constant expression required");
15388	  return error_mark_node;
15389	}
15390
15391      nn = ctxp->current_loop;
15392
15393      /* It must be assignable to the type of the switch expression. */
15394      if (!try_builtin_assignconv (NULL_TREE,
15395				   TREE_TYPE (TREE_OPERAND (nn, 0)), cn))
15396	{
15397	  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
15398	  parse_error_context
15399	    (wfl_operator,
15400	     "Incompatible type for case. Can't convert `%s' to `int'",
15401	     lang_printable_name (TREE_TYPE (cn), 0));
15402	  return error_mark_node;
15403	}
15404
15405      cn = fold (convert (int_type_node, cn));
15406      TREE_CONSTANT_OVERFLOW (cn) = 0;
15407      CAN_COMPLETE_NORMALLY (cn) = 1;
15408
15409      /* Save the label on a list so that we can later check for
15410	 duplicates.  */
15411      case_label_list = tree_cons (node, cn, case_label_list);
15412
15413      /* Multiple instance of a case label bearing the same value is
15414	 checked later. The case expression is all right so far. */
15415      if (TREE_CODE (cn) == VAR_DECL)
15416	cn = DECL_INITIAL (cn);
15417      TREE_OPERAND (node, 0) = cn;
15418      TREE_TYPE (node) = void_type_node;
15419      CAN_COMPLETE_NORMALLY (node) = 1;
15420      TREE_SIDE_EFFECTS (node) = 1;
15421      break;
15422
15423    case DEFAULT_EXPR:
15424      nn = ctxp->current_loop;
15425      /* Only one default label is allowed per switch statement */
15426      if (SWITCH_HAS_DEFAULT (nn))
15427	{
15428	  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
15429	  parse_error_context (wfl_operator,
15430			       "Duplicate case label: `default'");
15431	  return error_mark_node;
15432	}
15433      else
15434	SWITCH_HAS_DEFAULT (nn) = 1;
15435      TREE_TYPE (node) = void_type_node;
15436      TREE_SIDE_EFFECTS (node) = 1;
15437      CAN_COMPLETE_NORMALLY (node) = 1;
15438      break;
15439
15440    case SWITCH_EXPR:
15441    case LOOP_EXPR:
15442      PUSH_LOOP (node);
15443      /* Check whether the loop was enclosed in a labeled
15444         statement. If not, create one, insert the loop in it and
15445         return the node */
15446      nn = patch_loop_statement (node);
15447
15448      /* Anyways, walk the body of the loop */
15449      if (TREE_CODE (node) == LOOP_EXPR)
15450	TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
15451      /* Switch statement: walk the switch expression and the cases */
15452      else
15453	node = patch_switch_statement (node);
15454
15455      if (node == error_mark_node || TREE_OPERAND (node, 0) == error_mark_node)
15456	nn = error_mark_node;
15457      else
15458	{
15459	  TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node;
15460	  /* If we returned something different, that's because we
15461	     inserted a label. Pop the label too. */
15462	  if (nn != node)
15463	    {
15464	      if (CAN_COMPLETE_NORMALLY (node))
15465		CAN_COMPLETE_NORMALLY (nn) = 1;
15466	      POP_LABELED_BLOCK ();
15467	    }
15468	}
15469      POP_LOOP ();
15470      return nn;
15471
15472    case EXIT_EXPR:
15473      TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
15474      return patch_exit_expr (node);
15475
15476    case COND_EXPR:
15477      /* Condition */
15478      TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
15479      if (TREE_OPERAND (node, 0) == error_mark_node)
15480	return error_mark_node;
15481      /* then-else branches */
15482      TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
15483      if (TREE_OPERAND (node, 1) == error_mark_node)
15484	return error_mark_node;
15485      TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2));
15486      if (TREE_OPERAND (node, 2) == error_mark_node)
15487	return error_mark_node;
15488      return patch_if_else_statement (node);
15489      break;
15490
15491    case CONDITIONAL_EXPR:
15492      /* Condition */
15493      wfl_op1 = TREE_OPERAND (node, 0);
15494      COMPLETE_CHECK_OP_0 (node);
15495      wfl_op2 = TREE_OPERAND (node, 1);
15496      COMPLETE_CHECK_OP_1 (node);
15497      wfl_op3 = TREE_OPERAND (node, 2);
15498      COMPLETE_CHECK_OP_2 (node);
15499      return patch_conditional_expr (node, wfl_op1, wfl_op2);
15500
15501      /* 3- Expression section */
15502    case COMPOUND_EXPR:
15503      wfl_op2 = TREE_OPERAND (node, 1);
15504      TREE_OPERAND (node, 0) = nn =
15505	java_complete_tree (TREE_OPERAND (node, 0));
15506      if (wfl_op2 == empty_stmt_node)
15507	CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn);
15508      else
15509	{
15510	  if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK)
15511	    {
15512	      /* An unreachable condition in a do-while statement
15513		 is *not* (technically) an unreachable statement. */
15514	      nn = wfl_op2;
15515	      if (TREE_CODE (nn) == EXPR_WITH_FILE_LOCATION)
15516		nn = EXPR_WFL_NODE (nn);
15517	      /* NN can be NULL_TREE exactly when UPDATE is, in
15518		 finish_for_loop.  */
15519	      if (nn != NULL_TREE && TREE_CODE (nn) != EXIT_EXPR)
15520		{
15521		  SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
15522		  if (SUPPRESS_UNREACHABLE_ERROR (nn))
15523		    {
15524		      /* Perhaps this warning should have an
15525			 associated flag.  The code being compiled is
15526			 pedantically correct, but useless.  */
15527		      parse_warning_context (wfl_operator,
15528					     "Unreachable statement");
15529		    }
15530		  else
15531		    parse_error_context (wfl_operator,
15532					 "Unreachable statement");
15533		}
15534	    }
15535	  TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
15536	  if (TREE_OPERAND (node, 1) == error_mark_node)
15537	    return error_mark_node;
15538	  /* Even though we might allow the case where the first
15539	     operand doesn't return normally, we still should compute
15540	     CAN_COMPLETE_NORMALLY correctly.  */
15541	  CAN_COMPLETE_NORMALLY (node)
15542	    = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0))
15543	       && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)));
15544	}
15545      TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1));
15546      break;
15547
15548    case RETURN_EXPR:
15549      /* CAN_COMPLETE_NORMALLY (node) = 0; */
15550      return patch_return (node);
15551
15552    case EXPR_WITH_FILE_LOCATION:
15553      if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
15554	  || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
15555	{
15556	  tree wfl = node;
15557	  node = resolve_expression_name (node, NULL);
15558	  if (node == error_mark_node)
15559	    return node;
15560	  /* Keep line number information somewhere were it doesn't
15561	     disrupt the completion process. */
15562	  if (flag_emit_xref && TREE_CODE (node) != CALL_EXPR)
15563	    {
15564	      EXPR_WFL_NODE (wfl) = TREE_OPERAND (node, 1);
15565	      TREE_OPERAND (node, 1) = wfl;
15566	    }
15567	  CAN_COMPLETE_NORMALLY (node) = 1;
15568	}
15569      else
15570	{
15571	  tree body;
15572	  int save_lineno = lineno;
15573	  lineno = EXPR_WFL_LINENO (node);
15574	  body = java_complete_tree (EXPR_WFL_NODE (node));
15575	  lineno = save_lineno;
15576	  EXPR_WFL_NODE (node) = body;
15577	  TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body);
15578	  CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
15579	  if (body == empty_stmt_node || TREE_CONSTANT (body))
15580	    {
15581	      /* Makes it easier to constant fold, detect empty bodies. */
15582	      return body;
15583	    }
15584	  if (body == error_mark_node)
15585	    {
15586	      /* Its important for the evaluation of assignment that
15587		 this mark on the TREE_TYPE is propagated. */
15588	      TREE_TYPE (node) = error_mark_node;
15589	      return error_mark_node;
15590	    }
15591	  else
15592	    TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node));
15593
15594	}
15595      break;
15596
15597    case NEW_ARRAY_EXPR:
15598      /* Patch all the dimensions */
15599      flag = 0;
15600      for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
15601	{
15602	  int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
15603	  tree dim = convert (int_type_node,
15604			      java_complete_tree (TREE_VALUE (cn)));
15605	  if (dim == error_mark_node)
15606	    {
15607	      flag = 1;
15608	      continue;
15609	    }
15610	  else
15611	    {
15612	      TREE_VALUE (cn) = dim;
15613	      /* Setup the location of the current dimension, for
15614		 later error report. */
15615	      TREE_PURPOSE (cn) =
15616		build_expr_wfl (NULL_TREE, input_filename, 0, 0);
15617	      EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
15618	    }
15619	}
15620      /* They complete the array creation expression, if no errors
15621         were found. */
15622      CAN_COMPLETE_NORMALLY (node) = 1;
15623      return (flag ? error_mark_node
15624	      : force_evaluation_order (patch_newarray (node)));
15625
15626    case NEW_ANONYMOUS_ARRAY_EXPR:
15627      /* Create the array type if necessary. */
15628      if (ANONYMOUS_ARRAY_DIMS_SIG (node))
15629	{
15630	  tree type = ANONYMOUS_ARRAY_BASE_TYPE (node);
15631	  if (!(type = resolve_type_during_patch (type)))
15632	    return error_mark_node;
15633	  type = build_array_from_name (type, NULL_TREE,
15634					ANONYMOUS_ARRAY_DIMS_SIG (node), NULL);
15635	  ANONYMOUS_ARRAY_BASE_TYPE (node) = build_pointer_type (type);
15636	}
15637      node = patch_new_array_init (ANONYMOUS_ARRAY_BASE_TYPE (node),
15638				   ANONYMOUS_ARRAY_INITIALIZER (node));
15639      if (node == error_mark_node)
15640	return error_mark_node;
15641      CAN_COMPLETE_NORMALLY (node) = 1;
15642      return node;
15643
15644    case NEW_CLASS_EXPR:
15645    case CALL_EXPR:
15646      /* Complete function's argument(s) first */
15647      if (complete_function_arguments (node))
15648	return error_mark_node;
15649      else
15650	{
15651	  tree decl, wfl = TREE_OPERAND (node, 0);
15652	  int in_this = CALL_THIS_CONSTRUCTOR_P (node);
15653	  int from_super = (EXPR_WFL_NODE (TREE_OPERAND (node, 0)) ==
15654                           super_identifier_node);
15655
15656	  node = patch_method_invocation (node, NULL_TREE, NULL_TREE,
15657					  from_super, 0, &decl);
15658	  if (node == error_mark_node)
15659	    return error_mark_node;
15660
15661	  check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl);
15662	  /* If we call this(...), register signature and positions */
15663	  if (in_this)
15664	    DECL_CONSTRUCTOR_CALLS (current_function_decl) =
15665	      tree_cons (wfl, decl,
15666			 DECL_CONSTRUCTOR_CALLS (current_function_decl));
15667	  CAN_COMPLETE_NORMALLY (node) = 1;
15668	  return force_evaluation_order (node);
15669	}
15670
15671    case MODIFY_EXPR:
15672      /* Save potential wfls */
15673      wfl_op1 = TREE_OPERAND (node, 0);
15674      TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1);
15675
15676      if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)
15677	  && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
15678	  && DECL_INITIAL (nn) != NULL_TREE)
15679	{
15680	  tree value;
15681
15682	  value = fold_constant_for_init (nn, nn);
15683
15684	  /* When we have a primitype type, or a string and we're not
15685             emitting a class file, we actually don't want to generate
15686             anything for the assignment. */
15687	  if (value != NULL_TREE &&
15688	      (JPRIMITIVE_TYPE_P (TREE_TYPE (value)) ||
15689	       (TREE_TYPE (value) == string_ptr_type_node &&
15690		! flag_emit_class_files)))
15691	    {
15692	      /* Prepare node for patch_assignment */
15693	      TREE_OPERAND (node, 1) = value;
15694	      /* Call patch assignment to verify the assignment */
15695	      if (patch_assignment (node, wfl_op1) == error_mark_node)
15696		return error_mark_node;
15697	      /* Set DECL_INITIAL properly (a conversion might have
15698                 been decided by patch_assignment) and return the
15699                 empty statement. */
15700	      else
15701		{
15702		  tree patched = patch_string (TREE_OPERAND (node, 1));
15703		  if (patched)
15704		    DECL_INITIAL (nn) = patched;
15705		  else
15706		    DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
15707		  DECL_FIELD_FINAL_IUD (nn) = 1;
15708		  return empty_stmt_node;
15709		}
15710	    }
15711	  if (! flag_emit_class_files)
15712	    DECL_INITIAL (nn) = NULL_TREE;
15713	}
15714      wfl_op2 = TREE_OPERAND (node, 1);
15715
15716      if (TREE_OPERAND (node, 0) == error_mark_node)
15717	return error_mark_node;
15718
15719      flag = COMPOUND_ASSIGN_P (wfl_op2);
15720      if (flag)
15721	{
15722	  /* This might break when accessing outer field from inner
15723             class. TESTME, FIXME */
15724	  tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
15725
15726	  /* Hand stabilize the lhs on both places */
15727	  TREE_OPERAND (node, 0) = lvalue;
15728	  TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
15729	    (flag_emit_class_files ? lvalue : save_expr (lvalue));
15730
15731	  /* 15.25.2.a: Left hand is not an array access. FIXME */
15732	  /* Now complete the RHS. We write it back later on. */
15733	  nn = java_complete_tree (TREE_OPERAND (node, 1));
15734
15735	  if ((cn = patch_string (nn)))
15736	    nn = cn;
15737
15738	  /* The last part of the rewrite for E1 op= E2 is to have
15739	     E1 = (T)(E1 op E2), with T being the type of E1. */
15740	  nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
15741					       TREE_TYPE (lvalue), nn));
15742
15743	  /* If the assignment is compound and has reference type,
15744	     then ensure the LHS has type String and nothing else.  */
15745	  if (JREFERENCE_TYPE_P (TREE_TYPE (lvalue))
15746	      && ! JSTRING_TYPE_P (TREE_TYPE (lvalue)))
15747	    parse_error_context (wfl_op2,
15748				 "Incompatible type for `+='. Can't convert `%s' to `java.lang.String'",
15749				 lang_printable_name (TREE_TYPE (lvalue), 0));
15750
15751	  /* 15.25.2.b: Left hand is an array access. FIXME */
15752	}
15753
15754      /* If we're about to patch a NEW_ARRAY_INIT, we call a special
15755	 function to complete this RHS. Note that a NEW_ARRAY_INIT
15756	 might have been already fully expanded if created as a result
15757	 of processing an anonymous array initializer. We avoid doing
15758	 the operation twice by testing whether the node already bears
15759	 a type. */
15760      else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT && !TREE_TYPE (wfl_op2))
15761	nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)),
15762				   TREE_OPERAND (node, 1));
15763      /* Otherwise we simply complete the RHS */
15764      else
15765	nn = java_complete_tree (TREE_OPERAND (node, 1));
15766
15767      if (nn == error_mark_node)
15768	return error_mark_node;
15769
15770      /* Write back the RHS as we evaluated it. */
15771      TREE_OPERAND (node, 1) = nn;
15772
15773      /* In case we're handling = with a String as a RHS, we need to
15774	 produce a String out of the RHS (it might still be a
15775	 STRING_CST or a StringBuffer at this stage */
15776      if ((nn = patch_string (TREE_OPERAND (node, 1))))
15777	TREE_OPERAND (node, 1) = nn;
15778
15779      if ((nn = outer_field_access_fix (wfl_op1, TREE_OPERAND (node, 0),
15780					TREE_OPERAND (node, 1))))
15781	{
15782	  /* We return error_mark_node if outer_field_access_fix
15783	     detects we write into a final. */
15784	  if (nn == error_mark_node)
15785	    return error_mark_node;
15786	  node = nn;
15787	}
15788      else
15789	{
15790	  node = patch_assignment (node, wfl_op1);
15791	  if (node == error_mark_node)
15792	    return error_mark_node;
15793	  /* Reorganize the tree if necessary. */
15794	  if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
15795		       || JSTRING_P (TREE_TYPE (node))))
15796	    node = java_refold (node);
15797	}
15798
15799      /* Seek to set DECL_INITIAL to a proper value, since it might have
15800	 undergone a conversion in patch_assignment. We do that only when
15801	 it's necessary to have DECL_INITIAL properly set. */
15802      nn = TREE_OPERAND (node, 0);
15803      if (TREE_CODE (nn) == VAR_DECL
15804	  && DECL_INITIAL (nn) && CONSTANT_VALUE_P (DECL_INITIAL (nn))
15805	  && FIELD_STATIC (nn) && FIELD_FINAL (nn)
15806	  && (JPRIMITIVE_TYPE_P (TREE_TYPE (nn))
15807	      || TREE_TYPE (nn) == string_ptr_type_node))
15808	DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
15809
15810      CAN_COMPLETE_NORMALLY (node) = 1;
15811      return node;
15812
15813    case MULT_EXPR:
15814    case PLUS_EXPR:
15815    case MINUS_EXPR:
15816    case LSHIFT_EXPR:
15817    case RSHIFT_EXPR:
15818    case URSHIFT_EXPR:
15819    case BIT_AND_EXPR:
15820    case BIT_XOR_EXPR:
15821    case BIT_IOR_EXPR:
15822    case TRUNC_MOD_EXPR:
15823    case TRUNC_DIV_EXPR:
15824    case RDIV_EXPR:
15825    case TRUTH_ANDIF_EXPR:
15826    case TRUTH_ORIF_EXPR:
15827    case EQ_EXPR:
15828    case NE_EXPR:
15829    case GT_EXPR:
15830    case GE_EXPR:
15831    case LT_EXPR:
15832    case LE_EXPR:
15833      /* Operands 0 and 1 are WFL in certain cases only. patch_binop
15834	 knows how to handle those cases. */
15835      wfl_op1 = TREE_OPERAND (node, 0);
15836      wfl_op2 = TREE_OPERAND (node, 1);
15837
15838      CAN_COMPLETE_NORMALLY (node) = 1;
15839      /* Don't complete string nodes if dealing with the PLUS operand. */
15840      if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1))
15841        {
15842          nn = java_complete_tree (wfl_op1);
15843          if (nn == error_mark_node)
15844            return error_mark_node;
15845
15846          TREE_OPERAND (node, 0) = nn;
15847        }
15848      if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2))
15849        {
15850          nn = java_complete_tree (wfl_op2);
15851          if (nn == error_mark_node)
15852            return error_mark_node;
15853
15854          TREE_OPERAND (node, 1) = nn;
15855        }
15856      return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2));
15857
15858    case INSTANCEOF_EXPR:
15859      wfl_op1 = TREE_OPERAND (node, 0);
15860      COMPLETE_CHECK_OP_0 (node);
15861      if (flag_emit_xref)
15862	{
15863	  TREE_TYPE (node) = boolean_type_node;
15864	  return node;
15865	}
15866      return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1));
15867
15868    case UNARY_PLUS_EXPR:
15869    case NEGATE_EXPR:
15870    case TRUTH_NOT_EXPR:
15871    case BIT_NOT_EXPR:
15872    case PREDECREMENT_EXPR:
15873    case PREINCREMENT_EXPR:
15874    case POSTDECREMENT_EXPR:
15875    case POSTINCREMENT_EXPR:
15876    case CONVERT_EXPR:
15877      /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
15878	 how to handle those cases. */
15879      wfl_op1 = TREE_OPERAND (node, 0);
15880      CAN_COMPLETE_NORMALLY (node) = 1;
15881      TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
15882      if (TREE_OPERAND (node, 0) == error_mark_node)
15883	return error_mark_node;
15884      node = patch_unaryop (node, wfl_op1);
15885      CAN_COMPLETE_NORMALLY (node) = 1;
15886      break;
15887
15888    case ARRAY_REF:
15889      /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
15890	 how to handle those cases. */
15891      wfl_op1 = TREE_OPERAND (node, 0);
15892      TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
15893      if (TREE_OPERAND (node, 0) == error_mark_node)
15894	return error_mark_node;
15895      if (!flag_emit_class_files && !flag_emit_xref)
15896	TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0));
15897      /* The same applies to wfl_op2 */
15898      wfl_op2 = TREE_OPERAND (node, 1);
15899      TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
15900      if (TREE_OPERAND (node, 1) == error_mark_node)
15901	return error_mark_node;
15902      if (!flag_emit_class_files && !flag_emit_xref)
15903	TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1));
15904      return patch_array_ref (node);
15905
15906    case RECORD_TYPE:
15907      return node;;
15908
15909    case COMPONENT_REF:
15910      /* The first step in the re-write of qualified name handling.  FIXME.
15911	 So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
15912      TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
15913      if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE)
15914	{
15915	  tree name = TREE_OPERAND (node, 1);
15916	  tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name);
15917	  if (field == NULL_TREE)
15918	    {
15919	      error ("missing static field `%s'", IDENTIFIER_POINTER (name));
15920	      return error_mark_node;
15921	    }
15922	  if (! FIELD_STATIC (field))
15923	    {
15924	      error ("not a static field `%s'", IDENTIFIER_POINTER (name));
15925	      return error_mark_node;
15926	    }
15927	  return field;
15928	}
15929      else
15930	abort ();
15931      break;
15932
15933    case THIS_EXPR:
15934      /* Can't use THIS in a static environment */
15935      if (!current_this)
15936	{
15937	  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
15938	  parse_error_context (wfl_operator,
15939			       "Keyword `this' used outside allowed context");
15940	  TREE_TYPE (node) = error_mark_node;
15941	  return error_mark_node;
15942	}
15943      if (ctxp->explicit_constructor_p)
15944	{
15945	  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
15946	  parse_error_context
15947	    (wfl_operator, "Can't reference `this' or `super' before the superclass constructor has been called");
15948	  TREE_TYPE (node) = error_mark_node;
15949	  return error_mark_node;
15950	}
15951      return current_this;
15952
15953    case CLASS_LITERAL:
15954      CAN_COMPLETE_NORMALLY (node) = 1;
15955      node = patch_incomplete_class_ref (node);
15956      if (node == error_mark_node)
15957	return error_mark_node;
15958      break;
15959
15960    default:
15961      CAN_COMPLETE_NORMALLY (node) = 1;
15962      /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
15963	 and it's time to turn it into the appropriate String object */
15964      if ((nn = patch_string (node)))
15965	node = nn;
15966      else
15967	internal_error ("No case for %s", tree_code_name [TREE_CODE (node)]);
15968    }
15969  return node;
15970}
15971
15972/* Complete function call's argument. Return a nonzero value is an
15973   error was found.  */
15974
15975static int
15976complete_function_arguments (node)
15977     tree node;
15978{
15979  int flag = 0;
15980  tree cn;
15981
15982  ctxp->explicit_constructor_p += (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0);
15983  for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
15984    {
15985      tree wfl = TREE_VALUE (cn), parm, temp;
15986      parm = java_complete_tree (wfl);
15987
15988      if (parm == error_mark_node)
15989	{
15990	  flag = 1;
15991	  continue;
15992	}
15993      /* If have a string literal that we haven't transformed yet or a
15994	 crafted string buffer, as a result of use of the the String
15995	 `+' operator. Build `parm.toString()' and expand it. */
15996      if ((temp = patch_string (parm)))
15997	parm = temp;
15998
15999      TREE_VALUE (cn) = parm;
16000    }
16001  ctxp->explicit_constructor_p -= (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0);
16002  return flag;
16003}
16004
16005/* Sometimes (for loops and variable initialized during their
16006   declaration), we want to wrap a statement around a WFL and turn it
16007   debugable.  */
16008
16009static tree
16010build_debugable_stmt (location, stmt)
16011    int location;
16012    tree stmt;
16013{
16014  if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
16015    {
16016      stmt = build_expr_wfl (stmt, input_filename, 0, 0);
16017      EXPR_WFL_LINECOL (stmt) = location;
16018    }
16019  JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
16020  return stmt;
16021}
16022
16023static tree
16024build_expr_block (body, decls)
16025     tree body, decls;
16026{
16027  tree node = make_node (BLOCK);
16028  BLOCK_EXPR_DECLS (node) = decls;
16029  BLOCK_EXPR_BODY (node) = body;
16030  if (body)
16031    TREE_TYPE (node) = TREE_TYPE (body);
16032  TREE_SIDE_EFFECTS (node) = 1;
16033  return node;
16034}
16035
16036/* Create a new function block and link it appropriately to current
16037   function block chain */
16038
16039static tree
16040enter_block ()
16041{
16042  tree b = build_expr_block (NULL_TREE, NULL_TREE);
16043
16044  /* Link block B supercontext to the previous block. The current
16045     function DECL is used as supercontext when enter_a_block is called
16046     for the first time for a given function. The current function body
16047     (DECL_FUNCTION_BODY) is set to be block B.  */
16048
16049  tree fndecl = current_function_decl;
16050
16051  if (!fndecl) {
16052    BLOCK_SUPERCONTEXT (b) = current_static_block;
16053    current_static_block = b;
16054  }
16055
16056  else if (!DECL_FUNCTION_BODY (fndecl))
16057    {
16058      BLOCK_SUPERCONTEXT (b) = fndecl;
16059      DECL_FUNCTION_BODY (fndecl) = b;
16060    }
16061  else
16062    {
16063      BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl);
16064      DECL_FUNCTION_BODY (fndecl) = b;
16065    }
16066  return b;
16067}
16068
16069/* Exit a block by changing the current function body
16070   (DECL_FUNCTION_BODY) to the current block super context, only if
16071   the block being exited isn't the method's top level one.  */
16072
16073static tree
16074exit_block ()
16075{
16076  tree b;
16077  if (current_function_decl)
16078    {
16079      b = DECL_FUNCTION_BODY (current_function_decl);
16080      if (BLOCK_SUPERCONTEXT (b) != current_function_decl)
16081	DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b);
16082    }
16083  else
16084    {
16085      b = current_static_block;
16086
16087      if (BLOCK_SUPERCONTEXT (b))
16088	current_static_block = BLOCK_SUPERCONTEXT (b);
16089    }
16090  return b;
16091}
16092
16093/* Lookup for NAME in the nested function's blocks, all the way up to
16094   the current toplevel one. It complies with Java's local variable
16095   scoping rules.  */
16096
16097static tree
16098lookup_name_in_blocks (name)
16099     tree name;
16100{
16101  tree b = GET_CURRENT_BLOCK (current_function_decl);
16102
16103  while (b != current_function_decl)
16104    {
16105      tree current;
16106
16107      /* Paranoid sanity check. To be removed */
16108      if (TREE_CODE (b) != BLOCK)
16109	abort ();
16110
16111      for (current = BLOCK_EXPR_DECLS (b); current;
16112	   current = TREE_CHAIN (current))
16113	if (DECL_NAME (current) == name)
16114	  return current;
16115      b = BLOCK_SUPERCONTEXT (b);
16116    }
16117  return NULL_TREE;
16118}
16119
16120static void
16121maybe_absorb_scoping_blocks ()
16122{
16123  while (BLOCK_IS_IMPLICIT (GET_CURRENT_BLOCK (current_function_decl)))
16124    {
16125      tree b = exit_block ();
16126      java_method_add_stmt (current_function_decl, b);
16127      SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno));
16128    }
16129}
16130
16131
16132/* This section of the source is reserved to build_* functions that
16133   are building incomplete tree nodes and the patch_* functions that
16134   are completing them.  */
16135
16136/* Wrap a non WFL node around a WFL.  */
16137
16138static tree
16139build_wfl_wrap (node, location)
16140    tree node;
16141    int location;
16142{
16143  tree wfl, node_to_insert = node;
16144
16145  /* We want to process THIS . xxx symbolicaly, to keep it consistent
16146     with the way we're processing SUPER. A THIS from a primary as a
16147     different form than a SUPER. Turn THIS into something symbolic */
16148  if (TREE_CODE (node) == THIS_EXPR)
16149    node_to_insert = wfl = build_wfl_node (this_identifier_node);
16150  else
16151    wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
16152
16153  EXPR_WFL_LINECOL (wfl) = location;
16154  EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (node_to_insert, NULL_TREE);
16155  return wfl;
16156}
16157
16158/* Build a super() constructor invocation. Returns empty_stmt_node if
16159   we're currently dealing with the class java.lang.Object. */
16160
16161static tree
16162build_super_invocation (mdecl)
16163     tree mdecl;
16164{
16165  if (DECL_CONTEXT (mdecl) == object_type_node)
16166    return empty_stmt_node;
16167  else
16168    {
16169      tree super_wfl = build_wfl_node (super_identifier_node);
16170      tree a = NULL_TREE, t;
16171      /* If we're dealing with an anonymous class, pass the arguments
16172         of the crafted constructor along. */
16173      if (ANONYMOUS_CLASS_P (DECL_CONTEXT (mdecl)))
16174	{
16175	  SKIP_THIS_AND_ARTIFICIAL_PARMS (t, mdecl);
16176	  for (; t != end_params_node; t = TREE_CHAIN (t))
16177	    a = tree_cons (NULL_TREE, build_wfl_node (TREE_PURPOSE (t)), a);
16178	}
16179      return build_method_invocation (super_wfl, a);
16180    }
16181}
16182
16183/* Build a SUPER/THIS qualified method invocation.  */
16184
16185static tree
16186build_this_super_qualified_invocation (use_this, name, args, lloc, rloc)
16187     int use_this;
16188     tree name, args;
16189     int lloc, rloc;
16190{
16191  tree invok;
16192  tree wfl =
16193    build_wfl_node (use_this ? this_identifier_node : super_identifier_node);
16194  EXPR_WFL_LINECOL (wfl) = lloc;
16195  invok = build_method_invocation (name, args);
16196  return make_qualified_primary (wfl, invok, rloc);
16197}
16198
16199/* Build an incomplete CALL_EXPR node. */
16200
16201static tree
16202build_method_invocation (name, args)
16203    tree name;
16204    tree args;
16205{
16206  tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE);
16207  TREE_SIDE_EFFECTS (call) = 1;
16208  EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
16209  return call;
16210}
16211
16212/* Build an incomplete new xxx(...) node. */
16213
16214static tree
16215build_new_invocation (name, args)
16216    tree name, args;
16217{
16218  tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE);
16219  TREE_SIDE_EFFECTS (call) = 1;
16220  EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
16221  return call;
16222}
16223
16224/* Build an incomplete assignment expression. */
16225
16226static tree
16227build_assignment (op, op_location, lhs, rhs)
16228     int op, op_location;
16229     tree lhs, rhs;
16230{
16231  tree assignment;
16232  /* Build the corresponding binop if we deal with a Compound
16233     Assignment operator. Mark the binop sub-tree as part of a
16234     Compound Assignment expression */
16235  if (op != ASSIGN_TK)
16236    {
16237      rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs);
16238      COMPOUND_ASSIGN_P (rhs) = 1;
16239    }
16240  assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs);
16241  TREE_SIDE_EFFECTS (assignment) = 1;
16242  EXPR_WFL_LINECOL (assignment) = op_location;
16243  return assignment;
16244}
16245
16246/* Print an INTEGER_CST node as decimal in a static buffer, and return
16247   the buffer.  This is used only for string conversion.  */
16248static char *
16249string_convert_int_cst (node)
16250     tree node;
16251{
16252  /* Long.MIN_VALUE is -9223372036854775808, 20 characters.  */
16253  static char buffer[21];
16254
16255  unsigned HOST_WIDE_INT lo = TREE_INT_CST_LOW (node);
16256  unsigned HOST_WIDE_INT hi = TREE_INT_CST_HIGH (node);
16257  char *p = buffer + sizeof (buffer);
16258  int neg = 0;
16259
16260  unsigned HOST_WIDE_INT hibit = (((unsigned HOST_WIDE_INT) 1)
16261				  << (HOST_BITS_PER_WIDE_INT - 1));
16262
16263  *--p = '\0';
16264
16265  /* If negative, note the fact and negate the value.  */
16266  if ((hi & hibit))
16267    {
16268      lo = ~lo;
16269      hi = ~hi;
16270      if (++lo == 0)
16271	++hi;
16272      neg = 1;
16273    }
16274
16275  /* Divide by 10 until there are no bits left.  */
16276  do
16277    {
16278      unsigned HOST_WIDE_INT acc = 0;
16279      unsigned HOST_WIDE_INT outhi = 0, outlo = 0;
16280      unsigned int i;
16281
16282      /* Use long division to compute the result and the remainder.  */
16283      for (i = 0; i < 2 * HOST_BITS_PER_WIDE_INT; ++i)
16284	{
16285	  /* Shift a bit into accumulator.  */
16286	  acc <<= 1;
16287	  if ((hi & hibit))
16288	    acc |= 1;
16289
16290	  /* Shift the value.  */
16291	  hi <<= 1;
16292	  if ((lo & hibit))
16293	    hi |= 1;
16294	  lo <<= 1;
16295
16296	  /* Shift the correct bit into the result.  */
16297	  outhi <<= 1;
16298	  if ((outlo & hibit))
16299	    outhi |= 1;
16300	  outlo <<= 1;
16301	  if (acc >= 10)
16302	    {
16303	      acc -= 10;
16304	      outlo |= 1;
16305	    }
16306	}
16307
16308      /* '0' == 060 in Java, but might not be here (think EBCDIC).  */
16309      *--p = '\060' + acc;
16310
16311      hi = outhi;
16312      lo = outlo;
16313    }
16314  while (hi || lo);
16315
16316  if (neg)
16317    *--p = '\055'; /* '-' == 055 in Java, but might not be here.  */
16318
16319  return p;
16320}
16321
16322/* Print an INTEGER_CST node in a static buffer, and return the
16323   buffer.  This is used only for error handling.  */
16324char *
16325print_int_node (node)
16326    tree node;
16327{
16328  static char buffer [80];
16329  if (TREE_CONSTANT_OVERFLOW (node))
16330    sprintf (buffer, "<overflow>");
16331
16332  if (TREE_INT_CST_HIGH (node) == 0)
16333    sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED,
16334	     TREE_INT_CST_LOW (node));
16335  else if (TREE_INT_CST_HIGH (node) == -1
16336	   && TREE_INT_CST_LOW (node) != 0)
16337    {
16338      buffer [0] = '-';
16339      sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED,
16340	       -TREE_INT_CST_LOW (node));
16341    }
16342  else
16343    sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
16344	     TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
16345
16346  return buffer;
16347}
16348
16349
16350/* Return 1 if an assignment to a FINAL is attempted in a non suitable
16351   context.  */
16352
16353/* 15.25 Assignment operators. */
16354
16355static tree
16356patch_assignment (node, wfl_op1)
16357     tree node;
16358     tree wfl_op1;
16359{
16360  tree rhs = TREE_OPERAND (node, 1);
16361  tree lvalue = TREE_OPERAND (node, 0), llvalue;
16362  tree lhs_type = NULL_TREE, rhs_type, new_rhs = NULL_TREE;
16363  int error_found = 0;
16364  int lvalue_from_array = 0;
16365  int is_return = 0;
16366
16367  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
16368
16369  /* Lhs can be a named variable */
16370  if (JDECL_P (lvalue))
16371    {
16372      lhs_type = TREE_TYPE (lvalue);
16373    }
16374  /* Or Lhs can be an array access. */
16375  else if (TREE_CODE (lvalue) == ARRAY_REF)
16376    {
16377      lhs_type = TREE_TYPE (lvalue);
16378      lvalue_from_array = 1;
16379    }
16380  /* Or a field access */
16381  else if (TREE_CODE (lvalue) == COMPONENT_REF)
16382    lhs_type = TREE_TYPE (lvalue);
16383  /* Or a function return slot */
16384  else if (TREE_CODE (lvalue) == RESULT_DECL)
16385    {
16386      /* If the return type is an integral type, then we create the
16387	 RESULT_DECL with a promoted type, but we need to do these
16388	 checks against the unpromoted type to ensure type safety.  So
16389	 here we look at the real type, not the type of the decl we
16390	 are modifying.  */
16391      lhs_type = TREE_TYPE (TREE_TYPE (current_function_decl));
16392      is_return = 1;
16393    }
16394  /* Otherwise, we might want to try to write into an optimized static
16395     final, this is an of a different nature, reported further on. */
16396  else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION
16397	   && resolve_expression_name (wfl_op1, &llvalue))
16398    {
16399      lhs_type = TREE_TYPE (lvalue);
16400    }
16401  else
16402    {
16403      parse_error_context (wfl_op1, "Invalid left hand side of assignment");
16404      error_found = 1;
16405    }
16406
16407  rhs_type = TREE_TYPE (rhs);
16408
16409  /* 5.1 Try the assignment conversion for builtin type. */
16410  new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs);
16411
16412  /* 5.2 If it failed, try a reference conversion */
16413  if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs)))
16414    lhs_type = promote_type (rhs_type);
16415
16416  /* 15.25.2 If we have a compound assignment, convert RHS into the
16417     type of the LHS */
16418  else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
16419    new_rhs = convert (lhs_type, rhs);
16420
16421  /* Explicit cast required. This is an error */
16422  if (!new_rhs)
16423    {
16424      char *t1 = xstrdup (lang_printable_name (TREE_TYPE (rhs), 0));
16425      char *t2 = xstrdup (lang_printable_name (lhs_type, 0));
16426      tree wfl;
16427      char operation [32];	/* Max size known */
16428
16429      /* If the assignment is part of a declaration, we use the WFL of
16430	 the declared variable to point out the error and call it a
16431	 declaration problem. If the assignment is a genuine =
16432	 operator, we call is a operator `=' problem, otherwise we
16433	 call it an assignment problem. In both of these last cases,
16434	 we use the WFL of the operator to indicate the error. */
16435
16436      if (MODIFY_EXPR_FROM_INITIALIZATION_P (node))
16437	{
16438	  wfl = wfl_op1;
16439	  strcpy (operation, "declaration");
16440	}
16441      else
16442	{
16443	  wfl = wfl_operator;
16444	  if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
16445	    strcpy (operation, "assignment");
16446	  else if (is_return)
16447	    strcpy (operation, "`return'");
16448	  else
16449	    strcpy (operation, "`='");
16450	}
16451
16452      if (!valid_cast_to_p (rhs_type, lhs_type))
16453	parse_error_context
16454	  (wfl, "Incompatible type for %s. Can't convert `%s' to `%s'",
16455	   operation, t1, t2);
16456      else
16457	parse_error_context (wfl, "Incompatible type for %s. Explicit cast needed to convert `%s' to `%s'",
16458			     operation, t1, t2);
16459      free (t1); free (t2);
16460      error_found = 1;
16461    }
16462
16463  if (error_found)
16464    return error_mark_node;
16465
16466  /* If we're processing a `return' statement, promote the actual type
16467     to the promoted type.  */
16468  if (is_return)
16469    new_rhs = convert (TREE_TYPE (lvalue), new_rhs);
16470
16471  /* 10.10: Array Store Exception runtime check */
16472  if (!flag_emit_class_files
16473      && !flag_emit_xref
16474      && lvalue_from_array
16475      && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type)))
16476    {
16477      tree array, store_check, base, index_expr;
16478
16479      /* Save RHS so that it doesn't get re-evaluated by the store check. */
16480      new_rhs = save_expr (new_rhs);
16481
16482      /* Get the INDIRECT_REF. */
16483      array = TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0);
16484      /* Get the array pointer expr. */
16485      array = TREE_OPERAND (array, 0);
16486      store_check = build_java_arraystore_check (array, new_rhs);
16487
16488      index_expr = TREE_OPERAND (lvalue, 1);
16489
16490      if (TREE_CODE (index_expr) == COMPOUND_EXPR)
16491	{
16492	  /* A COMPOUND_EXPR here is a bounds check. The bounds check must
16493	     happen before the store check, so prepare to insert the store
16494	     check within the second operand of the existing COMPOUND_EXPR. */
16495	  base = index_expr;
16496	}
16497      else
16498        base = lvalue;
16499
16500      index_expr = TREE_OPERAND (base, 1);
16501      TREE_OPERAND (base, 1) = build (COMPOUND_EXPR, TREE_TYPE (index_expr),
16502	  			      store_check, index_expr);
16503    }
16504
16505  /* Final locals can be used as case values in switch
16506     statement. Prepare them for this eventuality. */
16507  if (TREE_CODE (lvalue) == VAR_DECL
16508      && DECL_FINAL (lvalue)
16509      && TREE_CONSTANT (new_rhs)
16510      && IDENTIFIER_LOCAL_VALUE (DECL_NAME (lvalue))
16511      && JINTEGRAL_TYPE_P (TREE_TYPE (lvalue))
16512      )
16513    {
16514      TREE_CONSTANT (lvalue) = 1;
16515      DECL_INITIAL (lvalue) = new_rhs;
16516    }
16517
16518  /* Copy the rhs if it's a reference.  */
16519  if (! flag_check_references && ! flag_emit_class_files && optimize > 0)
16520    {
16521      switch (TREE_CODE (new_rhs))
16522	{
16523	case ARRAY_REF:
16524	case INDIRECT_REF:
16525	case COMPONENT_REF:
16526	  /* Transform a = foo.bar
16527	     into a = { int tmp; tmp = foo.bar; tmp; ).
16528	     We need to ensure that if a read from memory fails
16529	     because of a NullPointerException, a destination variable
16530	     will remain unchanged.  An explicit temporary does what
16531	     we need.
16532
16533	     If flag_check_references is set, this is unnecessary
16534	     because we'll check each reference before doing any
16535	     reads.  If optimize is not set the result will never be
16536	     written to a stack slot that contains the LHS.  */
16537	  {
16538	    tree tmp = build_decl (VAR_DECL, get_identifier ("<tmp>"),
16539				   TREE_TYPE (new_rhs));
16540	    tree block = build (BLOCK, TREE_TYPE (new_rhs), NULL);
16541	    tree assignment
16542	      = build (MODIFY_EXPR, TREE_TYPE (new_rhs), tmp, fold (new_rhs));
16543	    BLOCK_VARS (block) = tmp;
16544	    BLOCK_EXPR_BODY (block)
16545	      = build (COMPOUND_EXPR, TREE_TYPE (new_rhs), assignment, tmp);
16546	    TREE_SIDE_EFFECTS (block) = 1;
16547	    new_rhs = block;
16548	  }
16549	  break;
16550	default:
16551	  break;
16552	}
16553    }
16554
16555  TREE_OPERAND (node, 0) = lvalue;
16556  TREE_OPERAND (node, 1) = new_rhs;
16557  TREE_TYPE (node) = lhs_type;
16558  return node;
16559}
16560
16561/* Check that type SOURCE can be cast into type DEST. If the cast
16562   can't occur at all, return NULL; otherwise, return a possibly
16563   modified rhs.  */
16564
16565static tree
16566try_reference_assignconv (lhs_type, rhs)
16567     tree lhs_type, rhs;
16568{
16569  tree new_rhs = NULL_TREE;
16570  tree rhs_type = TREE_TYPE (rhs);
16571
16572  if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type))
16573    {
16574      /* `null' may be assigned to any reference type */
16575      if (rhs == null_pointer_node)
16576        new_rhs = null_pointer_node;
16577      /* Try the reference assignment conversion */
16578      else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0))
16579	new_rhs = rhs;
16580      /* This is a magic assignment that we process differently */
16581      else if (TREE_CODE (rhs) == JAVA_EXC_OBJ_EXPR)
16582	new_rhs = rhs;
16583    }
16584  return new_rhs;
16585}
16586
16587/* Check that RHS can be converted into LHS_TYPE by the assignment
16588   conversion (5.2), for the cases of RHS being a builtin type. Return
16589   NULL_TREE if the conversion fails or if because RHS isn't of a
16590   builtin type. Return a converted RHS if the conversion is possible.  */
16591
16592static tree
16593try_builtin_assignconv (wfl_op1, lhs_type, rhs)
16594     tree wfl_op1, lhs_type, rhs;
16595{
16596  tree new_rhs = NULL_TREE;
16597  tree rhs_type = TREE_TYPE (rhs);
16598
16599  /* Handle boolean specially.  */
16600  if (TREE_CODE (rhs_type) == BOOLEAN_TYPE
16601      || TREE_CODE (lhs_type) == BOOLEAN_TYPE)
16602    {
16603      if (TREE_CODE (rhs_type) == BOOLEAN_TYPE
16604	  && TREE_CODE (lhs_type) == BOOLEAN_TYPE)
16605	new_rhs = rhs;
16606    }
16607
16608  /* 5.1.1 Try Identity Conversion,
16609     5.1.2 Try Widening Primitive Conversion */
16610  else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type))
16611    new_rhs = convert (lhs_type, rhs);
16612
16613  /* Try a narrowing primitive conversion (5.1.3):
16614       - expression is a constant expression of type byte, short, char,
16615         or int, AND
16616       - variable is byte, short or char AND
16617       - The value of the expression is representable in the type of the
16618         variable */
16619  else if ((rhs_type == byte_type_node || rhs_type == short_type_node
16620	    || rhs_type == char_type_node || rhs_type == int_type_node)
16621	    && TREE_CONSTANT (rhs)
16622	   && (lhs_type == byte_type_node || lhs_type == char_type_node
16623	       || lhs_type == short_type_node))
16624    {
16625      if (int_fits_type_p (rhs, lhs_type))
16626        new_rhs = convert (lhs_type, rhs);
16627      else if (wfl_op1)		/* Might be called with a NULL */
16628	parse_warning_context
16629	  (wfl_op1, "Constant expression `%s' too wide for narrowing primitive conversion to `%s'",
16630	   print_int_node (rhs), lang_printable_name (lhs_type, 0));
16631      /* Reported a warning that will turn into an error further
16632	 down, so we don't return */
16633    }
16634
16635  return new_rhs;
16636}
16637
16638/* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
16639   conversion (5.1.1) or widening primitive conversion (5.1.2).  Return
16640   0 is the conversion test fails.  This implements parts the method
16641   invocation convertion (5.3).  */
16642
16643static int
16644valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)
16645     tree lhs_type, rhs_type;
16646{
16647  /* 5.1.1: This is the identity conversion part. */
16648  if (lhs_type == rhs_type)
16649    return 1;
16650
16651  /* Reject non primitive types and boolean conversions.  */
16652  if (!JNUMERIC_TYPE_P (lhs_type) || !JNUMERIC_TYPE_P (rhs_type))
16653    return 0;
16654
16655  /* 5.1.2: widening primitive conversion. byte, even if it's smaller
16656     than a char can't be converted into a char. Short can't too, but
16657     the < test below takes care of that */
16658  if (lhs_type == char_type_node && rhs_type == byte_type_node)
16659    return 0;
16660
16661  /* Accept all promoted type here. Note, we can't use <= in the test
16662     below, because we still need to bounce out assignments of short
16663     to char and the likes */
16664  if (lhs_type == int_type_node
16665      && (rhs_type == promoted_byte_type_node
16666	  || rhs_type == promoted_short_type_node
16667	  || rhs_type == promoted_char_type_node
16668	  || rhs_type == promoted_boolean_type_node))
16669    return 1;
16670
16671  /* From here, an integral is widened if its precision is smaller
16672     than the precision of the LHS or if the LHS is a floating point
16673     type, or the RHS is a float and the RHS a double. */
16674  if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type)
16675       && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)))
16676      || (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type))
16677      || (rhs_type == float_type_node && lhs_type == double_type_node))
16678    return 1;
16679
16680  return 0;
16681}
16682
16683/* Check that something of SOURCE type can be assigned or cast to
16684   something of DEST type at runtime. Return 1 if the operation is
16685   valid, 0 otherwise. If CAST is set to 1, we're treating the case
16686   were SOURCE is cast into DEST, which borrows a lot of the
16687   assignment check. */
16688
16689static int
16690valid_ref_assignconv_cast_p (source, dest, cast)
16691     tree source;
16692     tree dest;
16693     int cast;
16694{
16695  /* SOURCE or DEST might be null if not from a declared entity. */
16696  if (!source || !dest)
16697    return 0;
16698  if (JNULLP_TYPE_P (source))
16699    return 1;
16700  if (TREE_CODE (source) == POINTER_TYPE)
16701    source = TREE_TYPE (source);
16702  if (TREE_CODE (dest) == POINTER_TYPE)
16703    dest = TREE_TYPE (dest);
16704
16705  /* If source and dest are being compiled from bytecode, they may need to
16706     be loaded. */
16707  if (CLASS_P (source) && !CLASS_LOADED_P (source))
16708    {
16709      load_class (source, 1);
16710      safe_layout_class (source);
16711    }
16712  if (CLASS_P (dest) && !CLASS_LOADED_P (dest))
16713    {
16714      load_class (dest, 1);
16715      safe_layout_class (dest);
16716    }
16717
16718  /* Case where SOURCE is a class type */
16719  if (TYPE_CLASS_P (source))
16720    {
16721      if (TYPE_CLASS_P (dest))
16722	return  (source == dest
16723		 || inherits_from_p (source, dest)
16724		 || (cast && inherits_from_p (dest, source)));
16725      if (TYPE_INTERFACE_P (dest))
16726	{
16727	  /* If doing a cast and SOURCE is final, the operation is
16728             always correct a compile time (because even if SOURCE
16729             does not implement DEST, a subclass of SOURCE might). */
16730	  if (cast && !CLASS_FINAL (TYPE_NAME (source)))
16731	    return 1;
16732	  /* Otherwise, SOURCE must implement DEST */
16733	  return interface_of_p (dest, source);
16734	}
16735      /* DEST is an array, cast permited if SOURCE is of Object type */
16736      return (cast && source == object_type_node ? 1 : 0);
16737    }
16738  if (TYPE_INTERFACE_P (source))
16739    {
16740      if (TYPE_CLASS_P (dest))
16741	{
16742	  /* If not casting, DEST must be the Object type */
16743	  if (!cast)
16744	    return dest == object_type_node;
16745	  /* We're doing a cast. The cast is always valid is class
16746	     DEST is not final, otherwise, DEST must implement SOURCE */
16747	  else if (!CLASS_FINAL (TYPE_NAME (dest)))
16748	    return 1;
16749	  else
16750	    return interface_of_p (source, dest);
16751	}
16752      if (TYPE_INTERFACE_P (dest))
16753	{
16754	  /* If doing a cast, then if SOURCE and DEST contain method
16755             with the same signature but different return type, then
16756             this is a (compile time) error */
16757	  if (cast)
16758	    {
16759	      tree method_source, method_dest;
16760	      tree source_type;
16761	      tree source_sig;
16762	      tree source_name;
16763	      for (method_source = TYPE_METHODS (source); method_source;
16764		   method_source = TREE_CHAIN (method_source))
16765		{
16766		  source_sig =
16767		    build_java_argument_signature (TREE_TYPE (method_source));
16768		  source_type = TREE_TYPE (TREE_TYPE (method_source));
16769		  source_name = DECL_NAME (method_source);
16770		  for (method_dest = TYPE_METHODS (dest);
16771		       method_dest; method_dest = TREE_CHAIN (method_dest))
16772		    if (source_sig ==
16773			build_java_argument_signature (TREE_TYPE (method_dest))
16774			&& source_name == DECL_NAME (method_dest)
16775			&& source_type != TREE_TYPE (TREE_TYPE (method_dest)))
16776		      return 0;
16777		}
16778	      return 1;
16779	    }
16780	  else
16781	    return source == dest || interface_of_p (dest, source);
16782	}
16783      else
16784	{
16785	  /* Array */
16786	  return (cast
16787		  && (DECL_NAME (TYPE_NAME (source))
16788		      == java_lang_cloneable_identifier_node
16789		      || (DECL_NAME (TYPE_NAME (source))
16790			  == java_io_serializable_identifier_node)));
16791	}
16792    }
16793  if (TYPE_ARRAY_P (source))
16794    {
16795      if (TYPE_CLASS_P (dest))
16796	return dest == object_type_node;
16797      /* Can't cast an array to an interface unless the interface is
16798	 java.lang.Cloneable or java.io.Serializable.  */
16799      if (TYPE_INTERFACE_P (dest))
16800	return (DECL_NAME (TYPE_NAME (dest))
16801		== java_lang_cloneable_identifier_node
16802		|| (DECL_NAME (TYPE_NAME (dest))
16803		    == java_io_serializable_identifier_node));
16804      else			/* Arrays */
16805	{
16806	  tree source_element_type = TYPE_ARRAY_ELEMENT (source);
16807	  tree dest_element_type = TYPE_ARRAY_ELEMENT (dest);
16808
16809	  /* In case of severe errors, they turn out null */
16810	  if (!dest_element_type || !source_element_type)
16811	    return 0;
16812	  if (source_element_type == dest_element_type)
16813	    return 1;
16814	  return valid_ref_assignconv_cast_p (source_element_type,
16815					      dest_element_type, cast);
16816	}
16817      return 0;
16818    }
16819  return 0;
16820}
16821
16822static int
16823valid_cast_to_p (source, dest)
16824     tree source;
16825     tree dest;
16826{
16827  if (TREE_CODE (source) == POINTER_TYPE)
16828    source = TREE_TYPE (source);
16829  if (TREE_CODE (dest) == POINTER_TYPE)
16830    dest = TREE_TYPE (dest);
16831
16832  if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE)
16833    return valid_ref_assignconv_cast_p (source, dest, 1);
16834
16835  else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest))
16836    return 1;
16837
16838  else if (TREE_CODE (source) == BOOLEAN_TYPE
16839	   && TREE_CODE (dest) == BOOLEAN_TYPE)
16840    return 1;
16841
16842  return 0;
16843}
16844
16845static tree
16846do_unary_numeric_promotion (arg)
16847     tree arg;
16848{
16849  tree type = TREE_TYPE (arg);
16850  if ((TREE_CODE (type) == INTEGER_TYPE && TYPE_PRECISION (type) < 32)
16851      || TREE_CODE (type) == CHAR_TYPE)
16852    arg = convert (int_type_node, arg);
16853  return arg;
16854}
16855
16856/* Return a nonzero value if SOURCE can be converted into DEST using
16857   the method invocation conversion rule (5.3).  */
16858static int
16859valid_method_invocation_conversion_p (dest, source)
16860     tree dest, source;
16861{
16862  return ((JPRIMITIVE_TYPE_P (source) && JPRIMITIVE_TYPE_P (dest)
16863	   && valid_builtin_assignconv_identity_widening_p (dest, source))
16864	  || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source))
16865	      && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest))
16866	      && valid_ref_assignconv_cast_p (source, dest, 0)));
16867}
16868
16869/* Build an incomplete binop expression. */
16870
16871static tree
16872build_binop (op, op_location, op1, op2)
16873     enum tree_code op;
16874     int op_location;
16875     tree op1, op2;
16876{
16877  tree binop = build (op, NULL_TREE, op1, op2);
16878  TREE_SIDE_EFFECTS (binop) = 1;
16879  /* Store the location of the operator, for better error report. The
16880     string of the operator will be rebuild based on the OP value. */
16881  EXPR_WFL_LINECOL (binop) = op_location;
16882  return binop;
16883}
16884
16885/* Build the string of the operator retained by NODE. If NODE is part
16886   of a compound expression, add an '=' at the end of the string. This
16887   function is called when an error needs to be reported on an
16888   operator. The string is returned as a pointer to a static character
16889   buffer. */
16890
16891static char *
16892operator_string (node)
16893     tree node;
16894{
16895#define BUILD_OPERATOR_STRING(S)					\
16896  {									\
16897    sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : ""));	\
16898    return buffer;							\
16899  }
16900
16901  static char buffer [10];
16902  switch (TREE_CODE (node))
16903    {
16904    case MULT_EXPR: BUILD_OPERATOR_STRING ("*");
16905    case RDIV_EXPR: BUILD_OPERATOR_STRING ("/");
16906    case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%");
16907    case PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
16908    case MINUS_EXPR: BUILD_OPERATOR_STRING ("-");
16909    case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<");
16910    case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>");
16911    case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>");
16912    case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&");
16913    case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^");
16914    case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|");
16915    case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&");
16916    case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||");
16917    case EQ_EXPR: BUILD_OPERATOR_STRING ("==");
16918    case NE_EXPR: BUILD_OPERATOR_STRING ("!=");
16919    case GT_EXPR: BUILD_OPERATOR_STRING (">");
16920    case GE_EXPR: BUILD_OPERATOR_STRING (">=");
16921    case LT_EXPR: BUILD_OPERATOR_STRING ("<");
16922    case LE_EXPR: BUILD_OPERATOR_STRING ("<=");
16923    case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
16924    case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-");
16925    case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!");
16926    case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~");
16927    case PREINCREMENT_EXPR:	/* Fall through */
16928    case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++");
16929    case PREDECREMENT_EXPR:	/* Fall through */
16930    case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--");
16931    default:
16932      internal_error ("unregistered operator %s",
16933		      tree_code_name [TREE_CODE (node)]);
16934    }
16935  return NULL;
16936#undef BUILD_OPERATOR_STRING
16937}
16938
16939/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2.  */
16940
16941static int
16942java_decl_equiv (var_acc1, var_acc2)
16943     tree var_acc1, var_acc2;
16944{
16945  if (JDECL_P (var_acc1))
16946    return (var_acc1 == var_acc2);
16947
16948  return (TREE_CODE (var_acc1) == COMPONENT_REF
16949	  && TREE_CODE (var_acc2) == COMPONENT_REF
16950	  && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
16951	     == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0)
16952	  && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1));
16953}
16954
16955/* Return a nonzero value if CODE is one of the operators that can be
16956   used in conjunction with the `=' operator in a compound assignment.  */
16957
16958static int
16959binop_compound_p (code)
16960    enum tree_code code;
16961{
16962  int i;
16963  for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++)
16964    if (binop_lookup [i] == code)
16965      break;
16966
16967  return i < BINOP_COMPOUND_CANDIDATES;
16968}
16969
16970/* Reorganize after a fold to get SAVE_EXPR to generate what we want.  */
16971
16972static tree
16973java_refold (t)
16974     tree t;
16975{
16976  tree c, b, ns, decl;
16977
16978  if (TREE_CODE (t) != MODIFY_EXPR)
16979    return t;
16980
16981  c = TREE_OPERAND (t, 1);
16982  if (! (c && TREE_CODE (c) == COMPOUND_EXPR
16983	 && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR
16984	 && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1)))))
16985    return t;
16986
16987  /* Now the left branch of the binary operator. */
16988  b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
16989  if (! (b && TREE_CODE (b) == NOP_EXPR
16990	 && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
16991    return t;
16992
16993  ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0);
16994  if (! (ns && TREE_CODE (ns) == NOP_EXPR
16995	 && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR))
16996    return t;
16997
16998  decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0);
16999  if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF)
17000      /* It's got to be the an equivalent decl */
17001      && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0)))
17002    {
17003      /* Shorten the NOP_EXPR/SAVE_EXPR path. */
17004      TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0);
17005      /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
17006      TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1);
17007      /* Change the right part of the BINOP_EXPR */
17008      TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0);
17009    }
17010
17011  return t;
17012}
17013
17014/* Binary operators (15.16 up to 15.18). We return error_mark_node on
17015   errors but we modify NODE so that it contains the type computed
17016   according to the expression, when it's fixed. Otherwise, we write
17017   error_mark_node as the type. It allows us to further the analysis
17018   of remaining nodes and detects more errors in certain cases.  */
17019
17020static tree
17021patch_binop (node, wfl_op1, wfl_op2)
17022     tree node;
17023     tree wfl_op1;
17024     tree wfl_op2;
17025{
17026  tree op1 = TREE_OPERAND (node, 0);
17027  tree op2 = TREE_OPERAND (node, 1);
17028  tree op1_type = TREE_TYPE (op1);
17029  tree op2_type = TREE_TYPE (op2);
17030  tree prom_type = NULL_TREE, cn;
17031  enum tree_code code = TREE_CODE (node);
17032
17033  /* If 1, tell the routine that we have to return error_mark_node
17034     after checking for the initialization of the RHS */
17035  int error_found = 0;
17036
17037  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
17038
17039  /* If either op<n>_type are NULL, this might be early signs of an
17040     error situation, unless it's too early to tell (in case we're
17041     handling a `+', `==', `!=' or `instanceof'.) We want to set op<n>_type
17042     correctly so the error can be later on reported accurately. */
17043  if (! (code == PLUS_EXPR || code == NE_EXPR
17044	 || code == EQ_EXPR || code == INSTANCEOF_EXPR))
17045    {
17046      tree n;
17047      if (! op1_type)
17048	{
17049	  n = java_complete_tree (op1);
17050	  op1_type = TREE_TYPE (n);
17051	}
17052      if (! op2_type)
17053	{
17054	  n = java_complete_tree (op2);
17055	  op2_type = TREE_TYPE (n);
17056	}
17057    }
17058
17059  switch (code)
17060    {
17061    /* 15.16 Multiplicative operators */
17062    case MULT_EXPR:		/* 15.16.1 Multiplication Operator * */
17063    case RDIV_EXPR:		/* 15.16.2 Division Operator / */
17064    case TRUNC_DIV_EXPR:	/* 15.16.2 Integral type Division Operator / */
17065    case TRUNC_MOD_EXPR:	/* 15.16.3 Remainder operator % */
17066      if (!JNUMERIC_TYPE_P (op1_type) || !JNUMERIC_TYPE_P (op2_type))
17067	{
17068	  if (!JNUMERIC_TYPE_P (op1_type))
17069	    ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
17070	  if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
17071	    ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
17072	  TREE_TYPE (node) = error_mark_node;
17073	  error_found = 1;
17074	  break;
17075	}
17076      prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
17077
17078      /* Detect integral division by zero */
17079      if ((code == RDIV_EXPR || code == TRUNC_MOD_EXPR)
17080	  && TREE_CODE (prom_type) == INTEGER_TYPE
17081	  && (op2 == integer_zero_node || op2 == long_zero_node ||
17082	      (TREE_CODE (op2) == INTEGER_CST &&
17083	       ! TREE_INT_CST_LOW (op2)  && ! TREE_INT_CST_HIGH (op2))))
17084	{
17085	  parse_warning_context (wfl_operator, "Evaluating this expression will result in an arithmetic exception being thrown");
17086	  TREE_CONSTANT (node) = 0;
17087	}
17088
17089      /* Change the division operator if necessary */
17090      if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
17091	TREE_SET_CODE (node, TRUNC_DIV_EXPR);
17092
17093      /* Before divisions as is disapear, try to simplify and bail if
17094         applicable, otherwise we won't perform even simple
17095         simplifications like (1-1)/3. We can't do that with floating
17096         point number, folds can't handle them at this stage. */
17097      if (code == RDIV_EXPR && TREE_CONSTANT (op1) && TREE_CONSTANT (op2)
17098	  && JINTEGRAL_TYPE_P (op1) && JINTEGRAL_TYPE_P (op2))
17099	{
17100	  TREE_TYPE (node) = prom_type;
17101	  node = fold (node);
17102	  if (TREE_CODE (node) != code)
17103	    return node;
17104	}
17105
17106      if (TREE_CODE (prom_type) == INTEGER_TYPE
17107	  && flag_use_divide_subroutine
17108	  && ! flag_emit_class_files
17109	  && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
17110	return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
17111
17112      /* This one is more complicated. FLOATs are processed by a
17113	 function call to soft_fmod. Duplicate the value of the
17114	 COMPOUND_ASSIGN_P flag. */
17115      if (code == TRUNC_MOD_EXPR)
17116	{
17117	  tree mod = build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2);
17118	  COMPOUND_ASSIGN_P (mod) = COMPOUND_ASSIGN_P (node);
17119	  TREE_SIDE_EFFECTS (mod)
17120	    = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
17121	  return mod;
17122	}
17123      break;
17124
17125    /* 15.17 Additive Operators */
17126    case PLUS_EXPR:		/* 15.17.1 String Concatenation Operator + */
17127
17128      /* Operation is valid if either one argument is a string
17129	 constant, a String object or a StringBuffer crafted for the
17130	 purpose of the a previous usage of the String concatenation
17131	 operator */
17132
17133      if (TREE_CODE (op1) == STRING_CST
17134	  || TREE_CODE (op2) == STRING_CST
17135	  || JSTRING_TYPE_P (op1_type)
17136	  || JSTRING_TYPE_P (op2_type)
17137	  || IS_CRAFTED_STRING_BUFFER_P (op1)
17138	  || IS_CRAFTED_STRING_BUFFER_P (op2))
17139	return build_string_concatenation (op1, op2);
17140
17141    case MINUS_EXPR:		/* 15.17.2 Additive Operators (+ and -) for
17142				   Numeric Types */
17143      if (!JNUMERIC_TYPE_P (op1_type) || !JNUMERIC_TYPE_P (op2_type))
17144	{
17145	  if (!JNUMERIC_TYPE_P (op1_type))
17146	    ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
17147	  if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
17148	    ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
17149	  TREE_TYPE (node) = error_mark_node;
17150	  error_found = 1;
17151	  break;
17152	}
17153      prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
17154      break;
17155
17156    /* 15.18 Shift Operators */
17157    case LSHIFT_EXPR:
17158    case RSHIFT_EXPR:
17159    case URSHIFT_EXPR:
17160      if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type))
17161	{
17162	  if (!JINTEGRAL_TYPE_P (op1_type))
17163	    ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
17164	  else
17165	    {
17166	      if (JNUMERIC_TYPE_P (op2_type))
17167		parse_error_context (wfl_operator,
17168				     "Incompatible type for `%s'. Explicit cast needed to convert shift distance from `%s' to integral",
17169				     operator_string (node),
17170				     lang_printable_name (op2_type, 0));
17171	      else
17172		parse_error_context (wfl_operator,
17173				     "Incompatible type for `%s'. Can't convert shift distance from `%s' to integral",
17174				     operator_string (node),
17175				     lang_printable_name (op2_type, 0));
17176	    }
17177	  TREE_TYPE (node) = error_mark_node;
17178	  error_found = 1;
17179	  break;
17180	}
17181
17182      /* Unary numeric promotion (5.6.1) is performed on each operand
17183         separately */
17184      op1 = do_unary_numeric_promotion (op1);
17185      op2 = do_unary_numeric_promotion (op2);
17186
17187      /* If the right hand side is of type `long', first cast it to
17188	 `int'.  */
17189      if (TREE_TYPE (op2) == long_type_node)
17190	op2 = build1 (CONVERT_EXPR, int_type_node, op2);
17191
17192      /* The type of the shift expression is the type of the promoted
17193         type of the left-hand operand */
17194      prom_type = TREE_TYPE (op1);
17195
17196      /* Shift int only up to 0x1f and long up to 0x3f */
17197      if (prom_type == int_type_node)
17198	op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
17199			   build_int_2 (0x1f, 0)));
17200      else
17201	op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
17202			   build_int_2 (0x3f, 0)));
17203
17204      /* The >>> operator is a >> operating on unsigned quantities */
17205      if (code == URSHIFT_EXPR && ! flag_emit_class_files)
17206	{
17207	  tree to_return;
17208          tree utype = java_unsigned_type (prom_type);
17209          op1 = convert (utype, op1);
17210	  TREE_SET_CODE (node, RSHIFT_EXPR);
17211          TREE_OPERAND (node, 0) = op1;
17212          TREE_OPERAND (node, 1) = op2;
17213          TREE_TYPE (node) = utype;
17214	  to_return = convert (prom_type, node);
17215	  /* Copy the original value of the COMPOUND_ASSIGN_P flag */
17216	  COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node);
17217	  TREE_SIDE_EFFECTS (to_return)
17218	    = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
17219	  return to_return;
17220	}
17221      break;
17222
17223      /* 15.19.1 Type Comparison Operator instaceof */
17224    case INSTANCEOF_EXPR:
17225
17226      TREE_TYPE (node) = boolean_type_node;
17227
17228      /* OP1_TYPE might be NULL when OP1 is a string constant.  */
17229      if ((cn = patch_string (op1)))
17230	{
17231	  op1 = cn;
17232	  op1_type = TREE_TYPE (op1);
17233	}
17234      if (op1_type == NULL_TREE)
17235	abort ();
17236
17237      if (!(op2_type = resolve_type_during_patch (op2)))
17238	return error_mark_node;
17239
17240      /* The first operand must be a reference type or the null type */
17241      if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node)
17242	error_found = 1;	/* Error reported further below */
17243
17244      /* The second operand must be a reference type */
17245      if (!JREFERENCE_TYPE_P (op2_type))
17246	{
17247	  SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
17248	  parse_error_context
17249	    (wfl_operator, "Invalid argument `%s' for `instanceof'",
17250	     lang_printable_name (op2_type, 0));
17251	  error_found = 1;
17252	}
17253
17254      if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1))
17255	{
17256	  /* If the first operand is null, the result is always false */
17257	  if (op1 == null_pointer_node)
17258	    return boolean_false_node;
17259	  else if (flag_emit_class_files)
17260	    {
17261	      TREE_OPERAND (node, 1) = op2_type;
17262	      TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1);
17263	      return node;
17264	    }
17265	  /* Otherwise we have to invoke instance of to figure it out */
17266	  else
17267	    return build_instanceof (op1, op2_type);
17268	}
17269      /* There is no way the expression operand can be an instance of
17270	 the type operand. This is a compile time error. */
17271      else
17272	{
17273	  char *t1 = xstrdup (lang_printable_name (op1_type, 0));
17274	  SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
17275	  parse_error_context
17276	    (wfl_operator, "Impossible for `%s' to be instance of `%s'",
17277	     t1, lang_printable_name (op2_type, 0));
17278	  free (t1);
17279	  error_found = 1;
17280	}
17281
17282      break;
17283
17284      /* 15.21 Bitwise and Logical Operators */
17285    case BIT_AND_EXPR:
17286    case BIT_XOR_EXPR:
17287    case BIT_IOR_EXPR:
17288      if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type))
17289	/* Binary numeric promotion is performed on both operand and the
17290	   expression retain that type */
17291	prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
17292
17293      else if (TREE_CODE (op1_type) == BOOLEAN_TYPE
17294	       && TREE_CODE (op1_type) == BOOLEAN_TYPE)
17295	/* The type of the bitwise operator expression is BOOLEAN */
17296	prom_type = boolean_type_node;
17297      else
17298	{
17299	  if (!JINTEGRAL_TYPE_P (op1_type))
17300	    ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
17301	  if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type))
17302	    ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type);
17303	  TREE_TYPE (node) = error_mark_node;
17304	  error_found = 1;
17305	  /* Insert a break here if adding thing before the switch's
17306             break for this case */
17307	}
17308      break;
17309
17310      /* 15.22 Conditional-And Operator */
17311    case TRUTH_ANDIF_EXPR:
17312      /* 15.23 Conditional-Or Operator */
17313    case TRUTH_ORIF_EXPR:
17314      /* Operands must be of BOOLEAN type */
17315      if (TREE_CODE (op1_type) != BOOLEAN_TYPE ||
17316	  TREE_CODE (op2_type) != BOOLEAN_TYPE)
17317	{
17318	  if (TREE_CODE (op1_type) != BOOLEAN_TYPE)
17319	    ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type);
17320	  if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type))
17321	    ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type);
17322	  TREE_TYPE (node) = boolean_type_node;
17323	  error_found = 1;
17324	  break;
17325	}
17326      else if (integer_zerop (op1))
17327	{
17328	  return code == TRUTH_ANDIF_EXPR ? op1 : op2;
17329	}
17330      else if (integer_onep (op1))
17331	{
17332	  return code == TRUTH_ANDIF_EXPR ? op2 : op1;
17333	}
17334      /* The type of the conditional operators is BOOLEAN */
17335      prom_type = boolean_type_node;
17336      break;
17337
17338      /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
17339    case LT_EXPR:
17340    case GT_EXPR:
17341    case LE_EXPR:
17342    case GE_EXPR:
17343      /* The type of each of the operands must be a primitive numeric
17344         type */
17345      if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type))
17346	{
17347	  if (!JNUMERIC_TYPE_P (op1_type))
17348	    ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
17349	  if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
17350	    ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
17351	  TREE_TYPE (node) = boolean_type_node;
17352	  error_found = 1;
17353	  break;
17354	}
17355      /* Binary numeric promotion is performed on the operands */
17356      binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
17357      /* The type of the relation expression is always BOOLEAN */
17358      prom_type = boolean_type_node;
17359      break;
17360
17361      /* 15.20 Equality Operator */
17362    case EQ_EXPR:
17363    case NE_EXPR:
17364      /* It's time for us to patch the strings. */
17365      if ((cn = patch_string (op1)))
17366       {
17367         op1 = cn;
17368         op1_type = TREE_TYPE (op1);
17369       }
17370      if ((cn = patch_string (op2)))
17371       {
17372         op2 = cn;
17373         op2_type = TREE_TYPE (op2);
17374       }
17375
17376      /* 15.20.1 Numerical Equality Operators == and != */
17377      /* Binary numeric promotion is performed on the operands */
17378      if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))
17379	binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
17380
17381      /* 15.20.2 Boolean Equality Operators == and != */
17382      else if (TREE_CODE (op1_type) == BOOLEAN_TYPE &&
17383	  TREE_CODE (op2_type) == BOOLEAN_TYPE)
17384	;			/* Nothing to do here */
17385
17386      /* 15.20.3 Reference Equality Operators == and != */
17387      /* Types have to be either references or the null type. If
17388         they're references, it must be possible to convert either
17389         type to the other by casting conversion. */
17390      else if (op1 == null_pointer_node || op2 == null_pointer_node
17391	       || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type)
17392		   && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1)
17393		       || valid_ref_assignconv_cast_p (op2_type,
17394						       op1_type, 1))))
17395	;			/* Nothing to do here */
17396
17397      /* Else we have an error figure what can't be converted into
17398	 what and report the error */
17399      else
17400	{
17401	  char *t1;
17402	  t1 = xstrdup (lang_printable_name (op1_type, 0));
17403	  parse_error_context
17404	    (wfl_operator,
17405	     "Incompatible type for `%s'. Can't convert `%s' to `%s'",
17406	     operator_string (node), t1,
17407	     lang_printable_name (op2_type, 0));
17408	  free (t1);
17409	  TREE_TYPE (node) = boolean_type_node;
17410	  error_found = 1;
17411	  break;
17412	}
17413      prom_type = boolean_type_node;
17414      break;
17415    default:
17416      abort ();
17417    }
17418
17419  if (error_found)
17420    return error_mark_node;
17421
17422  TREE_OPERAND (node, 0) = op1;
17423  TREE_OPERAND (node, 1) = op2;
17424  TREE_TYPE (node) = prom_type;
17425  TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
17426
17427  if (flag_emit_xref)
17428    return node;
17429
17430  /* fold does not respect side-effect order as required for Java but not C.
17431   * Also, it sometimes create SAVE_EXPRs which are bad when emitting
17432   * bytecode.
17433   */
17434  if (flag_emit_class_files ? (TREE_CONSTANT (op1) && TREE_CONSTANT (op2))
17435      : ! TREE_SIDE_EFFECTS (node))
17436    node = fold (node);
17437  return node;
17438}
17439
17440/* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
17441   zero value, the value of CSTE comes after the valude of STRING */
17442
17443static tree
17444do_merge_string_cste (cste, string, string_len, after)
17445     tree cste;
17446     const char *string;
17447     int string_len, after;
17448{
17449  const char *old = TREE_STRING_POINTER (cste);
17450  int old_len = TREE_STRING_LENGTH (cste);
17451  int len = old_len + string_len;
17452  char *new = alloca (len+1);
17453
17454  if (after)
17455    {
17456      memcpy (new, string, string_len);
17457      memcpy (&new [string_len], old, old_len);
17458    }
17459  else
17460    {
17461      memcpy (new, old, old_len);
17462      memcpy (&new [old_len], string, string_len);
17463    }
17464  new [len] = '\0';
17465  return build_string (len, new);
17466}
17467
17468/* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
17469   new STRING_CST on success, NULL_TREE on failure.  */
17470
17471static tree
17472merge_string_cste (op1, op2, after)
17473     tree op1, op2;
17474     int after;
17475{
17476  /* Handle two string constants right away.  */
17477  if (TREE_CODE (op2) == STRING_CST)
17478    return do_merge_string_cste (op1, TREE_STRING_POINTER (op2),
17479				 TREE_STRING_LENGTH (op2), after);
17480
17481  /* Reasonable integer constant can be treated right away.  */
17482  if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2))
17483    {
17484      static const char *const boolean_true = "true";
17485      static const char *const boolean_false = "false";
17486      static const char *const null_pointer = "null";
17487      char ch[4];
17488      const char *string;
17489
17490      if (op2 == boolean_true_node)
17491	string = boolean_true;
17492      else if (op2 == boolean_false_node)
17493	string = boolean_false;
17494      else if (op2 == null_pointer_node)
17495	/* FIXME: null is not a compile-time constant, so it is only safe to
17496	   merge if the overall expression is non-constant. However, this
17497	   code always merges without checking the overall expression.  */
17498	string = null_pointer;
17499      else if (TREE_TYPE (op2) == char_type_node)
17500	{
17501	  /* Convert the character into UTF-8.	*/
17502	  unsigned int c = (unsigned int) TREE_INT_CST_LOW (op2);
17503	  unsigned char *p = (unsigned char *) ch;
17504	  if (0x01 <= c && c <= 0x7f)
17505	    *p++ = (unsigned char) c;
17506	  else if (c < 0x7ff)
17507	    {
17508	      *p++ = (unsigned char) (c >> 6 | 0xc0);
17509	      *p++ = (unsigned char) ((c & 0x3f) | 0x80);
17510	    }
17511	  else
17512	    {
17513	      *p++ = (unsigned char) (c >> 12 | 0xe0);
17514	      *p++ = (unsigned char) (((c >> 6) & 0x3f) | 0x80);
17515	      *p++ = (unsigned char) ((c & 0x3f) | 0x80);
17516	    }
17517	  *p = '\0';
17518
17519	  string = ch;
17520	}
17521      else
17522	string = string_convert_int_cst (op2);
17523
17524      return do_merge_string_cste (op1, string, strlen (string), after);
17525    }
17526  return NULL_TREE;
17527}
17528
17529/* Tries to statically concatenate OP1 and OP2 if possible. Either one
17530   has to be a STRING_CST and the other part must be a STRING_CST or a
17531   INTEGRAL constant. Return a new STRING_CST if the operation
17532   succeed, NULL_TREE otherwise.
17533
17534   If the case we want to optimize for space, we might want to return
17535   NULL_TREE for each invocation of this routine. FIXME */
17536
17537static tree
17538string_constant_concatenation (op1, op2)
17539     tree op1, op2;
17540{
17541  if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST))
17542    {
17543      tree string, rest;
17544      int invert;
17545
17546      string = (TREE_CODE (op1) == STRING_CST ? op1 : op2);
17547      rest   = (string == op1 ? op2 : op1);
17548      invert = (string == op1 ? 0 : 1 );
17549
17550      /* Walk REST, only if it looks reasonable */
17551      if (TREE_CODE (rest) != STRING_CST
17552	  && !IS_CRAFTED_STRING_BUFFER_P (rest)
17553	  && !JSTRING_TYPE_P (TREE_TYPE (rest))
17554	  && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION)
17555	{
17556	  rest = java_complete_tree (rest);
17557	  if (rest == error_mark_node)
17558	    return error_mark_node;
17559	  rest = fold (rest);
17560	}
17561      return merge_string_cste (string, rest, invert);
17562    }
17563  return NULL_TREE;
17564}
17565
17566/* Implement the `+' operator. Does static optimization if possible,
17567   otherwise create (if necessary) and append elements to a
17568   StringBuffer. The StringBuffer will be carried around until it is
17569   used for a function call or an assignment. Then toString() will be
17570   called on it to turn it into a String object. */
17571
17572static tree
17573build_string_concatenation (op1, op2)
17574     tree op1, op2;
17575{
17576  tree result;
17577  int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
17578
17579  if (flag_emit_xref)
17580    return build (PLUS_EXPR, string_type_node, op1, op2);
17581
17582  /* Try to do some static optimization */
17583  if ((result = string_constant_concatenation (op1, op2)))
17584    return result;
17585
17586  /* Discard empty strings on either side of the expression */
17587  if (TREE_CODE (op1) == STRING_CST && TREE_STRING_LENGTH (op1) == 0)
17588    {
17589      op1 = op2;
17590      op2 = NULL_TREE;
17591    }
17592  else if (TREE_CODE (op2) == STRING_CST && TREE_STRING_LENGTH (op2) == 0)
17593    op2 = NULL_TREE;
17594
17595  /* If operands are string constant, turn then into object references */
17596  if (TREE_CODE (op1) == STRING_CST)
17597    op1 = patch_string_cst (op1);
17598  if (op2 && TREE_CODE (op2) == STRING_CST)
17599    op2 = patch_string_cst (op2);
17600
17601  /* If either one of the constant is null and the other non null
17602     operand is a String constant, return it. */
17603  if ((TREE_CODE (op1) == STRING_CST) && !op2)
17604    return op1;
17605
17606  /* If OP1 isn't already a StringBuffer, create and
17607     initialize a new one */
17608  if (!IS_CRAFTED_STRING_BUFFER_P (op1))
17609    {
17610      /* Two solutions here:
17611	 1) OP1 is a constant string reference, we call new StringBuffer(OP1)
17612	 2) OP1 is something else, we call new StringBuffer().append(OP1).  */
17613      if (TREE_CONSTANT (op1) && JSTRING_TYPE_P (TREE_TYPE (op1)))
17614	op1 = BUILD_STRING_BUFFER (op1);
17615      else
17616	{
17617	  tree aNew = BUILD_STRING_BUFFER (NULL_TREE);
17618	  op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0);
17619	}
17620    }
17621
17622  if (op2)
17623    {
17624      /* OP1 is no longer the last node holding a crafted StringBuffer */
17625      IS_CRAFTED_STRING_BUFFER_P (op1) = 0;
17626      /* Create a node for `{new...,xxx}.append (op2)' */
17627      if (op2)
17628	op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0);
17629    }
17630
17631  /* Mark the last node holding a crafted StringBuffer */
17632  IS_CRAFTED_STRING_BUFFER_P (op1) = 1;
17633
17634  TREE_SIDE_EFFECTS (op1) = side_effects;
17635  return op1;
17636}
17637
17638/* Patch the string node NODE. NODE can be a STRING_CST of a crafted
17639   StringBuffer. If no string were found to be patched, return
17640   NULL. */
17641
17642static tree
17643patch_string (node)
17644    tree node;
17645{
17646  if (node == error_mark_node)
17647    return error_mark_node;
17648  if (TREE_CODE (node) == STRING_CST)
17649    return patch_string_cst (node);
17650  else if (IS_CRAFTED_STRING_BUFFER_P (node))
17651    {
17652      int saved = ctxp->explicit_constructor_p;
17653      tree invoke = build_method_invocation (wfl_to_string, NULL_TREE);
17654      tree ret;
17655      /* Temporary disable forbid the use of `this'. */
17656      ctxp->explicit_constructor_p = 0;
17657      ret = java_complete_tree (make_qualified_primary (node, invoke, 0));
17658      /* String concatenation arguments must be evaluated in order too. */
17659      ret = force_evaluation_order (ret);
17660      /* Restore it at its previous value */
17661      ctxp->explicit_constructor_p = saved;
17662      return ret;
17663    }
17664  return NULL_TREE;
17665}
17666
17667/* Build the internal representation of a string constant.  */
17668
17669static tree
17670patch_string_cst (node)
17671     tree node;
17672{
17673  int location;
17674  if (! flag_emit_class_files)
17675    {
17676      node = get_identifier (TREE_STRING_POINTER (node));
17677      location = alloc_name_constant (CONSTANT_String, node);
17678      node = build_ref_from_constant_pool (location);
17679    }
17680  TREE_TYPE (node) = string_ptr_type_node;
17681  TREE_CONSTANT (node) = 1;
17682  return node;
17683}
17684
17685/* Build an incomplete unary operator expression. */
17686
17687static tree
17688build_unaryop (op_token, op_location, op1)
17689     int op_token, op_location;
17690     tree op1;
17691{
17692  enum tree_code op;
17693  tree unaryop;
17694  switch (op_token)
17695    {
17696    case PLUS_TK: op = UNARY_PLUS_EXPR; break;
17697    case MINUS_TK: op = NEGATE_EXPR; break;
17698    case NEG_TK: op = TRUTH_NOT_EXPR; break;
17699    case NOT_TK: op = BIT_NOT_EXPR; break;
17700    default: abort ();
17701    }
17702
17703  unaryop = build1 (op, NULL_TREE, op1);
17704  TREE_SIDE_EFFECTS (unaryop) = 1;
17705  /* Store the location of the operator, for better error report. The
17706     string of the operator will be rebuild based on the OP value. */
17707  EXPR_WFL_LINECOL (unaryop) = op_location;
17708  return unaryop;
17709}
17710
17711/* Special case for the ++/-- operators, since they require an extra
17712   argument to build, which is set to NULL and patched
17713   later. IS_POST_P is 1 if the operator, 0 otherwise.  */
17714
17715static tree
17716build_incdec (op_token, op_location, op1, is_post_p)
17717     int op_token, op_location;
17718     tree op1;
17719     int is_post_p;
17720{
17721  static const enum tree_code lookup [2][2] =
17722    {
17723      { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
17724      { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
17725    };
17726  tree node = build (lookup [is_post_p][(op_token - DECR_TK)],
17727		     NULL_TREE, op1, NULL_TREE);
17728  TREE_SIDE_EFFECTS (node) = 1;
17729  /* Store the location of the operator, for better error report. The
17730     string of the operator will be rebuild based on the OP value. */
17731  EXPR_WFL_LINECOL (node) = op_location;
17732  return node;
17733}
17734
17735/* Build an incomplete cast operator, based on the use of the
17736   CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
17737   set. java_complete_tree is trained to walk a CONVERT_EXPR even
17738   though its type is already set.  */
17739
17740static tree
17741build_cast (location, type, exp)
17742     int location;
17743     tree type, exp;
17744{
17745  tree node = build1 (CONVERT_EXPR, type, exp);
17746  EXPR_WFL_LINECOL (node) = location;
17747  return node;
17748}
17749
17750/* Build an incomplete class reference operator.  */
17751static tree
17752build_incomplete_class_ref (location, class_name)
17753    int location;
17754    tree class_name;
17755{
17756  tree node = build1 (CLASS_LITERAL, NULL_TREE, class_name);
17757  EXPR_WFL_LINECOL (node) = location;
17758  return node;
17759}
17760
17761/* Complete an incomplete class reference operator.  */
17762static tree
17763patch_incomplete_class_ref (node)
17764    tree node;
17765{
17766  tree type = TREE_OPERAND (node, 0);
17767  tree ref_type;
17768
17769  if (!(ref_type = resolve_type_during_patch (type)))
17770    return error_mark_node;
17771
17772  if (!flag_emit_class_files || JPRIMITIVE_TYPE_P (ref_type)
17773      || TREE_CODE (ref_type) == VOID_TYPE)
17774    {
17775      tree dot = build_class_ref (ref_type);
17776      /* A class referenced by `foo.class' is initialized.  */
17777      if (!flag_emit_class_files)
17778       dot = build_class_init (ref_type, dot);
17779      return java_complete_tree (dot);
17780    }
17781
17782  /* If we're emitting class files and we have to deal with non
17783     primitive types, we invoke (and consider generating) the
17784     synthetic static method `class$'. */
17785  if (!TYPE_DOT_CLASS (current_class))
17786      build_dot_class_method (current_class);
17787  ref_type = build_dot_class_method_invocation (ref_type);
17788  return java_complete_tree (ref_type);
17789}
17790
17791/* 15.14 Unary operators. We return error_mark_node in case of error,
17792   but preserve the type of NODE if the type is fixed.  */
17793
17794static tree
17795patch_unaryop (node, wfl_op)
17796     tree node;
17797     tree wfl_op;
17798{
17799  tree op = TREE_OPERAND (node, 0);
17800  tree op_type = TREE_TYPE (op);
17801  tree prom_type = NULL_TREE, value, decl;
17802  int outer_field_flag = 0;
17803  int code = TREE_CODE (node);
17804  int error_found = 0;
17805
17806  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
17807
17808  switch (code)
17809    {
17810      /* 15.13.2 Postfix Increment Operator ++ */
17811    case POSTINCREMENT_EXPR:
17812      /* 15.13.3 Postfix Increment Operator -- */
17813    case POSTDECREMENT_EXPR:
17814      /* 15.14.1 Prefix Increment Operator ++ */
17815    case PREINCREMENT_EXPR:
17816      /* 15.14.2 Prefix Decrement Operator -- */
17817    case PREDECREMENT_EXPR:
17818      op = decl = strip_out_static_field_access_decl (op);
17819      outer_field_flag = outer_field_expanded_access_p (op, NULL, NULL, NULL);
17820      /* We might be trying to change an outer field accessed using
17821         access method. */
17822      if (outer_field_flag)
17823	{
17824	  /* Retrieve the decl of the field we're trying to access. We
17825             do that by first retrieving the function we would call to
17826             access the field. It has been already verified that this
17827             field isn't final */
17828	  if (flag_emit_class_files)
17829	    decl = TREE_OPERAND (op, 0);
17830	  else
17831	    decl = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (op, 0), 0), 0);
17832	  decl = DECL_FUNCTION_ACCESS_DECL (decl);
17833	}
17834      /* We really should have a JAVA_ARRAY_EXPR to avoid this */
17835      else if (!JDECL_P (decl)
17836	  && TREE_CODE (decl) != COMPONENT_REF
17837	  && !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF)
17838	  && TREE_CODE (decl) != INDIRECT_REF
17839	  && !(TREE_CODE (decl) == COMPOUND_EXPR
17840	       && TREE_OPERAND (decl, 1)
17841	       && (TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF)))
17842	{
17843	  TREE_TYPE (node) = error_mark_node;
17844	  error_found = 1;
17845	}
17846
17847      /* From now on, we know that op if a variable and that it has a
17848         valid wfl. We use wfl_op to locate errors related to the
17849         ++/-- operand. */
17850      if (!JNUMERIC_TYPE_P (op_type))
17851	{
17852	  parse_error_context
17853	    (wfl_op, "Invalid argument type `%s' to `%s'",
17854	     lang_printable_name (op_type, 0), operator_string (node));
17855	  TREE_TYPE (node) = error_mark_node;
17856	  error_found = 1;
17857	}
17858      else
17859	{
17860	  /* Before the addition, binary numeric promotion is performed on
17861	     both operands, if really necessary */
17862	  if (JINTEGRAL_TYPE_P (op_type))
17863	    {
17864	      value = build_int_2 (1, 0);
17865	      TREE_TYPE (value) = TREE_TYPE (node) = op_type;
17866	    }
17867	  else
17868	    {
17869	      value = build_int_2 (1, 0);
17870	      TREE_TYPE (node) =
17871		binary_numeric_promotion (op_type,
17872					  TREE_TYPE (value), &op, &value);
17873	    }
17874
17875	  /* We remember we might be accessing an outer field */
17876	  if (outer_field_flag)
17877	    {
17878	      /* We re-generate an access to the field */
17879	      value = build (PLUS_EXPR, TREE_TYPE (op),
17880			     build_outer_field_access (wfl_op, decl), value);
17881
17882	      /* And we patch the original access$() into a write
17883                 with plus_op as a rhs */
17884	      return outer_field_access_fix (node, op, value);
17885	    }
17886
17887	  /* And write back into the node. */
17888	  TREE_OPERAND (node, 0) = op;
17889	  TREE_OPERAND (node, 1) = value;
17890	  /* Convert the overall back into its original type, if
17891             necessary, and return */
17892	  if (JINTEGRAL_TYPE_P (op_type))
17893	    return fold (node);
17894	  else
17895	    return fold (convert (op_type, node));
17896	}
17897      break;
17898
17899      /* 15.14.3 Unary Plus Operator + */
17900    case UNARY_PLUS_EXPR:
17901      /* 15.14.4 Unary Minus Operator - */
17902    case NEGATE_EXPR:
17903      if (!JNUMERIC_TYPE_P (op_type))
17904	{
17905	  ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type);
17906	  TREE_TYPE (node) = error_mark_node;
17907	  error_found = 1;
17908	}
17909      /* Unary numeric promotion is performed on operand */
17910      else
17911	{
17912	  op = do_unary_numeric_promotion (op);
17913	  prom_type = TREE_TYPE (op);
17914	  if (code == UNARY_PLUS_EXPR)
17915	    return fold (op);
17916	}
17917      break;
17918
17919      /* 15.14.5 Bitwise Complement Operator ~ */
17920    case BIT_NOT_EXPR:
17921      if (!JINTEGRAL_TYPE_P (op_type))
17922	{
17923	  ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type);
17924	  TREE_TYPE (node) = error_mark_node;
17925	  error_found = 1;
17926	}
17927      else
17928	{
17929	  op = do_unary_numeric_promotion (op);
17930	  prom_type = TREE_TYPE (op);
17931	}
17932      break;
17933
17934      /* 15.14.6 Logical Complement Operator ! */
17935    case TRUTH_NOT_EXPR:
17936      if (TREE_CODE (op_type) != BOOLEAN_TYPE)
17937	{
17938	  ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type);
17939	  /* But the type is known. We will report an error if further
17940	     attempt of a assignment is made with this rhs */
17941	  TREE_TYPE (node) = boolean_type_node;
17942	  error_found = 1;
17943	}
17944      else
17945	prom_type = boolean_type_node;
17946      break;
17947
17948      /* 15.15 Cast Expression */
17949    case CONVERT_EXPR:
17950      value = patch_cast (node, wfl_operator);
17951      if (value == error_mark_node)
17952	{
17953	  /* If this cast is part of an assignment, we tell the code
17954	     that deals with it not to complain about a mismatch,
17955	     because things have been cast, anyways */
17956	  TREE_TYPE (node) = error_mark_node;
17957	  error_found = 1;
17958	}
17959      else
17960	{
17961	  value = fold (value);
17962	  TREE_SIDE_EFFECTS (value) = TREE_SIDE_EFFECTS (op);
17963	  return value;
17964	}
17965      break;
17966    }
17967
17968  if (error_found)
17969    return error_mark_node;
17970
17971  /* There are cases where node has been replaced by something else
17972     and we don't end up returning here: UNARY_PLUS_EXPR,
17973     CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
17974  TREE_OPERAND (node, 0) = fold (op);
17975  TREE_TYPE (node) = prom_type;
17976  TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op);
17977  return fold (node);
17978}
17979
17980/* Generic type resolution that sometimes takes place during node
17981   patching. Returned the resolved type or generate an error
17982   message. Return the resolved type or NULL_TREE.  */
17983
17984static tree
17985resolve_type_during_patch (type)
17986     tree type;
17987{
17988  if (unresolved_type_p (type, NULL))
17989    {
17990      tree type_decl = resolve_and_layout (EXPR_WFL_NODE (type), type);
17991      if (!type_decl)
17992	{
17993	  parse_error_context (type,
17994			       "Class `%s' not found in type declaration",
17995			       IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
17996	  return NULL_TREE;
17997	}
17998      return TREE_TYPE (type_decl);
17999    }
18000  return type;
18001}
18002/* 5.5 Casting Conversion. error_mark_node is returned if an error is
18003   found. Otherwise NODE or something meant to replace it is returned.  */
18004
18005static tree
18006patch_cast (node, wfl_op)
18007     tree node;
18008     tree wfl_op;
18009{
18010  tree op = TREE_OPERAND (node, 0);
18011  tree cast_type = TREE_TYPE (node);
18012  tree patched, op_type;
18013  char *t1;
18014
18015  /* Some string patching might be necessary at this stage */
18016  if ((patched = patch_string (op)))
18017    TREE_OPERAND (node, 0) = op = patched;
18018  op_type = TREE_TYPE (op);
18019
18020  /* First resolve OP_TYPE if unresolved */
18021  if (!(cast_type = resolve_type_during_patch (cast_type)))
18022    return error_mark_node;
18023
18024  /* Check on cast that are proven correct at compile time */
18025  if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
18026    {
18027      /* Same type */
18028      if (cast_type == op_type)
18029	return node;
18030
18031      /* float and double type are converted to the original type main
18032	 variant and then to the target type. */
18033      if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE)
18034	op = convert (integer_type_node, op);
18035
18036      /* Try widening/narowwing convertion. Potentially, things need
18037	 to be worked out in gcc so we implement the extreme cases
18038	 correctly. fold_convert() needs to be fixed. */
18039      return convert (cast_type, op);
18040    }
18041
18042  /* It's also valid to cast a boolean into a boolean */
18043  if (op_type == boolean_type_node && cast_type == boolean_type_node)
18044    return node;
18045
18046  /* null can be casted to references */
18047  if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type))
18048    return build_null_of_type (cast_type);
18049
18050  /* The remaining legal casts involve conversion between reference
18051     types. Check for their compile time correctness. */
18052  if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type)
18053      && valid_ref_assignconv_cast_p (op_type, cast_type, 1))
18054    {
18055      TREE_TYPE (node) = promote_type (cast_type);
18056      /* Now, the case can be determined correct at compile time if
18057         OP_TYPE can be converted into CAST_TYPE by assignment
18058         conversion (5.2) */
18059
18060      if (valid_ref_assignconv_cast_p (op_type, cast_type, 0))
18061	{
18062	  TREE_SET_CODE (node, NOP_EXPR);
18063	  return node;
18064	}
18065
18066      if (flag_emit_class_files)
18067	{
18068	  TREE_SET_CODE (node, CONVERT_EXPR);
18069	  return node;
18070	}
18071
18072      /* The cast requires a run-time check */
18073      return build (CALL_EXPR, promote_type (cast_type),
18074		    build_address_of (soft_checkcast_node),
18075		    tree_cons (NULL_TREE, build_class_ref (cast_type),
18076			       build_tree_list (NULL_TREE, op)),
18077		    NULL_TREE);
18078    }
18079
18080  /* Any other casts are proven incorrect at compile time */
18081  t1 = xstrdup (lang_printable_name (op_type, 0));
18082  parse_error_context (wfl_op, "Invalid cast from `%s' to `%s'",
18083		       t1, lang_printable_name (cast_type, 0));
18084  free (t1);
18085  return error_mark_node;
18086}
18087
18088/* Build a null constant and give it the type TYPE.  */
18089
18090static tree
18091build_null_of_type (type)
18092     tree type;
18093{
18094  tree node = build_int_2 (0, 0);
18095  TREE_TYPE (node) = promote_type (type);
18096  return node;
18097}
18098
18099/* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
18100   a list of indices. */
18101static tree
18102build_array_ref (location, array, index)
18103     int location;
18104     tree array, index;
18105{
18106  tree node = build (ARRAY_REF, NULL_TREE, array, index);
18107  EXPR_WFL_LINECOL (node) = location;
18108  return node;
18109}
18110
18111/* 15.12 Array Access Expression */
18112
18113static tree
18114patch_array_ref (node)
18115     tree node;
18116{
18117  tree array = TREE_OPERAND (node, 0);
18118  tree array_type  = TREE_TYPE (array);
18119  tree index = TREE_OPERAND (node, 1);
18120  tree index_type = TREE_TYPE (index);
18121  int error_found = 0;
18122
18123  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
18124
18125  if (TREE_CODE (array_type) == POINTER_TYPE)
18126    array_type = TREE_TYPE (array_type);
18127
18128  /* The array reference must be an array */
18129  if (!TYPE_ARRAY_P (array_type))
18130    {
18131      parse_error_context
18132	(wfl_operator,
18133	 "`[]' can only be applied to arrays. It can't be applied to `%s'",
18134	 lang_printable_name (array_type, 0));
18135      TREE_TYPE (node) = error_mark_node;
18136      error_found = 1;
18137    }
18138
18139  /* The array index undergoes unary numeric promotion. The promoted
18140     type must be int */
18141  index = do_unary_numeric_promotion (index);
18142  if (TREE_TYPE (index) != int_type_node)
18143    {
18144      if (valid_cast_to_p (index_type, int_type_node))
18145	parse_error_context (wfl_operator,
18146   "Incompatible type for `[]'. Explicit cast needed to convert `%s' to `int'",
18147			     lang_printable_name (index_type, 0));
18148      else
18149	parse_error_context (wfl_operator,
18150          "Incompatible type for `[]'. Can't convert `%s' to `int'",
18151			     lang_printable_name (index_type, 0));
18152      TREE_TYPE (node) = error_mark_node;
18153      error_found = 1;
18154    }
18155
18156  if (error_found)
18157    return error_mark_node;
18158
18159  array_type = TYPE_ARRAY_ELEMENT (array_type);
18160
18161  if (flag_emit_class_files || flag_emit_xref)
18162    {
18163      TREE_OPERAND (node, 0) = array;
18164      TREE_OPERAND (node, 1) = index;
18165    }
18166  else
18167    node = build_java_arrayaccess (array, array_type, index);
18168  TREE_TYPE (node) = array_type;
18169  return node;
18170}
18171
18172/* 15.9 Array Creation Expressions */
18173
18174static tree
18175build_newarray_node (type, dims, extra_dims)
18176     tree type;
18177     tree dims;
18178     int extra_dims;
18179{
18180  tree node =
18181    build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims),
18182	   build_int_2 (extra_dims, 0));
18183  return node;
18184}
18185
18186static tree
18187patch_newarray (node)
18188     tree node;
18189{
18190  tree type = TREE_OPERAND (node, 0);
18191  tree dims = TREE_OPERAND (node, 1);
18192  tree cdim, array_type;
18193  int error_found = 0;
18194  int ndims = 0;
18195  int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2));
18196
18197  /* Dimension types are verified. It's better for the types to be
18198     verified in order. */
18199  for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ )
18200    {
18201      int dim_error = 0;
18202      tree dim = TREE_VALUE (cdim);
18203
18204      /* Dim might have been saved during its evaluation */
18205      dim = (TREE_CODE (dim) == SAVE_EXPR ? TREE_OPERAND (dim, 0) : dim);
18206
18207      /* The type of each specified dimension must be an integral type. */
18208      if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim)))
18209	dim_error = 1;
18210
18211      /* Each expression undergoes an unary numeric promotion (5.6.1) and the
18212	 promoted type must be int. */
18213      else
18214	{
18215	  dim = do_unary_numeric_promotion (dim);
18216	  if (TREE_TYPE (dim) != int_type_node)
18217	    dim_error = 1;
18218	}
18219
18220      /* Report errors on types here */
18221      if (dim_error)
18222	{
18223	  parse_error_context
18224	    (TREE_PURPOSE (cdim),
18225	     "Incompatible type for dimension in array creation expression. %s convert `%s' to `int'",
18226	     (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ?
18227	      "Explicit cast needed to" : "Can't"),
18228	     lang_printable_name (TREE_TYPE (dim), 0));
18229	  error_found = 1;
18230	}
18231
18232      TREE_PURPOSE (cdim) = NULL_TREE;
18233    }
18234
18235  /* Resolve array base type if unresolved */
18236  if (!(type = resolve_type_during_patch (type)))
18237    error_found = 1;
18238
18239  if (error_found)
18240    {
18241      /* We don't want further evaluation of this bogus array creation
18242         operation */
18243      TREE_TYPE (node) = error_mark_node;
18244      return error_mark_node;
18245    }
18246
18247  /* Set array_type to the actual (promoted) array type of the result. */
18248  if (TREE_CODE (type) == RECORD_TYPE)
18249    type = build_pointer_type (type);
18250  while (--xdims >= 0)
18251    {
18252      type = promote_type (build_java_array_type (type, -1));
18253    }
18254  dims = nreverse (dims);
18255  array_type = type;
18256  for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim))
18257    {
18258      type = array_type;
18259      array_type
18260	= build_java_array_type (type,
18261				 TREE_CODE (cdim) == INTEGER_CST
18262				 ? (HOST_WIDE_INT) TREE_INT_CST_LOW (cdim)
18263				 : -1);
18264      array_type = promote_type (array_type);
18265    }
18266  dims = nreverse (dims);
18267
18268  /* The node is transformed into a function call. Things are done
18269     differently according to the number of dimensions. If the number
18270     of dimension is equal to 1, then the nature of the base type
18271     (primitive or not) matters. */
18272  if (ndims == 1)
18273    return build_new_array (type, TREE_VALUE (dims));
18274
18275  /* Can't reuse what's already written in expr.c because it uses the
18276     JVM stack representation. Provide a build_multianewarray. FIXME */
18277  return build (CALL_EXPR, array_type,
18278		build_address_of (soft_multianewarray_node),
18279		tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)),
18280			   tree_cons (NULL_TREE,
18281				      build_int_2 (ndims, 0), dims )),
18282		NULL_TREE);
18283}
18284
18285/* 10.6 Array initializer.  */
18286
18287/* Build a wfl for array element that don't have one, so we can
18288   pin-point errors.  */
18289
18290static tree
18291maybe_build_array_element_wfl (node)
18292     tree node;
18293{
18294  if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION)
18295    return build_expr_wfl (NULL_TREE, ctxp->filename,
18296			   ctxp->elc.line, ctxp->elc.prev_col);
18297  else
18298    return NULL_TREE;
18299}
18300
18301/* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
18302   identification of initialized arrays easier to detect during walk
18303   and expansion.  */
18304
18305static tree
18306build_new_array_init (location, values)
18307     int location;
18308     tree values;
18309{
18310  tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values);
18311  tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor);
18312  EXPR_WFL_LINECOL (to_return) = location;
18313  return to_return;
18314}
18315
18316/* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
18317   occurred.  Otherwise return NODE after having set its type
18318   appropriately.  */
18319
18320static tree
18321patch_new_array_init (type, node)
18322     tree type, node;
18323{
18324  int error_seen = 0;
18325  tree current, element_type;
18326  HOST_WIDE_INT length;
18327  int all_constant = 1;
18328  tree init = TREE_OPERAND (node, 0);
18329
18330  if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type)))
18331    {
18332      parse_error_context (node,
18333			   "Invalid array initializer for non-array type `%s'",
18334			   lang_printable_name (type, 1));
18335      return error_mark_node;
18336    }
18337  type = TREE_TYPE (type);
18338  element_type = TYPE_ARRAY_ELEMENT (type);
18339
18340  CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init));
18341
18342  for (length = 0, current = CONSTRUCTOR_ELTS (init);
18343       current;  length++, current = TREE_CHAIN (current))
18344    {
18345      tree elt = TREE_VALUE (current);
18346      if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT)
18347	{
18348	  error_seen |= array_constructor_check_entry (element_type, current);
18349	  elt = TREE_VALUE (current);
18350	  /* When compiling to native code, STRING_CST is converted to
18351	     INDIRECT_REF, but still with a TREE_CONSTANT flag. */
18352	  if (! TREE_CONSTANT (elt) || TREE_CODE (elt) == INDIRECT_REF)
18353	    all_constant = 0;
18354	}
18355      else
18356	{
18357	  TREE_VALUE (current) = patch_new_array_init (element_type, elt);
18358	  TREE_PURPOSE (current) = NULL_TREE;
18359	  all_constant = 0;
18360	}
18361      if (elt && TREE_CODE (elt) == TREE_LIST
18362	  && TREE_VALUE (elt) == error_mark_node)
18363	error_seen = 1;
18364    }
18365
18366  if (error_seen)
18367    return error_mark_node;
18368
18369  /* Create a new type. We can't reuse the one we have here by
18370     patching its dimension because it originally is of dimension -1
18371     hence reused by gcc. This would prevent triangular arrays. */
18372  type = build_java_array_type (element_type, length);
18373  TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type))));
18374  TREE_TYPE (node) = promote_type (type);
18375  TREE_CONSTANT (init) = all_constant;
18376  TREE_CONSTANT (node) = all_constant;
18377  return node;
18378}
18379
18380/* Verify that one entry of the initializer element list can be
18381   assigned to the array base type. Report 1 if an error occurred, 0
18382   otherwise.  */
18383
18384static int
18385array_constructor_check_entry (type, entry)
18386     tree type, entry;
18387{
18388  char *array_type_string = NULL;	/* For error reports */
18389  tree value, type_value, new_value, wfl_value, patched;
18390  int error_seen = 0;
18391
18392  new_value = NULL_TREE;
18393  wfl_value = TREE_VALUE (entry);
18394
18395  value = java_complete_tree (TREE_VALUE (entry));
18396  /* patch_string return error_mark_node if arg is error_mark_node */
18397  if ((patched = patch_string (value)))
18398    value = patched;
18399  if (value == error_mark_node)
18400    return 1;
18401
18402  type_value = TREE_TYPE (value);
18403
18404  /* At anytime, try_builtin_assignconv can report a warning on
18405     constant overflow during narrowing. */
18406  SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value);
18407  new_value = try_builtin_assignconv (wfl_operator, type, value);
18408  if (!new_value && (new_value = try_reference_assignconv (type, value)))
18409    type_value = promote_type (type);
18410
18411  /* Check and report errors */
18412  if (!new_value)
18413    {
18414      const char *const msg = (!valid_cast_to_p (type_value, type) ?
18415		   "Can't" : "Explicit cast needed to");
18416      if (!array_type_string)
18417	array_type_string = xstrdup (lang_printable_name (type, 1));
18418      parse_error_context
18419	(wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
18420	 msg, lang_printable_name (type_value, 1), array_type_string);
18421      error_seen = 1;
18422    }
18423
18424  if (new_value)
18425    TREE_VALUE (entry) = new_value;
18426
18427  if (array_type_string)
18428    free (array_type_string);
18429
18430  TREE_PURPOSE (entry) = NULL_TREE;
18431  return error_seen;
18432}
18433
18434static tree
18435build_this (location)
18436     int location;
18437{
18438  tree node = build_wfl_node (this_identifier_node);
18439  TREE_SET_CODE (node, THIS_EXPR);
18440  EXPR_WFL_LINECOL (node) = location;
18441  return node;
18442}
18443
18444/* 14.15 The return statement. It builds a modify expression that
18445   assigns the returned value to the RESULT_DECL that hold the value
18446   to be returned. */
18447
18448static tree
18449build_return (location, op)
18450     int location;
18451     tree op;
18452{
18453  tree node = build1 (RETURN_EXPR, NULL_TREE, op);
18454  EXPR_WFL_LINECOL (node) = location;
18455  node = build_debugable_stmt (location, node);
18456  return node;
18457}
18458
18459static tree
18460patch_return (node)
18461     tree node;
18462{
18463  tree return_exp = TREE_OPERAND (node, 0);
18464  tree meth = current_function_decl;
18465  tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl));
18466  int error_found = 0;
18467
18468  TREE_TYPE (node) = error_mark_node;
18469  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
18470
18471  /* It's invalid to have a return value within a function that is
18472     declared with the keyword void or that is a constructor */
18473  if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth)))
18474    error_found = 1;
18475
18476  /* It's invalid to use a return statement in a static block */
18477  if (DECL_CLINIT_P (current_function_decl))
18478    error_found = 1;
18479
18480  /* It's invalid to have a no return value within a function that
18481     isn't declared with the keyword `void' */
18482  if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth)))
18483    error_found = 2;
18484
18485  if (DECL_INSTINIT_P (current_function_decl))
18486    error_found = 1;
18487
18488  if (error_found)
18489    {
18490      if (DECL_INSTINIT_P (current_function_decl))
18491	parse_error_context (wfl_operator,
18492			     "`return' inside instance initializer");
18493
18494      else if (DECL_CLINIT_P (current_function_decl))
18495	parse_error_context (wfl_operator,
18496			     "`return' inside static initializer");
18497
18498      else if (!DECL_CONSTRUCTOR_P (meth))
18499	{
18500	  char *t = xstrdup (lang_printable_name (mtype, 0));
18501	  parse_error_context (wfl_operator,
18502			       "`return' with%s value from `%s %s'",
18503			       (error_found == 1 ? "" : "out"),
18504			       t, lang_printable_name (meth, 0));
18505	  free (t);
18506	}
18507      else
18508	parse_error_context (wfl_operator,
18509			     "`return' with value from constructor `%s'",
18510			     lang_printable_name (meth, 0));
18511      return error_mark_node;
18512    }
18513
18514  /* If we have a return_exp, build a modify expression and expand
18515     it. Note: at that point, the assignment is declared valid, but we
18516     may want to carry some more hacks */
18517  if (return_exp)
18518    {
18519      tree exp = java_complete_tree (return_exp);
18520      tree modify, patched;
18521
18522      if ((patched = patch_string (exp)))
18523	exp = patched;
18524
18525      modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp);
18526      EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node);
18527      modify = java_complete_tree (modify);
18528
18529      if (modify != error_mark_node)
18530	{
18531	  TREE_SIDE_EFFECTS (modify) = 1;
18532	  TREE_OPERAND (node, 0) = modify;
18533	}
18534      else
18535	return error_mark_node;
18536    }
18537  TREE_TYPE (node) = void_type_node;
18538  TREE_SIDE_EFFECTS (node) = 1;
18539  return node;
18540}
18541
18542/* 14.8 The if Statement */
18543
18544static tree
18545build_if_else_statement (location, expression, if_body, else_body)
18546     int location;
18547     tree expression, if_body, else_body;
18548{
18549  tree node;
18550  if (!else_body)
18551    else_body = empty_stmt_node;
18552  node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body);
18553  EXPR_WFL_LINECOL (node) = location;
18554  node = build_debugable_stmt (location, node);
18555  return node;
18556}
18557
18558static tree
18559patch_if_else_statement (node)
18560     tree node;
18561{
18562  tree expression = TREE_OPERAND (node, 0);
18563  int can_complete_normally
18564    = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
18565       | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2)));
18566
18567  TREE_TYPE (node) = error_mark_node;
18568  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
18569
18570  /* The type of expression must be boolean */
18571  if (TREE_TYPE (expression) != boolean_type_node
18572      && TREE_TYPE (expression) != promoted_boolean_type_node)
18573    {
18574      parse_error_context
18575	(wfl_operator,
18576	 "Incompatible type for `if'. Can't convert `%s' to `boolean'",
18577	 lang_printable_name (TREE_TYPE (expression), 0));
18578      return error_mark_node;
18579    }
18580
18581  if (TREE_CODE (expression) == INTEGER_CST)
18582    {
18583      if (integer_zerop (expression))
18584	node = TREE_OPERAND (node, 2);
18585      else
18586	node = TREE_OPERAND (node, 1);
18587      if (CAN_COMPLETE_NORMALLY (node) != can_complete_normally)
18588	{
18589	  node = build (COMPOUND_EXPR, void_type_node, node, empty_stmt_node);
18590	  CAN_COMPLETE_NORMALLY (node) = can_complete_normally;
18591	}
18592      return node;
18593    }
18594  TREE_TYPE (node) = void_type_node;
18595  TREE_SIDE_EFFECTS (node) = 1;
18596  CAN_COMPLETE_NORMALLY (node) = can_complete_normally;
18597  return node;
18598}
18599
18600/* 14.6 Labeled Statements */
18601
18602/* Action taken when a lableled statement is parsed. a new
18603   LABELED_BLOCK_EXPR is created. No statement is attached to the
18604   label, yet.  LABEL can be NULL_TREE for artificially-generated blocks. */
18605
18606static tree
18607build_labeled_block (location, label)
18608     int location;
18609     tree label;
18610{
18611  tree label_name ;
18612  tree label_decl, node;
18613  if (label == NULL_TREE || label == continue_identifier_node)
18614    label_name = label;
18615  else
18616    {
18617      label_name = merge_qualified_name (label_id, label);
18618      /* Issue an error if we try to reuse a label that was previously
18619	 declared */
18620      if (IDENTIFIER_LOCAL_VALUE (label_name))
18621	{
18622	  EXPR_WFL_LINECOL (wfl_operator) = location;
18623	  parse_error_context (wfl_operator,
18624            "Declaration of `%s' shadows a previous label declaration",
18625			       IDENTIFIER_POINTER (label));
18626	  EXPR_WFL_LINECOL (wfl_operator) =
18627	    EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
18628	  parse_error_context (wfl_operator,
18629            "This is the location of the previous declaration of label `%s'",
18630			       IDENTIFIER_POINTER (label));
18631	  java_error_count--;
18632	}
18633    }
18634
18635  label_decl = create_label_decl (label_name);
18636  node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE);
18637  EXPR_WFL_LINECOL (node) = location;
18638  TREE_SIDE_EFFECTS (node) = 1;
18639  return node;
18640}
18641
18642/* A labeled statement LBE is attached a statement.  */
18643
18644static tree
18645finish_labeled_statement (lbe, statement)
18646     tree lbe;			/* Labeled block expr */
18647     tree statement;
18648{
18649  /* In anyways, tie the loop to its statement */
18650  LABELED_BLOCK_BODY (lbe) = statement;
18651  pop_labeled_block ();
18652  POP_LABELED_BLOCK ();
18653  return lbe;
18654}
18655
18656/* 14.10, 14.11, 14.12 Loop Statements */
18657
18658/* Create an empty LOOP_EXPR and make it the last in the nested loop
18659   list. */
18660
18661static tree
18662build_new_loop (loop_body)
18663     tree loop_body;
18664{
18665  tree loop =  build (LOOP_EXPR, NULL_TREE, loop_body);
18666  TREE_SIDE_EFFECTS (loop) = 1;
18667  PUSH_LOOP (loop);
18668  return loop;
18669}
18670
18671/* Create a loop body according to the following structure:
18672     COMPOUND_EXPR
18673       COMPOUND_EXPR		(loop main body)
18674         EXIT_EXPR		(this order is for while/for loops.
18675         LABELED_BLOCK_EXPR      the order is reversed for do loops)
18676           LABEL_DECL           (a continue occurring here branches at the
18677           BODY			 end of this labeled block)
18678       INCREMENT		(if any)
18679
18680  REVERSED, if nonzero, tells that the loop condition expr comes
18681  after the body, like in the do-while loop.
18682
18683  To obtain a loop, the loop body structure described above is
18684  encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
18685
18686   LABELED_BLOCK_EXPR
18687     LABEL_DECL                   (use this label to exit the loop)
18688     LOOP_EXPR
18689       <structure described above> */
18690
18691static tree
18692build_loop_body (location, condition, reversed)
18693     int location;
18694     tree condition;
18695     int reversed;
18696{
18697  tree first, second, body;
18698
18699  condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */
18700  EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */
18701  condition = build_debugable_stmt (location, condition);
18702  TREE_SIDE_EFFECTS (condition) = 1;
18703
18704  body = build_labeled_block (0, continue_identifier_node);
18705  first = (reversed ? body : condition);
18706  second = (reversed ? condition : body);
18707  return
18708    build (COMPOUND_EXPR, NULL_TREE,
18709	   build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node);
18710}
18711
18712/* Install CONDITION (if any) and loop BODY (using REVERSED to tell
18713   their order) on the current loop. Unlink the current loop from the
18714   loop list.  */
18715
18716static tree
18717finish_loop_body (location, condition, body, reversed)
18718     int location;
18719     tree condition, body;
18720     int reversed;
18721{
18722  tree to_return = ctxp->current_loop;
18723  tree loop_body = LOOP_EXPR_BODY (to_return);
18724  if (condition)
18725    {
18726      tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed);
18727      /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
18728         The real EXIT_EXPR is one operand further. */
18729      EXPR_WFL_LINECOL (cnode) = location;
18730      /* This one is for accurate error reports */
18731      EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location;
18732      TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition;
18733    }
18734  LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body;
18735  POP_LOOP ();
18736  return to_return;
18737}
18738
18739/* Tailored version of finish_loop_body for FOR loops, when FOR
18740   loops feature the condition part */
18741
18742static tree
18743finish_for_loop (location, condition, update, body)
18744    int location;
18745    tree condition, update, body;
18746{
18747  /* Put the condition and the loop body in place */
18748  tree loop = finish_loop_body (location, condition, body, 0);
18749  /* LOOP is the current loop which has been now popped of the loop
18750     stack.  Mark the update block as reachable and install it.  We do
18751     this because the (current interpretation of the) JLS requires
18752     that the update expression be considered reachable even if the
18753     for loop's body doesn't complete normally.  */
18754  if (update != NULL_TREE && update != empty_stmt_node)
18755    {
18756      tree up2 = update;
18757      if (TREE_CODE (up2) == EXPR_WITH_FILE_LOCATION)
18758	up2 = EXPR_WFL_NODE (up2);
18759      /* It is possible for the update expression to be an
18760	 EXPR_WFL_NODE wrapping nothing.  */
18761      if (up2 != NULL_TREE && up2 != empty_stmt_node)
18762	{
18763	  /* Try to detect constraint violations.  These would be
18764	     programming errors somewhere.  */
18765	  if (! IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (up2)))
18766	      || TREE_CODE (up2) == LOOP_EXPR)
18767	    abort ();
18768	  SUPPRESS_UNREACHABLE_ERROR (up2) = 1;
18769	}
18770    }
18771  LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
18772  return loop;
18773}
18774
18775/* Try to find the loop a block might be related to. This comprises
18776   the case where the LOOP_EXPR is found as the second operand of a
18777   COMPOUND_EXPR, because the loop happens to have an initialization
18778   part, then expressed as the first operand of the COMPOUND_EXPR. If
18779   the search finds something, 1 is returned. Otherwise, 0 is
18780   returned. The search is assumed to start from a
18781   LABELED_BLOCK_EXPR's block.  */
18782
18783static tree
18784search_loop (statement)
18785    tree statement;
18786{
18787  if (TREE_CODE (statement) == LOOP_EXPR)
18788    return statement;
18789
18790  if (TREE_CODE (statement) == BLOCK)
18791    statement = BLOCK_SUBBLOCKS (statement);
18792  else
18793    return NULL_TREE;
18794
18795  if (statement && TREE_CODE (statement) == COMPOUND_EXPR)
18796    while (statement && TREE_CODE (statement) == COMPOUND_EXPR)
18797      statement = TREE_OPERAND (statement, 1);
18798
18799  return (TREE_CODE (statement) == LOOP_EXPR
18800	  && FOR_LOOP_P (statement) ? statement : NULL_TREE);
18801}
18802
18803/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
18804   returned otherwise.  */
18805
18806static int
18807labeled_block_contains_loop_p (block, loop)
18808    tree block, loop;
18809{
18810  if (!block)
18811    return 0;
18812
18813  if (LABELED_BLOCK_BODY (block) == loop)
18814    return 1;
18815
18816  if (FOR_LOOP_P (loop) && search_loop (LABELED_BLOCK_BODY (block)) == loop)
18817    return 1;
18818
18819  return 0;
18820}
18821
18822/* If the loop isn't surrounded by a labeled statement, create one and
18823   insert LOOP as its body.  */
18824
18825static tree
18826patch_loop_statement (loop)
18827     tree loop;
18828{
18829  tree loop_label;
18830
18831  TREE_TYPE (loop) = void_type_node;
18832  if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop))
18833    return loop;
18834
18835  loop_label = build_labeled_block (0, NULL_TREE);
18836  /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
18837     that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
18838  LABELED_BLOCK_BODY (loop_label) = loop;
18839  PUSH_LABELED_BLOCK (loop_label);
18840  return loop_label;
18841}
18842
18843/* 14.13, 14.14: break and continue Statements */
18844
18845/* Build a break or a continue statement. a null NAME indicates an
18846   unlabeled break/continue statement.  */
18847
18848static tree
18849build_bc_statement (location, is_break, name)
18850     int location, is_break;
18851     tree name;
18852{
18853  tree break_continue, label_block_expr = NULL_TREE;
18854
18855  if (name)
18856    {
18857      if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE
18858	    (merge_qualified_name (label_id, EXPR_WFL_NODE (name)))))
18859	/* Null means that we don't have a target for this named
18860	   break/continue. In this case, we make the target to be the
18861	   label name, so that the error can be reported accuratly in
18862	   patch_bc_statement. */
18863	label_block_expr = EXPR_WFL_NODE (name);
18864    }
18865  /* Unlabeled break/continue will be handled during the
18866     break/continue patch operation */
18867  break_continue
18868    = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE);
18869
18870  IS_BREAK_STMT_P (break_continue) = is_break;
18871  TREE_SIDE_EFFECTS (break_continue) = 1;
18872  EXPR_WFL_LINECOL (break_continue) = location;
18873  break_continue = build_debugable_stmt (location, break_continue);
18874  return break_continue;
18875}
18876
18877/* Verification of a break/continue statement. */
18878
18879static tree
18880patch_bc_statement (node)
18881     tree node;
18882{
18883  tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt;
18884  tree labeled_block = ctxp->current_labeled_block;
18885  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
18886
18887  /* Having an identifier here means that the target is unknown. */
18888  if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE)
18889    {
18890      parse_error_context (wfl_operator, "No label definition found for `%s'",
18891			   IDENTIFIER_POINTER (bc_label));
18892      return error_mark_node;
18893    }
18894  if (! IS_BREAK_STMT_P (node))
18895    {
18896      /* It's a continue statement. */
18897      for (;; labeled_block = TREE_CHAIN (labeled_block))
18898	{
18899	  if (labeled_block == NULL_TREE)
18900	    {
18901	      if (bc_label == NULL_TREE)
18902		parse_error_context (wfl_operator,
18903				     "`continue' must be in loop");
18904	      else
18905		parse_error_context
18906		  (wfl_operator, "continue label `%s' does not name a loop",
18907		   IDENTIFIER_POINTER (bc_label));
18908	      return error_mark_node;
18909	    }
18910	  if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block))
18911	       == continue_identifier_node)
18912	      && (bc_label == NULL_TREE
18913		  || TREE_CHAIN (labeled_block) == bc_label))
18914	    {
18915	      bc_label = labeled_block;
18916	      break;
18917	    }
18918	}
18919    }
18920  else if (!bc_label)
18921    {
18922      for (;; labeled_block = TREE_CHAIN (labeled_block))
18923	{
18924	  if (labeled_block == NULL_TREE)
18925	    {
18926	      parse_error_context (wfl_operator,
18927				     "`break' must be in loop or switch");
18928	      return error_mark_node;
18929	    }
18930	  target_stmt = LABELED_BLOCK_BODY (labeled_block);
18931	  if (TREE_CODE (target_stmt) == SWITCH_EXPR
18932	      || search_loop (target_stmt))
18933	    {
18934	      bc_label = labeled_block;
18935	      break;
18936	    }
18937	}
18938    }
18939
18940  EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
18941  CAN_COMPLETE_NORMALLY (bc_label) = 1;
18942
18943  /* Our break/continue don't return values. */
18944  TREE_TYPE (node) = void_type_node;
18945  /* Encapsulate the break within a compound statement so that it's
18946     expanded all the times by expand_expr (and not clobbered
18947     sometimes, like after a if statement) */
18948  node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
18949  TREE_SIDE_EFFECTS (node) = 1;
18950  return node;
18951}
18952
18953/* Process the exit expression belonging to a loop. Its type must be
18954   boolean.  */
18955
18956static tree
18957patch_exit_expr (node)
18958     tree node;
18959{
18960  tree expression = TREE_OPERAND (node, 0);
18961  TREE_TYPE (node) = error_mark_node;
18962  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
18963
18964  /* The type of expression must be boolean */
18965  if (TREE_TYPE (expression) != boolean_type_node)
18966    {
18967      parse_error_context
18968	(wfl_operator,
18969    "Incompatible type for loop conditional. Can't convert `%s' to `boolean'",
18970	 lang_printable_name (TREE_TYPE (expression), 0));
18971      return error_mark_node;
18972    }
18973  /* Now we know things are allright, invert the condition, fold and
18974     return */
18975  TREE_OPERAND (node, 0) =
18976    fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression));
18977
18978  if (! integer_zerop (TREE_OPERAND (node, 0))
18979      && ctxp->current_loop != NULL_TREE
18980      && TREE_CODE (ctxp->current_loop) == LOOP_EXPR)
18981    CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1;
18982  if (! integer_onep (TREE_OPERAND (node, 0)))
18983    CAN_COMPLETE_NORMALLY (node) = 1;
18984
18985
18986  TREE_TYPE (node) = void_type_node;
18987  return node;
18988}
18989
18990/* 14.9 Switch statement */
18991
18992static tree
18993patch_switch_statement (node)
18994     tree node;
18995{
18996  tree se = TREE_OPERAND (node, 0), se_type;
18997  tree save, iter;
18998
18999  /* Complete the switch expression */
19000  se = TREE_OPERAND (node, 0) = java_complete_tree (se);
19001  se_type = TREE_TYPE (se);
19002  /* The type of the switch expression must be char, byte, short or
19003     int */
19004  if (! JINTEGRAL_TYPE_P (se_type) || se_type == long_type_node)
19005    {
19006      EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
19007      parse_error_context (wfl_operator,
19008	  "Incompatible type for `switch'. Can't convert `%s' to `int'",
19009			   lang_printable_name (se_type, 0));
19010      /* This is what java_complete_tree will check */
19011      TREE_OPERAND (node, 0) = error_mark_node;
19012      return error_mark_node;
19013    }
19014
19015  /* Save and restore the outer case label list.  */
19016  save = case_label_list;
19017  case_label_list = NULL_TREE;
19018
19019  TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
19020
19021  /* See if we've found a duplicate label.  We can't leave this until
19022     code generation, because in `--syntax-only' and `-C' modes we
19023     don't do ordinary code generation.  */
19024  for (iter = case_label_list; iter != NULL_TREE; iter = TREE_CHAIN (iter))
19025    {
19026      HOST_WIDE_INT val = TREE_INT_CST_LOW (TREE_VALUE (iter));
19027      tree subiter;
19028      for (subiter = TREE_CHAIN (iter);
19029	   subiter != NULL_TREE;
19030	   subiter = TREE_CHAIN (subiter))
19031	{
19032	  HOST_WIDE_INT subval = TREE_INT_CST_LOW (TREE_VALUE (subiter));
19033	  if (val == subval)
19034	    {
19035	      EXPR_WFL_LINECOL (wfl_operator)
19036		= EXPR_WFL_LINECOL (TREE_PURPOSE (iter));
19037	      /* The case_label_list is in reverse order, so print the
19038		 outer label first.  */
19039	      parse_error_context (wfl_operator, "duplicate case label: `"
19040				   HOST_WIDE_INT_PRINT_DEC "'", subval);
19041	      EXPR_WFL_LINECOL (wfl_operator)
19042		= EXPR_WFL_LINECOL (TREE_PURPOSE (subiter));
19043	      parse_error_context (wfl_operator, "original label is here");
19044
19045	      break;
19046	    }
19047	}
19048    }
19049
19050  case_label_list = save;
19051
19052  /* Ready to return */
19053  if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK)
19054    {
19055      TREE_TYPE (node) = error_mark_node;
19056      return error_mark_node;
19057    }
19058  TREE_TYPE (node) = void_type_node;
19059  TREE_SIDE_EFFECTS (node) = 1;
19060  CAN_COMPLETE_NORMALLY (node)
19061    = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
19062      || ! SWITCH_HAS_DEFAULT (node);
19063  return node;
19064}
19065
19066/* Assertions.  */
19067
19068/* Build an assertion expression for `assert CONDITION : VALUE'; VALUE
19069   might be NULL_TREE.  */
19070static tree
19071build_assertion (location, condition, value)
19072     int location;
19073     tree condition, value;
19074{
19075  tree node;
19076  tree klass = GET_CPC ();
19077
19078  if (! CLASS_USES_ASSERTIONS (klass))
19079    {
19080      tree field, classdollar, id, call;
19081      tree class_type = TREE_TYPE (klass);
19082
19083      field = add_field (class_type,
19084			 get_identifier ("$assertionsDisabled"),
19085			 boolean_type_node,
19086			 ACC_PRIVATE | ACC_STATIC | ACC_FINAL);
19087      MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field);
19088      FIELD_SYNTHETIC (field) = 1;
19089
19090      if (!TYPE_DOT_CLASS (class_type))
19091	build_dot_class_method (class_type);
19092      classdollar = build_dot_class_method_invocation (class_type);
19093
19094      /* Call CLASS.desiredAssertionStatus().  */
19095      id = build_wfl_node (get_identifier ("desiredAssertionStatus"));
19096      call = build (CALL_EXPR, NULL_TREE, id, NULL_TREE, NULL_TREE);
19097      call = make_qualified_primary (classdollar, call, location);
19098      TREE_SIDE_EFFECTS (call) = 1;
19099
19100      /* Invert to obtain !CLASS.desiredAssertionStatus().  This may
19101	 seem odd, but we do it to generate code identical to that of
19102	 the JDK.  */
19103      call = build1 (TRUTH_NOT_EXPR, NULL_TREE, call);
19104      TREE_SIDE_EFFECTS (call) = 1;
19105      DECL_INITIAL (field) = call;
19106
19107      /* Record the initializer in the initializer statement list.  */
19108      call = build (MODIFY_EXPR, NULL_TREE, field, call);
19109      TREE_CHAIN (call) = CPC_STATIC_INITIALIZER_STMT (ctxp);
19110      SET_CPC_STATIC_INITIALIZER_STMT (ctxp, call);
19111      MODIFY_EXPR_FROM_INITIALIZATION_P (call) = 1;
19112
19113      CLASS_USES_ASSERTIONS (klass) = 1;
19114    }
19115
19116  if (value != NULL_TREE)
19117    value = tree_cons (NULL_TREE, value, NULL_TREE);
19118
19119  node = build_wfl_node (get_identifier ("java"));
19120  node = make_qualified_name (node, build_wfl_node (get_identifier ("lang")),
19121			      location);
19122  node = make_qualified_name (node, build_wfl_node (get_identifier ("AssertionError")),
19123			      location);
19124
19125  node = build (NEW_CLASS_EXPR, NULL_TREE, node, value, NULL_TREE);
19126  TREE_SIDE_EFFECTS (node) = 1;
19127  /* It is too early to use BUILD_THROW.  */
19128  node = build1 (THROW_EXPR, NULL_TREE, node);
19129  TREE_SIDE_EFFECTS (node) = 1;
19130
19131  /* We invert the condition; if we just put NODE as the `else' part
19132     then we generate weird-looking bytecode.  */
19133  condition = build1 (TRUTH_NOT_EXPR, NULL_TREE, condition);
19134  /* Check $assertionsDisabled.  */
19135  condition
19136    = build (TRUTH_ANDIF_EXPR, NULL_TREE,
19137	     build1 (TRUTH_NOT_EXPR, NULL_TREE,
19138		     build_wfl_node (get_identifier ("$assertionsDisabled"))),
19139	     condition);
19140  node = build_if_else_statement (location, condition, node, NULL_TREE);
19141  return node;
19142}
19143
19144/* 14.18 The try/catch statements */
19145
19146/* Encapsulate TRY_STMTS' in a try catch sequence. The catch clause
19147   catches TYPE and executes CATCH_STMTS.  */
19148
19149static tree
19150encapsulate_with_try_catch (location, type, try_stmts, catch_stmts)
19151     int location;
19152     tree type, try_stmts, catch_stmts;
19153{
19154  tree try_block, catch_clause_param, catch_block, catch;
19155
19156  /* First build a try block */
19157  try_block = build_expr_block (try_stmts, NULL_TREE);
19158
19159  /* Build a catch block: we need a catch clause parameter */
19160  catch_clause_param = build_decl (VAR_DECL,
19161				   wpv_id, build_pointer_type (type));
19162  /* And a block */
19163  catch_block = build_expr_block (NULL_TREE, catch_clause_param);
19164
19165  /* Initialize the variable and store in the block */
19166  catch = build (MODIFY_EXPR, NULL_TREE, catch_clause_param,
19167		 build (JAVA_EXC_OBJ_EXPR, ptr_type_node));
19168  add_stmt_to_block (catch_block, NULL_TREE, catch);
19169
19170  /* Add the catch statements */
19171  add_stmt_to_block (catch_block, NULL_TREE, catch_stmts);
19172
19173  /* Now we can build a CATCH_EXPR */
19174  catch_block = build1 (CATCH_EXPR, NULL_TREE, catch_block);
19175
19176  return build_try_statement (location, try_block, catch_block);
19177}
19178
19179static tree
19180build_try_statement (location, try_block, catches)
19181     int location;
19182     tree try_block, catches;
19183{
19184  tree node = build (TRY_EXPR, NULL_TREE, try_block, catches);
19185  EXPR_WFL_LINECOL (node) = location;
19186  return node;
19187}
19188
19189static tree
19190build_try_finally_statement (location, try_block, finally)
19191     int location;
19192     tree try_block, finally;
19193{
19194  tree node = build (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally);
19195  EXPR_WFL_LINECOL (node) = location;
19196  return node;
19197}
19198
19199static tree
19200patch_try_statement (node)
19201     tree node;
19202{
19203  int error_found = 0;
19204  tree try = TREE_OPERAND (node, 0);
19205  /* Exception handlers are considered in left to right order */
19206  tree catch = nreverse (TREE_OPERAND (node, 1));
19207  tree current, caught_type_list = NULL_TREE;
19208
19209  /* Check catch clauses, if any. Every time we find an error, we try
19210     to process the next catch clause. We process the catch clause before
19211     the try block so that when processing the try block we can check thrown
19212     exceptions againts the caught type list. */
19213  for (current = catch; current; current = TREE_CHAIN (current))
19214    {
19215      tree carg_decl, carg_type;
19216      tree sub_current, catch_block, catch_clause;
19217      int unreachable;
19218
19219      /* At this point, the structure of the catch clause is
19220	   CATCH_EXPR		(catch node)
19221	     BLOCK	        (with the decl of the parameter)
19222               COMPOUND_EXPR
19223                 MODIFY_EXPR   (assignment of the catch parameter)
19224		 BLOCK	        (catch clause block)
19225       */
19226      catch_clause = TREE_OPERAND (current, 0);
19227      carg_decl = BLOCK_EXPR_DECLS (catch_clause);
19228      carg_type = TREE_TYPE (TREE_TYPE (carg_decl));
19229
19230      /* Catch clauses can't have more than one parameter declared,
19231	 but it's already enforced by the grammar. Make sure that the
19232	 only parameter of the clause statement in of class Throwable
19233	 or a subclass of Throwable, but that was done earlier. The
19234	 catch clause parameter type has also been resolved. */
19235
19236      /* Just make sure that the catch clause parameter type inherits
19237	 from java.lang.Throwable */
19238      if (!inherits_from_p (carg_type, throwable_type_node))
19239	{
19240	  EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
19241	  parse_error_context (wfl_operator,
19242			       "Can't catch class `%s'. Catch clause parameter type must be a subclass of class `java.lang.Throwable'",
19243			       lang_printable_name (carg_type, 0));
19244	  error_found = 1;
19245	  continue;
19246	}
19247
19248      /* Partial check for unreachable catch statement: The catch
19249	 clause is reachable iff is no earlier catch block A in
19250	 the try statement such that the type of the catch
19251	 clause's parameter is the same as or a subclass of the
19252	 type of A's parameter */
19253      unreachable = 0;
19254      for (sub_current = catch;
19255	   sub_current != current; sub_current = TREE_CHAIN (sub_current))
19256	{
19257	  tree sub_catch_clause, decl;
19258	  sub_catch_clause = TREE_OPERAND (sub_current, 0);
19259	  decl = BLOCK_EXPR_DECLS (sub_catch_clause);
19260
19261	  if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl))))
19262	    {
19263	      EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
19264	      parse_error_context
19265		(wfl_operator,
19266		 "`catch' not reached because of the catch clause at line %d",
19267		 EXPR_WFL_LINENO (sub_current));
19268	      unreachable = error_found = 1;
19269	      break;
19270	    }
19271	}
19272      /* Complete the catch clause block */
19273      catch_block = java_complete_tree (TREE_OPERAND (current, 0));
19274      if (catch_block == error_mark_node)
19275	{
19276	  error_found = 1;
19277	  continue;
19278	}
19279      if (CAN_COMPLETE_NORMALLY (catch_block))
19280	CAN_COMPLETE_NORMALLY (node) = 1;
19281      TREE_OPERAND (current, 0) = catch_block;
19282
19283      if (unreachable)
19284	continue;
19285
19286      /* Things to do here: the exception must be thrown */
19287
19288      /* Link this type to the caught type list */
19289      caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list);
19290    }
19291
19292  PUSH_EXCEPTIONS (caught_type_list);
19293  if ((try = java_complete_tree (try)) == error_mark_node)
19294    error_found = 1;
19295  if (CAN_COMPLETE_NORMALLY (try))
19296    CAN_COMPLETE_NORMALLY (node) = 1;
19297  POP_EXCEPTIONS ();
19298
19299  /* Verification ends here */
19300  if (error_found)
19301    return error_mark_node;
19302
19303  TREE_OPERAND (node, 0) = try;
19304  TREE_OPERAND (node, 1) = catch;
19305  TREE_TYPE (node) = void_type_node;
19306  return node;
19307}
19308
19309/* 14.17 The synchronized Statement */
19310
19311static tree
19312patch_synchronized_statement (node, wfl_op1)
19313    tree node, wfl_op1;
19314{
19315  tree expr = java_complete_tree (TREE_OPERAND (node, 0));
19316  tree block = TREE_OPERAND (node, 1);
19317
19318  tree tmp, enter, exit, expr_decl, assignment;
19319
19320  if (expr == error_mark_node)
19321    {
19322      block = java_complete_tree (block);
19323      return expr;
19324    }
19325
19326  /* We might be trying to synchronize on a STRING_CST */
19327  if ((tmp = patch_string (expr)))
19328    expr = tmp;
19329
19330  /* The TYPE of expr must be a reference type */
19331  if (!JREFERENCE_TYPE_P (TREE_TYPE (expr)))
19332    {
19333      SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
19334      parse_error_context (wfl_operator, "Incompatible type for `synchronized'. Can't convert `%s' to `java.lang.Object'",
19335			   lang_printable_name (TREE_TYPE (expr), 0));
19336      return error_mark_node;
19337    }
19338
19339  if (flag_emit_xref)
19340    {
19341      TREE_OPERAND (node, 0) = expr;
19342      TREE_OPERAND (node, 1) = java_complete_tree (block);
19343      CAN_COMPLETE_NORMALLY (node) = 1;
19344      return node;
19345    }
19346
19347  /* Generate a try-finally for the synchronized statement, except
19348     that the handler that catches all throw exception calls
19349     _Jv_MonitorExit and then rethrow the exception.
19350     The synchronized statement is then implemented as:
19351     TRY
19352       {
19353         _Jv_MonitorEnter (expression)
19354	 synchronized_block
19355         _Jv_MonitorExit (expression)
19356       }
19357     CATCH_ALL
19358       {
19359         e = _Jv_exception_info ();
19360	 _Jv_MonitorExit (expression)
19361	 Throw (e);
19362       } */
19363
19364  expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr));
19365  BUILD_MONITOR_ENTER (enter, expr_decl);
19366  BUILD_MONITOR_EXIT (exit, expr_decl);
19367  CAN_COMPLETE_NORMALLY (enter) = 1;
19368  CAN_COMPLETE_NORMALLY (exit) = 1;
19369  assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr);
19370  TREE_SIDE_EFFECTS (assignment) = 1;
19371  node = build (COMPOUND_EXPR, NULL_TREE,
19372		build (COMPOUND_EXPR, NULL_TREE, assignment, enter),
19373		build (TRY_FINALLY_EXPR, NULL_TREE, block, exit));
19374  node = build_expr_block (node, expr_decl);
19375
19376  return java_complete_tree (node);
19377}
19378
19379/* 14.16 The throw Statement */
19380
19381static tree
19382patch_throw_statement (node, wfl_op1)
19383    tree node, wfl_op1;
19384{
19385  tree expr = TREE_OPERAND (node, 0);
19386  tree type = TREE_TYPE (expr);
19387  int unchecked_ok = 0, tryblock_throws_ok = 0;
19388
19389  /* Thrown expression must be assignable to java.lang.Throwable */
19390  if (!try_reference_assignconv (throwable_type_node, expr))
19391    {
19392      SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
19393      parse_error_context (wfl_operator,
19394    "Can't throw `%s'; it must be a subclass of class `java.lang.Throwable'",
19395			   lang_printable_name (type, 0));
19396      /* If the thrown expression was a reference, we further the
19397         compile-time check. */
19398      if (!JREFERENCE_TYPE_P (type))
19399	return error_mark_node;
19400    }
19401
19402  /* At least one of the following must be true */
19403
19404  /* The type of the throw expression is a not checked exception,
19405     i.e. is a unchecked expression. */
19406  unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type));
19407
19408  SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
19409  /* An instance can't throw a checked exception unless that exception
19410     is explicitly declared in the `throws' clause of each
19411     constructor. This doesn't apply to anonymous classes, since they
19412     don't have declared constructors. */
19413  if (!unchecked_ok
19414      && DECL_INSTINIT_P (current_function_decl)
19415      && !ANONYMOUS_CLASS_P (current_class))
19416    {
19417      tree current;
19418      for (current = TYPE_METHODS (current_class); current;
19419	   current = TREE_CHAIN (current))
19420	if (DECL_CONSTRUCTOR_P (current)
19421	    && !check_thrown_exceptions_do (TREE_TYPE (expr)))
19422	  {
19423	    parse_error_context (wfl_operator, "Checked exception `%s' can't be thrown in instance initializer (not all declared constructor are declaring it in their `throws' clause)",
19424				 lang_printable_name (TREE_TYPE (expr), 0));
19425	    return error_mark_node;
19426	  }
19427    }
19428
19429  /* Throw is contained in a try statement and at least one catch
19430     clause can receive the thrown expression or the current method is
19431     declared to throw such an exception. Or, the throw statement is
19432     contained in a method or constructor declaration and the type of
19433     the Expression is assignable to at least one type listed in the
19434     throws clause the declaration. */
19435  if (!unchecked_ok)
19436    tryblock_throws_ok = check_thrown_exceptions_do (TREE_TYPE (expr));
19437  if (!(unchecked_ok || tryblock_throws_ok))
19438    {
19439      /* If there is a surrounding try block that has no matching
19440	 clatch clause, report it first. A surrounding try block exits
19441	 only if there is something after the list of checked
19442	 exception thrown by the current function (if any). */
19443      if (IN_TRY_BLOCK_P ())
19444	parse_error_context (wfl_operator, "Checked exception `%s' can't be caught by any of the catch clause(s) of the surrounding `try' block",
19445			     lang_printable_name (type, 0));
19446      /* If we have no surrounding try statement and the method doesn't have
19447	 any throws, report it now. FIXME */
19448
19449      /* We report that the exception can't be throw from a try block
19450         in all circumstances but when the `throw' is inside a static
19451         block. */
19452      else if (!EXCEPTIONS_P (currently_caught_type_list)
19453	       && !tryblock_throws_ok)
19454	{
19455	  if (DECL_CLINIT_P (current_function_decl))
19456	    parse_error_context (wfl_operator,
19457                   "Checked exception `%s' can't be thrown in initializer",
19458				 lang_printable_name (type, 0));
19459	  else
19460	    parse_error_context (wfl_operator,
19461                   "Checked exception `%s' isn't thrown from a `try' block",
19462				 lang_printable_name (type, 0));
19463	}
19464      /* Otherwise, the current method doesn't have the appropriate
19465         throws declaration */
19466      else
19467	parse_error_context (wfl_operator, "Checked exception `%s' doesn't match any of current method's `throws' declaration(s)",
19468			     lang_printable_name (type, 0));
19469      return error_mark_node;
19470    }
19471
19472  if (! flag_emit_class_files && ! flag_emit_xref)
19473    BUILD_THROW (node, expr);
19474
19475  /* If doing xrefs, keep the location where the `throw' was seen. */
19476  if (flag_emit_xref)
19477    EXPR_WFL_LINECOL (node) = EXPR_WFL_LINECOL (wfl_op1);
19478  return node;
19479}
19480
19481/* Check that exception said to be thrown by method DECL can be
19482   effectively caught from where DECL is invoked.  */
19483
19484static void
19485check_thrown_exceptions (location, decl)
19486     int location;
19487     tree decl;
19488{
19489  tree throws;
19490  /* For all the unchecked exceptions thrown by DECL */
19491  for (throws = DECL_FUNCTION_THROWS (decl); throws;
19492       throws = TREE_CHAIN (throws))
19493    if (!check_thrown_exceptions_do (TREE_VALUE (throws)))
19494      {
19495#if 1
19496	/* Temporary hack to suppresses errors about cloning arrays. FIXME */
19497	if (DECL_NAME (decl) == get_identifier ("clone"))
19498	  continue;
19499#endif
19500	EXPR_WFL_LINECOL (wfl_operator) = location;
19501	if (DECL_FINIT_P (current_function_decl))
19502	  parse_error_context
19503            (wfl_operator, "Exception `%s' can't be thrown in initializer",
19504	     lang_printable_name (TREE_VALUE (throws), 0));
19505	else
19506	  {
19507	    parse_error_context
19508	      (wfl_operator, "Exception `%s' must be caught, or it must be declared in the `throws' clause of `%s'",
19509	       lang_printable_name (TREE_VALUE (throws), 0),
19510	       (DECL_INIT_P (current_function_decl) ?
19511		IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
19512		IDENTIFIER_POINTER (DECL_NAME (current_function_decl))));
19513	  }
19514      }
19515}
19516
19517/* Return 1 if checked EXCEPTION is caught at the current nesting level of
19518   try-catch blocks, OR is listed in the `throws' clause of the
19519   current method.  */
19520
19521static int
19522check_thrown_exceptions_do (exception)
19523     tree exception;
19524{
19525  tree list = currently_caught_type_list;
19526  resolve_and_layout (exception, NULL_TREE);
19527  /* First, all the nested try-catch-finally at that stage. The
19528     last element contains `throws' clause exceptions, if any. */
19529  if (IS_UNCHECKED_EXCEPTION_P (exception))
19530    return 1;
19531  while (list)
19532    {
19533      tree caught;
19534      for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught))
19535	if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0))
19536	  return 1;
19537      list = TREE_CHAIN (list);
19538    }
19539  return 0;
19540}
19541
19542static void
19543purge_unchecked_exceptions (mdecl)
19544     tree mdecl;
19545{
19546  tree throws = DECL_FUNCTION_THROWS (mdecl);
19547  tree new = NULL_TREE;
19548
19549  while (throws)
19550    {
19551      tree next = TREE_CHAIN (throws);
19552      if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws)))
19553	{
19554	  TREE_CHAIN (throws) = new;
19555	  new = throws;
19556	}
19557      throws = next;
19558    }
19559  /* List is inverted here, but it doesn't matter */
19560  DECL_FUNCTION_THROWS (mdecl) = new;
19561}
19562
19563/* This function goes over all of CLASS_TYPE ctors and checks whether
19564   each of them features at least one unchecked exception in its
19565   `throws' clause. If it's the case, it returns `true', `false'
19566   otherwise.  */
19567
19568static bool
19569ctors_unchecked_throws_clause_p (class_type)
19570     tree class_type;
19571{
19572  tree current;
19573
19574  for (current = TYPE_METHODS (class_type); current;
19575       current = TREE_CHAIN (current))
19576    {
19577      bool ctu = false;	/* Ctor Throws Unchecked */
19578      if (DECL_CONSTRUCTOR_P (current))
19579	{
19580	  tree throws;
19581	  for (throws = DECL_FUNCTION_THROWS (current); throws && !ctu;
19582	       throws = TREE_CHAIN (throws))
19583	    if (inherits_from_p (TREE_VALUE (throws), exception_type_node))
19584	      ctu = true;
19585	}
19586      /* We return false as we found one ctor that is unfit. */
19587      if (!ctu && DECL_CONSTRUCTOR_P (current))
19588	return false;
19589    }
19590  /* All ctors feature at least one unchecked exception in their
19591     `throws' clause. */
19592  return true;
19593}
19594
19595/* 15.24 Conditional Operator ?: */
19596
19597static tree
19598patch_conditional_expr (node, wfl_cond, wfl_op1)
19599     tree node, wfl_cond, wfl_op1;
19600{
19601  tree cond = TREE_OPERAND (node, 0);
19602  tree op1 = TREE_OPERAND (node, 1);
19603  tree op2 = TREE_OPERAND (node, 2);
19604  tree resulting_type = NULL_TREE;
19605  tree t1, t2, patched;
19606  int error_found = 0;
19607
19608  /* Operands of ?: might be StringBuffers crafted as a result of a
19609     string concatenation. Obtain a descent operand here.  */
19610  if ((patched = patch_string (op1)))
19611    TREE_OPERAND (node, 1) = op1 = patched;
19612  if ((patched = patch_string (op2)))
19613    TREE_OPERAND (node, 2) = op2 = patched;
19614
19615  t1 = TREE_TYPE (op1);
19616  t2 = TREE_TYPE (op2);
19617
19618  /* The first expression must be a boolean */
19619  if (TREE_TYPE (cond) != boolean_type_node)
19620    {
19621      SET_WFL_OPERATOR (wfl_operator, node, wfl_cond);
19622      parse_error_context (wfl_operator,
19623               "Incompatible type for `?:'. Can't convert `%s' to `boolean'",
19624			   lang_printable_name (TREE_TYPE (cond), 0));
19625      error_found = 1;
19626    }
19627
19628  /* Second and third can be numeric, boolean (i.e. primitive),
19629     references or null. Anything else results in an error */
19630  if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2))
19631	|| ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node)
19632	    && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node))
19633	|| (t1 == boolean_type_node && t2 == boolean_type_node)))
19634    error_found = 1;
19635
19636  /* Determine the type of the conditional expression. Same types are
19637     easy to deal with */
19638  else if (t1 == t2)
19639    resulting_type = t1;
19640
19641  /* There are different rules for numeric types */
19642  else if (JNUMERIC_TYPE_P (t1))
19643    {
19644      /* if byte/short found, the resulting type is short */
19645      if ((t1 == byte_type_node && t2 == short_type_node)
19646	  || (t1 == short_type_node && t2 == byte_type_node))
19647	resulting_type = short_type_node;
19648
19649      /* If t1 is a constant int and t2 is of type byte, short or char
19650	 and t1's value fits in t2, then the resulting type is t2 */
19651      else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1)))
19652	  && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2))
19653	resulting_type = t2;
19654
19655      /* If t2 is a constant int and t1 is of type byte, short or char
19656	 and t2's value fits in t1, then the resulting type is t1 */
19657      else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2)))
19658	  && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1))
19659	resulting_type = t1;
19660
19661      /* Otherwise, binary numeric promotion is applied and the
19662	 resulting type is the promoted type of operand 1 and 2 */
19663      else
19664	resulting_type = binary_numeric_promotion (t1, t2,
19665						   &TREE_OPERAND (node, 1),
19666						   &TREE_OPERAND (node, 2));
19667    }
19668
19669  /* Cases of a reference and a null type */
19670  else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node)
19671    resulting_type = t1;
19672
19673  else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node)
19674    resulting_type = t2;
19675
19676  /* Last case: different reference types. If a type can be converted
19677     into the other one by assignment conversion, the latter
19678     determines the type of the expression */
19679  else if ((resulting_type = try_reference_assignconv (t1, op2)))
19680    resulting_type = promote_type (t1);
19681
19682  else if ((resulting_type = try_reference_assignconv (t2, op1)))
19683    resulting_type = promote_type (t2);
19684
19685  /* If we don't have any resulting type, we're in trouble */
19686  if (!resulting_type)
19687    {
19688      char *t = xstrdup (lang_printable_name (t1, 0));
19689      SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
19690      parse_error_context (wfl_operator,
19691		 "Incompatible type for `?:'. Can't convert `%s' to `%s'",
19692			   t, lang_printable_name (t2, 0));
19693      free (t);
19694      error_found = 1;
19695    }
19696
19697  if (error_found)
19698    {
19699      TREE_TYPE (node) = error_mark_node;
19700      return error_mark_node;
19701    }
19702
19703  TREE_TYPE (node) = resulting_type;
19704  TREE_SET_CODE (node, COND_EXPR);
19705  CAN_COMPLETE_NORMALLY (node) = 1;
19706  return node;
19707}
19708
19709/* Wrap EXPR with code to initialize DECL's class, if appropriate. */
19710
19711static tree
19712maybe_build_class_init_for_field (decl, expr)
19713    tree decl, expr;
19714{
19715  tree clas = DECL_CONTEXT (decl);
19716  if (flag_emit_class_files || flag_emit_xref)
19717    return expr;
19718
19719  if (TREE_CODE (decl) == VAR_DECL && FIELD_STATIC (decl)
19720      && FIELD_FINAL (decl))
19721    {
19722      tree init = DECL_INITIAL (decl);
19723      if (init != NULL_TREE)
19724	init = fold_constant_for_init (init, decl);
19725      if (init != NULL_TREE && CONSTANT_VALUE_P (init))
19726	return expr;
19727    }
19728
19729  return build_class_init (clas, expr);
19730}
19731
19732/* Try to constant fold NODE.
19733   If NODE is not a constant expression, return NULL_EXPR.
19734   CONTEXT is a static final VAR_DECL whose initializer we are folding. */
19735
19736static tree
19737fold_constant_for_init (node, context)
19738     tree node;
19739     tree context;
19740{
19741  tree op0, op1, val;
19742  enum tree_code code = TREE_CODE (node);
19743
19744  switch (code)
19745    {
19746    case INTEGER_CST:
19747      if (node == null_pointer_node)
19748	return NULL_TREE;
19749    case STRING_CST:
19750    case REAL_CST:
19751      return node;
19752
19753    case PLUS_EXPR:
19754    case MINUS_EXPR:
19755    case MULT_EXPR:
19756    case TRUNC_MOD_EXPR:
19757    case RDIV_EXPR:
19758    case LSHIFT_EXPR:
19759    case RSHIFT_EXPR:
19760    case URSHIFT_EXPR:
19761    case BIT_AND_EXPR:
19762    case BIT_XOR_EXPR:
19763    case BIT_IOR_EXPR:
19764    case TRUTH_ANDIF_EXPR:
19765    case TRUTH_ORIF_EXPR:
19766    case EQ_EXPR:
19767    case NE_EXPR:
19768    case GT_EXPR:
19769    case GE_EXPR:
19770    case LT_EXPR:
19771    case LE_EXPR:
19772      op0 = TREE_OPERAND (node, 0);
19773      op1 = TREE_OPERAND (node, 1);
19774      val = fold_constant_for_init (op0, context);
19775      if (val == NULL_TREE || ! TREE_CONSTANT (val))
19776	return NULL_TREE;
19777      TREE_OPERAND (node, 0) = val;
19778      val = fold_constant_for_init (op1, context);
19779      if (val == NULL_TREE || ! TREE_CONSTANT (val))
19780	return NULL_TREE;
19781      TREE_OPERAND (node, 1) = val;
19782      return patch_binop (node, op0, op1);
19783
19784    case UNARY_PLUS_EXPR:
19785    case NEGATE_EXPR:
19786    case TRUTH_NOT_EXPR:
19787    case BIT_NOT_EXPR:
19788    case CONVERT_EXPR:
19789      op0 = TREE_OPERAND (node, 0);
19790      val = fold_constant_for_init (op0, context);
19791      if (val == NULL_TREE || ! TREE_CONSTANT (val))
19792	return NULL_TREE;
19793      TREE_OPERAND (node, 0) = val;
19794      return patch_unaryop (node, op0);
19795      break;
19796
19797    case COND_EXPR:
19798      val = fold_constant_for_init (TREE_OPERAND (node, 0), context);
19799      if (val == NULL_TREE || ! TREE_CONSTANT (val))
19800	return NULL_TREE;
19801      TREE_OPERAND (node, 0) = val;
19802      val = fold_constant_for_init (TREE_OPERAND (node, 1), context);
19803      if (val == NULL_TREE || ! TREE_CONSTANT (val))
19804	return NULL_TREE;
19805      TREE_OPERAND (node, 1) = val;
19806      val = fold_constant_for_init (TREE_OPERAND (node, 2), context);
19807      if (val == NULL_TREE || ! TREE_CONSTANT (val))
19808	return NULL_TREE;
19809      TREE_OPERAND (node, 2) = val;
19810      return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1)
19811	: TREE_OPERAND (node, 2);
19812
19813    case VAR_DECL:
19814    case FIELD_DECL:
19815      if (! FIELD_FINAL (node)
19816	  || DECL_INITIAL (node) == NULL_TREE)
19817	return NULL_TREE;
19818      val = DECL_INITIAL (node);
19819      /* Guard against infinite recursion. */
19820      DECL_INITIAL (node) = NULL_TREE;
19821      val = fold_constant_for_init (val, node);
19822      if (val != NULL_TREE && TREE_CODE (val) != STRING_CST)
19823	val = try_builtin_assignconv (NULL_TREE, TREE_TYPE (node), val);
19824      DECL_INITIAL (node) = val;
19825      return val;
19826
19827    case EXPR_WITH_FILE_LOCATION:
19828      /* Compare java_complete_tree and resolve_expression_name. */
19829      if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
19830	  || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
19831	{
19832	  tree name = EXPR_WFL_NODE (node);
19833	  tree decl;
19834	  if (PRIMARY_P (node))
19835	    return NULL_TREE;
19836	  else if (! QUALIFIED_P (name))
19837	    {
19838	      decl = lookup_field_wrapper (DECL_CONTEXT (context), name);
19839	      if (decl == NULL_TREE
19840		  || (! FIELD_STATIC (decl) && ! FIELD_FINAL (decl)))
19841		return NULL_TREE;
19842	      return fold_constant_for_init (decl, decl);
19843	    }
19844	  else
19845	    {
19846	      /* Install the proper context for the field resolution.
19847		 The prior context is restored once the name is
19848		 properly qualified. */
19849	      tree saved_current_class = current_class;
19850	      /* Wait until the USE_COMPONENT_REF re-write.  FIXME. */
19851	      current_class = DECL_CONTEXT (context);
19852	      qualify_ambiguous_name (node);
19853	      current_class = saved_current_class;
19854	      if (resolve_field_access (node, &decl, NULL)
19855		  && decl != NULL_TREE)
19856		return fold_constant_for_init (decl, decl);
19857	      return NULL_TREE;
19858	    }
19859	}
19860      else
19861	{
19862	  op0 = TREE_OPERAND (node, 0);
19863	  val = fold_constant_for_init (op0, context);
19864	  if (val == NULL_TREE || ! TREE_CONSTANT (val))
19865	    return NULL_TREE;
19866	  TREE_OPERAND (node, 0) = val;
19867	  return val;
19868	}
19869
19870#ifdef USE_COMPONENT_REF
19871    case IDENTIFIER:
19872    case COMPONENT_REF:
19873      ?;
19874#endif
19875
19876    default:
19877      return NULL_TREE;
19878    }
19879}
19880
19881#ifdef USE_COMPONENT_REF
19882/* Context is 'T' for TypeName, 'P' for PackageName,
19883   'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */
19884
19885tree
19886resolve_simple_name (name, context)
19887     tree name;
19888     int context;
19889{
19890}
19891
19892tree
19893resolve_qualified_name (name, context)
19894     tree name;
19895     int context;
19896{
19897}
19898#endif
19899
19900/* Mark P, which is really a `struct parser_ctxt **' for GC.  */
19901
19902static void
19903mark_parser_ctxt (p)
19904     void *p;
19905{
19906  struct parser_ctxt *pc = *((struct parser_ctxt **) p);
19907#ifndef JC1_LITE
19908  size_t i;
19909#endif
19910
19911  if (!pc)
19912    return;
19913
19914#ifndef JC1_LITE
19915  for (i = 0; i < ARRAY_SIZE (pc->modifier_ctx); ++i)
19916    ggc_mark_tree (pc->modifier_ctx[i]);
19917  ggc_mark_tree (pc->class_type);
19918  ggc_mark_tree (pc->function_decl);
19919  ggc_mark_tree (pc->package);
19920  ggc_mark_tree (pc->class_list);
19921  ggc_mark_tree (pc->current_parsed_class);
19922  ggc_mark_tree (pc->current_parsed_class_un);
19923  ggc_mark_tree (pc->non_static_initialized);
19924  ggc_mark_tree (pc->static_initialized);
19925  ggc_mark_tree (pc->instance_initializers);
19926  ggc_mark_tree (pc->import_list);
19927  ggc_mark_tree (pc->import_demand_list);
19928  ggc_mark_tree (pc->current_loop);
19929  ggc_mark_tree (pc->current_labeled_block);
19930#endif /* JC1_LITE */
19931
19932  if (pc->next)
19933    mark_parser_ctxt (&pc->next);
19934}
19935
19936void
19937init_src_parse ()
19938{
19939  /* Sanity check; we've been bit by this before.  */
19940  if (ARRAY_SIZE (ctxp->modifier_ctx) != MODIFIER_TK - PUBLIC_TK)
19941    abort ();
19942}
19943
19944
19945
19946/* This section deals with the functions that are called when tables
19947   recording class initialization information are traversed.  */
19948
19949/* Attach to PTR (a block) the declaration found in ENTRY. */
19950
19951static int
19952attach_init_test_initialization_flags (entry, ptr)
19953     PTR *entry;
19954     PTR ptr;
19955{
19956  tree block = (tree)ptr;
19957  struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry;
19958
19959  if (block != error_mark_node)
19960    {
19961      TREE_CHAIN (ite->value) = BLOCK_EXPR_DECLS (block);
19962      BLOCK_EXPR_DECLS (block) = ite->value;
19963    }
19964  return true;
19965}
19966
19967/* This function is called for each classes that is known definitely
19968   assigned when a given static method was called. This function
19969   augments a compound expression (INFO) storing all assignment to
19970   initialized static class flags if a flag already existed, otherwise
19971   a new one is created.  */
19972
19973static int
19974emit_test_initialization (entry_p, info)
19975     PTR *entry_p;
19976     PTR info;
19977{
19978  tree l = (tree) info;
19979  tree decl, init;
19980  tree key = (tree) *entry_p;
19981  tree *ite;
19982  htab_t cf_ht = DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl);
19983
19984  /* If we haven't found a flag and we're dealing with self registered
19985     with current_function_decl, then don't do anything. Self is
19986     always added as definitely initialized but this information is
19987     valid only if used outside the current function. */
19988  if (current_function_decl == TREE_PURPOSE (l)
19989      && java_treetreehash_find (cf_ht, key) == NULL)
19990    return true;
19991
19992  ite = java_treetreehash_new (cf_ht, key);
19993
19994  /* If we don't have a variable, create one and install it. */
19995  if (*ite == NULL)
19996    {
19997      tree block;
19998
19999      decl = build_decl (VAR_DECL, NULL_TREE, boolean_type_node);
20000      MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
20001      LOCAL_CLASS_INITIALIZATION_FLAG (decl) = 1;
20002      DECL_CONTEXT (decl) = current_function_decl;
20003      DECL_INITIAL (decl) = boolean_true_node;
20004
20005      /* The trick is to find the right context for it. */
20006      block = BLOCK_SUBBLOCKS (GET_CURRENT_BLOCK (current_function_decl));
20007      TREE_CHAIN (decl) = BLOCK_EXPR_DECLS (block);
20008      BLOCK_EXPR_DECLS (block) = decl;
20009      *ite = decl;
20010    }
20011  else
20012    decl = *ite;
20013
20014  /* Now simply augment the compound that holds all the assignments
20015     pertaining to this method invocation. */
20016  init = build (MODIFY_EXPR, boolean_type_node, decl, boolean_true_node);
20017  TREE_SIDE_EFFECTS (init) = 1;
20018  TREE_VALUE (l) = add_stmt_to_compound (TREE_VALUE (l), void_type_node, init);
20019  TREE_SIDE_EFFECTS (TREE_VALUE (l)) = 1;
20020
20021  return true;
20022}
20023
20024#include "gt-java-parse.h"
20025#include "gtype-java.h"
20026
20027
20028