]> gcc.gnu.org Git - gcc.git/blob - gcc/java/parse.c
parse.y (check_class_interface_creation): Use DIR_SEPARATOR consistently.
[gcc.git] / gcc / java / parse.c
1
2 /* A Bison parser, made from ./parse.y
3 by GNU Bison version 1.25
4 */
5
6 #define YYBISON 1 /* Identify Bison output. */
7
8 #define yyparse java_parse
9 #define yylex java_lex
10 #define yyerror java_error
11 #define yylval java_lval
12 #define yychar java_char
13 #define yydebug java_debug
14 #define yynerrs java_nerrs
15 #define PLUS_TK 258
16 #define MINUS_TK 259
17 #define MULT_TK 260
18 #define DIV_TK 261
19 #define REM_TK 262
20 #define LS_TK 263
21 #define SRS_TK 264
22 #define ZRS_TK 265
23 #define AND_TK 266
24 #define XOR_TK 267
25 #define OR_TK 268
26 #define BOOL_AND_TK 269
27 #define BOOL_OR_TK 270
28 #define EQ_TK 271
29 #define NEQ_TK 272
30 #define GT_TK 273
31 #define GTE_TK 274
32 #define LT_TK 275
33 #define LTE_TK 276
34 #define PLUS_ASSIGN_TK 277
35 #define MINUS_ASSIGN_TK 278
36 #define MULT_ASSIGN_TK 279
37 #define DIV_ASSIGN_TK 280
38 #define REM_ASSIGN_TK 281
39 #define LS_ASSIGN_TK 282
40 #define SRS_ASSIGN_TK 283
41 #define ZRS_ASSIGN_TK 284
42 #define AND_ASSIGN_TK 285
43 #define XOR_ASSIGN_TK 286
44 #define OR_ASSIGN_TK 287
45 #define PUBLIC_TK 288
46 #define PRIVATE_TK 289
47 #define PROTECTED_TK 290
48 #define STATIC_TK 291
49 #define FINAL_TK 292
50 #define SYNCHRONIZED_TK 293
51 #define VOLATILE_TK 294
52 #define TRANSIENT_TK 295
53 #define NATIVE_TK 296
54 #define PAD_TK 297
55 #define ABSTRACT_TK 298
56 #define MODIFIER_TK 299
57 #define DECR_TK 300
58 #define INCR_TK 301
59 #define DEFAULT_TK 302
60 #define IF_TK 303
61 #define THROW_TK 304
62 #define BOOLEAN_TK 305
63 #define DO_TK 306
64 #define IMPLEMENTS_TK 307
65 #define THROWS_TK 308
66 #define BREAK_TK 309
67 #define IMPORT_TK 310
68 #define ELSE_TK 311
69 #define INSTANCEOF_TK 312
70 #define RETURN_TK 313
71 #define VOID_TK 314
72 #define CATCH_TK 315
73 #define INTERFACE_TK 316
74 #define CASE_TK 317
75 #define EXTENDS_TK 318
76 #define FINALLY_TK 319
77 #define SUPER_TK 320
78 #define WHILE_TK 321
79 #define CLASS_TK 322
80 #define SWITCH_TK 323
81 #define CONST_TK 324
82 #define TRY_TK 325
83 #define FOR_TK 326
84 #define NEW_TK 327
85 #define CONTINUE_TK 328
86 #define GOTO_TK 329
87 #define PACKAGE_TK 330
88 #define THIS_TK 331
89 #define BYTE_TK 332
90 #define SHORT_TK 333
91 #define INT_TK 334
92 #define LONG_TK 335
93 #define CHAR_TK 336
94 #define INTEGRAL_TK 337
95 #define FLOAT_TK 338
96 #define DOUBLE_TK 339
97 #define FP_TK 340
98 #define ID_TK 341
99 #define REL_QM_TK 342
100 #define REL_CL_TK 343
101 #define NOT_TK 344
102 #define NEG_TK 345
103 #define ASSIGN_ANY_TK 346
104 #define ASSIGN_TK 347
105 #define OP_TK 348
106 #define CP_TK 349
107 #define OCB_TK 350
108 #define CCB_TK 351
109 #define OSB_TK 352
110 #define CSB_TK 353
111 #define SC_TK 354
112 #define C_TK 355
113 #define DOT_TK 356
114 #define STRING_LIT_TK 357
115 #define CHAR_LIT_TK 358
116 #define INT_LIT_TK 359
117 #define FP_LIT_TK 360
118 #define TRUE_TK 361
119 #define FALSE_TK 362
120 #define BOOL_LIT_TK 363
121 #define NULL_TK 364
122
123 #line 48 "./parse.y"
124
125 #include <stdio.h>
126 #include <stdlib.h>
127 #include <string.h>
128 #include <dirent.h>
129 #ifdef __STDC__
130 #include <stdarg.h>
131 #else
132 #include <varargs.h>
133 #endif
134
135 #include "config.h"
136 #include "tree.h"
137 #include "rtl.h"
138 #include "obstack.h"
139 #include "toplev.h"
140 #include "flags.h"
141 #include "java-tree.h"
142 #include "jcf.h"
143 #include "lex.h"
144 #include "parse.h"
145 #include "zipfile.h"
146 #include "convert.h"
147 #include "buffer.h"
148
149 #ifndef DIR_SEPARATOR
150 #define DIR_SEPARATOR '/'
151 #endif
152
153 /* Local function prototypes */
154 static char *java_accstring_lookup PROTO ((int));
155 static void classitf_redefinition_error PROTO ((char *,tree, tree, tree));
156 static void variable_redefinition_error PROTO ((tree, tree, tree, int));
157 static void check_modifiers PROTO ((char *, int, int));
158 static tree create_class PROTO ((int, tree, tree, tree));
159 static tree create_interface PROTO ((int, tree, tree));
160 static tree find_field PROTO ((tree, tree));
161 static tree lookup_field_wrapper PROTO ((tree, tree));
162 static int duplicate_declaration_error_p PROTO ((tree, tree, tree));
163 static void register_fields PROTO ((int, tree, tree));
164 static tree parser_qualified_classname PROTO ((tree));
165 static int parser_check_super PROTO ((tree, tree, tree));
166 static int parser_check_super_interface PROTO ((tree, tree, tree));
167 static void check_modifiers_consistency PROTO ((int));
168 static tree lookup_cl PROTO ((tree));
169 static tree lookup_java_method2 PROTO ((tree, tree, int));
170 static tree method_header PROTO ((int, tree, tree, tree));
171 static void fix_method_argument_names PROTO ((tree ,tree));
172 static tree method_declarator PROTO ((tree, tree));
173 static void parse_warning_context VPROTO ((tree cl, char *msg, ...));
174 static void issue_warning_error_from_context PROTO ((tree, char *msg, va_list));
175 static tree parse_jdk1_1_error PROTO ((char *));
176 static void complete_class_report_errors PROTO ((jdep *));
177 static int process_imports PROTO ((void));
178 static void read_import_dir PROTO ((tree));
179 static int find_in_imports_on_demand PROTO ((tree));
180 static int find_in_imports PROTO ((tree));
181 static int check_pkg_class_access PROTO ((tree, tree));
182 static tree resolve_package PROTO ((tree, tree *));
183 static tree lookup_package_type PROTO ((char *, int));
184 static tree resolve_class PROTO ((tree, tree, tree));
185 static tree do_resolve_class PROTO ((tree, tree, tree));
186 static void declare_local_variables PROTO ((int, tree, tree));
187 static void source_start_java_method PROTO ((tree));
188 static void source_end_java_method PROTO ((void));
189 static void expand_start_java_method PROTO ((tree));
190 static tree find_name_in_single_imports PROTO ((tree));
191 static void check_abstract_method_header PROTO ((tree));
192 static tree lookup_java_interface_method2 PROTO ((tree, tree));
193 static tree resolve_expression_name PROTO ((tree, tree *));
194 static tree maybe_create_class_interface_decl PROTO ((tree, tree, tree));
195 static int check_class_interface_creation PROTO ((int, int, tree,
196 tree, tree, tree));
197 static tree patch_method_invocation PROTO ((tree, tree, tree,
198 int *, tree *));
199 static int breakdown_qualified PROTO ((tree *, tree *, tree));
200 static tree resolve_and_layout PROTO ((tree, tree));
201 static tree resolve_no_layout PROTO ((tree, tree));
202 static int invocation_mode PROTO ((tree, int));
203 static tree find_applicable_accessible_methods_list PROTO ((int, tree,
204 tree, tree));
205 static tree find_most_specific_methods_list PROTO ((tree));
206 static int argument_types_convertible PROTO ((tree, tree));
207 static tree patch_invoke PROTO ((tree, tree, tree));
208 static tree lookup_method_invoke PROTO ((int, tree, tree, tree, tree));
209 static tree register_incomplete_type PROTO ((int, tree, tree, tree));
210 static tree obtain_incomplete_type PROTO ((tree));
211 static tree java_complete_lhs PROTO ((tree));
212 static tree java_complete_tree PROTO ((tree));
213 static void java_complete_expand_method PROTO ((tree));
214 static int unresolved_type_p PROTO ((tree, tree *));
215 static void create_jdep_list PROTO ((struct parser_ctxt *));
216 static tree build_expr_block PROTO ((tree, tree));
217 static tree enter_block PROTO ((void));
218 static tree enter_a_block PROTO ((tree));
219 static tree exit_block PROTO ((void));
220 static tree lookup_name_in_blocks PROTO ((tree));
221 static void maybe_absorb_scoping_blocks PROTO ((void));
222 static tree build_method_invocation PROTO ((tree, tree));
223 static tree build_new_invocation PROTO ((tree, tree));
224 static tree build_assignment PROTO ((int, int, tree, tree));
225 static tree build_binop PROTO ((enum tree_code, int, tree, tree));
226 static int check_final_assignment PROTO ((tree ,tree));
227 static tree patch_assignment PROTO ((tree, tree, tree ));
228 static tree patch_binop PROTO ((tree, tree, tree));
229 static tree build_unaryop PROTO ((int, int, tree));
230 static tree build_incdec PROTO ((int, int, tree, int));
231 static tree patch_unaryop PROTO ((tree, tree));
232 static tree build_cast PROTO ((int, tree, tree));
233 static tree build_null_of_type PROTO ((tree));
234 static tree patch_cast PROTO ((tree, tree));
235 static int valid_ref_assignconv_cast_p PROTO ((tree, tree, int));
236 static int valid_builtin_assignconv_identity_widening_p PROTO ((tree, tree));
237 static int valid_cast_to_p PROTO ((tree, tree));
238 static int valid_method_invocation_conversion_p PROTO ((tree, tree));
239 static tree try_builtin_assignconv PROTO ((tree, tree, tree));
240 static tree try_reference_assignconv PROTO ((tree, tree));
241 static tree build_unresolved_array_type PROTO ((tree));
242 static tree build_array_from_name PROTO ((tree, tree, tree, tree *));
243 static tree build_array_ref PROTO ((int, tree, tree));
244 static tree patch_array_ref PROTO ((tree));
245 static tree make_qualified_name PROTO ((tree, tree, int));
246 static tree merge_qualified_name PROTO ((tree, tree));
247 static tree make_qualified_primary PROTO ((tree, tree, int));
248 static int resolve_qualified_expression_name PROTO ((tree, tree *,
249 tree *, tree *));
250 static void qualify_ambiguous_name PROTO ((tree));
251 static void maybe_generate_clinit PROTO ((void));
252 static tree resolve_field_access PROTO ((tree, tree *, tree *));
253 static tree build_newarray_node PROTO ((tree, tree, int));
254 static tree patch_newarray PROTO ((tree));
255 static tree resolve_type_during_patch PROTO ((tree));
256 static tree build_this PROTO ((int));
257 static tree build_return PROTO ((int, tree));
258 static tree patch_return PROTO ((tree));
259 static tree maybe_access_field PROTO ((tree, tree, tree));
260 static int complete_function_arguments PROTO ((tree));
261 static int check_for_static_method_reference PROTO ((tree, tree, tree, tree, tree));
262 static int not_accessible_p PROTO ((tree, tree, int));
263 static void check_deprecation PROTO ((tree, tree));
264 static int class_in_current_package PROTO ((tree));
265 static tree build_if_else_statement PROTO ((int, tree, tree, tree));
266 static tree patch_if_else_statement PROTO ((tree));
267 static tree add_stmt_to_compound PROTO ((tree, tree, tree));
268 static tree add_stmt_to_block PROTO ((tree, tree, tree));
269 static tree patch_exit_expr PROTO ((tree));
270 static tree build_labeled_block PROTO ((int, tree));
271 static tree generate_labeled_block PROTO (());
272 static tree complete_labeled_statement PROTO ((tree, tree));
273 static tree build_bc_statement PROTO ((int, int, tree));
274 static tree patch_bc_statement PROTO ((tree));
275 static tree patch_loop_statement PROTO ((tree));
276 static tree build_new_loop PROTO ((tree));
277 static tree build_loop_body PROTO ((int, tree, int));
278 static tree complete_loop_body PROTO ((int, tree, tree, int));
279 static tree build_debugable_stmt PROTO ((int, tree));
280 static tree complete_for_loop PROTO ((int, tree, tree, tree));
281 static tree patch_switch_statement PROTO ((tree));
282 static tree string_constant_concatenation PROTO ((tree, tree));
283 static tree build_string_concatenation PROTO ((tree, tree));
284 static tree patch_string_cst PROTO ((tree));
285 static tree patch_string PROTO ((tree));
286 static tree build_jump_to_finally PROTO ((tree, tree, tree, tree));
287 static tree build_try_statement PROTO ((int, tree, tree, tree));
288 static tree patch_try_statement PROTO ((tree));
289 static tree patch_synchronized_statement PROTO ((tree, tree));
290 static tree patch_throw_statement PROTO ((tree, tree));
291 static void check_thrown_exceptions PROTO ((int, tree));
292 static int check_thrown_exceptions_do PROTO ((tree));
293 static void purge_unchecked_exceptions PROTO ((tree));
294 static void check_throws_clauses PROTO ((tree, tree, tree));
295 static void complete_method_declaration PROTO ((tree));
296 static tree build_super_invocation PROTO (());
297 static int verify_constructor_circularity PROTO ((tree, tree));
298 static char *constructor_circularity_msg PROTO ((tree, tree));
299 static tree build_this_super_qualified_invocation PROTO ((int, tree, tree,
300 int, int));
301 static char *get_printable_method_name PROTO ((tree));
302 static tree patch_conditional_expr PROTO ((tree, tree, tree));
303 static void maybe_generate_finit PROTO (());
304 static void fix_constructors PROTO ((tree));
305 static int verify_constructor_super PROTO (());
306 static tree create_artificial_method PROTO ((tree, int, tree, tree, tree));
307 static void start_artificial_method_body PROTO ((tree));
308 static void end_artificial_method_body PROTO ((tree));
309 static int check_method_redefinition PROTO ((tree, tree));
310 static int reset_method_name PROTO ((tree));
311 static void java_check_regular_methods PROTO ((tree));
312 static void java_check_abstract_methods PROTO ((tree));
313 static tree maybe_build_primttype_type_ref PROTO ((tree, tree));
314 static void unreachable_stmt_error PROTO ((tree));
315 static tree find_expr_with_wfl PROTO ((tree));
316 static void missing_return_error PROTO ((tree));
317 static tree build_new_array_init PROTO ((int, tree));
318 static tree patch_new_array_init PROTO ((tree, tree));
319 static tree maybe_build_array_element_wfl PROTO ((tree));
320 static int array_constructor_check_entry PROTO ((tree, tree));
321 static char *purify_type_name PROTO ((char *));
322 static tree patch_initialized_static_field PROTO ((tree));
323 static tree fold_constant_for_init PROTO ((tree, tree));
324
325 /* Number of error found so far. */
326 int java_error_count;
327 /* Number of warning found so far. */
328 int java_warning_count;
329
330 /* The current parser context */
331 static struct parser_ctxt *ctxp;
332
333 /* List of things that were anlyzed for which code will be generated */
334 static struct parser_ctxt *ctxp_for_generation = NULL;
335
336 /* binop_lookup maps token to tree_code. It is used where binary
337 operations are involved and required by the parser. RDIV_EXPR
338 covers both integral/floating point division. The code is changed
339 once the type of both operator is worked out. */
340
341 static enum tree_code binop_lookup[19] =
342 {
343 PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR,
344 LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR,
345 BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR,
346 TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR,
347 EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR,
348 };
349 #define BINOP_LOOKUP(VALUE) \
350 binop_lookup [((VALUE) - PLUS_TK)% \
351 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
352
353 /* Fake WFL used to report error message. It is initialized once if
354 needed and reused with it's location information is overriden. */
355 tree wfl_operator = NULL_TREE;
356
357 /* The "$L" identifier we use to create labels. */
358 static tree label_id = NULL_TREE;
359
360 /* The "StringBuffer" identifier used for the String `+' operator. */
361 static tree wfl_string_buffer = NULL_TREE;
362
363 /* The "append" identifier used for String `+' operator. */
364 static tree wfl_append = NULL_TREE;
365
366 /* The "toString" identifier used for String `+' operator. */
367 static tree wfl_to_string = NULL_TREE;
368
369 #line 294 "./parse.y"
370 typedef union {
371 tree node;
372 int sub_token;
373 struct {
374 int token;
375 int location;
376 } operator;
377 int value;
378 } YYSTYPE;
379 #ifndef YYDEBUG
380 #define YYDEBUG 1
381 #endif
382
383 #include <stdio.h>
384
385 #ifndef __cplusplus
386 #ifndef __STDC__
387 #define const
388 #endif
389 #endif
390
391
392
393 #define YYFINAL 774
394 #define YYFLAG -32768
395 #define YYNTBASE 110
396
397 #define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 265)
398
399 static const char yytranslate[] = { 0,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
426 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
427 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
428 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
429 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
430 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
431 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
432 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
433 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
434 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
435 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
436 106, 107, 108, 109
437 };
438
439 #if YYDEBUG != 0
440 static const short yyprhs[] = { 0,
441 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
442 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
443 46, 50, 54, 56, 58, 60, 64, 66, 67, 69,
444 71, 73, 76, 79, 82, 86, 88, 91, 93, 96,
445 100, 103, 107, 109, 111, 115, 118, 122, 128, 133,
446 139, 141, 143, 145, 147, 149, 152, 153, 161, 162,
447 169, 173, 176, 180, 185, 186, 189, 193, 196, 197,
448 200, 203, 205, 209, 213, 216, 220, 222, 225, 227,
449 229, 231, 233, 235, 237, 239, 241, 245, 250, 252,
450 256, 260, 262, 266, 270, 275, 277, 281, 284, 288,
451 292, 294, 296, 297, 301, 304, 308, 312, 317, 322,
452 325, 329, 332, 336, 339, 343, 348, 352, 356, 360,
453 362, 366, 370, 373, 377, 380, 384, 385, 388, 391,
454 393, 397, 401, 403, 406, 408, 411, 415, 417, 418,
455 422, 425, 429, 433, 438, 441, 445, 449, 454, 459,
456 465, 473, 480, 482, 484, 485, 490, 491, 497, 498,
457 504, 505, 512, 516, 521, 524, 528, 531, 535, 538,
458 542, 544, 547, 549, 551, 553, 555, 557, 560, 563,
459 566, 570, 575, 577, 581, 585, 588, 592, 594, 596,
460 598, 601, 603, 605, 607, 610, 613, 617, 619, 621,
461 623, 625, 627, 629, 631, 633, 635, 637, 639, 641,
462 643, 645, 647, 649, 651, 653, 655, 657, 659, 661,
463 663, 666, 669, 672, 675, 678, 681, 684, 687, 691,
464 696, 701, 707, 712, 718, 725, 733, 740, 742, 744,
465 746, 748, 750, 752, 754, 760, 763, 767, 772, 780,
466 788, 789, 793, 798, 801, 805, 811, 814, 818, 822,
467 827, 829, 832, 835, 837, 840, 844, 847, 850, 854,
468 857, 862, 865, 868, 872, 877, 880, 882, 890, 898,
469 905, 909, 915, 920, 928, 935, 938, 941, 945, 948,
470 949, 951, 953, 956, 957, 959, 961, 965, 969, 972,
471 976, 979, 983, 986, 990, 993, 997, 1000, 1004, 1007,
472 1011, 1015, 1018, 1022, 1028, 1034, 1037, 1042, 1046, 1048,
473 1052, 1056, 1061, 1064, 1066, 1069, 1072, 1077, 1080, 1084,
474 1089, 1092, 1095, 1097, 1099, 1101, 1103, 1107, 1109, 1111,
475 1113, 1115, 1119, 1123, 1127, 1131, 1135, 1139, 1143, 1147,
476 1153, 1158, 1165, 1171, 1176, 1182, 1188, 1195, 1199, 1203,
477 1208, 1214, 1217, 1221, 1225, 1229, 1231, 1235, 1239, 1243,
478 1247, 1252, 1257, 1262, 1267, 1271, 1275, 1277, 1280, 1284,
479 1288, 1291, 1294, 1298, 1302, 1306, 1310, 1313, 1317, 1322,
480 1328, 1335, 1341, 1348, 1353, 1358, 1363, 1368, 1372, 1377,
481 1381, 1386, 1388, 1390, 1392, 1394, 1397, 1400, 1402, 1404,
482 1407, 1410, 1412, 1415, 1418, 1421, 1424, 1427, 1430, 1432,
483 1435, 1438, 1440, 1443, 1446, 1452, 1457, 1462, 1468, 1473,
484 1476, 1482, 1487, 1493, 1495, 1499, 1503, 1507, 1511, 1515,
485 1519, 1521, 1525, 1529, 1533, 1537, 1539, 1543, 1547, 1551,
486 1555, 1559, 1563, 1565, 1569, 1573, 1577, 1581, 1585, 1589,
487 1593, 1597, 1601, 1605, 1607, 1611, 1615, 1619, 1623, 1625,
488 1629, 1633, 1635, 1639, 1643, 1645, 1649, 1653, 1655, 1659,
489 1663, 1665, 1669, 1673, 1675, 1681, 1686, 1690, 1696, 1698,
490 1700, 1704, 1708, 1710, 1712, 1714, 1716, 1718, 1720
491 };
492
493 static const short yyrhs[] = { 123,
494 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
495 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
496 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
497 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
498 0, 118, 97, 98, 0, 113, 97, 1, 0, 118,
499 97, 1, 0, 120, 0, 121, 0, 122, 0, 119,
500 101, 122, 0, 86, 0, 0, 126, 0, 124, 0,
501 125, 0, 126, 124, 0, 126, 125, 0, 124, 125,
502 0, 126, 124, 125, 0, 127, 0, 124, 127, 0,
503 130, 0, 125, 130, 0, 75, 119, 99, 0, 75,
504 1, 0, 75, 119, 1, 0, 128, 0, 129, 0,
505 55, 119, 99, 0, 55, 1, 0, 55, 119, 1,
506 0, 55, 119, 101, 5, 99, 0, 55, 119, 101,
507 1, 0, 55, 119, 101, 5, 1, 0, 132, 0,
508 165, 0, 99, 0, 1, 0, 44, 0, 131, 44,
509 0, 0, 131, 67, 122, 135, 136, 133, 138, 0,
510 0, 67, 122, 135, 136, 134, 138, 0, 131, 67,
511 1, 0, 67, 1, 0, 67, 122, 1, 0, 131,
512 67, 122, 1, 0, 0, 63, 116, 0, 63, 116,
513 1, 0, 63, 1, 0, 0, 52, 137, 0, 52,
514 1, 0, 117, 0, 137, 100, 117, 0, 137, 100,
515 1, 0, 95, 96, 0, 95, 139, 96, 0, 140,
516 0, 139, 140, 0, 141, 0, 156, 0, 158, 0,
517 178, 0, 142, 0, 147, 0, 132, 0, 165, 0,
518 112, 143, 99, 0, 131, 112, 143, 99, 0, 144,
519 0, 143, 100, 144, 0, 143, 100, 1, 0, 145,
520 0, 145, 92, 146, 0, 145, 92, 1, 0, 145,
521 92, 146, 1, 0, 122, 0, 145, 97, 98, 0,
522 122, 1, 0, 145, 97, 1, 0, 145, 98, 1,
523 0, 263, 0, 176, 0, 0, 149, 148, 155, 0,
524 149, 1, 0, 112, 150, 153, 0, 59, 150, 153,
525 0, 131, 112, 150, 153, 0, 131, 59, 150, 153,
526 0, 112, 1, 0, 131, 112, 1, 0, 59, 1,
527 0, 131, 59, 1, 0, 131, 1, 0, 122, 93,
528 94, 0, 122, 93, 151, 94, 0, 150, 97, 98,
529 0, 122, 93, 1, 0, 150, 97, 1, 0, 152,
530 0, 151, 100, 152, 0, 151, 100, 1, 0, 112,
531 145, 0, 131, 112, 145, 0, 112, 1, 0, 131,
532 112, 1, 0, 0, 53, 154, 0, 53, 1, 0,
533 116, 0, 154, 100, 116, 0, 154, 100, 1, 0,
534 178, 0, 178, 99, 0, 99, 0, 157, 178, 0,
535 157, 178, 99, 0, 44, 0, 0, 160, 159, 162,
536 0, 161, 153, 0, 131, 161, 153, 0, 120, 93,
537 94, 0, 120, 93, 151, 94, 0, 179, 180, 0,
538 179, 163, 180, 0, 179, 181, 180, 0, 179, 163,
539 181, 180, 0, 164, 93, 94, 99, 0, 164, 93,
540 232, 94, 99, 0, 119, 101, 65, 93, 232, 94,
541 99, 0, 119, 101, 65, 93, 94, 99, 0, 76,
542 0, 65, 0, 0, 61, 122, 166, 171, 0, 0,
543 131, 61, 122, 167, 171, 0, 0, 61, 122, 170,
544 168, 171, 0, 0, 131, 61, 122, 170, 169, 171,
545 0, 61, 122, 1, 0, 131, 61, 122, 1, 0,
546 63, 117, 0, 170, 100, 117, 0, 63, 1, 0,
547 170, 100, 1, 0, 95, 96, 0, 95, 172, 96,
548 0, 173, 0, 172, 173, 0, 174, 0, 175, 0,
549 132, 0, 165, 0, 142, 0, 149, 99, 0, 149,
550 1, 0, 95, 96, 0, 95, 177, 96, 0, 95,
551 177, 100, 96, 0, 146, 0, 177, 100, 146, 0,
552 177, 100, 1, 0, 95, 96, 0, 179, 181, 180,
553 0, 95, 0, 96, 0, 182, 0, 181, 182, 0,
554 183, 0, 185, 0, 132, 0, 184, 99, 0, 112,
555 143, 0, 131, 112, 143, 0, 187, 0, 190, 0,
556 194, 0, 195, 0, 206, 0, 210, 0, 187, 0,
557 191, 0, 196, 0, 207, 0, 211, 0, 178, 0,
558 188, 0, 192, 0, 197, 0, 209, 0, 217, 0,
559 218, 0, 219, 0, 221, 0, 220, 0, 223, 0,
560 99, 0, 122, 88, 0, 189, 185, 0, 122, 1,
561 0, 189, 186, 0, 193, 99, 0, 1, 99, 0,
562 1, 95, 0, 1, 96, 0, 164, 93, 1, 0,
563 164, 93, 94, 1, 0, 164, 93, 232, 1, 0,
564 164, 93, 232, 94, 1, 0, 119, 101, 65, 1,
565 0, 119, 101, 65, 93, 1, 0, 119, 101, 65,
566 93, 232, 1, 0, 119, 101, 65, 93, 232, 94,
567 1, 0, 119, 101, 65, 93, 94, 1, 0, 260,
568 0, 244, 0, 245, 0, 241, 0, 242, 0, 238,
569 0, 230, 0, 48, 93, 263, 94, 185, 0, 48,
570 1, 0, 48, 93, 1, 0, 48, 93, 263, 1,
571 0, 48, 93, 263, 94, 186, 56, 185, 0, 48,
572 93, 263, 94, 186, 56, 186, 0, 0, 199, 198,
573 200, 0, 68, 93, 263, 94, 0, 68, 1, 0,
574 68, 93, 1, 0, 68, 93, 263, 94, 1, 0,
575 95, 96, 0, 95, 203, 96, 0, 95, 201, 96,
576 0, 95, 201, 203, 96, 0, 202, 0, 201, 202,
577 0, 203, 181, 0, 204, 0, 203, 204, 0, 62,
578 264, 88, 0, 47, 88, 0, 62, 1, 0, 62,
579 264, 1, 0, 47, 1, 0, 66, 93, 263, 94,
580 0, 205, 185, 0, 66, 1, 0, 66, 93, 1,
581 0, 66, 93, 263, 1, 0, 205, 186, 0, 51,
582 0, 208, 185, 66, 93, 263, 94, 99, 0, 213,
583 99, 263, 99, 215, 94, 185, 0, 213, 99, 99,
584 215, 94, 185, 0, 213, 99, 1, 0, 213, 99,
585 263, 99, 1, 0, 213, 99, 99, 1, 0, 213,
586 99, 263, 99, 215, 94, 186, 0, 213, 99, 99,
587 215, 94, 186, 0, 71, 93, 0, 71, 1, 0,
588 71, 93, 1, 0, 212, 214, 0, 0, 216, 0,
589 184, 0, 216, 1, 0, 0, 216, 0, 193, 0,
590 216, 100, 193, 0, 216, 100, 1, 0, 54, 99,
591 0, 54, 122, 99, 0, 54, 1, 0, 54, 122,
592 1, 0, 73, 99, 0, 73, 122, 99, 0, 73,
593 1, 0, 73, 122, 1, 0, 58, 99, 0, 58,
594 263, 99, 0, 58, 1, 0, 58, 263, 1, 0,
595 49, 263, 99, 0, 49, 1, 0, 49, 263, 1,
596 0, 222, 93, 263, 94, 178, 0, 222, 93, 263,
597 94, 1, 0, 222, 1, 0, 222, 93, 1, 94,
598 0, 222, 93, 1, 0, 44, 0, 70, 178, 224,
599 0, 70, 178, 227, 0, 70, 178, 224, 227, 0,
600 70, 1, 0, 225, 0, 224, 225, 0, 226, 178,
601 0, 60, 93, 152, 94, 0, 60, 1, 0, 60,
602 93, 1, 0, 60, 93, 1, 94, 0, 64, 178,
603 0, 64, 1, 0, 229, 0, 233, 0, 111, 0,
604 76, 0, 93, 263, 94, 0, 230, 0, 237, 0,
605 238, 0, 239, 0, 119, 101, 67, 0, 113, 101,
606 67, 0, 59, 101, 67, 0, 119, 101, 76, 0,
607 93, 263, 1, 0, 119, 101, 1, 0, 113, 101,
608 1, 0, 59, 101, 1, 0, 72, 116, 93, 232,
609 94, 0, 72, 116, 93, 94, 0, 72, 116, 93,
610 232, 94, 138, 0, 72, 116, 93, 94, 138, 0,
611 231, 122, 93, 94, 0, 231, 122, 93, 94, 138,
612 0, 231, 122, 93, 232, 94, 0, 231, 122, 93,
613 232, 94, 138, 0, 72, 1, 99, 0, 72, 116,
614 1, 0, 72, 116, 93, 1, 0, 72, 116, 93,
615 232, 1, 0, 231, 1, 0, 231, 122, 1, 0,
616 119, 101, 72, 0, 228, 101, 72, 0, 263, 0,
617 232, 100, 263, 0, 232, 100, 1, 0, 72, 113,
618 234, 0, 72, 115, 234, 0, 72, 113, 234, 236,
619 0, 72, 115, 234, 236, 0, 72, 115, 236, 176,
620 0, 72, 113, 236, 176, 0, 72, 1, 98, 0,
621 72, 1, 97, 0, 235, 0, 234, 235, 0, 97,
622 263, 98, 0, 97, 263, 1, 0, 97, 1, 0,
623 97, 98, 0, 236, 97, 98, 0, 236, 97, 1,
624 0, 228, 101, 122, 0, 65, 101, 122, 0, 65,
625 1, 0, 119, 93, 94, 0, 119, 93, 232, 94,
626 0, 228, 101, 122, 93, 94, 0, 228, 101, 122,
627 93, 232, 94, 0, 65, 101, 122, 93, 94, 0,
628 65, 101, 122, 93, 232, 94, 0, 65, 101, 1,
629 94, 0, 65, 101, 1, 101, 0, 119, 97, 263,
630 98, 0, 229, 97, 263, 98, 0, 119, 97, 1,
631 0, 119, 97, 263, 1, 0, 229, 97, 1, 0,
632 229, 97, 263, 1, 0, 228, 0, 119, 0, 241,
633 0, 242, 0, 240, 46, 0, 240, 45, 0, 244,
634 0, 245, 0, 3, 243, 0, 4, 243, 0, 246,
635 0, 3, 1, 0, 4, 1, 0, 46, 243, 0,
636 46, 1, 0, 45, 243, 0, 45, 1, 0, 240,
637 0, 89, 243, 0, 90, 243, 0, 247, 0, 89,
638 1, 0, 90, 1, 0, 93, 113, 236, 94, 243,
639 0, 93, 113, 94, 243, 0, 93, 263, 94, 246,
640 0, 93, 119, 236, 94, 246, 0, 93, 113, 97,
641 1, 0, 93, 1, 0, 93, 113, 236, 94, 1,
642 0, 93, 113, 94, 1, 0, 93, 119, 236, 94,
643 1, 0, 243, 0, 248, 5, 243, 0, 248, 6,
644 243, 0, 248, 7, 243, 0, 248, 5, 1, 0,
645 248, 6, 1, 0, 248, 7, 1, 0, 248, 0,
646 249, 3, 248, 0, 249, 4, 248, 0, 249, 3,
647 1, 0, 249, 4, 1, 0, 249, 0, 250, 8,
648 249, 0, 250, 9, 249, 0, 250, 10, 249, 0,
649 250, 8, 1, 0, 250, 9, 1, 0, 250, 10,
650 1, 0, 250, 0, 251, 20, 250, 0, 251, 18,
651 250, 0, 251, 21, 250, 0, 251, 19, 250, 0,
652 251, 57, 114, 0, 251, 20, 1, 0, 251, 18,
653 1, 0, 251, 21, 1, 0, 251, 19, 1, 0,
654 251, 57, 1, 0, 251, 0, 252, 16, 251, 0,
655 252, 17, 251, 0, 252, 16, 1, 0, 252, 17,
656 1, 0, 252, 0, 253, 11, 252, 0, 253, 11,
657 1, 0, 253, 0, 254, 12, 253, 0, 254, 12,
658 1, 0, 254, 0, 255, 13, 254, 0, 255, 13,
659 1, 0, 255, 0, 256, 14, 255, 0, 256, 14,
660 1, 0, 256, 0, 257, 15, 256, 0, 257, 15,
661 1, 0, 257, 0, 257, 87, 263, 88, 258, 0,
662 257, 87, 88, 1, 0, 257, 87, 1, 0, 257,
663 87, 263, 88, 1, 0, 258, 0, 260, 0, 261,
664 262, 259, 0, 261, 262, 1, 0, 119, 0, 237,
665 0, 239, 0, 91, 0, 92, 0, 259, 0, 263,
666 0
667 };
668
669 #endif
670
671 #if YYDEBUG != 0
672 static const short yyrline[] = { 0,
673 444, 450, 452, 453, 454, 455, 456, 460, 462, 465,
674 467, 468, 471, 473, 476, 480, 484, 488, 494, 496,
675 498, 500, 505, 507, 510, 514, 519, 524, 526, 527,
676 528, 529, 530, 531, 532, 535, 540, 546, 548, 551,
677 554, 556, 560, 562, 565, 592, 594, 598, 607, 609,
678 613, 620, 621, 623, 633, 638, 653, 657, 660, 663,
679 666, 668, 670, 672, 676, 678, 680, 682, 686, 688,
680 690, 697, 703, 708, 712, 715, 719, 721, 724, 726,
681 727, 728, 732, 734, 735, 737, 742, 745, 755, 758,
682 760, 764, 767, 774, 780, 788, 790, 792, 794, 796,
683 800, 802, 806, 813, 814, 818, 821, 823, 825, 827,
684 829, 831, 833, 835, 842, 845, 847, 856, 858, 862,
685 867, 872, 876, 881, 883, 885, 892, 894, 896, 900,
686 903, 905, 909, 911, 912, 917, 922, 928, 936, 943,
687 946, 949, 953, 956, 960, 969, 971, 973, 978, 985,
688 993, 995, 999, 1007, 1018, 1022, 1025, 1028, 1031, 1034,
689 1037, 1040, 1043, 1045, 1049, 1055, 1060, 1062, 1066, 1069,
690 1073, 1075, 1078, 1080, 1081, 1083, 1087, 1091, 1097, 1102,
691 1105, 1107, 1111, 1117, 1121, 1126, 1129, 1133, 1138, 1146,
692 1148, 1151, 1153, 1155, 1159, 1163, 1166, 1170, 1172, 1173,
693 1174, 1175, 1176, 1186, 1188, 1189, 1190, 1191, 1194, 1196,
694 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1208,
695 1213, 1224, 1231, 1235, 1246, 1256, 1262, 1268, 1274, 1276,
696 1282, 1284, 1290, 1292, 1294, 1296, 1298, 1302, 1304, 1305,
697 1306, 1307, 1308, 1309, 1312, 1315, 1317, 1319, 1323, 1328,
698 1333, 1339, 1349, 1355, 1357, 1359, 1366, 1369, 1371, 1373,
699 1377, 1379, 1382, 1386, 1388, 1391, 1398, 1404, 1406, 1408,
700 1412, 1420, 1423, 1425, 1427, 1431, 1436, 1445, 1450, 1453,
701 1460, 1462, 1464, 1468, 1471, 1480, 1487, 1489, 1493, 1506,
702 1508, 1514, 1520, 1524, 1526, 1530, 1533, 1535, 1539, 1542,
703 1544, 1546, 1550, 1553, 1555, 1557, 1561, 1564, 1566, 1568,
704 1572, 1578, 1580, 1584, 1591, 1593, 1595, 1597, 1601, 1609,
705 1612, 1614, 1616, 1620, 1622, 1629, 1637, 1654, 1656, 1658,
706 1662, 1668, 1673, 1675, 1678, 1680, 1682, 1684, 1685, 1686,
707 1687, 1691, 1693, 1695, 1700, 1702, 1704, 1706, 1708, 1712,
708 1715, 1720, 1722, 1727, 1728, 1729, 1730, 1731, 1733, 1735,
709 1737, 1739, 1741, 1745, 1747, 1750, 1756, 1761, 1765, 1768,
710 1770, 1772, 1776, 1778, 1780, 1782, 1786, 1789, 1793, 1799,
711 1801, 1809, 1812, 1814, 1818, 1823, 1831, 1835, 1838, 1840,
712 1851, 1862, 1867, 1876, 1878, 1882, 1885, 1887, 1892, 1897,
713 1902, 1909, 1911, 1912, 1913, 1916, 1921, 1926, 1928, 1929,
714 1931, 1933, 1934, 1936, 1940, 1943, 1947, 1950, 1954, 1956,
715 1958, 1960, 1961, 1963, 1967, 1975, 1977, 1979, 1991, 1993,
716 1999, 2001, 2003, 2007, 2009, 2014, 2019, 2024, 2026, 2028,
717 2032, 2034, 2039, 2044, 2046, 2050, 2052, 2057, 2062, 2067,
718 2069, 2071, 2075, 2077, 2082, 2087, 2092, 2097, 2099, 2101,
719 2103, 2105, 2107, 2111, 2113, 2118, 2123, 2125, 2129, 2131,
720 2136, 2140, 2142, 2147, 2151, 2153, 2158, 2162, 2164, 2169,
721 2173, 2175, 2180, 2184, 2186, 2191, 2197, 2199, 2203, 2205,
722 2208, 2211, 2219, 2221, 2222, 2225, 2227, 2230, 2234
723 };
724 #endif
725
726
727 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
728
729 static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK",
730 "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
731 "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
732 "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
733 "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
734 "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
735 "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
736 "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
737 "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
738 "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
739 "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
740 "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
741 "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
742 "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
743 "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
744 "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
745 "goal","literal","type","primitive_type","reference_type","class_or_interface_type",
746 "class_type","interface_type","array_type","name","simple_name","qualified_name",
747 "identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
748 "import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
749 "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
750 "interface_type_list","class_body","class_body_declarations","class_body_declaration",
751 "class_member_declaration","field_declaration","variable_declarators","variable_declarator",
752 "variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
753 "method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list",
754 "method_body","static_initializer","static","constructor_declaration","@4","constructor_header",
755 "constructor_declarator","constructor_body","explicit_constructor_invocation",
756 "this_or_super","interface_declaration","@5","@6","@7","@8","extends_interfaces",
757 "interface_body","interface_member_declarations","interface_member_declaration",
758 "constant_declaration","abstract_method_declaration","array_initializer","variable_initializers",
759 "block","block_begin","block_end","block_statements","block_statement","local_variable_declaration_statement",
760 "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
761 "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
762 "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
763 "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups",
764 "switch_block_statement_group","switch_labels","switch_label","while_expression",
765 "while_statement","while_statement_nsi","do_statement_begin","do_statement",
766 "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update",
767 "statement_expression_list","break_statement","continue_statement","return_statement",
768 "throw_statement","synchronized_statement","synchronized","try_statement","catches",
769 "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array",
770 "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression",
771 "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access",
772 "postfix_expression","post_increment_expression","post_decrement_expression",
773 "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus",
774 "cast_expression","multiplicative_expression","additive_expression","shift_expression",
775 "relational_expression","equality_expression","and_expression","exclusive_or_expression",
776 "inclusive_or_expression","conditional_and_expression","conditional_or_expression",
777 "conditional_expression","assignment_expression","assignment","left_hand_side",
778 "assignment_operator","expression","constant_expression", NULL
779 };
780 #endif
781
782 static const short yyr1[] = { 0,
783 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
784 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
785 118, 118, 119, 119, 120, 121, 122, 123, 123, 123,
786 123, 123, 123, 123, 123, 124, 124, 125, 125, 126,
787 126, 126, 127, 127, 128, 128, 128, 129, 129, 129,
788 130, 130, 130, 130, 131, 131, 133, 132, 134, 132,
789 132, 132, 132, 132, 135, 135, 135, 135, 136, 136,
790 136, 137, 137, 137, 138, 138, 139, 139, 140, 140,
791 140, 140, 141, 141, 141, 141, 142, 142, 143, 143,
792 143, 144, 144, 144, 144, 145, 145, 145, 145, 145,
793 146, 146, 148, 147, 147, 149, 149, 149, 149, 149,
794 149, 149, 149, 149, 150, 150, 150, 150, 150, 151,
795 151, 151, 152, 152, 152, 152, 153, 153, 153, 154,
796 154, 154, 155, 155, 155, 156, 156, 157, 159, 158,
797 160, 160, 161, 161, 162, 162, 162, 162, 163, 163,
798 163, 163, 164, 164, 166, 165, 167, 165, 168, 165,
799 169, 165, 165, 165, 170, 170, 170, 170, 171, 171,
800 172, 172, 173, 173, 173, 173, 174, 175, 175, 176,
801 176, 176, 177, 177, 177, 178, 178, 179, 180, 181,
802 181, 182, 182, 182, 183, 184, 184, 185, 185, 185,
803 185, 185, 185, 186, 186, 186, 186, 186, 187, 187,
804 187, 187, 187, 187, 187, 187, 187, 187, 187, 188,
805 189, 190, 190, 191, 192, 192, 192, 192, 192, 192,
806 192, 192, 192, 192, 192, 192, 192, 193, 193, 193,
807 193, 193, 193, 193, 194, 194, 194, 194, 195, 196,
808 198, 197, 199, 199, 199, 199, 200, 200, 200, 200,
809 201, 201, 202, 203, 203, 204, 204, 204, 204, 204,
810 205, 206, 206, 206, 206, 207, 208, 209, 210, 210,
811 210, 210, 210, 211, 211, 212, 212, 212, 213, 214,
812 214, 214, 214, 215, 215, 216, 216, 216, 217, 217,
813 217, 217, 218, 218, 218, 218, 219, 219, 219, 219,
814 220, 220, 220, 221, 221, 221, 221, 221, 222, 223,
815 223, 223, 223, 224, 224, 225, 226, 226, 226, 226,
816 227, 227, 228, 228, 229, 229, 229, 229, 229, 229,
817 229, 229, 229, 229, 229, 229, 229, 229, 229, 230,
818 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
819 230, 230, 230, 231, 231, 232, 232, 232, 233, 233,
820 233, 233, 233, 233, 233, 233, 234, 234, 235, 235,
821 235, 236, 236, 236, 237, 237, 237, 238, 238, 238,
822 238, 238, 238, 238, 238, 239, 239, 239, 239, 239,
823 239, 240, 240, 240, 240, 241, 242, 243, 243, 243,
824 243, 243, 243, 243, 244, 244, 245, 245, 246, 246,
825 246, 246, 246, 246, 247, 247, 247, 247, 247, 247,
826 247, 247, 247, 248, 248, 248, 248, 248, 248, 248,
827 249, 249, 249, 249, 249, 250, 250, 250, 250, 250,
828 250, 250, 251, 251, 251, 251, 251, 251, 251, 251,
829 251, 251, 251, 252, 252, 252, 252, 252, 253, 253,
830 253, 254, 254, 254, 255, 255, 255, 256, 256, 256,
831 257, 257, 257, 258, 258, 258, 258, 258, 259, 259,
832 260, 260, 261, 261, 261, 262, 262, 263, 264
833 };
834
835 static const short yyr2[] = { 0,
836 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
837 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
838 3, 3, 1, 1, 1, 3, 1, 0, 1, 1,
839 1, 2, 2, 2, 3, 1, 2, 1, 2, 3,
840 2, 3, 1, 1, 3, 2, 3, 5, 4, 5,
841 1, 1, 1, 1, 1, 2, 0, 7, 0, 6,
842 3, 2, 3, 4, 0, 2, 3, 2, 0, 2,
843 2, 1, 3, 3, 2, 3, 1, 2, 1, 1,
844 1, 1, 1, 1, 1, 1, 3, 4, 1, 3,
845 3, 1, 3, 3, 4, 1, 3, 2, 3, 3,
846 1, 1, 0, 3, 2, 3, 3, 4, 4, 2,
847 3, 2, 3, 2, 3, 4, 3, 3, 3, 1,
848 3, 3, 2, 3, 2, 3, 0, 2, 2, 1,
849 3, 3, 1, 2, 1, 2, 3, 1, 0, 3,
850 2, 3, 3, 4, 2, 3, 3, 4, 4, 5,
851 7, 6, 1, 1, 0, 4, 0, 5, 0, 5,
852 0, 6, 3, 4, 2, 3, 2, 3, 2, 3,
853 1, 2, 1, 1, 1, 1, 1, 2, 2, 2,
854 3, 4, 1, 3, 3, 2, 3, 1, 1, 1,
855 2, 1, 1, 1, 2, 2, 3, 1, 1, 1,
856 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
857 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
858 2, 2, 2, 2, 2, 2, 2, 2, 3, 4,
859 4, 5, 4, 5, 6, 7, 6, 1, 1, 1,
860 1, 1, 1, 1, 5, 2, 3, 4, 7, 7,
861 0, 3, 4, 2, 3, 5, 2, 3, 3, 4,
862 1, 2, 2, 1, 2, 3, 2, 2, 3, 2,
863 4, 2, 2, 3, 4, 2, 1, 7, 7, 6,
864 3, 5, 4, 7, 6, 2, 2, 3, 2, 0,
865 1, 1, 2, 0, 1, 1, 3, 3, 2, 3,
866 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
867 3, 2, 3, 5, 5, 2, 4, 3, 1, 3,
868 3, 4, 2, 1, 2, 2, 4, 2, 3, 4,
869 2, 2, 1, 1, 1, 1, 3, 1, 1, 1,
870 1, 3, 3, 3, 3, 3, 3, 3, 3, 5,
871 4, 6, 5, 4, 5, 5, 6, 3, 3, 4,
872 5, 2, 3, 3, 3, 1, 3, 3, 3, 3,
873 4, 4, 4, 4, 3, 3, 1, 2, 3, 3,
874 2, 2, 3, 3, 3, 3, 2, 3, 4, 5,
875 6, 5, 6, 4, 4, 4, 4, 3, 4, 3,
876 4, 1, 1, 1, 1, 2, 2, 1, 1, 2,
877 2, 1, 2, 2, 2, 2, 2, 2, 1, 2,
878 2, 1, 2, 2, 5, 4, 4, 5, 4, 2,
879 5, 4, 5, 1, 3, 3, 3, 3, 3, 3,
880 1, 3, 3, 3, 3, 1, 3, 3, 3, 3,
881 3, 3, 1, 3, 3, 3, 3, 3, 3, 3,
882 3, 3, 3, 1, 3, 3, 3, 3, 1, 3,
883 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
884 1, 3, 3, 1, 5, 4, 3, 5, 1, 1,
885 3, 3, 1, 1, 1, 1, 1, 1, 1
886 };
887
888 static const short yydefact[] = { 0,
889 54, 55, 0, 0, 0, 0, 53, 1, 0, 0,
890 0, 36, 43, 44, 38, 0, 51, 52, 46, 27,
891 0, 23, 24, 25, 0, 62, 0, 41, 0, 0,
892 37, 39, 0, 0, 56, 0, 0, 47, 45, 0,
893 163, 0, 0, 159, 63, 0, 69, 42, 40, 0,
894 0, 0, 61, 0, 49, 0, 26, 167, 17, 165,
895 15, 0, 156, 0, 0, 68, 16, 0, 0, 59,
896 164, 0, 161, 64, 69, 50, 48, 12, 0, 10,
897 11, 169, 0, 8, 9, 13, 14, 15, 0, 175,
898 177, 0, 176, 0, 171, 173, 174, 168, 166, 160,
899 67, 71, 72, 70, 0, 158, 0, 57, 112, 0,
900 127, 110, 0, 0, 89, 92, 127, 0, 0, 0,
901 114, 0, 0, 179, 178, 170, 172, 0, 0, 60,
902 162, 0, 0, 0, 0, 107, 98, 87, 0, 0,
903 0, 0, 106, 21, 18, 22, 20, 19, 113, 127,
904 111, 0, 127, 74, 73, 55, 188, 75, 23, 0,
905 85, 0, 77, 79, 83, 84, 0, 80, 0, 81,
906 139, 127, 86, 82, 0, 58, 118, 115, 0, 0,
907 0, 120, 129, 130, 128, 119, 117, 91, 0, 90,
908 94, 0, 0, 0, 0, 0, 0, 0, 336, 0,
909 0, 0, 0, 6, 5, 2, 3, 4, 7, 335,
910 0, 403, 0, 102, 402, 333, 338, 0, 334, 339,
911 340, 341, 419, 404, 405, 434, 408, 409, 412, 422,
912 441, 446, 453, 464, 469, 472, 475, 478, 481, 484,
913 489, 498, 490, 0, 101, 99, 97, 100, 109, 88,
914 108, 186, 0, 127, 76, 78, 105, 0, 136, 0,
915 141, 0, 55, 0, 0, 277, 0, 0, 0, 0,
916 0, 0, 0, 0, 336, 0, 220, 0, 8, 403,
917 0, 0, 194, 0, 209, 0, 190, 192, 0, 193,
918 198, 210, 0, 199, 211, 0, 200, 201, 212, 251,
919 0, 202, 0, 213, 203, 290, 0, 214, 215, 216,
920 218, 217, 0, 219, 244, 243, 0, 241, 242, 239,
921 240, 238, 125, 123, 0, 116, 0, 0, 413, 403,
922 339, 341, 410, 414, 411, 418, 417, 416, 415, 0,
923 387, 0, 0, 0, 16, 0, 423, 420, 424, 421,
924 430, 0, 403, 0, 180, 183, 0, 0, 0, 0,
925 0, 95, 0, 0, 362, 0, 407, 406, 0, 0,
926 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
927 0, 0, 0, 0, 0, 0, 0, 0, 0, 496,
928 497, 0, 143, 0, 142, 135, 104, 133, 137, 188,
929 140, 0, 227, 228, 226, 246, 0, 312, 0, 301,
930 299, 0, 309, 307, 0, 273, 0, 254, 0, 323,
931 0, 287, 0, 305, 303, 0, 0, 196, 0, 0,
932 223, 221, 0, 0, 189, 187, 191, 195, 319, 403,
933 222, 225, 0, 272, 0, 403, 0, 292, 296, 289,
934 0, 0, 316, 0, 126, 124, 122, 121, 132, 131,
935 349, 344, 0, 386, 376, 375, 358, 0, 369, 377,
936 0, 370, 0, 359, 0, 0, 0, 0, 0, 0,
937 346, 337, 181, 0, 348, 343, 388, 0, 366, 398,
938 0, 347, 342, 364, 345, 365, 385, 400, 0, 363,
939 0, 438, 435, 439, 436, 440, 437, 444, 442, 445,
940 443, 450, 447, 451, 448, 452, 449, 460, 455, 462,
941 457, 459, 454, 461, 456, 463, 0, 458, 467, 465,
942 468, 466, 471, 470, 474, 473, 477, 476, 480, 479,
943 483, 482, 487, 0, 0, 492, 491, 144, 134, 403,
944 0, 0, 145, 0, 247, 0, 313, 311, 302, 300,
945 310, 308, 274, 0, 255, 0, 0, 0, 320, 324,
946 0, 321, 288, 306, 304, 337, 0, 197, 229, 0,
947 0, 0, 252, 0, 293, 0, 281, 0, 0, 318,
948 0, 394, 395, 0, 381, 382, 0, 378, 371, 0,
949 374, 372, 373, 360, 351, 0, 432, 426, 429, 0,
950 0, 427, 185, 182, 184, 389, 0, 399, 396, 0,
951 401, 397, 354, 0, 486, 0, 0, 146, 0, 0,
952 147, 248, 0, 275, 271, 0, 328, 0, 332, 331,
953 325, 322, 326, 233, 0, 230, 231, 0, 0, 0,
954 257, 0, 261, 0, 264, 0, 298, 297, 283, 0,
955 295, 0, 317, 0, 392, 0, 380, 379, 384, 383,
956 353, 361, 350, 431, 425, 433, 428, 368, 367, 390,
957 0, 355, 356, 488, 485, 0, 148, 0, 0, 0,
958 245, 0, 198, 0, 205, 206, 0, 207, 208, 0,
959 256, 329, 0, 234, 0, 0, 232, 270, 267, 268,
960 499, 0, 259, 262, 0, 258, 0, 265, 0, 0,
961 282, 0, 315, 314, 393, 352, 391, 357, 0, 149,
962 0, 0, 0, 224, 276, 0, 330, 327, 237, 235,
963 0, 269, 266, 260, 0, 280, 0, 0, 0, 150,
964 0, 249, 0, 0, 236, 278, 279, 152, 0, 0,
965 0, 0, 151, 0, 0, 0, 0, 285, 0, 250,
966 284, 0, 0, 0
967 };
968
969 static const short yydefgoto[] = { 772,
970 210, 278, 211, 85, 86, 68, 60, 87, 212, 22,
971 23, 24, 8, 9, 10, 11, 12, 13, 14, 15,
972 282, 283, 132, 105, 47, 70, 104, 130, 162, 163,
973 164, 91, 114, 115, 116, 213, 166, 258, 92, 111,
974 181, 182, 136, 185, 397, 168, 169, 170, 260, 171,
975 172, 401, 551, 284, 18, 43, 72, 65, 107, 44,
976 63, 94, 95, 96, 97, 214, 357, 285, 175, 436,
977 717, 287, 288, 289, 290, 692, 291, 292, 293, 294,
978 695, 295, 296, 297, 298, 696, 299, 443, 300, 583,
979 652, 653, 654, 655, 301, 302, 698, 303, 304, 305,
980 699, 306, 307, 450, 660, 661, 308, 309, 310, 311,
981 312, 313, 314, 569, 570, 571, 572, 215, 216, 217,
982 218, 488, 219, 469, 470, 471, 220, 221, 222, 223,
983 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
984 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
985 244, 392, 489, 712
986 };
987
988 static const short yypact[] = { 456,
989 -32768,-32768, 92, -32, 361, 363,-32768,-32768, 208, 445,
990 525,-32768,-32768,-32768,-32768, 617,-32768,-32768,-32768,-32768,
991 18,-32768,-32768,-32768, 45,-32768, 293,-32768, 22, 558,
992 -32768,-32768, 538, 571,-32768, -32, 405,-32768,-32768, 479,
993 -32768, 421, 11, 164,-32768, 432, 182,-32768,-32768, -32,
994 643, 329,-32768, 341,-32768, 59,-32768,-32768,-32768,-32768,
995 194, 968,-32768, 468, 11,-32768,-32768, 20, 471,-32768,
996 -32768, 11, 164,-32768, 182,-32768,-32768,-32768, 476,-32768,
997 -32768,-32768, 504, 373,-32768,-32768, 419, -79, 779,-32768,
998 -32768, 61,-32768, 988,-32768,-32768,-32768,-32768,-32768,-32768,
999 -32768,-32768,-32768, 440, 466,-32768, 11,-32768,-32768, 473,
1000 4,-32768, 143, -25,-32768, 722, 4, 39, 77, 475,
1001 -32768, 518, 520,-32768,-32768,-32768,-32768, 526, 860,-32768,
1002 -32768, 466, 615, 531, 84,-32768,-32768,-32768, 562, 2071,
1003 87, 582,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 4,
1004 -32768, 362, 4,-32768,-32768, 519, 502,-32768, 529, 779,
1005 -32768, 872,-32768,-32768,-32768,-32768, 19,-32768, 536,-32768,
1006 -32768, 670,-32768,-32768, 1798,-32768,-32768,-32768, 583, 893,
1007 10,-32768,-32768,-32768, 634,-32768,-32768,-32768, 317,-32768,
1008 -32768, 2818, 2883, 2934, 2999, 645, 34, 586,-32768, 3050,
1009 3115, 3166, 5306,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1010 652, 795, 29,-32768, 655, 661,-32768, 587,-32768, 461,
1011 -32768, 694, 833,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1012 946, 887, 962, 806, 897, 767, 784, 786, 799, 596,
1013 -32768,-32768,-32768, 832,-32768,-32768,-32768,-32768,-32768,-32768,
1014 -32768,-32768, 826, 670,-32768,-32768,-32768, 150, 718, 727,
1015 -32768, 773, 246, 304, 3231,-32768, 186, 2122, 23, 320,
1016 336, 93, 345, 230, 742, 5603,-32768, -32, 385, 843,
1017 714, 990,-32768, 746,-32768, 1730,-32768,-32768, 751,-32768,
1018 -32768,-32768, 1866,-32768,-32768, 754,-32768,-32768,-32768,-32768,
1019 1866,-32768, 1866,-32768,-32768, 5654, 761,-32768,-32768,-32768,
1020 -32768,-32768, 347,-32768, 758, 788, 833, 920, 928,-32768,
1021 -32768,-32768,-32768, 898, 588,-32768, 697, 590,-32768, 606,
1022 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 217,
1023 -32768, 595, 883, 745, 745, 349,-32768,-32768,-32768,-32768,
1024 -32768, 747, 989, 260,-32768,-32768, 625, 291, 5371, 3282,
1025 780,-32768, 442, 3347,-32768, 388,-32768,-32768, 3398, 3463,
1026 3514, 3579, 3630, 3695, 3746, 3811, 3862, 3927, 3978, 4043,
1027 688, 4094, 4159, 4210, 4275, 4326, 4391, 4442, 2187,-32768,
1028 -32768, 4507,-32768, 253,-32768,-32768,-32768, 763,-32768,-32768,
1029 -32768, 1730,-32768,-32768,-32768,-32768, 4558,-32768, 66,-32768,
1030 -32768, 95,-32768,-32768, 97,-32768, 4623,-32768, 4674,-32768,
1031 711,-32768, 5088,-32768,-32768, 104, 261, 757, 2238, 457,
1032 -32768,-32768, -32, 2303,-32768,-32768,-32768,-32768,-32768, 1007,
1033 -32768,-32768, 750,-32768, 805, 901, 893,-32768,-32768,-32768,
1034 111, 2354,-32768, 4739,-32768, 898,-32768,-32768,-32768,-32768,
1035 -32768,-32768, -38, 781,-32768,-32768,-32768, 2419, 745,-32768,
1036 557, 745, 557,-32768, 2470, 4790, 179, 614, 2535, 642,
1037 -32768, 5679,-32768, 2006,-32768,-32768,-32768, 556,-32768,-32768,
1038 219,-32768,-32768,-32768,-32768,-32768, 790,-32768, 229,-32768,
1039 5422,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 946,-32768,
1040 946,-32768, 887,-32768, 887,-32768, 887,-32768, 962,-32768,
1041 962,-32768, 962,-32768, 962,-32768, 373,-32768,-32768, 806,
1042 -32768, 806,-32768, 897,-32768, 767,-32768, 784,-32768, 786,
1043 -32768, 799,-32768, 894, 809,-32768,-32768,-32768,-32768, 924,
1044 1730, 807,-32768, 1730,-32768, 265,-32768,-32768,-32768,-32768,
1045 -32768,-32768,-32768, 301,-32768, 808, 390, 215, 711,-32768,
1046 536,-32768,-32768,-32768,-32768,-32768, 401, 757,-32768, 904,
1047 47, 532,-32768, 814,-32768, 5222,-32768, 5113, 810, 824,
1048 836,-32768,-32768, 5487,-32768,-32768, 243,-32768, 829, 245,
1049 -32768, 829,-32768,-32768, 466, 69,-32768,-32768,-32768, 4855,
1050 5264,-32768,-32768,-32768,-32768,-32768, 4906,-32768,-32768, 5538,
1051 -32768,-32768, 466, 602,-32768, 4971, 657,-32768, 1730, 2586,
1052 -32768,-32768, 1932,-32768,-32768, 224,-32768, 705,-32768,-32768,
1053 -32768,-32768,-32768,-32768, 2651,-32768,-32768, 931, 333, 5022,
1054 -32768, 669,-32768, 1507,-32768, 5603,-32768,-32768,-32768, 869,
1055 890, 5155,-32768, 225,-32768, 619,-32768,-32768,-32768,-32768,
1056 -32768,-32768, 466,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1057 743,-32768, 466,-32768,-32768, 409,-32768, 133, 112, 417,
1058 -32768, 927, 945, 1932,-32768,-32768, 1932,-32768,-32768, 906,
1059 -32768, 914, 925,-32768, 1013, 154,-32768,-32768,-32768,-32768,
1060 -32768, 360,-32768,-32768, 1580,-32768, 1654,-32768, 936, 1866,
1061 -32768, 937,-32768,-32768,-32768,-32768,-32768,-32768, 2702,-32768,
1062 200, 4558, 1866,-32768,-32768, 2767,-32768,-32768,-32768,-32768,
1063 1036,-32768,-32768,-32768, 940,-32768, 1866, 223, 214,-32768,
1064 332,-32768, 5113, 949,-32768,-32768,-32768,-32768, 227, 1932,
1065 950, 5155,-32768, 995, 1932, 958, 1932,-32768, 1932,-32768,
1066 -32768, 1056, 1061,-32768
1067 };
1068
1069 static const short yypgoto[] = {-32768,
1070 -32768, -60, -53, 681, -31, -121, 565,-32768, -3, 566,
1071 -32768, 134,-32768, 1054, 630,-32768, 218,-32768,-32768, 759,
1072 17, 441,-32768,-32768, 1024, 1008,-32768, -127,-32768, 930,
1073 -32768, 331, -122, 948, -173, -191,-32768,-32768, 379, 498,
1074 840, -323, -101,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1075 935,-32768,-32768, 695, -30,-32768,-32768,-32768,-32768, 1050,
1076 503,-32768, 1011,-32768,-32768, 14,-32768, -104, 846, -349,
1077 -165, -278,-32768, 803, -15, 115, -546,-32768, -429,-32768,
1078 -32768,-32768, -299,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1079 -32768, 458, 459, -623, -362,-32768,-32768,-32768,-32768,-32768,
1080 -32768,-32768, -337,-32768, -620, 811,-32768,-32768,-32768,-32768,
1081 -32768,-32768,-32768,-32768, 543,-32768, 544,-32768,-32768, -120,
1082 -32768, -339,-32768, 769, 279, -308, 1141, 244, 1161, 374,
1083 434, 491, -111, 515, 683, -468,-32768, 627, 684, 570,
1084 641, 731, 733, 730, 732, 734,-32768, 497, 737, 740,
1085 -32768,-32768, 36,-32768
1086 };
1087
1088
1089 #define YYLAST 5788
1090
1091
1092 static const short yytable[] = { 21,
1093 152, 83, 29, 458, 176, 324, 449, 437, 84, 286,
1094 59, 356, 184, 612, 67, 143, 16, 120, 38, 257,
1095 101, 50, 48, 341, 174, 16, 16, 16, 123, 362,
1096 718, 93, 59, 83, 341, 84, 473, 59, 61, 144,
1097 84, 722, 61, 478, 480, 41, 16, 647, 249, 16,
1098 16, 251, 553, 20, 315, 592, 134, 174, 88, 76,
1099 61, 124, 593, 93, 259, 61, 557, 16, 83, 672,
1100 261, -66, 179, 138, 139, 84, 346, 146, 89, 84,
1101 333, 335, 337, 339, 186, 88, 693, 246, 348, 350,
1102 88, 718, 19, 420, 581, 559, 59, 561, 173, 123,
1103 135, 83, 67, 326, 574, 62, 84, 42, 84, 327,
1104 89, 585, 647, -103, -66, -154, 39, -103, 40, 325,
1105 49, 279, 50, 342, 61, 88, 84, -93, -93, 88,
1106 61, 173, 761, 646, 342, 606, 145, 25, 27, -155,
1107 648, 766, 677, 137, 344, 160, 617, 693, 352, 180,
1108 693, 456, 395, 398, 740, 428, 88, 77, 88, 125,
1109 599, 624, 673, 602, 558, 315, 345, 421, 617, 52,
1110 54, 280, 315, 57, 147, 245, 88, 20, 160, 609,
1111 315, 187, 315, 57, 247, 315, 410, 157, 330, 330,
1112 330, 330, 179, 560, 61, 562, 330, 330, 353, 84,
1113 707, 628, 575, 694, 631, 731, 460, -30, 1, -291,
1114 586, 617, 110, 693, 740, 639, 113, 461, 693, 618,
1115 693, 433, 693, 739, 701, 723, 31, 755, 84, 621,
1116 424, 730, 279, 69, -96, 133, 554, 354, 245, -96,
1117 -96, -96, -96, 667, 157, 669, -319, 741, 396, 88,
1118 31, 2, 279, 617, 666, 110, 113, 503, 505, 507,
1119 481, 481, 3, 64, 694, 632, 179, 694, 4, 180,
1120 697, 20, 189, 84, 5, 437, 596, 441, 88, 687,
1121 681, 315, 280, 462, 411, 444, 658, 445, 449, 440,
1122 689, 485, 615, 45, 50, 700, 67, 440, 750, 440,
1123 409, 634, 446, 415, 406, 706, 7, 759, 281, 157,
1124 578, 427, 189, 617, 703, 20, 619, 137, -253, 157,
1125 416, 758, 447, 88, 61, 763, 622, 527, 425, 71,
1126 694, 697, 632, 708, 697, 694, 418, 694, -319, 694,
1127 668, 74, 670, 180, -65, 422, 548, 453, 279, 474,
1128 437, 366, 327, 482, 576, 46, 700, 486, 633, 700,
1129 742, 26, 449, 28, 608, 330, 330, 330, 330, 330,
1130 330, 330, 330, 330, 330, 330, 330, 88, 330, 330,
1131 330, 330, 330, 330, 330, 629, 433, -65, 500, 749,
1132 637, 42, -65, 84, 635, 491, 407, 697, 550, 499,
1133 412, 644, 697, 46, 697, 53, 697, 426, -96, 644,
1134 -96, 189, 417, -96, -96, -96, -96, 406, 316, 281,
1135 709, 58, 700, -157, 545, 760, 281, 700, 419, 700,
1136 315, 700, 66, 315, 281, -65, 281, 423, 437, 454,
1137 17, 475, 556, 88, -31, 1, 20, 743, 20, 17,
1138 17, 17, 564, 449, 566, -28, 1, 492, 189, 165,
1139 250, 139, 449, 640, 491, 315, 643, 315, 98, 118,
1140 17, 102, 330, 17, 17, 464, 109, 671, 330, 55,
1141 501, 118, 638, 56, 601, 358, 603, 589, 2, 591,
1142 20, 17, 165, 645, 57, 682, 497, 279, 675, 2,
1143 279, 729, 90, 597, 112, 4, 20, 167, 315, 732,
1144 3, 5, 315, 496, 491, 119, 4, 20, 149, 245,
1145 151, 577, 5, 493, -29, 1, 154, 20, 494, 316,
1146 6, 183, 495, 315, 90, 281, 316, -32, 1, 128,
1147 167, 315, 20, 7, 316, 726, 316, 280, 317, 316,
1148 280, -494, -494, 20, 7, 728, 20, -34, 1, 724,
1149 129, 20, 188, 57, 20, 133, 189, 100, 2, 161,
1150 -33, 1, 148, 315, 106, 279, 315, 179, 649, 3,
1151 117, 2, 248, 323, 84, 4, 343, 365, 455, 20,
1152 459, 5, 3, 650, 315, 463, 315, 252, 4, 315,
1153 279, 2, 161, 20, 5, 20, 330, 330, 318, 131,
1154 388, 20, 315, -138, 2, 177, 20, 691, 4, 150,
1155 153, 253, 330, 7, 5, 280, 315, 651, 99, 440,
1156 157, 4, 315, 103, 88, 78, 7, 5, 30, 315,
1157 34, 315, -35, 1, 315, 316, 315, 20, 315, 616,
1158 280, 203, 679, 600, 180, 617, 7, 492, 2, 317,
1159 35, 279, 51, 279, 78, 319, 317, 80, 20, 7,
1160 81, 20, 20, 20, 317, 20, 317, 36, 441, 317,
1161 20, 444, 389, 37, 281, 711, 2, 281, 526, 320,
1162 440, 719, 155, 440, 159, 683, 80, 457, 359, 81,
1163 20, 617, 360, 4, 746, 702, 361, 610, 178, 5,
1164 600, 280, 725, 280, 431, 649, 440, 752, 617, 318,
1165 483, 686, 134, 493, 484, 159, 318, 159, 494, 440,
1166 650, 757, 495, 328, 318, 611, 318, 78, 600, 318,
1167 2, 7, 20, 440, 691, 340, 78, 598, 2, 746,
1168 598, 752, 358, 757, 78, 363, 440, 364, -25, -25,
1169 57, 440, 281, 440, 713, 440, 281, 751, 32, 80,
1170 567, 754, 81, 20, 568, 317, 319, 384, 80, 121,
1171 492, 81, 20, 319, -495, -495, 80, 281, 32, 81,
1172 20, 319, 32, 319, 316, 385, 319, 316, 386, -25,
1173 320, 432, -338, -338, -25, -25, -25, 320, 734, 32,
1174 -25, 735, 387, 140, -25, 320, 399, 320, 141, 142,
1175 320, 400, 35, 377, 378, 379, 380, 281, 78, 316,
1176 281, 316, -340, -340, -153, 318, 727, 122, 434, 36,
1177 476, 468, 617, 477, 582, 37, 493, 358, 281, 438,
1178 281, 494, 442, 281, -338, 495, 139, 321, -338, 452,
1179 80, 549, 381, 81, 20, 20, 281, 403, 404, 2,
1180 584, 405, 316, 594, 764, 78, 316, 367, 368, 768,
1181 281, 770, 620, 771, -340, -493, -493, 359, -340, 372,
1182 373, 360, 319, 281, 625, 361, 626, 316, 281, 630,
1183 281, 636, 281, 156, 646, 316, 656, 80, 662, 78,
1184 81, 20, 382, 383, 322, 156, 320, 663, 79, 393,
1185 4, 78, 390, 391, 317, 600, 5, 317, -15, 664,
1186 79, 707, 4, -493, -493, 359, 35, 316, 5, 429,
1187 316, 80, 78, 430, 81, 20, 519, 521, 523, 525,
1188 369, 370, 371, 80, 157, 158, 81, 20, 316, 317,
1189 316, 317, 720, 316, -404, -404, 157, 255, 321, 374,
1190 375, 376, -405, -405, 80, 321, 316, 81, 20, 465,
1191 466, 467, 733, 321, 318, 321, -15, 318, 321, 586,
1192 316, -493, -493, 359, 141, 142, 316, 429, 509, 511,
1193 -204, 361, 317, 316, 736, 316, 317, 737, 316, -15,
1194 316, 2, 316, 739, -493, -493, 359, 78, 738, 318,
1195 429, 318, 530, 532, 627, 322, 79, 317, 4, 745,
1196 747, 2, 322, 35, 5, 317, 755, 78, 756, 78,
1197 322, 319, 322, 765, 319, 322, 79, 762, 4, 80,
1198 767, 769, 81, 20, 5, 773, 37, 513, 515, 517,
1199 774, 528, 318, 82, 33, 320, 318, 317, 320, 80,
1200 317, 80, 81, 20, 81, 20, 319, 75, 319, -493,
1201 -493, 359, 108, 126, 321, 479, 190, 318, 317, 361,
1202 317, 256, 394, 317, 254, 318, 552, -493, -493, 359,
1203 320, 73, 320, 360, 127, 402, 317, 430, 448, 714,
1204 715, 641, 642, 472, 534, 538, 451, 536, 540, 319,
1205 317, 542, 685, 319, 0, 0, 317, 318, 547, 0,
1206 318, 0, 0, 317, 0, 317, 0, 0, 317, 0,
1207 317, 322, 317, 320, 319, 0, 0, 320, 318, 0,
1208 318, 0, 319, 318, 0, 0, 0, 0, 0, 0,
1209 0, 0, 0, 0, 0, 0, 318, 0, 320, 0,
1210 0, 0, 0, 0, 0, 0, 320, 0, 0, 0,
1211 318, 0, 0, 0, 319, 0, 318, 319, 0, 0,
1212 0, 0, 0, 318, 0, 318, 0, 0, 318, 0,
1213 318, 0, 318, 0, 0, 319, 0, 319, 320, 0,
1214 319, 320, 0, 0, 0, 0, 0, 0, 0, 0,
1215 0, 0, 0, 319, 0, 0, 0, 0, 0, 320,
1216 0, 320, 0, 321, 320, 0, 321, 319, 0, 0,
1217 0, 0, 0, 319, 0, 0, 0, 320, 0, 0,
1218 319, 0, 319, 0, 0, 319, 0, 319, 0, 319,
1219 0, 320, 0, 0, 0, 0, 0, 320, 321, 0,
1220 321, 0, 0, 0, 320, 0, 320, 0, 0, 320,
1221 0, 320, 0, 320, 0, 0, 0, 0, 0, 0,
1222 322, 0, 0, 322, 0, 0, 0, 0, 0, 0,
1223 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1224 0, 321, 0, 0, 0, 321, 0, 0, 0, 0,
1225 0, 0, 0, 0, 0, 322, 0, 322, 0, 0,
1226 0, 0, 331, 331, 331, 331, 321, 0, 0, 0,
1227 331, 331, 0, 0, 321, 0, 0, 0, 0, 0,
1228 0, 0, 332, 332, 332, 332, 0, 0, 0, 0,
1229 332, 332, 0, 0, 0, 0, 0, 0, 322, 0,
1230 0, 0, 322, 0, 0, 0, 321, 0, 0, 321,
1231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1232 0, 0, 0, 322, 0, 0, 0, 321, 0, 321,
1233 0, 322, 321, 0, 0, 0, 0, 0, 0, 0,
1234 0, 0, 0, 0, 0, 321, 0, 0, 0, 0,
1235 0, 0, 0, 0, 0, 0, 0, 0, 0, 321,
1236 0, 0, 0, 322, 0, 321, 322, 0, 0, 0,
1237 0, 0, 321, 0, 321, 0, 0, 321, 0, 321,
1238 0, 321, 0, 0, 322, 0, 322, 0, 0, 322,
1239 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1240 0, 0, 322, 0, 0, 0, 0, 0, 0, 0,
1241 0, 0, 0, 0, 0, 0, 322, 0, 0, 0,
1242 0, 0, 322, 0, 0, 0, 0, 0, 0, 322,
1243 0, 322, 0, 0, 322, 0, 322, 262, 322, 331,
1244 331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
1245 331, 0, 331, 331, 331, 331, 331, 331, 331, 332,
1246 332, 332, 332, 332, 332, 332, 332, 332, 332, 332,
1247 332, 0, 332, 332, 332, 332, 332, 332, 332, 0,
1248 263, 194, 195, 649, 264, 265, 78, 266, 0, 0,
1249 267, 0, 0, 0, 268, 196, 0, 0, 650, 0,
1250 0, 269, 270, 5, 271, 0, 272, 273, 198, 274,
1251 262, 0, 275, 0, 0, 0, 0, 0, 80, 0,
1252 0, 81, 20, 0, 0, 0, 0, 0, 0, 276,
1253 0, 157, 716, 0, 0, 277, 0, 0, 204, 205,
1254 206, 207, 0, 0, 208, 209, 331, 0, 0, 0,
1255 0, 0, 331, 263, 194, 195, 649, 264, 265, 78,
1256 266, 0, 0, 267, 0, 0, 332, 268, 196, 0,
1257 0, 650, 332, 0, 269, 270, 5, 271, 0, 272,
1258 273, 198, 274, 0, 262, 275, 0, 0, 0, 0,
1259 0, 80, 0, 0, 81, 20, 0, 0, 0, 0,
1260 0, 0, 276, 0, 157, 744, 0, 0, 277, 0,
1261 0, 204, 205, 206, 207, 0, 0, 208, 209, 0,
1262 0, 0, 0, 0, 0, 0, 0, 263, 194, 195,
1263 -263, 264, 265, 78, 266, 0, 0, 267, 0, 0,
1264 0, 268, 196, 0, 0, -263, 0, 0, 269, 270,
1265 5, 271, 0, 272, 273, 198, 274, 0, 0, 275,
1266 262, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1267 0, 0, 0, 0, 0, 0, 276, 0, 157, -263,
1268 331, 331, 277, 0, 0, 204, 205, 206, 207, 0,
1269 0, 208, 209, 0, 0, 0, 331, 0, 0, 0,
1270 332, 332, 0, 263, 194, 195, 0, 264, 265, 78,
1271 266, 0, 0, 267, 0, 0, 332, 268, 196, 0,
1272 0, 0, 0, 0, 269, 270, 5, 271, 262, 272,
1273 273, 198, 274, 0, 0, 275, 0, 0, 0, 0,
1274 0, 80, 0, 0, 81, 20, 0, 0, 0, 0,
1275 0, 0, 276, 0, 157, 435, 0, 0, 277, 0,
1276 0, 204, 205, 206, 207, 0, 0, 208, 209, 0,
1277 0, 263, 194, 195, 0, 264, 265, 78, 266, 0,
1278 0, 267, 0, 0, 0, 268, 196, 0, 0, 0,
1279 0, 0, 269, 270, 5, 271, 262, 272, 273, 198,
1280 274, 0, 0, 275, 0, 0, 0, 0, 0, 80,
1281 0, 0, 81, 20, 0, 0, 0, 0, 0, 0,
1282 276, 0, 157, 0, 0, 0, 277, 0, 0, 204,
1283 205, 206, 207, 0, 0, 208, 209, 0, 0, 439,
1284 194, 195, 0, 264, 265, 78, 266, 0, 0, 267,
1285 0, 0, 0, 268, 196, 0, 0, 0, 0, 0,
1286 269, 270, 262, 271, 0, 272, 273, 198, 274, 0,
1287 0, 275, 0, 0, 0, 0, 0, 80, 0, 0,
1288 81, 20, 0, 0, 0, 0, 0, 0, 276, 0,
1289 157, 0, 0, 0, 277, 0, 0, 204, 205, 206,
1290 207, 0, 0, 208, 209, 439, 194, 195, 0, 690,
1291 265, 78, 266, 0, 0, 267, 0, 0, 0, 268,
1292 196, 0, 0, 0, 0, 0, 269, 270, 0, 271,
1293 0, 272, 273, 198, 274, 0, 613, 275, 192, 193,
1294 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1295 0, 0, 0, 0, 276, 0, 157, 0, 0, 0,
1296 277, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1297 209, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1298 194, 195, 0, 0, 0, 78, 0, 0, 0, 0,
1299 0, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1300 197, 191, 0, 192, 193, 0, 0, 198, 0, 0,
1301 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1302 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1303 203, 614, 0, 0, 0, 0, 0, 204, 205, 206,
1304 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1305 78, 0, 413, 0, 192, 193, 0, 0, 0, 196,
1306 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1307 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1308 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1309 201, 0, 0, 202, 0, 203, 194, 195, 0, 0,
1310 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1311 196, 0, 0, 0, 0, 0, 197, 543, 0, 192,
1312 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1313 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1314 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1315 414, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1316 209, 194, 195, 0, 0, 0, 78, 0, 490, 0,
1317 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1318 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1319 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1320 0, 81, 20, 0, 544, 200, 201, 0, 0, 202,
1321 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1322 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1323 0, 0, 197, 579, 0, 192, 193, 0, 0, 198,
1324 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1325 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1326 202, 0, 0, 0, 0, 148, 0, 0, 0, 204,
1327 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1328 0, 0, 78, 0, 587, 0, 192, 193, 0, 0,
1329 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1330 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1331 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1332 0, 200, 201, 0, 0, 202, 580, 0, 194, 195,
1333 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1334 208, 209, 196, 0, 0, 0, 0, 0, 197, 595,
1335 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1336 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1337 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1338 0, 0, 588, 0, 0, 204, 205, 206, 207, 0,
1339 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1340 604, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1341 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1342 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1343 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1344 0, 202, 0, 0, 194, 195, 596, 0, 0, 78,
1345 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1346 0, 0, 0, 0, 197, 490, 0, 192, 193, 0,
1347 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1348 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1349 0, 0, 202, 605, 0, 0, 0, 0, 0, 0,
1350 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1351 195, 0, 0, 0, 78, 0, 579, 0, 192, 193,
1352 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1353 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1354 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1355 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1356 194, 195, 596, 0, 0, 78, 204, 205, 206, 207,
1357 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1358 197, 704, 0, 192, 193, 0, 0, 198, 0, 0,
1359 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1360 81, 20, 0, 0, 200, 201, 0, 0, 202, 688,
1361 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1362 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1363 78, 0, 704, 0, 192, 193, 0, 0, 0, 196,
1364 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1365 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1366 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1367 201, 0, 0, 202, 705, 0, 194, 195, 0, 0,
1368 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1369 196, 0, 0, 0, 0, 0, 197, 587, 0, 192,
1370 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1371 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1372 200, 201, 0, 0, 202, 748, 0, 0, 0, 0,
1373 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1374 209, 194, 195, 0, 0, 0, 78, 0, 329, 0,
1375 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1376 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1377 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1378 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1379 0, 0, 194, 195, 0, 753, 0, 78, 204, 205,
1380 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1381 0, 0, 197, 334, 0, 192, 193, 0, 0, 198,
1382 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1383 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1384 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1385 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1386 0, 0, 78, 0, 336, 0, 192, 193, 0, 0,
1387 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1388 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1389 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1390 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1391 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1392 208, 209, 196, 0, 0, 0, 0, 0, 197, 338,
1393 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1394 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1395 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1396 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1397 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1398 347, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1399 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1400 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1401 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1402 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1403 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1404 0, 0, 0, 0, 197, 349, 0, 192, 193, 0,
1405 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1406 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1407 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1408 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1409 195, 0, 0, 0, 78, 0, 351, 0, 192, 193,
1410 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1411 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1412 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1413 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1414 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1415 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1416 197, 408, 0, 192, 193, 0, 0, 198, 0, 0,
1417 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1418 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1419 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1420 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1421 78, 0, 490, 0, 192, 193, 0, 0, 0, 196,
1422 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1423 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1424 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1425 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1426 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1427 196, 0, 0, 0, 0, 0, 197, 498, 0, 192,
1428 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1429 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1430 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1431 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1432 209, 194, 195, 0, 0, 0, 78, 0, 502, 0,
1433 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1434 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1435 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1436 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1437 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1438 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1439 0, 0, 197, 504, 0, 192, 193, 0, 0, 198,
1440 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1441 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1442 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1443 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1444 0, 0, 78, 0, 506, 0, 192, 193, 0, 0,
1445 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1446 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1447 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1448 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1449 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1450 208, 209, 196, 0, 0, 0, 0, 0, 197, 508,
1451 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1452 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1453 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1454 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1455 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1456 510, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1457 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1458 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1459 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1460 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1461 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1462 0, 0, 0, 0, 197, 512, 0, 192, 193, 0,
1463 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1464 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1465 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1466 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1467 195, 0, 0, 0, 78, 0, 514, 0, 192, 193,
1468 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1469 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1470 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1471 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1472 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1473 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1474 197, 516, 0, 192, 193, 0, 0, 198, 0, 0,
1475 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1476 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1477 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1478 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1479 78, 0, 518, 0, 192, 193, 0, 0, 0, 196,
1480 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1481 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1482 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1483 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1484 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1485 196, 0, 0, 0, 0, 0, 197, 520, 0, 192,
1486 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1487 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1488 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1489 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1490 209, 194, 195, 0, 0, 0, 78, 0, 522, 0,
1491 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1492 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1493 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1494 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1495 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1496 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1497 0, 0, 197, 524, 0, 192, 193, 0, 0, 198,
1498 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1499 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1500 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1501 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1502 0, 0, 78, 0, 529, 0, 192, 193, 0, 0,
1503 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1504 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1505 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1506 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1507 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1508 208, 209, 196, 0, 0, 0, 0, 0, 197, 531,
1509 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1510 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1511 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1512 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1513 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1514 533, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1515 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1516 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1517 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1518 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1519 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1520 0, 0, 0, 0, 197, 535, 0, 192, 193, 0,
1521 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1522 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1523 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1524 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1525 195, 0, 0, 0, 78, 0, 537, 0, 192, 193,
1526 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1527 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1528 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1529 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1530 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1531 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1532 197, 539, 0, 192, 193, 0, 0, 198, 0, 0,
1533 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1534 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1535 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1536 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1537 78, 0, 541, 0, 192, 193, 0, 0, 0, 196,
1538 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1539 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1540 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1541 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1542 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1543 196, 0, 0, 0, 0, 0, 197, 546, 0, 192,
1544 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1545 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1546 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1547 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1548 209, 194, 195, 0, 0, 0, 78, 0, 555, 0,
1549 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1550 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1551 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1552 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1553 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1554 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1555 0, 0, 197, 563, 0, 192, 193, 0, 0, 198,
1556 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1557 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1558 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1559 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1560 0, 0, 78, 0, 565, 0, 192, 193, 0, 0,
1561 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1562 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1563 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1564 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1565 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1566 208, 209, 196, 0, 0, 0, 0, 0, 197, 590,
1567 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1568 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1569 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1570 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1571 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1572 607, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1573 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1574 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1575 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1576 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1577 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1578 0, 0, 0, 0, 197, 674, 0, 192, 193, 0,
1579 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1580 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1581 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1582 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1583 195, 0, 0, 0, 78, 0, 678, 0, 192, 193,
1584 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1585 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1586 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1587 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1588 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1589 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1590 197, 684, 0, 192, 193, 0, 0, 198, 0, 0,
1591 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1592 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1593 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1594 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1595 78, 0, 710, 0, 192, 193, 0, 0, 0, 196,
1596 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1597 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1598 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1599 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1600 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1601 196, 0, 0, 0, 0, 0, 197, 0, 573, 0,
1602 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1603 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1604 200, 201, 0, 659, 202, 0, 0, 0, 0, 0,
1605 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1606 209, -286, -286, -286, 0, 0, 0, -286, 0, 0,
1607 0, 0, 0, 0, 0, 0, -286, 0, 0, 0,
1608 0, 0, -286, 0, 0, 721, 0, 194, 195, -286,
1609 0, 0, 78, -286, 0, 0, 0, 0, 0, -286,
1610 0, 196, -286, -286, 0, 0, 0, 197, 0, 0,
1611 -286, 0, 0, 0, 198, 0, -286, 0, 199, -286,
1612 -286, -286, -286, 0, 80, -286, -286, 81, 20, 194,
1613 195, 0, 0, 0, 78, 276, -294, 0, 0, 0,
1614 0, 0, 0, 196, 204, 205, 206, 207, 0, 197,
1615 208, 209, 657, 0, 0, 0, 198, 0, 0, 0,
1616 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1617 20, 0, 0, 0, 0, 0, 0, 276, -294, 0,
1618 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1619 0, 0, 208, 209, 676, 0, 194, 195, 0, 0,
1620 0, 78, 0, 0, 0, 0, 0, 0, 0, 0,
1621 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1622 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1623 0, 0, 0, 80, 0, 0, 81, 20, 192, 193,
1624 0, 0, 0, 78, 276, 0, 0, 0, 0, 0,
1625 0, 0, 196, 204, 205, 206, 207, 0, 197, 208,
1626 209, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1627 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1628 194, 195, 200, 201, 0, 78, 202, 0, 0, 0,
1629 0, 0, 0, 0, 196, 204, 205, 206, 207, 0,
1630 197, 208, 209, 192, 193, 0, 0, 198, 0, 0,
1631 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1632 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1633 203, 355, 0, 0, 0, 0, 0, 204, 205, 206,
1634 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1635 78, 0, 0, 0, 192, 193, 0, 0, 0, 196,
1636 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1637 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1638 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1639 201, 0, 0, 202, 487, 0, 194, 195, 0, 0,
1640 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1641 196, 0, 0, 0, 0, 0, 197, 0, 0, 192,
1642 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1643 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1644 200, 201, 0, 0, 202, 623, 0, 0, 0, 0,
1645 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1646 209, 194, 195, 0, 0, 0, 78, 0, 0, 0,
1647 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1648 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1649 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1650 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1651 665, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1652 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1653 0, 0, 197, 0, 0, 192, 193, 0, 0, 198,
1654 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1655 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1656 202, 680, 0, 0, 0, 0, 0, 0, 0, 204,
1657 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1658 0, 0, 78, 0, 0, 0, 0, 0, 0, 0,
1659 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1660 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1661 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1662 0, 200, 201, 0, 0, 202, 0, 2, 194, 195,
1663 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1664 208, 209, 196, 0, 0, 0, 0, 0, 197, 0,
1665 0, 0, 0, 0, 0, 198, 0, 0, 78, 199,
1666 0, 0, 0, 0, 0, 80, 0, 196, 81, 20,
1667 0, 0, 0, 197, 0, 0, 276, 0, 0, 0,
1668 198, 0, 0, 0, 199, 204, 205, 206, 207, 0,
1669 80, 208, 209, 81, 20, 0, 0, 200, 201, 0,
1670 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1671 204, 205, 206, 207, 0, 0, 208, 209
1672 };
1673
1674 static const short yycheck[] = { 3,
1675 123, 62, 6, 327, 132, 179, 306, 286, 62, 175,
1676 42, 203, 134, 482, 46, 117, 0, 97, 1, 1,
1677 1, 101, 1, 1, 129, 9, 10, 11, 89, 1,
1678 654, 62, 64, 94, 1, 89, 345, 69, 42, 1,
1679 94, 662, 46, 352, 353, 1, 30, 1, 150, 33,
1680 34, 153, 402, 86, 175, 94, 53, 162, 62, 1,
1681 64, 1, 101, 94, 169, 69, 1, 51, 129, 1,
1682 172, 52, 133, 99, 100, 129, 198, 1, 62, 133,
1683 192, 193, 194, 195, 1, 89, 633, 1, 200, 201,
1684 94, 715, 1, 1, 434, 1, 128, 1, 129, 160,
1685 97, 162, 134, 94, 1, 95, 160, 63, 162, 100,
1686 94, 1, 1, 95, 95, 93, 99, 99, 101, 180,
1687 99, 175, 101, 101, 128, 129, 180, 99, 100, 133,
1688 134, 162, 753, 1, 101, 475, 98, 4, 5, 95,
1689 94, 762, 611, 1, 198, 129, 100, 694, 202, 133,
1690 697, 325, 254, 258, 1, 278, 160, 99, 162, 99,
1691 469, 501, 94, 472, 99, 286, 198, 272, 100, 36,
1692 37, 175, 293, 40, 98, 140, 180, 86, 162, 1,
1693 301, 98, 303, 50, 98, 306, 1, 95, 192, 193,
1694 194, 195, 253, 99, 198, 99, 200, 201, 202, 253,
1695 1, 551, 99, 633, 554, 94, 328, 0, 1, 99,
1696 100, 100, 79, 760, 1, 1, 83, 1, 765, 1,
1697 767, 282, 769, 1, 1, 1, 9, 1, 282, 1,
1698 1, 99, 286, 52, 92, 93, 402, 202, 203, 97,
1699 98, 99, 100, 1, 95, 1, 1, 94, 99, 253,
1700 33, 44, 306, 100, 594, 122, 123, 369, 370, 371,
1701 1, 1, 55, 100, 694, 1, 327, 697, 61, 253,
1702 633, 86, 139, 327, 67, 554, 98, 293, 282, 629,
1703 620, 402, 286, 67, 99, 301, 586, 303, 588, 293,
1704 630, 1, 484, 1, 101, 633, 328, 301, 99, 303,
1705 265, 1, 306, 268, 1, 645, 99, 94, 175, 95,
1706 433, 276, 179, 100, 638, 86, 98, 1, 95, 95,
1707 1, 99, 306, 327, 328, 99, 98, 381, 99, 1,
1708 760, 694, 1, 1, 697, 765, 1, 767, 93, 769,
1709 98, 1, 98, 327, 52, 1, 94, 1, 402, 1,
1710 629, 218, 100, 94, 94, 63, 694, 67, 94, 697,
1711 1, 1, 662, 1, 476, 369, 370, 371, 372, 373,
1712 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
1713 384, 385, 386, 387, 388, 551, 447, 95, 1, 729,
1714 1, 63, 52, 447, 94, 360, 93, 760, 402, 364,
1715 267, 1, 765, 63, 767, 1, 769, 274, 92, 1,
1716 94, 278, 93, 97, 98, 99, 100, 1, 175, 286,
1717 88, 1, 760, 95, 389, 94, 293, 765, 93, 767,
1718 551, 769, 1, 554, 301, 95, 303, 93, 717, 93,
1719 0, 93, 407, 447, 0, 1, 86, 88, 86, 9,
1720 10, 11, 417, 753, 419, 0, 1, 1, 325, 129,
1721 99, 100, 762, 568, 429, 586, 571, 588, 1, 97,
1722 30, 1, 476, 33, 34, 342, 1, 605, 482, 1,
1723 93, 97, 93, 5, 471, 101, 473, 452, 44, 454,
1724 86, 51, 162, 93, 361, 623, 363, 551, 610, 44,
1725 554, 93, 62, 468, 1, 61, 86, 129, 629, 93,
1726 55, 67, 633, 72, 479, 97, 61, 86, 1, 484,
1727 1, 65, 67, 67, 0, 1, 1, 86, 72, 286,
1728 75, 1, 76, 654, 94, 402, 293, 0, 1, 100,
1729 162, 662, 86, 99, 301, 673, 303, 551, 175, 306,
1730 554, 91, 92, 86, 99, 683, 86, 0, 1, 664,
1731 95, 86, 1, 430, 86, 93, 433, 65, 44, 129,
1732 0, 1, 98, 694, 72, 629, 697, 638, 47, 55,
1733 83, 44, 1, 1, 638, 61, 1, 1, 1, 86,
1734 1, 67, 55, 62, 715, 1, 717, 96, 61, 720,
1735 654, 44, 162, 86, 67, 86, 610, 611, 175, 107,
1736 15, 86, 733, 95, 44, 1, 86, 633, 61, 122,
1737 123, 93, 626, 99, 67, 629, 747, 96, 64, 633,
1738 95, 61, 753, 69, 638, 50, 99, 67, 9, 760,
1739 11, 762, 0, 1, 765, 402, 767, 86, 769, 94,
1740 654, 95, 617, 97, 638, 100, 99, 1, 44, 286,
1741 44, 715, 33, 717, 50, 175, 293, 82, 86, 99,
1742 85, 86, 86, 86, 301, 86, 303, 61, 694, 306,
1743 86, 697, 87, 67, 551, 650, 44, 554, 1, 175,
1744 694, 656, 128, 697, 129, 94, 82, 1, 93, 85,
1745 86, 100, 97, 61, 720, 1, 101, 94, 94, 67,
1746 97, 715, 94, 717, 1, 47, 720, 733, 100, 286,
1747 96, 65, 53, 67, 100, 160, 293, 162, 72, 733,
1748 62, 747, 76, 100, 301, 94, 303, 50, 97, 306,
1749 44, 99, 86, 747, 760, 101, 50, 469, 44, 765,
1750 472, 767, 101, 769, 50, 101, 760, 97, 45, 46,
1751 627, 765, 629, 767, 96, 769, 633, 732, 10, 82,
1752 60, 736, 85, 86, 64, 402, 286, 11, 82, 1,
1753 1, 85, 86, 293, 91, 92, 82, 654, 30, 85,
1754 86, 301, 34, 303, 551, 12, 306, 554, 13, 86,
1755 286, 88, 45, 46, 91, 92, 93, 293, 694, 51,
1756 97, 697, 14, 92, 101, 301, 99, 303, 97, 98,
1757 306, 95, 44, 18, 19, 20, 21, 694, 50, 586,
1758 697, 588, 45, 46, 93, 402, 94, 59, 93, 61,
1759 94, 97, 100, 97, 95, 67, 67, 101, 715, 99,
1760 717, 72, 99, 720, 97, 76, 100, 175, 101, 99,
1761 82, 99, 57, 85, 86, 86, 733, 95, 96, 44,
1762 66, 99, 629, 93, 760, 50, 633, 45, 46, 765,
1763 747, 767, 93, 769, 97, 91, 92, 93, 101, 3,
1764 4, 97, 402, 760, 1, 101, 88, 654, 765, 93,
1765 767, 94, 769, 44, 1, 662, 93, 82, 99, 50,
1766 85, 86, 16, 17, 175, 44, 402, 94, 59, 94,
1767 61, 50, 91, 92, 551, 97, 67, 554, 86, 94,
1768 59, 1, 61, 91, 92, 93, 44, 694, 67, 97,
1769 697, 82, 50, 101, 85, 86, 377, 378, 379, 380,
1770 5, 6, 7, 82, 95, 96, 85, 86, 715, 586,
1771 717, 588, 94, 720, 45, 46, 95, 96, 286, 8,
1772 9, 10, 45, 46, 82, 293, 733, 85, 86, 97,
1773 98, 99, 56, 301, 551, 303, 86, 554, 306, 100,
1774 747, 91, 92, 93, 97, 98, 753, 97, 372, 373,
1775 56, 101, 629, 760, 99, 762, 633, 94, 765, 86,
1776 767, 44, 769, 1, 91, 92, 93, 50, 94, 586,
1777 97, 588, 382, 383, 101, 286, 59, 654, 61, 94,
1778 94, 44, 293, 44, 67, 662, 1, 50, 99, 50,
1779 301, 551, 303, 94, 554, 306, 59, 99, 61, 82,
1780 56, 94, 85, 86, 67, 0, 67, 374, 375, 376,
1781 0, 381, 629, 96, 11, 551, 633, 694, 554, 82,
1782 697, 82, 85, 86, 85, 86, 586, 54, 588, 91,
1783 92, 93, 75, 96, 402, 97, 139, 654, 715, 101,
1784 717, 162, 253, 720, 160, 662, 402, 91, 92, 93,
1785 586, 52, 588, 97, 94, 260, 733, 101, 306, 652,
1786 652, 569, 569, 345, 384, 386, 306, 385, 387, 629,
1787 747, 388, 626, 633, -1, -1, 753, 694, 392, -1,
1788 697, -1, -1, 760, -1, 762, -1, -1, 765, -1,
1789 767, 402, 769, 629, 654, -1, -1, 633, 715, -1,
1790 717, -1, 662, 720, -1, -1, -1, -1, -1, -1,
1791 -1, -1, -1, -1, -1, -1, 733, -1, 654, -1,
1792 -1, -1, -1, -1, -1, -1, 662, -1, -1, -1,
1793 747, -1, -1, -1, 694, -1, 753, 697, -1, -1,
1794 -1, -1, -1, 760, -1, 762, -1, -1, 765, -1,
1795 767, -1, 769, -1, -1, 715, -1, 717, 694, -1,
1796 720, 697, -1, -1, -1, -1, -1, -1, -1, -1,
1797 -1, -1, -1, 733, -1, -1, -1, -1, -1, 715,
1798 -1, 717, -1, 551, 720, -1, 554, 747, -1, -1,
1799 -1, -1, -1, 753, -1, -1, -1, 733, -1, -1,
1800 760, -1, 762, -1, -1, 765, -1, 767, -1, 769,
1801 -1, 747, -1, -1, -1, -1, -1, 753, 586, -1,
1802 588, -1, -1, -1, 760, -1, 762, -1, -1, 765,
1803 -1, 767, -1, 769, -1, -1, -1, -1, -1, -1,
1804 551, -1, -1, 554, -1, -1, -1, -1, -1, -1,
1805 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1806 -1, 629, -1, -1, -1, 633, -1, -1, -1, -1,
1807 -1, -1, -1, -1, -1, 586, -1, 588, -1, -1,
1808 -1, -1, 192, 193, 194, 195, 654, -1, -1, -1,
1809 200, 201, -1, -1, 662, -1, -1, -1, -1, -1,
1810 -1, -1, 192, 193, 194, 195, -1, -1, -1, -1,
1811 200, 201, -1, -1, -1, -1, -1, -1, 629, -1,
1812 -1, -1, 633, -1, -1, -1, 694, -1, -1, 697,
1813 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1814 -1, -1, -1, 654, -1, -1, -1, 715, -1, 717,
1815 -1, 662, 720, -1, -1, -1, -1, -1, -1, -1,
1816 -1, -1, -1, -1, -1, 733, -1, -1, -1, -1,
1817 -1, -1, -1, -1, -1, -1, -1, -1, -1, 747,
1818 -1, -1, -1, 694, -1, 753, 697, -1, -1, -1,
1819 -1, -1, 760, -1, 762, -1, -1, 765, -1, 767,
1820 -1, 769, -1, -1, 715, -1, 717, -1, -1, 720,
1821 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1822 -1, -1, 733, -1, -1, -1, -1, -1, -1, -1,
1823 -1, -1, -1, -1, -1, -1, 747, -1, -1, -1,
1824 -1, -1, 753, -1, -1, -1, -1, -1, -1, 760,
1825 -1, 762, -1, -1, 765, -1, 767, 1, 769, 369,
1826 370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
1827 380, -1, 382, 383, 384, 385, 386, 387, 388, 369,
1828 370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
1829 380, -1, 382, 383, 384, 385, 386, 387, 388, -1,
1830 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1831 54, -1, -1, -1, 58, 59, -1, -1, 62, -1,
1832 -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
1833 1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1834 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1835 -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
1836 104, 105, -1, -1, 108, 109, 476, -1, -1, -1,
1837 -1, -1, 482, 44, 45, 46, 47, 48, 49, 50,
1838 51, -1, -1, 54, -1, -1, 476, 58, 59, -1,
1839 -1, 62, 482, -1, 65, 66, 67, 68, -1, 70,
1840 71, 72, 73, -1, 1, 76, -1, -1, -1, -1,
1841 -1, 82, -1, -1, 85, 86, -1, -1, -1, -1,
1842 -1, -1, 93, -1, 95, 96, -1, -1, 99, -1,
1843 -1, 102, 103, 104, 105, -1, -1, 108, 109, -1,
1844 -1, -1, -1, -1, -1, -1, -1, 44, 45, 46,
1845 47, 48, 49, 50, 51, -1, -1, 54, -1, -1,
1846 -1, 58, 59, -1, -1, 62, -1, -1, 65, 66,
1847 67, 68, -1, 70, 71, 72, 73, -1, -1, 76,
1848 1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1849 -1, -1, -1, -1, -1, -1, 93, -1, 95, 96,
1850 610, 611, 99, -1, -1, 102, 103, 104, 105, -1,
1851 -1, 108, 109, -1, -1, -1, 626, -1, -1, -1,
1852 610, 611, -1, 44, 45, 46, -1, 48, 49, 50,
1853 51, -1, -1, 54, -1, -1, 626, 58, 59, -1,
1854 -1, -1, -1, -1, 65, 66, 67, 68, 1, 70,
1855 71, 72, 73, -1, -1, 76, -1, -1, -1, -1,
1856 -1, 82, -1, -1, 85, 86, -1, -1, -1, -1,
1857 -1, -1, 93, -1, 95, 96, -1, -1, 99, -1,
1858 -1, 102, 103, 104, 105, -1, -1, 108, 109, -1,
1859 -1, 44, 45, 46, -1, 48, 49, 50, 51, -1,
1860 -1, 54, -1, -1, -1, 58, 59, -1, -1, -1,
1861 -1, -1, 65, 66, 67, 68, 1, 70, 71, 72,
1862 73, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1863 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1864 93, -1, 95, -1, -1, -1, 99, -1, -1, 102,
1865 103, 104, 105, -1, -1, 108, 109, -1, -1, 44,
1866 45, 46, -1, 48, 49, 50, 51, -1, -1, 54,
1867 -1, -1, -1, 58, 59, -1, -1, -1, -1, -1,
1868 65, 66, 1, 68, -1, 70, 71, 72, 73, -1,
1869 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1870 85, 86, -1, -1, -1, -1, -1, -1, 93, -1,
1871 95, -1, -1, -1, 99, -1, -1, 102, 103, 104,
1872 105, -1, -1, 108, 109, 44, 45, 46, -1, 48,
1873 49, 50, 51, -1, -1, 54, -1, -1, -1, 58,
1874 59, -1, -1, -1, -1, -1, 65, 66, -1, 68,
1875 -1, 70, 71, 72, 73, -1, 1, 76, 3, 4,
1876 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1877 -1, -1, -1, -1, 93, -1, 95, -1, -1, -1,
1878 99, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1879 109, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1880 45, 46, -1, -1, -1, 50, -1, -1, -1, -1,
1881 -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
1882 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1883 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1884 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1885 95, 96, -1, -1, -1, -1, -1, 102, 103, 104,
1886 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1887 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1888 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1889 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1890 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1891 90, -1, -1, 93, -1, 95, 45, 46, -1, -1,
1892 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1893 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1894 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1895 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1896 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
1897 99, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1898 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1899 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1900 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1901 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1902 -1, 85, 86, -1, 88, 89, 90, -1, -1, 93,
1903 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
1904 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1905 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1906 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1907 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1908 93, -1, -1, -1, -1, 98, -1, -1, -1, 102,
1909 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1910 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1911 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1912 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1913 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1914 -1, 89, 90, -1, -1, 93, 94, -1, 45, 46,
1915 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1916 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1917 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1918 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1919 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
1920 -1, -1, 99, -1, -1, 102, 103, 104, 105, -1,
1921 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1922 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1923 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1924 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1925 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1926 -1, 93, -1, -1, 45, 46, 98, -1, -1, 50,
1927 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1928 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1929 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1930 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1931 -1, -1, 93, 94, -1, -1, -1, -1, -1, -1,
1932 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1933 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1934 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1935 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1936 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1937 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1938 45, 46, 98, -1, -1, 50, 102, 103, 104, 105,
1939 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1940 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1941 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1942 85, 86, -1, -1, 89, 90, -1, -1, 93, 94,
1943 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
1944 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1945 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1946 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1947 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1948 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1949 90, -1, -1, 93, 94, -1, 45, 46, -1, -1,
1950 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1951 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1952 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1953 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1954 89, 90, -1, -1, 93, 94, -1, -1, -1, -1,
1955 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1956 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1957 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1958 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1959 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1960 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1961 -1, -1, 45, 46, -1, 99, -1, 50, 102, 103,
1962 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1963 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1964 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1965 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1966 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
1967 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1968 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1969 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1970 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1971 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1972 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
1973 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1974 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1975 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1976 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1977 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
1978 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
1979 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1980 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1981 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1982 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1983 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1984 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
1985 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1986 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1987 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1988 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1989 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
1990 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1991 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1992 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1993 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1994 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1995 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1996 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
1997 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1998 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1999 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2000 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2001 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2002 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2003 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2004 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2005 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2006 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2007 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2008 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2009 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2010 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2011 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2012 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2013 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2014 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2015 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2016 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2017 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2018 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2019 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2020 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2021 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2022 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2023 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2024 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2025 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2026 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2027 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2028 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2029 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2030 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2031 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2032 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2033 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2034 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2035 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2036 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2037 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2038 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2039 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2040 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2041 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2042 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2043 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2044 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2045 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2046 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2047 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2048 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2049 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
2050 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2051 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2052 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2053 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2054 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2055 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2056 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
2057 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2058 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2059 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2060 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2061 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2062 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2063 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2064 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2065 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2066 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2067 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2068 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2069 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2070 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2071 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2072 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2073 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2074 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2075 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2076 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2077 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2078 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2079 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2080 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2081 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2082 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2083 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2084 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2085 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2086 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2087 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2088 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2089 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2090 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2091 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2092 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2093 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2094 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2095 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2096 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2097 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2098 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2099 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2100 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2101 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2102 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2103 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2104 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2105 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2106 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2107 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
2108 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2109 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2110 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2111 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2112 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2113 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2114 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
2115 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2116 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2117 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2118 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2119 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2120 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2121 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2122 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2123 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2124 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2125 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2126 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2127 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2128 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2129 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2130 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2131 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2132 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2133 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2134 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2135 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2136 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2137 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2138 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2139 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2140 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2141 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2142 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2143 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2144 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2145 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2146 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2147 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2148 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2149 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2150 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2151 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2152 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2153 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2154 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2155 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2156 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2157 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2158 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2159 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2160 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2161 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2162 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2163 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2164 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2165 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
2166 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2167 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2168 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2169 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2170 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2171 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2172 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
2173 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2174 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2175 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2176 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2177 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2178 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2179 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2180 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2181 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2182 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2183 59, -1, -1, -1, -1, -1, 65, -1, 1, -1,
2184 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2185 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2186 89, 90, -1, 1, 93, -1, -1, -1, -1, -1,
2187 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2188 109, 44, 45, 46, -1, -1, -1, 50, -1, -1,
2189 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
2190 -1, -1, 65, -1, -1, 1, -1, 45, 46, 72,
2191 -1, -1, 50, 76, -1, -1, -1, -1, -1, 82,
2192 -1, 59, 85, 86, -1, -1, -1, 65, -1, -1,
2193 93, -1, -1, -1, 72, -1, 99, -1, 76, 102,
2194 103, 104, 105, -1, 82, 108, 109, 85, 86, 45,
2195 46, -1, -1, -1, 50, 93, 94, -1, -1, -1,
2196 -1, -1, -1, 59, 102, 103, 104, 105, -1, 65,
2197 108, 109, 1, -1, -1, -1, 72, -1, -1, -1,
2198 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2199 86, -1, -1, -1, -1, -1, -1, 93, 94, -1,
2200 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2201 -1, -1, 108, 109, 1, -1, 45, 46, -1, -1,
2202 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
2203 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2204 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2205 -1, -1, -1, 82, -1, -1, 85, 86, 3, 4,
2206 -1, -1, -1, 50, 93, -1, -1, -1, -1, -1,
2207 -1, -1, 59, 102, 103, 104, 105, -1, 65, 108,
2208 109, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2209 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2210 45, 46, 89, 90, -1, 50, 93, -1, -1, -1,
2211 -1, -1, -1, -1, 59, 102, 103, 104, 105, -1,
2212 65, 108, 109, 3, 4, -1, -1, 72, -1, -1,
2213 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2214 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2215 95, 96, -1, -1, -1, -1, -1, 102, 103, 104,
2216 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2217 50, -1, -1, -1, 3, 4, -1, -1, -1, 59,
2218 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2219 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2220 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2221 90, -1, -1, 93, 94, -1, 45, 46, -1, -1,
2222 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2223 59, -1, -1, -1, -1, -1, 65, -1, -1, 3,
2224 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2225 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2226 89, 90, -1, -1, 93, 94, -1, -1, -1, -1,
2227 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2228 109, 45, 46, -1, -1, -1, 50, -1, -1, -1,
2229 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2230 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2231 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2232 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2233 94, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2234 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2235 -1, -1, 65, -1, -1, 3, 4, -1, -1, 72,
2236 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2237 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2238 93, 94, -1, -1, -1, -1, -1, -1, -1, 102,
2239 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2240 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2241 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2242 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2243 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2244 -1, 89, 90, -1, -1, 93, -1, 44, 45, 46,
2245 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2246 108, 109, 59, -1, -1, -1, -1, -1, 65, -1,
2247 -1, -1, -1, -1, -1, 72, -1, -1, 50, 76,
2248 -1, -1, -1, -1, -1, 82, -1, 59, 85, 86,
2249 -1, -1, -1, 65, -1, -1, 93, -1, -1, -1,
2250 72, -1, -1, -1, 76, 102, 103, 104, 105, -1,
2251 82, 108, 109, 85, 86, -1, -1, 89, 90, -1,
2252 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2253 102, 103, 104, 105, -1, -1, 108, 109
2254 };
2255 #define YYPURE 1
2256
2257 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2258 #line 3 "/usr/share/misc/bison.simple"
2259
2260 /* Skeleton output parser for bison,
2261 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2262
2263 This program is free software; you can redistribute it and/or modify
2264 it under the terms of the GNU General Public License as published by
2265 the Free Software Foundation; either version 2, or (at your option)
2266 any later version.
2267
2268 This program is distributed in the hope that it will be useful,
2269 but WITHOUT ANY WARRANTY; without even the implied warranty of
2270 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2271 GNU General Public License for more details.
2272
2273 You should have received a copy of the GNU General Public License
2274 along with this program; if not, write to the Free Software
2275 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2276
2277 /* As a special exception, when this file is copied by Bison into a
2278 Bison output file, you may use that output file without restriction.
2279 This special exception was added by the Free Software Foundation
2280 in version 1.24 of Bison. */
2281
2282 #ifndef alloca
2283 #ifdef __GNUC__
2284 #define alloca __builtin_alloca
2285 #else /* not GNU C. */
2286 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
2287 #include <alloca.h>
2288 #else /* not sparc */
2289 #if defined (MSDOS) && !defined (__TURBOC__)
2290 #include <malloc.h>
2291 #else /* not MSDOS, or __TURBOC__ */
2292 #if defined(_AIX)
2293 #include <malloc.h>
2294 #pragma alloca
2295 #else /* not MSDOS, __TURBOC__, or _AIX */
2296 #ifdef __hpux
2297 #ifdef __cplusplus
2298 extern "C" {
2299 void *alloca (unsigned int);
2300 };
2301 #else /* not __cplusplus */
2302 void *alloca ();
2303 #endif /* not __cplusplus */
2304 #endif /* __hpux */
2305 #endif /* not _AIX */
2306 #endif /* not MSDOS, or __TURBOC__ */
2307 #endif /* not sparc. */
2308 #endif /* not GNU C. */
2309 #endif /* alloca not defined. */
2310
2311 /* This is the parser code that is written into each bison parser
2312 when the %semantic_parser declaration is not specified in the grammar.
2313 It was written by Richard Stallman by simplifying the hairy parser
2314 used when %semantic_parser is specified. */
2315
2316 /* Note: there must be only one dollar sign in this file.
2317 It is replaced by the list of actions, each action
2318 as one case of the switch. */
2319
2320 #define yyerrok (yyerrstatus = 0)
2321 #define yyclearin (yychar = YYEMPTY)
2322 #define YYEMPTY -2
2323 #define YYEOF 0
2324 #define YYACCEPT return(0)
2325 #define YYABORT return(1)
2326 #define YYERROR goto yyerrlab1
2327 /* Like YYERROR except do call yyerror.
2328 This remains here temporarily to ease the
2329 transition to the new meaning of YYERROR, for GCC.
2330 Once GCC version 2 has supplanted version 1, this can go. */
2331 #define YYFAIL goto yyerrlab
2332 #define YYRECOVERING() (!!yyerrstatus)
2333 #define YYBACKUP(token, value) \
2334 do \
2335 if (yychar == YYEMPTY && yylen == 1) \
2336 { yychar = (token), yylval = (value); \
2337 yychar1 = YYTRANSLATE (yychar); \
2338 YYPOPSTACK; \
2339 goto yybackup; \
2340 } \
2341 else \
2342 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2343 while (0)
2344
2345 #define YYTERROR 1
2346 #define YYERRCODE 256
2347
2348 #ifndef YYPURE
2349 #define YYLEX yylex()
2350 #endif
2351
2352 #ifdef YYPURE
2353 #ifdef YYLSP_NEEDED
2354 #ifdef YYLEX_PARAM
2355 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2356 #else
2357 #define YYLEX yylex(&yylval, &yylloc)
2358 #endif
2359 #else /* not YYLSP_NEEDED */
2360 #ifdef YYLEX_PARAM
2361 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2362 #else
2363 #define YYLEX yylex(&yylval)
2364 #endif
2365 #endif /* not YYLSP_NEEDED */
2366 #endif
2367
2368 /* If nonreentrant, generate the variables here */
2369
2370 #ifndef YYPURE
2371
2372 int yychar; /* the lookahead symbol */
2373 YYSTYPE yylval; /* the semantic value of the */
2374 /* lookahead symbol */
2375
2376 #ifdef YYLSP_NEEDED
2377 YYLTYPE yylloc; /* location data for the lookahead */
2378 /* symbol */
2379 #endif
2380
2381 int yynerrs; /* number of parse errors so far */
2382 #endif /* not YYPURE */
2383
2384 #if YYDEBUG != 0
2385 int yydebug; /* nonzero means print parse trace */
2386 /* Since this is uninitialized, it does not stop multiple parsers
2387 from coexisting. */
2388 #endif
2389
2390 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2391
2392 #ifndef YYINITDEPTH
2393 #define YYINITDEPTH 200
2394 #endif
2395
2396 /* YYMAXDEPTH is the maximum size the stacks can grow to
2397 (effective only if the built-in stack extension method is used). */
2398
2399 #if YYMAXDEPTH == 0
2400 #undef YYMAXDEPTH
2401 #endif
2402
2403 #ifndef YYMAXDEPTH
2404 #define YYMAXDEPTH 10000
2405 #endif
2406
2407 /* Prevent warning if -Wstrict-prototypes. */
2408 #ifdef __GNUC__
2409 int yyparse (void);
2410 #endif
2411 \f
2412 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2413 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2414 #else /* not GNU C or C++ */
2415 #ifndef __cplusplus
2416
2417 /* This is the most reliable way to avoid incompatibilities
2418 in available built-in functions on various systems. */
2419 static void
2420 __yy_memcpy (to, from, count)
2421 char *to;
2422 char *from;
2423 int count;
2424 {
2425 register char *f = from;
2426 register char *t = to;
2427 register int i = count;
2428
2429 while (i-- > 0)
2430 *t++ = *f++;
2431 }
2432
2433 #else /* __cplusplus */
2434
2435 /* This is the most reliable way to avoid incompatibilities
2436 in available built-in functions on various systems. */
2437 static void
2438 __yy_memcpy (char *to, char *from, int count)
2439 {
2440 register char *f = from;
2441 register char *t = to;
2442 register int i = count;
2443
2444 while (i-- > 0)
2445 *t++ = *f++;
2446 }
2447
2448 #endif
2449 #endif
2450 \f
2451 #line 196 "/usr/share/misc/bison.simple"
2452
2453 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2454 into yyparse. The argument should have type void *.
2455 It should actually point to an object.
2456 Grammar actions can access the variable by casting it
2457 to the proper pointer type. */
2458
2459 #ifdef YYPARSE_PARAM
2460 #ifdef __cplusplus
2461 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2462 #define YYPARSE_PARAM_DECL
2463 #else /* not __cplusplus */
2464 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2465 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2466 #endif /* not __cplusplus */
2467 #else /* not YYPARSE_PARAM */
2468 #define YYPARSE_PARAM_ARG
2469 #define YYPARSE_PARAM_DECL
2470 #endif /* not YYPARSE_PARAM */
2471
2472 int
2473 yyparse(YYPARSE_PARAM_ARG)
2474 YYPARSE_PARAM_DECL
2475 {
2476 register int yystate;
2477 register int yyn;
2478 register short *yyssp;
2479 register YYSTYPE *yyvsp;
2480 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2481 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2482
2483 short yyssa[YYINITDEPTH]; /* the state stack */
2484 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2485
2486 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2487 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2488
2489 #ifdef YYLSP_NEEDED
2490 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2491 YYLTYPE *yyls = yylsa;
2492 YYLTYPE *yylsp;
2493
2494 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2495 #else
2496 #define YYPOPSTACK (yyvsp--, yyssp--)
2497 #endif
2498
2499 int yystacksize = YYINITDEPTH;
2500
2501 #ifdef YYPURE
2502 int yychar;
2503 YYSTYPE yylval;
2504 int yynerrs;
2505 #ifdef YYLSP_NEEDED
2506 YYLTYPE yylloc;
2507 #endif
2508 #endif
2509
2510 YYSTYPE yyval; /* the variable used to return */
2511 /* semantic values from the action */
2512 /* routines */
2513
2514 int yylen;
2515
2516 #if YYDEBUG != 0
2517 if (yydebug)
2518 fprintf(stderr, "Starting parse\n");
2519 #endif
2520
2521 yystate = 0;
2522 yyerrstatus = 0;
2523 yynerrs = 0;
2524 yychar = YYEMPTY; /* Cause a token to be read. */
2525
2526 /* Initialize stack pointers.
2527 Waste one element of value and location stack
2528 so that they stay on the same level as the state stack.
2529 The wasted elements are never initialized. */
2530
2531 yyssp = yyss - 1;
2532 yyvsp = yyvs;
2533 #ifdef YYLSP_NEEDED
2534 yylsp = yyls;
2535 #endif
2536
2537 /* Push a new state, which is found in yystate . */
2538 /* In all cases, when you get here, the value and location stacks
2539 have just been pushed. so pushing a state here evens the stacks. */
2540 yynewstate:
2541
2542 *++yyssp = yystate;
2543
2544 if (yyssp >= yyss + yystacksize - 1)
2545 {
2546 /* Give user a chance to reallocate the stack */
2547 /* Use copies of these so that the &'s don't force the real ones into memory. */
2548 YYSTYPE *yyvs1 = yyvs;
2549 short *yyss1 = yyss;
2550 #ifdef YYLSP_NEEDED
2551 YYLTYPE *yyls1 = yyls;
2552 #endif
2553
2554 /* Get the current used size of the three stacks, in elements. */
2555 int size = yyssp - yyss + 1;
2556
2557 #ifdef yyoverflow
2558 /* Each stack pointer address is followed by the size of
2559 the data in use in that stack, in bytes. */
2560 #ifdef YYLSP_NEEDED
2561 /* This used to be a conditional around just the two extra args,
2562 but that might be undefined if yyoverflow is a macro. */
2563 yyoverflow("parser stack overflow",
2564 &yyss1, size * sizeof (*yyssp),
2565 &yyvs1, size * sizeof (*yyvsp),
2566 &yyls1, size * sizeof (*yylsp),
2567 &yystacksize);
2568 #else
2569 yyoverflow("parser stack overflow",
2570 &yyss1, size * sizeof (*yyssp),
2571 &yyvs1, size * sizeof (*yyvsp),
2572 &yystacksize);
2573 #endif
2574
2575 yyss = yyss1; yyvs = yyvs1;
2576 #ifdef YYLSP_NEEDED
2577 yyls = yyls1;
2578 #endif
2579 #else /* no yyoverflow */
2580 /* Extend the stack our own way. */
2581 if (yystacksize >= YYMAXDEPTH)
2582 {
2583 yyerror("parser stack overflow");
2584 return 2;
2585 }
2586 yystacksize *= 2;
2587 if (yystacksize > YYMAXDEPTH)
2588 yystacksize = YYMAXDEPTH;
2589 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
2590 __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
2591 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
2592 __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
2593 #ifdef YYLSP_NEEDED
2594 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
2595 __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
2596 #endif
2597 #endif /* no yyoverflow */
2598
2599 yyssp = yyss + size - 1;
2600 yyvsp = yyvs + size - 1;
2601 #ifdef YYLSP_NEEDED
2602 yylsp = yyls + size - 1;
2603 #endif
2604
2605 #if YYDEBUG != 0
2606 if (yydebug)
2607 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2608 #endif
2609
2610 if (yyssp >= yyss + yystacksize - 1)
2611 YYABORT;
2612 }
2613
2614 #if YYDEBUG != 0
2615 if (yydebug)
2616 fprintf(stderr, "Entering state %d\n", yystate);
2617 #endif
2618
2619 goto yybackup;
2620 yybackup:
2621
2622 /* Do appropriate processing given the current state. */
2623 /* Read a lookahead token if we need one and don't already have one. */
2624 /* yyresume: */
2625
2626 /* First try to decide what to do without reference to lookahead token. */
2627
2628 yyn = yypact[yystate];
2629 if (yyn == YYFLAG)
2630 goto yydefault;
2631
2632 /* Not known => get a lookahead token if don't already have one. */
2633
2634 /* yychar is either YYEMPTY or YYEOF
2635 or a valid token in external form. */
2636
2637 if (yychar == YYEMPTY)
2638 {
2639 #if YYDEBUG != 0
2640 if (yydebug)
2641 fprintf(stderr, "Reading a token: ");
2642 #endif
2643 yychar = YYLEX;
2644 }
2645
2646 /* Convert token to internal form (in yychar1) for indexing tables with */
2647
2648 if (yychar <= 0) /* This means end of input. */
2649 {
2650 yychar1 = 0;
2651 yychar = YYEOF; /* Don't call YYLEX any more */
2652
2653 #if YYDEBUG != 0
2654 if (yydebug)
2655 fprintf(stderr, "Now at end of input.\n");
2656 #endif
2657 }
2658 else
2659 {
2660 yychar1 = YYTRANSLATE(yychar);
2661
2662 #if YYDEBUG != 0
2663 if (yydebug)
2664 {
2665 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2666 /* Give the individual parser a way to print the precise meaning
2667 of a token, for further debugging info. */
2668 #ifdef YYPRINT
2669 YYPRINT (stderr, yychar, yylval);
2670 #endif
2671 fprintf (stderr, ")\n");
2672 }
2673 #endif
2674 }
2675
2676 yyn += yychar1;
2677 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2678 goto yydefault;
2679
2680 yyn = yytable[yyn];
2681
2682 /* yyn is what to do for this token type in this state.
2683 Negative => reduce, -yyn is rule number.
2684 Positive => shift, yyn is new state.
2685 New state is final state => don't bother to shift,
2686 just return success.
2687 0, or most negative number => error. */
2688
2689 if (yyn < 0)
2690 {
2691 if (yyn == YYFLAG)
2692 goto yyerrlab;
2693 yyn = -yyn;
2694 goto yyreduce;
2695 }
2696 else if (yyn == 0)
2697 goto yyerrlab;
2698
2699 if (yyn == YYFINAL)
2700 YYACCEPT;
2701
2702 /* Shift the lookahead token. */
2703
2704 #if YYDEBUG != 0
2705 if (yydebug)
2706 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2707 #endif
2708
2709 /* Discard the token being shifted unless it is eof. */
2710 if (yychar != YYEOF)
2711 yychar = YYEMPTY;
2712
2713 *++yyvsp = yylval;
2714 #ifdef YYLSP_NEEDED
2715 *++yylsp = yylloc;
2716 #endif
2717
2718 /* count tokens shifted since error; after three, turn off error status. */
2719 if (yyerrstatus) yyerrstatus--;
2720
2721 yystate = yyn;
2722 goto yynewstate;
2723
2724 /* Do the default action for the current state. */
2725 yydefault:
2726
2727 yyn = yydefact[yystate];
2728 if (yyn == 0)
2729 goto yyerrlab;
2730
2731 /* Do a reduction. yyn is the number of a rule to reduce with. */
2732 yyreduce:
2733 yylen = yyr2[yyn];
2734 if (yylen > 0)
2735 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2736
2737 #if YYDEBUG != 0
2738 if (yydebug)
2739 {
2740 int i;
2741
2742 fprintf (stderr, "Reducing via rule %d (line %d), ",
2743 yyn, yyrline[yyn]);
2744
2745 /* Print the symbols being reduced, and their result. */
2746 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2747 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2748 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2749 }
2750 #endif
2751
2752
2753 switch (yyn) {
2754
2755 case 1:
2756 #line 446 "./parse.y"
2757 {;
2758 break;}
2759 case 18:
2760 #line 490 "./parse.y"
2761 {
2762 yyval.node = build_java_array_type (yyvsp[-2].node, -1);
2763 CLASS_LOADED_P (yyval.node) = 1;
2764 ;
2765 break;}
2766 case 19:
2767 #line 495 "./parse.y"
2768 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2769 break;}
2770 case 20:
2771 #line 497 "./parse.y"
2772 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2773 break;}
2774 case 21:
2775 #line 499 "./parse.y"
2776 {RULE ("']' expected"); RECOVER;;
2777 break;}
2778 case 22:
2779 #line 501 "./parse.y"
2780 {RULE ("']' expected"); RECOVER;;
2781 break;}
2782 case 26:
2783 #line 516 "./parse.y"
2784 { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
2785 break;}
2786 case 28:
2787 #line 525 "./parse.y"
2788 {yyval.node = NULL;;
2789 break;}
2790 case 36:
2791 #line 537 "./parse.y"
2792 {
2793 yyval.node = NULL;
2794 ;
2795 break;}
2796 case 37:
2797 #line 541 "./parse.y"
2798 {
2799 yyval.node = NULL;
2800 ;
2801 break;}
2802 case 40:
2803 #line 553 "./parse.y"
2804 { ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ;
2805 break;}
2806 case 41:
2807 #line 555 "./parse.y"
2808 {yyerror ("Missing name"); RECOVER;;
2809 break;}
2810 case 42:
2811 #line 557 "./parse.y"
2812 {yyerror ("';' expected"); RECOVER;;
2813 break;}
2814 case 45:
2815 #line 567 "./parse.y"
2816 {
2817 tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name;
2818 int i = IDENTIFIER_LENGTH (name)-1;
2819 char *last = &IDENTIFIER_POINTER (name)[i];
2820 while (last != IDENTIFIER_POINTER (name))
2821 {
2822 if (last [0] == '.')
2823 break;
2824 last--;
2825 }
2826 last_name = get_identifier (++last);
2827 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name))
2828 {
2829 tree err = find_name_in_single_imports (last_name);
2830 if (err && err != name)
2831 parse_error_context
2832 (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'",
2833 IDENTIFIER_POINTER (name),
2834 IDENTIFIER_POINTER (err));
2835 else
2836 REGISTER_IMPORT (yyvsp[-1].node, last_name)
2837 }
2838 else
2839 REGISTER_IMPORT (yyvsp[-1].node, last_name);
2840 ;
2841 break;}
2842 case 46:
2843 #line 593 "./parse.y"
2844 {yyerror ("Missing name"); RECOVER;;
2845 break;}
2846 case 47:
2847 #line 595 "./parse.y"
2848 {yyerror ("';' expected"); RECOVER;;
2849 break;}
2850 case 48:
2851 #line 600 "./parse.y"
2852 {
2853 tree name = EXPR_WFL_NODE (yyvsp[-3].node);
2854 tree node = build_tree_list (yyvsp[-3].node, NULL_TREE);
2855 read_import_dir (yyvsp[-3].node);
2856 TREE_CHAIN (node) = ctxp->import_demand_list;
2857 ctxp->import_demand_list = node;
2858 ;
2859 break;}
2860 case 49:
2861 #line 608 "./parse.y"
2862 {yyerror ("'*' expected"); RECOVER;;
2863 break;}
2864 case 50:
2865 #line 610 "./parse.y"
2866 {yyerror ("';' expected"); RECOVER;;
2867 break;}
2868 case 51:
2869 #line 615 "./parse.y"
2870 {
2871 maybe_generate_finit ();
2872 maybe_generate_clinit ();
2873 yyval.node = yyvsp[0].node;
2874 ;
2875 break;}
2876 case 53:
2877 #line 622 "./parse.y"
2878 { yyval.node = NULL; ;
2879 break;}
2880 case 54:
2881 #line 624 "./parse.y"
2882 {
2883 YYERROR_NOW;
2884 yyerror ("Class or interface declaration expected");
2885 ;
2886 break;}
2887 case 55:
2888 #line 635 "./parse.y"
2889 {
2890 yyval.value = (1 << yyvsp[0].value);
2891 ;
2892 break;}
2893 case 56:
2894 #line 639 "./parse.y"
2895 {
2896 int acc = (1 << yyvsp[0].value);
2897 if (yyval.value & acc)
2898 parse_error_context
2899 (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice",
2900 java_accstring_lookup (acc));
2901 else
2902 {
2903 yyval.value |= acc;
2904 }
2905 ;
2906 break;}
2907 case 57:
2908 #line 655 "./parse.y"
2909 { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2910 break;}
2911 case 58:
2912 #line 657 "./parse.y"
2913 {
2914 yyval.node = yyvsp[0].node;
2915 ;
2916 break;}
2917 case 59:
2918 #line 661 "./parse.y"
2919 { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2920 break;}
2921 case 60:
2922 #line 663 "./parse.y"
2923 {
2924 yyval.node = yyvsp[0].node;
2925 ;
2926 break;}
2927 case 61:
2928 #line 667 "./parse.y"
2929 {yyerror ("Missing class name"); RECOVER;;
2930 break;}
2931 case 62:
2932 #line 669 "./parse.y"
2933 {yyerror ("Missing class name"); RECOVER;;
2934 break;}
2935 case 63:
2936 #line 671 "./parse.y"
2937 {if (!ctxp->class_err) yyerror ("'{' expected"); DRECOVER(class1);;
2938 break;}
2939 case 64:
2940 #line 673 "./parse.y"
2941 {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;;
2942 break;}
2943 case 65:
2944 #line 677 "./parse.y"
2945 { yyval.node = NULL; ;
2946 break;}
2947 case 66:
2948 #line 679 "./parse.y"
2949 { yyval.node = yyvsp[0].node; ;
2950 break;}
2951 case 67:
2952 #line 681 "./parse.y"
2953 {yyerror ("'{' expected"); ctxp->class_err=1;;
2954 break;}
2955 case 68:
2956 #line 683 "./parse.y"
2957 {yyerror ("Missing super class name"); ctxp->class_err=1;;
2958 break;}
2959 case 69:
2960 #line 687 "./parse.y"
2961 { yyval.node = NULL_TREE; ;
2962 break;}
2963 case 70:
2964 #line 689 "./parse.y"
2965 { yyval.node = yyvsp[0].node; ;
2966 break;}
2967 case 71:
2968 #line 691 "./parse.y"
2969 {
2970 ctxp->class_err=1;
2971 yyerror ("Missing interface name");
2972 ;
2973 break;}
2974 case 72:
2975 #line 699 "./parse.y"
2976 {
2977 ctxp->interface_number = 1;
2978 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
2979 ;
2980 break;}
2981 case 73:
2982 #line 704 "./parse.y"
2983 {
2984 ctxp->interface_number++;
2985 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
2986 ;
2987 break;}
2988 case 74:
2989 #line 709 "./parse.y"
2990 {yyerror ("Missing interface name"); RECOVER;;
2991 break;}
2992 case 75:
2993 #line 714 "./parse.y"
2994 { yyval.node = ctxp->current_parsed_class; ;
2995 break;}
2996 case 76:
2997 #line 716 "./parse.y"
2998 { yyval.node = ctxp->current_parsed_class; ;
2999 break;}
3000 case 82:
3001 #line 729 "./parse.y"
3002 { yyval.node = parse_jdk1_1_error ("instance initializer"); ;
3003 break;}
3004 case 85:
3005 #line 736 "./parse.y"
3006 { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ;
3007 break;}
3008 case 86:
3009 #line 738 "./parse.y"
3010 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
3011 break;}
3012 case 87:
3013 #line 744 "./parse.y"
3014 { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ;
3015 break;}
3016 case 88:
3017 #line 746 "./parse.y"
3018 {
3019 check_modifiers
3020 ("Illegal modifier `%s' for field declaration",
3021 yyvsp[-3].value, FIELD_MODIFIERS);
3022 check_modifiers_consistency (yyvsp[-3].value);
3023 register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node);
3024 ;
3025 break;}
3026 case 90:
3027 #line 759 "./parse.y"
3028 { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ;
3029 break;}
3030 case 91:
3031 #line 761 "./parse.y"
3032 {yyerror ("Missing term"); RECOVER;;
3033 break;}
3034 case 92:
3035 #line 766 "./parse.y"
3036 { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ;
3037 break;}
3038 case 93:
3039 #line 768 "./parse.y"
3040 {
3041 if (java_error_count)
3042 yyvsp[0].node = NULL_TREE;
3043 yyval.node = build_tree_list
3044 (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node));
3045 ;
3046 break;}
3047 case 94:
3048 #line 775 "./parse.y"
3049 {
3050 yyerror ("Missing variable initializer");
3051 yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
3052 RECOVER;
3053 ;
3054 break;}
3055 case 95:
3056 #line 781 "./parse.y"
3057 {
3058 yyerror ("';' expected");
3059 yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
3060 RECOVER;
3061 ;
3062 break;}
3063 case 97:
3064 #line 791 "./parse.y"
3065 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
3066 break;}
3067 case 98:
3068 #line 793 "./parse.y"
3069 {yyerror ("Invalid declaration"); DRECOVER(vdi);;
3070 break;}
3071 case 99:
3072 #line 795 "./parse.y"
3073 {yyerror ("']' expected"); DRECOVER(vdi);;
3074 break;}
3075 case 100:
3076 #line 797 "./parse.y"
3077 {yyerror ("Unbalanced ']'"); DRECOVER(vdi);;
3078 break;}
3079 case 103:
3080 #line 808 "./parse.y"
3081 {
3082 current_function_decl = yyvsp[0].node;
3083 source_start_java_method (current_function_decl);
3084 ;
3085 break;}
3086 case 104:
3087 #line 813 "./parse.y"
3088 { complete_method_declaration (yyvsp[0].node); ;
3089 break;}
3090 case 105:
3091 #line 815 "./parse.y"
3092 {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;
3093 break;}
3094 case 106:
3095 #line 820 "./parse.y"
3096 { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3097 break;}
3098 case 107:
3099 #line 822 "./parse.y"
3100 { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
3101 break;}
3102 case 108:
3103 #line 824 "./parse.y"
3104 { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3105 break;}
3106 case 109:
3107 #line 826 "./parse.y"
3108 { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
3109 break;}
3110 case 110:
3111 #line 828 "./parse.y"
3112 {RECOVER;;
3113 break;}
3114 case 111:
3115 #line 830 "./parse.y"
3116 {RECOVER;;
3117 break;}
3118 case 112:
3119 #line 832 "./parse.y"
3120 {yyerror ("Identifier expected"); RECOVER;;
3121 break;}
3122 case 113:
3123 #line 834 "./parse.y"
3124 {yyerror ("Identifier expected"); RECOVER;;
3125 break;}
3126 case 114:
3127 #line 836 "./parse.y"
3128 {
3129 yyerror ("Invalid method declaration, return type required");
3130 RECOVER;
3131 ;
3132 break;}
3133 case 115:
3134 #line 844 "./parse.y"
3135 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3136 break;}
3137 case 116:
3138 #line 846 "./parse.y"
3139 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3140 break;}
3141 case 117:
3142 #line 848 "./parse.y"
3143 {
3144 EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location;
3145 TREE_PURPOSE (yyvsp[-2].node) =
3146 build_unresolved_array_type (TREE_PURPOSE (yyvsp[-2].node));
3147 parse_warning_context
3148 (wfl_operator,
3149 "Discouraged form of returned type specification");
3150 ;
3151 break;}
3152 case 118:
3153 #line 857 "./parse.y"
3154 {yyerror ("')' expected"); DRECOVER(method_declarator);;
3155 break;}
3156 case 119:
3157 #line 859 "./parse.y"
3158 {yyerror ("']' expected"); RECOVER;;
3159 break;}
3160 case 120:
3161 #line 864 "./parse.y"
3162 {
3163 ctxp->formal_parameter_number = 1;
3164 ;
3165 break;}
3166 case 121:
3167 #line 868 "./parse.y"
3168 {
3169 ctxp->formal_parameter_number += 1;
3170 yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
3171 ;
3172 break;}
3173 case 122:
3174 #line 873 "./parse.y"
3175 {yyerror ("Missing formal parameter term"); RECOVER;;
3176 break;}
3177 case 123:
3178 #line 878 "./parse.y"
3179 {
3180 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3181 ;
3182 break;}
3183 case 124:
3184 #line 882 "./parse.y"
3185 { yyval.node = parse_jdk1_1_error ("final parameters"); ;
3186 break;}
3187 case 125:
3188 #line 884 "./parse.y"
3189 {yyerror ("Missing identifier"); RECOVER;;
3190 break;}
3191 case 126:
3192 #line 886 "./parse.y"
3193 {
3194 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value));
3195 yyerror ("Missing identifier"); RECOVER;
3196 ;
3197 break;}
3198 case 127:
3199 #line 893 "./parse.y"
3200 { yyval.node = NULL_TREE; ;
3201 break;}
3202 case 128:
3203 #line 895 "./parse.y"
3204 { yyval.node = yyvsp[0].node; ;
3205 break;}
3206 case 129:
3207 #line 897 "./parse.y"
3208 {yyerror ("Missing class type term"); RECOVER;;
3209 break;}
3210 case 130:
3211 #line 902 "./parse.y"
3212 { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ;
3213 break;}
3214 case 131:
3215 #line 904 "./parse.y"
3216 { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ;
3217 break;}
3218 case 132:
3219 #line 906 "./parse.y"
3220 {yyerror ("Missing class type term"); RECOVER;;
3221 break;}
3222 case 135:
3223 #line 913 "./parse.y"
3224 { yyval.node = NULL_TREE; ;
3225 break;}
3226 case 136:
3227 #line 919 "./parse.y"
3228 {
3229 RULE ("STATIC_INITIALIZER");
3230 ;
3231 break;}
3232 case 137:
3233 #line 923 "./parse.y"
3234 {
3235 RULE ("STATIC_INITIALIZER");
3236 ;
3237 break;}
3238 case 138:
3239 #line 930 "./parse.y"
3240 {
3241 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
3242 ;
3243 break;}
3244 case 139:
3245 #line 938 "./parse.y"
3246 {
3247 current_function_decl = yyvsp[0].node;
3248 source_start_java_method (current_function_decl);
3249 ;
3250 break;}
3251 case 140:
3252 #line 943 "./parse.y"
3253 { complete_method_declaration (yyvsp[0].node); ;
3254 break;}
3255 case 141:
3256 #line 948 "./parse.y"
3257 { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3258 break;}
3259 case 142:
3260 #line 950 "./parse.y"
3261 { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3262 break;}
3263 case 143:
3264 #line 955 "./parse.y"
3265 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3266 break;}
3267 case 144:
3268 #line 957 "./parse.y"
3269 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3270 break;}
3271 case 145:
3272 #line 965 "./parse.y"
3273 {
3274 BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node;
3275 yyval.node = yyvsp[0].node;
3276 ;
3277 break;}
3278 case 146:
3279 #line 970 "./parse.y"
3280 { yyval.node = yyvsp[0].node; ;
3281 break;}
3282 case 147:
3283 #line 972 "./parse.y"
3284 { yyval.node = yyvsp[0].node; ;
3285 break;}
3286 case 148:
3287 #line 974 "./parse.y"
3288 { yyval.node = yyvsp[0].node; ;
3289 break;}
3290 case 149:
3291 #line 980 "./parse.y"
3292 {
3293 yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE);
3294 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node);
3295 yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
3296 ;
3297 break;}
3298 case 150:
3299 #line 986 "./parse.y"
3300 {
3301 yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node);
3302 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node);
3303 yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
3304 ;
3305 break;}
3306 case 151:
3307 #line 994 "./parse.y"
3308 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3309 break;}
3310 case 152:
3311 #line 996 "./parse.y"
3312 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3313 break;}
3314 case 153:
3315 #line 1001 "./parse.y"
3316 {
3317 tree wfl = build_wfl_node (this_identifier_node,
3318 input_filename, 0, 0);
3319 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3320 yyval.node = wfl;
3321 ;
3322 break;}
3323 case 154:
3324 #line 1008 "./parse.y"
3325 {
3326 tree wfl = build_wfl_node (super_identifier_node,
3327 input_filename, 0, 0);
3328 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3329 yyval.node = wfl;
3330 ;
3331 break;}
3332 case 155:
3333 #line 1020 "./parse.y"
3334 { create_interface (0, yyvsp[0].node, NULL_TREE); ;
3335 break;}
3336 case 156:
3337 #line 1022 "./parse.y"
3338 {
3339 yyval.node = yyvsp[0].node;
3340 ;
3341 break;}
3342 case 157:
3343 #line 1026 "./parse.y"
3344 { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ;
3345 break;}
3346 case 158:
3347 #line 1028 "./parse.y"
3348 {
3349 yyval.node = yyvsp[0].node;
3350 ;
3351 break;}
3352 case 159:
3353 #line 1032 "./parse.y"
3354 { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ;
3355 break;}
3356 case 160:
3357 #line 1034 "./parse.y"
3358 {
3359 yyval.node = yyvsp[0].node;
3360 ;
3361 break;}
3362 case 161:
3363 #line 1038 "./parse.y"
3364 { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ;
3365 break;}
3366 case 162:
3367 #line 1040 "./parse.y"
3368 {
3369 yyval.node = yyvsp[0].node;
3370 ;
3371 break;}
3372 case 163:
3373 #line 1044 "./parse.y"
3374 {yyerror ("(here)'{' expected"); RECOVER;;
3375 break;}
3376 case 164:
3377 #line 1046 "./parse.y"
3378 {yyerror ("(there)'{' expected"); RECOVER;;
3379 break;}
3380 case 165:
3381 #line 1051 "./parse.y"
3382 {
3383 ctxp->interface_number = 1;
3384 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3385 ;
3386 break;}
3387 case 166:
3388 #line 1056 "./parse.y"
3389 {
3390 ctxp->interface_number++;
3391 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3392 ;
3393 break;}
3394 case 167:
3395 #line 1061 "./parse.y"
3396 {yyerror ("Invalid interface type"); RECOVER;;
3397 break;}
3398 case 168:
3399 #line 1063 "./parse.y"
3400 {yyerror ("Missing term"); RECOVER;;
3401 break;}
3402 case 169:
3403 #line 1068 "./parse.y"
3404 { yyval.node = NULL_TREE; ;
3405 break;}
3406 case 170:
3407 #line 1070 "./parse.y"
3408 { yyval.node = NULL_TREE; ;
3409 break;}
3410 case 175:
3411 #line 1082 "./parse.y"
3412 { yyval.node = parse_jdk1_1_error ("inner class declaration"); ;
3413 break;}
3414 case 176:
3415 #line 1084 "./parse.y"
3416 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
3417 break;}
3418 case 178:
3419 #line 1093 "./parse.y"
3420 {
3421 check_abstract_method_header (yyvsp[-1].node);
3422 current_function_decl = NULL_TREE; /* FIXME ? */
3423 ;
3424 break;}
3425 case 179:
3426 #line 1098 "./parse.y"
3427 {yyerror ("';' expected"); RECOVER;;
3428 break;}
3429 case 180:
3430 #line 1104 "./parse.y"
3431 { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ;
3432 break;}
3433 case 181:
3434 #line 1106 "./parse.y"
3435 { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3436 break;}
3437 case 182:
3438 #line 1108 "./parse.y"
3439 { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ;
3440 break;}
3441 case 183:
3442 #line 1113 "./parse.y"
3443 {
3444 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node),
3445 yyvsp[0].node, NULL_TREE);
3446 ;
3447 break;}
3448 case 184:
3449 #line 1118 "./parse.y"
3450 {
3451 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node);
3452 ;
3453 break;}
3454 case 185:
3455 #line 1122 "./parse.y"
3456 {yyerror ("Missing term"); RECOVER;;
3457 break;}
3458 case 186:
3459 #line 1128 "./parse.y"
3460 { yyval.node = empty_stmt_node; ;
3461 break;}
3462 case 187:
3463 #line 1130 "./parse.y"
3464 { yyval.node = yyvsp[0].node; ;
3465 break;}
3466 case 188:
3467 #line 1135 "./parse.y"
3468 { enter_block (); ;
3469 break;}
3470 case 189:
3471 #line 1140 "./parse.y"
3472 {
3473 maybe_absorb_scoping_blocks ();
3474 yyval.node = exit_block ();
3475 ;
3476 break;}
3477 case 193:
3478 #line 1154 "./parse.y"
3479 { java_method_add_stmt (current_function_decl, yyvsp[0].node); ;
3480 break;}
3481 case 194:
3482 #line 1156 "./parse.y"
3483 { parse_jdk1_1_error ("inner class declaration"); ;
3484 break;}
3485 case 196:
3486 #line 1165 "./parse.y"
3487 { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ;
3488 break;}
3489 case 197:
3490 #line 1167 "./parse.y"
3491 { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ;
3492 break;}
3493 case 203:
3494 #line 1177 "./parse.y"
3495 {
3496 /* If the for loop is unlabeled, we must return the
3497 block it was defined it. It our last chance to
3498 get a hold on it. */
3499 if (!LOOP_HAS_LABEL_P (yyval.node))
3500 yyval.node = exit_block ();
3501 ;
3502 break;}
3503 case 220:
3504 #line 1210 "./parse.y"
3505 { yyval.node = empty_stmt_node; ;
3506 break;}
3507 case 221:
3508 #line 1215 "./parse.y"
3509 {
3510 yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node),
3511 EXPR_WFL_NODE (yyvsp[-1].node));
3512 pushlevel (2);
3513 push_labeled_block (yyval.node);
3514 PUSH_LABELED_BLOCK (yyval.node);
3515 ;
3516 break;}
3517 case 222:
3518 #line 1226 "./parse.y"
3519 {
3520 yyval.node = complete_labeled_statement (yyvsp[-1].node, yyvsp[0].node);
3521 pop_labeled_block ();
3522 POP_LABELED_BLOCK ();
3523 ;
3524 break;}
3525 case 223:
3526 #line 1232 "./parse.y"
3527 {yyerror ("':' expected"); RECOVER;;
3528 break;}
3529 case 224:
3530 #line 1237 "./parse.y"
3531 {
3532 yyval.node = complete_labeled_statement (yyvsp[-1].node, yyvsp[0].node);
3533 pop_labeled_block ();
3534 POP_LABELED_BLOCK ();
3535 ;
3536 break;}
3537 case 225:
3538 #line 1248 "./parse.y"
3539 {
3540 /* We have a statement. Generate a WFL around it so
3541 we can debug it */
3542 yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0);
3543 /* We know we have a statement, so set the debug
3544 info to be eventually generate here. */
3545 yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node);
3546 ;
3547 break;}
3548 case 226:
3549 #line 1257 "./parse.y"
3550 {
3551 if (ctxp->prevent_ese != lineno)
3552 yyerror ("Invalid expression statement");
3553 DRECOVER (expr_stmt);
3554 ;
3555 break;}
3556 case 227:
3557 #line 1263 "./parse.y"
3558 {
3559 if (ctxp->prevent_ese != lineno)
3560 yyerror ("Invalid expression statement");
3561 DRECOVER (expr_stmt);
3562 ;
3563 break;}
3564 case 228:
3565 #line 1269 "./parse.y"
3566 {
3567 if (ctxp->prevent_ese != lineno)
3568 yyerror ("Invalid expression statement");
3569 DRECOVER (expr_stmt);
3570 ;
3571 break;}
3572 case 229:
3573 #line 1275 "./parse.y"
3574 {yyerror ("')' expected"); RECOVER;;
3575 break;}
3576 case 230:
3577 #line 1277 "./parse.y"
3578 {
3579 yyerror ("Constructor invocation must be first "
3580 "thing in a constructor");
3581 RECOVER;
3582 ;
3583 break;}
3584 case 231:
3585 #line 1283 "./parse.y"
3586 {yyerror ("')' expected"); RECOVER;;
3587 break;}
3588 case 232:
3589 #line 1285 "./parse.y"
3590 {
3591 yyerror ("Constructor invocation must be first "
3592 "thing in a constructor");
3593 RECOVER;
3594 ;
3595 break;}
3596 case 233:
3597 #line 1291 "./parse.y"
3598 {yyerror ("'(' expected"); RECOVER;;
3599 break;}
3600 case 234:
3601 #line 1293 "./parse.y"
3602 {yyerror ("')' expected"); RECOVER;;
3603 break;}
3604 case 235:
3605 #line 1295 "./parse.y"
3606 {yyerror ("')' expected"); RECOVER;;
3607 break;}
3608 case 236:
3609 #line 1297 "./parse.y"
3610 {yyerror ("';' expected"); RECOVER;;
3611 break;}
3612 case 237:
3613 #line 1299 "./parse.y"
3614 {yyerror ("';' expected"); RECOVER;;
3615 break;}
3616 case 245:
3617 #line 1314 "./parse.y"
3618 { yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node, NULL_TREE); ;
3619 break;}
3620 case 246:
3621 #line 1316 "./parse.y"
3622 {yyerror ("'(' expected"); RECOVER;;
3623 break;}
3624 case 247:
3625 #line 1318 "./parse.y"
3626 {yyerror ("Missing term"); RECOVER;;
3627 break;}
3628 case 248:
3629 #line 1320 "./parse.y"
3630 {yyerror ("')' expected"); RECOVER;;
3631 break;}
3632 case 249:
3633 #line 1325 "./parse.y"
3634 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3635 break;}
3636 case 250:
3637 #line 1330 "./parse.y"
3638 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3639 break;}
3640 case 251:
3641 #line 1335 "./parse.y"
3642 {
3643 enter_block ();
3644 ;
3645 break;}
3646 case 252:
3647 #line 1339 "./parse.y"
3648 {
3649 /* Make into "proper list" of COMPOUND_EXPRs.
3650 I.e. make the last statment also have its own
3651 COMPOUND_EXPR. */
3652 maybe_absorb_scoping_blocks ();
3653 TREE_OPERAND (yyvsp[-2].node, 1) = exit_block ();
3654 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-2].node), yyvsp[-2].node);
3655 ;
3656 break;}
3657 case 253:
3658 #line 1351 "./parse.y"
3659 {
3660 yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE);
3661 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3662 ;
3663 break;}
3664 case 254:
3665 #line 1356 "./parse.y"
3666 {yyerror ("'(' expected"); RECOVER;;
3667 break;}
3668 case 255:
3669 #line 1358 "./parse.y"
3670 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;
3671 break;}
3672 case 256:
3673 #line 1360 "./parse.y"
3674 {yyerror ("'{' expected"); RECOVER;;
3675 break;}
3676 case 257:
3677 #line 1368 "./parse.y"
3678 { yyval.node = NULL_TREE; ;
3679 break;}
3680 case 258:
3681 #line 1370 "./parse.y"
3682 { yyval.node = NULL_TREE; ;
3683 break;}
3684 case 259:
3685 #line 1372 "./parse.y"
3686 { yyval.node = NULL_TREE; ;
3687 break;}
3688 case 260:
3689 #line 1374 "./parse.y"
3690 { yyval.node = NULL_TREE; ;
3691 break;}
3692 case 266:
3693 #line 1393 "./parse.y"
3694 {
3695 tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node);
3696 EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location;
3697 java_method_add_stmt (current_function_decl, lab);
3698 ;
3699 break;}
3700 case 267:
3701 #line 1399 "./parse.y"
3702 {
3703 tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
3704 EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location;
3705 java_method_add_stmt (current_function_decl, lab);
3706 ;
3707 break;}
3708 case 268:
3709 #line 1405 "./parse.y"
3710 {yyerror ("Missing or invalid constant expression"); RECOVER;;
3711 break;}
3712 case 269:
3713 #line 1407 "./parse.y"
3714 {yyerror ("':' expected"); RECOVER;;
3715 break;}
3716 case 270:
3717 #line 1409 "./parse.y"
3718 {yyerror ("':' expected"); RECOVER;;
3719 break;}
3720 case 271:
3721 #line 1414 "./parse.y"
3722 {
3723 tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
3724 yyval.node = build_new_loop (body);
3725 ;
3726 break;}
3727 case 272:
3728 #line 1422 "./parse.y"
3729 { yyval.node = complete_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3730 break;}
3731 case 273:
3732 #line 1424 "./parse.y"
3733 {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;
3734 break;}
3735 case 274:
3736 #line 1426 "./parse.y"
3737 {yyerror ("Missing term and ')' expected"); RECOVER;;
3738 break;}
3739 case 275:
3740 #line 1428 "./parse.y"
3741 {yyerror ("')' expected"); RECOVER;;
3742 break;}
3743 case 276:
3744 #line 1433 "./parse.y"
3745 { yyval.node = complete_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3746 break;}
3747 case 277:
3748 #line 1438 "./parse.y"
3749 {
3750 tree body = build_loop_body (0, NULL_TREE, 1);
3751 yyval.node = build_new_loop (body);
3752 ;
3753 break;}
3754 case 278:
3755 #line 1447 "./parse.y"
3756 { yyval.node = complete_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ;
3757 break;}
3758 case 279:
3759 #line 1452 "./parse.y"
3760 { yyval.node = complete_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
3761 break;}
3762 case 280:
3763 #line 1454 "./parse.y"
3764 {
3765 yyval.node = complete_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3766 /* We have not condition, so we get rid of the EXIT_EXPR */
3767 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
3768 empty_stmt_node;
3769 ;
3770 break;}
3771 case 281:
3772 #line 1461 "./parse.y"
3773 {yyerror ("Invalid control expression"); RECOVER;;
3774 break;}
3775 case 282:
3776 #line 1463 "./parse.y"
3777 {yyerror ("Invalid update expression"); RECOVER;;
3778 break;}
3779 case 283:
3780 #line 1465 "./parse.y"
3781 {yyerror ("Invalid update expression"); RECOVER;;
3782 break;}
3783 case 284:
3784 #line 1470 "./parse.y"
3785 { yyval.node = complete_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
3786 break;}
3787 case 285:
3788 #line 1472 "./parse.y"
3789 {
3790 yyval.node = complete_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3791 /* We have not condition, so we get rid of the EXIT_EXPR */
3792 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
3793 empty_stmt_node;
3794 ;
3795 break;}
3796 case 286:
3797 #line 1482 "./parse.y"
3798 {
3799 /* This scope defined for local variable that may be
3800 defined within the scope of the for loop */
3801 enter_block ();
3802 ;
3803 break;}
3804 case 287:
3805 #line 1488 "./parse.y"
3806 {yyerror ("'(' expected"); DRECOVER(for_1);;
3807 break;}
3808 case 288:
3809 #line 1490 "./parse.y"
3810 {yyerror ("Invalid init statement"); RECOVER;;
3811 break;}
3812 case 289:
3813 #line 1495 "./parse.y"
3814 {
3815 /* We now declare the loop body. The loop is
3816 declared as a for loop. */
3817 tree body = build_loop_body (0, NULL_TREE, 0);
3818 yyval.node = build_new_loop (body);
3819 IS_FOR_LOOP_P (yyval.node) = 1;
3820 /* The loop is added to the current block the for
3821 statement is defined within */
3822 java_method_add_stmt (current_function_decl, yyval.node);
3823 ;
3824 break;}
3825 case 290:
3826 #line 1507 "./parse.y"
3827 { yyval.node = empty_stmt_node; ;
3828 break;}
3829 case 291:
3830 #line 1509 "./parse.y"
3831 {
3832 /* Init statement recorded within the previously
3833 defined block scope */
3834 yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node);
3835 ;
3836 break;}
3837 case 292:
3838 #line 1515 "./parse.y"
3839 {
3840 /* Local variable are recorded within the previously
3841 defined block scope */
3842 yyval.node = NULL_TREE;
3843 ;
3844 break;}
3845 case 293:
3846 #line 1521 "./parse.y"
3847 {yyerror ("';' expected"); DRECOVER(for_init_1);;
3848 break;}
3849 case 294:
3850 #line 1525 "./parse.y"
3851 {yyval.node = empty_stmt_node;;
3852 break;}
3853 case 295:
3854 #line 1527 "./parse.y"
3855 { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ;
3856 break;}
3857 case 296:
3858 #line 1532 "./parse.y"
3859 { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ;
3860 break;}
3861 case 297:
3862 #line 1534 "./parse.y"
3863 { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ;
3864 break;}
3865 case 298:
3866 #line 1536 "./parse.y"
3867 {yyerror ("Missing term"); RECOVER;;
3868 break;}
3869 case 299:
3870 #line 1541 "./parse.y"
3871 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ;
3872 break;}
3873 case 300:
3874 #line 1543 "./parse.y"
3875 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ;
3876 break;}
3877 case 301:
3878 #line 1545 "./parse.y"
3879 {yyerror ("Missing term"); RECOVER;;
3880 break;}
3881 case 302:
3882 #line 1547 "./parse.y"
3883 {yyerror ("';' expected"); RECOVER;;
3884 break;}
3885 case 303:
3886 #line 1552 "./parse.y"
3887 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ;
3888 break;}
3889 case 304:
3890 #line 1554 "./parse.y"
3891 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ;
3892 break;}
3893 case 305:
3894 #line 1556 "./parse.y"
3895 {yyerror ("Missing term"); RECOVER;;
3896 break;}
3897 case 306:
3898 #line 1558 "./parse.y"
3899 {yyerror ("';' expected"); RECOVER;;
3900 break;}
3901 case 307:
3902 #line 1563 "./parse.y"
3903 { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ;
3904 break;}
3905 case 308:
3906 #line 1565 "./parse.y"
3907 { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3908 break;}
3909 case 309:
3910 #line 1567 "./parse.y"
3911 {yyerror ("Missing term"); RECOVER;;
3912 break;}
3913 case 310:
3914 #line 1569 "./parse.y"
3915 {yyerror ("';' expected"); RECOVER;;
3916 break;}
3917 case 311:
3918 #line 1574 "./parse.y"
3919 {
3920 yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node);
3921 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3922 ;
3923 break;}
3924 case 312:
3925 #line 1579 "./parse.y"
3926 {yyerror ("Missing term"); RECOVER;;
3927 break;}
3928 case 313:
3929 #line 1581 "./parse.y"
3930 {yyerror ("';' expected"); RECOVER;;
3931 break;}
3932 case 314:
3933 #line 1586 "./parse.y"
3934 {
3935 yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3936 EXPR_WFL_LINECOL (yyval.node) =
3937 EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));
3938 ;
3939 break;}
3940 case 315:
3941 #line 1592 "./parse.y"
3942 {yyerror ("'{' expected"); RECOVER;;
3943 break;}
3944 case 316:
3945 #line 1594 "./parse.y"
3946 {yyerror ("'(' expected"); RECOVER;;
3947 break;}
3948 case 317:
3949 #line 1596 "./parse.y"
3950 {yyerror ("Missing term"); RECOVER;;
3951 break;}
3952 case 318:
3953 #line 1598 "./parse.y"
3954 {yyerror ("Missing term"); RECOVER;;
3955 break;}
3956 case 319:
3957 #line 1603 "./parse.y"
3958 {
3959 if ((1 << yyvsp[0].value) != ACC_SYNCHRONIZED)
3960 fatal ("synchronized was '%d' - yyparse", (1 << yyvsp[0].value));
3961 ;
3962 break;}
3963 case 320:
3964 #line 1611 "./parse.y"
3965 { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node, NULL_TREE); ;
3966 break;}
3967 case 321:
3968 #line 1613 "./parse.y"
3969 { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, NULL_TREE, yyvsp[0].node); ;
3970 break;}
3971 case 322:
3972 #line 1615 "./parse.y"
3973 { yyval.node = build_try_statement (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3974 break;}
3975 case 323:
3976 #line 1617 "./parse.y"
3977 {yyerror ("'{' expected"); DRECOVER (try_statement);;
3978 break;}
3979 case 325:
3980 #line 1623 "./parse.y"
3981 {
3982 TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node;
3983 yyval.node = yyvsp[0].node;
3984 ;
3985 break;}
3986 case 326:
3987 #line 1631 "./parse.y"
3988 {
3989 java_method_add_stmt (current_function_decl, yyvsp[0].node);
3990 exit_block ();
3991 yyval.node = yyvsp[-1].node;
3992 ;
3993 break;}
3994 case 327:
3995 #line 1639 "./parse.y"
3996 {
3997 /* We add a block to define a scope for
3998 formal_parameter (CCBP). The formal parameter is
3999 declared initialized by the appropriate function
4000 call */
4001 tree ccpb = enter_block ();
4002 tree init = build_assignment (ASSIGN_TK, yyvsp[-2].operator.location,
4003 TREE_PURPOSE (yyvsp[-1].node),
4004 soft_exceptioninfo_call_node);
4005 declare_local_variables (0, TREE_VALUE (yyvsp[-1].node),
4006 build_tree_list (TREE_PURPOSE (yyvsp[-1].node),
4007 init));
4008 yyval.node = build1 (CATCH_EXPR, NULL_TREE, ccpb);
4009 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4010 ;
4011 break;}
4012 case 328:
4013 #line 1655 "./parse.y"
4014 {yyerror ("'(' expected"); RECOVER;;
4015 break;}
4016 case 329:
4017 #line 1657 "./parse.y"
4018 {yyerror ("Missing term or ')' expected"); DRECOVER (2);;
4019 break;}
4020 case 330:
4021 #line 1659 "./parse.y"
4022 {yyerror ("')' expected"); DRECOVER (1);;
4023 break;}
4024 case 331:
4025 #line 1664 "./parse.y"
4026 {
4027 yyval.node = build (FINALLY_EXPR, NULL_TREE,
4028 create_label_decl (generate_name ()), yyvsp[0].node);
4029 ;
4030 break;}
4031 case 332:
4032 #line 1669 "./parse.y"
4033 {yyerror ("'{' expected"); RECOVER; ;
4034 break;}
4035 case 336:
4036 #line 1681 "./parse.y"
4037 { yyval.node = build_this (yyvsp[0].operator.location); ;
4038 break;}
4039 case 337:
4040 #line 1683 "./parse.y"
4041 {yyval.node = yyvsp[-1].node;;
4042 break;}
4043 case 342:
4044 #line 1692 "./parse.y"
4045 { yyval.node = parse_jdk1_1_error ("named class literals"); ;
4046 break;}
4047 case 343:
4048 #line 1694 "./parse.y"
4049 { yyval.node = build_class_ref (yyvsp[-2].node); ;
4050 break;}
4051 case 344:
4052 #line 1696 "./parse.y"
4053 { yyval.node = build_class_ref (void_type_node); ;
4054 break;}
4055 case 345:
4056 #line 1701 "./parse.y"
4057 { yyval.node = parse_jdk1_1_error ("class literals"); ;
4058 break;}
4059 case 346:
4060 #line 1703 "./parse.y"
4061 {yyerror ("')' expected"); RECOVER;;
4062 break;}
4063 case 347:
4064 #line 1705 "./parse.y"
4065 {yyerror ("'class' or 'this' expected" ); RECOVER;;
4066 break;}
4067 case 348:
4068 #line 1707 "./parse.y"
4069 {yyerror ("'class' expected" ); RECOVER;;
4070 break;}
4071 case 349:
4072 #line 1709 "./parse.y"
4073 {yyerror ("'class' expected" ); RECOVER;;
4074 break;}
4075 case 350:
4076 #line 1714 "./parse.y"
4077 { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4078 break;}
4079 case 351:
4080 #line 1716 "./parse.y"
4081 { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ;
4082 break;}
4083 case 352:
4084 #line 1721 "./parse.y"
4085 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4086 break;}
4087 case 353:
4088 #line 1723 "./parse.y"
4089 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4090 break;}
4091 case 358:
4092 #line 1732 "./parse.y"
4093 {yyerror ("'(' expected"); DRECOVER(new_1);;
4094 break;}
4095 case 359:
4096 #line 1734 "./parse.y"
4097 {yyerror ("'(' expected"); RECOVER;;
4098 break;}
4099 case 360:
4100 #line 1736 "./parse.y"
4101 {yyerror ("')' or term expected"); RECOVER;;
4102 break;}
4103 case 361:
4104 #line 1738 "./parse.y"
4105 {yyerror ("')' expected"); RECOVER;;
4106 break;}
4107 case 362:
4108 #line 1740 "./parse.y"
4109 {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;;
4110 break;}
4111 case 363:
4112 #line 1742 "./parse.y"
4113 {yyerror ("'(' expected"); RECOVER;;
4114 break;}
4115 case 366:
4116 #line 1752 "./parse.y"
4117 {
4118 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
4119 ctxp->formal_parameter_number = 1;
4120 ;
4121 break;}
4122 case 367:
4123 #line 1757 "./parse.y"
4124 {
4125 ctxp->formal_parameter_number += 1;
4126 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
4127 ;
4128 break;}
4129 case 368:
4130 #line 1762 "./parse.y"
4131 {yyerror ("Missing term"); RECOVER;;
4132 break;}
4133 case 369:
4134 #line 1767 "./parse.y"
4135 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4136 break;}
4137 case 370:
4138 #line 1769 "./parse.y"
4139 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4140 break;}
4141 case 371:
4142 #line 1771 "./parse.y"
4143 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, ctxp->osb_number); ;
4144 break;}
4145 case 372:
4146 #line 1773 "./parse.y"
4147 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, ctxp->osb_number); ;
4148 break;}
4149 case 373:
4150 #line 1777 "./parse.y"
4151 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4152 break;}
4153 case 374:
4154 #line 1779 "./parse.y"
4155 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4156 break;}
4157 case 375:
4158 #line 1781 "./parse.y"
4159 {yyerror ("'[' expected"); DRECOVER ("]");;
4160 break;}
4161 case 376:
4162 #line 1783 "./parse.y"
4163 {yyerror ("']' expected"); RECOVER;;
4164 break;}
4165 case 377:
4166 #line 1788 "./parse.y"
4167 { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ;
4168 break;}
4169 case 378:
4170 #line 1790 "./parse.y"
4171 { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ;
4172 break;}
4173 case 379:
4174 #line 1795 "./parse.y"
4175 {
4176 EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
4177 yyval.node = yyvsp[-1].node;
4178 ;
4179 break;}
4180 case 380:
4181 #line 1800 "./parse.y"
4182 {yyerror ("']' expected"); RECOVER;;
4183 break;}
4184 case 381:
4185 #line 1802 "./parse.y"
4186 {
4187 yyerror ("Missing term");
4188 yyerror ("']' expected");
4189 RECOVER;
4190 ;
4191 break;}
4192 case 382:
4193 #line 1811 "./parse.y"
4194 { ctxp->osb_number = 1; ;
4195 break;}
4196 case 383:
4197 #line 1813 "./parse.y"
4198 { ctxp->osb_number++; ;
4199 break;}
4200 case 384:
4201 #line 1815 "./parse.y"
4202 { yyerror ("']' expected"); RECOVER;;
4203 break;}
4204 case 385:
4205 #line 1820 "./parse.y"
4206 { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
4207 break;}
4208 case 386:
4209 #line 1824 "./parse.y"
4210 {
4211 tree super_wfl =
4212 build_wfl_node (super_identifier_node,
4213 input_filename, 0, 0);
4214 EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location;
4215 yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location);
4216 ;
4217 break;}
4218 case 387:
4219 #line 1832 "./parse.y"
4220 {yyerror ("Field expected"); DRECOVER (super_field_acces);;
4221 break;}
4222 case 388:
4223 #line 1837 "./parse.y"
4224 { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ;
4225 break;}
4226 case 389:
4227 #line 1839 "./parse.y"
4228 { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4229 break;}
4230 case 390:
4231 #line 1841 "./parse.y"
4232 {
4233 if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR)
4234 yyval.node = build_this_super_qualified_invocation
4235 (1, yyvsp[-2].node, NULL_TREE, 0, yyvsp[-3].operator.location);
4236 else
4237 {
4238 tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE);
4239 yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location);
4240 }
4241 ;
4242 break;}
4243 case 391:
4244 #line 1852 "./parse.y"
4245 {
4246 if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR)
4247 yyval.node = build_this_super_qualified_invocation
4248 (1, yyvsp[-3].node, yyvsp[-1].node, 0, yyvsp[-4].operator.location);
4249 else
4250 {
4251 tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node);
4252 yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location);
4253 }
4254 ;
4255 break;}
4256 case 392:
4257 #line 1863 "./parse.y"
4258 {
4259 yyval.node = build_this_super_qualified_invocation
4260 (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location);
4261 ;
4262 break;}
4263 case 393:
4264 #line 1868 "./parse.y"
4265 {
4266 yyval.node = build_this_super_qualified_invocation
4267 (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location);
4268 ;
4269 break;}
4270 case 394:
4271 #line 1877 "./parse.y"
4272 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4273 break;}
4274 case 395:
4275 #line 1879 "./parse.y"
4276 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4277 break;}
4278 case 396:
4279 #line 1884 "./parse.y"
4280 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4281 break;}
4282 case 397:
4283 #line 1886 "./parse.y"
4284 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4285 break;}
4286 case 398:
4287 #line 1888 "./parse.y"
4288 {
4289 yyerror ("Missing term and ']' expected");
4290 DRECOVER(array_access);
4291 ;
4292 break;}
4293 case 399:
4294 #line 1893 "./parse.y"
4295 {
4296 yyerror ("']' expected");
4297 DRECOVER(array_access);
4298 ;
4299 break;}
4300 case 400:
4301 #line 1898 "./parse.y"
4302 {
4303 yyerror ("Missing term and ']' expected");
4304 DRECOVER(array_access);
4305 ;
4306 break;}
4307 case 401:
4308 #line 1903 "./parse.y"
4309 {
4310 yyerror ("']' expected");
4311 DRECOVER(array_access);
4312 ;
4313 break;}
4314 case 406:
4315 #line 1918 "./parse.y"
4316 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4317 break;}
4318 case 407:
4319 #line 1923 "./parse.y"
4320 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4321 break;}
4322 case 410:
4323 #line 1930 "./parse.y"
4324 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4325 break;}
4326 case 411:
4327 #line 1932 "./parse.y"
4328 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4329 break;}
4330 case 413:
4331 #line 1935 "./parse.y"
4332 {yyerror ("Missing term"); RECOVER;
4333 break;}
4334 case 414:
4335 #line 1937 "./parse.y"
4336 {yyerror ("Missing term"); RECOVER;
4337 break;}
4338 case 415:
4339 #line 1942 "./parse.y"
4340 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4341 break;}
4342 case 416:
4343 #line 1944 "./parse.y"
4344 {yyerror ("Missing term"); RECOVER;
4345 break;}
4346 case 417:
4347 #line 1949 "./parse.y"
4348 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4349 break;}
4350 case 418:
4351 #line 1951 "./parse.y"
4352 {yyerror ("Missing term"); RECOVER;
4353 break;}
4354 case 420:
4355 #line 1957 "./parse.y"
4356 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4357 break;}
4358 case 421:
4359 #line 1959 "./parse.y"
4360 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4361 break;}
4362 case 423:
4363 #line 1962 "./parse.y"
4364 {yyerror ("Missing term"); RECOVER;
4365 break;}
4366 case 424:
4367 #line 1964 "./parse.y"
4368 {yyerror ("Missing term"); RECOVER;
4369 break;}
4370 case 425:
4371 #line 1969 "./parse.y"
4372 {
4373 tree type = yyvsp[-3].node;
4374 while (ctxp->osb_number--)
4375 type = build_java_array_type (type, -1);
4376 yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node);
4377 ;
4378 break;}
4379 case 426:
4380 #line 1976 "./parse.y"
4381 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4382 break;}
4383 case 427:
4384 #line 1978 "./parse.y"
4385 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4386 break;}
4387 case 428:
4388 #line 1980 "./parse.y"
4389 {
4390 char *ptr;
4391 while (ctxp->osb_number--)
4392 obstack_1grow (&temporary_obstack, '[');
4393 obstack_grow0 (&temporary_obstack,
4394 IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)),
4395 IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node)));
4396 ptr = obstack_finish (&temporary_obstack);
4397 EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr);
4398 yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node);
4399 ;
4400 break;}
4401 case 429:
4402 #line 1992 "./parse.y"
4403 {yyerror ("']' expected, invalid type expression");;
4404 break;}
4405 case 430:
4406 #line 1994 "./parse.y"
4407 {
4408 if (ctxp->prevent_ese != lineno)
4409 yyerror ("Invalid type expression"); RECOVER;
4410 RECOVER;
4411 ;
4412 break;}
4413 case 431:
4414 #line 2000 "./parse.y"
4415 {yyerror ("Missing term"); RECOVER;;
4416 break;}
4417 case 432:
4418 #line 2002 "./parse.y"
4419 {yyerror ("Missing term"); RECOVER;;
4420 break;}
4421 case 433:
4422 #line 2004 "./parse.y"
4423 {yyerror ("Missing term"); RECOVER;;
4424 break;}
4425 case 435:
4426 #line 2010 "./parse.y"
4427 {
4428 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token),
4429 yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
4430 ;
4431 break;}
4432 case 436:
4433 #line 2015 "./parse.y"
4434 {
4435 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4436 yyvsp[-2].node, yyvsp[0].node);
4437 ;
4438 break;}
4439 case 437:
4440 #line 2020 "./parse.y"
4441 {
4442 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4443 yyvsp[-2].node, yyvsp[0].node);
4444 ;
4445 break;}
4446 case 438:
4447 #line 2025 "./parse.y"
4448 {yyerror ("Missing term"); RECOVER;;
4449 break;}
4450 case 439:
4451 #line 2027 "./parse.y"
4452 {yyerror ("Missing term"); RECOVER;;
4453 break;}
4454 case 440:
4455 #line 2029 "./parse.y"
4456 {yyerror ("Missing term"); RECOVER;;
4457 break;}
4458 case 442:
4459 #line 2035 "./parse.y"
4460 {
4461 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4462 yyvsp[-2].node, yyvsp[0].node);
4463 ;
4464 break;}
4465 case 443:
4466 #line 2040 "./parse.y"
4467 {
4468 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4469 yyvsp[-2].node, yyvsp[0].node);
4470 ;
4471 break;}
4472 case 444:
4473 #line 2045 "./parse.y"
4474 {yyerror ("Missing term"); RECOVER;;
4475 break;}
4476 case 445:
4477 #line 2047 "./parse.y"
4478 {yyerror ("Missing term"); RECOVER;;
4479 break;}
4480 case 447:
4481 #line 2053 "./parse.y"
4482 {
4483 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4484 yyvsp[-2].node, yyvsp[0].node);
4485 ;
4486 break;}
4487 case 448:
4488 #line 2058 "./parse.y"
4489 {
4490 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4491 yyvsp[-2].node, yyvsp[0].node);
4492 ;
4493 break;}
4494 case 449:
4495 #line 2063 "./parse.y"
4496 {
4497 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4498 yyvsp[-2].node, yyvsp[0].node);
4499 ;
4500 break;}
4501 case 450:
4502 #line 2068 "./parse.y"
4503 {yyerror ("Missing term"); RECOVER;;
4504 break;}
4505 case 451:
4506 #line 2070 "./parse.y"
4507 {yyerror ("Missing term"); RECOVER;;
4508 break;}
4509 case 452:
4510 #line 2072 "./parse.y"
4511 {yyerror ("Missing term"); RECOVER;;
4512 break;}
4513 case 454:
4514 #line 2078 "./parse.y"
4515 {
4516 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4517 yyvsp[-2].node, yyvsp[0].node);
4518 ;
4519 break;}
4520 case 455:
4521 #line 2083 "./parse.y"
4522 {
4523 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4524 yyvsp[-2].node, yyvsp[0].node);
4525 ;
4526 break;}
4527 case 456:
4528 #line 2088 "./parse.y"
4529 {
4530 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4531 yyvsp[-2].node, yyvsp[0].node);
4532 ;
4533 break;}
4534 case 457:
4535 #line 2093 "./parse.y"
4536 {
4537 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4538 yyvsp[-2].node, yyvsp[0].node);
4539 ;
4540 break;}
4541 case 458:
4542 #line 2098 "./parse.y"
4543 { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4544 break;}
4545 case 459:
4546 #line 2100 "./parse.y"
4547 {yyerror ("Missing term"); RECOVER;;
4548 break;}
4549 case 460:
4550 #line 2102 "./parse.y"
4551 {yyerror ("Missing term"); RECOVER;;
4552 break;}
4553 case 461:
4554 #line 2104 "./parse.y"
4555 {yyerror ("Missing term"); RECOVER;;
4556 break;}
4557 case 462:
4558 #line 2106 "./parse.y"
4559 {yyerror ("Missing term"); RECOVER;;
4560 break;}
4561 case 463:
4562 #line 2108 "./parse.y"
4563 {yyerror ("Invalid reference type"); RECOVER;;
4564 break;}
4565 case 465:
4566 #line 2114 "./parse.y"
4567 {
4568 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4569 yyvsp[-2].node, yyvsp[0].node);
4570 ;
4571 break;}
4572 case 466:
4573 #line 2119 "./parse.y"
4574 {
4575 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4576 yyvsp[-2].node, yyvsp[0].node);
4577 ;
4578 break;}
4579 case 467:
4580 #line 2124 "./parse.y"
4581 {yyerror ("Missing term"); RECOVER;;
4582 break;}
4583 case 468:
4584 #line 2126 "./parse.y"
4585 {yyerror ("Missing term"); RECOVER;;
4586 break;}
4587 case 470:
4588 #line 2132 "./parse.y"
4589 {
4590 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4591 yyvsp[-2].node, yyvsp[0].node);
4592 ;
4593 break;}
4594 case 471:
4595 #line 2137 "./parse.y"
4596 {yyerror ("Missing term"); RECOVER;;
4597 break;}
4598 case 473:
4599 #line 2143 "./parse.y"
4600 {
4601 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4602 yyvsp[-2].node, yyvsp[0].node);
4603 ;
4604 break;}
4605 case 474:
4606 #line 2148 "./parse.y"
4607 {yyerror ("Missing term"); RECOVER;;
4608 break;}
4609 case 476:
4610 #line 2154 "./parse.y"
4611 {
4612 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4613 yyvsp[-2].node, yyvsp[0].node);
4614 ;
4615 break;}
4616 case 477:
4617 #line 2159 "./parse.y"
4618 {yyerror ("Missing term"); RECOVER;;
4619 break;}
4620 case 479:
4621 #line 2165 "./parse.y"
4622 {
4623 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4624 yyvsp[-2].node, yyvsp[0].node);
4625 ;
4626 break;}
4627 case 480:
4628 #line 2170 "./parse.y"
4629 {yyerror ("Missing term"); RECOVER;;
4630 break;}
4631 case 482:
4632 #line 2176 "./parse.y"
4633 {
4634 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4635 yyvsp[-2].node, yyvsp[0].node);
4636 ;
4637 break;}
4638 case 483:
4639 #line 2181 "./parse.y"
4640 {yyerror ("Missing term"); RECOVER;;
4641 break;}
4642 case 485:
4643 #line 2187 "./parse.y"
4644 {
4645 yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
4646 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4647 ;
4648 break;}
4649 case 486:
4650 #line 2192 "./parse.y"
4651 {
4652 YYERROR_NOW;
4653 yyerror ("Missing term");
4654 DRECOVER (1);
4655 ;
4656 break;}
4657 case 487:
4658 #line 2198 "./parse.y"
4659 {yyerror ("Missing term"); DRECOVER (2);;
4660 break;}
4661 case 488:
4662 #line 2200 "./parse.y"
4663 {yyerror ("Missing term"); DRECOVER (3);;
4664 break;}
4665 case 491:
4666 #line 2210 "./parse.y"
4667 { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4668 break;}
4669 case 492:
4670 #line 2212 "./parse.y"
4671 {
4672 if (ctxp->prevent_ese != lineno)
4673 yyerror ("Missing term");
4674 DRECOVER (assign);
4675 ;
4676 break;}
4677 }
4678 /* the action file gets copied in in place of this dollarsign */
4679 #line 498 "/usr/share/misc/bison.simple"
4680 \f
4681 yyvsp -= yylen;
4682 yyssp -= yylen;
4683 #ifdef YYLSP_NEEDED
4684 yylsp -= yylen;
4685 #endif
4686
4687 #if YYDEBUG != 0
4688 if (yydebug)
4689 {
4690 short *ssp1 = yyss - 1;
4691 fprintf (stderr, "state stack now");
4692 while (ssp1 != yyssp)
4693 fprintf (stderr, " %d", *++ssp1);
4694 fprintf (stderr, "\n");
4695 }
4696 #endif
4697
4698 *++yyvsp = yyval;
4699
4700 #ifdef YYLSP_NEEDED
4701 yylsp++;
4702 if (yylen == 0)
4703 {
4704 yylsp->first_line = yylloc.first_line;
4705 yylsp->first_column = yylloc.first_column;
4706 yylsp->last_line = (yylsp-1)->last_line;
4707 yylsp->last_column = (yylsp-1)->last_column;
4708 yylsp->text = 0;
4709 }
4710 else
4711 {
4712 yylsp->last_line = (yylsp+yylen-1)->last_line;
4713 yylsp->last_column = (yylsp+yylen-1)->last_column;
4714 }
4715 #endif
4716
4717 /* Now "shift" the result of the reduction.
4718 Determine what state that goes to,
4719 based on the state we popped back to
4720 and the rule number reduced by. */
4721
4722 yyn = yyr1[yyn];
4723
4724 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
4725 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4726 yystate = yytable[yystate];
4727 else
4728 yystate = yydefgoto[yyn - YYNTBASE];
4729
4730 goto yynewstate;
4731
4732 yyerrlab: /* here on detecting error */
4733
4734 if (! yyerrstatus)
4735 /* If not already recovering from an error, report this error. */
4736 {
4737 ++yynerrs;
4738
4739 #ifdef YYERROR_VERBOSE
4740 yyn = yypact[yystate];
4741
4742 if (yyn > YYFLAG && yyn < YYLAST)
4743 {
4744 int size = 0;
4745 char *msg;
4746 int x, count;
4747
4748 count = 0;
4749 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
4750 for (x = (yyn < 0 ? -yyn : 0);
4751 x < (sizeof(yytname) / sizeof(char *)); x++)
4752 if (yycheck[x + yyn] == x)
4753 size += strlen(yytname[x]) + 15, count++;
4754 msg = (char *) malloc(size + 15);
4755 if (msg != 0)
4756 {
4757 strcpy(msg, "parse error");
4758
4759 if (count < 5)
4760 {
4761 count = 0;
4762 for (x = (yyn < 0 ? -yyn : 0);
4763 x < (sizeof(yytname) / sizeof(char *)); x++)
4764 if (yycheck[x + yyn] == x)
4765 {
4766 strcat(msg, count == 0 ? ", expecting `" : " or `");
4767 strcat(msg, yytname[x]);
4768 strcat(msg, "'");
4769 count++;
4770 }
4771 }
4772 yyerror(msg);
4773 free(msg);
4774 }
4775 else
4776 yyerror ("parse error; also virtual memory exceeded");
4777 }
4778 else
4779 #endif /* YYERROR_VERBOSE */
4780 yyerror("parse error");
4781 }
4782
4783 goto yyerrlab1;
4784 yyerrlab1: /* here on error raised explicitly by an action */
4785
4786 if (yyerrstatus == 3)
4787 {
4788 /* if just tried and failed to reuse lookahead token after an error, discard it. */
4789
4790 /* return failure if at end of input */
4791 if (yychar == YYEOF)
4792 YYABORT;
4793
4794 #if YYDEBUG != 0
4795 if (yydebug)
4796 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
4797 #endif
4798
4799 yychar = YYEMPTY;
4800 }
4801
4802 /* Else will try to reuse lookahead token
4803 after shifting the error token. */
4804
4805 yyerrstatus = 3; /* Each real token shifted decrements this */
4806
4807 goto yyerrhandle;
4808
4809 yyerrdefault: /* current state does not do anything special for the error token. */
4810
4811 #if 0
4812 /* This is wrong; only states that explicitly want error tokens
4813 should shift them. */
4814 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4815 if (yyn) goto yydefault;
4816 #endif
4817
4818 yyerrpop: /* pop the current state because it cannot handle the error token */
4819
4820 if (yyssp == yyss) YYABORT;
4821 yyvsp--;
4822 yystate = *--yyssp;
4823 #ifdef YYLSP_NEEDED
4824 yylsp--;
4825 #endif
4826
4827 #if YYDEBUG != 0
4828 if (yydebug)
4829 {
4830 short *ssp1 = yyss - 1;
4831 fprintf (stderr, "Error: state stack now");
4832 while (ssp1 != yyssp)
4833 fprintf (stderr, " %d", *++ssp1);
4834 fprintf (stderr, "\n");
4835 }
4836 #endif
4837
4838 yyerrhandle:
4839
4840 yyn = yypact[yystate];
4841 if (yyn == YYFLAG)
4842 goto yyerrdefault;
4843
4844 yyn += YYTERROR;
4845 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
4846 goto yyerrdefault;
4847
4848 yyn = yytable[yyn];
4849 if (yyn < 0)
4850 {
4851 if (yyn == YYFLAG)
4852 goto yyerrpop;
4853 yyn = -yyn;
4854 goto yyreduce;
4855 }
4856 else if (yyn == 0)
4857 goto yyerrpop;
4858
4859 if (yyn == YYFINAL)
4860 YYACCEPT;
4861
4862 #if YYDEBUG != 0
4863 if (yydebug)
4864 fprintf(stderr, "Shifting error token, ");
4865 #endif
4866
4867 *++yyvsp = yylval;
4868 #ifdef YYLSP_NEEDED
4869 *++yylsp = yylloc;
4870 #endif
4871
4872 yystate = yyn;
4873 goto yynewstate;
4874 }
4875 #line 2238 "./parse.y"
4876
4877 \f
4878
4879 #include "lex.c"
4880
4881 /* Flag for the error report routine to issue the error the first time
4882 it's called (overriding the default behavior which is to drop the
4883 first invocation and honor the second one, taking advantage of a
4884 richer context. */
4885 static int force_error = 0;
4886
4887 /* Create a new parser context and make it the current one. */
4888
4889 void
4890 java_push_parser_context ()
4891 {
4892 struct parser_ctxt *new =
4893 (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
4894
4895 bzero (new, sizeof (struct parser_ctxt));
4896 new->next = ctxp;
4897 ctxp = new;
4898 if (ctxp->next)
4899 {
4900 ctxp->incomplete_class = ctxp->next->incomplete_class;
4901 ctxp->gclass_list = ctxp->next->gclass_list;
4902 }
4903 }
4904
4905 /* If the first file of a file list was a class file, no context
4906 exists for a source file to be parsed. This boolean remembers that
4907 java_parser_context_save_global might have created a dummy one, so
4908 that java_parser_context_restore_global can pop it. */
4909 static int extra_ctxp_pushed_p = 0;
4910
4911 void
4912 java_parser_context_save_global ()
4913 {
4914 if (!ctxp)
4915 {
4916 java_push_parser_context ();
4917 extra_ctxp_pushed_p = 1;
4918 }
4919 ctxp->finput = finput;
4920 ctxp->lineno = lineno;
4921 ctxp->current_class = current_class;
4922 ctxp->filename = input_filename;
4923 ctxp->current_function_decl = current_function_decl;
4924 }
4925
4926 void
4927 java_parser_context_restore_global ()
4928 {
4929 finput = ctxp->finput;
4930 lineno = ctxp->lineno;
4931 current_class = ctxp->current_class;
4932 input_filename = ctxp->filename;
4933 current_function_decl = ctxp->current_function_decl;
4934 if (!ctxp->next && extra_ctxp_pushed_p)
4935 {
4936 java_pop_parser_context (0);
4937 extra_ctxp_pushed_p = 0;
4938 }
4939 }
4940
4941 void
4942 java_pop_parser_context (generate)
4943 int generate;
4944 {
4945 tree current;
4946 struct parser_ctxt *toFree, *next;
4947
4948 if (!ctxp)
4949 return;
4950
4951 toFree = ctxp;
4952 next = ctxp->next;
4953 if (next)
4954 {
4955 next->incomplete_class = ctxp->incomplete_class;
4956 next->gclass_list = ctxp->gclass_list;
4957 lineno = ctxp->lineno;
4958 finput = ctxp->finput;
4959 current_class = ctxp->current_class;
4960 }
4961
4962 /* Set the single import class file flag to 0 for the current list
4963 of imported things */
4964 for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
4965 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0;
4966
4967 /* And restore those of the previous context */
4968 if ((ctxp = next)) /* Assignment is really meant here */
4969 for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
4970 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1;
4971
4972 if (generate)
4973 {
4974 toFree->next = ctxp_for_generation;
4975 ctxp_for_generation = toFree;
4976 }
4977 else
4978 free (toFree);
4979 }
4980
4981 /* Reporting JDK1.1 features not implemented */
4982
4983 static tree
4984 parse_jdk1_1_error (msg)
4985 char *msg;
4986 {
4987 sorry (": `%s' JDK1.1(TM) feature", msg);
4988 java_error_count++;
4989 return empty_stmt_node;
4990 }
4991
4992 static int do_warning = 0;
4993
4994 void
4995 yyerror (msg)
4996 char *msg;
4997 {
4998 static java_lc elc;
4999 static int prev_lineno;
5000 static char *prev_msg;
5001
5002 int save_lineno;
5003 char *remainder, *code_from_source;
5004 extern struct obstack temporary_obstack;
5005
5006 if (!force_error && prev_lineno == lineno)
5007 return;
5008
5009 /* Save current error location but report latter, when the context is
5010 richer. */
5011 if (ctxp->java_error_flag == 0)
5012 {
5013 ctxp->java_error_flag = 1;
5014 elc = ctxp->elc;
5015 /* Do something to use the previous line if we're reaching the
5016 end of the file... */
5017 #ifdef VERBOSE_SKELETON
5018 printf ("* Error detected (%s)\n", (msg ? msg : "(null)"));
5019 #endif
5020 return;
5021 }
5022
5023 /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
5024 if (!force_error && msg == prev_msg && prev_lineno == elc.line)
5025 return;
5026
5027 ctxp->java_error_flag = 0;
5028 if (do_warning)
5029 java_warning_count++;
5030 else
5031 java_error_count++;
5032
5033 if (elc.col == 0 && msg[1] == ';')
5034 {
5035 elc.col = ctxp->p_line->char_col-1;
5036 elc.line = ctxp->p_line->lineno;
5037 }
5038
5039 save_lineno = lineno;
5040 prev_lineno = lineno = elc.line;
5041 prev_msg = msg;
5042
5043 code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col);
5044 obstack_grow0 (&temporary_obstack,
5045 code_from_source, strlen (code_from_source));
5046 remainder = obstack_finish (&temporary_obstack);
5047 if (do_warning)
5048 warning ("%s.\n%s", msg, remainder);
5049 else
5050 error ("%s.\n%s", msg, remainder);
5051
5052 /* This allow us to cheaply avoid an extra 'Invalid expression
5053 statement' error report when errors have been already reported on
5054 the same line. This occurs when we report an error but don't have
5055 a synchronization point other than ';', which
5056 expression_statement is the only one to take care of. */
5057 ctxp->prevent_ese = lineno = save_lineno;
5058 }
5059
5060 static void
5061 issue_warning_error_from_context (cl, msg, ap)
5062 tree cl;
5063 char *msg;
5064 va_list ap;
5065 {
5066 char *saved, *saved_input_filename;
5067 char buffer [4096];
5068 vsprintf (buffer, msg, ap);
5069 force_error = 1;
5070
5071 ctxp->elc.line = EXPR_WFL_LINENO (cl);
5072 ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 :
5073 (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl)));
5074
5075 /* We have a CL, that's a good reason for using it if it contains data */
5076 saved = ctxp->filename;
5077 if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl))
5078 ctxp->filename = EXPR_WFL_FILENAME (cl);
5079 saved_input_filename = input_filename;
5080 input_filename = ctxp->filename;
5081 java_error (NULL);
5082 java_error (buffer);
5083 ctxp->filename = saved;
5084 input_filename = saved_input_filename;
5085 force_error = 0;
5086 }
5087
5088 /* Issue an error message at a current source line CL */
5089
5090 void
5091 parse_error_context VPROTO ((tree cl, char *msg, ...))
5092 {
5093 #ifndef __STDC__
5094 tree cl;
5095 char *msg;
5096 #endif
5097 va_list ap;
5098
5099 VA_START (ap, msg);
5100 #ifndef __STDC__
5101 cl = va_arg (ap, tree);
5102 msg = va_arg (ap, char *);
5103 #endif
5104 issue_warning_error_from_context (cl, msg, ap);
5105 va_end (ap);
5106 }
5107
5108 /* Issue a warning at a current source line CL */
5109
5110 static void
5111 parse_warning_context VPROTO ((tree cl, char *msg, ...))
5112 {
5113 #ifndef __STDC__
5114 tree cl;
5115 char *msg;
5116 #endif
5117 va_list ap;
5118
5119 VA_START (ap, msg);
5120 #ifndef __STDC__
5121 cl = va_arg (ap, tree);
5122 msg = va_arg (ap, char *);
5123 #endif
5124
5125 force_error = do_warning = 1;
5126 issue_warning_error_from_context (cl, msg, ap);
5127 do_warning = force_error = 0;
5128 va_end (ap);
5129 }
5130
5131 static tree
5132 find_expr_with_wfl (node)
5133 tree node;
5134 {
5135 while (node)
5136 {
5137 char code;
5138 tree to_return;
5139
5140 switch (TREE_CODE (node))
5141 {
5142 case BLOCK:
5143 return find_expr_with_wfl (BLOCK_EXPR_BODY (node));
5144
5145 case COMPOUND_EXPR:
5146 to_return = find_expr_with_wfl (TREE_OPERAND (node, 0));
5147 if (to_return)
5148 return to_return;
5149 to_return = find_expr_with_wfl (TREE_OPERAND (node, 1));
5150 return to_return;
5151
5152 case LOOP_EXPR:
5153 return find_expr_with_wfl (TREE_OPERAND (node, 0));
5154
5155 case LABELED_BLOCK_EXPR:
5156 return find_expr_with_wfl (TREE_OPERAND (node, 1));
5157 default:
5158 code = TREE_CODE_CLASS (TREE_CODE (node));
5159 if (((code == '1') || (code == '2') || (code == 'e'))
5160 && EXPR_WFL_LINECOL (node))
5161 return node;
5162 }
5163 }
5164 return NULL_TREE;
5165 }
5166
5167 /* Issue a missing return statement error. Uses METHOD to figure the
5168 last line of the method the error occurs in. */
5169
5170 static void
5171 missing_return_error (method)
5172 tree method;
5173 {
5174 EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2);
5175 parse_error_context (wfl_operator, "Missing return statement");
5176 }
5177
5178 /* Issue an unreachable statement error. From NODE, find the next
5179 statement to report appropriately. */
5180 static void
5181 unreachable_stmt_error (node)
5182 tree node;
5183 {
5184 /* Browse node to find the next expression node that has a WFL. Use
5185 the location to report the error */
5186 if (TREE_CODE (node) == COMPOUND_EXPR)
5187 node = find_expr_with_wfl (TREE_OPERAND (node, 1));
5188 else
5189 node = find_expr_with_wfl (node);
5190
5191 if (node)
5192 {
5193 EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2);
5194 parse_error_context (wfl_operator, "Unreachable statement");
5195 }
5196 else
5197 fatal ("Can't get valid statement - unreachable_stmt_error");
5198 }
5199
5200 int
5201 java_report_errors ()
5202 {
5203 if (java_error_count)
5204 fprintf (stderr, "%d error%s",
5205 java_error_count, (java_error_count == 1 ? "" : "s"));
5206 if (java_warning_count)
5207 fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""),
5208 java_warning_count, (java_warning_count == 1 ? "" : "s"));
5209 if (java_error_count || java_warning_count)
5210 putc ('\n', stderr);
5211 return java_error_count;
5212 }
5213
5214 static char *
5215 java_accstring_lookup (flags)
5216 int flags;
5217 {
5218 static char buffer [80];
5219 #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
5220
5221 /* Access modifier looked-up first for easier report on forbidden
5222 access. */
5223 if (flags & ACC_PUBLIC) COPY_RETURN ("public");
5224 if (flags & ACC_PRIVATE) COPY_RETURN ("private");
5225 if (flags & ACC_PROTECTED) COPY_RETURN ("protected");
5226 if (flags & ACC_STATIC) COPY_RETURN ("static");
5227 if (flags & ACC_FINAL) COPY_RETURN ("final");
5228 if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized");
5229 if (flags & ACC_VOLATILE) COPY_RETURN ("volatile");
5230 if (flags & ACC_TRANSIENT) COPY_RETURN ("transient");
5231 if (flags & ACC_NATIVE) COPY_RETURN ("native");
5232 if (flags & ACC_INTERFACE) COPY_RETURN ("interface");
5233 if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract");
5234
5235 buffer [0] = '\0';
5236 return buffer;
5237 #undef COPY_RETURN
5238 }
5239
5240 /* Issuing error messages upon redefinition of classes, interfaces or
5241 variables. */
5242
5243 static void
5244 classitf_redefinition_error (context, id, decl, cl)
5245 char *context;
5246 tree id, decl, cl;
5247 {
5248 parse_error_context (cl, "%s `%s' already defined in %s:%d",
5249 context, IDENTIFIER_POINTER (id),
5250 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
5251 /* Here we should point out where its redefined. It's a unicode. FIXME */
5252 }
5253
5254 static void
5255 variable_redefinition_error (context, name, type, line)
5256 tree context, name, type;
5257 int line;
5258 {
5259 char *type_name;
5260
5261 /* Figure a proper name for type. We might haven't resolved it */
5262 if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type))
5263 type_name = IDENTIFIER_POINTER (TYPE_NAME (type));
5264 else
5265 type_name = lang_printable_name (type, 0);
5266
5267 parse_error_context (context,
5268 "Variable `%s' is already defined in this method and "
5269 "was declared `%s %s' at line %d",
5270 IDENTIFIER_POINTER (name),
5271 type_name, IDENTIFIER_POINTER (name), line);
5272 }
5273
5274 static tree
5275 build_array_from_name (type, type_wfl, name, ret_name)
5276 tree type, type_wfl, name, *ret_name;
5277 {
5278 int more_dims = 0;
5279 char *string;
5280
5281 /* Eventually get more dims */
5282 string = IDENTIFIER_POINTER (name);
5283 while (string [more_dims] == '[')
5284 more_dims++;
5285
5286 /* If we have, then craft a new type for this variable */
5287 if (more_dims)
5288 {
5289 name = get_identifier (&more_dims [string]);
5290
5291 /* If type already is a reference on an array, get the base type */
5292 if ((TREE_CODE (type) == POINTER_TYPE) &&
5293 TYPE_ARRAY_P (TREE_TYPE (type)))
5294 type = TREE_TYPE (type);
5295
5296 /* Building the first dimension of a primitive type uses this
5297 function */
5298 if (JPRIMITIVE_TYPE_P (type))
5299 {
5300 type = build_java_array_type (type, -1);
5301 CLASS_LOADED_P (type) = 1;
5302 more_dims--;
5303 }
5304 /* Otherwise, if we have a WFL for this type, use it (the type
5305 is already an array on an unresolved type, and we just keep
5306 on adding dimensions) */
5307 else if (type_wfl)
5308 type = type_wfl;
5309
5310 /* Add all the dimensions */
5311 while (more_dims--)
5312 type = build_unresolved_array_type (type);
5313
5314 /* The type may have been incomplete in the first place */
5315 if (type_wfl)
5316 type = obtain_incomplete_type (type);
5317 }
5318
5319 *ret_name = name;
5320 return type;
5321 }
5322
5323 /* Build something that the type identifier resolver will identify as
5324 being an array to an unresolved type. TYPE_WFL is a WFL on a
5325 identifier. */
5326
5327 static tree
5328 build_unresolved_array_type (type_or_wfl)
5329 tree type_or_wfl;
5330 {
5331 char *ptr;
5332
5333 /* TYPE_OR_WFL might be an array on a resolved type. In this case,
5334 just create a array type */
5335 if (TREE_CODE (type_or_wfl) == RECORD_TYPE)
5336 {
5337 tree type = build_java_array_type (type_or_wfl, -1);
5338 CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl);
5339 return type;
5340 }
5341
5342 obstack_1grow (&temporary_obstack, '[');
5343 obstack_grow0 (&temporary_obstack,
5344 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
5345 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
5346 ptr = obstack_finish (&temporary_obstack);
5347 return build_expr_wfl (get_identifier (ptr),
5348 EXPR_WFL_FILENAME (type_or_wfl),
5349 EXPR_WFL_LINENO (type_or_wfl),
5350 EXPR_WFL_COLNO (type_or_wfl));
5351 }
5352
5353 /* Check modifiers. If one doesn't fit, retrieve it in its declaration line
5354 and point it out. */
5355
5356 static void
5357 check_modifiers (message, value, mask)
5358 char *message;
5359 int value;
5360 int mask;
5361 {
5362 /* Should point out the one that don't fit. ASCII/unicode,
5363 going backward. FIXME */
5364 if (value & ~mask)
5365 {
5366 int i, remainder = value & ~mask;
5367 for (i = 0; i <= 10; i++)
5368 if ((1 << i) & remainder)
5369 parse_error_context (ctxp->modifier_ctx [i], message,
5370 java_accstring_lookup (1 << i));
5371 }
5372 }
5373
5374 static void
5375 parser_add_interface (class_decl, interface_decl, wfl)
5376 tree class_decl, interface_decl, wfl;
5377 {
5378 if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
5379 parse_error_context (wfl, "Interface `%s' repeated",
5380 IDENTIFIER_POINTER (DECL_NAME (interface_decl)));
5381 }
5382
5383 /* Bulk of common class/interface checks. Return 1 if an error was
5384 encountered. TAG is 0 for a class, 1 for an interface. */
5385
5386 static int
5387 check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl)
5388 int is_interface, flags;
5389 tree raw_name, qualified_name, decl, cl;
5390 {
5391 tree node;
5392
5393 if (!quiet_flag)
5394 fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"),
5395 IDENTIFIER_POINTER (qualified_name));
5396
5397 /* Scope of an interface/class type name:
5398 - Can't be imported by a single type import
5399 - Can't already exists in the package */
5400 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name)
5401 && (node = find_name_in_single_imports (raw_name)))
5402 {
5403 parse_error_context
5404 (cl, "%s name `%s' clashes with imported type `%s'",
5405 (is_interface ? "Interface" : "Class"),
5406 IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node));
5407 return 1;
5408 }
5409 if (decl && CLASS_COMPLETE_P (decl))
5410 {
5411 classitf_redefinition_error ((is_interface ? "Interface" : "Class"),
5412 qualified_name, decl, cl);
5413 return 1;
5414 }
5415
5416 /* If public, file name should match class/interface name */
5417 if (flags & ACC_PUBLIC)
5418 {
5419 char *f;
5420
5421 /* Contains OS dependent assumption on path separator. FIXME */
5422 for (f = &input_filename [strlen (input_filename)];
5423 f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR;
5424 f--)
5425 ;
5426 if (f[0] == '/' || f[0] == DIR_SEPARATOR)
5427 f++;
5428 if (strncmp (IDENTIFIER_POINTER (raw_name),
5429 f , IDENTIFIER_LENGTH (raw_name)) ||
5430 f [IDENTIFIER_LENGTH (raw_name)] != '.')
5431 parse_error_context (cl, "Public %s `%s' must be defined in a file "
5432 "called `%s.java'",
5433 (is_interface ? "interface" : "class"),
5434 IDENTIFIER_POINTER (qualified_name),
5435 IDENTIFIER_POINTER (raw_name));
5436 }
5437
5438 check_modifiers ((is_interface ?
5439 "Illegal modifier `%s' for interface declaration" :
5440 "Illegal modifier `%s' for class declaration"), flags,
5441 (is_interface ? INTERFACE_MODIFIERS : CLASS_MODIFIERS));
5442 return 0;
5443 }
5444
5445 /* If DECL is NULL, create and push a new DECL, record the current
5446 line CL and do other maintenance things. */
5447
5448 static tree
5449 maybe_create_class_interface_decl (decl, qualified_name, cl)
5450 tree decl, qualified_name, cl;
5451 {
5452 if (!decl)
5453 decl = push_class (make_class (), qualified_name);
5454
5455 /* Take care of the file and line business */
5456 DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
5457 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
5458 CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
5459 CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) =
5460 IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
5461
5462 ctxp->current_parsed_class = decl;
5463
5464 /* Link the declaration to the already seen ones */
5465 TREE_CHAIN (decl) = ctxp->class_list;
5466 ctxp->class_list = decl;
5467
5468 /* Create a new nodes in the global lists */
5469 ctxp->gclass_list = tree_cons (NULL_TREE, decl, ctxp->gclass_list);
5470 all_class_list = tree_cons (NULL_TREE, decl, all_class_list);
5471
5472 /* Install a new dependency list element */
5473 create_jdep_list (ctxp);
5474
5475 SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
5476 IDENTIFIER_POINTER (qualified_name)));
5477 return decl;
5478 }
5479
5480 static void
5481 add_superinterfaces (decl, interface_list)
5482 tree decl, interface_list;
5483 {
5484 tree node;
5485 /* Superinterface(s): if present and defined, parser_check_super_interface ()
5486 takes care of ensuring that:
5487 - This is an accessible interface type,
5488 - Circularity detection.
5489 parser_add_interface is then called. If present but not defined,
5490 the check operation is delayed until the super interface gets
5491 defined. */
5492 for (node = interface_list; node; node = TREE_CHAIN (node))
5493 {
5494 tree current = TREE_PURPOSE (node);
5495 tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current));
5496 if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl)))
5497 {
5498 if (!parser_check_super_interface (idecl, decl, current))
5499 parser_add_interface (decl, idecl, current);
5500 }
5501 else
5502 register_incomplete_type (JDEP_INTERFACE,
5503 current, decl, NULL_TREE);
5504 }
5505 }
5506
5507 /* Create an interface in pass1 and return its decl. Return the
5508 interface's decl in pass 2. */
5509
5510 static tree
5511 create_interface (flags, id, super)
5512 int flags;
5513 tree id, super;
5514 {
5515 tree raw_name = EXPR_WFL_NODE (id);
5516 tree q_name = parser_qualified_classname (id);
5517 tree decl = IDENTIFIER_CLASS_VALUE (q_name);
5518
5519 EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */
5520
5521 /* Basic checks: scope, redefinition, modifiers */
5522 if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id))
5523 return NULL_TREE;
5524
5525 /* Interface modifiers check
5526 - public/abstract allowed (already done at that point)
5527 - abstract is obsolete (comes first, it's a warning, or should be)
5528 - Can't use twice the same (checked in the modifier rule) */
5529 if ((flags & ACC_ABSTRACT) && flag_redundant)
5530 parse_warning_context
5531 (MODIFIER_WFL (ABSTRACT_TK),
5532 "Redundant use of `abstract' modifier. Interface `%s' is implicitely "
5533 "abstract", IDENTIFIER_POINTER (raw_name));
5534
5535 /* Create a new decl if DECL is NULL, otherwise fix it */
5536 decl = maybe_create_class_interface_decl (decl, q_name, id);
5537
5538 /* Set super info and mark the class a complete */
5539 set_super_info (ACC_ABSTRACT | ACC_INTERFACE | flags, TREE_TYPE (decl),
5540 object_type_node, ctxp->interface_number);
5541 ctxp->interface_number = 0;
5542 CLASS_COMPLETE_P (decl) = 1;
5543 add_superinterfaces (decl, super);
5544
5545 return decl;
5546 }
5547
5548 /* Create an class in pass1 and return its decl. Return class
5549 interface's decl in pass 2. */
5550
5551 static tree
5552 create_class (flags, id, super, interfaces)
5553 int flags;
5554 tree id, super, interfaces;
5555 {
5556 tree raw_name = EXPR_WFL_NODE (id);
5557 tree class_id, decl;
5558 tree super_decl = NULL, super_decl_type;
5559
5560 class_id = parser_qualified_classname (id);
5561 decl = IDENTIFIER_CLASS_VALUE (class_id);
5562 ctxp->current_parsed_class_un = EXPR_WFL_NODE (id);
5563 EXPR_WFL_NODE (id) = class_id;
5564
5565 /* Basic check: scope, redefinition, modifiers */
5566 if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id))
5567 return NULL_TREE;
5568
5569 /* Class modifier check:
5570 - Allowed modifier (already done at that point)
5571 - abstract AND final forbidden
5572 - Public classes defined in the correct file */
5573 if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
5574 parse_error_context (id, "Class `%s' can't be declared both abstract "
5575 "and final", IDENTIFIER_POINTER (raw_name));
5576
5577 /* Create a new decl if DECL is NULL, otherwise fix it */
5578 decl = maybe_create_class_interface_decl (decl, class_id, id);
5579
5580 /* If SUPER exists, use it, otherwise use Object */
5581 if (super)
5582 {
5583 /* Can't extend java.lang.Object */
5584 if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
5585 {
5586 parse_error_context (id, "Can't extend `java.lang.Object'");
5587 return NULL_TREE;
5588 }
5589
5590 /* The class is known and exists if there is a decl. Otherwise,
5591 postpone the operation and do it later. */
5592 super_decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (super));
5593 if (super_decl)
5594 {
5595 parser_check_super (super_decl, decl, id);
5596 super_decl_type = TREE_TYPE (super_decl);
5597 }
5598 else
5599 super_decl_type =
5600 register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE);
5601 }
5602 else if (TREE_TYPE (decl) != object_type_node)
5603 super_decl_type = object_type_node;
5604 /* We're defining java.lang.Object */
5605 else
5606 super_decl_type = NULL_TREE;
5607
5608 /* Set super info and mark the class a complete */
5609 set_super_info (flags, TREE_TYPE (decl), super_decl_type,
5610 ctxp->interface_number);
5611 ctxp->interface_number = 0;
5612 CLASS_COMPLETE_P (decl) = 1;
5613 add_superinterfaces (decl, interfaces);
5614
5615 /* Eventually sets the @deprecated tag flag */
5616 CHECK_DEPRECATED (decl);
5617
5618 return decl;
5619 }
5620
5621 /* Can't use lookup_field () since we don't want to load the class and
5622 can't set the CLASS_LOADED_P flag */
5623
5624 static tree
5625 find_field (class, name)
5626 tree class;
5627 tree name;
5628 {
5629 tree decl;
5630 for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl))
5631 {
5632 if (DECL_NAME (decl) == name)
5633 return decl;
5634 }
5635 return NULL_TREE;
5636 }
5637
5638 /* Wrap around lookup_field that doesn't potentially upset the value
5639 of CLASS */
5640
5641 static tree
5642 lookup_field_wrapper (class, name)
5643 tree class, name;
5644 {
5645 tree type = class;
5646 tree decl;
5647 java_parser_context_save_global ();
5648 decl = lookup_field (&type, name);
5649 java_parser_context_restore_global ();
5650 return decl;
5651 }
5652
5653 /* Find duplicate field within the same class declarations and report
5654 the error. Returns 1 if a duplicated field was found, 0
5655 otherwise. */
5656
5657 static int
5658 duplicate_declaration_error_p (new_field_name, new_type, cl)
5659 tree new_field_name, new_type, cl;
5660 {
5661 /* This might be modified to work with method decl as well */
5662 tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class),
5663 new_field_name);
5664 if (decl)
5665 {
5666 char *t1 = strdup (purify_type_name
5667 ((TREE_CODE (new_type) == POINTER_TYPE
5668 && TREE_TYPE (new_type) == NULL_TREE) ?
5669 IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
5670 lang_printable_name (new_type, 1)));
5671 /* The type may not have been completed by the time we report
5672 the error */
5673 char *t2 = strdup (purify_type_name
5674 ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
5675 && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
5676 IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
5677 lang_printable_name (TREE_TYPE (decl), 1)));
5678 parse_error_context
5679 (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
5680 t1, IDENTIFIER_POINTER (new_field_name),
5681 t2, IDENTIFIER_POINTER (DECL_NAME (decl)),
5682 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
5683 free (t1);
5684 free (t2);
5685 return 1;
5686 }
5687 return 0;
5688 }
5689
5690 /* Field registration routine. If TYPE doesn't exist, field
5691 declarations are linked to the undefined TYPE dependency list, to
5692 be later resolved in java_complete_class () */
5693
5694 static void
5695 register_fields (flags, type, variable_list)
5696 int flags;
5697 tree type, variable_list;
5698 {
5699 tree current, saved_type;
5700 tree class_type = TREE_TYPE (ctxp->current_parsed_class);
5701 int saved_lineno = lineno;
5702 int must_chain = 0;
5703 tree wfl = NULL_TREE;
5704
5705 /* If we're adding fields to interfaces, those fields are public,
5706 static, final */
5707 if (CLASS_INTERFACE (TYPE_NAME (class_type)))
5708 {
5709 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK),
5710 flags, ACC_PUBLIC,
5711 "%s", "interface field(s)");
5712 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
5713 flags, ACC_STATIC,
5714 "%s", "interface field(s)");
5715 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
5716 flags, ACC_FINAL, "%s", "interface field(s)");
5717 check_modifiers ("Illegal interface member modifier `%s'", flags,
5718 INTERFACE_FIELD_MODIFIERS);
5719 flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL);
5720 }
5721
5722 /* Obtain a suitable type for resolution, if necessary */
5723 SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain);
5724
5725 /* If TYPE is fully resolved and we don't have a reference, make one */
5726 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5727
5728 for (current = variable_list, saved_type = type; current;
5729 current = TREE_CHAIN (current), type = saved_type)
5730 {
5731 tree real_type;
5732 tree field_decl;
5733 tree cl = TREE_PURPOSE (current);
5734 tree init = TREE_VALUE (current);
5735 tree current_name = EXPR_WFL_NODE (cl);
5736
5737 /* Process NAME, as it may specify extra dimension(s) for it */
5738 type = build_array_from_name (type, wfl, current_name, &current_name);
5739
5740 /* Type adjustment. We may have just readjusted TYPE because
5741 the variable specified more dimensions. Make sure we have
5742 a reference if we can and don't have one already. Also
5743 change the name if we have an init. */
5744 if (type != saved_type)
5745 {
5746 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5747 if (init)
5748 EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name;
5749 }
5750
5751 real_type = GET_REAL_TYPE (type);
5752 /* Check for redeclarations */
5753 if (duplicate_declaration_error_p (current_name, real_type, cl))
5754 continue;
5755
5756 /* Set lineno to the line the field was found and create a
5757 declaration for it. Eventually sets the @deprecated tag flag. */
5758 lineno = EXPR_WFL_LINENO (cl);
5759 field_decl = add_field (class_type, current_name, real_type, flags);
5760 CHECK_DEPRECATED (field_decl);
5761
5762 /* Check if we must chain. */
5763 if (must_chain)
5764 register_incomplete_type (JDEP_FIELD, wfl, field_decl, type);
5765
5766 /* Default value of a static field is 0 and it is considered
5767 initialized. */
5768 if (flags & ACC_STATIC)
5769 INITIALIZED_P (field_decl) = 1;
5770
5771 /* If we have an initialization value tied to the field */
5772 if (init)
5773 {
5774 /* The field is declared static */
5775 if (flags & ACC_STATIC)
5776 {
5777 /* We include the field and its initialization part into
5778 a list used to generate <clinit>. After <clinit> is
5779 walked, fields initialization will be processed and
5780 fields initialized with know constants will be taken
5781 out of <clinit> and have ther DECL_INITIAL set
5782 appropriately. */
5783 TREE_CHAIN (init) = ctxp->static_initialized;
5784 ctxp->static_initialized = init;
5785 DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1);
5786 }
5787 /* A non-static field declared with an immediate initialization is
5788 to be initialized in <init>, if any. This field is remembered
5789 to be processed at the time of the generation of <init>. */
5790 else
5791 {
5792 TREE_CHAIN (init) = ctxp->non_static_initialized;
5793 ctxp->non_static_initialized = init;
5794 }
5795 INITIALIZED_P (field_decl) = 1;
5796 MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
5797 }
5798 }
5799 lineno = saved_lineno;
5800 }
5801
5802 /* Generate the method $finit$ that initializes fields initialized
5803 upon declaration. */
5804
5805 static void
5806 maybe_generate_finit ()
5807 {
5808 tree mdecl, current;
5809
5810 if (!ctxp->non_static_initialized || java_error_count)
5811 return;
5812
5813 mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
5814 ACC_PRIVATE, void_type_node,
5815 finit_identifier_node, end_params_node);
5816 start_artificial_method_body (mdecl);
5817
5818 ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized);
5819 for (current = ctxp->non_static_initialized; current;
5820 current = TREE_CHAIN (current))
5821 java_method_add_stmt (mdecl,
5822 build_debugable_stmt (EXPR_WFL_LINECOL (current),
5823 current));
5824
5825 end_artificial_method_body (mdecl);
5826 CLASS_HAS_FINIT_P (TREE_TYPE (ctxp->current_parsed_class)) = 1;
5827 ctxp->non_static_initialized = NULL_TREE;
5828 }
5829
5830 /* Check whether it is necessary to generate a <clinit> for the class
5831 we just parsed. */
5832
5833 static void
5834 maybe_generate_clinit ()
5835 {
5836 tree mdecl, c;
5837
5838 if (!ctxp->static_initialized || java_error_count)
5839 return;
5840
5841 mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
5842 ACC_STATIC, void_type_node,
5843 clinit_identifier_node, end_params_node);
5844 start_artificial_method_body (mdecl);
5845
5846 /* Keep initialization in order to enforce 8.5 */
5847 ctxp->static_initialized = nreverse (ctxp->static_initialized);
5848
5849 /* We process the list of assignment we produced as the result of
5850 the declaration of initialized static field and add them as
5851 statement to the <clinit> method. */
5852 for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c))
5853 {
5854 /* We build the assignment expression that will initialize the
5855 field to its value. There are strict rules on static
5856 initializers (8.5). FIXME */
5857 java_method_add_stmt (mdecl,
5858 build_debugable_stmt (EXPR_WFL_LINECOL (c), c));
5859 }
5860
5861 end_artificial_method_body (mdecl);
5862 ctxp->static_initialized = NULL_TREE;
5863 }
5864
5865 /* Shared accros method_declarator and method_header to remember the
5866 patch stage that was reached during the declaration of the method.
5867 A method DECL is built differently is there is no patch
5868 (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
5869 pending on the currently defined method. */
5870
5871 static int patch_stage;
5872
5873 /* Check the method declaration and add the method to its current
5874 class. If the argument list is known to contain incomplete types,
5875 the method is partially added and the registration will be resume
5876 once the method arguments resolved. If TYPE is NULL, we're dealing
5877 with a constructor. */
5878
5879 static tree
5880 method_header (flags, type, mdecl, throws)
5881 int flags;
5882 tree type, mdecl, throws;
5883 {
5884 tree meth = TREE_VALUE (mdecl);
5885 tree id = TREE_PURPOSE (mdecl);
5886 tree this_class = TREE_TYPE (ctxp->current_parsed_class);
5887 tree type_wfl = NULL_TREE;
5888 tree meth_name = NULL_TREE, current, orig_arg;
5889 int saved_lineno;
5890 int constructor_ok = 0, must_chain;
5891
5892 check_modifiers_consistency (flags);
5893
5894 /* There are some forbidden modifiers for an abstract method and its
5895 class must be abstract as well. */
5896 if (type && (flags & ACC_ABSTRACT))
5897 {
5898 ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private");
5899 ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static");
5900 ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final");
5901 ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native");
5902 ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized");
5903 if (!CLASS_ABSTRACT (TYPE_NAME (this_class)))
5904 parse_error_context
5905 (id, "Class `%s' must be declared abstract to define abstract "
5906 "method `%s'",
5907 IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)),
5908 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
5909 }
5910 /* Things to be checked when declaring a constructor */
5911 if (!type)
5912 {
5913 int ec = java_error_count;
5914 /* 8.6: Constructor declarations: we might be trying to define a
5915 method without specifying a return type. */
5916 if (EXPR_WFL_NODE (id) != ctxp->current_parsed_class_un)
5917 parse_error_context
5918 (id, "Invalid method declaration, return type required");
5919 /* 8.6.3: Constructor modifiers */
5920 else
5921 {
5922 JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract");
5923 JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static");
5924 JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final");
5925 JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native");
5926 JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized");
5927 }
5928 /* If we found error here, we don't consider it's OK to tread
5929 the method definition as a constructor, for the rest of this
5930 function */
5931 if (ec == java_error_count)
5932 constructor_ok = 1;
5933 }
5934
5935 /* Method declared within the scope of an interface are implicitly
5936 abstract and public. Conflicts with other erroneously provided
5937 modifiers are check right after. */
5938
5939 if (CLASS_INTERFACE (TYPE_NAME (this_class)))
5940 {
5941 /* If FLAGS isn't set because of a modifier, turn the
5942 corresponding modifier WFL to NULL so we issue a warning on
5943 the obsolete use of the modifier */
5944 if (!(flags & ACC_PUBLIC))
5945 MODIFIER_WFL (PUBLIC_TK) = NULL;
5946 if (!(flags & ACC_ABSTRACT))
5947 MODIFIER_WFL (ABSTRACT_TK) = NULL;
5948 flags |= ACC_PUBLIC;
5949 flags |= ACC_ABSTRACT;
5950 }
5951
5952 /* Modifiers context reset moved up, so abstract method declaration
5953 modifiers can be later checked. */
5954
5955 /* Set constructor returned type to void and method name to <init>,
5956 unless we found an error identifier the constructor (in which
5957 case we retain the original name) */
5958 if (!type)
5959 {
5960 type = void_type_node;
5961 if (constructor_ok)
5962 meth_name = init_identifier_node;
5963 }
5964 else
5965 meth_name = EXPR_WFL_NODE (id);
5966
5967 /* Do the returned type resolution and registration if necessary */
5968 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
5969
5970 if (meth_name)
5971 type = build_array_from_name (type, type_wfl, meth_name, &meth_name);
5972 EXPR_WFL_NODE (id) = meth_name;
5973 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5974
5975 if (must_chain)
5976 {
5977 patch_stage = JDEP_METHOD_RETURN;
5978 register_incomplete_type (patch_stage, type_wfl, id, type);
5979 TREE_TYPE (meth) = GET_REAL_TYPE (type);
5980 }
5981 else
5982 TREE_TYPE (meth) = type;
5983
5984 saved_lineno = lineno;
5985 /* When defining an abstract or interface method, the curly
5986 bracket at level 1 doesn't exist because there is no function
5987 body */
5988 lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
5989 EXPR_WFL_LINENO (id));
5990
5991 /* Remember the original argument list */
5992 orig_arg = TYPE_ARG_TYPES (meth);
5993
5994 if (patch_stage) /* includes ret type and/or all args */
5995 {
5996 jdep *jdep;
5997 meth = add_method_1 (this_class, flags, meth_name, meth);
5998 /* Patch for the return type */
5999 if (patch_stage == JDEP_METHOD_RETURN)
6000 {
6001 jdep = CLASSD_LAST (ctxp->classd_list);
6002 JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth));
6003 }
6004 /* This is the stop JDEP. METH allows the function's signature
6005 to be computed. */
6006 register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE);
6007 }
6008 else
6009 meth = add_method (this_class, flags, meth_name,
6010 build_java_signature (meth));
6011
6012 /* Fix the method argument list so we have the argument name
6013 information */
6014 fix_method_argument_names (orig_arg, meth);
6015
6016 /* Register the parameter number and re-install the current line
6017 number */
6018 DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1;
6019 lineno = saved_lineno;
6020
6021 /* Register exception specified by the `throws' keyword for
6022 resolution and set the method decl appropriate field to the list.
6023 Note: the grammar ensures that what we get here are class
6024 types. */
6025 if (throws)
6026 {
6027 throws = nreverse (throws);
6028 for (current = throws; current; current = TREE_CHAIN (current))
6029 {
6030 register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current),
6031 NULL_TREE, NULL_TREE);
6032 JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
6033 &TREE_VALUE (current);
6034 }
6035 DECL_FUNCTION_THROWS (meth) = throws;
6036 }
6037
6038 /* We set the DECL_NAME to ID so we can track the location where
6039 the function was declared. This allow us to report
6040 redefinition error accurately. When method are verified,
6041 DECL_NAME is reinstalled properly (using the content of the
6042 WFL node ID) (see check_method_redefinition). We don't do that
6043 when Object is being defined. Constructor <init> names will be
6044 reinstalled the same way. */
6045 if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node)
6046 DECL_NAME (meth) = id;
6047
6048 /* Set the flag if we correctly processed a constructor */
6049 if (constructor_ok)
6050 DECL_CONSTRUCTOR_P (meth) = 1;
6051
6052 /* Eventually set the @deprecated tag flag */
6053 CHECK_DEPRECATED (meth);
6054
6055 return meth;
6056 }
6057
6058 static void
6059 fix_method_argument_names (orig_arg, meth)
6060 tree orig_arg, meth;
6061 {
6062 tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth));
6063 if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE)
6064 {
6065 TREE_PURPOSE (arg) = this_identifier_node;
6066 arg = TREE_CHAIN (arg);
6067 }
6068 while (orig_arg != end_params_node)
6069 {
6070 TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg);
6071 orig_arg = TREE_CHAIN (orig_arg);
6072 arg = TREE_CHAIN (arg);
6073 }
6074 }
6075
6076 /* Complete the method declaration with METHOD_BODY. */
6077
6078 static void
6079 complete_method_declaration (method_body)
6080 tree method_body;
6081 {
6082 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body;
6083 maybe_absorb_scoping_blocks ();
6084 /* Exit function's body */
6085 exit_block ();
6086 /* Merge last line of the function with first line, directly in the
6087 function decl. It will be used to emit correct debug info. */
6088 DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1);
6089 }
6090
6091 /* Build a an error message for constructor circularity errors. */
6092
6093 static char *
6094 constructor_circularity_msg (from, to)
6095 tree from, to;
6096 {
6097 static char string [4096];
6098 char *t = strdup (lang_printable_name (from, 0));
6099 sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
6100 free (t);
6101 return string;
6102 }
6103
6104 /* Verify a circular call to METH. Return 1 if an error is found, 0
6105 otherwise. */
6106
6107 static int
6108 verify_constructor_circularity (meth, current)
6109 tree meth, current;
6110 {
6111 static tree list = NULL_TREE;
6112 tree c;
6113 for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
6114 {
6115 if (TREE_VALUE (c) == meth)
6116 {
6117 char *t;
6118 if (list)
6119 {
6120 tree liste;
6121 list = nreverse (list);
6122 for (liste = list; liste; liste = TREE_CHAIN (liste))
6123 {
6124 parse_error_context
6125 (TREE_PURPOSE (TREE_PURPOSE (liste)),
6126 constructor_circularity_msg
6127 (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
6128 java_error_count--;
6129 }
6130 }
6131 t = strdup (lang_printable_name (meth, 0));
6132 parse_error_context (TREE_PURPOSE (c),
6133 "%s: recursive invocation of constructor `%s'",
6134 constructor_circularity_msg (current, meth), t);
6135 free (t);
6136 list = NULL_TREE;
6137 return 1;
6138 }
6139 }
6140 for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
6141 {
6142 list = tree_cons (c, current, list);
6143 if (verify_constructor_circularity (meth, TREE_VALUE (c)))
6144 return 1;
6145 list = TREE_CHAIN (list);
6146 }
6147 return 0;
6148 }
6149
6150 /* Check modifiers that can be declared but exclusively */
6151
6152 static void
6153 check_modifiers_consistency (flags)
6154 int flags;
6155 {
6156 int acc_count = 0;
6157 tree cl = NULL_TREE;
6158
6159 THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl);
6160 THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl);
6161 THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl);
6162 if (acc_count > 1)
6163 parse_error_context
6164 (cl, "Inconsistent member declaration. At most one of `public', "
6165 "`private', or `protected' may be specified");
6166 }
6167
6168 /* Check the methode header METH for abstract specifics features */
6169
6170 static void
6171 check_abstract_method_header (meth)
6172 tree meth;
6173 {
6174 int flags = get_access_flags_from_decl (meth);
6175 /* DECL_NAME might still be a WFL node */
6176 tree name = GET_METHOD_NAME (meth);
6177
6178 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK), flags,
6179 ACC_ABSTRACT, "abstract method `%s'",
6180 IDENTIFIER_POINTER (name));
6181 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), flags,
6182 ACC_PUBLIC, "abstract method `%s'",
6183 IDENTIFIER_POINTER (name));
6184
6185 check_modifiers ("Illegal modifier `%s' for interface method",
6186 flags, INTERFACE_METHOD_MODIFIERS);
6187 }
6188
6189 /* Create a FUNCTION_TYPE node and start augmenting it with the
6190 declared function arguments. Arguments type that can't be resolved
6191 are left as they are, but the returned node is marked as containing
6192 incomplete types. */
6193
6194 static tree
6195 method_declarator (id, list)
6196 tree id, list;
6197 {
6198 tree arg_types = NULL_TREE, current, node;
6199 tree meth = make_node (FUNCTION_TYPE);
6200 jdep *jdep;
6201
6202 patch_stage = JDEP_NO_PATCH;
6203
6204 for (current = list; current; current = TREE_CHAIN (current))
6205 {
6206 int must_chain = 0;
6207 tree wfl_name = TREE_PURPOSE (current);
6208 tree type = TREE_VALUE (current);
6209 tree name = EXPR_WFL_NODE (wfl_name);
6210 tree already, arg_node;
6211 tree type_wfl = NULL_TREE;
6212 tree real_type;
6213
6214 /* Obtain a suitable type for resolution, if necessary */
6215 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
6216
6217 /* Process NAME, as it may specify extra dimension(s) for it */
6218 type = build_array_from_name (type, type_wfl, name, &name);
6219 EXPR_WFL_NODE (wfl_name) = name;
6220
6221 real_type = GET_REAL_TYPE (type);
6222 if (TREE_CODE (real_type) == RECORD_TYPE)
6223 {
6224 real_type = promote_type (real_type);
6225 if (TREE_CODE (type) == TREE_LIST)
6226 TREE_PURPOSE (type) = real_type;
6227 }
6228
6229 /* Check redefinition */
6230 for (already = arg_types; already; already = TREE_CHAIN (already))
6231 if (TREE_PURPOSE (already) == name)
6232 {
6233 parse_error_context
6234 (wfl_name, "Variable `%s' is used more than once in the "
6235 "argument list of method `%s'", IDENTIFIER_POINTER (name),
6236 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
6237 break;
6238 }
6239
6240 /* If we've an incomplete argument type, we know there is a location
6241 to patch when the type get resolved, later. */
6242 jdep = NULL;
6243 if (must_chain)
6244 {
6245 patch_stage = JDEP_METHOD;
6246 type = register_incomplete_type (patch_stage,
6247 type_wfl, wfl_name, type);
6248 jdep = CLASSD_LAST (ctxp->classd_list);
6249 JDEP_MISC (jdep) = id;
6250 }
6251
6252 /* The argument node: a name and a (possibly) incomplete type */
6253 arg_node = build_tree_list (name, real_type);
6254 if (jdep)
6255 JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node);
6256 TREE_CHAIN (arg_node) = arg_types;
6257 arg_types = arg_node;
6258 }
6259 TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node);
6260 node = build_tree_list (id, meth);
6261 return node;
6262 }
6263
6264 static int
6265 unresolved_type_p (wfl, returned)
6266 tree wfl;
6267 tree *returned;
6268
6269 {
6270 if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
6271 {
6272 tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
6273 if (returned)
6274 *returned = (decl ? TREE_TYPE (decl) : NULL_TREE);
6275 return 1;
6276 }
6277 if (returned)
6278 *returned = wfl;
6279 return 0;
6280 }
6281
6282 /* From NAME, build a qualified identifier node using the
6283 qualification from the current package definition. */
6284
6285 static tree
6286 parser_qualified_classname (name)
6287 tree name;
6288 {
6289 if (ctxp->package)
6290 return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name));
6291 else
6292 return EXPR_WFL_NODE (name);
6293 }
6294
6295 /* Called once the type a interface extends is resolved. Returns 0 if
6296 everything is OK. */
6297
6298 static int
6299 parser_check_super_interface (super_decl, this_decl, this_wfl)
6300 tree super_decl, this_decl, this_wfl;
6301 {
6302 tree super_type = TREE_TYPE (super_decl);
6303
6304 /* Has to be an interface */
6305 if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl))))
6306 {
6307 parse_error_context
6308 (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'",
6309 (TYPE_ARRAY_P (super_type) ? "array" : "class"),
6310 IDENTIFIER_POINTER (DECL_NAME (super_decl)),
6311 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
6312 "interface" : "class"),
6313 IDENTIFIER_POINTER (DECL_NAME (this_decl)));
6314 return 1;
6315 }
6316
6317 /* Check scope: same package OK, other package: OK if public */
6318 if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl)))
6319 return 1;
6320
6321 SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
6322 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6323 IDENTIFIER_POINTER (DECL_NAME (super_decl))));
6324 return 0;
6325 }
6326
6327 /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
6328 0 if everthing is OK. */
6329
6330 static int
6331 parser_check_super (super_decl, this_decl, wfl)
6332 tree super_decl, this_decl, wfl;
6333 {
6334 tree super_type = TREE_TYPE (super_decl);
6335
6336 /* SUPER should be a CLASS (neither an array nor an interface) */
6337 if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type)))
6338 {
6339 parse_error_context
6340 (wfl, "Class `%s' can't subclass %s `%s'",
6341 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6342 (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"),
6343 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
6344 return 1;
6345 }
6346
6347 if (CLASS_FINAL (TYPE_NAME (super_type)))
6348 {
6349 parse_error_context (wfl, "Can't subclass final classes: %s",
6350 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
6351 return 1;
6352 }
6353
6354 /* Check scope: same package OK, other package: OK if public */
6355 if (check_pkg_class_access (DECL_NAME (super_decl), wfl))
6356 return 1;
6357
6358 SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
6359 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6360 IDENTIFIER_POINTER (DECL_NAME (super_decl))));
6361 return 0;
6362 }
6363
6364 /* Create a new dependency list and link it (in a LIFO manner) to the
6365 CTXP list of type dependency list. */
6366
6367 static void
6368 create_jdep_list (ctxp)
6369 struct parser_ctxt *ctxp;
6370 {
6371 jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist));
6372 new->first = new->last = NULL;
6373 new->next = ctxp->classd_list;
6374 ctxp->classd_list = new;
6375 }
6376
6377 static jdeplist *
6378 reverse_jdep_list (ctxp)
6379 struct parser_ctxt *ctxp;
6380 {
6381 register jdeplist *prev = NULL, *current, *next;
6382 for (current = ctxp->classd_list; current; current = next)
6383 {
6384 next = current->next;
6385 current->next = prev;
6386 prev = current;
6387 }
6388 return prev;
6389 }
6390
6391 /* Create a fake pointer based on the ID stored in
6392 TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
6393 registered again. */
6394
6395 static tree
6396 obtain_incomplete_type (type_name)
6397 tree type_name;
6398 {
6399 tree ptr, name;
6400
6401 if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION)
6402 name = EXPR_WFL_NODE (type_name);
6403 else if (INCOMPLETE_TYPE_P (type_name))
6404 name = TYPE_NAME (type_name);
6405 else
6406 fatal ("invalid type name - obtain_incomplete_type");
6407
6408 for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr))
6409 if (TYPE_NAME (TREE_PURPOSE (ptr)) == name)
6410 break;
6411
6412 if (!ptr)
6413 {
6414 tree core;
6415 push_obstacks (&permanent_obstack, &permanent_obstack);
6416 BUILD_PTR_FROM_NAME (core, name);
6417 layout_type (core);
6418 ptr = build_tree_list (core, NULL_TREE);
6419 pop_obstacks ();
6420 TREE_CHAIN (ptr) = ctxp->incomplete_class;
6421 ctxp->incomplete_class = ptr;
6422 }
6423
6424 return ptr;
6425 }
6426
6427 /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
6428 non NULL instead of computing a new fake type based on WFL. The new
6429 dependency is inserted in the current type dependency list, in FIFO
6430 manner. */
6431
6432 static tree
6433 register_incomplete_type (kind, wfl, decl, ptr)
6434 int kind;
6435 tree wfl, decl, ptr;
6436 {
6437 jdep *new = (jdep *)xmalloc (sizeof (jdep));
6438
6439 if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */
6440 ptr = obtain_incomplete_type (wfl);
6441
6442 JDEP_KIND (new) = kind;
6443 JDEP_DECL (new) = decl;
6444 JDEP_SOLV (new) = ptr;
6445 JDEP_WFL (new) = wfl;
6446 JDEP_CHAIN (new) = NULL;
6447 JDEP_MISC (new) = NULL_TREE;
6448 JDEP_GET_PATCH (new) = (tree *)NULL;
6449
6450 JDEP_INSERT (ctxp->classd_list, new);
6451
6452 return ptr;
6453 }
6454
6455 void
6456 java_check_circular_reference ()
6457 {
6458 tree current;
6459 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
6460 {
6461 tree type = TREE_TYPE (current);
6462 if (CLASS_INTERFACE (TYPE_NAME (type)))
6463 {
6464 /* Check all interfaces this class extends */
6465 tree basetype_vec = TYPE_BINFO_BASETYPES (type);
6466 int n, i;
6467
6468 if (!basetype_vec)
6469 return;
6470 n = TREE_VEC_LENGTH (basetype_vec);
6471 for (i = 0; i < n; i++)
6472 {
6473 tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
6474 if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node
6475 && interface_of_p (type, BINFO_TYPE (vec_elt)))
6476 parse_error_context (lookup_cl (current),
6477 "Cyclic interface inheritance");
6478 }
6479 }
6480 else
6481 if (inherits_from_p (CLASSTYPE_SUPER (type), type))
6482 parse_error_context (lookup_cl (current),
6483 "Cyclic class inheritance");
6484 }
6485 }
6486
6487 /* safe_layout_class just makes sure that we can load a class without
6488 disrupting the current_class, input_file, lineno, etc, information
6489 about the class processed currently. */
6490
6491 void
6492 safe_layout_class (class)
6493 tree class;
6494 {
6495 tree save_current_class = current_class;
6496 char *save_input_filename = input_filename;
6497 int save_lineno = lineno;
6498
6499 push_obstacks (&permanent_obstack, &permanent_obstack);
6500
6501 layout_class (class);
6502 pop_obstacks ();
6503
6504 current_class = save_current_class;
6505 input_filename = save_input_filename;
6506 lineno = save_lineno;
6507 CLASS_LOADED_P (class) = 1;
6508 }
6509
6510 static tree
6511 jdep_resolve_class (dep)
6512 jdep *dep;
6513 {
6514 tree decl;
6515
6516 if (JDEP_RESOLVED_P (dep))
6517 decl = JDEP_RESOLVED_DECL (dep);
6518 else
6519 {
6520 decl = resolve_class (JDEP_TO_RESOLVE (dep),
6521 JDEP_DECL (dep), JDEP_WFL (dep));
6522 JDEP_RESOLVED (dep, decl);
6523 }
6524
6525 if (!decl)
6526 complete_class_report_errors (dep);
6527
6528 return decl;
6529 }
6530
6531 /* Complete unsatisfied class declaration and their dependencies */
6532
6533 void
6534 java_complete_class ()
6535 {
6536 tree cclass;
6537 jdeplist *cclassd;
6538 int error_found;
6539 tree type;
6540
6541 push_obstacks (&permanent_obstack, &permanent_obstack);
6542
6543 /* Process imports and reverse the import on demand list */
6544 process_imports ();
6545 if (ctxp->import_demand_list)
6546 ctxp->import_demand_list = nreverse (ctxp->import_demand_list);
6547
6548 /* Rever things so we have the right order */
6549 ctxp->class_list = nreverse (ctxp->class_list);
6550 ctxp->classd_list = reverse_jdep_list (ctxp);
6551
6552 for (cclassd = ctxp->classd_list, cclass = ctxp->class_list;
6553 cclass && cclassd;
6554 cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd))
6555 {
6556 jdep *dep;
6557 for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep))
6558 {
6559 tree decl;
6560 if (!(decl = jdep_resolve_class (dep)))
6561 continue;
6562
6563 /* Now it's time to patch */
6564 switch (JDEP_KIND (dep))
6565 {
6566 case JDEP_SUPER:
6567 /* Simply patch super */
6568 if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
6569 continue;
6570 BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
6571 (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
6572 break;
6573
6574 case JDEP_FIELD:
6575 {
6576 /* We do part of the job done in add_field */
6577 tree field_decl = JDEP_DECL (dep);
6578 tree field_type = TREE_TYPE (decl);
6579 push_obstacks (&permanent_obstack, &permanent_obstack);
6580 if (TREE_CODE (field_type) == RECORD_TYPE)
6581 field_type = promote_type (field_type);
6582 pop_obstacks ();
6583 TREE_TYPE (field_decl) = field_type;
6584 DECL_ALIGN (field_decl) = 0;
6585 layout_decl (field_decl, 0);
6586 SOURCE_FRONTEND_DEBUG
6587 (("Completed field/var decl `%s' with `%s'",
6588 IDENTIFIER_POINTER (DECL_NAME (field_decl)),
6589 IDENTIFIER_POINTER (DECL_NAME (decl))));
6590 break;
6591 }
6592 case JDEP_METHOD: /* We start patching a method */
6593 case JDEP_METHOD_RETURN:
6594 error_found = 0;
6595 while (1)
6596 {
6597 if (decl)
6598 {
6599 type = TREE_TYPE(decl);
6600 if (TREE_CODE (type) == RECORD_TYPE)
6601 type = promote_type (type);
6602 JDEP_APPLY_PATCH (dep, type);
6603 SOURCE_FRONTEND_DEBUG
6604 (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ?
6605 "Completing fct `%s' with ret type `%s'":
6606 "Completing arg `%s' with type `%s'"),
6607 IDENTIFIER_POINTER (EXPR_WFL_NODE
6608 (JDEP_DECL_WFL (dep))),
6609 IDENTIFIER_POINTER (DECL_NAME (decl))));
6610 }
6611 else
6612 error_found = 1;
6613 dep = JDEP_CHAIN (dep);
6614 if (JDEP_KIND (dep) == JDEP_METHOD_END)
6615 break;
6616 else
6617 decl = jdep_resolve_class (dep);
6618 }
6619 if (!error_found)
6620 {
6621 tree mdecl = JDEP_DECL (dep), signature;
6622 push_obstacks (&permanent_obstack, &permanent_obstack);
6623 /* Recompute and reset the signature */
6624 signature = build_java_signature (TREE_TYPE (mdecl));
6625 set_java_signature (TREE_TYPE (mdecl), signature);
6626 pop_obstacks ();
6627 }
6628 else
6629 continue;
6630 break;
6631
6632 case JDEP_INTERFACE:
6633 if (parser_check_super_interface (decl, JDEP_DECL (dep),
6634 JDEP_WFL (dep)))
6635 continue;
6636 parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep));
6637 break;
6638
6639 case JDEP_PARM:
6640 case JDEP_VARIABLE:
6641 type = TREE_TYPE(decl);
6642 if (TREE_CODE (type) == RECORD_TYPE)
6643 type = promote_type (type);
6644 JDEP_APPLY_PATCH (dep, type);
6645 break;
6646
6647 case JDEP_TYPE:
6648 JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
6649 SOURCE_FRONTEND_DEBUG
6650 (("Completing a random type dependency on a '%s' node",
6651 tree_code_name [TREE_CODE (JDEP_DECL (dep))]));
6652 break;
6653
6654 case JDEP_EXCEPTION:
6655 JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
6656 SOURCE_FRONTEND_DEBUG
6657 (("Completing `%s' `throws' argument node",
6658 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))));
6659 break;
6660
6661 default:
6662 fatal ("Can't handle patch code %d - java_complete_class",
6663 JDEP_KIND (dep));
6664 }
6665 }
6666 }
6667 pop_obstacks ();
6668 return;
6669 }
6670
6671 /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
6672 array. */
6673
6674 static tree
6675 resolve_class (class_type, decl, cl)
6676 tree class_type, decl, cl;
6677 {
6678 char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type));
6679 char *base = name;
6680 tree resolved_type, resolved_type_decl;
6681
6682 /* 1- Check to see if we have an array. If true, find what we really
6683 want to resolve */
6684 while (name[0] == '[')
6685 name++;
6686 if (base != name)
6687 TYPE_NAME (class_type) = get_identifier (name);
6688
6689 /* 2- Resolve the bare type */
6690 if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl)))
6691 return NULL_TREE;
6692 resolved_type = TREE_TYPE (resolved_type_decl);
6693
6694 /* 3- If we have and array, reconstruct the array down to its nesting */
6695 if (base != name)
6696 {
6697 while (base != name)
6698 {
6699 if (TREE_CODE (resolved_type) == RECORD_TYPE)
6700 resolved_type = promote_type (resolved_type);
6701 resolved_type = build_java_array_type (resolved_type, -1);
6702 CLASS_LOADED_P (resolved_type) = 1;
6703 name--;
6704 }
6705 /* Build a fake decl for this, since this is what is expected to
6706 be returned. */
6707 resolved_type_decl =
6708 build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type);
6709 /* Figure how those two things are important for error report. FIXME */
6710 DECL_SOURCE_LINE (resolved_type_decl) = 0;
6711 DECL_SOURCE_FILE (resolved_type_decl) = input_filename;
6712 }
6713 return resolved_type_decl;
6714 }
6715
6716 /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
6717 are used to report error messages. */
6718
6719 static tree
6720 do_resolve_class (class_type, decl, cl)
6721 tree class_type;
6722 tree decl;
6723 tree cl;
6724 {
6725 tree new_class_decl;
6726 tree original_name = NULL_TREE;
6727
6728 /* Do not try to replace TYPE_NAME (class_type) by a variable, since
6729 its is changed by find_in_imports{_on_demand} */
6730
6731 /* 1- Check for the type in single imports */
6732 if (find_in_imports (class_type))
6733 return NULL_TREE;
6734
6735 /* 2- And check for the type in the current compilation unit. If it fails,
6736 try with a name qualified with the package name if appropriate. */
6737 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6738 {
6739 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
6740 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
6741 load_class (TYPE_NAME (class_type), 0);
6742 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6743 }
6744
6745 original_name = TYPE_NAME (class_type);
6746 if (!QUALIFIED_P (TYPE_NAME (class_type)) && ctxp->package)
6747 TYPE_NAME (class_type) = merge_qualified_name (ctxp->package,
6748 TYPE_NAME (class_type));
6749 if (!(new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6750 load_class (TYPE_NAME (class_type), 0);
6751 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6752 {
6753 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
6754 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
6755 load_class (TYPE_NAME (class_type), 0);
6756 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6757 }
6758 TYPE_NAME (class_type) = original_name;
6759
6760 /* 3- Check an other compilation unit that bears the name of type */
6761 load_class (TYPE_NAME (class_type), 0);
6762 if (check_pkg_class_access (TYPE_NAME (class_type),
6763 (cl ? cl : lookup_cl (decl))))
6764 return NULL_TREE;
6765
6766 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6767 return new_class_decl;
6768
6769 /* 4- Check the import on demands. Don't allow bar.baz to be
6770 imported from foo.* */
6771 if (!QUALIFIED_P (TYPE_NAME (class_type)))
6772 if (find_in_imports_on_demand (class_type))
6773 return NULL_TREE;
6774
6775 /* 5- Last call for a resolution */
6776 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6777 }
6778
6779 /* Resolve NAME and lay it out (if not done and if not the current
6780 parsed class). Return a decl node. This function is meant to be
6781 called when type resolution is necessary during the walk pass. */
6782
6783 static tree
6784 resolve_and_layout (something, cl)
6785 tree something;
6786 tree cl;
6787 {
6788 tree decl;
6789
6790 /* Don't do that on the current class */
6791 if (something == current_class)
6792 return TYPE_NAME (current_class);
6793
6794 /* Don't do anything for void and other primitive types */
6795 if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
6796 return NULL_TREE;
6797
6798 /* Pointer types can be reall pointer types or fake pointers. When
6799 finding a real pointer, recheck for primitive types */
6800 if (TREE_CODE (something) == POINTER_TYPE)
6801 {
6802 if (TREE_TYPE (something))
6803 {
6804 something = TREE_TYPE (something);
6805 if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
6806 return NULL_TREE;
6807 }
6808 else
6809 something = TYPE_NAME (something);
6810 }
6811
6812 /* Don't do anything for arrays of primitive types */
6813 if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something)
6814 && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something)))
6815 return NULL_TREE;
6816
6817 /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
6818 or a real TYPE */
6819 if (TREE_CODE (something) != IDENTIFIER_NODE)
6820 something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ?
6821 DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something));
6822
6823 if (!(decl = resolve_no_layout (something, cl)))
6824 return NULL_TREE;
6825
6826 /* Resolve and layout if necessary */
6827 layout_class_methods (TREE_TYPE (decl));
6828 if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))
6829 CHECK_METHODS (decl);
6830 if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
6831 safe_layout_class (TREE_TYPE (decl));
6832
6833 return decl;
6834 }
6835
6836 /* Resolve a class, returns its decl but doesn't perform any
6837 layout. The current parsing context is saved and restored */
6838
6839 static tree
6840 resolve_no_layout (name, cl)
6841 tree name, cl;
6842 {
6843 tree ptr, decl;
6844 BUILD_PTR_FROM_NAME (ptr, name);
6845 java_parser_context_save_global ();
6846 decl = resolve_class (ptr, NULL_TREE, cl);
6847 java_parser_context_restore_global ();
6848
6849 return decl;
6850 }
6851
6852 /* Called when reporting errors. Skip leader '[' in a complex array
6853 type description that failed to be resolved. */
6854
6855 static char *
6856 purify_type_name (name)
6857 char *name;
6858 {
6859 while (*name && *name == '[')
6860 name++;
6861 return name;
6862 }
6863
6864 /* The type CURRENT refers to can't be found. We print error messages. */
6865
6866 static void
6867 complete_class_report_errors (dep)
6868 jdep *dep;
6869 {
6870 char *name;
6871
6872 if (!JDEP_WFL (dep))
6873 return;
6874
6875 name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)));
6876 switch (JDEP_KIND (dep))
6877 {
6878 case JDEP_SUPER:
6879 parse_error_context
6880 (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found",
6881 purify_type_name (name),
6882 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6883 break;
6884 case JDEP_FIELD:
6885 parse_error_context
6886 (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'",
6887 purify_type_name (name),
6888 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6889 break;
6890 case JDEP_METHOD: /* Covers arguments */
6891 parse_error_context
6892 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
6893 "argument `%s' of method `%s'",
6894 purify_type_name (name),
6895 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))),
6896 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep))));
6897 break;
6898 case JDEP_METHOD_RETURN: /* Covers return type */
6899 parse_error_context
6900 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
6901 "return type of method `%s'",
6902 purify_type_name (name),
6903 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
6904 break;
6905 case JDEP_INTERFACE:
6906 parse_error_context
6907 (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found",
6908 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
6909 (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")),
6910 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6911 break;
6912 case JDEP_VARIABLE:
6913 parse_error_context
6914 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
6915 "local variable `%s'",
6916 purify_type_name (IDENTIFIER_POINTER
6917 (EXPR_WFL_NODE (JDEP_WFL (dep)))),
6918 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6919 break;
6920 case JDEP_EXCEPTION: /* As specified by `throws' */
6921 parse_error_context
6922 (JDEP_WFL (dep), "Class `%s' not found in `throws'",
6923 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))));
6924 break;
6925 default:
6926 /* Fix for -Wall. Just break doing nothing. The error will be
6927 caught later */
6928 break;
6929 }
6930 }
6931
6932 /* Check uninitialized final. */
6933
6934 void
6935 java_check_final ()
6936 {
6937 }
6938
6939 /* Return a static string containing the DECL prototype string. If
6940 DECL is a constructor, use the class name instead of the form
6941 <init> */
6942
6943 static char *
6944 get_printable_method_name (decl)
6945 tree decl;
6946 {
6947 char *to_return;
6948 tree name;
6949
6950 if (DECL_CONSTRUCTOR_P (decl))
6951 {
6952 name = DECL_NAME (decl);
6953 DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
6954 }
6955
6956 to_return = lang_printable_name (decl, 0);
6957 if (DECL_CONSTRUCTOR_P (decl))
6958 DECL_NAME (decl) = name;
6959
6960 return to_return;
6961 }
6962
6963 /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
6964 nevertheless needs to be verfied, 1 otherwise. */
6965
6966 static int
6967 reset_method_name (method)
6968 tree method;
6969 {
6970 if (DECL_NAME (method) != clinit_identifier_node
6971 && DECL_NAME (method) != finit_identifier_node)
6972 {
6973 /* NAME is just the plain name when Object is being defined */
6974 if (DECL_CONTEXT (method) != object_type_node)
6975 DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ?
6976 init_identifier_node : GET_METHOD_NAME (method));
6977 return 0;
6978 }
6979 else
6980 return 1;
6981 }
6982
6983 /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
6984
6985 tree
6986 java_get_real_method_name (method_decl)
6987 tree method_decl;
6988 {
6989 tree method_name = DECL_NAME (method_decl);
6990 if (DECL_CONSTRUCTOR_P (method_decl))
6991 return init_identifier_node;
6992
6993 /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
6994 and still can be a constructor. FIXME */
6995
6996 /* Don't confuse method only bearing the name of their class as
6997 constructors */
6998 else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl))
6999 && ctxp
7000 && ctxp->current_parsed_class_un == EXPR_WFL_NODE (method_name)
7001 && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED
7002 && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node)
7003 return init_identifier_node;
7004 else
7005 return EXPR_WFL_NODE (method_name);
7006 }
7007
7008 /* Track method being redefined inside the same class. As a side
7009 effect, set DECL_NAME to an IDENTIFIER (prior entering this
7010 function it's a FWL, so we can track errors more accurately */
7011
7012 static int
7013 check_method_redefinition (class, method)
7014 tree class, method;
7015 {
7016 tree redef, name;
7017 tree cl = DECL_NAME (method);
7018 tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
7019 /* decl name of artificial <clinit> and $finit$ doesn't need to be fixed and
7020 checked */
7021
7022 /* Reset the method name before running the check. If it returns 1,
7023 the method doesn't need to be verified with respect to method
7024 redeclaration and we return 0 */
7025 if (reset_method_name (method))
7026 return 0;
7027
7028 name = DECL_NAME (method);
7029 for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
7030 {
7031 if (redef == method)
7032 break;
7033 if (DECL_NAME (redef) == name
7034 && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef)))
7035 {
7036 parse_error_context
7037 (cl, "Duplicate %s declaration `%s'",
7038 (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
7039 get_printable_method_name (redef));
7040 return 1;
7041 }
7042 }
7043 return 0;
7044 }
7045
7046 /* Check all the methods of CLASS. Methods are first completed then
7047 checked according to regular method existance rules.
7048 If no constructor were encountered, then build its declaration. */
7049
7050 static void
7051 java_check_regular_methods (class_decl)
7052 tree class_decl;
7053 {
7054 int saw_constructor = 0;
7055 tree method;
7056 tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl));
7057 tree super_class = CLASSTYPE_SUPER (class);
7058 tree saved_found_wfl = NULL_TREE, found = NULL_TREE;
7059 tree mthrows;
7060
7061 /* It is not necessary to check methods defined in java.lang.Object */
7062 if (class == object_type_node)
7063 return;
7064
7065 if (!TYPE_NVIRTUALS (class))
7066 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7067
7068 /* Should take interfaces into account. FIXME */
7069 for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method))
7070 {
7071 tree sig;
7072 tree method_wfl = DECL_NAME (method);
7073 int aflags;
7074
7075 /* If we previously found something and its name was saved,
7076 reinstall it now */
7077 if (found && saved_found_wfl)
7078 DECL_NAME (found) = saved_found_wfl;
7079
7080 /* Check for redefinitions */
7081 if (check_method_redefinition (class, method))
7082 continue;
7083
7084 /* If we see one constructor a mark so we don't generate the
7085 default one. Also skip other verifications: constructors
7086 can't be inherited hence hiden or overriden */
7087 if (DECL_CONSTRUCTOR_P (method))
7088 {
7089 saw_constructor = 1;
7090 continue;
7091 }
7092
7093 /* We verify things thrown by the method. They must inherits from
7094 java.lang.Throwable */
7095 for (mthrows = DECL_FUNCTION_THROWS (method);
7096 mthrows; mthrows = TREE_CHAIN (mthrows))
7097 {
7098 if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node))
7099 parse_error_context
7100 (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be "
7101 "a subclass of class `java.lang.Throwable'",
7102 IDENTIFIER_POINTER
7103 (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
7104 }
7105
7106 sig = build_java_argument_signature (TREE_TYPE (method));
7107 found = lookup_argument_method (super_class, DECL_NAME (method), sig);
7108
7109 /* Nothing overrides or it's a private method. */
7110 if (!found || (found && METHOD_PRIVATE (found)))
7111 continue;
7112
7113 /* If found wasn't verified, it's DECL_NAME won't be set properly.
7114 We set it temporarily for the sake of the error report. */
7115 saved_found_wfl = DECL_NAME (found);
7116 reset_method_name (found);
7117
7118 /* Can't override a method with the same name and different return
7119 types. */
7120 if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
7121 {
7122 char *t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)),
7123 0));
7124 parse_error_context
7125 (method_wfl,
7126 "Method `%s' was defined with return type `%s' in class `%s'",
7127 lang_printable_name (found, 0), t,
7128 IDENTIFIER_POINTER
7129 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7130 free (t);
7131 }
7132
7133 /* Can't override final. Can't override static. */
7134 if (METHOD_FINAL (found) || METHOD_STATIC (found))
7135 {
7136 /* Static *can* override static */
7137 if (METHOD_STATIC (found) && METHOD_STATIC (method))
7138 continue;
7139 parse_error_context
7140 (method_wfl,
7141 "%s methods can't be overriden. Method `%s' is %s in class `%s'",
7142 (METHOD_FINAL (found) ? "Final" : "Static"),
7143 lang_printable_name (found, 0),
7144 (METHOD_FINAL (found) ? "final" : "static"),
7145 IDENTIFIER_POINTER
7146 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7147 continue;
7148 }
7149 /* Static method can't override instance method. */
7150 if (METHOD_STATIC (method))
7151 {
7152 parse_error_context
7153 (method_wfl,
7154 "Instance methods can't be overriden by a static method. Method "
7155 "`%s' is an instance method in class `%s'",
7156 lang_printable_name (found, 0),
7157 IDENTIFIER_POINTER
7158 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7159 continue;
7160 }
7161
7162 aflags = get_access_flags_from_decl (found);
7163 /* - Overriding/hiding public must be public
7164 - Overriding/hiding protected must be protected or public
7165 - If the overriden or hidden method has default (package)
7166 access, then the overriding or hiding method must not be
7167 private; otherwise, a compile-time error occurs */
7168 if ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method))
7169 || (METHOD_PROTECTED (found)
7170 && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method)))
7171 || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC))
7172 && METHOD_PRIVATE (method)))
7173 {
7174 parse_error_context
7175 (method_wfl,
7176 "Methods can't be overridden to be more private. Method `%s' is "
7177 "not %s in class `%s'", lang_printable_name (method, 0),
7178 (METHOD_PUBLIC (method) ? "public" :
7179 (METHOD_PRIVATE (method) ? "private" : "protected")),
7180 IDENTIFIER_POINTER (DECL_NAME
7181 (TYPE_NAME (DECL_CONTEXT (found)))));
7182 continue;
7183 }
7184
7185 /* Overriding methods must have compatible `throws' clauses on checked
7186 exceptions, if any */
7187 check_throws_clauses (method, method_wfl, found);
7188
7189 /* If the method has default access in an other package, then
7190 issue a warning that the current method doesn't override the
7191 one that was found elsewhere. Do not issue this warning when
7192 the match was found in java.lang.Object. */
7193 if (DECL_CONTEXT (found) != object_type_node
7194 && (!aflags || (aflags > ACC_PROTECTED))
7195 && !class_in_current_package (DECL_CONTEXT (found))
7196 && flag_not_overriding)
7197 parse_warning_context
7198 (method_wfl, "Method `%s' in class `%s' does not "
7199 "override the corresponding method in class `%s', which is "
7200 "private to a different package",
7201 lang_printable_name (found, 0),
7202 IDENTIFIER_POINTER (DECL_NAME (class_decl)),
7203 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7204
7205 /* Inheriting multiple methods with the same signature. FIXME */
7206 }
7207
7208 /* Don't forget eventual pending found and saved_found_wfl. Take
7209 into account that we might have exited because we saw an
7210 aritifical method as the last entry. */
7211
7212 if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
7213 DECL_NAME (found) = saved_found_wfl;
7214
7215 if (!TYPE_NVIRTUALS (class))
7216 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7217
7218 if (!saw_constructor)
7219 {
7220 /* No constructor seen, we craft one, at line 0. Since this
7221 operation takes place after we laid methods out
7222 (layout_class_methods), we prepare the its DECL
7223 appropriately. */
7224 int flags;
7225 tree decl;
7226
7227 /* If the class is declared PUBLIC, the default constructor is
7228 PUBLIC otherwise it has default access implied by no access
7229 modifiers. */
7230 flags = (get_access_flags_from_decl (class_decl) & ACC_PUBLIC ?
7231 ACC_PUBLIC : 0);
7232 decl = create_artificial_method (class, flags, void_type_node,
7233 init_identifier_node, end_params_node);
7234 DECL_CONSTRUCTOR_P (decl) = 1;
7235 layout_class_method (TREE_TYPE (class_decl), NULL_TREE, decl, NULL_TREE);
7236 }
7237 }
7238
7239 /* Return a non zero value if the `throws' clause of METHOD (if any)
7240 is incompatible with the `throws' clause of FOUND (if any). */
7241
7242 static void
7243 check_throws_clauses (method, method_wfl, found)
7244 tree method, method_wfl, found;
7245 {
7246 tree mthrows, fthrows;
7247
7248 /* Can't check these things with class loaded from bytecode. FIXME */
7249 if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found)))
7250 return;
7251
7252 for (mthrows = DECL_FUNCTION_THROWS (method);
7253 mthrows; mthrows = TREE_CHAIN (mthrows))
7254 {
7255 /* We don't verify unchecked expressions */
7256 if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows)))
7257 continue;
7258 /* Checked expression must be compatible */
7259 for (fthrows = DECL_FUNCTION_THROWS (found);
7260 fthrows; fthrows = TREE_CHAIN (fthrows))
7261 if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows)))
7262 break;
7263 if (!fthrows)
7264 {
7265 parse_error_context
7266 (method_wfl, "Invalid checked exception class `%s' in "
7267 "`throws' clause. The exception must be a subclass of an "
7268 "exception thrown by `%s' from class `%s'",
7269 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
7270 lang_printable_name (found, 0),
7271 IDENTIFIER_POINTER
7272 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7273 }
7274 }
7275 }
7276
7277 /* Check abstract method of interface INTERFACE */
7278
7279 static void
7280 java_check_abstract_methods (interface_decl)
7281 tree interface_decl;
7282 {
7283 int i, n;
7284 tree method, basetype_vec, found;
7285 tree interface = TREE_TYPE (interface_decl);
7286
7287 for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method))
7288 {
7289 tree method_wfl = DECL_NAME (method);
7290
7291 /* 2- Check for double definition inside the defining interface */
7292 if (check_method_redefinition (interface, method))
7293 continue;
7294
7295 /* 3- Overriding is OK as far as we preserve the return type and
7296 the thrown exceptions (FIXME) */
7297 found = lookup_java_interface_method2 (interface, method);
7298 if (found)
7299 {
7300 char *t;
7301 tree saved_found_wfl = DECL_NAME (found);
7302 reset_method_name (found);
7303 t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
7304 parse_error_context
7305 (method_wfl,
7306 "Method `%s' was defined with return type `%s' in class `%s'",
7307 lang_printable_name (found, 0), t,
7308 IDENTIFIER_POINTER
7309 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7310 free (t);
7311 continue;
7312
7313 DECL_NAME (found) = saved_found_wfl;
7314 }
7315 }
7316
7317 /* 4- Inherited methods can't differ by their returned types */
7318 if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface)))
7319 return;
7320 n = TREE_VEC_LENGTH (basetype_vec);
7321 for (i = 0; i < n; i++)
7322 {
7323 tree sub_interface_method, sub_interface;
7324 tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
7325 if (!vec_elt)
7326 continue;
7327 sub_interface = BINFO_TYPE (vec_elt);
7328 for (sub_interface_method = TYPE_METHODS (sub_interface);
7329 sub_interface_method;
7330 sub_interface_method = TREE_CHAIN (sub_interface_method))
7331 {
7332 found = lookup_java_interface_method2 (interface,
7333 sub_interface_method);
7334 if (found && (found != sub_interface_method))
7335 {
7336 tree saved_found_wfl = DECL_NAME (found);
7337 reset_method_name (found);
7338 parse_error_context
7339 (lookup_cl (sub_interface_method),
7340 "Interface `%s' inherits method `%s' from interface `%s'. "
7341 "This method is redefined with a different return type in "
7342 "interface `%s'",
7343 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
7344 lang_printable_name (found, 0),
7345 IDENTIFIER_POINTER
7346 (DECL_NAME (TYPE_NAME
7347 (DECL_CONTEXT (sub_interface_method)))),
7348 IDENTIFIER_POINTER
7349 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7350 DECL_NAME (found) = saved_found_wfl;
7351 }
7352 }
7353 }
7354 }
7355
7356 /* Lookup methods in interfaces using their name and partial
7357 signature. Return a matching method only if their types differ. */
7358
7359 static tree
7360 lookup_java_interface_method2 (class, method_decl)
7361 tree class, method_decl;
7362 {
7363 int i, n;
7364 tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return;
7365
7366 if (!basetype_vec)
7367 return NULL_TREE;
7368
7369 n = TREE_VEC_LENGTH (basetype_vec);
7370 for (i = 0; i < n; i++)
7371 {
7372 tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return;
7373 if ((BINFO_TYPE (vec_elt) != object_type_node)
7374 && (to_return =
7375 lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1)))
7376 return to_return;
7377 }
7378 for (i = 0; i < n; i++)
7379 {
7380 to_return = lookup_java_interface_method2
7381 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl);
7382 if (to_return)
7383 return to_return;
7384 }
7385
7386 return NULL_TREE;
7387 }
7388
7389 /* Lookup method using their name and partial signature. Return a
7390 matching method only if their types differ. */
7391
7392 static tree
7393 lookup_java_method2 (clas, method_decl, do_interface)
7394 tree clas, method_decl;
7395 int do_interface;
7396 {
7397 tree method, method_signature, method_name, method_type, name;
7398
7399 method_signature = build_java_argument_signature (TREE_TYPE (method_decl));
7400 name = DECL_NAME (method_decl);
7401 method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
7402 EXPR_WFL_NODE (name) : name);
7403 method_type = TREE_TYPE (TREE_TYPE (method_decl));
7404
7405 while (clas != NULL_TREE)
7406 {
7407 for (method = TYPE_METHODS (clas);
7408 method != NULL_TREE; method = TREE_CHAIN (method))
7409 {
7410 tree method_sig = build_java_argument_signature (TREE_TYPE (method));
7411 tree name = DECL_NAME (method);
7412 if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
7413 EXPR_WFL_NODE (name) : name) == method_name
7414 && method_sig == method_signature
7415 && TREE_TYPE (TREE_TYPE (method)) != method_type)
7416 return method;
7417 }
7418 clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas));
7419 }
7420 return NULL_TREE;
7421 }
7422
7423 /* Return the line that matches DECL line number. Used during error
7424 report */
7425
7426 static tree
7427 lookup_cl (decl)
7428 tree decl;
7429 {
7430 static tree cl = NULL_TREE;
7431
7432 if (!decl)
7433 return NULL_TREE;
7434
7435 if (cl == NULL_TREE)
7436 cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
7437
7438 EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
7439 EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
7440
7441 return cl;
7442 }
7443
7444 /* Look for a simple name in the single-type import list */
7445
7446 static tree
7447 find_name_in_single_imports (name)
7448 tree name;
7449 {
7450 tree node;
7451
7452 for (node = ctxp->import_list; node; node = TREE_CHAIN (node))
7453 if (TREE_VALUE (node) == name)
7454 return (EXPR_WFL_NODE (TREE_PURPOSE (node)));
7455
7456 return NULL_TREE;
7457 }
7458
7459 /* Process all single-type import. */
7460
7461 static int
7462 process_imports ()
7463 {
7464 tree import;
7465 int error_found;
7466
7467 for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
7468 {
7469 tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
7470
7471 /* Don't load twice something already defined. */
7472 if (IDENTIFIER_CLASS_VALUE (to_be_found))
7473 continue;
7474 QUALIFIED_P (to_be_found) = 1;
7475 load_class (to_be_found, 0);
7476 error_found =
7477 check_pkg_class_access (to_be_found, TREE_PURPOSE (import));
7478 if (!IDENTIFIER_CLASS_VALUE (to_be_found))
7479 {
7480 parse_error_context (TREE_PURPOSE (import),
7481 "Class or interface `%s' not found in import",
7482 IDENTIFIER_POINTER (to_be_found));
7483 return 1;
7484 }
7485 if (error_found)
7486 return 1;
7487 }
7488 return 0;
7489 }
7490
7491 /* Possibly find a class imported by a single-type import statement. Return
7492 1 if an error occured, 0 otherwise. */
7493
7494 static int
7495 find_in_imports (class_type)
7496 tree class_type;
7497 {
7498 tree import;
7499
7500 for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
7501 if (TREE_VALUE (import) == TYPE_NAME (class_type))
7502 {
7503 TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import));
7504 QUALIFIED_P (TYPE_NAME (class_type)) = 1;
7505 }
7506 return 0;
7507 }
7508
7509 static int
7510 note_possible_classname (name, len)
7511 char *name;
7512 int len;
7513 {
7514 tree node;
7515 if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0)
7516 len = len - 5;
7517 else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0)
7518 len = len - 6;
7519 else
7520 return 0;
7521 node = ident_subst (name, len, "", '/', '.', "");
7522 IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
7523 QUALIFIED_P (node) = 1; /* As soon as we turn / into . */
7524 return 1;
7525 }
7526
7527 /* Read a import directory, gathering potential match for further type
7528 references. Indifferently reads a filesystem or a ZIP archive
7529 directory. */
7530
7531 static void
7532 read_import_dir (wfl)
7533 tree wfl;
7534 {
7535 tree package_id = EXPR_WFL_NODE (wfl);
7536 char *package_name = IDENTIFIER_POINTER (package_id);
7537 int package_length = IDENTIFIER_LENGTH (package_id);
7538 DIR *dirp = NULL;
7539 JCF jcfr, *jcf, *saved_jcf = current_jcf;
7540
7541 int found = 0;
7542 int k;
7543 void *entry;
7544 struct buffer filename[1];
7545
7546
7547 if (IS_AN_IMPORT_ON_DEMAND_P (package_id))
7548 return;
7549 IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1;
7550
7551 BUFFER_INIT (filename);
7552 buffer_grow (filename, package_length + 100);
7553
7554 for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
7555 {
7556 char *entry_name = jcf_path_name (entry);
7557 int entry_length = strlen (entry_name);
7558 if (jcf_path_is_zipfile (entry))
7559 {
7560 ZipFile *zipf;
7561 buffer_grow (filename, entry_length);
7562 memcpy (filename->data, entry_name, entry_length - 1);
7563 filename->data[entry_length-1] = '\0';
7564 zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry));
7565 if (zipf == NULL)
7566 error ("malformed .zip archive in CLASSPATH: %s", entry_name);
7567 else
7568 {
7569 ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory;
7570 BUFFER_RESET (filename);
7571 for (k = 0; k < package_length; k++)
7572 {
7573 char ch = package_name[k];
7574 *filename->ptr++ = ch == '.' ? '/' : ch;
7575 }
7576 *filename->ptr++ = '/';
7577
7578 for (; k < zipf->count; k++, zipd = ZIPDIR_NEXT (zipd))
7579 {
7580 char *current_entry = ZIPDIR_FILENAME (zipd);
7581 int current_entry_len = zipd->filename_length;
7582
7583 if (strncmp (filename->data, current_entry,
7584 BUFFER_LENGTH (filename)) != 0)
7585 continue;
7586 found += note_possible_classname (current_entry,
7587 current_entry_len);
7588 }
7589 }
7590 }
7591 else
7592 {
7593 BUFFER_RESET (filename);
7594 buffer_grow (filename, entry_length + package_length + 4);
7595 strcpy (filename->data, entry_name);
7596 filename->ptr = filename->data + entry_length;
7597 for (k = 0; k < package_length; k++)
7598 {
7599 char ch = package_name[k];
7600 *filename->ptr++ = ch == '.' ? '/' : ch;
7601 }
7602 *filename->ptr = '\0';
7603
7604 dirp = opendir (filename->data);
7605 if (dirp == NULL)
7606 continue;
7607 *filename->ptr++ = '/';
7608 for (;;)
7609 {
7610 int java_or_class = 0;
7611 int len;
7612 char *d_name;
7613 struct dirent *direntp = readdir (dirp);
7614 if (!direntp)
7615 break;
7616 d_name = direntp->d_name;
7617 len = strlen (direntp->d_name);
7618 buffer_grow (filename, len+1);
7619 strcpy (filename->ptr, d_name);
7620 found += note_possible_classname (filename->data + entry_length,
7621 package_length+len+1);
7622 }
7623 if (dirp)
7624 closedir (dirp);
7625 }
7626 }
7627
7628 free (filename->data);
7629
7630 /* Here we should have a unified way of retrieving an entry, to be
7631 indexed. */
7632 if (!found)
7633 {
7634 static int first = 1;
7635 if (first)
7636 {
7637 char buffer [256];
7638 sprintf (buffer, "Can't find default package `%s'. Check "
7639 "the CLASSPATH environment variable and the access to the "
7640 "archives.", package_name);
7641 error (buffer);
7642 java_error_count++;
7643 first = 0;
7644 }
7645 else
7646 parse_error_context (wfl, "Package `%s' not found in import",
7647 package_name);
7648 current_jcf = saved_jcf;
7649 return;
7650 }
7651 current_jcf = saved_jcf;
7652 }
7653
7654 /* Possibly find a type in the import on demands specified
7655 types. Returns 1 if an error occured, 0 otherwise. Run throught the
7656 entire list, to detected potential double definitions. */
7657
7658 static int
7659 find_in_imports_on_demand (class_type)
7660 tree class_type;
7661 {
7662 tree node, import, node_to_use;
7663 int seen_once = -1;
7664 tree cl;
7665
7666 for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import))
7667 {
7668 char *id_name;
7669 obstack_grow (&temporary_obstack,
7670 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
7671 IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
7672 obstack_1grow (&temporary_obstack, '.');
7673 obstack_grow0 (&temporary_obstack,
7674 IDENTIFIER_POINTER (TYPE_NAME (class_type)),
7675 IDENTIFIER_LENGTH (TYPE_NAME (class_type)));
7676 id_name = obstack_finish (&temporary_obstack);
7677
7678 node = maybe_get_identifier (id_name);
7679 if (node && IS_A_CLASSFILE_NAME (node))
7680 {
7681 if (seen_once < 0)
7682 {
7683 cl = TREE_PURPOSE (import);
7684 seen_once = 1;
7685 node_to_use = node;
7686 }
7687 else
7688 {
7689 seen_once++;
7690 parse_error_context
7691 (import, "Type `%s' also potentially defined in package `%s'",
7692 IDENTIFIER_POINTER (TYPE_NAME (class_type)),
7693 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))));
7694 }
7695 }
7696 }
7697
7698 if (seen_once == 1)
7699 {
7700 /* Setup lineno so that it refers to the line of the import (in
7701 case we parse a class file and encounter errors */
7702 tree decl;
7703 int saved_lineno = lineno;
7704 lineno = EXPR_WFL_LINENO (cl);
7705 TYPE_NAME (class_type) = node_to_use;
7706 QUALIFIED_P (TYPE_NAME (class_type)) = 1;
7707 decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7708 /* If there is no DECL set for the class or if the class isn't
7709 loaded and not seen in source yet, the load */
7710 if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl))
7711 && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl))))
7712 load_class (node_to_use, 0);
7713 lineno = saved_lineno;
7714 return check_pkg_class_access (TYPE_NAME (class_type), cl);
7715 }
7716 else
7717 return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
7718 }
7719
7720 static tree
7721 resolve_package (pkg, next)
7722 tree pkg, *next;
7723 {
7724 tree type_name = NULL_TREE;
7725 char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg));
7726
7727 /* The trick is to determine when the package name stops and were
7728 the name of something contained in the package starts. Then we
7729 return a fully qualified name of what we want to get. */
7730
7731 /* Do a quick search on well known package names */
7732 if (!strncmp (name, "java.lang.reflect", 17))
7733 {
7734 *next =
7735 TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg))));
7736 type_name = lookup_package_type (name, 17);
7737 }
7738 else if (!strncmp (name, "java.lang", 9))
7739 {
7740 *next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)));
7741 type_name = lookup_package_type (name, 9);
7742 }
7743 else
7744 return NULL_TREE; /* FIXME, search all imported packages. */
7745
7746 return type_name;
7747 }
7748
7749 static tree
7750 lookup_package_type (name, from)
7751 char *name;
7752 int from;
7753 {
7754 char subname [128];
7755 char *sub = &name[from+1];
7756 while (*sub != '.' && *sub)
7757 sub++;
7758 strncpy (subname, name, sub-name);
7759 subname [sub-name] = '\0';
7760 return get_identifier (subname);
7761 }
7762
7763 /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
7764 access violations were found, 1 otherwise. */
7765
7766 static int
7767 check_pkg_class_access (class_name, cl)
7768 tree class_name;
7769 tree cl;
7770 {
7771 tree type;
7772
7773 if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name))
7774 return 0;
7775
7776 if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name))))
7777 return 0;
7778
7779 if (!CLASS_PUBLIC (TYPE_NAME (type)))
7780 {
7781 parse_error_context
7782 (cl, "Can't access %s `%s'. Only public classes and interfaces in "
7783 "other packages can be accessed",
7784 (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
7785 IDENTIFIER_POINTER (class_name));
7786 return 1;
7787 }
7788 return 0;
7789 }
7790
7791 /* Local variable declaration. */
7792
7793 static void
7794 declare_local_variables (modifier, type, vlist)
7795 int modifier;
7796 tree type;
7797 tree vlist;
7798 {
7799 tree decl, current, saved_type;
7800 tree type_wfl = NULL_TREE;
7801 int must_chain = 0;
7802
7803 /* Push a new block if statement were seen between the last time we
7804 pushed a block and now. Keep a cound of block to close */
7805 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)))
7806 {
7807 tree body = DECL_FUNCTION_BODY (current_function_decl);
7808 tree b = enter_block ();
7809 BLOCK_EXPR_ORIGIN(b) = body;
7810 }
7811
7812 if (modifier)
7813 {
7814 int i;
7815 for (i = 0; i <= 10; i++) if (1 << i & modifier) break;
7816 if (modifier == ACC_FINAL)
7817 {
7818 if (flag_static_local_jdk1_1)
7819 parse_warning_context (ctxp->modifier_ctx [i],
7820 "Unsupported JDK1.1 `final' local variable "
7821 "(treated as non final)");
7822 }
7823 else
7824 {
7825 parse_error_context
7826 (ctxp->modifier_ctx [i],
7827 "Only `final' is allowed as a local variables modifier");
7828 return;
7829 }
7830 }
7831
7832 /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
7833 hold the TYPE value if a new incomplete has to be created (as
7834 opposed to being found already existing and reused). */
7835 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
7836
7837 /* If TYPE is fully resolved and we don't have a reference, make one */
7838 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
7839
7840 /* Go through all the declared variables */
7841 for (current = vlist, saved_type = type; current;
7842 current = TREE_CHAIN (current), type = saved_type)
7843 {
7844 tree other, real_type;
7845 tree wfl = TREE_PURPOSE (current);
7846 tree name = EXPR_WFL_NODE (wfl);
7847 tree init = TREE_VALUE (current);
7848
7849 /* Process NAME, as it may specify extra dimension(s) for it */
7850 type = build_array_from_name (type, type_wfl, name, &name);
7851
7852 /* Variable redefinition check */
7853 if ((other = lookup_name_in_blocks (name)))
7854 {
7855 variable_redefinition_error (wfl, name, TREE_TYPE (other),
7856 DECL_SOURCE_LINE (other));
7857 continue;
7858 }
7859
7860 /* Type adjustment. We may have just readjusted TYPE because
7861 the variable specified more dimensions. Make sure we have
7862 a reference if we can and don't have one already. */
7863 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
7864
7865 real_type = GET_REAL_TYPE (type);
7866 /* Never layout this decl. This will be done when its scope
7867 will be entered */
7868 decl = build_decl (VAR_DECL, name, real_type);
7869 BLOCK_CHAIN_DECL (decl);
7870
7871 /* Don't try to use an INIT statement when an error was found */
7872 if (init && java_error_count)
7873 init = NULL_TREE;
7874
7875 /* Add the initialization function to the current function's code */
7876 if (init)
7877 {
7878 /* Name might have been readjusted */
7879 EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name;
7880 MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
7881 java_method_add_stmt (current_function_decl,
7882 build_debugable_stmt (EXPR_WFL_LINECOL (init),
7883 init));
7884 }
7885
7886 /* Setup dependency the type of the decl */
7887 if (must_chain)
7888 {
7889 jdep *dep;
7890 register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type);
7891 dep = CLASSD_LAST (ctxp->classd_list);
7892 JDEP_GET_PATCH (dep) = &TREE_TYPE (decl);
7893 }
7894 }
7895 SOURCE_FRONTEND_DEBUG (("Defined locals"));
7896 }
7897
7898 /* Called during parsing. Build decls from argument list. */
7899
7900 static void
7901 source_start_java_method (fndecl)
7902 tree fndecl;
7903 {
7904 tree tem;
7905 tree parm_decl;
7906 int i;
7907
7908 current_function_decl = fndecl;
7909
7910 /* New scope for the function */
7911 enter_block ();
7912 for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
7913 tem != end_params_node; tem = TREE_CHAIN (tem), i++)
7914 {
7915 tree type = TREE_VALUE (tem);
7916 tree name = TREE_PURPOSE (tem);
7917
7918 /* If type is incomplete. Create an incomplete decl and ask for
7919 the decl to be patched later */
7920 if (INCOMPLETE_TYPE_P (type))
7921 {
7922 jdep *jdep;
7923 tree real_type = GET_REAL_TYPE (type);
7924 parm_decl = build_decl (PARM_DECL, name, real_type);
7925 type = obtain_incomplete_type (type);
7926 register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type);
7927 jdep = CLASSD_LAST (ctxp->classd_list);
7928 JDEP_MISC (jdep) = name;
7929 JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl);
7930 }
7931 else
7932 parm_decl = build_decl (PARM_DECL, name, type);
7933
7934 BLOCK_CHAIN_DECL (parm_decl);
7935 }
7936 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
7937 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) =
7938 nreverse (tem);
7939 DECL_ARG_SLOT_COUNT (current_function_decl) = i;
7940 }
7941
7942 /* Called during parsing. Creates an artificial method declaration. */
7943
7944 static tree
7945 create_artificial_method (class, flags, type, name, args)
7946 tree class;
7947 int flags;
7948 tree type, name, args;
7949 {
7950 int saved_lineno = lineno;
7951 tree mdecl;
7952
7953 lineno = 0;
7954 mdecl = make_node (FUNCTION_TYPE);
7955 TREE_TYPE (mdecl) = type;
7956 TYPE_ARG_TYPES (mdecl) = args;
7957 mdecl = add_method (class, flags, name, build_java_signature (mdecl));
7958 lineno = saved_lineno;
7959 DECL_ARTIFICIAL (mdecl) = 1;
7960 return mdecl;
7961 }
7962
7963 /* Starts the body if an artifical method. */
7964
7965 static void
7966 start_artificial_method_body (mdecl)
7967 tree mdecl;
7968 {
7969 DECL_SOURCE_LINE (mdecl) = 1;
7970 DECL_SOURCE_LINE_MERGE (mdecl, 1);
7971 source_start_java_method (mdecl);
7972 enter_block ();
7973 }
7974
7975 static void
7976 end_artificial_method_body (mdecl)
7977 tree mdecl;
7978 {
7979 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block ();
7980 exit_block ();
7981 }
7982
7983 /* Called during expansion. Push decls formerly built from argument
7984 list so they're usable during expansion. */
7985
7986 static void
7987 expand_start_java_method (fndecl)
7988 tree fndecl;
7989 {
7990 tree tem, *ptr;
7991
7992 current_function_decl = fndecl;
7993
7994 announce_function (fndecl);
7995 pushlevel (1); /* Push parameters */
7996 ptr = &DECL_ARGUMENTS (fndecl);
7997 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
7998 while (tem)
7999 {
8000 tree next = TREE_CHAIN (tem);
8001 tree type = TREE_TYPE (tem);
8002 #ifdef PROMOTE_PROTOTYPES
8003 if (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
8004 && INTEGRAL_TYPE_P (type))
8005 type = integer_type_node;
8006 #endif
8007 DECL_ARG_TYPE (tem) = type;
8008 layout_decl (tem, 0);
8009 pushdecl (tem);
8010 INITIALIZED_P (tem) = 1; /* Parms are initialized */
8011 *ptr = tem;
8012 ptr = &TREE_CHAIN (tem);
8013 tem = next;
8014 }
8015 *ptr = NULL_TREE;
8016 pushdecl_force_head (DECL_ARGUMENTS (fndecl));
8017 lineno = DECL_SOURCE_LINE_FIRST (fndecl);
8018 complete_start_java_method (fndecl);
8019 }
8020
8021 /* Terminate a function and expand its body. */
8022
8023 static void
8024 source_end_java_method ()
8025 {
8026 tree fndecl = current_function_decl;
8027
8028 java_parser_context_save_global ();
8029 lineno = ctxp->last_ccb_indent1;
8030
8031 /* Set EH language codes */
8032 java_set_exception_lang_code ();
8033
8034 /* Generate function's code */
8035 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
8036 && ! flag_emit_class_files)
8037 expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)));
8038
8039 /* pop out of its parameters */
8040 pushdecl_force_head (DECL_ARGUMENTS (fndecl));
8041 poplevel (1, 0, 1);
8042 BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
8043
8044 /* Generate rtl for function exit. */
8045 if (! flag_emit_class_files)
8046 {
8047 lineno = DECL_SOURCE_LINE_LAST (fndecl);
8048 /* Emit catch-finally clauses */
8049 emit_handlers ();
8050 expand_function_end (input_filename, lineno, 0);
8051
8052 /* Run the optimizers and output assembler code for this function. */
8053 rest_of_compilation (fndecl);
8054 }
8055
8056 current_function_decl = NULL_TREE;
8057 /* permanent_allocation (1); */
8058 java_parser_context_restore_global ();
8059 }
8060
8061 /* Record EXPR in the current function block. Complements compound
8062 expression second operand if necessary. */
8063
8064 tree
8065 java_method_add_stmt (fndecl, expr)
8066 tree fndecl, expr;
8067 {
8068 return add_stmt_to_block (DECL_FUNCTION_BODY (fndecl), NULL_TREE, expr);
8069 }
8070
8071 static tree
8072 add_stmt_to_block (b, type, stmt)
8073 tree b, type, stmt;
8074 {
8075 tree body = BLOCK_EXPR_BODY (b), c;
8076
8077 if (java_error_count)
8078 return body;
8079
8080 if ((c = add_stmt_to_compound (body, type, stmt)) == body)
8081 return body;
8082
8083 BLOCK_EXPR_BODY (b) = c;
8084 TREE_SIDE_EFFECTS (c) = 1;
8085 return c;
8086 }
8087
8088 /* Add STMT to EXISTING if possible, otherwise create a new
8089 COMPOUND_EXPR and add STMT to it. */
8090
8091 static tree
8092 add_stmt_to_compound (existing, type, stmt)
8093 tree existing, type, stmt;
8094 {
8095 if (existing)
8096 return build (COMPOUND_EXPR, type, existing, stmt);
8097 else
8098 return stmt;
8099 }
8100
8101 /* Hold THIS for the scope of the current public method decl. */
8102 static tree current_this;
8103
8104 void java_layout_seen_class_methods ()
8105 {
8106 tree previous_list = all_class_list;
8107 tree end = NULL_TREE;
8108 tree current;
8109
8110 while (1)
8111 {
8112 for (current = previous_list;
8113 current != end; current = TREE_CHAIN (current))
8114 layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
8115
8116 if (previous_list != all_class_list)
8117 {
8118 end = previous_list;
8119 previous_list = all_class_list;
8120 }
8121 else
8122 break;
8123 }
8124 }
8125
8126 /* Layout the methods of all classes loaded in one way on an
8127 other. Check methods of source parsed classes. Then reorder the
8128 fields and layout the classes or the type of all source parsed
8129 classes */
8130
8131 void
8132 java_layout_classes ()
8133 {
8134 tree current;
8135
8136 /* Layout the methods of all classes seen so far */
8137 java_layout_seen_class_methods ();
8138 java_parse_abort_on_error ();
8139 all_class_list = NULL_TREE;
8140
8141 /* Then check the methods of all parsed classes */
8142 for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
8143 if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current))))
8144 CHECK_METHODS (TREE_VALUE (current));
8145 java_parse_abort_on_error ();
8146
8147 for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
8148 {
8149 current_class = TREE_TYPE (TREE_VALUE (current));
8150
8151 /* Reverse the fields, but leave the dummy field in front.
8152 Fields are already ordered for Object and Class */
8153 if (TYPE_FIELDS (current_class) && current_class != object_type_node
8154 && current_class != class_type_node)
8155 {
8156 /* If the dummy field is there, reverse the right fields and
8157 just layout the type for proper fields offset */
8158 if (!DECL_NAME (TYPE_FIELDS (current_class)))
8159 {
8160 tree fields = TYPE_FIELDS (current_class);
8161 TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields));
8162 TYPE_SIZE (current_class) = NULL_TREE;
8163 layout_type (current_class);
8164 }
8165 /* We don't have a dummy field, we need to layout the class,
8166 after having reversed the fields */
8167 else
8168 {
8169 TYPE_FIELDS (current_class) =
8170 nreverse (TYPE_FIELDS (current_class));
8171 TYPE_SIZE (current_class) = NULL_TREE;
8172 layout_class (current_class);
8173 }
8174 }
8175 else
8176 layout_class (current_class);
8177
8178 /* From now on, the class is considered completely loaded */
8179 CLASS_LOADED_P (current_class) = 1;
8180
8181 /* Error reported by the caller */
8182 if (java_error_count)
8183 return;
8184 }
8185
8186 /* We might have reloaded classes durign the process of laying out
8187 classes for code generation. We must layout the methods of those
8188 late additions, as constructor checks might use them */
8189 java_layout_seen_class_methods ();
8190 java_parse_abort_on_error ();
8191 }
8192
8193 /* Expand all methods in all registered classes. */
8194
8195 void
8196 java_complete_expand_methods ()
8197 {
8198 tree current;
8199
8200 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
8201 {
8202 tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current));
8203 tree decl;
8204
8205 current_class = TREE_TYPE (current);
8206
8207 /* Initialize a new constant pool */
8208 init_outgoing_cpool ();
8209
8210 /* We want <clinit> (if any) to be processed first. */
8211 decl = tree_last (TYPE_METHODS (class_type));
8212 if (decl && DECL_NAME (decl) == clinit_identifier_node)
8213 {
8214 tree list = nreverse (TYPE_METHODS (class_type));
8215 list = TREE_CHAIN (list);
8216 TREE_CHAIN (decl) = NULL_TREE;
8217 TYPE_METHODS (class_type) = chainon (decl, nreverse (list));
8218 }
8219
8220 /* Don't process function bodies in interfaces */
8221 if (!CLASS_INTERFACE (TYPE_NAME (current_class)))
8222 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
8223 {
8224 current_function_decl = decl;
8225 /* Don't generate debug info on line zero when expanding a
8226 generated constructor. */
8227 if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl))
8228 {
8229 /* If we found errors, it's too dangerous to try to generate
8230 and expand a constructor */
8231 if (!java_error_count)
8232 {
8233 restore_line_number_status (1);
8234 java_complete_expand_method (decl);
8235 restore_line_number_status (0);
8236 }
8237 }
8238 else if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl))
8239 continue;
8240 else
8241 java_complete_expand_method (decl);
8242 }
8243
8244 /* Now verify constructor circularity (stop after the first one
8245 we find) */
8246 if (!CLASS_INTERFACE (TYPE_NAME (current_class)))
8247 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
8248 if (DECL_CONSTRUCTOR_P (decl) &&
8249 verify_constructor_circularity (decl, decl))
8250 break;
8251
8252 /* Make the class data, register it and run the rest of decl
8253 compilation on it */
8254 if (!java_error_count)
8255 {
8256 if (flag_emit_class_files)
8257 write_classfile (current_class);
8258 else
8259 finish_class (current_class);
8260 }
8261 }
8262 }
8263
8264 /* Hold a list of catch clauses list. The first element of this list is
8265 the list of the catch clauses of the currently analysed try block. */
8266 static tree currently_caught_type_list;
8267
8268 /* Complete and expand a method. */
8269
8270 static void
8271 java_complete_expand_method (mdecl)
8272 tree mdecl;
8273 {
8274 /* Fix constructors before expanding them */
8275 if (DECL_CONSTRUCTOR_P (mdecl))
8276 fix_constructors (mdecl);
8277
8278 /* Expand functions that have a body */
8279 if (DECL_FUNCTION_BODY (mdecl))
8280 {
8281 tree fbody = DECL_FUNCTION_BODY (mdecl);
8282 tree block_body = BLOCK_EXPR_BODY (fbody);
8283 expand_start_java_method (mdecl);
8284
8285 current_this
8286 = (!METHOD_STATIC (mdecl) ?
8287 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
8288
8289 /* Purge the `throws' list of unchecked exceptions */
8290 purge_unchecked_exceptions (mdecl);
8291
8292 /* Install exceptions thrown with `throws' */
8293 PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
8294
8295 if (block_body != NULL_TREE)
8296 block_body = java_complete_tree (block_body);
8297 BLOCK_EXPR_BODY (fbody) = block_body;
8298
8299 if ((block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body))
8300 && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE)
8301 missing_return_error (current_function_decl);
8302
8303 /* Don't go any further if we've found error(s) during the
8304 expansion */
8305 if (!java_error_count)
8306 source_end_java_method ();
8307 else
8308 {
8309 pushdecl_force_head (DECL_ARGUMENTS (mdecl));
8310 poplevel (1, 0, 1);
8311 }
8312
8313 /* Pop the exceptions and sanity check */
8314 POP_EXCEPTIONS();
8315 if (currently_caught_type_list)
8316 fatal ("Exception list non empty - java_complete_expand_method");
8317 }
8318 }
8319
8320 /* Craft a body for default constructor. Patch existing constructor
8321 bodies with call to super() and field initialization statements if
8322 necessary. */
8323
8324 static void
8325 fix_constructors (mdecl)
8326 tree mdecl;
8327 {
8328 tree body = DECL_FUNCTION_BODY (mdecl);
8329
8330 if (!body)
8331 {
8332 /* The constructor body must be crafted by hand. It's the
8333 constructor we defined when we realize we didn't have the
8334 CLASSNAME() constructor */
8335
8336 tree compound;
8337
8338 /* It is an error for the compiler to generate a default
8339 constructor if the superclass doesn't have a constructor that
8340 takes no argument */
8341 if (verify_constructor_super ())
8342 {
8343 tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class));
8344 char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
8345 parse_error_context (lookup_cl (TYPE_NAME (current_class)),
8346 "No constructor matching `%s()' found in "
8347 "class `%s'", n, n);
8348 }
8349
8350 start_artificial_method_body (mdecl);
8351
8352 /* We don't generate a super constructor invocation if we're
8353 compiling java.lang.Object. build_super_invocation takes care
8354 of that. */
8355 compound = java_method_add_stmt (mdecl, build_super_invocation ());
8356
8357 end_artificial_method_body (mdecl);
8358 }
8359 /* Search for an explicit constructor invocation */
8360 else
8361 {
8362 int found = 0;
8363 tree main_block = BLOCK_EXPR_BODY (body);
8364 tree compound = NULL_TREE;
8365
8366 while (body)
8367 switch (TREE_CODE (body))
8368 {
8369 case CALL_EXPR:
8370 found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
8371 body = NULL_TREE;
8372 break;
8373 case COMPOUND_EXPR:
8374 case EXPR_WITH_FILE_LOCATION:
8375 body = TREE_OPERAND (body, 0);
8376 break;
8377 case BLOCK:
8378 body = BLOCK_EXPR_BODY (body);
8379 break;
8380 default:
8381 found = 0;
8382 body = NULL_TREE;
8383 }
8384 /* The constructor is missing an invocation of super() */
8385 if (!found)
8386 compound = add_stmt_to_compound (compound, NULL_TREE,
8387 build_super_invocation ());
8388
8389 /* Fix the constructor main block if we're adding extra stmts */
8390 if (compound)
8391 {
8392 compound = add_stmt_to_compound (compound, NULL_TREE,
8393 BLOCK_EXPR_BODY (main_block));
8394 BLOCK_EXPR_BODY (main_block) = compound;
8395 }
8396 }
8397 }
8398
8399 /* Browse constructors in the super class, searching for a constructor
8400 that doesn't take any argument. Return 0 if one is found, 1
8401 otherwise. */
8402
8403 static int
8404 verify_constructor_super ()
8405 {
8406 tree class = CLASSTYPE_SUPER (current_class);
8407 if (!class)
8408 return 0;
8409
8410 if (class)
8411 {
8412 tree mdecl;
8413 for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
8414 {
8415 if (DECL_CONSTRUCTOR_P (mdecl)
8416 && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node)
8417 return 0;
8418 }
8419 }
8420 return 1;
8421 }
8422
8423 /* Expand finals. */
8424
8425 void
8426 java_expand_finals ()
8427 {
8428 }
8429
8430 /* Generate code for all context remembered for code generation. */
8431
8432 void
8433 java_expand_classes ()
8434 {
8435 java_parse_abort_on_error ();
8436 if (!(ctxp = ctxp_for_generation))
8437 return;
8438 java_layout_classes ();
8439 java_parse_abort_on_error ();
8440
8441 for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
8442 {
8443 ctxp = ctxp_for_generation;
8444 lang_init_source (2); /* Error msgs have method prototypes */
8445 java_complete_expand_methods (); /* Complete and expand method bodies */
8446 java_parse_abort_on_error ();
8447 java_expand_finals (); /* Expand and check the finals */
8448 java_parse_abort_on_error ();
8449 java_check_final (); /* Check unitialized final */
8450 java_parse_abort_on_error ();
8451 }
8452 }
8453
8454 /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
8455 a tree list node containing RIGHT. Fore coming RIGHTs will be
8456 chained to this hook. LOCATION contains the location of the
8457 separating `.' operator. */
8458
8459 static tree
8460 make_qualified_primary (primary, right, location)
8461 tree primary, right;
8462 int location;
8463 {
8464 tree wfl;
8465
8466 /* We want to process THIS . xxx symbolicaly, to keep it consistent
8467 with the way we're processing SUPER. A THIS from a primary as a
8468 different form than a SUPER. Turn THIS into something symbolic */
8469 if (TREE_CODE (primary) == THIS_EXPR)
8470 {
8471 wfl = build_wfl_node (this_identifier_node, input_filename, 0, 0);
8472 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
8473 wfl = make_qualified_name (wfl, right, location);
8474 PRIMARY_P (wfl) = 1;
8475 return wfl;
8476 }
8477 /* Other non WFL node are wrapped around a WFL */
8478 else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
8479 {
8480 wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
8481 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
8482 EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE);
8483 }
8484 else
8485 {
8486 wfl = primary;
8487 if (!EXPR_WFL_QUALIFICATION (primary))
8488 EXPR_WFL_QUALIFICATION (primary) =
8489 build_tree_list (primary, NULL_TREE);
8490 }
8491
8492 EXPR_WFL_LINECOL (right) = location;
8493 chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE));
8494 PRIMARY_P (wfl) = 1;
8495 return wfl;
8496 }
8497
8498 /* Simple merge of two name separated by a `.' */
8499
8500 static tree
8501 merge_qualified_name (left, right)
8502 tree left, right;
8503 {
8504 tree node;
8505 obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left),
8506 IDENTIFIER_LENGTH (left));
8507 obstack_1grow (&temporary_obstack, '.');
8508 obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right),
8509 IDENTIFIER_LENGTH (right));
8510 node = get_identifier (obstack_base (&temporary_obstack));
8511 obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
8512 QUALIFIED_P (node) = 1;
8513 return node;
8514 }
8515
8516 /* Merge the two parts of a qualified name into LEFT. Set the
8517 location information of the resulting node to LOCATION, usually
8518 inherited from the location information of the `.' operator. */
8519
8520 static tree
8521 make_qualified_name (left, right, location)
8522 tree left, right;
8523 int location;
8524 {
8525 tree left_id = EXPR_WFL_NODE (left);
8526 tree right_id = EXPR_WFL_NODE (right);
8527 tree wfl, merge;
8528
8529 merge = merge_qualified_name (left_id, right_id);
8530
8531 /* Left wasn't qualified and is now qualified */
8532 if (!QUALIFIED_P (left_id))
8533 {
8534 tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0);
8535 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left);
8536 EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
8537 }
8538
8539 wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0);
8540 EXPR_WFL_LINECOL (wfl) = location;
8541 chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE));
8542
8543 EXPR_WFL_NODE (left) = merge;
8544 return left;
8545 }
8546
8547 /* Extract the last identifier component of the qualified in WFL. The
8548 last identifier is removed from the linked list */
8549
8550 static tree
8551 cut_identifier_in_qualified (wfl)
8552 tree wfl;
8553 {
8554 tree q;
8555 tree previous = NULL_TREE;
8556 for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q))
8557 if (!TREE_CHAIN (q))
8558 {
8559 if (!previous)
8560 fatal ("Operating on a non qualified qualified WFL - "
8561 "cut_identifier_in_qualified");
8562 TREE_CHAIN (previous) = NULL_TREE;
8563 return TREE_PURPOSE (q);
8564 }
8565 }
8566
8567 /* Resolve the expression name NAME. Return its decl. */
8568
8569 static tree
8570 resolve_expression_name (id, orig)
8571 tree id;
8572 tree *orig;
8573 {
8574 tree name = EXPR_WFL_NODE (id);
8575 tree decl;
8576
8577 /* 6.5.5.1: Simple expression names */
8578 if (!PRIMARY_P (id) && !QUALIFIED_P (name))
8579 {
8580 /* 15.13.1: NAME can appear within the scope of a local variable
8581 declaration */
8582 if ((decl = IDENTIFIER_LOCAL_VALUE (name)))
8583 return decl;
8584
8585 /* 15.13.1: NAME can appear within a class declaration */
8586 else
8587 {
8588 decl = lookup_field_wrapper (current_class, name);
8589 if (decl)
8590 {
8591 int fs = FIELD_STATIC (decl);
8592 /* Instance variable (8.3.1.1) can't appear within
8593 static method, static initializer or initializer for
8594 a static variable. */
8595 if (!fs && METHOD_STATIC (current_function_decl))
8596 {
8597 parse_error_context
8598 (id, "Can't make a static reference to nonstatic variable "
8599 "`%s' in class `%s'",
8600 IDENTIFIER_POINTER (name),
8601 IDENTIFIER_POINTER (DECL_NAME
8602 (TYPE_NAME (current_class))));
8603 return error_mark_node;
8604 }
8605 /* Instance variables can't appear as an argument of
8606 an explicit constructor invocation */
8607 if (!fs && ctxp->explicit_constructor_p)
8608 {
8609 parse_error_context
8610 (id, "Can't reference `%s' before the superclass "
8611 "constructor has been called", IDENTIFIER_POINTER (name));
8612 return error_mark_node;
8613 }
8614
8615 /* Otherwise build what it takes to access the field */
8616 decl = build_field_ref ((fs ? NULL_TREE : current_this),
8617 current_class, name);
8618 if (fs && !flag_emit_class_files)
8619 decl = build_class_init (current_class, decl);
8620 /* We may be asked to save the real field access node */
8621 if (orig)
8622 *orig = decl;
8623 /* And we return what we got */
8624 return decl;
8625 }
8626 /* Fall down to error report on undefined variable */
8627 }
8628 }
8629 /* 6.5.5.2 Qualified Expression Names */
8630 else
8631 {
8632 if (orig)
8633 *orig = NULL_TREE;
8634 qualify_ambiguous_name (id);
8635 /* 15.10.1 Field Access Using a Primary and/or Expression Name */
8636 /* 15.10.2: Accessing Superclass Members using super */
8637 return resolve_field_access (id, NULL, NULL);
8638 }
8639
8640 /* We've got an error here */
8641 parse_error_context (id, "Undefined variable `%s'",
8642 IDENTIFIER_POINTER (name));
8643
8644 return error_mark_node;
8645 }
8646
8647 /* 15.10.1 Field Acess Using a Primary and/or Expression Name.
8648 We return something suitable to generate the field access. We also
8649 return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
8650 recipient's address can be null. */
8651
8652 static tree
8653 resolve_field_access (qual_wfl, field_decl, field_type)
8654 tree qual_wfl;
8655 tree *field_decl, *field_type;
8656 {
8657 int is_static = 0;
8658 tree field_ref;
8659 tree decl, where_found, type_found;
8660
8661 if (resolve_qualified_expression_name (qual_wfl, &decl,
8662 &where_found, &type_found))
8663 return error_mark_node;
8664
8665 /* Resolve the LENGTH field of an array here */
8666 if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found)
8667 && ! flag_emit_class_files)
8668 {
8669 tree length = build_java_array_length_access (where_found);
8670 field_ref =
8671 build_java_arraynull_check (type_found, length, int_type_node);
8672 }
8673 /* We might have been trying to resolve field.method(). In which
8674 case, the resolution is over and decl is the answer */
8675 else if (DECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
8676 field_ref = decl;
8677 else if (DECL_P (decl))
8678 {
8679 int static_final_found = 0;
8680 if (!type_found)
8681 type_found = DECL_CONTEXT (decl);
8682 is_static = DECL_P (decl) && FIELD_STATIC (decl);
8683 if (FIELD_FINAL (decl)
8684 && JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
8685 && DECL_LANG_SPECIFIC (decl)
8686 && DECL_INITIAL (decl))
8687 {
8688 field_ref = DECL_INITIAL (decl);
8689 static_final_found = 1;
8690 }
8691 else
8692 field_ref = build_field_ref ((is_static ? NULL_TREE : where_found),
8693 type_found, DECL_NAME (decl));
8694 if (field_ref == error_mark_node)
8695 return error_mark_node;
8696 if (is_static && !static_final_found && !flag_emit_class_files)
8697 {
8698 field_ref = build_class_init (type_found, field_ref);
8699 /* If the static field was identified by an expression that
8700 needs to be generated, make the field access a compound
8701 expression whose first part of the evaluation of the
8702 field selector part. */
8703 if (where_found && TREE_CODE (where_found) != TYPE_DECL
8704 && TREE_CODE (where_found) != RECORD_TYPE)
8705 {
8706 tree type = QUAL_DECL_TYPE (field_ref);
8707 field_ref = build (COMPOUND_EXPR, type, where_found, field_ref);
8708 }
8709 }
8710 }
8711 else
8712 field_ref = decl;
8713
8714 if (field_decl)
8715 *field_decl = decl;
8716 if (field_type)
8717 *field_type = (QUAL_DECL_TYPE (decl) ?
8718 QUAL_DECL_TYPE (decl) : TREE_TYPE (decl));
8719 return field_ref;
8720 }
8721
8722 /* 6.5.5.2: Qualified Expression Names */
8723
8724 static int
8725 resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
8726 tree wfl;
8727 tree *found_decl, *type_found, *where_found;
8728 {
8729 int from_type = 0; /* Field search initiated from a type */
8730 int from_super = 0, from_cast = 0;
8731 int previous_call_static = 0;
8732 int is_static;
8733 tree decl = NULL_TREE, type = NULL_TREE, q;
8734 *type_found = *where_found = NULL_TREE;
8735
8736 for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
8737 {
8738 tree qual_wfl = QUAL_WFL (q);
8739
8740 /* 15.10.1 Field Access Using a Primary */
8741 switch (TREE_CODE (qual_wfl))
8742 {
8743 case CALL_EXPR:
8744 case NEW_CLASS_EXPR:
8745 /* If the access to the function call is a non static field,
8746 build the code to access it. */
8747 if (DECL_P (decl) && !FIELD_STATIC (decl))
8748 {
8749 decl = maybe_access_field (decl, *where_found,
8750 DECL_CONTEXT (decl));
8751 if (decl == error_mark_node)
8752 return 1;
8753 }
8754 /* And code for the function call */
8755 if (complete_function_arguments (qual_wfl))
8756 return 1;
8757 if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
8758 CALL_USING_SUPER (qual_wfl) = 1;
8759 *where_found =
8760 patch_method_invocation (qual_wfl, decl, type, &is_static, NULL);
8761 if (*where_found == error_mark_node)
8762 return 1;
8763 *type_found = type = QUAL_DECL_TYPE (*where_found);
8764
8765 /* If the previous call was static and this one is too,
8766 build a compound expression to hold the two (because in
8767 that case, previous function calls aren't transported as
8768 forcoming function's argument. */
8769 if (previous_call_static && is_static)
8770 {
8771 decl = build (COMPOUND_EXPR, type, decl, *where_found);
8772 TREE_SIDE_EFFECTS (decl) = 1;
8773 }
8774 else
8775 {
8776 previous_call_static = is_static;
8777 decl = *where_found;
8778 }
8779 continue;
8780
8781 case CONVERT_EXPR:
8782 *where_found = decl = java_complete_tree (qual_wfl);
8783 if (decl == error_mark_node)
8784 return 1;
8785 *type_found = type = QUAL_DECL_TYPE (decl);
8786 from_cast = 1;
8787 continue;
8788
8789 case CONDITIONAL_EXPR:
8790 case STRING_CST:
8791 *where_found = decl = java_complete_tree (qual_wfl);
8792 if (decl == error_mark_node)
8793 return 1;
8794 *type_found = type = QUAL_DECL_TYPE (decl);
8795 continue;
8796
8797 case ARRAY_REF:
8798 /* If the access to the function call is a non static field,
8799 build the code to access it. */
8800 if (DECL_P (decl) && !FIELD_STATIC (decl))
8801 {
8802 decl = maybe_access_field (decl, *where_found, type);
8803 if (decl == error_mark_node)
8804 return 1;
8805 }
8806 /* And code for the array reference expression */
8807 decl = java_complete_tree (qual_wfl);
8808 if (decl == error_mark_node)
8809 return 1;
8810 type = QUAL_DECL_TYPE (decl);
8811 continue;
8812
8813 default:
8814 /* Fix for -Wall Just go to the next statement. Don't
8815 continue */
8816 }
8817
8818 /* If we fall here, we weren't processing a (static) function call. */
8819 previous_call_static = 0;
8820
8821 /* It can be the keyword THIS */
8822 if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
8823 {
8824 if (!current_this)
8825 {
8826 parse_error_context
8827 (wfl, "Keyword `this' used outside allowed context");
8828 return 1;
8829 }
8830 /* We have to generate code for intermediate acess */
8831 *where_found = decl = current_this;
8832 *type_found = type = QUAL_DECL_TYPE (decl);
8833 continue;
8834 }
8835
8836 /* 15.10.2 Accessing Superclass Members using SUPER */
8837 if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
8838 {
8839 tree node;
8840 /* Check on the restricted use of SUPER */
8841 if (METHOD_STATIC (current_function_decl)
8842 || current_class == object_type_node)
8843 {
8844 parse_error_context
8845 (wfl, "Keyword `super' used outside allowed context");
8846 return 1;
8847 }
8848 /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
8849 node = build_cast (EXPR_WFL_LINECOL (qual_wfl),
8850 CLASSTYPE_SUPER (current_class),
8851 build_this (EXPR_WFL_LINECOL (qual_wfl)));
8852 *where_found = decl = java_complete_tree (node);
8853 if (decl == error_mark_node)
8854 return 1;
8855 *type_found = type = QUAL_DECL_TYPE (decl);
8856 from_super = from_type = 1;
8857 continue;
8858 }
8859
8860 /* 15.13.1: Can't search for field name in packages, so we
8861 assume a variable/class name was meant. */
8862 if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
8863 {
8864 tree name = resolve_package (wfl, &q);
8865 if (name)
8866 {
8867 *where_found = decl = resolve_no_layout (name, qual_wfl);
8868 /* We wan't to be absolutely that the class is laid
8869 out. We're going to search something inside it. */
8870 *type_found = type = TREE_TYPE (decl);
8871 layout_class (type);
8872 from_type = 1;
8873 /* Should be a list, really. FIXME */
8874 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 1;
8875 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 0;
8876 }
8877 else
8878 {
8879 if (from_super || from_cast)
8880 parse_error_context
8881 ((from_cast ? qual_wfl : wfl),
8882 "No variable `%s' defined in class `%s'",
8883 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
8884 lang_printable_name (type, 0));
8885 else
8886 parse_error_context
8887 (qual_wfl, "Undefined variable or class name: `%s'",
8888 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)));
8889 return 1;
8890 }
8891 }
8892
8893 /* We have a type name. It's been already resolved when the
8894 expression was qualified. */
8895 else if (RESOLVE_TYPE_NAME_P (qual_wfl))
8896 {
8897 if (!(decl = QUAL_RESOLUTION (q)))
8898 return 1; /* Error reported already */
8899
8900 if (not_accessible_p (TREE_TYPE (decl), decl, 0))
8901 {
8902 parse_error_context
8903 (qual_wfl, "Can't access %s field `%s.%s' from `%s'",
8904 java_accstring_lookup (get_access_flags_from_decl (decl)),
8905 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))),
8906 IDENTIFIER_POINTER (DECL_NAME (decl)),
8907 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
8908 return 1;
8909 }
8910 check_deprecation (qual_wfl, decl);
8911
8912 type = TREE_TYPE (decl);
8913 from_type = 1;
8914 }
8915 /* We resolve and expression name */
8916 else
8917 {
8918 tree field_decl;
8919
8920 /* If there exists an early resolution, use it. That occurs
8921 only once and we know that there are more things to
8922 come. Don't do that when processing something after SUPER
8923 (we need more thing to be put in place below */
8924 if (!from_super && QUAL_RESOLUTION (q))
8925 {
8926 decl = QUAL_RESOLUTION (q);
8927 if (!type)
8928 {
8929 if (!FIELD_STATIC (decl))
8930 *where_found = current_this;
8931 else
8932 {
8933 *where_found = TREE_TYPE (decl);
8934 if (TREE_CODE (*where_found) == POINTER_TYPE)
8935 *where_found = TREE_TYPE (*where_found);
8936 }
8937 }
8938 }
8939
8940 /* We have to search for a field, knowing the type of its
8941 container. The flag FROM_TYPE indicates that we resolved
8942 the last member of the expression as a type name, which
8943 means that for the resolution of this field, we'll look
8944 for other errors than if it was resolved as a member of
8945 an other field. */
8946 else
8947 {
8948 int is_static;
8949 tree field_decl_type; /* For layout */
8950
8951 if (!from_type && !JREFERENCE_TYPE_P (type))
8952 {
8953 parse_error_context
8954 (qual_wfl, "Attempt to reference field `%s' in `%s %s'",
8955 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
8956 lang_printable_name (type, 0),
8957 IDENTIFIER_POINTER (DECL_NAME (field_decl)));
8958 return 1;
8959 }
8960
8961 if (!(field_decl =
8962 lookup_field_wrapper (type, EXPR_WFL_NODE (qual_wfl))))
8963 {
8964 parse_error_context
8965 (qual_wfl, "No variable `%s' defined in class `%s'",
8966 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
8967 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
8968 return 1;
8969 }
8970
8971 /* Layout the type of field_decl, since we may need
8972 it. Don't do primitive types or loaded classes. The
8973 situation of non primitive arrays may not handled
8974 properly here. FIXME */
8975 if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE)
8976 field_decl_type = TREE_TYPE (TREE_TYPE (field_decl));
8977 else
8978 field_decl_type = TREE_TYPE (field_decl);
8979 if (!JPRIMITIVE_TYPE_P (field_decl_type)
8980 && !CLASS_LOADED_P (field_decl_type)
8981 && !TYPE_ARRAY_P (field_decl_type))
8982 resolve_and_layout (field_decl_type, NULL_TREE);
8983 if (TYPE_ARRAY_P (field_decl_type))
8984 CLASS_LOADED_P (field_decl_type) = 1;
8985
8986 /* Check on accessibility here */
8987 if (not_accessible_p (type, field_decl, from_super))
8988 {
8989 parse_error_context
8990 (qual_wfl,
8991 "Can't access %s field `%s.%s' from `%s'",
8992 java_accstring_lookup
8993 (get_access_flags_from_decl (field_decl)),
8994 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))),
8995 IDENTIFIER_POINTER (DECL_NAME (field_decl)),
8996 IDENTIFIER_POINTER
8997 (DECL_NAME (TYPE_NAME (current_class))));
8998 return 1;
8999 }
9000 check_deprecation (qual_wfl, field_decl);
9001
9002 /* There are things to check when fields are accessed
9003 from type. There are no restrictions on a static
9004 declaration of the field when it is accessed from an
9005 interface */
9006 is_static = FIELD_STATIC (field_decl);
9007 if (!from_super && from_type
9008 && !TYPE_INTERFACE_P (type) && !is_static)
9009 {
9010 parse_error_context
9011 (qual_wfl, "Can't make a static reference to nonstatic "
9012 "variable `%s' in class `%s'",
9013 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
9014 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
9015 return 1;
9016 }
9017 from_cast = from_super = 0;
9018
9019 /* If we need to generate something to get a proper
9020 handle on what this field is accessed from, do it
9021 now. */
9022 if (!is_static)
9023 {
9024 decl = maybe_access_field (decl, *where_found, *type_found);
9025 if (decl == error_mark_node)
9026 return 1;
9027 }
9028
9029 /* We want to keep the location were found it, and the type
9030 we found. */
9031 *where_found = decl;
9032 *type_found = type;
9033
9034 /* This is the decl found and eventually the next one to
9035 search from */
9036 decl = field_decl;
9037 }
9038 from_type = 0;
9039 type = QUAL_DECL_TYPE (decl);
9040 }
9041 }
9042 *found_decl = decl;
9043 return 0;
9044 }
9045
9046 /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
9047 can't be accessed from REFERENCE (a record type). */
9048
9049 int not_accessible_p (reference, member, from_super)
9050 tree reference, member;
9051 int from_super;
9052 {
9053 int access_flag = get_access_flags_from_decl (member);
9054
9055 /* Access always granted for members declared public */
9056 if (access_flag & ACC_PUBLIC)
9057 return 0;
9058
9059 /* Check access on protected members */
9060 if (access_flag & ACC_PROTECTED)
9061 {
9062 /* Access granted if it occurs from within the package
9063 containing the class in which the protected member is
9064 declared */
9065 if (class_in_current_package (DECL_CONTEXT (member)))
9066 return 0;
9067
9068 /* If accessed with the form `super.member', then access is granted */
9069 if (from_super)
9070 return 0;
9071
9072 /* Otherwise, access is granted if occuring from the class where
9073 member is declared or a subclass of it */
9074 if (inherits_from_p (reference, current_class))
9075 return 0;
9076 return 1;
9077 }
9078
9079 /* Check access on private members. Access is granted only if it
9080 occurs from within the class in witch it is declared */
9081 if (access_flag & ACC_PRIVATE)
9082 return (current_class == DECL_CONTEXT (member) ? 0 : 1);
9083
9084 /* Default access are permitted only when occuring within the
9085 package in which the type (REFERENCE) is declared. In other words,
9086 REFERENCE is defined in the current package */
9087 if (ctxp->package)
9088 return !class_in_current_package (reference);
9089
9090 /* Otherwise, access is granted */
9091 return 0;
9092 }
9093
9094 /* Test deprecated decl access. */
9095 static void
9096 check_deprecation (wfl, decl)
9097 tree wfl, decl;
9098 {
9099 char *file = DECL_SOURCE_FILE (decl);
9100 /* Complain if the field is deprecated and the file it was defined
9101 in isn't compiled at the same time the file which contains its
9102 use is */
9103 if (DECL_DEPRECATED (decl)
9104 && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file)))
9105 {
9106 char the [20];
9107 switch (TREE_CODE (decl))
9108 {
9109 case FUNCTION_DECL:
9110 strcpy (the, "method");
9111 break;
9112 case FIELD_DECL:
9113 strcpy (the, "field");
9114 break;
9115 case TYPE_DECL:
9116 strcpy (the, "class");
9117 break;
9118 default:
9119 fatal ("unexpected DECL code - check_deprecation");
9120 }
9121 parse_warning_context
9122 (wfl, "The %s `%s' in class `%s' has been deprecated",
9123 the, lang_printable_name (decl, 0),
9124 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)))));
9125 }
9126 }
9127
9128 /* Returns 1 if class was declared in the current package, 0 otherwise */
9129
9130 static int
9131 class_in_current_package (class)
9132 tree class;
9133 {
9134 static tree cache = NULL_TREE;
9135 int qualified_flag;
9136 tree left;
9137
9138 if (cache == class)
9139 return 1;
9140
9141 qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
9142
9143 /* If the current package is empty and the name of CLASS is
9144 qualified, class isn't in the current package. If there is a
9145 current package and the name of the CLASS is not qualified, class
9146 isn't in the current package */
9147 if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag))
9148 return 0;
9149
9150 /* If there is not package and the name of CLASS isn't qualified,
9151 they belong to the same unnamed package */
9152 if (!ctxp->package && !qualified_flag)
9153 return 1;
9154
9155 /* Compare the left part of the name of CLASS with the package name */
9156 breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
9157 if (ctxp->package == left)
9158 {
9159 cache = class;
9160 return 1;
9161 }
9162 return 0;
9163 }
9164
9165 /* This function may generate code to access DECL from WHERE. This is
9166 done only if certain conditions meet. */
9167
9168 static tree
9169 maybe_access_field (decl, where, type)
9170 tree decl, where, type;
9171 {
9172 if (TREE_CODE (decl) == FIELD_DECL && decl != current_this
9173 && !FIELD_STATIC (decl))
9174 decl = build_field_ref (where ? where : current_this,
9175 (type ? type : DECL_CONTEXT (decl)),
9176 DECL_NAME (decl));
9177 return decl;
9178 }
9179
9180 /* Build a method invocation, by patching PATCH. If non NULL
9181 and according to the situation, PRIMARY and WHERE may be
9182 used. IS_STATIC is set to 1 if the invoked function is static. */
9183
9184 static tree
9185 patch_method_invocation (patch, primary, where, is_static, ret_decl)
9186 tree patch, primary, where;
9187 int *is_static;
9188 tree *ret_decl;
9189 {
9190 tree wfl = TREE_OPERAND (patch, 0);
9191 tree args = TREE_OPERAND (patch, 1);
9192 tree name = EXPR_WFL_NODE (wfl);
9193 tree list;
9194 int is_static_flag = 0;
9195 int is_super_init = 0;
9196
9197 /* Should be overriden if everything goes well. Otherwise, if
9198 something fails, it should keep this value. It stop the
9199 evaluation of a bogus assignment. See java_complete_tree,
9200 MODIFY_EXPR: for the reasons why we sometimes want to keep on
9201 evaluating an assignment */
9202 TREE_TYPE (patch) = error_mark_node;
9203
9204 /* Since lookup functions are messing with line numbers, save the
9205 context now. */
9206 java_parser_context_save_global ();
9207
9208 /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
9209
9210 /* Resolution of qualified name, excluding constructors */
9211 if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch))
9212 {
9213 tree class_decl, identifier, identifier_wfl;
9214 /* Extract the last IDENTIFIER of the qualified
9215 expression. This is a wfl and we will use it's location
9216 data during error report. */
9217 identifier_wfl = cut_identifier_in_qualified (wfl);
9218 identifier = EXPR_WFL_NODE (identifier_wfl);
9219
9220 /* Given the context, IDENTIFIER is syntactically qualified
9221 as a MethodName. We need to qualify what's before */
9222 qualify_ambiguous_name (wfl);
9223
9224 /* Package resolution are erroneous */
9225 if (RESOLVE_PACKAGE_NAME_P (wfl))
9226 {
9227 tree remainder;
9228 breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
9229 parse_error_context (wfl, "Can't search method `%s' in package "
9230 "`%s'",IDENTIFIER_POINTER (identifier),
9231 IDENTIFIER_POINTER (remainder));
9232 PATCH_METHOD_RETURN_ERROR ();
9233 }
9234 /* We're resolving a call from a type */
9235 else if (RESOLVE_TYPE_NAME_P (wfl))
9236 {
9237 tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl));
9238 tree name = DECL_NAME (decl);
9239 tree type;
9240
9241 class_decl = resolve_and_layout (name, wfl);
9242 if (CLASS_INTERFACE (decl))
9243 {
9244 parse_error_context
9245 (identifier_wfl, "Can't make static reference to method "
9246 "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier),
9247 IDENTIFIER_POINTER (name));
9248 PATCH_METHOD_RETURN_ERROR ();
9249 }
9250 /* Look the method up in the type selector. The method ought
9251 to be static. */
9252 type = TREE_TYPE (class_decl);
9253 list = lookup_method_invoke (0, wfl, type, identifier, args);
9254 if (list && !METHOD_STATIC (list))
9255 {
9256 char *fct_name = strdup (lang_printable_name (list, 0));
9257 parse_error_context
9258 (identifier_wfl,
9259 "Can't make static reference to method `%s %s' in class `%s'",
9260 lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
9261 fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
9262 free (fct_name);
9263 PATCH_METHOD_RETURN_ERROR ();
9264 }
9265 args = nreverse (args);
9266 }
9267 /* We're resolving an expression name */
9268 else
9269 {
9270 tree field, type;
9271
9272 /* 1- Find the field to which the call applies */
9273 field = resolve_field_access (wfl, NULL, &type);
9274 if (field == error_mark_node)
9275 PATCH_METHOD_RETURN_ERROR ();
9276 /* field is used in lieu of a primary. It alows us not to
9277 report errors on erroneous use of `this' in
9278 constructors. */
9279 primary = field;
9280
9281 /* 2- Do the layout of the class where the last field
9282 was found, so we can search it. */
9283 class_decl = resolve_and_layout (type, NULL_TREE);
9284 if (class_decl != NULL_TREE)
9285 type = TREE_TYPE (class_decl);
9286
9287 /* 3- Retrieve a filtered list of method matches, Refine
9288 if necessary. In any cases, point out errors. */
9289 list = lookup_method_invoke (0, identifier_wfl, type,
9290 identifier, args);
9291
9292 /* 4- Add the field as an argument */
9293 args = tree_cons (NULL_TREE, field, nreverse (args));
9294 }
9295
9296 /* IDENTIFIER_WFL will be used to report any problem further */
9297 wfl = identifier_wfl;
9298 }
9299 /* Resolution of simple names, names generated after a primary: or
9300 constructors */
9301 else
9302 {
9303 tree class_to_search;
9304 int lc; /* Looking for Constructor */
9305
9306 /* We search constructor in their target class */
9307 if (CALL_CONSTRUCTOR_P (patch))
9308 {
9309 if (TREE_CODE (patch) == NEW_CLASS_EXPR)
9310 class_to_search = EXPR_WFL_NODE (wfl);
9311 else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
9312 this_identifier_node)
9313 class_to_search = NULL_TREE;
9314 else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
9315 super_identifier_node)
9316 {
9317 is_super_init = 1;
9318 if (CLASSTYPE_SUPER (current_class))
9319 class_to_search =
9320 DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class)));
9321 else
9322 {
9323 parse_error_context (wfl, "Can't invoke super constructor "
9324 "on java.lang.Object");
9325 PATCH_METHOD_RETURN_ERROR ();
9326 }
9327 }
9328
9329 /* Class to search is NULL if we're searching the current one */
9330 if (class_to_search)
9331 {
9332 class_to_search = resolve_and_layout (class_to_search,
9333 NULL_TREE);
9334 if (!class_to_search)
9335 {
9336 parse_error_context
9337 (wfl, "Class `%s' not found in type declaration",
9338 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
9339 PATCH_METHOD_RETURN_ERROR ();
9340 }
9341
9342 /* Can't instantiate an abstract class, but we can
9343 invoke it's constructor. It's use within the `new'
9344 context is denied here. */
9345 if (CLASS_ABSTRACT (class_to_search)
9346 && TREE_CODE (patch) == NEW_CLASS_EXPR)
9347 {
9348 parse_error_context
9349 (wfl, "Class `%s' is an abstract class. It can't be "
9350 "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
9351 PATCH_METHOD_RETURN_ERROR ();
9352 }
9353 class_to_search = TREE_TYPE (class_to_search);
9354 }
9355 else
9356 class_to_search = current_class;
9357 lc = 1;
9358 }
9359 /* This is a regular search in the local class, unless an
9360 alternate class is specified. */
9361 else
9362 {
9363 class_to_search = (where ? where : current_class);
9364 lc = 0;
9365 }
9366
9367 /* NAME is a simple identifier or comes from a primary. Search
9368 in the class whose declaration contain the method being
9369 invoked. */
9370 resolve_and_layout (class_to_search, NULL_TREE);
9371 list = lookup_method_invoke (lc, wfl, class_to_search, name, args);
9372
9373 /* Don't continue if no method were found, as the next statement
9374 can't be executed then. */
9375 if (!list)
9376 PATCH_METHOD_RETURN_ERROR ();
9377
9378 /* Check for static reference if non static methods */
9379 if (check_for_static_method_reference (wfl, patch, list,
9380 class_to_search, primary))
9381 PATCH_METHOD_RETURN_ERROR ();
9382
9383 /* Non static methods are called with the current object extra
9384 argument. If patch a `new TYPE()', the argument is the value
9385 returned by the object allocator. If method is resolved as a
9386 primary, use the primary otherwise use the current THIS. */
9387 args = nreverse (args);
9388 if (!METHOD_STATIC (list) && TREE_CODE (patch) != NEW_CLASS_EXPR)
9389 args = tree_cons (NULL_TREE, primary ? primary : current_this, args);
9390 }
9391
9392 /* Merge point of all resolution schemes. If we have nothing, this
9393 is an error, already signaled */
9394 if (!list)
9395 PATCH_METHOD_RETURN_ERROR ();
9396
9397 /* Check accessibility, position the is_static flag, build and
9398 return the call */
9399 if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0))
9400 {
9401 char *fct_name = strdup (lang_printable_name (list, 0));
9402 parse_error_context
9403 (wfl, "Can't access %s method `%s %s.%s' from `%s'",
9404 java_accstring_lookup (get_access_flags_from_decl (list)),
9405 lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
9406 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list)))),
9407 fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
9408 free (fct_name);
9409 PATCH_METHOD_RETURN_ERROR ();
9410 }
9411 check_deprecation (wfl, list);
9412
9413 is_static_flag = METHOD_STATIC (list);
9414
9415 /* In the context of an explicit constructor invocation, we can't
9416 invoke any method relying on `this'. Exceptions are: we're
9417 invoking a static function, primary exists and is not the current
9418 this, we're creating a new object. */
9419 if (ctxp->explicit_constructor_p
9420 && !is_static_flag
9421 && (!primary || primary == current_this)
9422 && (TREE_CODE (patch) != NEW_CLASS_EXPR))
9423 {
9424 parse_error_context
9425 (wfl, "Can't reference `this' before the superclass constructor has "
9426 "been called");
9427 PATCH_METHOD_RETURN_ERROR ();
9428 }
9429 java_parser_context_restore_global ();
9430 if (is_static)
9431 *is_static = is_static_flag;
9432 /* Sometimes, we want the decl of the selected method. Such as for
9433 EH checking */
9434 if (ret_decl)
9435 *ret_decl = list;
9436 patch = patch_invoke (patch, list, args);
9437 if (is_super_init && CLASS_HAS_FINIT_P (current_class))
9438 {
9439 /* Generate the code used to initialize fields declared with an
9440 initialization statement. For now, it returns a call the the
9441 artificial function $finit$, if required. */
9442
9443 tree finit_call =
9444 build_method_invocation (build_expr_wfl (finit_identifier_node,
9445 input_filename, 0, 0),
9446 NULL_TREE);
9447 patch = build (COMPOUND_EXPR, void_type_node, patch,
9448 java_complete_tree (finit_call));
9449 CAN_COMPLETE_NORMALLY (patch) = 1;
9450 }
9451 return patch;
9452 }
9453
9454 /* Check that we're not trying to do a static reference to a method in
9455 non static method. Return 1 if it's the case, 0 otherwise. */
9456
9457 static int
9458 check_for_static_method_reference (wfl, node, method, where, primary)
9459 tree wfl, node, method, where, primary;
9460 {
9461 if (METHOD_STATIC (current_function_decl)
9462 && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
9463 {
9464 char *fct_name = strdup (lang_printable_name (method, 0));
9465 parse_error_context
9466 (wfl, "Can't make static reference to method `%s %s' in class `%s'",
9467 lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
9468 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where))));
9469 free (fct_name);
9470 return 1;
9471 }
9472 return 0;
9473 }
9474
9475 /* Patch an invoke expression METHOD and ARGS, based on its invocation
9476 mode. */
9477
9478 static tree
9479 patch_invoke (patch, method, args)
9480 tree patch, method, args;
9481 {
9482 tree dtable, func;
9483 tree original_call, t, ta;
9484
9485 /* Last step for args: convert build-in types. If we're dealing with
9486 a new TYPE() type call, the first argument to the constructor
9487 isn't found in the incomming argument list, but delivered by
9488 `new' */
9489 t = TYPE_ARG_TYPES (TREE_TYPE (method));
9490 if (TREE_CODE (patch) == NEW_CLASS_EXPR)
9491 t = TREE_CHAIN (t);
9492 for (ta = args; t != end_params_node && ta;
9493 t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
9494 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
9495 TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
9496 TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
9497
9498 if (flag_emit_class_files)
9499 func = method;
9500 else
9501 {
9502 tree signature = build_java_signature (TREE_TYPE (method));
9503 switch (invocation_mode (method, CALL_USING_SUPER (patch)))
9504 {
9505 case INVOKE_VIRTUAL:
9506 dtable = invoke_build_dtable (0, args);
9507 func = build_invokevirtual (dtable, method);
9508 break;
9509
9510 case INVOKE_SUPER:
9511 case INVOKE_STATIC:
9512 func = build_known_method_ref (method, TREE_TYPE (method),
9513 DECL_CONTEXT (method),
9514 signature, args);
9515 break;
9516
9517 case INVOKE_INTERFACE:
9518 dtable = invoke_build_dtable (1, args);
9519 func = build_invokeinterface (dtable, DECL_NAME (method), signature);
9520 break;
9521
9522 default:
9523 fatal ("internal error - unknown invocation_mode result");
9524 }
9525
9526 /* Ensure self_type is initialized, (invokestatic). FIXME */
9527 func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func);
9528 }
9529
9530 TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method));
9531 TREE_OPERAND (patch, 0) = func;
9532 TREE_OPERAND (patch, 1) = args;
9533 original_call = patch;
9534
9535 /* We're processing a `new TYPE ()' form. New is called an its
9536 returned value is the first argument to the constructor. We build
9537 a COMPOUND_EXPR and use saved expression so that the overall NEW
9538 expression value is a pointer to a newly created and initialized
9539 class. */
9540 if (TREE_CODE (original_call) == NEW_CLASS_EXPR)
9541 {
9542 tree class = DECL_CONTEXT (method);
9543 tree c1, saved_new, size, new;
9544 if (flag_emit_class_files)
9545 {
9546 TREE_TYPE (patch) = build_pointer_type (class);
9547 return patch;
9548 }
9549 if (!TYPE_SIZE (class))
9550 safe_layout_class (class);
9551 size = size_in_bytes (class);
9552 new = build (CALL_EXPR, promote_type (class),
9553 build_address_of (alloc_object_node),
9554 tree_cons (NULL_TREE, build_class_ref (class),
9555 build_tree_list (NULL_TREE,
9556 size_in_bytes (class))),
9557 NULL_TREE);
9558 saved_new = save_expr (new);
9559 c1 = build_tree_list (NULL_TREE, saved_new);
9560 TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1);
9561 TREE_OPERAND (original_call, 1) = c1;
9562 TREE_SET_CODE (original_call, CALL_EXPR);
9563 patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
9564 }
9565 return patch;
9566 }
9567
9568 static int
9569 invocation_mode (method, super)
9570 tree method;
9571 int super;
9572 {
9573 int access = get_access_flags_from_decl (method);
9574
9575 if (super)
9576 return INVOKE_SUPER;
9577
9578 if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE)
9579 return INVOKE_STATIC;
9580
9581 if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
9582 return INVOKE_STATIC;
9583
9584 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
9585 return INVOKE_INTERFACE;
9586
9587 if (DECL_CONSTRUCTOR_P (method))
9588 return INVOKE_STATIC;
9589
9590 return INVOKE_VIRTUAL;
9591 }
9592
9593 /* Retrieve a refined list of matching methods. It covers the step
9594 15.11.2 (Compile-Time Step 2) */
9595
9596 static tree
9597 lookup_method_invoke (lc, cl, class, name, arg_list)
9598 int lc;
9599 tree cl;
9600 tree class, name, arg_list;
9601 {
9602 tree atl = end_params_node; /* Arg Type List */
9603 tree method, signature, list, node;
9604 char *candidates; /* Used for error report */
9605
9606 /* Fix the arguments */
9607 for (node = arg_list; node; node = TREE_CHAIN (node))
9608 {
9609 tree current_arg = TREE_VALUE (node);
9610 /* Integer constant 0 passed as itself, not as a type */
9611 if (current_arg != integer_zero_node)
9612 current_arg = TREE_TYPE (TREE_VALUE (node));
9613 /* Non primitive type may have to be resolved */
9614 if (current_arg != integer_zero_node
9615 && !JPRIMITIVE_TYPE_P (current_arg))
9616 resolve_and_layout (current_arg, NULL_TREE);
9617 /* And promoted */
9618 if (TREE_CODE (current_arg) == RECORD_TYPE)
9619 current_arg = promote_type (current_arg);
9620 atl = tree_cons (NULL_TREE, current_arg, atl);
9621 }
9622
9623 /* Find all candidates and then refine the list, searching for the
9624 most specific method. */
9625 list = find_applicable_accessible_methods_list (lc, class, name, atl);
9626 list = find_most_specific_methods_list (list);
9627 if (list && !TREE_CHAIN (list))
9628 return TREE_VALUE (list);
9629
9630 /* Issue an error. List candidates if any. Candidates are listed
9631 only if accessible (non accessible methods may end-up here for
9632 the sake of a better error report). */
9633 candidates = NULL;
9634 if (list)
9635 {
9636 tree current;
9637 obstack_grow (&temporary_obstack, ". Candidates are:\n", 18);
9638 for (current = list; current; current = TREE_CHAIN (current))
9639 {
9640 tree cm = TREE_VALUE (current);
9641 char string [4096];
9642 if (!cm || not_accessible_p (class, cm, 0))
9643 continue;
9644 sprintf
9645 (string, " `%s' in `%s'%s",
9646 get_printable_method_name (cm),
9647 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))),
9648 (TREE_CHAIN (current) ? "\n" : ""));
9649 obstack_grow (&temporary_obstack, string, strlen (string));
9650 }
9651 obstack_1grow (&temporary_obstack, '\0');
9652 candidates = obstack_finish (&temporary_obstack);
9653 }
9654 /* Issue the error message */
9655 for (node = atl; node; node = TREE_CHAIN (node))
9656 if (TREE_VALUE (node) == integer_zero_node)
9657 TREE_VALUE (node) = long_type_node;
9658 method = make_node (FUNCTION_TYPE);
9659 TYPE_ARG_TYPES (method) = atl;
9660 signature = build_java_argument_signature (method);
9661 parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s",
9662 (lc ? "constructor" : "method"),
9663 (lc ?
9664 IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) :
9665 IDENTIFIER_POINTER (name)),
9666 IDENTIFIER_POINTER (signature),
9667 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
9668 (candidates ? candidates : ""));
9669 return NULL_TREE;
9670 }
9671
9672 /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
9673 when we're looking for a constructor. */
9674
9675 static tree
9676 find_applicable_accessible_methods_list (lc, class, name, arglist)
9677 int lc;
9678 tree class, name, arglist;
9679 {
9680 tree method;
9681 tree list = NULL_TREE, all_list = NULL_TREE;
9682
9683 while (class != NULL_TREE)
9684 {
9685 for (method = TYPE_METHODS (class);
9686 method != NULL_TREE; method = TREE_CHAIN (method))
9687 {
9688 if (lc && !DECL_CONSTRUCTOR_P (method))
9689 continue;
9690 else if (!lc && (DECL_CONSTRUCTOR_P (method)
9691 || (GET_METHOD_NAME (method) != name)))
9692 continue;
9693
9694 if (argument_types_convertible (method, arglist))
9695 {
9696 /* Retain accessible methods only */
9697 if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
9698 method, 0))
9699 list = tree_cons (NULL_TREE, method, list);
9700 else
9701 /* Also retain all selected method here */
9702 all_list = tree_cons (NULL_TREE, method, list);
9703 }
9704 }
9705 /* When dealing with constructor, stop here, otherwise search
9706 other classes */
9707 class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class));
9708 }
9709 /* Either return the list obtained or all selected (but
9710 inaccessible) methods for better error report. */
9711 return (!list ? all_list : list);
9712 }
9713
9714 /* 15.11.2.2 Choose the Most Specific Method */
9715
9716 static tree
9717 find_most_specific_methods_list (list)
9718 tree list;
9719 {
9720 int max = 0;
9721 tree current, new_list = NULL_TREE;
9722 for (current = list; current; current = TREE_CHAIN (current))
9723 {
9724 tree method;
9725 DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0;
9726
9727 for (method = list; method; method = TREE_CHAIN (method))
9728 {
9729 /* Don't test a method against itself */
9730 if (method == current)
9731 continue;
9732
9733 /* Compare arguments and location where method where declared */
9734 if (argument_types_convertible (TREE_VALUE (method),
9735 TREE_VALUE (current))
9736 && valid_method_invocation_conversion_p
9737 (DECL_CONTEXT (TREE_VALUE (method)),
9738 DECL_CONTEXT (TREE_VALUE (current))))
9739 {
9740 int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current));
9741 max = (v > max ? v : max);
9742 }
9743 }
9744 }
9745
9746 /* Review the list and select the maximally specific methods */
9747 for (current = list; current; current = TREE_CHAIN (current))
9748 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
9749 new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
9750
9751 /* If we can't find one, lower expectations and try to gather multiple
9752 maximally specific methods */
9753 while (!new_list)
9754 {
9755 while (--max > 0)
9756 {
9757 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
9758 new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
9759 }
9760 return new_list;
9761 }
9762
9763 return new_list;
9764 }
9765
9766 /* Make sure that the type of each M2_OR_ARGLIST arguments can be
9767 converted by method invocation conversion (5.3) to the type of the
9768 corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
9769 to change less often than M1. */
9770
9771 static int
9772 argument_types_convertible (m1, m2_or_arglist)
9773 tree m1, m2_or_arglist;
9774 {
9775 static tree m2_arg_value = NULL_TREE;
9776 static tree m2_arg_cache = NULL_TREE;
9777
9778 register tree m1_arg, m2_arg;
9779
9780 m1_arg = TYPE_ARG_TYPES (TREE_TYPE (m1));
9781 if (!METHOD_STATIC (m1))
9782 m1_arg = TREE_CHAIN (m1_arg);
9783
9784 if (m2_arg_value == m2_or_arglist)
9785 m2_arg = m2_arg_cache;
9786 else
9787 {
9788 /* M2_OR_ARGLIST can be a function DECL or a raw list of
9789 argument types */
9790 if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL)
9791 {
9792 m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist));
9793 if (!METHOD_STATIC (m2_or_arglist))
9794 m2_arg = TREE_CHAIN (m2_arg);
9795 }
9796 else
9797 m2_arg = m2_or_arglist;
9798
9799 m2_arg_value = m2_or_arglist;
9800 m2_arg_cache = m2_arg;
9801 }
9802
9803 while (m1_arg != end_params_node && m2_arg != end_params_node)
9804 {
9805 resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE);
9806 if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg),
9807 TREE_VALUE (m2_arg)))
9808 break;
9809 m1_arg = TREE_CHAIN (m1_arg);
9810 m2_arg = TREE_CHAIN (m2_arg);
9811 }
9812 return m1_arg == end_params_node && m2_arg == end_params_node;
9813 }
9814
9815 /* Qualification routines */
9816
9817 static void
9818 qualify_ambiguous_name (id)
9819 tree id;
9820 {
9821 tree qual, qual_wfl, name, decl, ptr_type, saved_current_class;
9822 int again, super_found = 0, this_found = 0;
9823
9824 /* We first qualify the first element, then derive qualification of
9825 others based on the first one. If the first element is qualified
9826 by a resolution (field or type), this resolution is stored in the
9827 QUAL_RESOLUTION of the qual element being examined. We need to
9828 save the current_class since the use of SUPER might change the
9829 its value. */
9830 saved_current_class = current_class;
9831 qual = EXPR_WFL_QUALIFICATION (id);
9832 do {
9833
9834 /* Simple qualified expression feature a qual_wfl that is a
9835 WFL. Expression derived from a primary feature more complicated
9836 things like a CALL_EXPR. Expression from primary need to be
9837 worked out to extract the part on which the qualification will
9838 take place. */
9839 qual_wfl = QUAL_WFL (qual);
9840 switch (TREE_CODE (qual_wfl))
9841 {
9842 case CALL_EXPR:
9843 qual_wfl = TREE_OPERAND (qual_wfl, 0);
9844 if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
9845 {
9846 qual = EXPR_WFL_QUALIFICATION (qual_wfl);
9847 qual_wfl = QUAL_WFL (qual);
9848 }
9849 break;
9850 case NEW_CLASS_EXPR:
9851 case CONVERT_EXPR:
9852 qual_wfl = TREE_OPERAND (qual_wfl, 0);
9853 break;
9854 case ARRAY_REF:
9855 while (TREE_CODE (qual_wfl) == ARRAY_REF)
9856 qual_wfl = TREE_OPERAND (qual_wfl, 0);
9857 break;
9858 default:
9859 /* Fix for -Wall. Just break doing nothing */
9860 break;
9861 }
9862 name = EXPR_WFL_NODE (qual_wfl);
9863 ptr_type = current_class;
9864 again = 0;
9865 /* If we have a THIS (from a primary), we set the context accordingly */
9866 if (name == this_identifier_node)
9867 {
9868 qual = TREE_CHAIN (qual);
9869 qual_wfl = QUAL_WFL (qual);
9870 if (TREE_CODE (qual_wfl) == CALL_EXPR)
9871 again = 1;
9872 else
9873 name = EXPR_WFL_NODE (qual_wfl);
9874 this_found = 1;
9875 }
9876 /* If we have a SUPER, we set the context accordingly */
9877 if (name == super_identifier_node)
9878 {
9879 current_class = CLASSTYPE_SUPER (ptr_type);
9880 /* Check that there is such a thing as a super class. If not,
9881 return. The error will be caught later on, during the
9882 resolution */
9883 if (!current_class)
9884 {
9885 current_class = saved_current_class;
9886 return;
9887 }
9888 qual = TREE_CHAIN (qual);
9889 /* Do one more interation to set things up */
9890 super_found = again = 1;
9891 }
9892 /* Loop one more time if we're dealing with ?: or a string constant */
9893 if (TREE_CODE (qual_wfl) == CONDITIONAL_EXPR
9894 || TREE_CODE (qual_wfl) == STRING_CST)
9895 {
9896 qual = TREE_CHAIN (qual);
9897 qual_wfl = QUAL_WFL (qual);
9898 again = 1;
9899 }
9900 } while (again);
9901
9902 /* If name appears within the scope of a location variable
9903 declaration or parameter declaration, then it is an expression
9904 name. We don't carry this test out if we're in the context of the
9905 use of SUPER or THIS */
9906
9907 if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
9908 {
9909 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
9910 QUAL_RESOLUTION (qual) = decl;
9911 }
9912
9913 /* If within the class/interface NAME was found to be used there
9914 exists a (possibly inherited) field named NAME, then this is an
9915 expression name. */
9916 else if ((decl = lookup_field_wrapper (ptr_type, name)))
9917 {
9918 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
9919 QUAL_RESOLUTION (qual) = decl;
9920 }
9921
9922 /* We reclassify NAME as a type name if:
9923 - NAME is a class/interface declared within the compilation
9924 unit containing NAME,
9925 - NAME is imported via a single-type-import declaration,
9926 - NAME is declared in an another compilation unit of the package
9927 of the compilation unit containing NAME,
9928 - NAME is declared by exactly on type-import-on-demand declaration
9929 of the compilation unit containing NAME. */
9930 else if ((decl = resolve_and_layout (name, NULL_TREE)))
9931 {
9932 RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
9933 QUAL_RESOLUTION (qual) = decl;
9934 }
9935
9936 /* Method call are expression name */
9937 else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
9938 || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF)
9939 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
9940
9941 /* Check here that NAME isn't declared by more than one
9942 type-import-on-demand declaration of the compilation unit
9943 containing NAME. FIXME */
9944
9945 /* Otherwise, NAME is reclassified as a package name */
9946 else
9947 RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
9948
9949 /* Propagate the qualification accross other components of the
9950 qualified name */
9951 for (qual = TREE_CHAIN (qual); qual;
9952 qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual))
9953 {
9954 if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
9955 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1;
9956 else
9957 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1;
9958 }
9959
9960 /* Store the global qualification for the ambiguous part of ID back
9961 into ID fields */
9962 if (RESOLVE_EXPRESSION_NAME_P (qual_wfl))
9963 RESOLVE_EXPRESSION_NAME_P (id) = 1;
9964 else if (RESOLVE_TYPE_NAME_P (qual_wfl))
9965 RESOLVE_TYPE_NAME_P (id) = 1;
9966 else if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
9967 RESOLVE_PACKAGE_NAME_P (id) = 1;
9968
9969 /* Restore the current class */
9970 current_class = saved_current_class;
9971 }
9972
9973 static int
9974 breakdown_qualified (left, right, source)
9975 tree *left, *right, source;
9976 {
9977 char *p = IDENTIFIER_POINTER (source), *base;
9978 int l = IDENTIFIER_LENGTH (source);
9979
9980 /* Breakdown NAME into REMAINDER . IDENTIFIER */
9981 base = p;
9982 p += (l-1);
9983 while (*p != '.' && p != base)
9984 p--;
9985
9986 /* We didn't find a '.'. Return an error */
9987 if (p == base)
9988 return 1;
9989
9990 *p = '\0';
9991 if (right)
9992 *right = get_identifier (p+1);
9993 *left = get_identifier (IDENTIFIER_POINTER (source));
9994 *p = '.';
9995
9996 return 0;
9997 }
9998
9999 /* Patch tree nodes in a function body. When a BLOCK is found, push
10000 local variable decls if present.
10001 Same as java_complete_lhs, but does resolve static finals to values. */
10002
10003 static tree
10004 java_complete_tree (node)
10005 tree node;
10006 {
10007 node = java_complete_lhs (node);
10008 if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node)
10009 && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE)
10010 {
10011 tree value = DECL_INITIAL (node);
10012 DECL_INITIAL (node) = NULL_TREE;
10013 value = fold_constant_for_init (value, node);
10014 DECL_INITIAL (node) = value;
10015 if (value != NULL_TREE)
10016 return value;
10017 }
10018 return node;
10019 }
10020
10021 /* Patch tree nodes in a function body. When a BLOCK is found, push
10022 local variable decls if present.
10023 Same as java_complete_tree, but does not resolve static finals to values. */
10024
10025 static tree
10026 java_complete_lhs (node)
10027 tree node;
10028 {
10029 tree nn, cn, wfl_op1, wfl_op2, wfl_op3;
10030 int flag;
10031
10032 /* CONVERT_EXPR always has its type set, even though it needs to be
10033 worked out. */
10034 if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR)
10035 return node;
10036
10037 /* The switch block implements cases processing container nodes
10038 first. Contained nodes are always written back. Leaves come
10039 next and return a value. */
10040 switch (TREE_CODE (node))
10041 {
10042 case BLOCK:
10043
10044 /* 1- Block section.
10045 Set the local values on decl names so we can identify them
10046 faster when they're referenced. At that stage, identifiers
10047 are legal so we don't check for declaration errors. */
10048 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
10049 {
10050 DECL_CONTEXT (cn) = current_function_decl;
10051 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn;
10052 INITIALIZED_P (cn) = 0;
10053 }
10054 if (BLOCK_EXPR_BODY (node) == NULL_TREE)
10055 CAN_COMPLETE_NORMALLY (node) = 1;
10056 else
10057 {
10058 tree stmt = BLOCK_EXPR_BODY (node);
10059 tree *ptr;
10060 int error_seen = 0;
10061 if (TREE_CODE (stmt) == COMPOUND_EXPR)
10062 {
10063 /* Re-order from (((A; B); C); ...; Z) to
10064 (A; (B; (C ; (...; Z)))).
10065 This makes it easier to scan the statements left-to-right
10066 without using recursion (which might overflow the stack
10067 if the block has many statements. */
10068 for (;;)
10069 {
10070 tree left = TREE_OPERAND (stmt, 0);
10071 if (TREE_CODE (left) != COMPOUND_EXPR)
10072 break;
10073 TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1);
10074 TREE_OPERAND (left, 1) = stmt;
10075 stmt = left;
10076 }
10077 BLOCK_EXPR_BODY (node) = stmt;
10078 }
10079
10080 /* Now do the actual complete, without deep recursion for
10081 long blocks. */
10082 ptr = &BLOCK_EXPR_BODY (node);
10083 while (TREE_CODE (*ptr) == COMPOUND_EXPR)
10084 {
10085 tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
10086 tree *next = &TREE_OPERAND (*ptr, 1);
10087 TREE_OPERAND (*ptr, 0) = cur;
10088 if (TREE_CODE (cur) == ERROR_MARK)
10089 error_seen++;
10090 else if (! CAN_COMPLETE_NORMALLY (cur))
10091 {
10092 wfl_op2 = *next;
10093 for (;;)
10094 {
10095 if (TREE_CODE (wfl_op2) == BLOCK)
10096 wfl_op2 = BLOCK_EXPR_BODY (wfl_op2);
10097 else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR)
10098 wfl_op2 = TREE_OPERAND (wfl_op2, 0);
10099 else
10100 break;
10101 }
10102 if (TREE_CODE (wfl_op2) != CASE_EXPR
10103 && TREE_CODE (wfl_op2) != DEFAULT_EXPR
10104 && wfl_op2 != empty_stmt_node)
10105 unreachable_stmt_error (*ptr);
10106 }
10107 ptr = next;
10108 }
10109 *ptr = java_complete_tree (*ptr);
10110
10111 if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0)
10112 return error_mark_node;
10113 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr);
10114 }
10115 /* Turn local bindings to null */
10116 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
10117 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE;
10118
10119 TREE_TYPE (node) = void_type_node;
10120 break;
10121
10122 /* 2- They are expressions but ultimately deal with statements */
10123
10124 case THROW_EXPR:
10125 wfl_op1 = TREE_OPERAND (node, 0);
10126 COMPLETE_CHECK_OP_0 (node);
10127 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10128 return patch_throw_statement (node, wfl_op1);
10129
10130 case SYNCHRONIZED_EXPR:
10131 wfl_op1 = TREE_OPERAND (node, 0);
10132 COMPLETE_CHECK_OP_0 (node);
10133 COMPLETE_CHECK_OP_1 (node);
10134 return patch_synchronized_statement (node, wfl_op1);
10135
10136 case TRY_EXPR:
10137 return patch_try_statement (node);
10138
10139 case LABELED_BLOCK_EXPR:
10140 PUSH_LABELED_BLOCK (node);
10141 if (LABELED_BLOCK_BODY (node))
10142 COMPLETE_CHECK_OP_1 (node);
10143 TREE_TYPE (node) = void_type_node;
10144 POP_LABELED_BLOCK ();
10145 if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node)))
10146 CAN_COMPLETE_NORMALLY (node) = 1;
10147 return node;
10148
10149 case EXIT_BLOCK_EXPR:
10150 /* We don't complete operand 1, because it's the return value of
10151 the EXIT_BLOCK_EXPR which doesn't exist it Java */
10152 return patch_bc_statement (node);
10153
10154 case CASE_EXPR:
10155 cn = java_complete_tree (TREE_OPERAND (node, 0));
10156 if (cn == error_mark_node)
10157 return cn;
10158
10159 /* First, the case expression must be constant */
10160 cn = fold (cn);
10161
10162 if (!TREE_CONSTANT (cn))
10163 {
10164 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10165 parse_error_context (node, "Constant expression required");
10166 return error_mark_node;
10167 }
10168
10169 nn = ctxp->current_loop;
10170
10171 /* It must be assignable to the type of the switch expression. */
10172 if (!try_builtin_assignconv (NULL_TREE,
10173 TREE_TYPE (TREE_OPERAND (nn, 0)), cn))
10174 {
10175 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10176 parse_error_context
10177 (wfl_operator,
10178 "Incompatible type for case. Can't convert `%s' to `int'",
10179 lang_printable_name (TREE_TYPE (cn), 0));
10180 return error_mark_node;
10181 }
10182
10183 cn = fold (convert (int_type_node, cn));
10184
10185 /* Multiple instance of a case label bearing the same
10186 value is checked during code generation. The case
10187 expression is allright so far. */
10188 TREE_OPERAND (node, 0) = cn;
10189 TREE_TYPE (node) = void_type_node;
10190 CAN_COMPLETE_NORMALLY (node) = 1;
10191 TREE_SIDE_EFFECTS (node) = 1;
10192 break;
10193
10194 case DEFAULT_EXPR:
10195 nn = ctxp->current_loop;
10196 /* Only one default label is allowed per switch statement */
10197 if (SWITCH_HAS_DEFAULT (nn))
10198 {
10199 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10200 parse_error_context (wfl_operator,
10201 "Duplicate case label: `default'");
10202 return error_mark_node;
10203 }
10204 else
10205 SWITCH_HAS_DEFAULT (nn) = 1;
10206 TREE_TYPE (node) = void_type_node;
10207 TREE_SIDE_EFFECTS (node) = 1;
10208 CAN_COMPLETE_NORMALLY (node) = 1;
10209 break;
10210
10211 case SWITCH_EXPR:
10212 case LOOP_EXPR:
10213 PUSH_LOOP (node);
10214 /* Check whether the loop was enclosed in a labeled
10215 statement. If not, create one, insert the loop in it and
10216 return the node */
10217 nn = patch_loop_statement (node);
10218
10219 /* Anyways, walk the body of the loop */
10220 if (TREE_CODE (node) == LOOP_EXPR)
10221 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
10222 /* Switch statement: walk the switch expression and the cases */
10223 else
10224 node = patch_switch_statement (node);
10225
10226 if (TREE_OPERAND (node, 0) == error_mark_node)
10227 return error_mark_node;
10228 TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node;
10229 /* If we returned something different, that's because we
10230 inserted a label. Pop the label too. */
10231 if (nn != node)
10232 {
10233 if (CAN_COMPLETE_NORMALLY (node))
10234 CAN_COMPLETE_NORMALLY (nn) = 1;
10235 POP_LABELED_BLOCK ();
10236 }
10237 POP_LOOP ();
10238 return nn;
10239
10240 case EXIT_EXPR:
10241 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
10242 return patch_exit_expr (node);
10243
10244 case COND_EXPR:
10245 /* Condition */
10246 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
10247 if (TREE_OPERAND (node, 0) == error_mark_node)
10248 return error_mark_node;
10249 /* then-else branches */
10250 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
10251 if (TREE_OPERAND (node, 1) == error_mark_node)
10252 return error_mark_node;
10253 TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2));
10254 if (TREE_OPERAND (node, 2) == error_mark_node)
10255 return error_mark_node;
10256 return patch_if_else_statement (node);
10257 break;
10258
10259 case CONDITIONAL_EXPR:
10260 /* Condition */
10261 wfl_op1 = TREE_OPERAND (node, 0);
10262 COMPLETE_CHECK_OP_0 (node);
10263 wfl_op2 = TREE_OPERAND (node, 1);
10264 COMPLETE_CHECK_OP_1 (node);
10265 wfl_op3 = TREE_OPERAND (node, 2);
10266 COMPLETE_CHECK_OP_2 (node);
10267 return patch_conditional_expr (node, wfl_op1, wfl_op2);
10268
10269 /* 3- Expression section */
10270 case COMPOUND_EXPR:
10271 wfl_op2 = TREE_OPERAND (node, 1);
10272 TREE_OPERAND (node, 0) = nn =
10273 java_complete_tree (TREE_OPERAND (node, 0));
10274 if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK
10275 && TREE_OPERAND (node, 1) != empty_stmt_node)
10276 {
10277 SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
10278 parse_error_context (wfl_operator, "Unreachable statement");
10279 }
10280 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
10281 if (TREE_OPERAND (node, 1) == error_mark_node)
10282 return error_mark_node;
10283 TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1));
10284 CAN_COMPLETE_NORMALLY (node)
10285 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1));
10286 break;
10287
10288 case RETURN_EXPR:
10289 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10290 return patch_return (node);
10291
10292 case EXPR_WITH_FILE_LOCATION:
10293 if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
10294 || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
10295 {
10296 node = resolve_expression_name (node, NULL);
10297 CAN_COMPLETE_NORMALLY (node) = 1;
10298 }
10299 else
10300 {
10301 tree body;
10302 int save_lineno = lineno;
10303 lineno = EXPR_WFL_LINENO (node);
10304 body = java_complete_tree (EXPR_WFL_NODE (node));
10305 lineno = save_lineno;
10306 EXPR_WFL_NODE (node) = body;
10307 TREE_SIDE_EFFECTS (node) = 1;
10308 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
10309 if (EXPR_WFL_NODE (node) == error_mark_node)
10310 {
10311 /* Its important for the evaluation of assignment that
10312 this mark on the TREE_TYPE is propagated. */
10313 TREE_TYPE (node) = error_mark_node;
10314 return error_mark_node;
10315 }
10316 else
10317 TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node));
10318
10319 }
10320 break;
10321
10322 case NEW_ARRAY_EXPR:
10323 /* Patch all the dimensions */
10324 flag = 0;
10325 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
10326 {
10327 int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
10328 tree dim = java_complete_tree (TREE_VALUE (cn));
10329 if (dim == error_mark_node)
10330 {
10331 flag = 1;
10332 continue;
10333 }
10334 else
10335 {
10336 TREE_VALUE (cn) = dim;
10337 /* Setup the location of the current dimension, for
10338 later error report. */
10339 TREE_PURPOSE (cn) =
10340 build_expr_wfl (NULL_TREE, input_filename, 0, 0);
10341 EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
10342 }
10343 }
10344 /* They complete the array creation expression, if no errors
10345 were found. */
10346 CAN_COMPLETE_NORMALLY (node) = 1;
10347 return (flag ? error_mark_node : patch_newarray (node));
10348
10349 case NEW_CLASS_EXPR:
10350 case CALL_EXPR:
10351 /* Complete function's argument(s) first */
10352 if (complete_function_arguments (node))
10353 return error_mark_node;
10354 else
10355 {
10356 tree decl, wfl = TREE_OPERAND (node, 0);
10357 int in_this = CALL_THIS_CONSTRUCTOR_P (node);
10358
10359 node = patch_method_invocation (node, NULL_TREE,
10360 NULL_TREE, 0, &decl);
10361 if (node == error_mark_node)
10362 return error_mark_node;
10363
10364 check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl);
10365 /* If we call this(...), register signature and positions */
10366 if (in_this)
10367 DECL_CONSTRUCTOR_CALLS (current_function_decl) =
10368 tree_cons (wfl, decl,
10369 DECL_CONSTRUCTOR_CALLS (current_function_decl));
10370 CAN_COMPLETE_NORMALLY (node) = 1;
10371 return node;
10372 }
10373
10374 case MODIFY_EXPR:
10375 /* Save potential wfls */
10376 wfl_op1 = TREE_OPERAND (node, 0);
10377 wfl_op2 = TREE_OPERAND (node, 1);
10378 TREE_OPERAND (node, 0) = java_complete_lhs (wfl_op1);
10379 if (TREE_OPERAND (node, 0) == error_mark_node)
10380 return error_mark_node;
10381
10382 if (COMPOUND_ASSIGN_P (wfl_op2))
10383 {
10384 tree lvalue;
10385 tree other =
10386 java_complete_tree (TREE_OPERAND (wfl_op2, 0));
10387
10388 /* Hand stablize the lhs on both places */
10389 lvalue = stabilize_reference (other);
10390 TREE_OPERAND (node, 0) = lvalue;
10391 TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue;
10392 }
10393
10394 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
10395 function to complete this RHS */
10396 if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT)
10397 nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)),
10398 TREE_OPERAND (node, 1));
10399 else
10400 nn = java_complete_tree (TREE_OPERAND (node, 1));
10401
10402 /* There are cases where the type of RHS is fixed. In those
10403 cases, if the evaluation of the RHS fails, we further the
10404 evaluation of the assignment to detect more errors. */
10405 if (nn == error_mark_node)
10406 {
10407 /* It's hopeless, but we can further things on to discover
10408 an error during the assignment. In any cases, the
10409 assignment operation fails. */
10410 if (TREE_CODE (TREE_OPERAND (node, 1)) != EXPR_WITH_FILE_LOCATION
10411 && TREE_CODE (TREE_OPERAND (node, 1)) != NEW_ARRAY_INIT
10412 && TREE_TYPE (TREE_OPERAND (node, 1)) != error_mark_node)
10413 patch_assignment (node, wfl_op1, wfl_op2);
10414
10415 /* Now, we still mark the lhs as initialized */
10416 if (DECL_P (TREE_OPERAND (node, 0)))
10417 INITIALIZED_P (TREE_OPERAND (node, 0)) = 1;
10418
10419 return error_mark_node;
10420 }
10421 TREE_OPERAND (node, 1) = nn;
10422
10423 /* In case we're handling = with a String as a RHS, we need to
10424 produce a String out of the RHS (it might still be a
10425 STRING_CST or a StringBuffer at this stage */
10426 if ((nn = patch_string (TREE_OPERAND (node, 1))))
10427 TREE_OPERAND (node, 1) = nn;
10428 node = patch_assignment (node, wfl_op1, wfl_op2);
10429 CAN_COMPLETE_NORMALLY (node) = 1;
10430
10431 /* Before returning the node, in the context of a static field
10432 assignment in <clinit>, we may want to carray further
10433 optimizations. (VAR_DECL means it's a static field. See
10434 add_field. */
10435 if (DECL_NAME (current_function_decl) == clinit_identifier_node
10436 && MODIFY_EXPR_FROM_INITIALIZATION_P (node)
10437 && TREE_CODE (TREE_OPERAND (node, 0)) == VAR_DECL)
10438 node = patch_initialized_static_field (node);
10439
10440 return node;
10441
10442 case MULT_EXPR:
10443 case PLUS_EXPR:
10444 case MINUS_EXPR:
10445 case LSHIFT_EXPR:
10446 case RSHIFT_EXPR:
10447 case URSHIFT_EXPR:
10448 case BIT_AND_EXPR:
10449 case BIT_XOR_EXPR:
10450 case BIT_IOR_EXPR:
10451 case TRUNC_MOD_EXPR:
10452 case RDIV_EXPR:
10453 case TRUTH_ANDIF_EXPR:
10454 case TRUTH_ORIF_EXPR:
10455 case EQ_EXPR:
10456 case NE_EXPR:
10457 case GT_EXPR:
10458 case GE_EXPR:
10459 case LT_EXPR:
10460 case LE_EXPR:
10461 /* Operands 0 and 1 are WFL in certain cases only. patch_binop
10462 knows how to handle those cases. */
10463 wfl_op1 = TREE_OPERAND (node, 0);
10464 wfl_op2 = TREE_OPERAND (node, 1);
10465
10466 CAN_COMPLETE_NORMALLY (node) = 1;
10467 /* Don't complete string nodes if dealing with the PLUS operand. */
10468 if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1))
10469 {
10470 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
10471 if (TREE_OPERAND (node, 0) == error_mark_node)
10472 return error_mark_node;
10473 }
10474 if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2))
10475 {
10476 TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
10477 if (TREE_OPERAND (node, 1) == error_mark_node)
10478 return error_mark_node;
10479 }
10480 return patch_binop (node, wfl_op1, wfl_op2);
10481
10482 case INSTANCEOF_EXPR:
10483 wfl_op1 = TREE_OPERAND (node, 0);
10484 COMPLETE_CHECK_OP_0 (node);
10485 return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1));
10486
10487 case UNARY_PLUS_EXPR:
10488 case NEGATE_EXPR:
10489 case TRUTH_NOT_EXPR:
10490 case BIT_NOT_EXPR:
10491 case PREDECREMENT_EXPR:
10492 case PREINCREMENT_EXPR:
10493 case POSTDECREMENT_EXPR:
10494 case POSTINCREMENT_EXPR:
10495 case CONVERT_EXPR:
10496 /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
10497 how to handle those cases. */
10498 wfl_op1 = TREE_OPERAND (node, 0);
10499 CAN_COMPLETE_NORMALLY (node) = 1;
10500 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
10501 if (TREE_OPERAND (node, 0) == error_mark_node)
10502 return error_mark_node;
10503 node = patch_unaryop (node, wfl_op1);
10504 CAN_COMPLETE_NORMALLY (node) = 1;
10505 break;
10506
10507 case ARRAY_REF:
10508 /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
10509 how to handle those cases. */
10510 wfl_op1 = TREE_OPERAND (node, 0);
10511 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
10512 if (TREE_OPERAND (node, 0) == error_mark_node)
10513 return error_mark_node;
10514 if (!flag_emit_class_files)
10515 TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0));
10516 /* The same applies to wfl_op2 */
10517 wfl_op2 = TREE_OPERAND (node, 1);
10518 TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
10519 if (TREE_OPERAND (node, 1) == error_mark_node)
10520 return error_mark_node;
10521 if (!flag_emit_class_files)
10522 TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1));
10523 return patch_array_ref (node);
10524
10525 case RECORD_TYPE:
10526 return node;;
10527
10528 case COMPONENT_REF:
10529 /* The first step in the re-write of qualified name handling. FIXME.
10530 So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
10531 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
10532 if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE)
10533 {
10534 tree name = TREE_OPERAND (node, 1);
10535 tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name);
10536 if (field == NULL_TREE)
10537 {
10538 error ("missing static field `%s'", IDENTIFIER_POINTER (name));
10539 return error_mark_node;
10540 }
10541 if (! FIELD_STATIC (field))
10542 {
10543 error ("not a static field `%s'", IDENTIFIER_POINTER (name));
10544 return error_mark_node;
10545 }
10546 return field;
10547 }
10548 else
10549 fatal ("unimplemented java_complete_tree for COMPONENT_REF");
10550 break;
10551
10552 case THIS_EXPR:
10553 /* Can't use THIS in a static environment */
10554 if (!current_this)
10555 {
10556 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10557 parse_error_context (wfl_operator, "Keyword `this' used outside "
10558 "allowed context");
10559 TREE_TYPE (node) = error_mark_node;
10560 return error_mark_node;
10561 }
10562 if (ctxp->explicit_constructor_p)
10563 {
10564 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10565 parse_error_context
10566 (wfl_operator, "Can't reference `this' or `super' before the "
10567 "superclass constructor has been called");
10568 TREE_TYPE (node) = error_mark_node;
10569 return error_mark_node;
10570 }
10571 return current_this;
10572
10573 default:
10574 CAN_COMPLETE_NORMALLY (node) = 1;
10575 /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
10576 and it's time to turn it into the appropriate String object
10577 */
10578 if ((node = patch_string (node)))
10579 return node;
10580 fatal ("No case for tree code `%s' - java_complete_tree\n",
10581 tree_code_name [TREE_CODE (node)]);
10582 }
10583 return node;
10584 }
10585
10586 /* Complete function call's argument. Return a non zero value is an
10587 error was found. */
10588
10589 static int
10590 complete_function_arguments (node)
10591 tree node;
10592 {
10593 int flag = 0;
10594 tree cn;
10595
10596 ctxp->explicit_constructor_p += (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
10597 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
10598 {
10599 tree wfl = TREE_VALUE (cn), parm, temp;
10600 parm = java_complete_tree (wfl);
10601 if (parm == error_mark_node)
10602 {
10603 flag = 1;
10604 continue;
10605 }
10606 /* If have a string literal that we haven't transformed yet or a
10607 crafted string buffer, as a result of use of the the String
10608 `+' operator. Build `parm.toString()' and expand it. */
10609 if ((temp = patch_string (parm)))
10610 parm = temp;
10611 /* Inline PRIMTYPE.TYPE read access */
10612 parm = maybe_build_primttype_type_ref (parm, wfl);
10613
10614 TREE_VALUE (cn) = parm;
10615 }
10616 ctxp->explicit_constructor_p -= (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
10617 return flag;
10618 }
10619
10620 /* Sometimes (for loops and variable initialized during their
10621 declaration), we want to wrap a statement around a WFL and turn it
10622 debugable. */
10623
10624 static tree
10625 build_debugable_stmt (location, stmt)
10626 int location;
10627 tree stmt;
10628 {
10629 if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
10630 {
10631 stmt = build_expr_wfl (stmt, input_filename, 0, 0);
10632 EXPR_WFL_LINECOL (stmt) = location;
10633 }
10634 JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
10635 return stmt;
10636 }
10637
10638 static tree
10639 build_expr_block (body, decls)
10640 tree body, decls;
10641 {
10642 tree node = make_node (BLOCK);
10643 BLOCK_EXPR_DECLS (node) = decls;
10644 BLOCK_EXPR_BODY (node) = body;
10645 if (body)
10646 TREE_TYPE (node) = TREE_TYPE (body);
10647 TREE_SIDE_EFFECTS (node) = 1;
10648 return node;
10649 }
10650
10651 /* Create a new function block and link it approriately to current
10652 function block chain */
10653
10654 static tree
10655 enter_block ()
10656 {
10657 return (enter_a_block (build_expr_block (NULL_TREE, NULL_TREE)));
10658 }
10659
10660 /* Link block B supercontext to the previous block. The current
10661 function DECL is used as supercontext when enter_a_block is called
10662 for the first time for a given function. The current function body
10663 (DECL_FUNCTION_BODY) is set to be block B. */
10664
10665 static tree
10666 enter_a_block (b)
10667 tree b;
10668 {
10669 tree fndecl = current_function_decl;
10670
10671 if (!DECL_FUNCTION_BODY (fndecl))
10672 {
10673 BLOCK_SUPERCONTEXT (b) = fndecl;
10674 DECL_FUNCTION_BODY (fndecl) = b;
10675 }
10676 else
10677 {
10678 BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl);
10679 DECL_FUNCTION_BODY (fndecl) = b;
10680 }
10681 return b;
10682 }
10683
10684 /* Exit a block by changing the current function body
10685 (DECL_FUNCTION_BODY) to the current block super context, only if
10686 the block being exited isn't the method's top level one. */
10687
10688 static tree
10689 exit_block ()
10690 {
10691 tree b = DECL_FUNCTION_BODY (current_function_decl);
10692
10693 if (BLOCK_SUPERCONTEXT (b) != current_function_decl)
10694 DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b);
10695
10696 return b;
10697 }
10698
10699 /* Lookup for NAME in the nested function's blocks, all the way up to
10700 the current toplevel one. It complies with Java's local variable
10701 scoping rules. */
10702
10703 static tree
10704 lookup_name_in_blocks (name)
10705 tree name;
10706 {
10707 tree b = DECL_FUNCTION_BODY (current_function_decl);
10708
10709 while (b != current_function_decl)
10710 {
10711 tree current;
10712
10713 /* Paranoid sanity check. To be removed */
10714 if (TREE_CODE (b) != BLOCK)
10715 fatal ("non block expr function body - lookup_name_in_blocks");
10716
10717 for (current = BLOCK_EXPR_DECLS (b); current;
10718 current = TREE_CHAIN (current))
10719 if (DECL_NAME (current) == name)
10720 return current;
10721 b = BLOCK_SUPERCONTEXT (b);
10722 }
10723 return NULL_TREE;
10724 }
10725
10726 static void
10727 maybe_absorb_scoping_blocks ()
10728 {
10729 while (BLOCK_EXPR_ORIGIN (DECL_FUNCTION_BODY (current_function_decl)))
10730 {
10731 tree b = exit_block ();
10732 java_method_add_stmt (current_function_decl, b);
10733 SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno));
10734 }
10735 }
10736
10737 \f
10738 /* This section of the source is reserved to build_* functions that
10739 are building incomplete tree nodes and the patch_* functions that
10740 are completing them. */
10741
10742 /* Build a super() constructor invocation. Returns empty_stmt_node if
10743 we're currently dealing with the class java.lang.Object. */
10744
10745 static tree
10746 build_super_invocation ()
10747 {
10748 if (current_class == object_type_node)
10749 return empty_stmt_node;
10750 else
10751 {
10752 tree super_wfl = build_wfl_node (super_identifier_node,
10753 input_filename, 0, 0);
10754 return build_method_invocation (super_wfl, NULL_TREE);
10755 }
10756 }
10757
10758 /* Build a SUPER/THIS qualified method invocation. */
10759
10760 static tree
10761 build_this_super_qualified_invocation (use_this, name, args, lloc, rloc)
10762 int use_this;
10763 tree name, args;
10764 int lloc, rloc;
10765
10766 {
10767 tree invok;
10768 tree wfl =
10769 build_wfl_node ((use_this ? this_identifier_node : super_identifier_node),
10770 input_filename, 0, 0);
10771 EXPR_WFL_LINECOL (wfl) = lloc;
10772 invok = build_method_invocation (name, args);
10773 return make_qualified_primary (wfl, invok, rloc);
10774 }
10775
10776 /* Build an incomplete CALL_EXPR node. */
10777
10778 static tree
10779 build_method_invocation (name, args)
10780 tree name;
10781 tree args;
10782 {
10783 tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE);
10784 TREE_SIDE_EFFECTS (call) = 1;
10785 EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
10786 return call;
10787 }
10788
10789 /* Build an incomplete new xxx(...) node. */
10790
10791 static tree
10792 build_new_invocation (name, args)
10793 tree name, args;
10794 {
10795 tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE);
10796 TREE_SIDE_EFFECTS (call) = 1;
10797 EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
10798 return call;
10799 }
10800
10801 /* Build an incomplete assignment expression. */
10802
10803 static tree
10804 build_assignment (op, op_location, lhs, rhs)
10805 int op, op_location;
10806 tree lhs, rhs;
10807 {
10808 tree assignment;
10809 /* Build the corresponding binop if we deal with a Compound
10810 Assignment operator. Mark the binop sub-tree as part of a
10811 Compound Assignment expression */
10812 if (op != ASSIGN_TK)
10813 {
10814 rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs);
10815 COMPOUND_ASSIGN_P (rhs) = 1;
10816 }
10817 assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs);
10818 TREE_SIDE_EFFECTS (assignment) = 1;
10819 EXPR_WFL_LINECOL (assignment) = op_location;
10820 return assignment;
10821 }
10822
10823 /* Print an INTEGER_CST node in a static buffer, and return the buffer. */
10824
10825 char *
10826 print_int_node (node)
10827 tree node;
10828 {
10829 static char buffer [80];
10830 if (TREE_CONSTANT_OVERFLOW (node))
10831 sprintf (buffer, "<overflow>");
10832
10833 if (TREE_INT_CST_HIGH (node) == 0)
10834 sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED,
10835 TREE_INT_CST_LOW (node));
10836 else if (TREE_INT_CST_HIGH (node) == -1
10837 && TREE_INT_CST_LOW (node) != 0)
10838 {
10839 buffer [0] = '-';
10840 sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED,
10841 -TREE_INT_CST_LOW (node));
10842 }
10843 else
10844 sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
10845 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
10846
10847 return buffer;
10848 }
10849
10850 /* Return 1 if you an assignment of a FINAL is attempted */
10851
10852 static int
10853 check_final_assignment (lvalue, wfl)
10854 tree lvalue, wfl;
10855 {
10856 if (DECL_P (lvalue) && FIELD_FINAL (lvalue) &&
10857 DECL_NAME (current_function_decl) != clinit_identifier_node)
10858 {
10859 parse_error_context
10860 (wfl, "Can't assign a value to the final variable `%s'",
10861 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
10862 return 1;
10863 }
10864 return 0;
10865 }
10866
10867 /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
10868 read. This is needed to avoid circularities in the implementation
10869 of these fields in libjava. */
10870
10871 static tree
10872 maybe_build_primttype_type_ref (rhs, wfl)
10873 tree rhs, wfl;
10874 {
10875 tree to_return = NULL_TREE;
10876 tree rhs_type = TREE_TYPE (rhs);
10877 if (TREE_CODE (rhs) == COMPOUND_EXPR)
10878 {
10879 tree n = TREE_OPERAND (rhs, 1);
10880 if (TREE_CODE (n) == VAR_DECL
10881 && DECL_NAME (n) == TYPE_identifier_node
10882 && rhs_type == class_ptr_type)
10883 {
10884 char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
10885 if (!strncmp (self_name, "java.lang.", 10))
10886 to_return = build_primtype_type_ref (self_name);
10887 }
10888 }
10889 return (to_return ? to_return : rhs );
10890 }
10891
10892 /* 15.25 Assignment operators. */
10893
10894 static tree
10895 patch_assignment (node, wfl_op1, wfl_op2)
10896 tree node;
10897 tree wfl_op1;
10898 tree wfl_op2;
10899 {
10900 tree rhs = TREE_OPERAND (node, 1);
10901 tree lvalue = TREE_OPERAND (node, 0), llvalue;
10902 tree lhs_type, rhs_type, new_rhs = NULL_TREE;
10903 int error_found = 0;
10904 int lvalue_from_array = 0;
10905
10906 /* Can't assign to a final. */
10907 if (check_final_assignment (lvalue, wfl_op1))
10908 error_found = 1;
10909
10910 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10911
10912 /* Lhs can be a named variable */
10913 if (DECL_P (lvalue))
10914 {
10915 INITIALIZED_P (lvalue) = 1;
10916 lhs_type = TREE_TYPE (lvalue);
10917 }
10918 /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
10919 comment on reason why */
10920 else if (TREE_CODE (wfl_op1) == ARRAY_REF)
10921 {
10922 lhs_type = TREE_TYPE (lvalue);
10923 lvalue_from_array = 1;
10924 }
10925 /* Or a field access */
10926 else if (TREE_CODE (lvalue) == COMPONENT_REF)
10927 lhs_type = TREE_TYPE (lvalue);
10928 /* Or a function return slot */
10929 else if (TREE_CODE (lvalue) == RESULT_DECL)
10930 lhs_type = TREE_TYPE (lvalue);
10931 /* Otherwise, we might want to try to write into an optimized static
10932 final, this is an of a different nature, reported further on. */
10933 else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION
10934 && resolve_expression_name (wfl_op1, &llvalue)
10935 && check_final_assignment (llvalue, wfl_op1))
10936 {
10937 error_found = 1;
10938 /* What we should do instead is resetting the all the flags
10939 previously set, exchange lvalue for llvalue and continue. */
10940 return error_mark_node;
10941 }
10942 else
10943 {
10944 parse_error_context (wfl_op1, "Invalid left hand side of assignment");
10945 error_found = 1;
10946 }
10947
10948 rhs_type = TREE_TYPE (rhs);
10949 /* 5.1 Try the assignment conversion for builtin type. */
10950 new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs);
10951
10952 /* 5.2 If it failed, try a reference conversion */
10953 if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs)))
10954 lhs_type = promote_type (rhs_type);
10955
10956 /* 15.25.2 If we have a compound assignment, convert RHS into the
10957 type of the LHS */
10958 else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
10959 new_rhs = convert (lhs_type, rhs);
10960
10961 /* Explicit cast required. This is an error */
10962 if (!new_rhs)
10963 {
10964 char *t1 = strdup (lang_printable_name (TREE_TYPE (rhs), 0));
10965 char *t2 = strdup (lang_printable_name (lhs_type, 0));
10966 tree wfl;
10967 char operation [32]; /* Max size known */
10968
10969 /* If the assignment is part of a declaration, we use the WFL of
10970 the declared variable to point out the error and call it a
10971 declaration problem. If the assignment is a genuine =
10972 operator, we call is a operator `=' problem, otherwise we
10973 call it an assignment problem. In both of these last cases,
10974 we use the WFL of the operator to indicate the error. */
10975
10976 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node))
10977 {
10978 wfl = wfl_op1;
10979 strcpy (operation, "declaration");
10980 }
10981 else
10982 {
10983 wfl = wfl_operator;
10984 if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
10985 strcpy (operation, "assignment");
10986 else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL)
10987 strcpy (operation, "`return'");
10988 else
10989 strcpy (operation, "`='");
10990 }
10991
10992 parse_error_context
10993 (wfl, (!valid_cast_to_p (rhs_type, lhs_type) ?
10994 "Incompatible type for %s. Can't convert `%s' to `%s'" :
10995 "Incompatible type for %s. Explicit cast "
10996 "needed to convert `%s' to `%s'"), operation, t1, t2);
10997 free (t1); free (t2);
10998 error_found = 1;
10999 }
11000
11001 /* Inline read access to java.lang.PRIMTYPE.TYPE */
11002 if (new_rhs)
11003 new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2);
11004
11005 if (error_found)
11006 return error_mark_node;
11007
11008 /* If we built a compound expression as the result of a reference
11009 assignment into an array element, return it here. */
11010 if (TREE_CODE (node) == COMPOUND_EXPR)
11011 return node;
11012
11013 TREE_OPERAND (node, 0) = lvalue;
11014 TREE_OPERAND (node, 1) = new_rhs;
11015 TREE_TYPE (node) = lhs_type;
11016 return node;
11017 }
11018
11019 /* Optimize static (final) field initialized upon declaration.
11020 - If the field is static final and is assigned to a primitive
11021 constant type, then set its DECL_INITIAL to the value.
11022 - More to come. */
11023
11024 static tree
11025 patch_initialized_static_field (node)
11026 tree node;
11027 {
11028 tree field = TREE_OPERAND (node, 0);
11029 tree value = TREE_OPERAND (node, 1);
11030
11031 if (DECL_INITIAL (field) != NULL_TREE)
11032 {
11033 tree type = TREE_TYPE (value);
11034 if (FIELD_FINAL (field) && TREE_CONSTANT (value)
11035 && (JPRIMITIVE_TYPE_P (type)
11036 || (flag_emit_class_files
11037 && TREE_CODE (type) == POINTER_TYPE
11038 && TREE_TYPE (type) == string_type_node)))
11039 {
11040 DECL_INITIAL (field) = value;
11041 return empty_stmt_node;
11042 }
11043 DECL_INITIAL (field) = NULL_TREE;
11044 }
11045 return node;
11046 }
11047
11048 /* Check that type SOURCE can be cast into type DEST. If the cast
11049 can't occur at all, return 0 otherwise 1. This function is used to
11050 produce accurate error messages on the reasons why an assignment
11051 failed. */
11052
11053 static tree
11054 try_reference_assignconv (lhs_type, rhs)
11055 tree lhs_type, rhs;
11056 {
11057 tree new_rhs = NULL_TREE;
11058 tree rhs_type = TREE_TYPE (rhs);
11059
11060 if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type))
11061 {
11062 /* `null' may be assigned to any reference type */
11063 if (rhs == null_pointer_node)
11064 new_rhs = null_pointer_node;
11065 /* Try the reference assignment conversion */
11066 else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0))
11067 new_rhs = rhs;
11068 /* This is a magic assignment that we process differently */
11069 else if (rhs == soft_exceptioninfo_call_node)
11070 new_rhs = rhs;
11071 }
11072 return new_rhs;
11073 }
11074
11075 /* Check that RHS can be converted into LHS_TYPE by the assignment
11076 conversion (5.2), for the cases of RHS being a builtin type. Return
11077 NULL_TREE if the conversion fails or if because RHS isn't of a
11078 builtin type. Return a converted RHS if the conversion is possible. */
11079
11080 static tree
11081 try_builtin_assignconv (wfl_op1, lhs_type, rhs)
11082 tree wfl_op1, lhs_type, rhs;
11083 {
11084 tree new_rhs = NULL_TREE;
11085 tree rhs_type = TREE_TYPE (rhs);
11086
11087 /* Zero accepted everywhere */
11088 if (TREE_CODE (rhs) == INTEGER_CST
11089 && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0
11090 && JPRIMITIVE_TYPE_P (rhs_type))
11091 new_rhs = convert (lhs_type, rhs);
11092
11093 /* 5.1.1 Try Identity Conversion,
11094 5.1.2 Try Widening Primitive Conversion */
11095 else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type))
11096 new_rhs = convert (lhs_type, rhs);
11097
11098 /* Try a narrowing primitive conversion (5.1.3):
11099 - expression is a constant expression of type int AND
11100 - variable is byte, short or char AND
11101 - The value of the expression is representable in the type of the
11102 variable */
11103 else if (rhs_type == int_type_node && TREE_CONSTANT (rhs)
11104 && (lhs_type == byte_type_node || lhs_type == char_type_node
11105 || lhs_type == short_type_node))
11106 {
11107 if (int_fits_type_p (rhs, lhs_type))
11108 new_rhs = convert (lhs_type, rhs);
11109 else if (wfl_op1) /* Might be called with a NULL */
11110 parse_warning_context
11111 (wfl_op1, "Constant expression `%s' to wide for narrowing "
11112 "primitive conversion to `%s'",
11113 print_int_node (rhs), lang_printable_name (lhs_type, 0));
11114 /* Reported a warning that will turn into an error further
11115 down, so we don't return */
11116 }
11117
11118 return new_rhs;
11119 }
11120
11121 /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
11122 conversion (5.1.1) or widening primitve conversion (5.1.2). Return
11123 0 is the conversion test fails. This implements parts the method
11124 invocation convertion (5.3). */
11125
11126 static int
11127 valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)
11128 tree lhs_type, rhs_type;
11129 {
11130 int all_primitive;
11131
11132 if (lhs_type == rhs_type)
11133 return 1;
11134
11135 /* Sometimes, instead of passing a type, we pass integer_zero_node
11136 so we know that an integral type can accomodate it */
11137 if (JINTEGRAL_TYPE_P (lhs_type) && (rhs_type == integer_zero_node))
11138 return 1;
11139
11140 all_primitive =
11141 JPRIMITIVE_TYPE_P (lhs_type) && JPRIMITIVE_TYPE_P (rhs_type);
11142
11143 if (!all_primitive)
11144 return 0;
11145
11146 /* byte, even if it's smaller than a char can't be converted into a
11147 char. Short can't too, but the < test below takes care of that */
11148 if (lhs_type == char_type_node && rhs_type == byte_type_node)
11149 return 0;
11150
11151 /* Accept all promoted type here. Note, we can't use <= in the test
11152 below, because we still need to bounce out assignments of short
11153 to char and the likes */
11154 if (lhs_type == int_type_node
11155 && (rhs_type == promoted_byte_type_node
11156 || rhs_type == promoted_short_type_node
11157 || rhs_type == promoted_char_type_node
11158 || rhs_type == promoted_boolean_type_node))
11159 return 1;
11160
11161 if (JINTEGRAL_TYPE_P (rhs_type)
11162 && ((TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type))
11163 || (JFLOAT_TYPE_P (lhs_type) &&
11164 TYPE_PRECISION (rhs_type) == TYPE_PRECISION (lhs_type))))
11165 return 1;
11166 else if (JFLOAT_TYPE_P (rhs_type)
11167 && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)))
11168 return 1;
11169
11170 return 0;
11171 }
11172
11173 /* Check that something of SOURCE type can be assigned or cast to
11174 something of DEST type at runtime. Return 1 if the operation is
11175 valid, 0 otherwise. If CAST is set to 1, we're treating the case
11176 were SOURCE is cast into DEST, which borrows a lot of the
11177 assignment check. */
11178
11179 static int
11180 valid_ref_assignconv_cast_p (source, dest, cast)
11181 tree source;
11182 tree dest;
11183 int cast;
11184 {
11185 if (JNULLP_TYPE_P (source))
11186 return 1;
11187 if (TREE_CODE (source) == POINTER_TYPE)
11188 source = TREE_TYPE (source);
11189 if (TREE_CODE (dest) == POINTER_TYPE)
11190 dest = TREE_TYPE (dest);
11191 /* Case where SOURCE is a class type */
11192 if (TYPE_CLASS_P (source))
11193 {
11194 if (TYPE_CLASS_P (dest))
11195 return source == dest || inherits_from_p (source, dest)
11196 || (cast && inherits_from_p (dest, source));
11197 if (TYPE_INTERFACE_P (dest))
11198 {
11199 /* If doing a cast and SOURCE is final, the operation is
11200 always correct a compile time (because even if SOURCE
11201 does not implement DEST, a subclass of SOURCE might). */
11202 if (cast && !CLASS_FINAL (TYPE_NAME (source)))
11203 return 1;
11204 /* Otherwise, SOURCE must implement DEST */
11205 return interface_of_p (dest, source);
11206 }
11207 /* DEST is an array, cast permited if SOURCE is of Object type */
11208 return (cast && source == object_type_node ? 1 : 0);
11209 }
11210 if (TYPE_INTERFACE_P (source))
11211 {
11212 if (TYPE_CLASS_P (dest))
11213 {
11214 /* If not casting, DEST must be the Object type */
11215 if (!cast)
11216 return dest == object_type_node;
11217 /* We're doing a cast. The cast is always valid is class
11218 DEST is not final, otherwise, DEST must implement SOURCE */
11219 else if (!CLASS_FINAL (TYPE_NAME (dest)))
11220 return 1;
11221 else
11222 return interface_of_p (source, dest);
11223 }
11224 if (TYPE_INTERFACE_P (dest))
11225 {
11226 /* If doing a cast, then if SOURCE and DEST contain method
11227 with the same signature but different return type, then
11228 this is a (compile time) error */
11229 if (cast)
11230 {
11231 tree method_source, method_dest;
11232 tree source_type;
11233 tree source_sig;
11234 tree source_name;
11235 for (method_source = TYPE_METHODS (source); method_source;
11236 method_source = TREE_CHAIN (method_source))
11237 {
11238 source_sig =
11239 build_java_argument_signature (TREE_TYPE (method_source));
11240 source_type = TREE_TYPE (TREE_TYPE (method_source));
11241 source_name = DECL_NAME (method_source);
11242 for (method_dest = TYPE_METHODS (dest);
11243 method_dest; method_dest = TREE_CHAIN (method_dest))
11244 if (source_sig ==
11245 build_java_argument_signature (TREE_TYPE (method_dest))
11246 && source_name == DECL_NAME (method_dest)
11247 && source_type != TREE_TYPE (TREE_TYPE (method_dest)))
11248 return 0;
11249 }
11250 return 1;
11251 }
11252 else
11253 return source == dest || interface_of_p (dest, source);
11254 }
11255 else /* Array */
11256 return 0;
11257 }
11258 if (TYPE_ARRAY_P (source))
11259 {
11260 if (TYPE_CLASS_P (dest))
11261 return dest == object_type_node;
11262 if (TYPE_INTERFACE_P (dest))
11263 return 0; /* Install test on Clonable. FIXME */
11264 else /* Arrays */
11265 {
11266 tree source_element_type = TYPE_ARRAY_ELEMENT (source);
11267 tree dest_element_type = TYPE_ARRAY_ELEMENT (dest);
11268
11269 /* In case of severe errors, they turn out null */
11270 if (!dest_element_type || !source_element_type)
11271 return 0;
11272 if (source_element_type == dest_element_type)
11273 return 1;
11274 return valid_ref_assignconv_cast_p (source_element_type,
11275 dest_element_type, cast);
11276 }
11277 return 0;
11278 }
11279 return 0;
11280 }
11281
11282 static int
11283 valid_cast_to_p (source, dest)
11284 tree source;
11285 tree dest;
11286 {
11287 if (TREE_CODE (source) == POINTER_TYPE)
11288 source = TREE_TYPE (source);
11289 if (TREE_CODE (dest) == POINTER_TYPE)
11290 dest = TREE_TYPE (dest);
11291
11292 if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE)
11293 return valid_ref_assignconv_cast_p (source, dest, 1);
11294
11295 else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest))
11296 return 1;
11297
11298 return 0;
11299 }
11300
11301 /* Method invocation conversion test. Return 1 if type SOURCE can be
11302 converted to type DEST through the methond invocation conversion
11303 process (5.3) */
11304
11305 static tree
11306 do_unary_numeric_promotion (arg)
11307 tree arg;
11308 {
11309 tree type = TREE_TYPE (arg);
11310 if (TREE_CODE (type) == INTEGER_TYPE ? TYPE_PRECISION (type) < 32
11311 : TREE_CODE (type) == CHAR_TYPE)
11312 arg = convert (int_type_node, arg);
11313 return arg;
11314 }
11315
11316 static int
11317 valid_method_invocation_conversion_p (dest, source)
11318 tree dest, source;
11319 {
11320 return (((JPRIMITIVE_TYPE_P (source) || (source == integer_zero_node))
11321 && JPRIMITIVE_TYPE_P (dest)
11322 && valid_builtin_assignconv_identity_widening_p (dest, source))
11323 || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source))
11324 && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest))
11325 && valid_ref_assignconv_cast_p (source, dest, 0)));
11326 }
11327
11328 /* Build an incomplete binop expression. */
11329
11330 static tree
11331 build_binop (op, op_location, op1, op2)
11332 enum tree_code op;
11333 int op_location;
11334 tree op1, op2;
11335 {
11336 tree binop = build (op, NULL_TREE, op1, op2);
11337 TREE_SIDE_EFFECTS (binop) = 1;
11338 /* Store the location of the operator, for better error report. The
11339 string of the operator will be rebuild based on the OP value. */
11340 EXPR_WFL_LINECOL (binop) = op_location;
11341 return binop;
11342 }
11343
11344 /* Build the string of the operator retained by NODE. If NODE is part
11345 of a compound expression, add an '=' at the end of the string. This
11346 function is called when an error needs to be reported on an
11347 operator. The string is returned as a pointer to a static character
11348 buffer. */
11349
11350 static char *
11351 operator_string (node)
11352 tree node;
11353 {
11354 #define BUILD_OPERATOR_STRING(S) \
11355 { \
11356 sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
11357 return buffer; \
11358 }
11359
11360 static char buffer [10];
11361 switch (TREE_CODE (node))
11362 {
11363 case MULT_EXPR: BUILD_OPERATOR_STRING ("*");
11364 case RDIV_EXPR: BUILD_OPERATOR_STRING ("/");
11365 case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%");
11366 case PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
11367 case MINUS_EXPR: BUILD_OPERATOR_STRING ("-");
11368 case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<");
11369 case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>");
11370 case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>");
11371 case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&");
11372 case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^");
11373 case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|");
11374 case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&");
11375 case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||");
11376 case EQ_EXPR: BUILD_OPERATOR_STRING ("==");
11377 case NE_EXPR: BUILD_OPERATOR_STRING ("!=");
11378 case GT_EXPR: BUILD_OPERATOR_STRING (">");
11379 case GE_EXPR: BUILD_OPERATOR_STRING (">=");
11380 case LT_EXPR: BUILD_OPERATOR_STRING ("<");
11381 case LE_EXPR: BUILD_OPERATOR_STRING ("<=");
11382 case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
11383 case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-");
11384 case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!");
11385 case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~");
11386 case PREINCREMENT_EXPR: /* Fall through */
11387 case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++");
11388 case PREDECREMENT_EXPR: /* Fall through */
11389 case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--");
11390 default:
11391 fatal ("unregistered operator %s - operator_string",
11392 tree_code_name [TREE_CODE (node)]);
11393 }
11394 return NULL;
11395 #undef BUILD_OPERATOR_STRING
11396 }
11397
11398 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
11399 errors but we modify NODE so that it contains the type computed
11400 according to the expression, when it's fixed. Otherwise, we write
11401 error_mark_node as the type. It allows us to further the analysis
11402 of remaining nodes and detects more errors in certain cases. */
11403
11404 static tree
11405 patch_binop (node, wfl_op1, wfl_op2)
11406 tree node;
11407 tree wfl_op1;
11408 tree wfl_op2;
11409 {
11410 tree op1 = TREE_OPERAND (node, 0);
11411 tree op2 = TREE_OPERAND (node, 1);
11412 tree op1_type = TREE_TYPE (op1);
11413 tree op2_type = TREE_TYPE (op2);
11414 tree prom_type;
11415 int code = TREE_CODE (node);
11416
11417 /* If 1, tell the routine that we have to return error_mark_node
11418 after checking for the initialization of the RHS */
11419 int error_found = 0;
11420
11421 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11422
11423 switch (code)
11424 {
11425 /* 15.16 Multiplicative operators */
11426 case MULT_EXPR: /* 15.16.1 Multiplication Operator * */
11427 case RDIV_EXPR: /* 15.16.2 Division Operator / */
11428 case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */
11429 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
11430 {
11431 if (!JPRIMITIVE_TYPE_P (op1_type))
11432 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
11433 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
11434 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
11435 TREE_TYPE (node) = error_mark_node;
11436 error_found = 1;
11437 break;
11438 }
11439 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
11440 /* Change the division operator if necessary */
11441 if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
11442 TREE_SET_CODE (node, TRUNC_DIV_EXPR);
11443 /* This one is more complicated. FLOATs are processed by a function
11444 call to soft_fmod. */
11445 if (code == TRUNC_MOD_EXPR)
11446 return build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2);
11447 break;
11448
11449 /* 15.17 Additive Operators */
11450 case PLUS_EXPR: /* 15.17.1 String Concatenation Operator + */
11451
11452 /* Operation is valid if either one argument is a string
11453 constant, a String object or a StringBuffer crafted for the
11454 purpose of the a previous usage of the String concatenation
11455 operator */
11456
11457 if (TREE_CODE (op1) == STRING_CST
11458 || TREE_CODE (op2) == STRING_CST
11459 || JSTRING_TYPE_P (op1_type)
11460 || JSTRING_TYPE_P (op2_type)
11461 || IS_CRAFTED_STRING_BUFFER_P (op1)
11462 || IS_CRAFTED_STRING_BUFFER_P (op2))
11463 return build_string_concatenation (op1, op2);
11464
11465 case MINUS_EXPR: /* 15.17.2 Additive Operators (+ and -) for
11466 Numeric Types */
11467 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
11468 {
11469 if (!JPRIMITIVE_TYPE_P (op1_type))
11470 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
11471 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
11472 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
11473 TREE_TYPE (node) = error_mark_node;
11474 error_found = 1;
11475 break;
11476 }
11477 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
11478 break;
11479
11480 /* 15.18 Shift Operators */
11481 case LSHIFT_EXPR:
11482 case RSHIFT_EXPR:
11483 case URSHIFT_EXPR:
11484 if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type))
11485 {
11486 if (!JINTEGRAL_TYPE_P (op1_type))
11487 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
11488 else
11489 parse_error_context
11490 (wfl_operator, (JPRIMITIVE_TYPE_P (op2_type) ?
11491 "Incompatible type for `%s'. Explicit cast needed to convert "
11492 "shift distance from `%s' to integral" :
11493 "Incompatible type for `%s'. Can't convert shift distance from "
11494 "`%s' to integral"),
11495 operator_string (node), lang_printable_name (op2_type, 0));
11496 TREE_TYPE (node) = error_mark_node;
11497 error_found = 1;
11498 break;
11499 }
11500
11501 /* Unary numeric promotion (5.6.1) is performed on each operand
11502 separatly */
11503 op1 = do_unary_numeric_promotion (op1);
11504 op2 = do_unary_numeric_promotion (op2);
11505
11506 /* The type of the shift expression is the type of the promoted
11507 type of the left-hand operand */
11508 prom_type = TREE_TYPE (op1);
11509
11510 /* Shift int only up to 0x1f and long up to 0x3f */
11511 if (prom_type == int_type_node)
11512 op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
11513 build_int_2 (0x1f, 0)));
11514 else
11515 op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
11516 build_int_2 (0x3f, 0)));
11517
11518 /* The >>> operator is a >> operating on unsigned quantities */
11519 if (code == URSHIFT_EXPR && ! flag_emit_class_files)
11520 {
11521 op1 = convert (unsigned_type (prom_type), op1);
11522 TREE_SET_CODE (node, RSHIFT_EXPR);
11523 }
11524 break;
11525
11526 /* 15.19.1 Type Comparison Operator instaceof */
11527 case INSTANCEOF_EXPR:
11528
11529 TREE_TYPE (node) = boolean_type_node;
11530
11531 if (!(op2_type = resolve_type_during_patch (op2)))
11532 return error_mark_node;
11533
11534 /* The first operand must be a reference type or the null type */
11535 if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node)
11536 error_found = 1; /* Error reported further below */
11537
11538 /* The second operand must be a reference type */
11539 if (!JREFERENCE_TYPE_P (op2_type))
11540 {
11541 SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
11542 parse_error_context
11543 (wfl_operator, "Invalid argument `%s' for `instanceof'",
11544 lang_printable_name (op2_type, 0));
11545 error_found = 1;
11546 }
11547
11548 if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1))
11549 {
11550 /* If the first operand is null, the result is always false */
11551 if (op1 == null_pointer_node)
11552 return boolean_false_node;
11553 else if (flag_emit_class_files)
11554 {
11555 TREE_OPERAND (node, 1) = op2_type;
11556 return node;
11557 }
11558 /* Otherwise we have to invoke instance of to figure it out */
11559 else
11560 {
11561 tree call =
11562 build (CALL_EXPR, boolean_type_node,
11563 build_address_of (soft_instanceof_node),
11564 tree_cons
11565 (NULL_TREE, op1,
11566 build_tree_list (NULL_TREE,
11567 build_class_ref (op2_type))),
11568 NULL_TREE);
11569 TREE_SIDE_EFFECTS (call) = 1;
11570 return call;
11571 }
11572 }
11573 /* There is no way the expression operand can be an instance of
11574 the type operand. This is a compile time error. */
11575 else
11576 {
11577 char *t1 = strdup (lang_printable_name (op1_type, 0));
11578 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
11579 parse_error_context
11580 (wfl_operator, "Impossible for `%s' to be instance of `%s'",
11581 t1, lang_printable_name (op2_type, 0));
11582 free (t1);
11583 error_found = 1;
11584 }
11585
11586 break;
11587
11588 /* 15.21 Bitwise and Logical Operators */
11589 case BIT_AND_EXPR:
11590 case BIT_XOR_EXPR:
11591 case BIT_IOR_EXPR:
11592 if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type))
11593 /* Binary numeric promotion is performed on both operand and the
11594 expression retain that type */
11595 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
11596
11597 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE
11598 && TREE_CODE (op1_type) == BOOLEAN_TYPE)
11599 /* The type of the bitwise operator expression is BOOLEAN */
11600 prom_type = boolean_type_node;
11601 else
11602 {
11603 if (!JINTEGRAL_TYPE_P (op1_type))
11604 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
11605 if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type))
11606 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type);
11607 TREE_TYPE (node) = error_mark_node;
11608 error_found = 1;
11609 /* Insert a break here if adding thing before the switch's
11610 break for this case */
11611 }
11612 break;
11613
11614 /* 15.22 Conditional-And Operator */
11615 case TRUTH_ANDIF_EXPR:
11616 /* 15.23 Conditional-Or Operator */
11617 case TRUTH_ORIF_EXPR:
11618 /* Operands must be of BOOLEAN type */
11619 if (TREE_CODE (op1_type) != BOOLEAN_TYPE ||
11620 TREE_CODE (op2_type) != BOOLEAN_TYPE)
11621 {
11622 if (TREE_CODE (op1_type) != BOOLEAN_TYPE)
11623 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type);
11624 if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type))
11625 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type);
11626 TREE_TYPE (node) = boolean_type_node;
11627 error_found = 1;
11628 break;
11629 }
11630 /* The type of the conditional operators is BOOLEAN */
11631 prom_type = boolean_type_node;
11632 break;
11633
11634 /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
11635 case LT_EXPR:
11636 case GT_EXPR:
11637 case LE_EXPR:
11638 case GE_EXPR:
11639 /* The type of each of the operands must be a primitive numeric
11640 type */
11641 if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type))
11642 {
11643 if (!JNUMERIC_TYPE_P (op1_type))
11644 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
11645 if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
11646 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
11647 TREE_TYPE (node) = boolean_type_node;
11648 error_found = 1;
11649 break;
11650 }
11651 /* Binary numeric promotion is performed on the operands */
11652 binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
11653 /* The type of the relation expression is always BOOLEAN */
11654 prom_type = boolean_type_node;
11655 break;
11656
11657 /* 15.20 Equality Operator */
11658 case EQ_EXPR:
11659 case NE_EXPR:
11660 /* 15.20.1 Numerical Equality Operators == and != */
11661 /* Binary numeric promotion is performed on the operands */
11662 if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))
11663 binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
11664
11665 /* 15.20.2 Boolean Equality Operators == and != */
11666 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE &&
11667 TREE_CODE (op2_type) == BOOLEAN_TYPE)
11668 ; /* Nothing to do here */
11669
11670 /* 15.20.3 Reference Equality Operators == and != */
11671 /* Types have to be either references or the null type. If
11672 they're references, it must be possible to convert either
11673 type to the other by casting conversion. */
11674 else if (op1 == null_pointer_node || op2 == null_pointer_node
11675 || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type)
11676 && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1)
11677 || valid_ref_assignconv_cast_p (op2_type,
11678 op1_type, 1))))
11679 ; /* Nothing to do here */
11680
11681 /* Else we have an error figure what can't be converted into
11682 what and report the error */
11683 else
11684 {
11685 char *t1;
11686 t1 = strdup (lang_printable_name (op1_type, 0));
11687 parse_error_context
11688 (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' "
11689 "to `%s'", operator_string (node), t1,
11690 lang_printable_name (op2_type, 0));
11691 free (t1);
11692 TREE_TYPE (node) = boolean_type_node;
11693 error_found = 1;
11694 break;
11695 }
11696 prom_type = boolean_type_node;
11697 break;
11698 }
11699
11700 if (error_found)
11701 return error_mark_node;
11702
11703 TREE_OPERAND (node, 0) = op1;
11704 TREE_OPERAND (node, 1) = op2;
11705 TREE_TYPE (node) = prom_type;
11706 return fold (node);
11707 }
11708
11709 /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
11710 zero value, the value of CSTE comes after the valude of STRING */
11711
11712 static tree
11713 do_merge_string_cste (cste, string, string_len, after)
11714 tree cste;
11715 char *string;
11716 int string_len, after;
11717 {
11718 int len = TREE_STRING_LENGTH (cste) + string_len;
11719 char *old = TREE_STRING_POINTER (cste);
11720 TREE_STRING_LENGTH (cste) = len;
11721 TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1);
11722 if (after)
11723 {
11724 strcpy (TREE_STRING_POINTER (cste), string);
11725 strcat (TREE_STRING_POINTER (cste), old);
11726 }
11727 else
11728 {
11729 strcpy (TREE_STRING_POINTER (cste), old);
11730 strcat (TREE_STRING_POINTER (cste), string);
11731 }
11732 return cste;
11733 }
11734
11735 /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
11736 new STRING_CST on success, NULL_TREE on failure */
11737
11738 static tree
11739 merge_string_cste (op1, op2, after)
11740 tree op1, op2;
11741 int after;
11742 {
11743 /* Handle two string constants right away */
11744 if (TREE_CODE (op2) == STRING_CST)
11745 return do_merge_string_cste (op1, TREE_STRING_POINTER (op2),
11746 TREE_STRING_LENGTH (op2), after);
11747
11748 /* Reasonable integer constant can be treated right away */
11749 if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2))
11750 {
11751 static char *boolean_true = "true";
11752 static char *boolean_false = "false";
11753 static char *null_pointer = "null";
11754 char ch[3];
11755 char *string;
11756
11757 if (op2 == boolean_true_node)
11758 string = boolean_true;
11759 else if (op2 == boolean_false_node)
11760 string = boolean_false;
11761 else if (op2 == null_pointer_node)
11762 string = null_pointer;
11763 else if (TREE_TYPE (op2) == char_type_node)
11764 {
11765 ch[0] = (char )TREE_INT_CST_LOW (op2);
11766 ch[1] = '\0';
11767 string = ch;
11768 }
11769 else
11770 string = print_int_node (op2);
11771
11772 return do_merge_string_cste (op1, string, strlen (string), after);
11773 }
11774 return NULL_TREE;
11775 }
11776
11777 /* Tries to statically concatenate OP1 and OP2 if possible. Either one
11778 has to be a STRING_CST and the other part must be a STRING_CST or a
11779 INTEGRAL constant. Return a new STRING_CST if the operation
11780 succeed, NULL_TREE otherwise.
11781
11782 If the case we want to optimize for space, we might want to return
11783 NULL_TREE for each invocation of this routine. FIXME */
11784
11785 static tree
11786 string_constant_concatenation (op1, op2)
11787 tree op1, op2;
11788 {
11789 if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST))
11790 {
11791 tree string, rest;
11792 int invert;
11793
11794 string = (TREE_CODE (op1) == STRING_CST ? op1 : op2);
11795 rest = (string == op1 ? op2 : op1);
11796 invert = (string == op1 ? 0 : 1 );
11797
11798 /* Walk REST, only if it looks reasonable */
11799 if (TREE_CODE (rest) != STRING_CST
11800 && !IS_CRAFTED_STRING_BUFFER_P (rest)
11801 && !JSTRING_TYPE_P (TREE_TYPE (rest))
11802 && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION)
11803 {
11804 rest = java_complete_tree (rest);
11805 if (rest == error_mark_node)
11806 return error_mark_node;
11807 rest = fold (rest);
11808 }
11809 return merge_string_cste (string, rest, invert);
11810 }
11811 return NULL_TREE;
11812 }
11813
11814 /* Implement the `+' operator. Does static optimization if possible,
11815 otherwise create (if necessary) and append elements to a
11816 StringBuffer. The StringBuffer will be carried around until it is
11817 used for a function call or an assignment. Then toString() will be
11818 called on it to turn it into a String object. */
11819
11820 static tree
11821 build_string_concatenation (op1, op2)
11822 tree op1, op2;
11823 {
11824 tree result;
11825
11826 /* Try to do some static optimization */
11827 if ((result = string_constant_concatenation (op1, op2)))
11828 return result;
11829
11830 /* If operands are string constant, turn then into object references */
11831
11832 if (TREE_CODE (op1) == STRING_CST)
11833 op1 = patch_string_cst (op1);
11834 if (TREE_CODE (op2) == STRING_CST)
11835 op2 = patch_string_cst (op2);
11836
11837 /* If OP1 isn't already a StringBuffer, create and
11838 initialize a new one */
11839 if (!IS_CRAFTED_STRING_BUFFER_P (op1))
11840 {
11841 /* Two solutions here:
11842 1) OP1 is a string reference, we call new StringBuffer(OP1)
11843 2) Op2 is something else, we call new StringBuffer().append(OP1). */
11844 if (JSTRING_TYPE_P (TREE_TYPE (op1)))
11845 op1 = BUILD_STRING_BUFFER (op1);
11846 else
11847 {
11848 tree aNew = BUILD_STRING_BUFFER (NULL_TREE);
11849 op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0);
11850 }
11851 }
11852
11853 /* No longer the last node holding a crafted StringBuffer */
11854 IS_CRAFTED_STRING_BUFFER_P (op1) = 0;
11855 /* Create a node for `{new...,xxx}.append (op2)' */
11856 op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0);
11857 /* Mark the last node holding a crafted StringBuffer */
11858 IS_CRAFTED_STRING_BUFFER_P (op1) = 1;
11859
11860 return op1;
11861 }
11862
11863 /* Patch the string node NODE. NODE can be a STRING_CST of a crafted
11864 StringBuffer. If no string were found to be patched, return
11865 NULL. */
11866
11867 static tree
11868 patch_string (node)
11869 tree node;
11870 {
11871 if (node == error_mark_node)
11872 return error_mark_node;
11873 if (TREE_CODE (node) == STRING_CST)
11874 return patch_string_cst (node);
11875 else if (IS_CRAFTED_STRING_BUFFER_P (node))
11876 {
11877 int saved = ctxp->explicit_constructor_p;
11878 tree invoke = build_method_invocation (wfl_to_string, NULL_TREE);
11879 tree ret;
11880 /* Temporary disable forbid the use of `this'. */
11881 ctxp->explicit_constructor_p = 0;
11882 ret = java_complete_tree (make_qualified_primary (node, invoke, 0));
11883 /* Restore it at its previous value */
11884 ctxp->explicit_constructor_p = saved;
11885 return ret;
11886 }
11887 return NULL_TREE;
11888 }
11889
11890 /* Build the internal representation of a string constant. */
11891
11892 static tree
11893 patch_string_cst (node)
11894 tree node;
11895 {
11896 int location;
11897 if (! flag_emit_class_files)
11898 {
11899 push_obstacks (&permanent_obstack, &permanent_obstack);
11900 node = get_identifier (TREE_STRING_POINTER (node));
11901 location = alloc_name_constant (CONSTANT_String, node);
11902 node = build_ref_from_constant_pool (location);
11903 }
11904 TREE_TYPE (node) = promote_type (string_type_node);
11905 TREE_CONSTANT (node) = 1;
11906 return node;
11907 }
11908
11909 /* Build an incomplete unary operator expression. */
11910
11911 static tree
11912 build_unaryop (op_token, op_location, op1)
11913 int op_token, op_location;
11914 tree op1;
11915 {
11916 enum tree_code op;
11917 tree unaryop;
11918 switch (op_token)
11919 {
11920 case PLUS_TK: op = UNARY_PLUS_EXPR; break;
11921 case MINUS_TK: op = NEGATE_EXPR; break;
11922 case NEG_TK: op = TRUTH_NOT_EXPR; break;
11923 case NOT_TK: op = BIT_NOT_EXPR; break;
11924 default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
11925 op_token);
11926 }
11927
11928 unaryop = build1 (op, NULL_TREE, op1);
11929 TREE_SIDE_EFFECTS (unaryop) = 1;
11930 /* Store the location of the operator, for better error report. The
11931 string of the operator will be rebuild based on the OP value. */
11932 EXPR_WFL_LINECOL (unaryop) = op_location;
11933 return unaryop;
11934 }
11935
11936 /* Special case for the ++/-- operators, since they require an extra
11937 argument to build, which is set to NULL and patched
11938 later. IS_POST_P is 1 if the operator, 0 otherwise. */
11939
11940 static tree
11941 build_incdec (op_token, op_location, op1, is_post_p)
11942 int op_token, op_location;
11943 tree op1;
11944 int is_post_p;
11945 {
11946 static enum tree_code lookup [2][2] =
11947 {
11948 { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
11949 { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
11950 };
11951 tree node = build (lookup [is_post_p][(op_token - DECR_TK)],
11952 NULL_TREE, op1, NULL_TREE);
11953 TREE_SIDE_EFFECTS (node) = 1;
11954 /* Store the location of the operator, for better error report. The
11955 string of the operator will be rebuild based on the OP value. */
11956 EXPR_WFL_LINECOL (node) = op_location;
11957 return node;
11958 }
11959
11960 /* Build an incomplete cast operator, based on the use of the
11961 CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
11962 set. java_complete_tree is trained to walk a CONVERT_EXPR even
11963 though its type is already set. */
11964
11965 static tree
11966 build_cast (location, type, exp)
11967 int location;
11968 tree type, exp;
11969 {
11970 tree node = build1 (CONVERT_EXPR, type, exp);
11971 EXPR_WFL_LINECOL (node) = location;
11972 return node;
11973 }
11974
11975 /* 15.14 Unary operators. We return error_mark_node in case of error,
11976 but preserve the type of NODE if the type is fixed. */
11977
11978 static tree
11979 patch_unaryop (node, wfl_op)
11980 tree node;
11981 tree wfl_op;
11982 {
11983 tree op = TREE_OPERAND (node, 0);
11984 tree op_type = TREE_TYPE (op);
11985 tree prom_type, value;
11986 int code = TREE_CODE (node);
11987 int error_found = 0;
11988
11989 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11990
11991 switch (code)
11992 {
11993 /* 15.13.2 Postfix Increment Operator ++ */
11994 case POSTINCREMENT_EXPR:
11995 /* 15.13.3 Postfix Increment Operator -- */
11996 case POSTDECREMENT_EXPR:
11997 /* 15.14.1 Prefix Increment Operator ++ */
11998 case PREINCREMENT_EXPR:
11999 /* 15.14.2 Prefix Decrement Operator -- */
12000 case PREDECREMENT_EXPR:
12001 if (!DECL_P (op) && !((TREE_CODE (op) == INDIRECT_REF
12002 || TREE_CODE (op) == COMPONENT_REF)
12003 && JPRIMITIVE_TYPE_P (TREE_TYPE (op))))
12004 {
12005 tree lvalue;
12006 /* Before screaming, check that we're not in fact trying to
12007 increment a optimized static final access, in which case
12008 we issue an different error message. */
12009 if (!(TREE_CODE (wfl_op) == EXPR_WITH_FILE_LOCATION
12010 && resolve_expression_name (wfl_op, &lvalue)
12011 && check_final_assignment (lvalue, wfl_op)))
12012 parse_error_context (wfl_operator, "Invalid argument to `%s'",
12013 operator_string (node));
12014 TREE_TYPE (node) = error_mark_node;
12015 error_found = 1;
12016 }
12017 else if (check_final_assignment (op, wfl_op))
12018 error_found = 1;
12019
12020 /* From now on, we know that op if a variable and that it has a
12021 valid wfl. We use wfl_op to locate errors related to the
12022 ++/-- operand. */
12023 else if (!JNUMERIC_TYPE_P (op_type))
12024 {
12025 parse_error_context
12026 (wfl_op, "Invalid argument type `%s' to `%s'",
12027 lang_printable_name (op_type, 0), operator_string (node));
12028 TREE_TYPE (node) = error_mark_node;
12029 error_found = 1;
12030 }
12031 else
12032 {
12033 /* Before the addition, binary numeric promotion is performed on
12034 both operands */
12035 value = build_int_2 (1, 0);
12036 TREE_TYPE (node) =
12037 binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value);
12038 /* And write the promoted incremented and increment */
12039 TREE_OPERAND (node, 0) = op;
12040 TREE_OPERAND (node, 1) = value;
12041 /* Convert the overall back into its original type. */
12042 return fold (convert (op_type, node));
12043 }
12044 break;
12045
12046 /* 15.14.3 Unary Plus Operator + */
12047 case UNARY_PLUS_EXPR:
12048 /* 15.14.4 Unary Minus Operator - */
12049 case NEGATE_EXPR:
12050 if (!JNUMERIC_TYPE_P (op_type))
12051 {
12052 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type);
12053 TREE_TYPE (node) = error_mark_node;
12054 error_found = 1;
12055 }
12056 /* Unary numeric promotion is performed on operand */
12057 else
12058 {
12059 op = do_unary_numeric_promotion (op);
12060 prom_type = TREE_TYPE (op);
12061 if (code == UNARY_PLUS_EXPR)
12062 return fold (op);
12063 }
12064 break;
12065
12066 /* 15.14.5 Bitwise Complement Operator ~ */
12067 case BIT_NOT_EXPR:
12068 if (!JINTEGRAL_TYPE_P (op_type))
12069 {
12070 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type);
12071 TREE_TYPE (node) = error_mark_node;
12072 error_found = 1;
12073 }
12074 else
12075 {
12076 op = do_unary_numeric_promotion (op);
12077 prom_type = TREE_TYPE (op);
12078 }
12079 break;
12080
12081 /* 15.14.6 Logical Complement Operator ! */
12082 case TRUTH_NOT_EXPR:
12083 if (TREE_CODE (op_type) != BOOLEAN_TYPE)
12084 {
12085 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type);
12086 /* But the type is known. We will report an error if further
12087 attempt of a assignment is made with this rhs */
12088 TREE_TYPE (node) = boolean_type_node;
12089 error_found = 1;
12090 }
12091 else
12092 prom_type = boolean_type_node;
12093 break;
12094
12095 /* 15.15 Cast Expression */
12096 case CONVERT_EXPR:
12097 value = patch_cast (node, wfl_operator);
12098 if (value == error_mark_node)
12099 {
12100 /* If this cast is part of an assignment, we tell the code
12101 that deals with it not to complain about a mismatch,
12102 because things have been cast, anyways */
12103 TREE_TYPE (node) = error_mark_node;
12104 error_found = 1;
12105 }
12106 else
12107 return fold (value);
12108 break;
12109 }
12110
12111 if (error_found)
12112 return error_mark_node;
12113
12114 /* There are cases where node has been replaced by something else
12115 and we don't end up returning here: UNARY_PLUS_EXPR,
12116 CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
12117 TREE_OPERAND (node, 0) = fold (op);
12118 TREE_TYPE (node) = prom_type;
12119 return fold (node);
12120 }
12121
12122 /* Generic type resolution that sometimes takes place during node
12123 patching. Returned the resolved type or generate an error
12124 message. Return the resolved type or NULL_TREE. */
12125
12126 static tree
12127 resolve_type_during_patch (type)
12128 tree type;
12129 {
12130 if (unresolved_type_p (type, NULL))
12131 {
12132 tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE);
12133 if (!type_decl)
12134 {
12135 parse_error_context (type,
12136 "Class `%s' not found in type declaration",
12137 IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
12138 return NULL_TREE;
12139 }
12140 else
12141 {
12142 CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1;
12143 return TREE_TYPE (type_decl);
12144 }
12145 }
12146 return type;
12147 }
12148 /* 5.5 Casting Conversion. error_mark_node is returned if an error is
12149 found. Otherwise NODE or something meant to replace it is returned. */
12150
12151 static tree
12152 patch_cast (node, wfl_operator)
12153 tree node;
12154 tree wfl_operator;
12155 {
12156 tree op = TREE_OPERAND (node, 0);
12157 tree op_type = TREE_TYPE (op);
12158 tree cast_type = TREE_TYPE (node);
12159 char *t1;
12160
12161 /* First resolve OP_TYPE if unresolved */
12162 if (!(cast_type = resolve_type_during_patch (cast_type)))
12163 return error_mark_node;
12164
12165 /* Check on cast that are proven correct at compile time */
12166 if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
12167 {
12168 static tree convert_narrow ();
12169 /* Same type */
12170 if (cast_type == op_type)
12171 return node;
12172
12173 /* Try widening/narowwing convertion. Potentially, things need
12174 to be worked out in gcc so we implement the extreme cases
12175 correctly. fold_convert() needs to be fixed. */
12176 return convert (cast_type, op);
12177 }
12178
12179 /* null can be casted to references */
12180 if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type))
12181 return build_null_of_type (cast_type);
12182
12183 /* The remaining legal casts involve conversion between reference
12184 types. Check for their compile time correctness. */
12185 if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type)
12186 && valid_ref_assignconv_cast_p (cast_type, op_type, 1))
12187 {
12188 TREE_TYPE (node) = promote_type (cast_type);
12189 /* Now, the case can be determined correct at compile time if
12190 OP_TYPE can be converted into CAST_TYPE by assignment
12191 conversion (5.2) */
12192
12193 if (valid_ref_assignconv_cast_p (op_type, cast_type, 0))
12194 {
12195 TREE_SET_CODE (node, NOP_EXPR);
12196 return node;
12197 }
12198
12199 if (flag_emit_class_files)
12200 {
12201 TREE_SET_CODE (node, CONVERT_EXPR);
12202 return node;
12203 }
12204
12205 /* The cast requires a run-time check */
12206 return build (CALL_EXPR, promote_type (cast_type),
12207 build_address_of (soft_checkcast_node),
12208 tree_cons (NULL_TREE, build_class_ref (cast_type),
12209 build_tree_list (NULL_TREE, op)),
12210 NULL_TREE);
12211 }
12212
12213 /* Any other casts are proven incorrect at compile time */
12214 t1 = strdup (lang_printable_name (op_type, 0));
12215 parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
12216 t1, lang_printable_name (cast_type, 0));
12217 free (t1);
12218 return error_mark_node;
12219 }
12220
12221 /* Build a null constant and give it the type TYPE. */
12222
12223 static tree
12224 build_null_of_type (type)
12225 tree type;
12226 {
12227 tree node = build_int_2 (0, 0);
12228 TREE_TYPE (node) = promote_type (type);
12229 return node;
12230 }
12231
12232 /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
12233 a list of indices. */
12234 static tree
12235 build_array_ref (location, array, index)
12236 int location;
12237 tree array, index;
12238 {
12239 tree node = build (ARRAY_REF, NULL_TREE, array, index);
12240 EXPR_WFL_LINECOL (node) = location;
12241 return node;
12242 }
12243
12244 /* 15.12 Array Access Expression */
12245
12246 static tree
12247 patch_array_ref (node)
12248 tree node;
12249 {
12250 tree array = TREE_OPERAND (node, 0);
12251 tree array_type = TREE_TYPE (array);
12252 tree index = TREE_OPERAND (node, 1);
12253 tree index_type = TREE_TYPE (index);
12254 int error_found = 0;
12255
12256 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
12257
12258 if (TREE_CODE (array_type) == POINTER_TYPE)
12259 array_type = TREE_TYPE (array_type);
12260
12261 /* The array reference must be an array */
12262 if (!TYPE_ARRAY_P (array_type))
12263 {
12264 parse_error_context
12265 (wfl_operator, "`[]' can only be applied to arrays. It can't be "
12266 "applied to `%s'", lang_printable_name (array_type, 0));
12267 TREE_TYPE (node) = error_mark_node;
12268 error_found = 1;
12269 }
12270
12271 /* The array index underdoes unary numeric promotion. The promoted
12272 type must be int */
12273 index = do_unary_numeric_promotion (index);
12274 if (TREE_TYPE (index) != int_type_node)
12275 {
12276 int could_cast = valid_cast_to_p (index_type, int_type_node);
12277 parse_error_context
12278 (wfl_operator,
12279 (could_cast ? "Incompatible type for `[]'. Explicit cast needed to "
12280 "convert `%s' to `int'" : "Incompatible type for `[]'. "
12281 "Can't convert `%s' to `int'"),
12282 lang_printable_name (index_type, 0));
12283 TREE_TYPE (node) = error_mark_node;
12284 error_found = 1;
12285 }
12286
12287 if (error_found)
12288 return error_mark_node;
12289
12290 array_type = TYPE_ARRAY_ELEMENT (array_type);
12291
12292 if (flag_emit_class_files)
12293 {
12294 TREE_OPERAND (node, 0) = array;
12295 TREE_OPERAND (node, 1) = index;
12296 }
12297 else
12298 node = build_java_arrayaccess (array, array_type, index);
12299 TREE_TYPE (node) = array_type;
12300 return node;
12301 }
12302
12303 /* 15.9 Array Creation Expressions */
12304
12305 static tree
12306 build_newarray_node (type, dims, extra_dims)
12307 tree type;
12308 tree dims;
12309 int extra_dims;
12310 {
12311 tree node =
12312 build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims),
12313 build_int_2 (extra_dims, 0));
12314 return node;
12315 }
12316
12317 static tree
12318 patch_newarray (node)
12319 tree node;
12320 {
12321 tree type = TREE_OPERAND (node, 0);
12322 tree dims = TREE_OPERAND (node, 1);
12323 tree cdim, array_type;
12324 int error_found = 0;
12325 int ndims = 0;
12326 int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2));
12327
12328 /* Dimension types are verified. It's better for the types to be
12329 verified in order. */
12330 for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ )
12331 {
12332 int dim_error = 0;
12333 tree dim = TREE_VALUE (cdim);
12334
12335 /* Dim might have been saved during its evaluation */
12336 dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim);
12337
12338 /* The type of each specified dimension must be an integral type. */
12339 if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim)))
12340 dim_error = 1;
12341
12342 /* Each expression undergoes an unary numeric promotion (5.6.1) and the
12343 promoted type must be int. */
12344 else
12345 {
12346 dim = do_unary_numeric_promotion (dim);
12347 if (TREE_TYPE (dim) != int_type_node)
12348 dim_error = 1;
12349 }
12350
12351 /* Report errors on types here */
12352 if (dim_error)
12353 {
12354 parse_error_context
12355 (TREE_PURPOSE (cdim),
12356 "Incompatible type for dimension in array creation expression. "
12357 "%s convert `%s' to `int'",
12358 (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ?
12359 "Explicit cast needed to" : "Can't"),
12360 lang_printable_name (TREE_TYPE (dim), 0));
12361 error_found = 1;
12362 }
12363
12364 TREE_PURPOSE (cdim) = NULL_TREE;
12365 }
12366
12367 /* Resolve array base type if unresolved */
12368 if (!(type = resolve_type_during_patch (type)))
12369 error_found = 1;
12370
12371 if (error_found)
12372 {
12373 /* We don't want further evaluation of this bogus array creation
12374 operation */
12375 TREE_TYPE (node) = error_mark_node;
12376 return error_mark_node;
12377 }
12378
12379 /* Set array_type to the actual (promoted) array type of the result. */
12380 if (TREE_CODE (type) == RECORD_TYPE)
12381 type = build_pointer_type (type);
12382 while (--xdims >= 0)
12383 {
12384 type = promote_type (build_java_array_type (type, -1));
12385 }
12386 dims = nreverse (dims);
12387 array_type = type;
12388 for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim))
12389 {
12390 type = array_type;
12391 array_type = build_java_array_type (type,
12392 TREE_CODE (cdim) == INTEGER_CST ?
12393 TREE_INT_CST_LOW (cdim) : -1);
12394 array_type = promote_type (array_type);
12395 }
12396 dims = nreverse (dims);
12397
12398 /* The node is transformed into a function call. Things are done
12399 differently according to the number of dimensions. If the number
12400 of dimension is equal to 1, then the nature of the base type
12401 (primitive or not) matters. */
12402 if (ndims == 1)
12403 return build_new_array (type, TREE_VALUE (dims));
12404
12405 /* Can't reuse what's already written in expr.c because it uses the
12406 JVM stack representation. Provide a build_multianewarray. FIXME */
12407 return build (CALL_EXPR, array_type,
12408 build_address_of (soft_multianewarray_node),
12409 tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)),
12410 tree_cons (NULL_TREE,
12411 build_int_2 (ndims, 0), dims )),
12412 NULL_TREE);
12413 }
12414
12415 /* 10.6 Array initializer. */
12416
12417 /* Build a wfl for array element that don't have one, so we can
12418 pin-point errors. */
12419
12420 static tree
12421 maybe_build_array_element_wfl (node)
12422 tree node;
12423 {
12424 if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION)
12425 return build_expr_wfl (NULL_TREE, ctxp->filename,
12426 ctxp->elc.line, ctxp->elc.prev_col);
12427 else
12428 return NULL_TREE;
12429 }
12430
12431 /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
12432 identification of initialized arrays easier to detect during walk
12433 and expansion. */
12434
12435 static tree
12436 build_new_array_init (location, values)
12437 int location;
12438 tree values;
12439 {
12440 tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values);
12441 tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor);
12442 EXPR_WFL_LINECOL (to_return) = EXPR_WFL_LINECOL (constructor) = location;
12443 return to_return;
12444 }
12445
12446 /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
12447 occurred. Otherwise return NODE after having set its type
12448 appropriately. */
12449
12450 static tree
12451 patch_new_array_init (type, node)
12452 tree type, node;
12453 {
12454 int error_seen = 0;
12455 tree current, element_type;
12456 HOST_WIDE_INT length;
12457 int all_constant = 1;
12458 tree init = TREE_OPERAND (node, 0);
12459
12460 if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type)))
12461 {
12462 parse_error_context (node,
12463 "Invalid array initializer for non-array type `%s'",
12464 lang_printable_name (type, 1));
12465 return error_mark_node;
12466 }
12467 type = TREE_TYPE (type);
12468 element_type = TYPE_ARRAY_ELEMENT (type);
12469
12470 CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init));
12471
12472 for (length = 0, current = CONSTRUCTOR_ELTS (init);
12473 current; length++, current = TREE_CHAIN (current))
12474 {
12475 tree elt = TREE_VALUE (current);
12476 if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT)
12477 {
12478 error_seen |= array_constructor_check_entry (element_type, current);
12479 if (! TREE_CONSTANT (TREE_VALUE (current)))
12480 all_constant = 0;
12481 }
12482 else
12483 {
12484 TREE_VALUE (current) = patch_new_array_init (element_type, elt);
12485 TREE_PURPOSE (current) = NULL_TREE;
12486 all_constant = 0;
12487 }
12488 if (elt && TREE_VALUE (elt) == error_mark_node)
12489 error_seen = 1;
12490 }
12491
12492 if (error_seen)
12493 return error_mark_node;
12494
12495 /* Create a new type. We can't reuse the one we have here by
12496 patching its dimension because it originally is of dimension -1
12497 hence reused by gcc. This would prevent triangular arrays. */
12498 type = build_java_array_type (element_type, length);
12499 TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type))));
12500 TREE_TYPE (node) = promote_type (type);
12501 TREE_CONSTANT (init) = all_constant;
12502 return node;
12503 }
12504
12505 /* Verify that one entry of the initializer element list can be
12506 assigned to the array base type. Report 1 if an error occurred, 0
12507 otherwise. */
12508
12509 static int
12510 array_constructor_check_entry (type, entry)
12511 tree type, entry;
12512 {
12513 char *array_type_string = NULL; /* For error reports */
12514 tree value, type_value, new_value, wfl_value, patched;
12515 int error_seen = 0;
12516
12517 new_value = NULL_TREE;
12518 wfl_value = TREE_VALUE (entry);
12519
12520 value = java_complete_tree (TREE_VALUE (entry));
12521 /* patch_string return error_mark_node if arg is error_mark_node */
12522 if ((patched = patch_string (value)))
12523 value = patched;
12524 if (value == error_mark_node)
12525 return 1;
12526
12527 type_value = TREE_TYPE (value);
12528
12529 /* At anytime, try_builtin_assignconv can report a warning on
12530 constant overflow during narrowing. */
12531 SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value);
12532 new_value = try_builtin_assignconv (wfl_operator, type, value);
12533 if (!new_value && (new_value = try_reference_assignconv (type, value)))
12534 type_value = promote_type (type);
12535
12536 /* Check and report errors */
12537 if (!new_value)
12538 {
12539 char *msg = (!valid_cast_to_p (type_value, type) ?
12540 "Can't" : "Explicit cast needed to");
12541 if (!array_type_string)
12542 array_type_string = strdup (lang_printable_name (type, 1));
12543 parse_error_context
12544 (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
12545 msg, lang_printable_name (type_value, 1), array_type_string);
12546 error_seen = 1;
12547 }
12548
12549 if (new_value)
12550 {
12551 new_value = maybe_build_primttype_type_ref (new_value, wfl_operator);
12552 TREE_VALUE (entry) = new_value;
12553 }
12554
12555 if (array_type_string)
12556 free (array_type_string);
12557
12558 TREE_PURPOSE (entry) = NULL_TREE;
12559 return error_seen;
12560 }
12561
12562 static tree
12563 build_this (location)
12564 int location;
12565 {
12566 tree node = build_wfl_node (this_identifier_node, input_filename, 0, 0);
12567 TREE_SET_CODE (node, THIS_EXPR);
12568 EXPR_WFL_LINECOL (node) = location;
12569 return node;
12570 }
12571
12572 /* 14.15 The return statement. It builds a modify expression that
12573 assigns the returned value to the RESULT_DECL that hold the value
12574 to be returned. */
12575
12576 static tree
12577 build_return (location, op)
12578 int location;
12579 tree op;
12580 {
12581 tree node = build1 (RETURN_EXPR, NULL_TREE, op);
12582 EXPR_WFL_LINECOL (node) = location;
12583 node = build_debugable_stmt (location, node);
12584 return node;
12585 }
12586
12587 static tree
12588 patch_return (node)
12589 tree node;
12590 {
12591 tree return_exp = TREE_OPERAND (node, 0);
12592 tree meth = current_function_decl;
12593 tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl));
12594 int error_found = 0;
12595
12596 TREE_TYPE (node) = error_mark_node;
12597 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
12598
12599 /* It's invalid to have a return value within a function that is
12600 declared with the keyword void or that is a constructor */
12601 if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth)))
12602 error_found = 1;
12603
12604 /* It's invalid to have a no return value within a function that
12605 isn't declared with the keyword `void' */
12606 if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth)))
12607 error_found = 2;
12608
12609 if (error_found)
12610 {
12611 if (!DECL_CONSTRUCTOR_P (meth))
12612 {
12613 char *t = strdup (lang_printable_name (mtype, 0));
12614 parse_error_context (wfl_operator,
12615 "`return' with%s value from `%s %s'",
12616 (error_found == 1 ? "" : "out"),
12617 t, lang_printable_name (meth, 0));
12618 free (t);
12619 }
12620 else
12621 parse_error_context (wfl_operator,
12622 "`return' with value from constructor `%s'",
12623 lang_printable_name (meth, 0));
12624 return error_mark_node;
12625 }
12626
12627 /* If we have a return_exp, build a modify expression and expand
12628 it. Note: at that point, the assignment is declared valid, but we
12629 may want to carry some more hacks */
12630 if (return_exp)
12631 {
12632 tree exp = java_complete_tree (return_exp);
12633 tree modify, patched;
12634
12635 /* If the function returned value and EXP are booleans, EXP has
12636 to be converted into the type of DECL_RESULT, which is integer
12637 (see complete_start_java_method) */
12638 if (TREE_TYPE (exp) == boolean_type_node &&
12639 TREE_TYPE (TREE_TYPE (meth)) == boolean_type_node)
12640 exp = convert_to_integer (TREE_TYPE (DECL_RESULT (meth)), exp);
12641
12642 /* `null' can be assigned to a function returning a reference */
12643 if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth))) &&
12644 exp == null_pointer_node)
12645 exp = build_null_of_type (TREE_TYPE (TREE_TYPE (meth)));
12646
12647 if ((patched = patch_string (exp)))
12648 exp = patched;
12649
12650 modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp);
12651 EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node);
12652 modify = java_complete_tree (modify);
12653
12654 if (modify != error_mark_node)
12655 {
12656 TREE_SIDE_EFFECTS (modify) = 1;
12657 TREE_OPERAND (node, 0) = modify;
12658 }
12659 else
12660 return error_mark_node;
12661 }
12662 TREE_TYPE (node) = void_type_node;
12663 TREE_SIDE_EFFECTS (node) = 1;
12664 return node;
12665 }
12666
12667 /* 14.8 The if Statement */
12668
12669 static tree
12670 build_if_else_statement (location, expression, if_body, else_body)
12671 int location;
12672 tree expression, if_body, else_body;
12673 {
12674 tree node;
12675 if (!else_body)
12676 else_body = empty_stmt_node;
12677 node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body);
12678 EXPR_WFL_LINECOL (node) = location;
12679 node = build_debugable_stmt (location, node);
12680 return node;
12681 }
12682
12683 static tree
12684 patch_if_else_statement (node)
12685 tree node;
12686 {
12687 tree expression = TREE_OPERAND (node, 0);
12688
12689 TREE_TYPE (node) = error_mark_node;
12690 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
12691
12692 /* The type of expression must be boolean */
12693 if (TREE_TYPE (expression) != boolean_type_node
12694 && TREE_TYPE (expression) != promoted_boolean_type_node)
12695 {
12696 parse_error_context
12697 (wfl_operator,
12698 "Incompatible type for `if'. Can't convert `%s' to `boolean'",
12699 lang_printable_name (TREE_TYPE (expression), 0));
12700 return error_mark_node;
12701 }
12702
12703 TREE_TYPE (node) = void_type_node;
12704 TREE_SIDE_EFFECTS (node) = 1;
12705 CAN_COMPLETE_NORMALLY (node)
12706 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
12707 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2));
12708 return node;
12709 }
12710
12711 /* 14.6 Labeled Statements */
12712
12713 /* Action taken when a lableled statement is parsed. a new
12714 LABELED_BLOCK_EXPR is created. No statement is attached to the
12715 label, yet. */
12716
12717 static tree
12718 build_labeled_block (location, label)
12719 int location;
12720 tree label;
12721 {
12722 tree label_name = merge_qualified_name (label_id, label);
12723 tree label_decl, node;
12724
12725 /* Issue an error if we try to reuse a label that was previously
12726 declared */
12727 if (IDENTIFIER_LOCAL_VALUE (label_name))
12728 {
12729 EXPR_WFL_LINECOL (wfl_operator) = location;
12730 parse_error_context (wfl_operator, "Declaration of `%s' shadows "
12731 "a previous label declaration",
12732 IDENTIFIER_POINTER (label));
12733 EXPR_WFL_LINECOL (wfl_operator) =
12734 EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
12735 parse_error_context (wfl_operator, "This is the location of the "
12736 "previous declaration of label `%s'",
12737 IDENTIFIER_POINTER (label));
12738 java_error_count--;
12739 }
12740
12741 label_decl = create_label_decl (label_name);
12742 node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE);
12743 EXPR_WFL_LINECOL (node) = location;
12744 TREE_SIDE_EFFECTS (node) = 1;
12745 return node;
12746 }
12747
12748 /* Generate a label crafting a unique name for it. This is used to
12749 implicitely label loops that aren't the body part of labeled
12750 statement. */
12751
12752 static tree
12753 generate_labeled_block ()
12754 {
12755 return build_labeled_block (0, generate_name ());
12756 }
12757
12758 /* A labeled statement LBE is attached a statement. */
12759
12760 static tree
12761 complete_labeled_statement (lbe, statement)
12762 tree lbe; /* Labeled block expr */
12763 tree statement;
12764 {
12765 /* In anyways, tie the loop to its statement */
12766 LABELED_BLOCK_BODY (lbe) = statement;
12767
12768 /* Ok, if statement is a for loop, we have to attach the labeled
12769 statement to the block the for loop belongs to and return the
12770 block instead */
12771 if (TREE_CODE (statement) == LOOP_EXPR && IS_FOR_LOOP_P (statement))
12772 {
12773 java_method_add_stmt (current_function_decl, lbe);
12774 return exit_block ();
12775 }
12776
12777 return lbe;
12778 }
12779
12780 /* 14.10, 14.11, 14.12 Loop Statements */
12781
12782 /* Create an empty LOOP_EXPR and make it the last in the nested loop
12783 list. */
12784
12785 static tree
12786 build_new_loop (loop_body)
12787 tree loop_body;
12788 {
12789 tree loop = build (LOOP_EXPR, NULL_TREE, loop_body);
12790 TREE_SIDE_EFFECTS (loop) = 1;
12791 PUSH_LOOP (loop);
12792 return loop;
12793 }
12794
12795 /* Create a loop body according to the following structure:
12796 COMPOUND_EXPR
12797 COMPOUND_EXPR (loop main body)
12798 EXIT_EXPR (this order is for while/for loops.
12799 LABELED_BLOCK_EXPR the order is reversed for do loops)
12800 LABEL_DECL (continue occurding here branche at the
12801 BODY end of this labeled block)
12802 INCREMENT (if any)
12803
12804 REVERSED, if non zero, tells that the loop condition expr comes
12805 after the body, like in the do-while loop.
12806
12807 To obtain a loop, the loop body structure described above is
12808 encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
12809
12810 LABELED_BLOCK_EXPR
12811 LABEL_DECL (use this label to exit the loop)
12812 LOOP_EXPR
12813 <structure described above> */
12814
12815 static tree
12816 build_loop_body (location, condition, reversed)
12817 int location;
12818 tree condition;
12819 int reversed;
12820 {
12821 tree first, second, body;
12822
12823 condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */
12824 EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */
12825 condition = build_debugable_stmt (location, condition);
12826 TREE_SIDE_EFFECTS (condition) = 1;
12827
12828 body = generate_labeled_block ();
12829 first = (reversed ? body : condition);
12830 second = (reversed ? condition : body);
12831 return
12832 build (COMPOUND_EXPR, NULL_TREE,
12833 build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node);
12834 }
12835
12836 /* Install CONDITION (if any) and loop BODY (using REVERSED to tell
12837 their order) on the current loop. Unlink the current loop from the
12838 loop list. */
12839
12840 static tree
12841 complete_loop_body (location, condition, body, reversed)
12842 int location;
12843 tree condition, body;
12844 int reversed;
12845 {
12846 tree to_return = ctxp->current_loop;
12847 tree loop_body = LOOP_EXPR_BODY (to_return);
12848 if (condition)
12849 {
12850 tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed);
12851 /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
12852 The real EXIT_EXPR is one operand further. */
12853 EXPR_WFL_LINECOL (cnode) = location;
12854 /* This one is for accurate error reports */
12855 EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location;
12856 TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition;
12857 }
12858 LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body;
12859 POP_LOOP ();
12860 return to_return;
12861 }
12862
12863 /* Tailored version of complete_loop_body for FOR loops, when FOR
12864 loops feature the condition part */
12865
12866 static tree
12867 complete_for_loop (location, condition, update, body)
12868 int location;
12869 tree condition, update, body;
12870 {
12871 /* Put the condition and the loop body in place */
12872 tree loop = complete_loop_body (location, condition, body, 0);
12873 /* LOOP is the current loop which has been now popped of the loop
12874 stack. Install the update block */
12875 LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
12876 return loop;
12877 }
12878
12879 /* If the loop isn't surrounded by a labeled statement, create one and
12880 insert LOOP as it's body. */
12881
12882 static tree
12883 patch_loop_statement (loop)
12884 tree loop;
12885 {
12886 tree loop_label, to_return_as_loop;
12887
12888 if (LOOP_HAS_LABEL_P (loop))
12889 {
12890 loop_label = ctxp->current_labeled_block;
12891 to_return_as_loop = loop;
12892 }
12893 else
12894 {
12895 loop_label = generate_labeled_block ();
12896 LABELED_BLOCK_BODY (loop_label) = loop;
12897 PUSH_LABELED_BLOCK (loop_label);
12898 to_return_as_loop = loop_label;
12899 }
12900 TREE_TYPE (to_return_as_loop) = void_type_node;
12901 return to_return_as_loop;
12902 }
12903
12904 /* 14.13, 14.14: break and continue Statements */
12905
12906 /* Build a break or a continue statement. a null NAME indicates an
12907 unlabeled break/continue statement. */
12908
12909 static tree
12910 build_bc_statement (location, is_break, name)
12911 int location, is_break;
12912 tree name;
12913 {
12914 tree break_continue, label_block_expr = NULL_TREE;
12915
12916 if (name)
12917 {
12918 if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE
12919 (merge_qualified_name (label_id, EXPR_WFL_NODE (name)))))
12920 /* Null means that we don't have a target for this named
12921 break/continue. In this case, we make the target to be the
12922 label name, so that the error can be reported accuratly in
12923 patch_bc_statement. */
12924 label_block_expr = EXPR_WFL_NODE (name);
12925 }
12926 /* Unlabeled break/continue will be handled during the
12927 break/continue patch operation */
12928 break_continue
12929 = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE);
12930
12931 IS_BREAK_STMT_P (break_continue) = is_break;
12932 TREE_SIDE_EFFECTS (break_continue) = 1;
12933 EXPR_WFL_LINECOL (break_continue) = location;
12934 break_continue = build_debugable_stmt (location, break_continue);
12935 return break_continue;
12936 }
12937
12938 /* Verification of a break/continue statement. */
12939
12940 static tree
12941 patch_bc_statement (node)
12942 tree node;
12943 {
12944 tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt;
12945 int is_unlabeled = 0;
12946 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
12947
12948 /* Not having a target means that the break/continue statement is
12949 unlabeled. We try to find a decent label for it */
12950 if (!bc_label)
12951 {
12952 is_unlabeled = 1;
12953 /* There should be a loop/switch to branch to */
12954 if (ctxp->current_loop)
12955 {
12956 if (TREE_CODE (ctxp->current_loop) == LOOP_EXPR)
12957 {
12958 /* At that stage, we're in the loop body, which is
12959 encapsulated around a LABELED_BLOCK_EXPR. So searching
12960 the current loop label requires us to consider the
12961 labeled block before the current one. */
12962 if (!LOOP_HAS_LABEL_SKIP_P (ctxp->current_loop))
12963 fatal ("unlabeled loop has no installed label -- "
12964 "patch_bc_statement");
12965 bc_label = TREE_CHAIN (ctxp->current_labeled_block);
12966 }
12967 /* For a SWITCH statement, this is the current one */
12968 else
12969 bc_label = ctxp->current_labeled_block;
12970 }
12971 /* Not having a loop to break/continue to is an error */
12972 else
12973 {
12974 parse_error_context (wfl_operator, "`%s' must be in loop%s",
12975 (IS_BREAK_STMT_P (node) ? "break" : "continue"),
12976 (IS_BREAK_STMT_P (node) ? " or switch" : ""));
12977 return error_mark_node;
12978 }
12979 }
12980 /* Having an identifier here means that the target is unknown. */
12981 else if (TREE_CODE (bc_label) == IDENTIFIER_NODE)
12982 {
12983 parse_error_context (wfl_operator, "No label definition found for `%s'",
12984 IDENTIFIER_POINTER (bc_label));
12985 return error_mark_node;
12986 }
12987
12988 /* Find the statement we're targeting. */
12989 target_stmt = LABELED_BLOCK_BODY (bc_label);
12990
12991 /* 14.13 The break Statement */
12992 if (IS_BREAK_STMT_P (node))
12993 {
12994 /* Named break are always fine, as far as they have a target
12995 (already verified). Anonymous break need to target
12996 while/do/for/switch */
12997 if (is_unlabeled &&
12998 !(TREE_CODE (target_stmt) == LOOP_EXPR /* do/while/for */
12999 || TREE_CODE (target_stmt) == SWITCH_EXPR)) /* switch FIXME */
13000 {
13001 parse_error_context (wfl_operator,
13002 "`break' must be in loop or switch");
13003 return error_mark_node;
13004 }
13005 /* If previously unlabeled, install the new found label */
13006 if (is_unlabeled)
13007 EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
13008 }
13009 /* 14.14 The continue Statement */
13010 /* The continue statement must always target a loop */
13011 else
13012 {
13013 if (TREE_CODE (target_stmt) != LOOP_EXPR) /* do/while/for */
13014 {
13015 parse_error_context (wfl_operator, "`continue' must be in loop");
13016 return error_mark_node;
13017 }
13018 /* Everything looks good. We can fix the `continue' jump to go
13019 at the place in the loop were the continue is. The continue
13020 is the current labeled block, by construction. */
13021 EXIT_BLOCK_LABELED_BLOCK (node) = bc_label = ctxp->current_labeled_block;
13022 }
13023
13024 CAN_COMPLETE_NORMALLY (bc_label) = 1;
13025
13026 /* Our break/continue don't return values. */
13027 TREE_TYPE (node) = void_type_node;
13028 /* Encapsulate the break within a compound statement so that it's
13029 expanded all the times by expand_expr (and not clobered
13030 sometimes, like after a if statement) */
13031 node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
13032 TREE_SIDE_EFFECTS (node) = 1;
13033 return node;
13034 }
13035
13036 /* Process the exit expression belonging to a loop. Its type must be
13037 boolean. */
13038
13039 static tree
13040 patch_exit_expr (node)
13041 tree node;
13042 {
13043 tree expression = TREE_OPERAND (node, 0);
13044 TREE_TYPE (node) = error_mark_node;
13045 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13046
13047 /* The type of expression must be boolean */
13048 if (TREE_TYPE (expression) != boolean_type_node)
13049 {
13050 parse_error_context
13051 (wfl_operator,
13052 "Incompatible type for loop conditional. Can't convert `%s' to "
13053 "`boolean'",
13054 lang_printable_name (TREE_TYPE (expression), 0));
13055 return error_mark_node;
13056 }
13057 /* Now we know things are allright, invert the condition, fold and
13058 return */
13059 TREE_OPERAND (node, 0) =
13060 fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression));
13061
13062 if (! integer_zerop (TREE_OPERAND (node, 0))
13063 && ctxp->current_loop != NULL_TREE
13064 && TREE_CODE (ctxp->current_loop) == LOOP_EXPR)
13065 CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1;
13066 if (! integer_onep (TREE_OPERAND (node, 0)))
13067 CAN_COMPLETE_NORMALLY (node) = 1;
13068
13069
13070 TREE_TYPE (node) = void_type_node;
13071 return node;
13072 }
13073
13074 /* 14.9 Switch statement */
13075
13076 static tree
13077 patch_switch_statement (node)
13078 tree node;
13079 {
13080 tree se = TREE_OPERAND (node, 0), se_type;
13081
13082 /* Complete the switch expression */
13083 se = TREE_OPERAND (node, 0) = java_complete_tree (se);
13084 se_type = TREE_TYPE (se);
13085 /* The type of the switch expression must be char, byte, short or
13086 int */
13087 if (!JINTEGRAL_TYPE_P (se_type))
13088 {
13089 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13090 parse_error_context (wfl_operator, "Incompatible type for `switch'. "
13091 "Can't convert `%s' to `int'",
13092 lang_printable_name (se_type, 0));
13093 /* This is what java_complete_tree will check */
13094 TREE_OPERAND (node, 0) = error_mark_node;
13095 return error_mark_node;
13096 }
13097
13098 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
13099
13100 /* Ready to return */
13101 if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK)
13102 {
13103 TREE_TYPE (node) = error_mark_node;
13104 return error_mark_node;
13105 }
13106 TREE_TYPE (node) = void_type_node;
13107 TREE_SIDE_EFFECTS (node) = 1;
13108 CAN_COMPLETE_NORMALLY (node)
13109 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
13110 || ! SWITCH_HAS_DEFAULT (node);
13111 return node;
13112 }
13113
13114 /* 14.18 The try statement */
13115
13116 /* Wrap BLOCK around a LABELED_BLOCK, set DECL to the newly generated
13117 exit labeld and issue a jump to FINALLY_LABEL:
13118
13119 LABELED_BLOCK
13120 BLOCK
13121 <orignal_statments>
13122 DECL = &LABEL_DECL
13123 GOTO_EXPR
13124 FINALLY_LABEL
13125 LABEL_DECL */
13126
13127 static tree
13128 build_jump_to_finally (block, decl, finally_label, type)
13129 tree block, decl, finally_label, type;
13130 {
13131 tree stmt;
13132 tree new_block = build (LABELED_BLOCK_EXPR, type,
13133 create_label_decl (generate_name ()), block);
13134
13135 stmt = build (MODIFY_EXPR, void_type_node, decl,
13136 build_address_of (LABELED_BLOCK_LABEL (new_block)));
13137 TREE_SIDE_EFFECTS (stmt) = 1;
13138 CAN_COMPLETE_NORMALLY (stmt) = 1;
13139 add_stmt_to_block (block, type, stmt);
13140 stmt = build (GOTO_EXPR, void_type_node, finally_label);
13141 TREE_SIDE_EFFECTS (stmt) = 1;
13142 add_stmt_to_block (block, type, stmt);
13143 return new_block;
13144 }
13145
13146 static tree
13147 build_try_statement (location, try_block, catches, finally)
13148 int location;
13149 tree try_block, catches, finally;
13150 {
13151 tree node, rff;
13152
13153 if (finally && ! flag_emit_class_files)
13154 {
13155 /* This block defines a scope for the entire try[-catch]-finally
13156 sequence. It hold a local variable used to return from the
13157 finally using a computed goto. We call it
13158 return_from_finally (RFF). */
13159 rff = build_decl (VAR_DECL, generate_name (), return_address_type_node);
13160
13161 /* Modification of the try block. */
13162 try_block = build_jump_to_finally (try_block, rff,
13163 FINALLY_EXPR_LABEL (finally),
13164 NULL_TREE);
13165
13166 /* To the finally block: add the computed goto */
13167 add_stmt_to_block (FINALLY_EXPR_BLOCK (finally), NULL_TREE,
13168 build (GOTO_EXPR, void_type_node, rff));
13169
13170 /* Modification of each catch blocks, if any */
13171 if (catches)
13172 {
13173 tree catch, catch_decl, catch_block, stmt;
13174
13175 for (catch = catches; catch; catch = TREE_CHAIN (catch))
13176 TREE_OPERAND (catch, 0) =
13177 build_jump_to_finally (TREE_OPERAND (catch, 0), rff,
13178 FINALLY_EXPR_LABEL (finally),
13179 NULL_TREE);
13180
13181 /* Plus, at the end of the list, we add the catch clause that
13182 will catch an uncaught exception, call finally and rethrow it:
13183 BLOCK
13184 void *exception_parameter; (catch_decl)
13185 LABELED_BLOCK
13186 BLOCK
13187 exception_parameter = _Jv_exception_info ();
13188 RFF = &LABEL_DECL;
13189 goto finally;
13190 LABEL_DECL;
13191 CALL_EXPR
13192 Jv_ReThrow
13193 exception_parameter */
13194 catch_decl = build_decl (VAR_DECL, generate_name (), ptr_type_node);
13195 BUILD_ASSIGN_EXCEPTION_INFO (stmt, catch_decl);
13196 catch_block = build_expr_block (stmt, NULL_TREE);
13197 catch_block = build_jump_to_finally (catch_block, rff,
13198 FINALLY_EXPR_LABEL (finally),
13199 void_type_node);
13200 BUILD_THROW (stmt, catch_decl);
13201 catch_block = build_expr_block (catch_block, catch_decl);
13202 add_stmt_to_block (catch_block, void_type_node, stmt);
13203
13204 /* Link the new handler to the existing list as the first
13205 entry. It will be the last one to be generated. */
13206 catch = build1 (CATCH_EXPR, void_type_node, catch_block);
13207 TREE_CHAIN (catch) = catches;
13208 catches = catch;
13209 }
13210 }
13211
13212 node = build (TRY_EXPR, NULL_TREE, try_block, catches, finally);
13213 EXPR_WFL_LINECOL (node) = location;
13214
13215 /* If we have a finally, surround this whole thing by a block where
13216 the RFF local variable is defined. */
13217
13218 return (finally && ! flag_emit_class_files ? build_expr_block (node, rff)
13219 : node);
13220 }
13221
13222 /* Get the catch clause block from an element of the catch clause
13223 list. If depends on whether a finally clause exists or node (in
13224 which case the original catch clause was surrounded by a
13225 LABELED_BLOCK_EXPR. */
13226
13227 tree
13228 java_get_catch_block (node, finally_present_p)
13229 tree node;
13230 int finally_present_p;
13231 {
13232 return (CATCH_EXPR_GET_EXPR (TREE_OPERAND (node, 0), finally_present_p));
13233 }
13234
13235 static tree
13236 patch_try_statement (node)
13237 tree node;
13238 {
13239 int error_found = 0;
13240 tree try = TREE_OPERAND (node, 0);
13241 /* Exception handlers are considered in left to right order */
13242 tree catch = nreverse (TREE_OPERAND (node, 1));
13243 tree finally = TREE_OPERAND (node, 2);
13244 int finally_p = (finally ? 1 : 0);
13245 tree current, caught_type_list = NULL_TREE;
13246
13247 /* Check catch clauses, if any. Every time we find an error, we try
13248 to process the next catch clause. We process the catch clause before
13249 the try block so that when processing the try block we can check thrown
13250 exceptions againts the caught type list. */
13251 for (current = catch; current; current = TREE_CHAIN (current))
13252 {
13253 tree carg_decl, carg_type;
13254 tree sub_current, catch_block, catch_clause;
13255 int unreachable;
13256
13257 /* Always detect the last catch clause if a finally is
13258 present. This is the catch-all handler and it just needs to
13259 be walked. */
13260 if (!TREE_CHAIN (current) && finally)
13261 {
13262 TREE_OPERAND (current, 0) =
13263 java_complete_tree (TREE_OPERAND (current, 0));
13264 continue;
13265 }
13266
13267 /* At this point, the structure of the catch clause is
13268 LABELED_BLOCK_EXPR (if we have a finally)
13269 CATCH_EXPR (catch node)
13270 BLOCK (with the decl of the parameter)
13271 COMPOUND_EXPR
13272 MODIFY_EXPR (assignment of the catch parameter)
13273 BLOCK (catch clause block)
13274 LABEL_DECL (where to return after finally (if any))
13275
13276 Since the structure of the catch clause depends on the
13277 presence of a finally, we use a function call to get to the
13278 cath clause */
13279 catch_clause = java_get_catch_block (current, finally_p);
13280 carg_decl = BLOCK_EXPR_DECLS (catch_clause);
13281 carg_type = TREE_TYPE (TREE_TYPE (carg_decl));
13282
13283 /* Catch clauses can't have more than one parameter declared,
13284 but it's already enforced by the grammar. Make sure that the
13285 only parameter of the clause statement in of class Throwable
13286 or a subclass of Throwable, but that was done earlier. The
13287 catch clause parameter type has also been resolved. */
13288
13289 /* Just make sure that the catch clause parameter type inherits
13290 from java.lang.Throwable */
13291 if (!inherits_from_p (carg_type, throwable_type_node))
13292 {
13293 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
13294 parse_error_context (wfl_operator,
13295 "Can't catch class `%s'. Catch clause "
13296 "parameter type must be a subclass of "
13297 "class `java.lang.Throwable'",
13298 lang_printable_name (carg_type, 0));
13299 error_found = 1;
13300 continue;
13301 }
13302
13303 /* Partial check for unreachable catch statement: The catch
13304 clause is reachable iff is no earlier catch block A in
13305 the try statement such that the type of the catch
13306 clause's parameter is the same as or a subclass of the
13307 type of A's parameter */
13308 unreachable = 0;
13309 for (sub_current = catch;
13310 sub_current != current; sub_current = TREE_CHAIN (sub_current))
13311 {
13312 tree sub_catch_clause, decl;
13313 sub_catch_clause = java_get_catch_block (sub_current, finally_p);
13314 decl = BLOCK_EXPR_DECLS (sub_catch_clause);
13315
13316 if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl))))
13317 {
13318 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
13319 parse_error_context
13320 (wfl_operator, "`catch' not reached because of the catch "
13321 "clause at line %d", EXPR_WFL_LINENO (sub_current));
13322 unreachable = error_found = 1;
13323 break;
13324 }
13325 }
13326 /* Complete the catch clause block */
13327 catch_block = java_complete_tree (TREE_OPERAND (current, 0));
13328 if (catch_block == error_mark_node)
13329 {
13330 error_found = 1;
13331 continue;
13332 }
13333 if (CAN_COMPLETE_NORMALLY (catch_block))
13334 CAN_COMPLETE_NORMALLY (node) = 1;
13335 TREE_OPERAND (current, 0) = catch_block;
13336
13337 if (unreachable)
13338 continue;
13339
13340 /* Things to do here: the exception must be thrown */
13341
13342 /* Link this type to the caught type list */
13343 caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list);
13344 }
13345
13346 PUSH_EXCEPTIONS (caught_type_list);
13347 if ((try = java_complete_tree (try)) == error_mark_node)
13348 error_found = 1;
13349 if (CAN_COMPLETE_NORMALLY (try))
13350 CAN_COMPLETE_NORMALLY (node) = 1;
13351 POP_EXCEPTIONS ();
13352
13353 /* Process finally */
13354 if (finally)
13355 {
13356 current = java_complete_tree (FINALLY_EXPR_BLOCK (finally));
13357 FINALLY_EXPR_BLOCK (finally) = current;
13358 if (current == error_mark_node)
13359 error_found = 1;
13360 if (! CAN_COMPLETE_NORMALLY (current))
13361 CAN_COMPLETE_NORMALLY (node) = 0;
13362 }
13363
13364 /* Verification ends here */
13365 if (error_found)
13366 return error_mark_node;
13367
13368 TREE_OPERAND (node, 0) = try;
13369 TREE_OPERAND (node, 1) = catch;
13370 TREE_OPERAND (node, 2) = finally;
13371 TREE_TYPE (node) = void_type_node;
13372 return node;
13373 }
13374
13375 /* 14.17 The synchronized Statement */
13376
13377 static tree
13378 patch_synchronized_statement (node, wfl_op1)
13379 tree node, wfl_op1;
13380 {
13381 tree expr = TREE_OPERAND (node, 0);
13382 tree block = TREE_OPERAND (node, 1);
13383 tree try_block, catch_all, stmt, compound, decl;
13384
13385 /* The TYPE of expr must be a reference type */
13386 if (!JREFERENCE_TYPE_P (TREE_TYPE (TREE_OPERAND (node, 0))))
13387 {
13388 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
13389 parse_error_context (wfl_operator, "Incompatible type for `synchronized'"
13390 ". Can't convert `%s' to `java.lang.Object'",
13391 lang_printable_name (TREE_TYPE (expr), 0));
13392 return error_mark_node;
13393 }
13394
13395 /* Generate a try-finally for the synchronized statement, except
13396 that the handler that catches all throw exception calls
13397 _Jv_MonitorExit and then rethrow the exception.
13398 The synchronized statement is then implemented as:
13399 TRY
13400 {
13401 _Jv_MonitorEnter (expression)
13402 synchronized_block
13403 _Jv_MonitorExit (expression)
13404 }
13405 CATCH_ALL
13406 {
13407 e = _Jv_exception_info ();
13408 _Jv_MonitorExit (expression)
13409 Throw (e);
13410 } */
13411
13412 /* TRY block */
13413 BUILD_MONITOR_ENTER (stmt, expr);
13414 compound = add_stmt_to_compound (NULL_TREE, int_type_node, stmt);
13415 compound = add_stmt_to_compound (compound, void_type_node, block);
13416 if (CAN_COMPLETE_NORMALLY (block))
13417 {
13418 BUILD_MONITOR_EXIT (stmt, expr);
13419 compound = add_stmt_to_compound (compound, int_type_node, stmt);
13420 }
13421 try_block = build_expr_block (compound, NULL_TREE);
13422 CAN_COMPLETE_NORMALLY (try_block) = CAN_COMPLETE_NORMALLY (block);
13423
13424 /* CATCH_ALL block */
13425 decl = build_decl (VAR_DECL, generate_name (), ptr_type_node);
13426 BUILD_ASSIGN_EXCEPTION_INFO (stmt, decl);
13427 compound = add_stmt_to_compound (NULL_TREE, void_type_node, stmt);
13428 BUILD_MONITOR_EXIT (stmt, expr);
13429 compound = add_stmt_to_compound (compound, int_type_node, stmt);
13430 BUILD_THROW (stmt, decl);
13431 compound = add_stmt_to_compound (compound, void_type_node, stmt);
13432 catch_all = build_expr_block (compound, decl);
13433 catch_all = build_expr_block (catch_all, NULL_TREE);
13434 catch_all = build1 (CATCH_EXPR, void_type_node, catch_all);
13435
13436 /* TRY-CATCH statement */
13437 compound = build (TRY_EXPR, void_type_node, try_block, catch_all, NULL_TREE);
13438 CAN_COMPLETE_NORMALLY (compound) = CAN_COMPLETE_NORMALLY (try_block);
13439 return compound;
13440 }
13441
13442 /* 14.16 The throw Statement */
13443
13444 static tree
13445 patch_throw_statement (node, wfl_op1)
13446 tree node, wfl_op1;
13447 {
13448 tree expr = TREE_OPERAND (node, 0);
13449 tree type = TREE_TYPE (expr);
13450 int unchecked_ok = 0, tryblock_throws_ok = 0;
13451
13452 /* Thrown expression must be assignable to java.lang.Throwable */
13453 if (!try_reference_assignconv (throwable_type_node, expr))
13454 {
13455 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
13456 parse_error_context (wfl_operator, "Can't throw `%s'; it must be a "
13457 "subclass of class `java.lang.Throwable'",
13458 lang_printable_name (type, 0));
13459 /* If the thrown expression was a reference, we further the
13460 compile-time check. */
13461 if (!JREFERENCE_TYPE_P (type))
13462 return error_mark_node;
13463 }
13464
13465 /* At least one of the following must be true */
13466
13467 /* The type of the throw expression is a not checked exception,
13468 i.e. is a unchecked expression. */
13469 unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type));
13470
13471 /* Throw is contained in a try statement and at least one catch
13472 clause can receive the thrown expression or the current method is
13473 declared to throw such an exception. Or, the throw statement is
13474 contained in a method or constructor declaration and the type of
13475 the Expression is assignable to at least one type listed in the
13476 throws clause the declaration. */
13477 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
13478 if (!unchecked_ok)
13479 tryblock_throws_ok =
13480 check_thrown_exceptions_do (TREE_TYPE (expr));
13481 if (!(unchecked_ok || tryblock_throws_ok))
13482 {
13483 /* If there is a surrounding try block that has no matching
13484 clatch clause, report it first. A surrounding try block exits
13485 only if there is something after the list of checked
13486 exception thrown by the current function (if any). */
13487 if (IN_TRY_BLOCK_P ())
13488 parse_error_context (wfl_operator, "Checked exception `%s' can't be "
13489 "caught by any of the catch clause(s) "
13490 "of the surrounding `try' block",
13491 lang_printable_name (type, 0));
13492 /* If we have no surrounding try statement and the method doesn't have
13493 any throws, report it now. FIXME */
13494 else if (!EXCEPTIONS_P (currently_caught_type_list)
13495 && !tryblock_throws_ok)
13496 parse_error_context (wfl_operator, "Checked exception `%s' isn't "
13497 "thrown from a `try' block",
13498 lang_printable_name (type, 0));
13499 /* Otherwise, the current method doesn't have the appropriate
13500 throws declaration */
13501 else
13502 parse_error_context (wfl_operator, "Checked exception `%s' doesn't "
13503 "match any of current method's `throws' "
13504 "declaration(s)",
13505 lang_printable_name (type, 0));
13506 return error_mark_node;
13507 }
13508
13509 /* If a throw statement is contained in a static initializer, then a
13510 compile-time check ensures that either its value is always an
13511 unchecked exception or its value is always caught by some try
13512 statement that contains it. FIXME, static initializer. */
13513
13514 if (! flag_emit_class_files)
13515 BUILD_THROW (node, expr);
13516 return node;
13517 }
13518
13519 /* Check that exception said to be thrown by method DECL can be
13520 effectively caught from where DECL is invoked. */
13521
13522 static void
13523 check_thrown_exceptions (location, decl)
13524 int location;
13525 tree decl;
13526 {
13527 tree throws;
13528 /* For all the unchecked exceptions thrown by DECL */
13529 for (throws = DECL_FUNCTION_THROWS (decl); throws;
13530 throws = TREE_CHAIN (throws))
13531 if (!check_thrown_exceptions_do (TREE_VALUE (throws)))
13532 {
13533 #if 1
13534 /* Temporary hack to suppresses errors about cloning arrays. FIXME */
13535 if (DECL_NAME (decl) == get_identifier ("clone"))
13536 continue;
13537 #endif
13538 EXPR_WFL_LINECOL (wfl_operator) = location;
13539 parse_error_context
13540 (wfl_operator, "Exception `%s' must be caught, or it must be "
13541 "declared in the `throws' clause of `%s'",
13542 lang_printable_name (TREE_VALUE (throws), 0),
13543 IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
13544 }
13545 }
13546
13547 /* Return 1 if checked EXCEPTION is caught at the current nesting level of
13548 try-catch blocks, OR is listed in the `throws' clause of the
13549 current method. */
13550
13551 static int
13552 check_thrown_exceptions_do (exception)
13553 tree exception;
13554 {
13555 tree list = currently_caught_type_list;
13556 resolve_and_layout (exception, NULL_TREE);
13557 /* First, all the nested try-catch-finally at that stage. The
13558 last element contains `throws' clause exceptions, if any. */
13559 if (IS_UNCHECKED_EXCEPTION_P (exception))
13560 return 1;
13561 while (list)
13562 {
13563 tree caught;
13564 for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught))
13565 if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0))
13566 return 1;
13567 list = TREE_CHAIN (list);
13568 }
13569 return 0;
13570 }
13571
13572 static void
13573 purge_unchecked_exceptions (mdecl)
13574 tree mdecl;
13575 {
13576 tree throws = DECL_FUNCTION_THROWS (mdecl);
13577 tree new = NULL_TREE;
13578
13579 while (throws)
13580 {
13581 tree next = TREE_CHAIN (throws);
13582 if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws)))
13583 {
13584 TREE_CHAIN (throws) = new;
13585 new = throws;
13586 }
13587 throws = next;
13588 }
13589 /* List is inverted here, but it doesn't matter */
13590 DECL_FUNCTION_THROWS (mdecl) = new;
13591 }
13592
13593 /* 15.24 Conditional Operator ?: */
13594
13595 static tree
13596 patch_conditional_expr (node, wfl_cond, wfl_op1)
13597 tree node, wfl_cond, wfl_op1;
13598 {
13599 tree cond = TREE_OPERAND (node, 0);
13600 tree op1 = TREE_OPERAND (node, 1);
13601 tree op2 = TREE_OPERAND (node, 2);
13602 tree resulting_type = NULL_TREE;
13603 tree t1, t2, patched;
13604 int error_found = 0;
13605
13606 /* Operands of ?: might be StringBuffers crafted as a result of a
13607 string concatenation. Obtain a descent operand here. */
13608 if ((patched = patch_string (op1)))
13609 TREE_OPERAND (node, 1) = op1 = patched;
13610 if ((patched = patch_string (op2)))
13611 TREE_OPERAND (node, 2) = op2 = patched;
13612
13613 t1 = TREE_TYPE (op1);
13614 t2 = TREE_TYPE (op2);
13615
13616 /* The first expression must be a boolean */
13617 if (TREE_TYPE (cond) != boolean_type_node)
13618 {
13619 SET_WFL_OPERATOR (wfl_operator, node, wfl_cond);
13620 parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
13621 "convert `%s' to `boolean'",
13622 lang_printable_name (TREE_TYPE (cond), 0));
13623 error_found = 1;
13624 }
13625
13626 /* Second and third can be numeric, boolean (i.e. primitive),
13627 references or null. Anything else results in an error */
13628 if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2))
13629 || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node)
13630 && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node))
13631 || (t1 == boolean_type_node && t2 == boolean_type_node)))
13632 error_found = 1;
13633
13634 /* Determine the type of the conditional expression. Same types are
13635 easy to deal with */
13636 else if (t1 == t2)
13637 resulting_type = t1;
13638
13639 /* There are different rules for numeric types */
13640 else if (JNUMERIC_TYPE_P (t1))
13641 {
13642 /* if byte/short found, the resulting type is short */
13643 if ((t1 == byte_type_node && t2 == short_type_node)
13644 || (t1 == short_type_node && t2 == byte_type_node))
13645 resulting_type = short_type_node;
13646
13647 /* If t1 is a constant int and t2 is of type byte, short or char
13648 and t1's value fits in t2, then the resulting type is t2 */
13649 else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1)))
13650 && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2))
13651 resulting_type = t2;
13652
13653 /* If t2 is a constant int and t1 is of type byte, short or char
13654 and t2's value fits in t1, then the resulting type is t1 */
13655 else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2)))
13656 && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1))
13657 resulting_type = t1;
13658
13659 /* Otherwise, binary numeric promotion is applied and the
13660 resulting type is the promoted type of operand 1 and 2 */
13661 else
13662 resulting_type = binary_numeric_promotion (t2, t2,
13663 &TREE_OPERAND (node, 1),
13664 &TREE_OPERAND (node, 2));
13665 }
13666
13667 /* Cases of a reference and a null type */
13668 else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node)
13669 resulting_type = t1;
13670
13671 else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node)
13672 resulting_type = t2;
13673
13674 /* Last case: different reference types. If a type can be converted
13675 into the other one by assignment conversion, the latter
13676 determines the type of the expression */
13677 else if ((resulting_type = try_reference_assignconv (t1, op2)))
13678 resulting_type = promote_type (t1);
13679
13680 else if ((resulting_type = try_reference_assignconv (t2, op1)))
13681 resulting_type = promote_type (t2);
13682
13683 /* If we don't have any resulting type, we're in trouble */
13684 if (!resulting_type)
13685 {
13686 char *t = strdup (lang_printable_name (t1, 0));
13687 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
13688 parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
13689 "convert `%s' to `%s'", t,
13690 lang_printable_name (t2, 0));
13691 free (t);
13692 error_found = 1;
13693 }
13694
13695 if (error_found)
13696 {
13697 TREE_TYPE (node) = error_mark_node;
13698 return error_mark_node;
13699 }
13700
13701 TREE_TYPE (node) = resulting_type;
13702 TREE_SET_CODE (node, COND_EXPR);
13703 CAN_COMPLETE_NORMALLY (node) = 1;
13704 return node;
13705 }
13706
13707 /* Try to constant fold NODE.
13708 If NODE is not a constant expression, return NULL_EXPR.
13709 CONTEXT is a static final VAR_DECL whose initializer we are folding. */
13710
13711 static tree
13712 fold_constant_for_init (node, context)
13713 tree node;
13714 tree context;
13715 {
13716 tree op0, op1, val;
13717 enum tree_code code = TREE_CODE (node);
13718
13719 if (code == INTEGER_CST || code == REAL_CST || code == STRING_CST)
13720 return node;
13721 if (TREE_TYPE (node) != NULL_TREE)
13722 return NULL_TREE;
13723
13724 switch (code)
13725 {
13726 case MULT_EXPR:
13727 case PLUS_EXPR:
13728 case MINUS_EXPR:
13729 case LSHIFT_EXPR:
13730 case RSHIFT_EXPR:
13731 case URSHIFT_EXPR:
13732 case BIT_AND_EXPR:
13733 case BIT_XOR_EXPR:
13734 case BIT_IOR_EXPR:
13735 case TRUNC_MOD_EXPR:
13736 case RDIV_EXPR:
13737 case TRUTH_ANDIF_EXPR:
13738 case TRUTH_ORIF_EXPR:
13739 case EQ_EXPR:
13740 case NE_EXPR:
13741 case GT_EXPR:
13742 case GE_EXPR:
13743 case LT_EXPR:
13744 case LE_EXPR:
13745 op0 = TREE_OPERAND (node, 0);
13746 op1 = TREE_OPERAND (node, 1);
13747 val = fold_constant_for_init (op0, context);
13748 if (val == NULL_TREE || ! TREE_CONSTANT (val))
13749 return NULL_TREE;
13750 TREE_OPERAND (node, 0) = val;
13751 val = fold_constant_for_init (op1, context);
13752 if (val == NULL_TREE || ! TREE_CONSTANT (val))
13753 return NULL_TREE;
13754 TREE_OPERAND (node, 1) = val;
13755 return patch_binop (node, op0, op1);
13756
13757 case UNARY_PLUS_EXPR:
13758 case NEGATE_EXPR:
13759 case TRUTH_NOT_EXPR:
13760 case BIT_NOT_EXPR:
13761 case CONVERT_EXPR:
13762 op0 = TREE_OPERAND (node, 0);
13763 val = fold_constant_for_init (op0, context);
13764 if (val == NULL_TREE || ! TREE_CONSTANT (val))
13765 return NULL_TREE;
13766 TREE_OPERAND (node, 0) = val;
13767 node = patch_unaryop (node, op0);
13768 break;
13769
13770 case COND_EXPR:
13771 val = fold_constant_for_init (TREE_OPERAND (node, 0), context);
13772 if (val == NULL_TREE || ! TREE_CONSTANT (val))
13773 return NULL_TREE;
13774 TREE_OPERAND (node, 0) = val;
13775 val = fold_constant_for_init (TREE_OPERAND (node, 1), context);
13776 if (val == NULL_TREE || ! TREE_CONSTANT (val))
13777 return NULL_TREE;
13778 TREE_OPERAND (node, 1) = val;
13779 val = fold_constant_for_init (TREE_OPERAND (node, 2), context);
13780 if (val == NULL_TREE || ! TREE_CONSTANT (val))
13781 return NULL_TREE;
13782 TREE_OPERAND (node, 2) = val;
13783 return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1)
13784 : TREE_OPERAND (node, 2);
13785
13786 case VAR_DECL:
13787 if (! FIELD_STATIC (node) || ! FIELD_FINAL (node)
13788 || DECL_INITIAL (node) == NULL_TREE)
13789 return NULL_TREE;
13790 val = DECL_INITIAL (node);
13791 /* Guard against infinite recursion. */
13792 DECL_INITIAL (node) = NULL_TREE;
13793 val = fold_constant_for_init (val, DECL_CONTEXT (node));
13794 DECL_INITIAL (node) = val;
13795 return val;
13796
13797 case EXPR_WITH_FILE_LOCATION:
13798 /* Compare java_complete_tree and resolve_expression_name. */
13799 if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
13800 || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
13801 {
13802 tree name = EXPR_WFL_NODE (node);
13803 tree decl;
13804 if (PRIMARY_P (node))
13805 return NULL_TREE;
13806 else if (! QUALIFIED_P (name))
13807 {
13808 decl = lookup_field_wrapper (DECL_CONTEXT (context), name);
13809 if (! FIELD_STATIC (decl))
13810 return NULL_TREE;
13811 return fold_constant_for_init (decl, decl);
13812 }
13813 else
13814 {
13815 #if 0
13816 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
13817 qualify_ambiguous_name (node);
13818 if (resolve_field_access (node, &decl, NULL)
13819 && decl != NULL_TREE)
13820 return fold_constant_for_init (decl, decl);
13821 #endif
13822 return NULL_TREE;
13823 }
13824 }
13825 else
13826 {
13827 op0 = TREE_OPERAND (node, 0);
13828 val = fold_constant_for_init (op0, context);
13829 if (val == NULL_TREE || ! TREE_CONSTANT (val))
13830 return NULL_TREE;
13831 TREE_OPERAND (node, 0) = val;
13832 return val;
13833 }
13834
13835 default:
13836 return NULL_TREE;
13837 }
13838 }
This page took 0.840258 seconds and 5 git commands to generate.