2 /* A Bison parser, made from ./parse.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse java_parse
9 #define yyerror java_error
10 #define yylval java_lval
11 #define yychar java_char
12 #define yydebug java_debug
13 #define yynerrs java_nerrs
25 #define BOOL_AND_TK 268
26 #define BOOL_OR_TK 269
33 #define PLUS_ASSIGN_TK 276
34 #define MINUS_ASSIGN_TK 277
35 #define MULT_ASSIGN_TK 278
36 #define DIV_ASSIGN_TK 279
37 #define REM_ASSIGN_TK 280
38 #define LS_ASSIGN_TK 281
39 #define SRS_ASSIGN_TK 282
40 #define ZRS_ASSIGN_TK 283
41 #define AND_ASSIGN_TK 284
42 #define XOR_ASSIGN_TK 285
43 #define OR_ASSIGN_TK 286
45 #define PRIVATE_TK 288
46 #define PROTECTED_TK 289
49 #define SYNCHRONIZED_TK 292
50 #define VOLATILE_TK 293
51 #define TRANSIENT_TK 294
54 #define ABSTRACT_TK 297
55 #define MODIFIER_TK 298
58 #define DEFAULT_TK 301
61 #define BOOLEAN_TK 304
63 #define IMPLEMENTS_TK 306
68 #define INSTANCEOF_TK 311
72 #define INTERFACE_TK 315
74 #define EXTENDS_TK 317
75 #define FINALLY_TK 318
84 #define CONTINUE_TK 327
86 #define PACKAGE_TK 329
93 #define INTEGRAL_TK 336
102 #define ASSIGN_ANY_TK 345
103 #define ASSIGN_TK 346
113 #define STRING_LIT_TK 356
114 #define CHAR_LIT_TK 357
115 #define INT_LIT_TK 358
116 #define FP_LIT_TK 359
119 #define BOOL_LIT_TK 362
132 #include "java-tree.h"
140 #include "function.h"
142 #include "defaults.h"
144 /* Local function prototypes */
145 static char *java_accstring_lookup PARAMS ((int));
146 static void classitf_redefinition_error PARAMS ((const char *,tree, tree, tree));
147 static void variable_redefinition_error PARAMS ((tree, tree, tree, int));
148 static tree create_class PARAMS ((int, tree, tree, tree));
149 static tree create_interface PARAMS ((int, tree, tree));
150 static tree find_field PARAMS ((tree, tree));
151 static tree lookup_field_wrapper PARAMS ((tree, tree));
152 static int duplicate_declaration_error_p PARAMS ((tree, tree, tree));
153 static void register_fields PARAMS ((int, tree, tree));
154 static tree parser_qualified_classname PARAMS ((tree));
155 static int parser_check_super PARAMS ((tree, tree, tree));
156 static int parser_check_super_interface PARAMS ((tree, tree, tree));
157 static void check_modifiers_consistency PARAMS ((int));
158 static tree lookup_cl PARAMS ((tree));
159 static tree lookup_java_method2 PARAMS ((tree, tree, int));
160 static tree method_header PARAMS ((int, tree, tree, tree));
161 static void fix_method_argument_names PARAMS ((tree ,tree));
162 static tree method_declarator PARAMS ((tree, tree));
163 static void parse_warning_context PARAMS ((tree cl, const char *msg, ...))
165 static void issue_warning_error_from_context PARAMS ((tree, const char *msg, va_list));
166 static void parse_ctor_invocation_error PARAMS ((void));
167 static tree parse_jdk1_1_error PARAMS ((const char *));
168 static void complete_class_report_errors PARAMS ((jdep *));
169 static int process_imports PARAMS ((void));
170 static void read_import_dir PARAMS ((tree));
171 static int find_in_imports_on_demand PARAMS ((tree));
172 static int find_in_imports PARAMS ((tree));
173 static int check_pkg_class_access PARAMS ((tree, tree));
174 static tree resolve_package PARAMS ((tree, tree *));
175 static tree lookup_package_type PARAMS ((const char *, int));
176 static tree lookup_package_type_and_set_next PARAMS ((const char *, int, tree *));
177 static tree resolve_class PARAMS ((tree, tree, tree));
178 static void declare_local_variables PARAMS ((int, tree, tree));
179 static void source_start_java_method PARAMS ((tree));
180 static void source_end_java_method PARAMS ((void));
181 static void expand_start_java_method PARAMS ((tree));
182 static tree find_name_in_single_imports PARAMS ((tree));
183 static void check_abstract_method_header PARAMS ((tree));
184 static tree lookup_java_interface_method2 PARAMS ((tree, tree));
185 static tree resolve_expression_name PARAMS ((tree, tree *));
186 static tree maybe_create_class_interface_decl PARAMS ((tree, tree, tree));
187 static int check_class_interface_creation PARAMS ((int, int, tree,
189 static tree patch_method_invocation PARAMS ((tree, tree, tree,
191 static int breakdown_qualified PARAMS ((tree *, tree *, tree));
192 static tree resolve_and_layout PARAMS ((tree, tree));
193 static tree resolve_no_layout PARAMS ((tree, tree));
194 static int invocation_mode PARAMS ((tree, int));
195 static tree find_applicable_accessible_methods_list PARAMS ((int, tree,
197 static void search_applicable_methods_list PARAMS ((int, tree, tree, tree,
199 static tree find_most_specific_methods_list PARAMS ((tree));
200 static int argument_types_convertible PARAMS ((tree, tree));
201 static tree patch_invoke PARAMS ((tree, tree, tree));
202 static tree lookup_method_invoke PARAMS ((int, tree, tree, tree, tree));
203 static tree register_incomplete_type PARAMS ((int, tree, tree, tree));
204 static tree obtain_incomplete_type PARAMS ((tree));
205 static tree java_complete_lhs PARAMS ((tree));
206 static tree java_complete_tree PARAMS ((tree));
207 static int java_pre_expand_clinit PARAMS ((tree));
208 static void java_complete_expand_method PARAMS ((tree));
209 static int unresolved_type_p PARAMS ((tree, tree *));
210 static void create_jdep_list PARAMS ((struct parser_ctxt *));
211 static tree build_expr_block PARAMS ((tree, tree));
212 static tree enter_block PARAMS ((void));
213 static tree enter_a_block PARAMS ((tree));
214 static tree exit_block PARAMS ((void));
215 static tree lookup_name_in_blocks PARAMS ((tree));
216 static void maybe_absorb_scoping_blocks PARAMS ((void));
217 static tree build_method_invocation PARAMS ((tree, tree));
218 static tree build_new_invocation PARAMS ((tree, tree));
219 static tree build_assignment PARAMS ((int, int, tree, tree));
220 static tree build_binop PARAMS ((enum tree_code, int, tree, tree));
221 static int check_final_assignment PARAMS ((tree ,tree));
222 static tree patch_assignment PARAMS ((tree, tree, tree ));
223 static tree patch_binop PARAMS ((tree, tree, tree));
224 static tree build_unaryop PARAMS ((int, int, tree));
225 static tree build_incdec PARAMS ((int, int, tree, int));
226 static tree patch_unaryop PARAMS ((tree, tree));
227 static tree build_cast PARAMS ((int, tree, tree));
228 static tree build_null_of_type PARAMS ((tree));
229 static tree patch_cast PARAMS ((tree, tree));
230 static int valid_ref_assignconv_cast_p PARAMS ((tree, tree, int));
231 static int valid_builtin_assignconv_identity_widening_p PARAMS ((tree, tree));
232 static int valid_cast_to_p PARAMS ((tree, tree));
233 static int valid_method_invocation_conversion_p PARAMS ((tree, tree));
234 static tree try_builtin_assignconv PARAMS ((tree, tree, tree));
235 static tree try_reference_assignconv PARAMS ((tree, tree));
236 static tree build_unresolved_array_type PARAMS ((tree));
237 static tree build_array_from_name PARAMS ((tree, tree, tree, tree *));
238 static tree build_array_ref PARAMS ((int, tree, tree));
239 static tree patch_array_ref PARAMS ((tree));
240 static tree make_qualified_name PARAMS ((tree, tree, int));
241 static tree merge_qualified_name PARAMS ((tree, tree));
242 static tree make_qualified_primary PARAMS ((tree, tree, int));
243 static int resolve_qualified_expression_name PARAMS ((tree, tree *,
245 static void qualify_ambiguous_name PARAMS ((tree));
246 static void maybe_generate_clinit PARAMS ((void));
247 static tree resolve_field_access PARAMS ((tree, tree *, tree *));
248 static tree build_newarray_node PARAMS ((tree, tree, int));
249 static tree patch_newarray PARAMS ((tree));
250 static tree resolve_type_during_patch PARAMS ((tree));
251 static tree build_this PARAMS ((int));
252 static tree build_return PARAMS ((int, tree));
253 static tree patch_return PARAMS ((tree));
254 static tree maybe_access_field PARAMS ((tree, tree, tree));
255 static int complete_function_arguments PARAMS ((tree));
256 static int check_for_static_method_reference PARAMS ((tree, tree, tree, tree, tree));
257 static int not_accessible_p PARAMS ((tree, tree, int));
258 static void check_deprecation PARAMS ((tree, tree));
259 static int class_in_current_package PARAMS ((tree));
260 static tree build_if_else_statement PARAMS ((int, tree, tree, tree));
261 static tree patch_if_else_statement PARAMS ((tree));
262 static tree add_stmt_to_compound PARAMS ((tree, tree, tree));
263 static tree add_stmt_to_block PARAMS ((tree, tree, tree));
264 static tree patch_exit_expr PARAMS ((tree));
265 static tree build_labeled_block PARAMS ((int, tree));
266 static tree finish_labeled_statement PARAMS ((tree, tree));
267 static tree build_bc_statement PARAMS ((int, int, tree));
268 static tree patch_bc_statement PARAMS ((tree));
269 static tree patch_loop_statement PARAMS ((tree));
270 static tree build_new_loop PARAMS ((tree));
271 static tree build_loop_body PARAMS ((int, tree, int));
272 static tree finish_loop_body PARAMS ((int, tree, tree, int));
273 static tree build_debugable_stmt PARAMS ((int, tree));
274 static tree finish_for_loop PARAMS ((int, tree, tree, tree));
275 static tree patch_switch_statement PARAMS ((tree));
276 static tree string_constant_concatenation PARAMS ((tree, tree));
277 static tree build_string_concatenation PARAMS ((tree, tree));
278 static tree patch_string_cst PARAMS ((tree));
279 static tree patch_string PARAMS ((tree));
280 static tree build_try_statement PARAMS ((int, tree, tree));
281 static tree build_try_finally_statement PARAMS ((int, tree, tree));
282 static tree patch_try_statement PARAMS ((tree));
283 static tree patch_synchronized_statement PARAMS ((tree, tree));
284 static tree patch_throw_statement PARAMS ((tree, tree));
285 static void check_thrown_exceptions PARAMS ((int, tree));
286 static int check_thrown_exceptions_do PARAMS ((tree));
287 static void purge_unchecked_exceptions PARAMS ((tree));
288 static void check_throws_clauses PARAMS ((tree, tree, tree));
289 static void finish_method_declaration PARAMS ((tree));
290 static tree build_super_invocation PARAMS ((tree));
291 static int verify_constructor_circularity PARAMS ((tree, tree));
292 static char *constructor_circularity_msg PARAMS ((tree, tree));
293 static tree build_this_super_qualified_invocation PARAMS ((int, tree, tree,
295 static const char *get_printable_method_name PARAMS ((tree));
296 static tree patch_conditional_expr PARAMS ((tree, tree, tree));
297 static void maybe_generate_finit PARAMS ((void));
298 static void fix_constructors PARAMS ((tree));
299 static int verify_constructor_super PARAMS ((void));
300 static tree create_artificial_method PARAMS ((tree, int, tree, tree, tree));
301 static void start_artificial_method_body PARAMS ((tree));
302 static void end_artificial_method_body PARAMS ((tree));
303 static int check_method_redefinition PARAMS ((tree, tree));
304 static int reset_method_name PARAMS ((tree));
305 static void java_check_regular_methods PARAMS ((tree));
306 static void java_check_abstract_methods PARAMS ((tree));
307 static tree maybe_build_primttype_type_ref PARAMS ((tree, tree));
308 static void unreachable_stmt_error PARAMS ((tree));
309 static tree find_expr_with_wfl PARAMS ((tree));
310 static void missing_return_error PARAMS ((tree));
311 static tree build_new_array_init PARAMS ((int, tree));
312 static tree patch_new_array_init PARAMS ((tree, tree));
313 static tree maybe_build_array_element_wfl PARAMS ((tree));
314 static int array_constructor_check_entry PARAMS ((tree, tree));
315 static const char *purify_type_name PARAMS ((const char *));
316 static tree fold_constant_for_init PARAMS ((tree, tree));
317 static tree strip_out_static_field_access_decl PARAMS ((tree));
318 static jdeplist *reverse_jdep_list PARAMS ((struct parser_ctxt *));
319 static void static_ref_err PARAMS ((tree, tree, tree));
320 static void parser_add_interface PARAMS ((tree, tree, tree));
321 static void add_superinterfaces PARAMS ((tree, tree));
322 static tree jdep_resolve_class PARAMS ((jdep *));
323 static int note_possible_classname PARAMS ((const char *, int));
324 static void java_complete_expand_methods PARAMS ((void));
325 static void java_expand_finals PARAMS ((void));
326 static tree cut_identifier_in_qualified PARAMS ((tree));
327 static tree java_stabilize_reference PARAMS ((tree));
328 static tree do_unary_numeric_promotion PARAMS ((tree));
329 static char * operator_string PARAMS ((tree));
330 static tree do_merge_string_cste PARAMS ((tree, const char *, int, int));
331 static tree merge_string_cste PARAMS ((tree, tree, int));
332 static tree java_refold PARAMS ((tree));
333 static int java_decl_equiv PARAMS ((tree, tree));
334 static int binop_compound_p PARAMS ((enum tree_code));
335 static tree search_loop PARAMS ((tree));
336 static int labeled_block_contains_loop_p PARAMS ((tree, tree));
337 static void check_abstract_method_definitions PARAMS ((int, tree, tree));
338 static void java_check_abstract_method_definitions PARAMS ((tree));
339 static void java_debug_context_do PARAMS ((int));
341 /* Number of error found so far. */
342 int java_error_count;
343 /* Number of warning found so far. */
344 int java_warning_count;
345 /* Tell when not to fold, when doing xrefs */
348 /* The current parser context */
349 struct parser_ctxt *ctxp;
351 /* List of things that were analyzed for which code will be generated */
352 static struct parser_ctxt *ctxp_for_generation = NULL;
354 /* binop_lookup maps token to tree_code. It is used where binary
355 operations are involved and required by the parser. RDIV_EXPR
356 covers both integral/floating point division. The code is changed
357 once the type of both operator is worked out. */
359 static enum tree_code binop_lookup[19] =
361 PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR,
362 LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR,
363 BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR,
364 TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR,
365 EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR,
367 #define BINOP_LOOKUP(VALUE) \
368 binop_lookup [((VALUE) - PLUS_TK)% \
369 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
371 /* This is the end index for binary operators that can also be used
372 in compound assignements. */
373 #define BINOP_COMPOUND_CANDIDATES 11
375 /* Fake WFL used to report error message. It is initialized once if
376 needed and reused with it's location information is overriden. */
377 tree wfl_operator = NULL_TREE;
379 /* The "$L" identifier we use to create labels. */
380 static tree label_id = NULL_TREE;
382 /* The "StringBuffer" identifier used for the String `+' operator. */
383 static tree wfl_string_buffer = NULL_TREE;
385 /* The "append" identifier used for String `+' operator. */
386 static tree wfl_append = NULL_TREE;
388 /* The "toString" identifier used for String `+' operator. */
389 static tree wfl_to_string = NULL_TREE;
391 /* The "java.lang" import qualified name. */
392 static tree java_lang_id = NULL_TREE;
394 /* The "java.lang.Cloneable" qualified name. */
395 static tree java_lang_cloneable = NULL_TREE;
397 /* Context and flag for static blocks */
398 static tree current_static_block = NULL_TREE;
400 /* The list of all packages we've seen so far */
401 static tree package_list = NULL_TREE;
403 /* Check modifiers. If one doesn't fit, retrieve it in its declaration
404 line and point it out. */
405 /* Should point out the one that don't fit. ASCII/unicode, going
408 #define check_modifiers(__message, __value, __mask) do { \
409 if ((__value) & ~(__mask)) \
411 int i, remainder = (__value) & ~(__mask); \
412 for (i = 0; i <= 10; i++) \
413 if ((1 << i) & remainder) \
414 parse_error_context (ctxp->modifier_ctx [i], (__message), \
415 java_accstring_lookup (1 << i)); \
420 #line 346 "./parse.y"
430 #line 356 "./parse.y"
448 #define YYFLAG -32768
451 #define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 267)
453 static const char yytranslate[] = { 0,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
479 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
480 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
481 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
482 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
483 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
484 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
485 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
486 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
487 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
488 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
489 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
494 static const short yyprhs[] = { 0,
495 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
496 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
497 46, 50, 54, 56, 58, 60, 64, 66, 67, 69,
498 71, 73, 76, 79, 82, 86, 88, 91, 93, 96,
499 100, 103, 107, 109, 111, 115, 118, 122, 128, 133,
500 139, 141, 143, 145, 147, 149, 152, 153, 161, 162,
501 169, 173, 176, 180, 185, 186, 189, 193, 196, 197,
502 200, 203, 205, 209, 213, 216, 220, 222, 225, 227,
503 229, 231, 233, 235, 238, 240, 242, 244, 248, 253,
504 255, 259, 263, 265, 269, 273, 278, 280, 284, 287,
505 291, 295, 297, 299, 300, 304, 307, 311, 315, 320,
506 325, 328, 332, 335, 339, 342, 346, 351, 355, 359,
507 363, 365, 369, 373, 376, 380, 383, 387, 389, 390,
508 393, 396, 398, 402, 406, 408, 411, 413, 416, 420,
509 422, 423, 427, 430, 434, 438, 443, 446, 450, 454,
510 459, 461, 464, 469, 475, 483, 490, 492, 494, 495,
511 500, 501, 507, 508, 514, 515, 522, 526, 531, 534,
512 538, 541, 545, 548, 552, 554, 557, 559, 561, 563,
513 565, 567, 570, 573, 576, 580, 585, 587, 591, 595,
514 598, 602, 604, 606, 608, 611, 613, 615, 617, 620,
515 623, 627, 629, 631, 633, 635, 637, 639, 641, 643,
516 645, 647, 649, 651, 653, 655, 657, 659, 661, 663,
517 665, 667, 669, 671, 673, 676, 679, 682, 685, 688,
518 691, 694, 697, 701, 706, 711, 717, 722, 728, 735,
519 743, 750, 752, 754, 756, 758, 760, 762, 764, 770,
520 773, 777, 782, 790, 798, 799, 803, 808, 811, 815,
521 821, 824, 828, 832, 837, 839, 842, 845, 847, 850,
522 854, 857, 860, 864, 867, 872, 875, 878, 882, 887,
523 890, 892, 900, 908, 915, 919, 925, 930, 938, 945,
524 948, 951, 955, 958, 959, 961, 963, 966, 967, 969,
525 971, 975, 979, 982, 986, 989, 993, 996, 1000, 1003,
526 1007, 1010, 1014, 1017, 1021, 1025, 1028, 1032, 1038, 1044,
527 1047, 1052, 1056, 1058, 1062, 1066, 1071, 1074, 1076, 1079,
528 1082, 1087, 1090, 1094, 1099, 1102, 1105, 1107, 1109, 1111,
529 1113, 1117, 1119, 1121, 1123, 1125, 1129, 1133, 1137, 1141,
530 1145, 1149, 1153, 1157, 1163, 1168, 1175, 1181, 1186, 1192,
531 1198, 1205, 1209, 1213, 1218, 1224, 1227, 1231, 1235, 1239,
532 1241, 1245, 1249, 1253, 1257, 1262, 1267, 1272, 1277, 1281,
533 1285, 1287, 1290, 1294, 1298, 1301, 1304, 1308, 1312, 1316,
534 1320, 1323, 1327, 1332, 1338, 1345, 1351, 1358, 1363, 1368,
535 1373, 1378, 1382, 1387, 1391, 1396, 1398, 1400, 1402, 1404,
536 1407, 1410, 1412, 1414, 1417, 1420, 1422, 1425, 1428, 1431,
537 1434, 1437, 1440, 1442, 1445, 1448, 1450, 1453, 1456, 1462,
538 1467, 1472, 1478, 1483, 1486, 1492, 1497, 1503, 1505, 1509,
539 1513, 1517, 1521, 1525, 1529, 1531, 1535, 1539, 1543, 1547,
540 1549, 1553, 1557, 1561, 1565, 1569, 1573, 1575, 1579, 1583,
541 1587, 1591, 1595, 1599, 1603, 1607, 1611, 1615, 1617, 1621,
542 1625, 1629, 1633, 1635, 1639, 1643, 1645, 1649, 1653, 1655,
543 1659, 1663, 1665, 1669, 1673, 1675, 1679, 1683, 1685, 1691,
544 1696, 1700, 1706, 1708, 1710, 1714, 1718, 1720, 1722, 1724,
548 static const short yyrhs[] = { 123,
549 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
550 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
551 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
552 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
553 0, 118, 97, 98, 0, 113, 97, 1, 0, 118,
554 97, 1, 0, 120, 0, 121, 0, 122, 0, 119,
555 101, 122, 0, 86, 0, 0, 126, 0, 124, 0,
556 125, 0, 126, 124, 0, 126, 125, 0, 124, 125,
557 0, 126, 124, 125, 0, 127, 0, 124, 127, 0,
558 130, 0, 125, 130, 0, 75, 119, 99, 0, 75,
559 1, 0, 75, 119, 1, 0, 128, 0, 129, 0,
560 55, 119, 99, 0, 55, 1, 0, 55, 119, 1,
561 0, 55, 119, 101, 5, 99, 0, 55, 119, 101,
562 1, 0, 55, 119, 101, 5, 1, 0, 132, 0,
563 167, 0, 99, 0, 1, 0, 44, 0, 131, 44,
564 0, 0, 131, 67, 122, 135, 136, 133, 138, 0,
565 0, 67, 122, 135, 136, 134, 138, 0, 131, 67,
566 1, 0, 67, 1, 0, 67, 122, 1, 0, 131,
567 67, 122, 1, 0, 0, 63, 116, 0, 63, 116,
568 1, 0, 63, 1, 0, 0, 52, 137, 0, 52,
569 1, 0, 117, 0, 137, 100, 117, 0, 137, 100,
570 1, 0, 95, 96, 0, 95, 139, 96, 0, 140,
571 0, 139, 140, 0, 141, 0, 157, 0, 159, 0,
572 180, 0, 142, 0, 142, 99, 0, 147, 0, 132,
573 0, 167, 0, 112, 143, 99, 0, 131, 112, 143,
574 99, 0, 144, 0, 143, 100, 144, 0, 143, 100,
575 1, 0, 145, 0, 145, 92, 146, 0, 145, 92,
576 1, 0, 145, 92, 146, 1, 0, 122, 0, 145,
577 97, 98, 0, 122, 1, 0, 145, 97, 1, 0,
578 145, 98, 1, 0, 265, 0, 178, 0, 0, 149,
579 148, 156, 0, 149, 1, 0, 112, 150, 154, 0,
580 59, 150, 154, 0, 131, 112, 150, 154, 0, 131,
581 59, 150, 154, 0, 112, 1, 0, 131, 112, 1,
582 0, 59, 1, 0, 131, 59, 1, 0, 131, 1,
583 0, 122, 93, 94, 0, 122, 93, 151, 94, 0,
584 150, 97, 98, 0, 122, 93, 1, 0, 150, 97,
585 1, 0, 152, 0, 151, 100, 152, 0, 151, 100,
586 1, 0, 112, 145, 0, 153, 112, 145, 0, 112,
587 1, 0, 153, 112, 1, 0, 131, 0, 0, 53,
588 155, 0, 53, 1, 0, 116, 0, 155, 100, 116,
589 0, 155, 100, 1, 0, 180, 0, 180, 99, 0,
590 99, 0, 158, 180, 0, 158, 180, 99, 0, 44,
591 0, 0, 161, 160, 163, 0, 162, 154, 0, 131,
592 162, 154, 0, 120, 93, 94, 0, 120, 93, 151,
593 94, 0, 181, 164, 0, 181, 165, 164, 0, 181,
594 183, 164, 0, 181, 165, 183, 164, 0, 182, 0,
595 182, 99, 0, 166, 93, 94, 99, 0, 166, 93,
596 234, 94, 99, 0, 119, 101, 65, 93, 234, 94,
597 99, 0, 119, 101, 65, 93, 94, 99, 0, 76,
598 0, 65, 0, 0, 61, 122, 168, 173, 0, 0,
599 131, 61, 122, 169, 173, 0, 0, 61, 122, 172,
600 170, 173, 0, 0, 131, 61, 122, 172, 171, 173,
601 0, 61, 122, 1, 0, 131, 61, 122, 1, 0,
602 63, 117, 0, 172, 100, 117, 0, 63, 1, 0,
603 172, 100, 1, 0, 95, 96, 0, 95, 174, 96,
604 0, 175, 0, 174, 175, 0, 176, 0, 177, 0,
605 132, 0, 167, 0, 142, 0, 149, 99, 0, 149,
606 1, 0, 95, 96, 0, 95, 179, 96, 0, 95,
607 179, 100, 96, 0, 146, 0, 179, 100, 146, 0,
608 179, 100, 1, 0, 95, 96, 0, 181, 183, 182,
609 0, 95, 0, 96, 0, 184, 0, 183, 184, 0,
610 185, 0, 187, 0, 132, 0, 186, 99, 0, 112,
611 143, 0, 153, 112, 143, 0, 189, 0, 192, 0,
612 196, 0, 197, 0, 208, 0, 212, 0, 189, 0,
613 193, 0, 198, 0, 209, 0, 213, 0, 180, 0,
614 190, 0, 194, 0, 199, 0, 211, 0, 219, 0,
615 220, 0, 221, 0, 223, 0, 222, 0, 225, 0,
616 99, 0, 122, 88, 0, 191, 187, 0, 122, 1,
617 0, 191, 188, 0, 195, 99, 0, 1, 99, 0,
618 1, 95, 0, 1, 96, 0, 166, 93, 1, 0,
619 166, 93, 94, 1, 0, 166, 93, 234, 1, 0,
620 166, 93, 234, 94, 1, 0, 119, 101, 65, 1,
621 0, 119, 101, 65, 93, 1, 0, 119, 101, 65,
622 93, 234, 1, 0, 119, 101, 65, 93, 234, 94,
623 1, 0, 119, 101, 65, 93, 94, 1, 0, 262,
624 0, 246, 0, 247, 0, 243, 0, 244, 0, 240,
625 0, 232, 0, 48, 93, 265, 94, 187, 0, 48,
626 1, 0, 48, 93, 1, 0, 48, 93, 265, 1,
627 0, 48, 93, 265, 94, 188, 56, 187, 0, 48,
628 93, 265, 94, 188, 56, 188, 0, 0, 201, 200,
629 202, 0, 68, 93, 265, 94, 0, 68, 1, 0,
630 68, 93, 1, 0, 68, 93, 265, 94, 1, 0,
631 95, 96, 0, 95, 205, 96, 0, 95, 203, 96,
632 0, 95, 203, 205, 96, 0, 204, 0, 203, 204,
633 0, 205, 183, 0, 206, 0, 205, 206, 0, 62,
634 266, 88, 0, 47, 88, 0, 62, 1, 0, 62,
635 266, 1, 0, 47, 1, 0, 66, 93, 265, 94,
636 0, 207, 187, 0, 66, 1, 0, 66, 93, 1,
637 0, 66, 93, 265, 1, 0, 207, 188, 0, 51,
638 0, 210, 187, 66, 93, 265, 94, 99, 0, 215,
639 99, 265, 99, 217, 94, 187, 0, 215, 99, 99,
640 217, 94, 187, 0, 215, 99, 1, 0, 215, 99,
641 265, 99, 1, 0, 215, 99, 99, 1, 0, 215,
642 99, 265, 99, 217, 94, 188, 0, 215, 99, 99,
643 217, 94, 188, 0, 71, 93, 0, 71, 1, 0,
644 71, 93, 1, 0, 214, 216, 0, 0, 218, 0,
645 186, 0, 218, 1, 0, 0, 218, 0, 195, 0,
646 218, 100, 195, 0, 218, 100, 1, 0, 54, 99,
647 0, 54, 122, 99, 0, 54, 1, 0, 54, 122,
648 1, 0, 73, 99, 0, 73, 122, 99, 0, 73,
649 1, 0, 73, 122, 1, 0, 58, 99, 0, 58,
650 265, 99, 0, 58, 1, 0, 58, 265, 1, 0,
651 49, 265, 99, 0, 49, 1, 0, 49, 265, 1,
652 0, 224, 93, 265, 94, 180, 0, 224, 93, 265,
653 94, 1, 0, 224, 1, 0, 224, 93, 1, 94,
654 0, 224, 93, 1, 0, 131, 0, 70, 180, 226,
655 0, 70, 180, 229, 0, 70, 180, 226, 229, 0,
656 70, 1, 0, 227, 0, 226, 227, 0, 228, 180,
657 0, 60, 93, 152, 94, 0, 60, 1, 0, 60,
658 93, 1, 0, 60, 93, 1, 94, 0, 64, 180,
659 0, 64, 1, 0, 231, 0, 235, 0, 111, 0,
660 76, 0, 93, 265, 94, 0, 232, 0, 239, 0,
661 240, 0, 241, 0, 119, 101, 67, 0, 113, 101,
662 67, 0, 59, 101, 67, 0, 119, 101, 76, 0,
663 93, 265, 1, 0, 119, 101, 1, 0, 113, 101,
664 1, 0, 59, 101, 1, 0, 72, 116, 93, 234,
665 94, 0, 72, 116, 93, 94, 0, 72, 116, 93,
666 234, 94, 138, 0, 72, 116, 93, 94, 138, 0,
667 233, 122, 93, 94, 0, 233, 122, 93, 94, 138,
668 0, 233, 122, 93, 234, 94, 0, 233, 122, 93,
669 234, 94, 138, 0, 72, 1, 99, 0, 72, 116,
670 1, 0, 72, 116, 93, 1, 0, 72, 116, 93,
671 234, 1, 0, 233, 1, 0, 233, 122, 1, 0,
672 119, 101, 72, 0, 230, 101, 72, 0, 265, 0,
673 234, 100, 265, 0, 234, 100, 1, 0, 72, 113,
674 236, 0, 72, 115, 236, 0, 72, 113, 236, 238,
675 0, 72, 115, 236, 238, 0, 72, 115, 238, 178,
676 0, 72, 113, 238, 178, 0, 72, 1, 98, 0,
677 72, 1, 97, 0, 237, 0, 236, 237, 0, 97,
678 265, 98, 0, 97, 265, 1, 0, 97, 1, 0,
679 97, 98, 0, 238, 97, 98, 0, 238, 97, 1,
680 0, 230, 101, 122, 0, 65, 101, 122, 0, 65,
681 1, 0, 119, 93, 94, 0, 119, 93, 234, 94,
682 0, 230, 101, 122, 93, 94, 0, 230, 101, 122,
683 93, 234, 94, 0, 65, 101, 122, 93, 94, 0,
684 65, 101, 122, 93, 234, 94, 0, 65, 101, 1,
685 94, 0, 65, 101, 1, 101, 0, 119, 97, 265,
686 98, 0, 231, 97, 265, 98, 0, 119, 97, 1,
687 0, 119, 97, 265, 1, 0, 231, 97, 1, 0,
688 231, 97, 265, 1, 0, 230, 0, 119, 0, 243,
689 0, 244, 0, 242, 46, 0, 242, 45, 0, 246,
690 0, 247, 0, 3, 245, 0, 4, 245, 0, 248,
691 0, 3, 1, 0, 4, 1, 0, 46, 245, 0,
692 46, 1, 0, 45, 245, 0, 45, 1, 0, 242,
693 0, 89, 245, 0, 90, 245, 0, 249, 0, 89,
694 1, 0, 90, 1, 0, 93, 113, 238, 94, 245,
695 0, 93, 113, 94, 245, 0, 93, 265, 94, 248,
696 0, 93, 119, 238, 94, 248, 0, 93, 113, 97,
697 1, 0, 93, 1, 0, 93, 113, 238, 94, 1,
698 0, 93, 113, 94, 1, 0, 93, 119, 238, 94,
699 1, 0, 245, 0, 250, 5, 245, 0, 250, 6,
700 245, 0, 250, 7, 245, 0, 250, 5, 1, 0,
701 250, 6, 1, 0, 250, 7, 1, 0, 250, 0,
702 251, 3, 250, 0, 251, 4, 250, 0, 251, 3,
703 1, 0, 251, 4, 1, 0, 251, 0, 252, 8,
704 251, 0, 252, 9, 251, 0, 252, 10, 251, 0,
705 252, 8, 1, 0, 252, 9, 1, 0, 252, 10,
706 1, 0, 252, 0, 253, 20, 252, 0, 253, 18,
707 252, 0, 253, 21, 252, 0, 253, 19, 252, 0,
708 253, 57, 114, 0, 253, 20, 1, 0, 253, 18,
709 1, 0, 253, 21, 1, 0, 253, 19, 1, 0,
710 253, 57, 1, 0, 253, 0, 254, 16, 253, 0,
711 254, 17, 253, 0, 254, 16, 1, 0, 254, 17,
712 1, 0, 254, 0, 255, 11, 254, 0, 255, 11,
713 1, 0, 255, 0, 256, 12, 255, 0, 256, 12,
714 1, 0, 256, 0, 257, 13, 256, 0, 257, 13,
715 1, 0, 257, 0, 258, 14, 257, 0, 258, 14,
716 1, 0, 258, 0, 259, 15, 258, 0, 259, 15,
717 1, 0, 259, 0, 259, 87, 265, 88, 260, 0,
718 259, 87, 88, 1, 0, 259, 87, 1, 0, 259,
719 87, 265, 88, 1, 0, 260, 0, 262, 0, 263,
720 264, 261, 0, 263, 264, 1, 0, 119, 0, 239,
721 0, 241, 0, 91, 0, 92, 0, 261, 0, 265,
728 static const short yyrline[] = { 0,
729 500, 506, 508, 509, 510, 511, 512, 516, 518, 521,
730 523, 524, 527, 529, 532, 536, 540, 544, 550, 552,
731 554, 556, 561, 563, 566, 570, 575, 580, 582, 583,
732 584, 585, 586, 587, 588, 591, 596, 602, 604, 607,
733 613, 615, 619, 621, 624, 651, 653, 657, 670, 672,
734 676, 683, 688, 690, 700, 705, 720, 724, 727, 730,
735 733, 735, 737, 742, 746, 748, 750, 752, 756, 758,
736 760, 767, 773, 778, 782, 791, 801, 803, 806, 808,
737 809, 810, 814, 816, 818, 819, 821, 826, 829, 839,
738 842, 844, 848, 851, 858, 864, 872, 874, 876, 878,
739 880, 884, 886, 890, 897, 898, 902, 905, 907, 909,
740 911, 916, 918, 920, 922, 929, 932, 934, 943, 945,
741 949, 954, 959, 963, 968, 973, 978, 985, 995, 997,
742 999, 1003, 1006, 1008, 1012, 1014, 1015, 1020, 1026, 1033,
743 1041, 1048, 1051, 1054, 1058, 1061, 1065, 1074, 1076, 1078,
744 1082, 1084, 1087, 1094, 1102, 1104, 1108, 1115, 1125, 1129,
745 1132, 1135, 1138, 1141, 1144, 1147, 1150, 1152, 1156, 1162,
746 1167, 1169, 1173, 1176, 1180, 1182, 1185, 1187, 1188, 1190,
747 1194, 1198, 1204, 1209, 1212, 1214, 1218, 1224, 1228, 1233,
748 1242, 1246, 1251, 1263, 1265, 1268, 1270, 1272, 1276, 1280,
749 1283, 1287, 1289, 1290, 1291, 1292, 1293, 1297, 1299, 1300,
750 1301, 1302, 1306, 1308, 1309, 1310, 1311, 1312, 1313, 1314,
751 1315, 1316, 1317, 1320, 1325, 1336, 1339, 1343, 1350, 1360,
752 1366, 1372, 1378, 1380, 1385, 1387, 1392, 1394, 1396, 1398,
753 1400, 1404, 1406, 1407, 1408, 1409, 1410, 1411, 1414, 1420,
754 1422, 1424, 1428, 1433, 1438, 1444, 1454, 1460, 1462, 1464,
755 1471, 1474, 1476, 1478, 1482, 1484, 1487, 1491, 1493, 1496,
756 1503, 1509, 1511, 1513, 1517, 1525, 1528, 1530, 1532, 1536,
757 1541, 1550, 1555, 1558, 1565, 1567, 1569, 1573, 1576, 1585,
758 1592, 1594, 1598, 1611, 1613, 1619, 1625, 1629, 1631, 1635,
759 1638, 1640, 1644, 1647, 1649, 1651, 1655, 1658, 1660, 1662,
760 1666, 1669, 1671, 1673, 1677, 1683, 1685, 1689, 1696, 1698,
761 1700, 1702, 1706, 1718, 1721, 1723, 1728, 1732, 1734, 1741,
762 1749, 1766, 1768, 1773, 1777, 1780, 1785, 1787, 1790, 1792,
763 1794, 1796, 1797, 1798, 1799, 1803, 1805, 1807, 1812, 1814,
764 1816, 1818, 1820, 1824, 1827, 1832, 1834, 1839, 1840, 1841,
765 1842, 1843, 1845, 1847, 1849, 1851, 1853, 1857, 1859, 1862,
766 1868, 1873, 1877, 1880, 1882, 1884, 1888, 1890, 1892, 1894,
767 1898, 1901, 1905, 1911, 1913, 1921, 1948, 1950, 1954, 1959,
768 1966, 1970, 1973, 1975, 1986, 1997, 2002, 2011, 2013, 2017,
769 2020, 2022, 2027, 2032, 2037, 2044, 2046, 2047, 2048, 2051,
770 2056, 2061, 2063, 2064, 2066, 2068, 2069, 2071, 2075, 2078,
771 2082, 2085, 2089, 2091, 2093, 2095, 2096, 2098, 2102, 2111,
772 2113, 2115, 2128, 2130, 2136, 2138, 2140, 2144, 2146, 2151,
773 2156, 2161, 2163, 2165, 2169, 2171, 2176, 2181, 2183, 2187,
774 2189, 2194, 2199, 2204, 2206, 2208, 2212, 2214, 2219, 2224,
775 2229, 2234, 2236, 2238, 2240, 2242, 2244, 2248, 2250, 2255,
776 2260, 2262, 2266, 2268, 2273, 2277, 2279, 2284, 2288, 2290,
777 2295, 2299, 2301, 2306, 2310, 2312, 2317, 2321, 2323, 2328,
778 2334, 2336, 2340, 2342, 2345, 2348, 2356, 2358, 2359, 2362,
784 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
786 static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK",
787 "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
788 "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
789 "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
790 "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
791 "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
792 "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
793 "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
794 "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
795 "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
796 "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
797 "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
798 "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
799 "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
800 "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
801 "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
802 "goal","literal","type","primitive_type","reference_type","class_or_interface_type",
803 "class_type","interface_type","array_type","name","simple_name","qualified_name",
804 "identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
805 "import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
806 "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
807 "interface_type_list","class_body","class_body_declarations","class_body_declaration",
808 "class_member_declaration","field_declaration","variable_declarators","variable_declarator",
809 "variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
810 "method_declarator","formal_parameter_list","formal_parameter","final","throws",
811 "class_type_list","method_body","static_initializer","static","constructor_declaration",
812 "@4","constructor_header","constructor_declarator","constructor_body","constructor_block_end",
813 "explicit_constructor_invocation","this_or_super","interface_declaration","@5",
814 "@6","@7","@8","extends_interfaces","interface_body","interface_member_declarations",
815 "interface_member_declaration","constant_declaration","abstract_method_declaration",
816 "array_initializer","variable_initializers","block","block_begin","block_end",
817 "block_statements","block_statement","local_variable_declaration_statement",
818 "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
819 "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
820 "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
821 "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups",
822 "switch_block_statement_group","switch_labels","switch_label","while_expression",
823 "while_statement","while_statement_nsi","do_statement_begin","do_statement",
824 "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update",
825 "statement_expression_list","break_statement","continue_statement","return_statement",
826 "throw_statement","synchronized_statement","synchronized","try_statement","catches",
827 "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array",
828 "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression",
829 "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access",
830 "postfix_expression","post_increment_expression","post_decrement_expression",
831 "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus",
832 "cast_expression","multiplicative_expression","additive_expression","shift_expression",
833 "relational_expression","equality_expression","and_expression","exclusive_or_expression",
834 "inclusive_or_expression","conditional_and_expression","conditional_or_expression",
835 "conditional_expression","assignment_expression","assignment","left_hand_side",
836 "assignment_operator","expression","constant_expression", NULL
840 static const short yyr1[] = { 0,
841 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
842 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
843 118, 118, 119, 119, 120, 121, 122, 123, 123, 123,
844 123, 123, 123, 123, 123, 124, 124, 125, 125, 126,
845 126, 126, 127, 127, 128, 128, 128, 129, 129, 129,
846 130, 130, 130, 130, 131, 131, 133, 132, 134, 132,
847 132, 132, 132, 132, 135, 135, 135, 135, 136, 136,
848 136, 137, 137, 137, 138, 138, 139, 139, 140, 140,
849 140, 140, 141, 141, 141, 141, 141, 142, 142, 143,
850 143, 143, 144, 144, 144, 144, 145, 145, 145, 145,
851 145, 146, 146, 148, 147, 147, 149, 149, 149, 149,
852 149, 149, 149, 149, 149, 150, 150, 150, 150, 150,
853 151, 151, 151, 152, 152, 152, 152, 153, 154, 154,
854 154, 155, 155, 155, 156, 156, 156, 157, 157, 158,
855 160, 159, 161, 161, 162, 162, 163, 163, 163, 163,
856 164, 164, 165, 165, 165, 165, 166, 166, 168, 167,
857 169, 167, 170, 167, 171, 167, 167, 167, 172, 172,
858 172, 172, 173, 173, 174, 174, 175, 175, 175, 175,
859 176, 177, 177, 178, 178, 178, 179, 179, 179, 180,
860 180, 181, 182, 183, 183, 184, 184, 184, 185, 186,
861 186, 187, 187, 187, 187, 187, 187, 188, 188, 188,
862 188, 188, 189, 189, 189, 189, 189, 189, 189, 189,
863 189, 189, 189, 190, 191, 192, 192, 193, 194, 194,
864 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
865 194, 195, 195, 195, 195, 195, 195, 195, 196, 196,
866 196, 196, 197, 198, 200, 199, 201, 201, 201, 201,
867 202, 202, 202, 202, 203, 203, 204, 205, 205, 206,
868 206, 206, 206, 206, 207, 208, 208, 208, 208, 209,
869 210, 211, 212, 212, 212, 212, 212, 213, 213, 214,
870 214, 214, 215, 216, 216, 216, 216, 217, 217, 218,
871 218, 218, 219, 219, 219, 219, 220, 220, 220, 220,
872 221, 221, 221, 221, 222, 222, 222, 223, 223, 223,
873 223, 223, 224, 225, 225, 225, 225, 226, 226, 227,
874 228, 228, 228, 228, 229, 229, 230, 230, 231, 231,
875 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
876 231, 231, 231, 232, 232, 232, 232, 232, 232, 232,
877 232, 232, 232, 232, 232, 232, 232, 233, 233, 234,
878 234, 234, 235, 235, 235, 235, 235, 235, 235, 235,
879 236, 236, 237, 237, 237, 238, 238, 238, 239, 239,
880 239, 240, 240, 240, 240, 240, 240, 240, 240, 241,
881 241, 241, 241, 241, 241, 242, 242, 242, 242, 243,
882 244, 245, 245, 245, 245, 245, 245, 245, 246, 246,
883 247, 247, 248, 248, 248, 248, 248, 248, 249, 249,
884 249, 249, 249, 249, 249, 249, 249, 250, 250, 250,
885 250, 250, 250, 250, 251, 251, 251, 251, 251, 252,
886 252, 252, 252, 252, 252, 252, 253, 253, 253, 253,
887 253, 253, 253, 253, 253, 253, 253, 254, 254, 254,
888 254, 254, 255, 255, 255, 256, 256, 256, 257, 257,
889 257, 258, 258, 258, 259, 259, 259, 260, 260, 260,
890 260, 260, 261, 261, 262, 262, 263, 263, 263, 264,
894 static const short yyr2[] = { 0,
895 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
896 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
897 3, 3, 1, 1, 1, 3, 1, 0, 1, 1,
898 1, 2, 2, 2, 3, 1, 2, 1, 2, 3,
899 2, 3, 1, 1, 3, 2, 3, 5, 4, 5,
900 1, 1, 1, 1, 1, 2, 0, 7, 0, 6,
901 3, 2, 3, 4, 0, 2, 3, 2, 0, 2,
902 2, 1, 3, 3, 2, 3, 1, 2, 1, 1,
903 1, 1, 1, 2, 1, 1, 1, 3, 4, 1,
904 3, 3, 1, 3, 3, 4, 1, 3, 2, 3,
905 3, 1, 1, 0, 3, 2, 3, 3, 4, 4,
906 2, 3, 2, 3, 2, 3, 4, 3, 3, 3,
907 1, 3, 3, 2, 3, 2, 3, 1, 0, 2,
908 2, 1, 3, 3, 1, 2, 1, 2, 3, 1,
909 0, 3, 2, 3, 3, 4, 2, 3, 3, 4,
910 1, 2, 4, 5, 7, 6, 1, 1, 0, 4,
911 0, 5, 0, 5, 0, 6, 3, 4, 2, 3,
912 2, 3, 2, 3, 1, 2, 1, 1, 1, 1,
913 1, 2, 2, 2, 3, 4, 1, 3, 3, 2,
914 3, 1, 1, 1, 2, 1, 1, 1, 2, 2,
915 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
916 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
917 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
918 2, 2, 3, 4, 4, 5, 4, 5, 6, 7,
919 6, 1, 1, 1, 1, 1, 1, 1, 5, 2,
920 3, 4, 7, 7, 0, 3, 4, 2, 3, 5,
921 2, 3, 3, 4, 1, 2, 2, 1, 2, 3,
922 2, 2, 3, 2, 4, 2, 2, 3, 4, 2,
923 1, 7, 7, 6, 3, 5, 4, 7, 6, 2,
924 2, 3, 2, 0, 1, 1, 2, 0, 1, 1,
925 3, 3, 2, 3, 2, 3, 2, 3, 2, 3,
926 2, 3, 2, 3, 3, 2, 3, 5, 5, 2,
927 4, 3, 1, 3, 3, 4, 2, 1, 2, 2,
928 4, 2, 3, 4, 2, 2, 1, 1, 1, 1,
929 3, 1, 1, 1, 1, 3, 3, 3, 3, 3,
930 3, 3, 3, 5, 4, 6, 5, 4, 5, 5,
931 6, 3, 3, 4, 5, 2, 3, 3, 3, 1,
932 3, 3, 3, 3, 4, 4, 4, 4, 3, 3,
933 1, 2, 3, 3, 2, 2, 3, 3, 3, 3,
934 2, 3, 4, 5, 6, 5, 6, 4, 4, 4,
935 4, 3, 4, 3, 4, 1, 1, 1, 1, 2,
936 2, 1, 1, 2, 2, 1, 2, 2, 2, 2,
937 2, 2, 1, 2, 2, 1, 2, 2, 5, 4,
938 4, 5, 4, 2, 5, 4, 5, 1, 3, 3,
939 3, 3, 3, 3, 1, 3, 3, 3, 3, 1,
940 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
941 3, 3, 3, 3, 3, 3, 3, 1, 3, 3,
942 3, 3, 1, 3, 3, 1, 3, 3, 1, 3,
943 3, 1, 3, 3, 1, 3, 3, 1, 5, 4,
944 3, 5, 1, 1, 3, 3, 1, 1, 1, 1,
948 static const short yydefact[] = { 0,
949 54, 55, 0, 0, 0, 0, 53, 1, 0, 0,
950 0, 36, 43, 44, 38, 0, 51, 52, 46, 27,
951 0, 23, 24, 25, 0, 62, 0, 41, 0, 0,
952 37, 39, 0, 0, 56, 0, 0, 47, 45, 0,
953 167, 0, 0, 163, 63, 0, 69, 42, 40, 0,
954 0, 0, 61, 0, 49, 0, 26, 171, 17, 169,
955 15, 0, 160, 0, 0, 68, 16, 0, 0, 59,
956 168, 0, 165, 64, 69, 50, 48, 12, 0, 10,
957 11, 173, 0, 8, 9, 13, 14, 15, 0, 179,
958 181, 0, 180, 0, 175, 177, 178, 172, 170, 164,
959 67, 71, 72, 70, 0, 162, 0, 57, 113, 0,
960 129, 111, 0, 0, 90, 93, 129, 0, 0, 0,
961 115, 0, 0, 183, 182, 174, 176, 0, 0, 60,
962 166, 0, 0, 0, 0, 108, 99, 88, 0, 0,
963 0, 0, 107, 21, 18, 22, 20, 19, 114, 129,
964 112, 0, 129, 74, 73, 55, 192, 75, 23, 0,
965 86, 0, 77, 79, 83, 85, 0, 80, 0, 81,
966 141, 129, 87, 82, 0, 58, 119, 116, 0, 128,
967 0, 121, 0, 131, 132, 130, 120, 118, 92, 0,
968 91, 95, 0, 0, 0, 0, 0, 0, 0, 340,
969 0, 0, 0, 0, 6, 5, 2, 3, 4, 7,
970 339, 0, 407, 0, 103, 406, 337, 342, 0, 338,
971 343, 344, 345, 423, 408, 409, 438, 412, 413, 416,
972 426, 445, 450, 457, 468, 473, 476, 479, 482, 485,
973 488, 493, 502, 494, 0, 102, 100, 98, 101, 110,
974 89, 109, 190, 0, 129, 76, 78, 84, 106, 0,
975 138, 0, 143, 0, 0, 0, 281, 0, 0, 0,
976 0, 0, 0, 0, 0, 340, 0, 224, 0, 8,
977 407, 0, 128, 198, 0, 0, 213, 0, 194, 196,
978 0, 197, 202, 214, 0, 203, 215, 0, 204, 205,
979 216, 255, 0, 206, 0, 217, 207, 294, 0, 218,
980 219, 220, 222, 221, 0, 223, 248, 247, 0, 245,
981 246, 243, 244, 242, 126, 124, 117, 0, 0, 0,
982 417, 407, 343, 345, 414, 418, 415, 422, 421, 420,
983 419, 0, 391, 0, 0, 0, 16, 0, 427, 424,
984 428, 425, 434, 0, 407, 0, 184, 187, 0, 0,
985 0, 0, 0, 96, 0, 0, 366, 0, 411, 410,
986 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
987 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
988 0, 500, 501, 0, 145, 0, 144, 137, 105, 135,
989 139, 192, 142, 0, 231, 232, 230, 250, 0, 316,
990 0, 305, 303, 0, 313, 311, 0, 277, 0, 258,
991 0, 327, 0, 291, 0, 309, 307, 0, 0, 200,
992 0, 0, 227, 225, 0, 0, 193, 191, 195, 199,
993 407, 323, 226, 229, 0, 276, 0, 407, 296, 300,
994 293, 0, 0, 320, 0, 123, 122, 127, 125, 134,
995 133, 353, 348, 0, 390, 380, 379, 362, 0, 373,
996 381, 0, 374, 0, 363, 0, 0, 0, 0, 0,
997 0, 350, 341, 185, 0, 352, 347, 392, 0, 370,
998 402, 0, 351, 346, 368, 349, 369, 389, 404, 0,
999 367, 0, 442, 439, 443, 440, 444, 441, 448, 446,
1000 449, 447, 454, 451, 455, 452, 456, 453, 464, 459,
1001 466, 461, 463, 458, 465, 460, 467, 0, 462, 471,
1002 469, 472, 470, 475, 474, 478, 477, 481, 480, 484,
1003 483, 487, 486, 491, 0, 0, 496, 495, 146, 136,
1004 407, 147, 0, 0, 151, 0, 251, 0, 317, 315,
1005 306, 304, 314, 312, 278, 0, 259, 0, 0, 0,
1006 324, 328, 0, 325, 292, 310, 308, 341, 0, 201,
1007 233, 0, 0, 0, 256, 0, 297, 0, 285, 0,
1008 0, 322, 0, 398, 399, 0, 385, 386, 0, 382,
1009 375, 0, 378, 376, 377, 364, 355, 0, 436, 430,
1010 433, 0, 0, 431, 189, 186, 188, 393, 0, 403,
1011 400, 0, 405, 401, 358, 0, 490, 0, 0, 148,
1012 0, 0, 152, 149, 252, 0, 279, 275, 0, 332,
1013 0, 336, 335, 329, 326, 330, 237, 0, 234, 235,
1014 0, 0, 0, 261, 0, 265, 0, 268, 0, 302,
1015 301, 287, 0, 299, 0, 321, 0, 396, 0, 384,
1016 383, 388, 387, 357, 365, 354, 435, 429, 437, 432,
1017 372, 371, 394, 0, 359, 360, 492, 489, 0, 150,
1018 0, 0, 0, 249, 0, 202, 0, 209, 210, 0,
1019 211, 212, 0, 260, 333, 0, 238, 0, 0, 236,
1020 274, 271, 272, 503, 0, 263, 266, 0, 262, 0,
1021 269, 0, 0, 286, 0, 319, 318, 397, 356, 395,
1022 361, 0, 153, 0, 0, 0, 228, 280, 0, 334,
1023 331, 241, 239, 0, 273, 270, 264, 0, 284, 0,
1024 0, 0, 154, 0, 253, 0, 0, 240, 282, 283,
1025 156, 0, 0, 0, 0, 155, 0, 0, 0, 0,
1026 289, 0, 254, 288, 0, 0, 0
1029 static const short yydefgoto[] = { 775,
1030 211, 279, 212, 85, 86, 68, 60, 87, 213, 22,
1031 23, 24, 8, 9, 10, 11, 12, 13, 14, 15,
1032 442, 284, 132, 105, 47, 70, 104, 130, 162, 163,
1033 164, 91, 114, 115, 116, 214, 166, 260, 92, 111,
1034 181, 182, 285, 136, 186, 399, 168, 169, 170, 262,
1035 171, 172, 403, 552, 553, 286, 18, 43, 72, 65,
1036 107, 44, 63, 94, 95, 96, 97, 215, 359, 287,
1037 175, 555, 720, 289, 290, 291, 292, 695, 293, 294,
1038 295, 296, 698, 297, 298, 299, 300, 699, 301, 445,
1039 302, 585, 655, 656, 657, 658, 303, 304, 701, 305,
1040 306, 307, 702, 308, 309, 451, 663, 664, 310, 311,
1041 312, 313, 314, 315, 316, 571, 572, 573, 574, 216,
1042 217, 218, 219, 489, 220, 470, 471, 472, 221, 222,
1043 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
1044 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
1045 243, 244, 245, 394, 490, 715
1048 static const short yypact[] = { 262,
1049 -32768,-32768, 332, -48, 389, 476,-32768,-32768, 490, 782,
1050 645,-32768,-32768,-32768,-32768, 735,-32768,-32768,-32768,-32768,
1051 16,-32768,-32768,-32768, 183,-32768, 343,-32768, 21, 797,
1052 -32768,-32768, 777, 823,-32768, -48, 508,-32768,-32768, 569,
1053 -32768, 518, -47, -25,-32768, 529, 33,-32768,-32768, -48,
1054 830, 256,-32768, 486,-32768, 25,-32768,-32768,-32768,-32768,
1055 112, 1261,-32768, 597, -47,-32768,-32768, 246, 618,-32768,
1056 -32768, -47, -25,-32768, 33,-32768,-32768,-32768, 622,-32768,
1057 -32768,-32768, 635, 126,-32768,-32768, 176, 494, 864,-32768,
1058 -32768, 55,-32768, 1403,-32768,-32768,-32768,-32768,-32768,-32768,
1059 -32768,-32768,-32768, 186, 259,-32768, -47,-32768,-32768, 253,
1060 -1,-32768, 429, 204,-32768, 785, -1, 63, 106, 269,
1061 -32768, 638, 643,-32768,-32768,-32768,-32768, 651, 943,-32768,
1062 -32768, 259, 426, 667, 128,-32768,-32768,-32768, 672, 1447,
1063 154, 390,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -1,
1064 -32768, 478, -1,-32768,-32768, 315, 319,-32768, 335, 864,
1065 -32768, 1076,-32768,-32768, 336,-32768, 17,-32768, 346,-32768,
1066 -32768, 397,-32768,-32768, 1944,-32768,-32768,-32768, 686, 427,
1067 -26,-32768, 904,-32768,-32768, 385,-32768,-32768,-32768, 300,
1068 -32768,-32768, 2848, 2899, 2964, 3015, 415, 26, 616,-32768,
1069 3080, 3131, 3196, 5179,-32768,-32768,-32768,-32768,-32768,-32768,
1070 -32768, 424, 940, 40,-32768, 443, 463,-32768, 698,-32768,
1071 761,-32768, 826, 843,-32768,-32768,-32768,-32768,-32768,-32768,
1072 -32768, 887, 923, 893, 1041, 922, 582, 596, 603, 639,
1073 6,-32768,-32768,-32768, 860,-32768,-32768,-32768,-32768,-32768,
1074 -32768,-32768,-32768, 932, 397,-32768,-32768,-32768,-32768, 535,
1075 568, 593,-32768, 491, 341, 3247,-32768, 120, 2152, 7,
1076 344, 351, 231, 402, 149, 602, 5476,-32768, -48, 633,
1077 972, 718, 466,-32768, 904, 610,-32768, 1876,-32768,-32768,
1078 644,-32768,-32768,-32768, 2012,-32768,-32768, 663,-32768,-32768,
1079 -32768,-32768, 2012,-32768, 2012,-32768,-32768, 5527, 676,-32768,
1080 -32768,-32768,-32768,-32768, 412,-32768, 867, 874, 843, 917,
1081 933,-32768,-32768,-32768,-32768, 899,-32768, 884, 706, 713,
1082 -32768, 187,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1083 -32768, 22,-32768, 726, 886, 648, 648, 420,-32768,-32768,
1084 -32768,-32768,-32768, 719, 1031, 94,-32768,-32768, 674, 35,
1085 5244, 3312, 685,-32768, -39, 3363,-32768, 421,-32768,-32768,
1086 3428, 3479, 3544, 3595, 3660, 3711, 3776, 3827, 3892, 3943,
1087 4008, 4059, 813, 4124, 4175, 4240, 4291, 4356, 4407, 4472,
1088 2203,-32768,-32768, 4523,-32768, 121,-32768,-32768,-32768, 694,
1089 -32768,-32768,-32768, 1876,-32768,-32768,-32768,-32768, 4588,-32768,
1090 57,-32768,-32768, 77,-32768,-32768, 86,-32768, 4639,-32768,
1091 4704,-32768, 725,-32768, 1129,-32768,-32768, 87, 217, 700,
1092 2268, 546,-32768,-32768, -48, 2319,-32768,-32768,-32768,-32768,
1093 1059, 427,-32768,-32768, 712,-32768, 752, 990,-32768,-32768,
1094 -32768, 48, 2384,-32768, 4755,-32768,-32768,-32768, 899,-32768,
1095 -32768,-32768,-32768, -34, 729,-32768,-32768,-32768, 2435, 648,
1096 -32768, 584, 648, 584,-32768, 2500, 4820, 168, 367, 2551,
1097 662,-32768, 5552,-32768, 646,-32768,-32768,-32768, 134,-32768,
1098 -32768, 209,-32768,-32768,-32768,-32768,-32768, 732,-32768, 211,
1099 -32768, 5295,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 887,
1100 -32768, 887,-32768, 923,-32768, 923,-32768, 923,-32768, 893,
1101 -32768, 893,-32768, 893,-32768, 893,-32768, 126,-32768,-32768,
1102 1041,-32768, 1041,-32768, 922,-32768, 582,-32768, 596,-32768,
1103 603,-32768, 639,-32768, 828, 739,-32768,-32768,-32768,-32768,
1104 1024,-32768, 1876, 742, 746, 1876,-32768, 295,-32768,-32768,
1105 -32768,-32768,-32768,-32768,-32768, 323,-32768, 754, 430, 254,
1106 725,-32768, 346,-32768,-32768,-32768,-32768,-32768, 438, 700,
1107 -32768, 849, 68, 361,-32768, 778,-32768, 555,-32768, 5103,
1108 776, 792, 812,-32768,-32768, 5360,-32768,-32768, 236,-32768,
1109 818, 240,-32768, 818,-32768,-32768, 259, 89,-32768,-32768,
1110 -32768, 4871, 1702,-32768,-32768,-32768,-32768,-32768, 4936,-32768,
1111 -32768, 5411,-32768,-32768, 259, 171,-32768, 4987, 775,-32768,
1112 1876, 2616,-32768,-32768,-32768, 2078,-32768,-32768, 255,-32768,
1113 909,-32768,-32768,-32768,-32768,-32768,-32768, 2667,-32768,-32768,
1114 920, 13, 5052,-32768, 470,-32768, 1597,-32768, 5476,-32768,
1115 -32768,-32768, 838, 824, 5128,-32768, 260,-32768, 360,-32768,
1116 -32768,-32768,-32768,-32768,-32768, 259,-32768,-32768,-32768,-32768,
1117 -32768,-32768,-32768, 378,-32768, 259,-32768,-32768, 446,-32768,
1118 108, 103, 468,-32768, 880, 891, 2078,-32768,-32768, 2078,
1119 -32768,-32768, 844,-32768, 863, 866,-32768, 973, 131,-32768,
1120 -32768,-32768,-32768,-32768, 244,-32768,-32768, 1677,-32768, 1808,
1121 -32768, 878, 2012,-32768, 894,-32768,-32768,-32768,-32768,-32768,
1122 -32768, 2732,-32768, 151, 4588, 2012,-32768,-32768, 2783,-32768,
1123 -32768,-32768,-32768, 1005,-32768,-32768,-32768, 912,-32768, 2012,
1124 159, 170,-32768, 339,-32768, 5103, 916,-32768,-32768,-32768,
1125 -32768, 178, 2078, 925, 5128,-32768, 979, 2078, 946, 2078,
1126 -32768, 2078,-32768,-32768, 1027, 1044,-32768
1129 static const short yypgoto[] = {-32768,
1130 -32768, -49, 160, 664, 30, -122, 515,-32768, -3, 291,
1131 -32768, 137,-32768, 1035, 588,-32768, 235,-32768,-32768, 971,
1132 20, 473,-32768,-32768, 995, 976,-32768, -121,-32768, 892,
1133 -32768, -83, -114, 931, -163, -198,-32768,-32768, -64, 587,
1134 801, -323, -126, -80,-32768,-32768,-32768,-32768,-32768,-32768,
1135 -32768, 911,-32768, -528,-32768, 668, -11,-32768,-32768,-32768,
1136 -32768, 1023, 391,-32768, 984,-32768,-32768, 251,-32768, -127,
1137 817, 796, -165, -284,-32768, 772, -271, 172, -530,-32768,
1138 -473,-32768,-32768,-32768, -307,-32768,-32768,-32768,-32768,-32768,
1139 -32768,-32768,-32768, 434, 437, -613, -406,-32768,-32768,-32768,
1140 -32768,-32768,-32768,-32768, -361,-32768, -646, 786,-32768,-32768,
1141 -32768,-32768,-32768,-32768,-32768,-32768, 514,-32768, 525,-32768,
1142 -32768, -94,-32768, -379,-32768, 755, 317, -292, 1204, 280,
1143 1237, 377, 500, 551, -58, 653, 704, -468,-32768, 649,
1144 690, 787, 636, 723, 724, 711, 716, 722,-32768, 501,
1145 720, 798,-32768,-32768, 127,-32768
1152 static const short yytable[] = { 21,
1153 450, 174, 29, 439, 457, 358, 183, 343, 152, 288,
1154 176, 185, 83, 711, 614, 326, 38, 259, 725, 16,
1155 390, 48, 462, 443, 630, 76, 343, 634, 16, 16,
1156 16, 446, 497, 447, 174, 486, 143, 20, 61, 123,
1157 364, 261, 61, 721, 83, 165, 20, 62, 587, 16,
1158 93, 134, 16, 16, 474, 124, 583, 559, 88, 594,
1159 61, 479, 481, 144, 167, 61, 595, 327, 650, 250,
1160 16, 59, 252, 328, 64, 67, 348, 561, 165, 83,
1161 317, 89, 93, 179, 69, 88, 563, 576, 463, 675,
1162 88, 263, 391, 59, 482, 135, 608, 167, 59, -158,
1163 712, 487, 690, 650, 721, 696, 146, 344, 649, 764,
1164 123, -104, 83, 89, 39, -104, 40, 173, 769, 49,
1165 412, 50, 626, 77, 61, 88, 344, 183, 187, 88,
1166 61, 743, 400, 329, 335, 337, 339, 341, -94, -94,
1167 25, 27, 350, 352, 680, 423, -295, 588, 160, 426,
1168 173, 710, 180, 125, 247, 560, 88, 59, 88, 742,
1169 145, 651, 697, 67, 430, 459, 696, 619, 611, 696,
1170 743, 281, 52, 54, 397, 562, 57, 601, 758, 88,
1171 604, 160, 676, 41, 564, 577, 57, 483, 619, 332,
1172 332, 332, 332, 317, 283, 61, 734, 332, 332, 355,
1173 317, 183, 619, 147, 179, 20, 733, 461, 317, 620,
1174 317, 623, 50, 317, 549, 110, 669, 482, 413, 113,
1175 328, 84, 118, 697, 744, 188, 697, 618, 347, 700,
1176 619, 422, 696, 619, 20, 435, 670, 696, 556, 696,
1177 672, 696, 684, 31, 745, 42, 101, 427, 84, 753,
1178 88, 248, 692, 84, 642, 704, 71, 761, 110, 113,
1179 726, -28, 1, 762, 686, 598, 246, 31, 709, 619,
1180 619, 439, 119, 180, 703, 190, 766, -159, 179, 361,
1181 661, 88, 450, 362, 281, 128, 617, 363, 84, 697,
1182 700, 441, 84, 700, 697, 635, 697, -66, 697, 441,
1183 137, 441, 138, 139, 448, 2, 621, 283, 624, 317,
1184 578, 282, 504, 506, 508, 190, 3, 706, 42, 84,
1185 580, 84, 4, 637, 88, 157, 61, 180, 5, 356,
1186 246, 746, 19, 671, 280, 703, 6, 673, 703, 635,
1187 -66, 408, 84, 45, 418, 133, 439, 180, 157, -257,
1188 -161, 420, 752, 129, 157, 368, 700, 450, 346, 67,
1189 7, 700, 354, 700, 694, 700, 148, 332, 332, 332,
1190 332, 332, 332, 332, 332, 332, 332, 332, 332, 88,
1191 332, 332, 332, 332, 332, 332, 332, 631, 636, 26,
1192 249, -97, 411, -97, -65, 417, -97, -97, -97, -97,
1193 551, 703, 424, 429, 414, 46, 703, 652, 703, -140,
1194 703, 428, 454, 84, 253, 190, 638, 20, 610, 159,
1195 475, 501, 653, 283, 282, 443, 177, 254, 446, 137,
1196 640, 282, 763, 409, 258, 439, 419, -65, 647, 282,
1197 157, 282, 643, 421, 84, 646, 647, 280, 450, 134,
1198 159, 749, 159, 728, 318, 100, 654, 450, 317, 619,
1199 612, 317, 106, 602, 755, 190, -323, 280, 408, 2,
1200 35, 730, 17, 332, 20, 78, 28, 619, 760, 332,
1201 465, 17, 17, 17, 330, 674, 74, 84, 492, -30,
1202 1, 694, 500, 317, 425, 317, 749, 131, 755, 57,
1203 760, 498, 17, 685, 455, 17, 17, 80, 53, 35,
1204 81, 20, 476, 502, 183, 342, 652, 546, 58, 178,
1205 -97, 133, 641, 17, 360, -97, -97, -97, -97, 66,
1206 648, 653, 37, 2, 90, 558, 317, -65, 732, 727,
1207 282, 317, 528, 365, 3, 566, 493, 568, 46, 281,
1208 4, 319, 281, 678, 729, 660, 5, 492, -323, 366,
1209 735, 20, 317, 280, 731, 716, 90, 318, 57, 55,
1210 317, 190, 283, 56, 318, 283, 251, 139, 99, 591,
1211 -65, 593, 318, 103, 318, 405, 406, 318, 7, 407,
1212 120, 179, 386, 20, 50, 599, 30, 98, 34, 195,
1213 196, 161, 317, 20, 78, 317, 492, 387, 332, 332,
1214 579, 246, 494, 197, 20, 388, 345, 495, 102, 198,
1215 51, 496, 109, 317, 332, 317, 199, 281, 317, 157,
1216 200, 20, 441, 398, 161, 112, 80, 88, 149, 81,
1217 20, 317, 155, 151, -29, 1, 615, 277, 193, 194,
1218 283, 154, 389, 281, 20, 317, 205, 206, 207, 208,
1219 180, 317, 209, 210, 319, 78, 401, 184, 317, 117,
1220 317, 319, 189, 317, 320, 317, 283, 317, 204, 319,
1221 602, 319, 20, 318, 319, 493, 325, 402, 2, 282,
1222 195, 196, 282, 441, -157, 78, 441, 80, 367, 3,
1223 81, 20, 436, 20, 197, 4, 458, 20, 150, 153,
1224 198, 5, 280, 460, 281, 280, 281, 199, 433, 441,
1225 20, 200, 603, 20, 605, 321, 464, 80, 20, 118,
1226 81, 20, 441, 360, 201, 202, 20, 283, 203, 283,
1227 204, 616, 440, 7, 469, 682, 441, 205, 206, 207,
1228 208, 494, 20, 209, 210, 613, 495, 20, 602, 441,
1229 496, 444, -25, -25, 441, 57, 441, 282, 441, 484,
1230 20, 20, 282, 485, 453, 493, -32, 1, 35, 714,
1231 319, -31, 1, 20, 569, 722, 600, 320, 570, 600,
1232 280, 20, 550, 282, 320, 36, -34, 1, 20, 139,
1233 84, 37, 320, -25, 320, 434, 584, 320, -25, -25,
1234 -25, 20, 477, 527, -25, 478, 280, 586, -25, 360,
1235 2, 596, -33, 1, 622, 2, 628, 322, 627, -35,
1236 1, 3, 318, 282, 632, 318, 282, 4, 321, 689,
1237 2, 494, 4, 5, 633, 321, 495, 639, 5, 649,
1238 496, -498, -498, 321, 282, 321, 282, 4, 321, 282,
1239 20, 754, 78, 5, 121, 757, 2, 318, 737, 318,
1240 659, 738, 282, 2, 665, 7, 140, 280, 323, 280,
1241 7, 141, 142, 4, 456, 666, 282, 369, 370, 5,
1242 4, 371, 372, 373, 80, 7, 5, 81, 20, 282,
1243 376, 377, 378, 320, 282, 667, 282, 35, 282, 705,
1244 318, -342, -342, 78, 602, 318, -499, -499, -344, -344,
1245 710, 7, 122, 588, 36, 374, 375, 2, 7, 319,
1246 37, 723, 319, 78, 767, 736, 318, 384, 385, 771,
1247 322, 773, 739, 774, 318, 80, -208, 322, 81, 20,
1248 392, 393, 2, 78, 321, 322, 740, 322, 78, 741,
1249 322, -408, -408, -342, 319, 80, 319, -342, 81, 20,
1250 -344, 748, 324, 742, -344, 2, 318, -409, -409, 318,
1251 32, 78, 466, 467, 468, 80, 156, 750, 81, 20,
1252 80, 323, 78, 81, 20, 141, 142, 318, 323, 318,
1253 32, 79, 318, 4, 32, 758, 323, 319, 323, 5,
1254 759, 323, 319, 80, 765, 318, 81, 20, 768, 531,
1255 533, 32, 510, 512, 80, 395, 776, 81, 20, 318,
1256 -497, -497, 361, 319, 770, 318, 362, 157, 158, 772,
1257 363, 319, 318, 777, 318, 33, 529, 318, 75, 318,
1258 108, 318, 320, 257, 396, 320, 322, -15, 379, 380,
1259 381, 382, -497, -497, 361, 514, 516, 518, 431, 191,
1260 255, 554, 432, 319, 73, -15, 319, 127, 404, 449,
1261 -497, -497, 361, 438, 644, 324, 431, 320, 717, 320,
1262 363, 718, 324, 452, 319, 645, 319, 383, 539, 319,
1263 324, 473, 324, 321, 541, 324, 321, 323, 535, -15,
1264 537, 543, 319, 548, -497, -497, 361, 0, 0, 156,
1265 431, -497, -497, 361, 629, 78, 319, 480, 688, 575,
1266 320, 363, 319, 0, 79, 320, 4, 0, 321, 319,
1267 321, 319, 5, 0, 319, 0, 319, 0, 319, -497,
1268 -497, 361, 0, 0, 0, 362, 320, 80, 0, 432,
1269 81, 20, 0, 0, 320, 520, 522, 524, 526, 0,
1270 157, 256, -290, -290, -290, 0, 0, 0, -290, 0,
1271 0, 321, 0, 0, 0, 0, 321, -290, 0, 0,
1272 0, 0, 0, -290, 0, 0, 320, 0, 0, 320,
1273 -290, 324, 0, 0, -290, 322, 0, 321, 322, 0,
1274 -290, 0, 0, -290, -290, 321, 0, 320, 0, 320,
1275 0, -290, 320, 0, 0, 0, 0, -290, 0, 0,
1276 -290, -290, -290, -290, 0, 320, -290, -290, 0, 0,
1277 322, 0, 322, 0, 0, 0, 0, 321, 0, 320,
1278 321, 0, 0, 0, 0, 320, 323, 0, 0, 323,
1279 0, 0, 320, 0, 320, 0, 0, 320, 321, 320,
1280 321, 320, 0, 321, 0, 0, 0, 0, 0, 0,
1281 0, 0, 0, 322, 0, 0, 321, 0, 322, 0,
1282 0, 323, 0, 323, 0, 0, 0, 0, 0, 0,
1283 321, 0, 0, 0, 2, 0, 321, 0, 0, 322,
1284 78, 0, 0, 321, 0, 321, 0, 322, 321, 79,
1285 321, 4, 321, 0, 0, 0, 0, 5, 0, 0,
1286 0, 0, 0, 0, 323, 0, 0, 0, 0, 323,
1287 0, 0, 80, 0, 0, 81, 20, 0, 0, 322,
1288 324, 0, 322, 324, 0, 0, 82, 0, 0, 0,
1289 323, 0, 0, 0, 0, 0, 0, 0, 323, 0,
1290 322, 0, 322, 0, 0, 322, 0, 0, 0, 0,
1291 0, 0, 0, 0, 0, 324, 0, 324, 322, 0,
1292 0, 0, 0, 0, 0, 0, 333, 333, 333, 333,
1293 323, 0, 322, 323, 333, 333, 0, 0, 322, 0,
1294 0, 0, 0, 0, 0, 322, 0, 322, 0, 0,
1295 322, 323, 322, 323, 322, 0, 323, 0, 324, 334,
1296 334, 334, 334, 324, 0, 0, 0, 334, 334, 323,
1297 0, 0, 0, 0, 0, 0, 2, 192, 0, 193,
1298 194, 0, 78, 323, 324, 0, 0, 0, 0, 323,
1299 0, 79, 324, 4, 0, 0, 323, 0, 323, 5,
1300 0, 323, 0, 323, 0, 323, 0, 0, 0, 0,
1301 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1302 0, 195, 196, 0, 324, 0, 78, 324, 126, 0,
1303 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1304 0, 198, 0, 0, 0, 324, 0, 324, 199, 0,
1305 324, 0, 200, 0, 0, 0, 0, 0, 80, 0,
1306 0, 81, 20, 324, 0, 201, 202, 0, 0, 203,
1307 0, 204, 0, 0, 0, 0, 0, 324, 205, 206,
1308 207, 208, 0, 324, 209, 210, 0, 0, 0, 0,
1309 324, 0, 324, 0, 0, 324, 0, 324, 0, 324,
1310 0, 0, 0, 0, 333, 333, 333, 333, 333, 333,
1311 333, 333, 333, 333, 333, 333, 0, 333, 333, 333,
1312 333, 333, 333, 333, 0, 0, 0, 264, 0, 0,
1313 0, 0, 0, 0, 0, 0, 0, 334, 334, 334,
1314 334, 334, 334, 334, 334, 334, 334, 334, 334, 0,
1315 334, 334, 334, 334, 334, 334, 334, 0, 0, 0,
1316 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1317 2, 195, 196, 652, 265, 266, 78, 267, 0, 0,
1318 268, 0, 0, 0, 269, 197, 0, 0, 653, 0,
1319 0, 270, 271, 5, 272, 0, 273, 274, 199, 275,
1320 0, 0, 276, 0, 0, 0, 0, 264, 80, 0,
1321 333, 81, 20, 0, 0, 0, 333, 0, 0, 277,
1322 0, 157, 719, 0, 0, 278, 0, 0, 205, 206,
1323 207, 208, 679, 0, 209, 210, 0, 0, 0, 0,
1324 0, 0, 0, 334, 0, 0, 0, 0, 0, 334,
1325 2, 195, 196, 652, 265, 266, 78, 267, 0, 0,
1326 268, 0, 0, 0, 269, 197, 0, 0, 653, 0,
1327 0, 270, 271, 5, 272, 0, 273, 274, 199, 275,
1328 0, 78, 276, 0, 0, 0, 0, 0, 80, 0,
1329 197, 81, 20, 0, 0, 0, 198, 0, 0, 277,
1330 0, 157, 747, 199, 0, 278, 0, 200, 205, 206,
1331 207, 208, 0, 80, 209, 210, 81, 20, 0, 0,
1332 201, 202, 0, 0, 203, 0, 0, 0, 0, 0,
1333 0, 0, 0, 205, 206, 207, 208, 0, 264, 209,
1334 210, 0, 0, 0, 0, 333, 333, 0, 0, 0,
1335 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1336 0, 333, 0, 0, 0, 0, 0, 0, 0, 0,
1337 0, 0, 0, 0, 0, 0, 0, 0, 334, 334,
1338 0, 2, 195, 196, -267, 265, 266, 78, 267, 0,
1339 0, 268, 0, 0, 334, 269, 197, 0, 0, -267,
1340 0, 0, 270, 271, 5, 272, 264, 273, 274, 199,
1341 275, 0, 0, 276, 0, 0, 0, 0, 0, 80,
1342 0, 0, 81, 20, 0, 0, 0, 0, 0, 0,
1343 277, 0, 157, -267, 0, 0, 278, 0, 0, 205,
1344 206, 207, 208, 0, 0, 209, 210, 0, 0, 2,
1345 195, 196, 0, 265, 266, 78, 267, 0, 0, 268,
1346 0, 0, 0, 269, 197, 0, 0, 0, 0, 0,
1347 270, 271, 5, 272, 264, 273, 274, 199, 275, 0,
1348 0, 276, 0, 0, 0, 0, 0, 80, 0, 0,
1349 81, 20, 0, 0, 0, 0, 0, 0, 277, 0,
1350 157, 437, 0, 0, 278, 0, 0, 205, 206, 207,
1351 208, 0, 0, 209, 210, 0, 0, 2, 195, 196,
1352 0, 265, 266, 78, 267, 0, 0, 268, 0, 0,
1353 0, 269, 197, 0, 0, 0, 0, 0, 270, 271,
1354 5, 272, 264, 273, 274, 199, 275, 0, 0, 276,
1355 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1356 0, 0, 0, 0, 0, 0, 277, 0, 157, 0,
1357 0, 0, 278, 0, 0, 205, 206, 207, 208, 0,
1358 0, 209, 210, 0, 0, 2, 195, 196, 0, 265,
1359 266, 78, 267, 0, 0, 268, 0, 0, 0, 269,
1360 197, 0, 0, 0, 0, 0, 270, 271, 264, 272,
1361 0, 273, 274, 199, 275, 0, 0, 276, 0, 0,
1362 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1363 0, 0, 0, 0, 277, 0, 157, 0, 0, 0,
1364 278, 0, 0, 205, 206, 207, 208, 0, 0, 209,
1365 210, 2, 195, 196, 0, 693, 266, 78, 267, 0,
1366 0, 268, 0, 0, 0, 269, 197, 0, 0, 0,
1367 0, 0, 270, 271, 0, 272, 0, 273, 274, 199,
1368 275, 0, 415, 276, 193, 194, 0, 0, 0, 80,
1369 0, 0, 81, 20, 0, 0, 0, 0, 0, 0,
1370 277, 0, 157, 0, 0, 0, 278, 0, 0, 205,
1371 206, 207, 208, 0, 0, 209, 210, 0, 0, 0,
1372 0, 0, 0, 0, 0, 0, 195, 196, 0, 0,
1373 0, 78, 0, 544, 0, 193, 194, 0, 0, 0,
1374 197, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1375 0, 0, 0, 199, 0, 0, 0, 200, 0, 0,
1376 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1377 201, 202, 0, 0, 203, 0, 0, 195, 196, 0,
1378 416, 0, 78, 205, 206, 207, 208, 0, 0, 209,
1379 210, 197, 0, 0, 0, 0, 0, 198, 491, 0,
1380 193, 194, 0, 0, 199, 0, 0, 0, 200, 0,
1381 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1382 545, 201, 202, 0, 0, 203, 0, 0, 0, 0,
1383 0, 0, 0, 0, 205, 206, 207, 208, 0, 0,
1384 209, 210, 195, 196, 0, 0, 0, 78, 0, 581,
1385 0, 193, 194, 0, 0, 0, 197, 0, 0, 0,
1386 0, 0, 198, 0, 0, 0, 0, 0, 0, 199,
1387 0, 0, 0, 200, 0, 0, 0, 0, 0, 80,
1388 0, 0, 81, 20, 0, 0, 201, 202, 0, 0,
1389 203, 0, 0, 195, 196, 148, 0, 0, 78, 205,
1390 206, 207, 208, 0, 0, 209, 210, 197, 0, 0,
1391 0, 0, 0, 198, 589, 0, 193, 194, 0, 0,
1392 199, 0, 0, 0, 200, 0, 0, 0, 0, 0,
1393 80, 0, 0, 81, 20, 0, 0, 201, 202, 0,
1394 0, 203, 582, 0, 0, 0, 0, 0, 0, 0,
1395 205, 206, 207, 208, 0, 0, 209, 210, 195, 196,
1396 0, 0, 0, 78, 0, 597, 0, 193, 194, 0,
1397 0, 0, 197, 0, 0, 0, 0, 0, 198, 0,
1398 0, 0, 0, 0, 0, 199, 0, 0, 0, 200,
1399 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1400 0, 0, 201, 202, 0, 0, 203, 0, 0, 195,
1401 196, 0, 590, 0, 78, 205, 206, 207, 208, 0,
1402 0, 209, 210, 197, 0, 0, 0, 0, 0, 198,
1403 606, 0, 193, 194, 0, 0, 199, 0, 0, 0,
1404 200, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1405 20, 0, 0, 201, 202, 0, 0, 203, 0, 0,
1406 0, 0, 598, 0, 0, 0, 205, 206, 207, 208,
1407 0, 0, 209, 210, 195, 196, 0, 0, 0, 78,
1408 0, 491, 0, 193, 194, 0, 0, 0, 197, 0,
1409 0, 0, 0, 0, 198, 0, 0, 0, 0, 0,
1410 0, 199, 0, 0, 0, 200, 0, 0, 0, 0,
1411 0, 80, 0, 0, 81, 20, 0, 0, 201, 202,
1412 0, 0, 203, 607, 0, 195, 196, 0, 0, 0,
1413 78, 205, 206, 207, 208, 0, 0, 209, 210, 197,
1414 0, 0, 0, 0, 0, 198, 581, 0, 193, 194,
1415 0, 0, 199, 0, 0, 0, 200, 0, 0, 0,
1416 0, 0, 80, 0, 0, 81, 20, 0, 0, 201,
1417 202, 0, 0, 203, 0, 0, 0, 0, 598, 0,
1418 0, 0, 205, 206, 207, 208, 0, 0, 209, 210,
1419 195, 196, 0, 0, 0, 78, 0, 707, 0, 193,
1420 194, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1421 198, 0, 0, 0, 0, 0, 0, 199, 0, 0,
1422 0, 200, 0, 0, 0, 0, 0, 80, 0, 0,
1423 81, 20, 0, 0, 201, 202, 0, 0, 203, 691,
1424 0, 195, 196, 0, 0, 0, 78, 205, 206, 207,
1425 208, 0, 0, 209, 210, 197, 0, 0, 0, 0,
1426 0, 198, 707, 0, 193, 194, 0, 0, 199, 0,
1427 0, 0, 200, 0, 0, 0, 0, 0, 80, 0,
1428 0, 81, 20, 0, 0, 201, 202, 0, 0, 203,
1429 708, 0, 0, 0, 0, 0, 0, 0, 205, 206,
1430 207, 208, 0, 0, 209, 210, 195, 196, 0, 0,
1431 0, 78, 0, 589, 0, 193, 194, 0, 0, 0,
1432 197, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1433 0, 0, 0, 199, 0, 0, 0, 200, 0, 0,
1434 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1435 201, 202, 0, 0, 203, 751, 0, 195, 196, 0,
1436 0, 0, 78, 205, 206, 207, 208, 0, 0, 209,
1437 210, 197, 0, 0, 0, 0, 0, 198, 331, 0,
1438 193, 194, 0, 0, 199, 0, 0, 0, 200, 0,
1439 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1440 0, 201, 202, 0, 0, 203, 0, 0, 0, 0,
1441 0, 756, 0, 0, 205, 206, 207, 208, 0, 0,
1442 209, 210, 195, 196, 0, 0, 0, 78, 0, 336,
1443 0, 193, 194, 0, 0, 0, 197, 0, 0, 0,
1444 0, 0, 198, 0, 0, 0, 0, 0, 0, 199,
1445 0, 0, 0, 200, 0, 0, 0, 0, 0, 80,
1446 0, 0, 81, 20, 0, 0, 201, 202, 0, 0,
1447 203, 0, 0, 195, 196, 0, 0, 0, 78, 205,
1448 206, 207, 208, 0, 0, 209, 210, 197, 0, 0,
1449 0, 0, 0, 198, 338, 0, 193, 194, 0, 0,
1450 199, 0, 0, 0, 200, 0, 0, 0, 0, 0,
1451 80, 0, 0, 81, 20, 0, 0, 201, 202, 0,
1452 0, 203, 0, 0, 0, 0, 0, 0, 0, 0,
1453 205, 206, 207, 208, 0, 0, 209, 210, 195, 196,
1454 0, 0, 0, 78, 0, 340, 0, 193, 194, 0,
1455 0, 0, 197, 0, 0, 0, 0, 0, 198, 0,
1456 0, 0, 0, 0, 0, 199, 0, 0, 0, 200,
1457 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1458 0, 0, 201, 202, 0, 0, 203, 0, 0, 195,
1459 196, 0, 0, 0, 78, 205, 206, 207, 208, 0,
1460 0, 209, 210, 197, 0, 0, 0, 0, 0, 198,
1461 349, 0, 193, 194, 0, 0, 199, 0, 0, 0,
1462 200, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1463 20, 0, 0, 201, 202, 0, 0, 203, 0, 0,
1464 0, 0, 0, 0, 0, 0, 205, 206, 207, 208,
1465 0, 0, 209, 210, 195, 196, 0, 0, 0, 78,
1466 0, 351, 0, 193, 194, 0, 0, 0, 197, 0,
1467 0, 0, 0, 0, 198, 0, 0, 0, 0, 0,
1468 0, 199, 0, 0, 0, 200, 0, 0, 0, 0,
1469 0, 80, 0, 0, 81, 20, 0, 0, 201, 202,
1470 0, 0, 203, 0, 0, 195, 196, 0, 0, 0,
1471 78, 205, 206, 207, 208, 0, 0, 209, 210, 197,
1472 0, 0, 0, 0, 0, 198, 353, 0, 193, 194,
1473 0, 0, 199, 0, 0, 0, 200, 0, 0, 0,
1474 0, 0, 80, 0, 0, 81, 20, 0, 0, 201,
1475 202, 0, 0, 203, 0, 0, 0, 0, 0, 0,
1476 0, 0, 205, 206, 207, 208, 0, 0, 209, 210,
1477 195, 196, 0, 0, 0, 78, 0, 410, 0, 193,
1478 194, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1479 198, 0, 0, 0, 0, 0, 0, 199, 0, 0,
1480 0, 200, 0, 0, 0, 0, 0, 80, 0, 0,
1481 81, 20, 0, 0, 201, 202, 0, 0, 203, 0,
1482 0, 195, 196, 0, 0, 0, 78, 205, 206, 207,
1483 208, 0, 0, 209, 210, 197, 0, 0, 0, 0,
1484 0, 198, 491, 0, 193, 194, 0, 0, 199, 0,
1485 0, 0, 200, 0, 0, 0, 0, 0, 80, 0,
1486 0, 81, 20, 0, 0, 201, 202, 0, 0, 203,
1487 0, 0, 0, 0, 0, 0, 0, 0, 205, 206,
1488 207, 208, 0, 0, 209, 210, 195, 196, 0, 0,
1489 0, 78, 0, 499, 0, 193, 194, 0, 0, 0,
1490 197, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1491 0, 0, 0, 199, 0, 0, 0, 200, 0, 0,
1492 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1493 201, 202, 0, 0, 203, 0, 0, 195, 196, 0,
1494 0, 0, 78, 205, 206, 207, 208, 0, 0, 209,
1495 210, 197, 0, 0, 0, 0, 0, 198, 503, 0,
1496 193, 194, 0, 0, 199, 0, 0, 0, 200, 0,
1497 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1498 0, 201, 202, 0, 0, 203, 0, 0, 0, 0,
1499 0, 0, 0, 0, 205, 206, 207, 208, 0, 0,
1500 209, 210, 195, 196, 0, 0, 0, 78, 0, 505,
1501 0, 193, 194, 0, 0, 0, 197, 0, 0, 0,
1502 0, 0, 198, 0, 0, 0, 0, 0, 0, 199,
1503 0, 0, 0, 200, 0, 0, 0, 0, 0, 80,
1504 0, 0, 81, 20, 0, 0, 201, 202, 0, 0,
1505 203, 0, 0, 195, 196, 0, 0, 0, 78, 205,
1506 206, 207, 208, 0, 0, 209, 210, 197, 0, 0,
1507 0, 0, 0, 198, 507, 0, 193, 194, 0, 0,
1508 199, 0, 0, 0, 200, 0, 0, 0, 0, 0,
1509 80, 0, 0, 81, 20, 0, 0, 201, 202, 0,
1510 0, 203, 0, 0, 0, 0, 0, 0, 0, 0,
1511 205, 206, 207, 208, 0, 0, 209, 210, 195, 196,
1512 0, 0, 0, 78, 0, 509, 0, 193, 194, 0,
1513 0, 0, 197, 0, 0, 0, 0, 0, 198, 0,
1514 0, 0, 0, 0, 0, 199, 0, 0, 0, 200,
1515 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1516 0, 0, 201, 202, 0, 0, 203, 0, 0, 195,
1517 196, 0, 0, 0, 78, 205, 206, 207, 208, 0,
1518 0, 209, 210, 197, 0, 0, 0, 0, 0, 198,
1519 511, 0, 193, 194, 0, 0, 199, 0, 0, 0,
1520 200, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1521 20, 0, 0, 201, 202, 0, 0, 203, 0, 0,
1522 0, 0, 0, 0, 0, 0, 205, 206, 207, 208,
1523 0, 0, 209, 210, 195, 196, 0, 0, 0, 78,
1524 0, 513, 0, 193, 194, 0, 0, 0, 197, 0,
1525 0, 0, 0, 0, 198, 0, 0, 0, 0, 0,
1526 0, 199, 0, 0, 0, 200, 0, 0, 0, 0,
1527 0, 80, 0, 0, 81, 20, 0, 0, 201, 202,
1528 0, 0, 203, 0, 0, 195, 196, 0, 0, 0,
1529 78, 205, 206, 207, 208, 0, 0, 209, 210, 197,
1530 0, 0, 0, 0, 0, 198, 515, 0, 193, 194,
1531 0, 0, 199, 0, 0, 0, 200, 0, 0, 0,
1532 0, 0, 80, 0, 0, 81, 20, 0, 0, 201,
1533 202, 0, 0, 203, 0, 0, 0, 0, 0, 0,
1534 0, 0, 205, 206, 207, 208, 0, 0, 209, 210,
1535 195, 196, 0, 0, 0, 78, 0, 517, 0, 193,
1536 194, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1537 198, 0, 0, 0, 0, 0, 0, 199, 0, 0,
1538 0, 200, 0, 0, 0, 0, 0, 80, 0, 0,
1539 81, 20, 0, 0, 201, 202, 0, 0, 203, 0,
1540 0, 195, 196, 0, 0, 0, 78, 205, 206, 207,
1541 208, 0, 0, 209, 210, 197, 0, 0, 0, 0,
1542 0, 198, 519, 0, 193, 194, 0, 0, 199, 0,
1543 0, 0, 200, 0, 0, 0, 0, 0, 80, 0,
1544 0, 81, 20, 0, 0, 201, 202, 0, 0, 203,
1545 0, 0, 0, 0, 0, 0, 0, 0, 205, 206,
1546 207, 208, 0, 0, 209, 210, 195, 196, 0, 0,
1547 0, 78, 0, 521, 0, 193, 194, 0, 0, 0,
1548 197, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1549 0, 0, 0, 199, 0, 0, 0, 200, 0, 0,
1550 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1551 201, 202, 0, 0, 203, 0, 0, 195, 196, 0,
1552 0, 0, 78, 205, 206, 207, 208, 0, 0, 209,
1553 210, 197, 0, 0, 0, 0, 0, 198, 523, 0,
1554 193, 194, 0, 0, 199, 0, 0, 0, 200, 0,
1555 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1556 0, 201, 202, 0, 0, 203, 0, 0, 0, 0,
1557 0, 0, 0, 0, 205, 206, 207, 208, 0, 0,
1558 209, 210, 195, 196, 0, 0, 0, 78, 0, 525,
1559 0, 193, 194, 0, 0, 0, 197, 0, 0, 0,
1560 0, 0, 198, 0, 0, 0, 0, 0, 0, 199,
1561 0, 0, 0, 200, 0, 0, 0, 0, 0, 80,
1562 0, 0, 81, 20, 0, 0, 201, 202, 0, 0,
1563 203, 0, 0, 195, 196, 0, 0, 0, 78, 205,
1564 206, 207, 208, 0, 0, 209, 210, 197, 0, 0,
1565 0, 0, 0, 198, 530, 0, 193, 194, 0, 0,
1566 199, 0, 0, 0, 200, 0, 0, 0, 0, 0,
1567 80, 0, 0, 81, 20, 0, 0, 201, 202, 0,
1568 0, 203, 0, 0, 0, 0, 0, 0, 0, 0,
1569 205, 206, 207, 208, 0, 0, 209, 210, 195, 196,
1570 0, 0, 0, 78, 0, 532, 0, 193, 194, 0,
1571 0, 0, 197, 0, 0, 0, 0, 0, 198, 0,
1572 0, 0, 0, 0, 0, 199, 0, 0, 0, 200,
1573 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1574 0, 0, 201, 202, 0, 0, 203, 0, 0, 195,
1575 196, 0, 0, 0, 78, 205, 206, 207, 208, 0,
1576 0, 209, 210, 197, 0, 0, 0, 0, 0, 198,
1577 534, 0, 193, 194, 0, 0, 199, 0, 0, 0,
1578 200, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1579 20, 0, 0, 201, 202, 0, 0, 203, 0, 0,
1580 0, 0, 0, 0, 0, 0, 205, 206, 207, 208,
1581 0, 0, 209, 210, 195, 196, 0, 0, 0, 78,
1582 0, 536, 0, 193, 194, 0, 0, 0, 197, 0,
1583 0, 0, 0, 0, 198, 0, 0, 0, 0, 0,
1584 0, 199, 0, 0, 0, 200, 0, 0, 0, 0,
1585 0, 80, 0, 0, 81, 20, 0, 0, 201, 202,
1586 0, 0, 203, 0, 0, 195, 196, 0, 0, 0,
1587 78, 205, 206, 207, 208, 0, 0, 209, 210, 197,
1588 0, 0, 0, 0, 0, 198, 538, 0, 193, 194,
1589 0, 0, 199, 0, 0, 0, 200, 0, 0, 0,
1590 0, 0, 80, 0, 0, 81, 20, 0, 0, 201,
1591 202, 0, 0, 203, 0, 0, 0, 0, 0, 0,
1592 0, 0, 205, 206, 207, 208, 0, 0, 209, 210,
1593 195, 196, 0, 0, 0, 78, 0, 540, 0, 193,
1594 194, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1595 198, 0, 0, 0, 0, 0, 0, 199, 0, 0,
1596 0, 200, 0, 0, 0, 0, 0, 80, 0, 0,
1597 81, 20, 0, 0, 201, 202, 0, 0, 203, 0,
1598 0, 195, 196, 0, 0, 0, 78, 205, 206, 207,
1599 208, 0, 0, 209, 210, 197, 0, 0, 0, 0,
1600 0, 198, 542, 0, 193, 194, 0, 0, 199, 0,
1601 0, 0, 200, 0, 0, 0, 0, 0, 80, 0,
1602 0, 81, 20, 0, 0, 201, 202, 0, 0, 203,
1603 0, 0, 0, 0, 0, 0, 0, 0, 205, 206,
1604 207, 208, 0, 0, 209, 210, 195, 196, 0, 0,
1605 0, 78, 0, 547, 0, 193, 194, 0, 0, 0,
1606 197, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1607 0, 0, 0, 199, 0, 0, 0, 200, 0, 0,
1608 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1609 201, 202, 0, 0, 203, 0, 0, 195, 196, 0,
1610 0, 0, 78, 205, 206, 207, 208, 0, 0, 209,
1611 210, 197, 0, 0, 0, 0, 0, 198, 557, 0,
1612 193, 194, 0, 0, 199, 0, 0, 0, 200, 0,
1613 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1614 0, 201, 202, 0, 0, 203, 0, 0, 0, 0,
1615 0, 0, 0, 0, 205, 206, 207, 208, 0, 0,
1616 209, 210, 195, 196, 0, 0, 0, 78, 0, 565,
1617 0, 193, 194, 0, 0, 0, 197, 0, 0, 0,
1618 0, 0, 198, 0, 0, 0, 0, 0, 0, 199,
1619 0, 0, 0, 200, 0, 0, 0, 0, 0, 80,
1620 0, 0, 81, 20, 0, 0, 201, 202, 0, 0,
1621 203, 0, 0, 195, 196, 0, 0, 0, 78, 205,
1622 206, 207, 208, 0, 0, 209, 210, 197, 0, 0,
1623 0, 0, 0, 198, 567, 0, 193, 194, 0, 0,
1624 199, 0, 0, 0, 200, 0, 0, 0, 0, 0,
1625 80, 0, 0, 81, 20, 0, 0, 201, 202, 0,
1626 0, 203, 0, 0, 0, 0, 0, 0, 0, 0,
1627 205, 206, 207, 208, 0, 0, 209, 210, 195, 196,
1628 0, 0, 0, 78, 0, 592, 0, 193, 194, 0,
1629 0, 0, 197, 0, 0, 0, 0, 0, 198, 0,
1630 0, 0, 0, 0, 0, 199, 0, 0, 0, 200,
1631 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1632 0, 0, 201, 202, 0, 0, 203, 0, 0, 195,
1633 196, 0, 0, 0, 78, 205, 206, 207, 208, 0,
1634 0, 209, 210, 197, 0, 0, 0, 0, 0, 198,
1635 609, 0, 193, 194, 0, 0, 199, 0, 0, 0,
1636 200, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1637 20, 0, 0, 201, 202, 0, 0, 203, 0, 0,
1638 0, 0, 0, 0, 0, 0, 205, 206, 207, 208,
1639 0, 0, 209, 210, 195, 196, 0, 0, 0, 78,
1640 0, 677, 0, 193, 194, 0, 0, 0, 197, 0,
1641 0, 0, 0, 0, 198, 0, 0, 0, 0, 0,
1642 0, 199, 0, 0, 0, 200, 0, 0, 0, 0,
1643 0, 80, 0, 0, 81, 20, 0, 0, 201, 202,
1644 0, 0, 203, 0, 0, 195, 196, 0, 0, 0,
1645 78, 205, 206, 207, 208, 0, 0, 209, 210, 197,
1646 0, 0, 0, 0, 0, 198, 681, 0, 193, 194,
1647 0, 0, 199, 0, 0, 0, 200, 0, 0, 0,
1648 0, 0, 80, 0, 0, 81, 20, 0, 0, 201,
1649 202, 0, 0, 203, 0, 0, 0, 0, 0, 0,
1650 0, 0, 205, 206, 207, 208, 0, 0, 209, 210,
1651 195, 196, 0, 0, 0, 78, 0, 687, 0, 193,
1652 194, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1653 198, 0, 0, 0, 0, 0, 0, 199, 0, 0,
1654 0, 200, 0, 0, 0, 0, 0, 80, 0, 0,
1655 81, 20, 0, 0, 201, 202, 0, 0, 203, 0,
1656 0, 195, 196, 0, 0, 0, 78, 205, 206, 207,
1657 208, 0, 0, 209, 210, 197, 0, 0, 0, 0,
1658 0, 198, 713, 0, 193, 194, 0, 0, 199, 0,
1659 0, 0, 200, 0, 0, 0, 0, 0, 80, 0,
1660 0, 81, 20, 0, 0, 201, 202, 0, 0, 203,
1661 0, 0, 0, 0, 0, 0, 0, 0, 205, 206,
1662 207, 208, 0, 0, 209, 210, 195, 196, 0, 0,
1663 0, 78, 0, 662, 0, 0, 0, 0, 0, 0,
1664 197, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1665 0, 0, 0, 199, 0, 0, 0, 200, 724, 0,
1666 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1667 201, 202, 0, 0, 203, 0, 0, 195, 196, 0,
1668 0, 0, 78, 205, 206, 207, 208, 0, 0, 209,
1669 210, 197, 0, 0, 0, 0, 0, 198, 0, 0,
1670 0, 0, 195, 196, 199, 0, 0, 78, 200, 0,
1671 0, 193, 194, 0, 80, 0, 197, 81, 20, 0,
1672 0, 0, 198, 0, 0, 277, -298, 0, 0, 199,
1673 0, 0, 0, 200, 205, 206, 207, 208, 0, 80,
1674 209, 210, 81, 20, 0, 0, 0, 0, 0, 0,
1675 277, -298, 0, 195, 196, 0, 0, 0, 78, 205,
1676 206, 207, 208, 0, 0, 209, 210, 197, 0, 0,
1677 0, 0, 0, 198, 0, 0, 193, 194, 0, 0,
1678 199, 0, 0, 0, 200, 0, 0, 0, 0, 0,
1679 80, 0, 0, 81, 20, 0, 0, 201, 202, 0,
1680 0, 203, 0, 204, 357, 0, 0, 0, 0, 0,
1681 205, 206, 207, 208, 0, 0, 209, 210, 195, 196,
1682 0, 0, 0, 78, 0, 0, 0, 193, 194, 0,
1683 0, 0, 197, 0, 0, 0, 0, 0, 198, 0,
1684 0, 0, 0, 0, 0, 199, 0, 0, 0, 200,
1685 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1686 0, 0, 201, 202, 0, 0, 203, 488, 0, 195,
1687 196, 0, 0, 0, 78, 205, 206, 207, 208, 0,
1688 0, 209, 210, 197, 0, 0, 0, 0, 0, 198,
1689 0, 0, 193, 194, 0, 0, 199, 0, 0, 0,
1690 200, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1691 20, 0, 0, 201, 202, 0, 0, 203, 625, 0,
1692 0, 0, 0, 0, 0, 0, 205, 206, 207, 208,
1693 0, 0, 209, 210, 195, 196, 0, 0, 0, 78,
1694 0, 0, 0, 193, 194, 0, 0, 0, 197, 0,
1695 0, 0, 0, 0, 198, 0, 0, 0, 0, 0,
1696 0, 199, 0, 0, 0, 200, 0, 0, 0, 0,
1697 0, 80, 0, 0, 81, 20, 0, 0, 201, 202,
1698 0, 0, 203, 668, 0, 195, 196, 0, 0, 0,
1699 78, 205, 206, 207, 208, 0, 0, 209, 210, 197,
1700 0, 0, 0, 0, 0, 198, 0, 0, 193, 194,
1701 0, 0, 199, 0, 0, 0, 200, 0, 0, 0,
1702 0, 0, 80, 0, 0, 81, 20, 0, 0, 201,
1703 202, 0, 0, 203, 683, 0, 0, 0, 0, 0,
1704 0, 0, 205, 206, 207, 208, 0, 0, 209, 210,
1705 195, 196, 0, 0, 0, 78, 0, 0, 0, 0,
1706 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1707 198, 0, 0, 0, 0, 0, 0, 199, 0, 0,
1708 0, 200, 0, 0, 0, 0, 0, 80, 0, 0,
1709 81, 20, 0, 0, 201, 202, 0, 0, 203, 0,
1710 2, 195, 196, 0, 0, 0, 78, 205, 206, 207,
1711 208, 0, 0, 209, 210, 197, 0, 0, 0, 0,
1712 0, 198, 0, 0, 0, 0, 0, 0, 199, 0,
1713 0, 78, 200, 0, 0, 0, 0, 0, 80, 0,
1714 197, 81, 20, 0, 0, 0, 198, 0, 0, 277,
1715 0, 0, 0, 199, 0, 0, 0, 200, 205, 206,
1716 207, 208, 0, 80, 209, 210, 81, 20, 0, 0,
1717 201, 202, 0, 0, 203, 0, 0, 0, 0, 0,
1718 0, 0, 0, 205, 206, 207, 208, 0, 0, 209,
1722 static const short yycheck[] = { 3,
1723 308, 129, 6, 288, 328, 204, 133, 1, 123, 175,
1724 132, 134, 62, 1, 483, 179, 1, 1, 665, 0,
1725 15, 1, 1, 295, 553, 1, 1, 556, 9, 10,
1726 11, 303, 72, 305, 162, 1, 117, 86, 42, 89,
1727 1, 169, 46, 657, 94, 129, 86, 95, 1, 30,
1728 62, 53, 33, 34, 347, 1, 436, 1, 62, 94,
1729 64, 354, 355, 1, 129, 69, 101, 94, 1, 150,
1730 51, 42, 153, 100, 100, 46, 199, 1, 162, 129,
1731 175, 62, 94, 133, 52, 89, 1, 1, 67, 1,
1732 94, 172, 87, 64, 1, 97, 476, 162, 69, 93,
1733 88, 67, 631, 1, 718, 636, 1, 101, 1, 756,
1734 160, 95, 162, 94, 99, 99, 101, 129, 765, 99,
1735 1, 101, 502, 99, 128, 129, 101, 254, 1, 133,
1736 134, 1, 260, 183, 193, 194, 195, 196, 99, 100,
1737 4, 5, 201, 202, 613, 273, 99, 100, 129, 1,
1738 162, 1, 133, 99, 1, 99, 160, 128, 162, 1,
1739 98, 94, 636, 134, 279, 329, 697, 100, 1, 700,
1740 1, 175, 36, 37, 255, 99, 40, 470, 1, 183,
1741 473, 162, 94, 1, 99, 99, 50, 94, 100, 193,
1742 194, 195, 196, 288, 175, 199, 94, 201, 202, 203,
1743 295, 328, 100, 98, 254, 86, 99, 330, 303, 1,
1744 305, 1, 101, 308, 94, 79, 596, 1, 99, 83,
1745 100, 62, 97, 697, 94, 98, 700, 94, 199, 636,
1746 100, 1, 763, 100, 86, 285, 1, 768, 404, 770,
1747 1, 772, 622, 9, 1, 63, 1, 99, 89, 99,
1748 254, 98, 632, 94, 1, 1, 1, 99, 122, 123,
1749 1, 0, 1, 94, 94, 98, 140, 33, 648, 100,
1750 100, 556, 97, 254, 636, 139, 99, 95, 328, 93,
1751 588, 285, 590, 97, 288, 100, 485, 101, 129, 763,
1752 697, 295, 133, 700, 768, 1, 770, 52, 772, 303,
1753 1, 305, 99, 100, 308, 44, 98, 288, 98, 404,
1754 94, 175, 371, 372, 373, 179, 55, 641, 63, 160,
1755 435, 162, 61, 1, 328, 95, 330, 308, 67, 203,
1756 204, 88, 1, 98, 175, 697, 75, 98, 700, 1,
1757 95, 1, 183, 1, 1, 93, 631, 328, 95, 95,
1758 95, 1, 732, 95, 95, 219, 763, 665, 199, 330,
1759 99, 768, 203, 770, 636, 772, 98, 371, 372, 373,
1760 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
1761 384, 385, 386, 387, 388, 389, 390, 553, 94, 1,
1762 1, 92, 266, 94, 52, 269, 97, 98, 99, 100,
1763 404, 763, 1, 277, 268, 63, 768, 47, 770, 95,
1764 772, 275, 1, 254, 96, 279, 94, 86, 477, 129,
1765 1, 1, 62, 404, 288, 697, 1, 93, 700, 1,
1766 1, 295, 94, 93, 99, 720, 93, 95, 1, 303,
1767 95, 305, 570, 93, 285, 573, 1, 288, 756, 53,
1768 160, 723, 162, 94, 175, 65, 96, 765, 553, 100,
1769 94, 556, 72, 97, 736, 329, 1, 308, 1, 44,
1770 44, 94, 0, 477, 86, 50, 1, 100, 750, 483,
1771 344, 9, 10, 11, 100, 607, 1, 328, 362, 0,
1772 1, 763, 366, 588, 93, 590, 768, 107, 770, 363,
1773 772, 365, 30, 625, 93, 33, 34, 82, 1, 44,
1774 85, 86, 93, 93, 641, 101, 47, 391, 1, 94,
1775 92, 93, 93, 51, 101, 97, 98, 99, 100, 1,
1776 93, 62, 67, 44, 62, 409, 631, 52, 93, 667,
1777 404, 636, 383, 101, 55, 419, 1, 421, 63, 553,
1778 61, 175, 556, 612, 676, 1, 67, 431, 93, 97,
1779 93, 86, 657, 404, 686, 96, 94, 288, 432, 1,
1780 665, 435, 553, 5, 295, 556, 99, 100, 64, 453,
1781 95, 455, 303, 69, 305, 95, 96, 308, 99, 99,
1782 97, 641, 11, 86, 101, 469, 9, 1, 11, 45,
1783 46, 129, 697, 86, 50, 700, 480, 12, 612, 613,
1784 65, 485, 67, 59, 86, 13, 1, 72, 1, 65,
1785 33, 76, 1, 718, 628, 720, 72, 631, 723, 95,
1786 76, 86, 636, 99, 162, 1, 82, 641, 1, 85,
1787 86, 736, 128, 1, 0, 1, 1, 93, 3, 4,
1788 631, 1, 14, 657, 86, 750, 102, 103, 104, 105,
1789 641, 756, 108, 109, 288, 50, 99, 1, 763, 83,
1790 765, 295, 1, 768, 175, 770, 657, 772, 95, 303,
1791 97, 305, 86, 404, 308, 1, 1, 95, 44, 553,
1792 45, 46, 556, 697, 93, 50, 700, 82, 1, 55,
1793 85, 86, 93, 86, 59, 61, 1, 86, 122, 123,
1794 65, 67, 553, 1, 718, 556, 720, 72, 1, 723,
1795 86, 76, 472, 86, 474, 175, 1, 82, 86, 97,
1796 85, 86, 736, 101, 89, 90, 86, 718, 93, 720,
1797 95, 96, 99, 99, 97, 619, 750, 102, 103, 104,
1798 105, 67, 86, 108, 109, 94, 72, 86, 97, 763,
1799 76, 99, 45, 46, 768, 629, 770, 631, 772, 96,
1800 86, 86, 636, 100, 99, 1, 0, 1, 44, 653,
1801 404, 0, 1, 86, 60, 659, 470, 288, 64, 473,
1802 631, 86, 99, 657, 295, 61, 0, 1, 86, 100,
1803 641, 67, 303, 86, 305, 88, 95, 308, 91, 92,
1804 93, 86, 94, 1, 97, 97, 657, 66, 101, 101,
1805 44, 93, 0, 1, 93, 44, 88, 175, 1, 0,
1806 1, 55, 553, 697, 93, 556, 700, 61, 288, 65,
1807 44, 67, 61, 67, 99, 295, 72, 94, 67, 1,
1808 76, 91, 92, 303, 718, 305, 720, 61, 308, 723,
1809 86, 735, 50, 67, 1, 739, 44, 588, 697, 590,
1810 93, 700, 736, 44, 99, 99, 92, 718, 175, 720,
1811 99, 97, 98, 61, 1, 94, 750, 45, 46, 67,
1812 61, 5, 6, 7, 82, 99, 67, 85, 86, 763,
1813 8, 9, 10, 404, 768, 94, 770, 44, 772, 1,
1814 631, 45, 46, 50, 97, 636, 91, 92, 45, 46,
1815 1, 99, 59, 100, 61, 3, 4, 44, 99, 553,
1816 67, 94, 556, 50, 763, 56, 657, 16, 17, 768,
1817 288, 770, 99, 772, 665, 82, 56, 295, 85, 86,
1818 91, 92, 44, 50, 404, 303, 94, 305, 50, 94,
1819 308, 45, 46, 97, 588, 82, 590, 101, 85, 86,
1820 97, 94, 175, 1, 101, 44, 697, 45, 46, 700,
1821 10, 50, 97, 98, 99, 82, 44, 94, 85, 86,
1822 82, 288, 50, 85, 86, 97, 98, 718, 295, 720,
1823 30, 59, 723, 61, 34, 1, 303, 631, 305, 67,
1824 99, 308, 636, 82, 99, 736, 85, 86, 94, 384,
1825 385, 51, 374, 375, 82, 94, 0, 85, 86, 750,
1826 91, 92, 93, 657, 56, 756, 97, 95, 96, 94,
1827 101, 665, 763, 0, 765, 11, 383, 768, 54, 770,
1828 75, 772, 553, 162, 254, 556, 404, 86, 18, 19,
1829 20, 21, 91, 92, 93, 376, 377, 378, 97, 139,
1830 160, 404, 101, 697, 52, 86, 700, 94, 262, 308,
1831 91, 92, 93, 288, 571, 288, 97, 588, 655, 590,
1832 101, 655, 295, 308, 718, 571, 720, 57, 388, 723,
1833 303, 347, 305, 553, 389, 308, 556, 404, 386, 86,
1834 387, 390, 736, 394, 91, 92, 93, -1, -1, 44,
1835 97, 91, 92, 93, 101, 50, 750, 97, 628, 1,
1836 631, 101, 756, -1, 59, 636, 61, -1, 588, 763,
1837 590, 765, 67, -1, 768, -1, 770, -1, 772, 91,
1838 92, 93, -1, -1, -1, 97, 657, 82, -1, 101,
1839 85, 86, -1, -1, 665, 379, 380, 381, 382, -1,
1840 95, 96, 44, 45, 46, -1, -1, -1, 50, -1,
1841 -1, 631, -1, -1, -1, -1, 636, 59, -1, -1,
1842 -1, -1, -1, 65, -1, -1, 697, -1, -1, 700,
1843 72, 404, -1, -1, 76, 553, -1, 657, 556, -1,
1844 82, -1, -1, 85, 86, 665, -1, 718, -1, 720,
1845 -1, 93, 723, -1, -1, -1, -1, 99, -1, -1,
1846 102, 103, 104, 105, -1, 736, 108, 109, -1, -1,
1847 588, -1, 590, -1, -1, -1, -1, 697, -1, 750,
1848 700, -1, -1, -1, -1, 756, 553, -1, -1, 556,
1849 -1, -1, 763, -1, 765, -1, -1, 768, 718, 770,
1850 720, 772, -1, 723, -1, -1, -1, -1, -1, -1,
1851 -1, -1, -1, 631, -1, -1, 736, -1, 636, -1,
1852 -1, 588, -1, 590, -1, -1, -1, -1, -1, -1,
1853 750, -1, -1, -1, 44, -1, 756, -1, -1, 657,
1854 50, -1, -1, 763, -1, 765, -1, 665, 768, 59,
1855 770, 61, 772, -1, -1, -1, -1, 67, -1, -1,
1856 -1, -1, -1, -1, 631, -1, -1, -1, -1, 636,
1857 -1, -1, 82, -1, -1, 85, 86, -1, -1, 697,
1858 553, -1, 700, 556, -1, -1, 96, -1, -1, -1,
1859 657, -1, -1, -1, -1, -1, -1, -1, 665, -1,
1860 718, -1, 720, -1, -1, 723, -1, -1, -1, -1,
1861 -1, -1, -1, -1, -1, 588, -1, 590, 736, -1,
1862 -1, -1, -1, -1, -1, -1, 193, 194, 195, 196,
1863 697, -1, 750, 700, 201, 202, -1, -1, 756, -1,
1864 -1, -1, -1, -1, -1, 763, -1, 765, -1, -1,
1865 768, 718, 770, 720, 772, -1, 723, -1, 631, 193,
1866 194, 195, 196, 636, -1, -1, -1, 201, 202, 736,
1867 -1, -1, -1, -1, -1, -1, 44, 1, -1, 3,
1868 4, -1, 50, 750, 657, -1, -1, -1, -1, 756,
1869 -1, 59, 665, 61, -1, -1, 763, -1, 765, 67,
1870 -1, 768, -1, 770, -1, 772, -1, -1, -1, -1,
1871 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1872 -1, 45, 46, -1, 697, -1, 50, 700, 96, -1,
1873 -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
1874 -1, 65, -1, -1, -1, 718, -1, 720, 72, -1,
1875 723, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1876 -1, 85, 86, 736, -1, 89, 90, -1, -1, 93,
1877 -1, 95, -1, -1, -1, -1, -1, 750, 102, 103,
1878 104, 105, -1, 756, 108, 109, -1, -1, -1, -1,
1879 763, -1, 765, -1, -1, 768, -1, 770, -1, 772,
1880 -1, -1, -1, -1, 371, 372, 373, 374, 375, 376,
1881 377, 378, 379, 380, 381, 382, -1, 384, 385, 386,
1882 387, 388, 389, 390, -1, -1, -1, 1, -1, -1,
1883 -1, -1, -1, -1, -1, -1, -1, 371, 372, 373,
1884 374, 375, 376, 377, 378, 379, 380, 381, 382, -1,
1885 384, 385, 386, 387, 388, 389, 390, -1, -1, -1,
1886 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1887 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1888 54, -1, -1, -1, 58, 59, -1, -1, 62, -1,
1889 -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
1890 -1, -1, 76, -1, -1, -1, -1, 1, 82, -1,
1891 477, 85, 86, -1, -1, -1, 483, -1, -1, 93,
1892 -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
1893 104, 105, 1, -1, 108, 109, -1, -1, -1, -1,
1894 -1, -1, -1, 477, -1, -1, -1, -1, -1, 483,
1895 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1896 54, -1, -1, -1, 58, 59, -1, -1, 62, -1,
1897 -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
1898 -1, 50, 76, -1, -1, -1, -1, -1, 82, -1,
1899 59, 85, 86, -1, -1, -1, 65, -1, -1, 93,
1900 -1, 95, 96, 72, -1, 99, -1, 76, 102, 103,
1901 104, 105, -1, 82, 108, 109, 85, 86, -1, -1,
1902 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
1903 -1, -1, -1, 102, 103, 104, 105, -1, 1, 108,
1904 109, -1, -1, -1, -1, 612, 613, -1, -1, -1,
1905 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1906 -1, 628, -1, -1, -1, -1, -1, -1, -1, -1,
1907 -1, -1, -1, -1, -1, -1, -1, -1, 612, 613,
1908 -1, 44, 45, 46, 47, 48, 49, 50, 51, -1,
1909 -1, 54, -1, -1, 628, 58, 59, -1, -1, 62,
1910 -1, -1, 65, 66, 67, 68, 1, 70, 71, 72,
1911 73, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1912 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1913 93, -1, 95, 96, -1, -1, 99, -1, -1, 102,
1914 103, 104, 105, -1, -1, 108, 109, -1, -1, 44,
1915 45, 46, -1, 48, 49, 50, 51, -1, -1, 54,
1916 -1, -1, -1, 58, 59, -1, -1, -1, -1, -1,
1917 65, 66, 67, 68, 1, 70, 71, 72, 73, -1,
1918 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1919 85, 86, -1, -1, -1, -1, -1, -1, 93, -1,
1920 95, 96, -1, -1, 99, -1, -1, 102, 103, 104,
1921 105, -1, -1, 108, 109, -1, -1, 44, 45, 46,
1922 -1, 48, 49, 50, 51, -1, -1, 54, -1, -1,
1923 -1, 58, 59, -1, -1, -1, -1, -1, 65, 66,
1924 67, 68, 1, 70, 71, 72, 73, -1, -1, 76,
1925 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1926 -1, -1, -1, -1, -1, -1, 93, -1, 95, -1,
1927 -1, -1, 99, -1, -1, 102, 103, 104, 105, -1,
1928 -1, 108, 109, -1, -1, 44, 45, 46, -1, 48,
1929 49, 50, 51, -1, -1, 54, -1, -1, -1, 58,
1930 59, -1, -1, -1, -1, -1, 65, 66, 1, 68,
1931 -1, 70, 71, 72, 73, -1, -1, 76, -1, -1,
1932 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1933 -1, -1, -1, -1, 93, -1, 95, -1, -1, -1,
1934 99, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1935 109, 44, 45, 46, -1, 48, 49, 50, 51, -1,
1936 -1, 54, -1, -1, -1, 58, 59, -1, -1, -1,
1937 -1, -1, 65, 66, -1, 68, -1, 70, 71, 72,
1938 73, -1, 1, 76, 3, 4, -1, -1, -1, 82,
1939 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1940 93, -1, 95, -1, -1, -1, 99, -1, -1, 102,
1941 103, 104, 105, -1, -1, 108, 109, -1, -1, -1,
1942 -1, -1, -1, -1, -1, -1, 45, 46, -1, -1,
1943 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
1944 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
1945 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1946 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1947 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
1948 99, -1, 50, 102, 103, 104, 105, -1, -1, 108,
1949 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
1950 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
1951 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1952 88, 89, 90, -1, -1, 93, -1, -1, -1, -1,
1953 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
1954 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
1955 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
1956 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
1957 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1958 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1959 93, -1, -1, 45, 46, 98, -1, -1, 50, 102,
1960 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
1961 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
1962 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1963 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1964 -1, 93, 94, -1, -1, -1, -1, -1, -1, -1,
1965 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
1966 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
1967 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
1968 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
1969 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1970 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
1971 46, -1, 99, -1, 50, 102, 103, 104, 105, -1,
1972 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
1973 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
1974 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1975 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1976 -1, -1, 98, -1, -1, -1, 102, 103, 104, 105,
1977 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
1978 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
1979 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
1980 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1981 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1982 -1, -1, 93, 94, -1, 45, 46, -1, -1, -1,
1983 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
1984 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
1985 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1986 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1987 90, -1, -1, 93, -1, -1, -1, -1, 98, -1,
1988 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1989 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
1990 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
1991 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1992 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1993 85, 86, -1, -1, 89, 90, -1, -1, 93, 94,
1994 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
1995 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
1996 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
1997 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1998 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1999 94, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2000 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2001 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2002 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2003 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2004 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2005 89, 90, -1, -1, 93, 94, -1, 45, 46, -1,
2006 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2007 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2008 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2009 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2010 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2011 -1, 99, -1, -1, 102, 103, 104, 105, -1, -1,
2012 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2013 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2014 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2015 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2016 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2017 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2018 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2019 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2020 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2021 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2022 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2023 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2024 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2025 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2026 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2027 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2028 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2029 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2030 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2031 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2032 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2033 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2034 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2035 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2036 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2037 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2038 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2039 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2040 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2041 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2042 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2043 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2044 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2045 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2046 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2047 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2048 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2049 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2050 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2051 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2052 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2053 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2054 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2055 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2056 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2057 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2058 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2059 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2060 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2061 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2062 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2063 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2064 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2065 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2066 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2067 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2068 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2069 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2070 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2071 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2072 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2073 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2074 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2075 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2076 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2077 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2078 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2079 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2080 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2081 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2082 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2083 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2084 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2085 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2086 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2087 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2088 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2089 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2090 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2091 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2092 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2093 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2094 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2095 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2096 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2097 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2098 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2099 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2100 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2101 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2102 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2103 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2104 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2105 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2106 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2107 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2108 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2109 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2110 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2111 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2112 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2113 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2114 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2115 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2116 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2117 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2118 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2119 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2120 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2121 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2122 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2123 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2124 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2125 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2126 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2127 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2128 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2129 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2130 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2131 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2132 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2133 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2134 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2135 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2136 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2137 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2138 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2139 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2140 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2141 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2142 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2143 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2144 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2145 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2146 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2147 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2148 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2149 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2150 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2151 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2152 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2153 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2154 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2155 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2156 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2157 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2158 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2159 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2160 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2161 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2162 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2163 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2164 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2165 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2166 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2167 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2168 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2169 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2170 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2171 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2172 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2173 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2174 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2175 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2176 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2177 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2178 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2179 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2180 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2181 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2182 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2183 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2184 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2185 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2186 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2187 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2188 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2189 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2190 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2191 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2192 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2193 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2194 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2195 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2196 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2197 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2198 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2199 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2200 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2201 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2202 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2203 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2204 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2205 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2206 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2207 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2208 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2209 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2210 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2211 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2212 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2213 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2214 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2215 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2216 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2217 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2218 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2219 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2220 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2221 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2222 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2223 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2224 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2225 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2226 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2227 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2228 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2229 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2230 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2231 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2232 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2233 -1, 50, -1, 1, -1, -1, -1, -1, -1, -1,
2234 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2235 -1, -1, -1, 72, -1, -1, -1, 76, 1, -1,
2236 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2237 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2238 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2239 109, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2240 -1, -1, 45, 46, 72, -1, -1, 50, 76, -1,
2241 -1, 3, 4, -1, 82, -1, 59, 85, 86, -1,
2242 -1, -1, 65, -1, -1, 93, 94, -1, -1, 72,
2243 -1, -1, -1, 76, 102, 103, 104, 105, -1, 82,
2244 108, 109, 85, 86, -1, -1, -1, -1, -1, -1,
2245 93, 94, -1, 45, 46, -1, -1, -1, 50, 102,
2246 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2247 -1, -1, -1, 65, -1, -1, 3, 4, -1, -1,
2248 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2249 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2250 -1, 93, -1, 95, 96, -1, -1, -1, -1, -1,
2251 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2252 -1, -1, -1, 50, -1, -1, -1, 3, 4, -1,
2253 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2254 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2255 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2256 -1, -1, 89, 90, -1, -1, 93, 94, -1, 45,
2257 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2258 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2259 -1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2260 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2261 86, -1, -1, 89, 90, -1, -1, 93, 94, -1,
2262 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2263 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2264 -1, -1, -1, 3, 4, -1, -1, -1, 59, -1,
2265 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2266 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2267 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2268 -1, -1, 93, 94, -1, 45, 46, -1, -1, -1,
2269 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2270 -1, -1, -1, -1, -1, 65, -1, -1, 3, 4,
2271 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2272 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2273 90, -1, -1, 93, 94, -1, -1, -1, -1, -1,
2274 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2275 45, 46, -1, -1, -1, 50, -1, -1, -1, -1,
2276 -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2277 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2278 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2279 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2280 44, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2281 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2282 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2283 -1, 50, 76, -1, -1, -1, -1, -1, 82, -1,
2284 59, 85, 86, -1, -1, -1, 65, -1, -1, 93,
2285 -1, -1, -1, 72, -1, -1, -1, 76, 102, 103,
2286 104, 105, -1, 82, 108, 109, 85, 86, -1, -1,
2287 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2288 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2293 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2294 #line 3 "/usr/lib/bison.simple"
2295 /* This file comes from bison-1.28. */
2297 /* Skeleton output parser for bison,
2298 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2300 This program is free software; you can redistribute it and/or modify
2301 it under the terms of the GNU General Public License as published by
2302 the Free Software Foundation; either version 2, or (at your option)
2305 This program is distributed in the hope that it will be useful,
2306 but WITHOUT ANY WARRANTY; without even the implied warranty of
2307 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2308 GNU General Public License for more details.
2310 You should have received a copy of the GNU General Public License
2311 along with this program; if not, write to the Free Software
2312 Foundation, Inc., 59 Temple Place - Suite 330,
2313 Boston, MA 02111-1307, USA. */
2315 /* As a special exception, when this file is copied by Bison into a
2316 Bison output file, you may use that output file without restriction.
2317 This special exception was added by the Free Software Foundation
2318 in version 1.24 of Bison. */
2320 /* This is the parser code that is written into each bison parser
2321 when the %semantic_parser declaration is not specified in the grammar.
2322 It was written by Richard Stallman by simplifying the hairy parser
2323 used when %semantic_parser is specified. */
2325 #ifndef YYSTACK_USE_ALLOCA
2327 #define YYSTACK_USE_ALLOCA
2328 #else /* alloca not defined */
2330 #define YYSTACK_USE_ALLOCA
2331 #define alloca __builtin_alloca
2332 #else /* not GNU C. */
2333 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2334 #define YYSTACK_USE_ALLOCA
2336 #else /* not sparc */
2337 /* We think this test detects Watcom and Microsoft C. */
2338 /* This used to test MSDOS, but that is a bad idea
2339 since that symbol is in the user namespace. */
2340 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2341 #if 0 /* No need for malloc.h, which pollutes the namespace;
2342 instead, just don't use alloca. */
2345 #else /* not MSDOS, or __TURBOC__ */
2347 /* I don't know what this was needed for, but it pollutes the namespace.
2348 So I turned it off. rms, 2 May 1997. */
2349 /* #include <malloc.h> */
2351 #define YYSTACK_USE_ALLOCA
2352 #else /* not MSDOS, or __TURBOC__, or _AIX */
2354 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2355 and on HPUX 10. Eventually we can turn this on. */
2356 #define YYSTACK_USE_ALLOCA
2357 #define alloca __builtin_alloca
2360 #endif /* not _AIX */
2361 #endif /* not MSDOS, or __TURBOC__ */
2362 #endif /* not sparc */
2363 #endif /* not GNU C */
2364 #endif /* alloca not defined */
2365 #endif /* YYSTACK_USE_ALLOCA not defined */
2367 #ifdef YYSTACK_USE_ALLOCA
2368 #define YYSTACK_ALLOC alloca
2370 #define YYSTACK_ALLOC malloc
2373 /* Note: there must be only one dollar sign in this file.
2374 It is replaced by the list of actions, each action
2375 as one case of the switch. */
2377 #define yyerrok (yyerrstatus = 0)
2378 #define yyclearin (yychar = YYEMPTY)
2381 #define YYACCEPT goto yyacceptlab
2382 #define YYABORT goto yyabortlab
2383 #define YYERROR goto yyerrlab1
2384 /* Like YYERROR except do call yyerror.
2385 This remains here temporarily to ease the
2386 transition to the new meaning of YYERROR, for GCC.
2387 Once GCC version 2 has supplanted version 1, this can go. */
2388 #define YYFAIL goto yyerrlab
2389 #define YYRECOVERING() (!!yyerrstatus)
2390 #define YYBACKUP(token, value) \
2392 if (yychar == YYEMPTY && yylen == 1) \
2393 { yychar = (token), yylval = (value); \
2394 yychar1 = YYTRANSLATE (yychar); \
2399 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2403 #define YYERRCODE 256
2406 #define YYLEX yylex()
2412 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2414 #define YYLEX yylex(&yylval, &yylloc)
2416 #else /* not YYLSP_NEEDED */
2418 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2420 #define YYLEX yylex(&yylval)
2422 #endif /* not YYLSP_NEEDED */
2425 /* If nonreentrant, generate the variables here */
2429 int yychar; /* the lookahead symbol */
2430 YYSTYPE yylval; /* the semantic value of the */
2431 /* lookahead symbol */
2434 YYLTYPE yylloc; /* location data for the lookahead */
2438 int yynerrs; /* number of parse errors so far */
2439 #endif /* not YYPURE */
2442 int yydebug; /* nonzero means print parse trace */
2443 /* Since this is uninitialized, it does not stop multiple parsers
2447 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2450 #define YYINITDEPTH 200
2453 /* YYMAXDEPTH is the maximum size the stacks can grow to
2454 (effective only if the built-in stack extension method is used). */
2461 #define YYMAXDEPTH 10000
2464 /* Define __yy_memcpy. Note that the size argument
2465 should be passed with type unsigned int, because that is what the non-GCC
2466 definitions require. With GCC, __builtin_memcpy takes an arg
2467 of type size_t, but it can handle unsigned int. */
2469 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2470 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2471 #else /* not GNU C or C++ */
2474 /* This is the most reliable way to avoid incompatibilities
2475 in available built-in functions on various systems. */
2477 __yy_memcpy (to, from, count)
2482 register char *f = from;
2483 register char *t = to;
2484 register int i = count;
2490 #else /* __cplusplus */
2492 /* This is the most reliable way to avoid incompatibilities
2493 in available built-in functions on various systems. */
2495 __yy_memcpy (char *to, char *from, unsigned int count)
2497 register char *t = to;
2498 register char *f = from;
2499 register int i = count;
2508 #line 217 "/usr/lib/bison.simple"
2510 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2511 into yyparse. The argument should have type void *.
2512 It should actually point to an object.
2513 Grammar actions can access the variable by casting it
2514 to the proper pointer type. */
2516 #ifdef YYPARSE_PARAM
2518 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2519 #define YYPARSE_PARAM_DECL
2520 #else /* not __cplusplus */
2521 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2522 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2523 #endif /* not __cplusplus */
2524 #else /* not YYPARSE_PARAM */
2525 #define YYPARSE_PARAM_ARG
2526 #define YYPARSE_PARAM_DECL
2527 #endif /* not YYPARSE_PARAM */
2529 /* Prevent warning if -Wstrict-prototypes. */
2531 #ifdef YYPARSE_PARAM
2532 int yyparse (void *);
2539 yyparse(YYPARSE_PARAM_ARG)
2542 register int yystate;
2544 register short *yyssp;
2545 register YYSTYPE *yyvsp;
2546 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2547 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2549 short yyssa[YYINITDEPTH]; /* the state stack */
2550 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2552 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2553 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2556 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2557 YYLTYPE *yyls = yylsa;
2560 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2562 #define YYPOPSTACK (yyvsp--, yyssp--)
2565 int yystacksize = YYINITDEPTH;
2566 int yyfree_stacks = 0;
2577 YYSTYPE yyval; /* the variable used to return */
2578 /* semantic values from the action */
2585 fprintf(stderr, "Starting parse\n");
2591 yychar = YYEMPTY; /* Cause a token to be read. */
2593 /* Initialize stack pointers.
2594 Waste one element of value and location stack
2595 so that they stay on the same level as the state stack.
2596 The wasted elements are never initialized. */
2604 /* Push a new state, which is found in yystate . */
2605 /* In all cases, when you get here, the value and location stacks
2606 have just been pushed. so pushing a state here evens the stacks. */
2611 if (yyssp >= yyss + yystacksize - 1)
2613 /* Give user a chance to reallocate the stack */
2614 /* Use copies of these so that the &'s don't force the real ones into memory. */
2615 YYSTYPE *yyvs1 = yyvs;
2616 short *yyss1 = yyss;
2618 YYLTYPE *yyls1 = yyls;
2621 /* Get the current used size of the three stacks, in elements. */
2622 int size = yyssp - yyss + 1;
2625 /* Each stack pointer address is followed by the size of
2626 the data in use in that stack, in bytes. */
2628 /* This used to be a conditional around just the two extra args,
2629 but that might be undefined if yyoverflow is a macro. */
2630 yyoverflow("parser stack overflow",
2631 &yyss1, size * sizeof (*yyssp),
2632 &yyvs1, size * sizeof (*yyvsp),
2633 &yyls1, size * sizeof (*yylsp),
2636 yyoverflow("parser stack overflow",
2637 &yyss1, size * sizeof (*yyssp),
2638 &yyvs1, size * sizeof (*yyvsp),
2642 yyss = yyss1; yyvs = yyvs1;
2646 #else /* no yyoverflow */
2647 /* Extend the stack our own way. */
2648 if (yystacksize >= YYMAXDEPTH)
2650 yyerror("parser stack overflow");
2662 if (yystacksize > YYMAXDEPTH)
2663 yystacksize = YYMAXDEPTH;
2664 #ifndef YYSTACK_USE_ALLOCA
2667 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2668 __yy_memcpy ((char *)yyss, (char *)yyss1,
2669 size * (unsigned int) sizeof (*yyssp));
2670 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2671 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2672 size * (unsigned int) sizeof (*yyvsp));
2674 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2675 __yy_memcpy ((char *)yyls, (char *)yyls1,
2676 size * (unsigned int) sizeof (*yylsp));
2678 #endif /* no yyoverflow */
2680 yyssp = yyss + size - 1;
2681 yyvsp = yyvs + size - 1;
2683 yylsp = yyls + size - 1;
2688 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2691 if (yyssp >= yyss + yystacksize - 1)
2697 fprintf(stderr, "Entering state %d\n", yystate);
2703 /* Do appropriate processing given the current state. */
2704 /* Read a lookahead token if we need one and don't already have one. */
2707 /* First try to decide what to do without reference to lookahead token. */
2709 yyn = yypact[yystate];
2713 /* Not known => get a lookahead token if don't already have one. */
2715 /* yychar is either YYEMPTY or YYEOF
2716 or a valid token in external form. */
2718 if (yychar == YYEMPTY)
2722 fprintf(stderr, "Reading a token: ");
2727 /* Convert token to internal form (in yychar1) for indexing tables with */
2729 if (yychar <= 0) /* This means end of input. */
2732 yychar = YYEOF; /* Don't call YYLEX any more */
2736 fprintf(stderr, "Now at end of input.\n");
2741 yychar1 = YYTRANSLATE(yychar);
2746 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2747 /* Give the individual parser a way to print the precise meaning
2748 of a token, for further debugging info. */
2750 YYPRINT (stderr, yychar, yylval);
2752 fprintf (stderr, ")\n");
2758 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2763 /* yyn is what to do for this token type in this state.
2764 Negative => reduce, -yyn is rule number.
2765 Positive => shift, yyn is new state.
2766 New state is final state => don't bother to shift,
2767 just return success.
2768 0, or most negative number => error. */
2783 /* Shift the lookahead token. */
2787 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2790 /* Discard the token being shifted unless it is eof. */
2791 if (yychar != YYEOF)
2799 /* count tokens shifted since error; after three, turn off error status. */
2800 if (yyerrstatus) yyerrstatus--;
2805 /* Do the default action for the current state. */
2808 yyn = yydefact[yystate];
2812 /* Do a reduction. yyn is the number of a rule to reduce with. */
2816 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2823 fprintf (stderr, "Reducing via rule %d (line %d), ",
2826 /* Print the symbols being reduced, and their result. */
2827 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2828 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2829 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2837 #line 502 "./parse.y"
2841 #line 546 "./parse.y"
2843 yyval.node = build_java_array_type (yyvsp[-2].node, -1);
2844 CLASS_LOADED_P (yyval.node) = 1;
2848 #line 551 "./parse.y"
2849 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2852 #line 553 "./parse.y"
2853 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2856 #line 555 "./parse.y"
2857 {RULE ("']' expected"); RECOVER;;
2860 #line 557 "./parse.y"
2861 {RULE ("']' expected"); RECOVER;;
2864 #line 572 "./parse.y"
2865 { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
2868 #line 581 "./parse.y"
2869 {yyval.node = NULL;;
2872 #line 593 "./parse.y"
2878 #line 597 "./parse.y"
2884 #line 609 "./parse.y"
2886 ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node);
2887 package_list = tree_cons (ctxp->package, NULL, package_list);
2891 #line 614 "./parse.y"
2892 {yyerror ("Missing name"); RECOVER;;
2895 #line 616 "./parse.y"
2896 {yyerror ("';' expected"); RECOVER;;
2899 #line 626 "./parse.y"
2901 tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name;
2902 int i = IDENTIFIER_LENGTH (name)-1;
2903 const char *last = &IDENTIFIER_POINTER (name)[i];
2904 while (last != IDENTIFIER_POINTER (name))
2906 if (last [0] == '.')
2910 last_name = get_identifier (++last);
2911 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name))
2913 tree err = find_name_in_single_imports (last_name);
2914 if (err && err != name)
2916 (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'",
2917 IDENTIFIER_POINTER (name),
2918 IDENTIFIER_POINTER (err));
2920 REGISTER_IMPORT (yyvsp[-1].node, last_name)
2923 REGISTER_IMPORT (yyvsp[-1].node, last_name);
2927 #line 652 "./parse.y"
2928 {yyerror ("Missing name"); RECOVER;;
2931 #line 654 "./parse.y"
2932 {yyerror ("';' expected"); RECOVER;;
2935 #line 659 "./parse.y"
2937 tree name = EXPR_WFL_NODE (yyvsp[-3].node);
2938 /* Don't import java.lang.* twice. */
2939 if (name != java_lang_id)
2941 tree node = build_tree_list (yyvsp[-3].node, NULL_TREE);
2942 read_import_dir (yyvsp[-3].node);
2943 TREE_CHAIN (node) = ctxp->import_demand_list;
2944 ctxp->import_demand_list = node;
2949 #line 671 "./parse.y"
2950 {yyerror ("'*' expected"); RECOVER;;
2953 #line 673 "./parse.y"
2954 {yyerror ("';' expected"); RECOVER;;
2957 #line 678 "./parse.y"
2959 maybe_generate_finit ();
2960 maybe_generate_clinit ();
2961 yyval.node = yyvsp[0].node;
2965 #line 684 "./parse.y"
2967 maybe_generate_clinit ();
2968 yyval.node = yyvsp[0].node;
2972 #line 689 "./parse.y"
2973 { yyval.node = NULL; ;
2976 #line 691 "./parse.y"
2979 yyerror ("Class or interface declaration expected");
2983 #line 702 "./parse.y"
2985 yyval.value = (1 << yyvsp[0].value);
2989 #line 706 "./parse.y"
2991 int acc = (1 << yyvsp[0].value);
2992 if (yyval.value & acc)
2994 (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice",
2995 java_accstring_lookup (acc));
3003 #line 722 "./parse.y"
3004 { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3007 #line 724 "./parse.y"
3009 yyval.node = yyvsp[0].node;
3013 #line 728 "./parse.y"
3014 { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3017 #line 730 "./parse.y"
3019 yyval.node = yyvsp[0].node;
3023 #line 734 "./parse.y"
3024 {yyerror ("Missing class name"); RECOVER;;
3027 #line 736 "./parse.y"
3028 {yyerror ("Missing class name"); RECOVER;;
3031 #line 738 "./parse.y"
3033 if (!ctxp->class_err) yyerror ("'{' expected");
3038 #line 743 "./parse.y"
3039 {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;;
3042 #line 747 "./parse.y"
3043 { yyval.node = NULL; ;
3046 #line 749 "./parse.y"
3047 { yyval.node = yyvsp[0].node; ;
3050 #line 751 "./parse.y"
3051 {yyerror ("'{' expected"); ctxp->class_err=1;;
3054 #line 753 "./parse.y"
3055 {yyerror ("Missing super class name"); ctxp->class_err=1;;
3058 #line 757 "./parse.y"
3059 { yyval.node = NULL_TREE; ;
3062 #line 759 "./parse.y"
3063 { yyval.node = yyvsp[0].node; ;
3066 #line 761 "./parse.y"
3069 yyerror ("Missing interface name");
3073 #line 769 "./parse.y"
3075 ctxp->interface_number = 1;
3076 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3080 #line 774 "./parse.y"
3082 ctxp->interface_number++;
3083 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3087 #line 779 "./parse.y"
3088 {yyerror ("Missing interface name"); RECOVER;;
3091 #line 784 "./parse.y"
3093 /* Store the location of the `}' when doing xrefs */
3095 DECL_END_SOURCE_LINE (ctxp->current_parsed_class) =
3096 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3097 yyval.node = ctxp->current_parsed_class;
3101 #line 792 "./parse.y"
3103 /* Store the location of the `}' when doing xrefs */
3105 DECL_END_SOURCE_LINE (ctxp->current_parsed_class) =
3106 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3107 yyval.node = ctxp->current_parsed_class;
3111 #line 811 "./parse.y"
3112 { yyval.node = parse_jdk1_1_error ("instance initializer"); ;
3115 #line 817 "./parse.y"
3116 { yyval.node = yyvsp[-1].node; ;
3119 #line 820 "./parse.y"
3120 { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ;
3123 #line 822 "./parse.y"
3124 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
3127 #line 828 "./parse.y"
3128 { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ;
3131 #line 830 "./parse.y"
3134 ("Illegal modifier `%s' for field declaration",
3135 yyvsp[-3].value, FIELD_MODIFIERS);
3136 check_modifiers_consistency (yyvsp[-3].value);
3137 register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node);
3141 #line 843 "./parse.y"
3142 { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ;
3145 #line 845 "./parse.y"
3146 {yyerror ("Missing term"); RECOVER;;
3149 #line 850 "./parse.y"
3150 { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ;
3153 #line 852 "./parse.y"
3155 if (java_error_count)
3156 yyvsp[0].node = NULL_TREE;
3157 yyval.node = build_tree_list
3158 (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node));
3162 #line 859 "./parse.y"
3164 yyerror ("Missing variable initializer");
3165 yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
3170 #line 865 "./parse.y"
3172 yyerror ("';' expected");
3173 yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
3178 #line 875 "./parse.y"
3179 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
3182 #line 877 "./parse.y"
3183 {yyerror ("Invalid declaration"); DRECOVER(vdi);;
3186 #line 879 "./parse.y"
3187 {yyerror ("']' expected"); DRECOVER(vdi);;
3190 #line 881 "./parse.y"
3191 {yyerror ("Unbalanced ']'"); DRECOVER(vdi);;
3194 #line 892 "./parse.y"
3196 current_function_decl = yyvsp[0].node;
3197 source_start_java_method (current_function_decl);
3201 #line 897 "./parse.y"
3202 { finish_method_declaration (yyvsp[0].node); ;
3205 #line 899 "./parse.y"
3206 {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;
3209 #line 904 "./parse.y"
3210 { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3213 #line 906 "./parse.y"
3214 { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
3217 #line 908 "./parse.y"
3218 { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3221 #line 910 "./parse.y"
3222 { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
3225 #line 912 "./parse.y"
3227 yyerror ("Invalid method declaration, method name required");
3232 #line 917 "./parse.y"
3236 #line 919 "./parse.y"
3237 {yyerror ("Identifier expected"); RECOVER;;
3240 #line 921 "./parse.y"
3241 {yyerror ("Identifier expected"); RECOVER;;
3244 #line 923 "./parse.y"
3246 yyerror ("Invalid method declaration, return type required");
3251 #line 931 "./parse.y"
3252 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3255 #line 933 "./parse.y"
3256 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3259 #line 935 "./parse.y"
3261 EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location;
3262 TREE_PURPOSE (yyvsp[-2].node) =
3263 build_unresolved_array_type (TREE_PURPOSE (yyvsp[-2].node));
3264 parse_warning_context
3266 "Discouraged form of returned type specification");
3270 #line 944 "./parse.y"
3271 {yyerror ("')' expected"); DRECOVER(method_declarator);;
3274 #line 946 "./parse.y"
3275 {yyerror ("']' expected"); RECOVER;;
3278 #line 951 "./parse.y"
3280 ctxp->formal_parameter_number = 1;
3284 #line 955 "./parse.y"
3286 ctxp->formal_parameter_number += 1;
3287 yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
3291 #line 960 "./parse.y"
3292 {yyerror ("Missing formal parameter term"); RECOVER;;
3295 #line 965 "./parse.y"
3297 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3301 #line 969 "./parse.y"
3303 parse_jdk1_1_error ("final parameters");
3304 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3308 #line 974 "./parse.y"
3310 yyerror ("Missing identifier"); RECOVER;
3311 yyval.node = NULL_TREE;
3315 #line 979 "./parse.y"
3317 yyerror ("Missing identifier"); RECOVER;
3318 yyval.node = NULL_TREE;
3322 #line 987 "./parse.y"
3324 check_modifiers ("Illegal modifier `%s'. Only `final' was expected here",
3325 yyvsp[0].value, ACC_FINAL);
3326 if (yyvsp[0].value != ACC_FINAL)
3327 MODIFIER_WFL (FINAL_TK) = build_wfl_node (NULL_TREE);
3331 #line 996 "./parse.y"
3332 { yyval.node = NULL_TREE; ;
3335 #line 998 "./parse.y"
3336 { yyval.node = yyvsp[0].node; ;
3339 #line 1000 "./parse.y"
3340 {yyerror ("Missing class type term"); RECOVER;;
3343 #line 1005 "./parse.y"
3344 { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ;
3347 #line 1007 "./parse.y"
3348 { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ;
3351 #line 1009 "./parse.y"
3352 {yyerror ("Missing class type term"); RECOVER;;
3355 #line 1016 "./parse.y"
3356 { yyval.node = NULL_TREE; ;
3359 #line 1022 "./parse.y"
3361 TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized;
3362 ctxp->static_initialized = yyvsp[0].node;
3366 #line 1027 "./parse.y"
3368 TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized;
3369 ctxp->static_initialized = yyvsp[-1].node;
3373 #line 1035 "./parse.y"
3375 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
3379 #line 1043 "./parse.y"
3381 current_function_decl = yyvsp[0].node;
3382 source_start_java_method (current_function_decl);
3386 #line 1048 "./parse.y"
3387 { finish_method_declaration (yyvsp[0].node); ;
3390 #line 1053 "./parse.y"
3391 { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3394 #line 1055 "./parse.y"
3395 { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3398 #line 1060 "./parse.y"
3399 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3402 #line 1062 "./parse.y"
3403 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3406 #line 1070 "./parse.y"
3408 BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node;
3409 yyval.node = yyvsp[0].node;
3413 #line 1075 "./parse.y"
3414 { yyval.node = yyvsp[0].node; ;
3417 #line 1077 "./parse.y"
3418 { yyval.node = yyvsp[0].node; ;
3421 #line 1079 "./parse.y"
3422 { yyval.node = yyvsp[0].node; ;
3425 #line 1089 "./parse.y"
3427 yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE);
3428 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node);
3429 yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
3433 #line 1095 "./parse.y"
3435 yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node);
3436 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node);
3437 yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
3441 #line 1103 "./parse.y"
3442 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3445 #line 1105 "./parse.y"
3446 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3449 #line 1110 "./parse.y"
3451 tree wfl = build_wfl_node (this_identifier_node);
3452 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3457 #line 1116 "./parse.y"
3459 tree wfl = build_wfl_node (super_identifier_node);
3460 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3465 #line 1127 "./parse.y"
3466 { create_interface (0, yyvsp[0].node, NULL_TREE); ;
3469 #line 1129 "./parse.y"
3471 yyval.node = yyvsp[0].node;
3475 #line 1133 "./parse.y"
3476 { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ;
3479 #line 1135 "./parse.y"
3481 yyval.node = yyvsp[0].node;
3485 #line 1139 "./parse.y"
3486 { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ;
3489 #line 1141 "./parse.y"
3491 yyval.node = yyvsp[0].node;
3495 #line 1145 "./parse.y"
3496 { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ;
3499 #line 1147 "./parse.y"
3501 yyval.node = yyvsp[0].node;
3505 #line 1151 "./parse.y"
3506 {yyerror ("'{' expected"); RECOVER;;
3509 #line 1153 "./parse.y"
3510 {yyerror ("'{' expected"); RECOVER;;
3513 #line 1158 "./parse.y"
3515 ctxp->interface_number = 1;
3516 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3520 #line 1163 "./parse.y"
3522 ctxp->interface_number++;
3523 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3527 #line 1168 "./parse.y"
3528 {yyerror ("Invalid interface type"); RECOVER;;
3531 #line 1170 "./parse.y"
3532 {yyerror ("Missing term"); RECOVER;;
3535 #line 1175 "./parse.y"
3536 { yyval.node = NULL_TREE; ;
3539 #line 1177 "./parse.y"
3540 { yyval.node = NULL_TREE; ;
3543 #line 1189 "./parse.y"
3544 { yyval.node = parse_jdk1_1_error ("inner class declaration"); ;
3547 #line 1191 "./parse.y"
3548 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
3551 #line 1200 "./parse.y"
3553 check_abstract_method_header (yyvsp[-1].node);
3554 current_function_decl = NULL_TREE; /* FIXME ? */
3558 #line 1205 "./parse.y"
3559 {yyerror ("';' expected"); RECOVER;;
3562 #line 1211 "./parse.y"
3563 { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ;
3566 #line 1213 "./parse.y"
3567 { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3570 #line 1215 "./parse.y"
3571 { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ;
3574 #line 1220 "./parse.y"
3576 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node),
3577 yyvsp[0].node, NULL_TREE);
3581 #line 1225 "./parse.y"
3583 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node);
3587 #line 1229 "./parse.y"
3588 {yyerror ("Missing term"); RECOVER;;
3591 #line 1235 "./parse.y"
3593 /* Store the location of the `}' when doing xrefs */
3594 if (current_function_decl && flag_emit_xref)
3595 DECL_END_SOURCE_LINE (current_function_decl) =
3596 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3597 yyval.node = empty_stmt_node;
3601 #line 1243 "./parse.y"
3602 { yyval.node = yyvsp[0].node; ;
3605 #line 1248 "./parse.y"
3609 #line 1253 "./parse.y"
3611 maybe_absorb_scoping_blocks ();
3612 /* Store the location of the `}' when doing xrefs */
3613 if (current_function_decl && flag_emit_xref)
3614 DECL_END_SOURCE_LINE (current_function_decl) =
3615 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3616 yyval.node = exit_block ();
3620 #line 1271 "./parse.y"
3621 { java_method_add_stmt (current_function_decl, yyvsp[0].node); ;
3624 #line 1273 "./parse.y"
3625 { parse_jdk1_1_error ("inner class declaration"); ;
3628 #line 1282 "./parse.y"
3629 { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ;
3632 #line 1284 "./parse.y"
3633 { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ;
3636 #line 1294 "./parse.y"
3637 { yyval.node = exit_block (); ;
3640 #line 1303 "./parse.y"
3641 { yyval.node = exit_block (); ;
3644 #line 1322 "./parse.y"
3645 { yyval.node = empty_stmt_node; ;
3648 #line 1327 "./parse.y"
3650 yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node),
3651 EXPR_WFL_NODE (yyvsp[-1].node));
3653 push_labeled_block (yyval.node);
3654 PUSH_LABELED_BLOCK (yyval.node);
3658 #line 1338 "./parse.y"
3659 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3662 #line 1340 "./parse.y"
3663 {yyerror ("':' expected"); RECOVER;;
3666 #line 1345 "./parse.y"
3667 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3670 #line 1352 "./parse.y"
3672 /* We have a statement. Generate a WFL around it so
3674 yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0);
3675 /* We know we have a statement, so set the debug
3676 info to be eventually generate here. */
3677 yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node);
3681 #line 1361 "./parse.y"
3683 if (ctxp->prevent_ese != lineno)
3684 yyerror ("Invalid expression statement");
3685 DRECOVER (expr_stmt);
3689 #line 1367 "./parse.y"
3691 if (ctxp->prevent_ese != lineno)
3692 yyerror ("Invalid expression statement");
3693 DRECOVER (expr_stmt);
3697 #line 1373 "./parse.y"
3699 if (ctxp->prevent_ese != lineno)
3700 yyerror ("Invalid expression statement");
3701 DRECOVER (expr_stmt);
3705 #line 1379 "./parse.y"
3706 {yyerror ("')' expected"); RECOVER;;
3709 #line 1381 "./parse.y"
3711 parse_ctor_invocation_error ();
3716 #line 1386 "./parse.y"
3717 {yyerror ("')' expected"); RECOVER;;
3720 #line 1388 "./parse.y"
3722 parse_ctor_invocation_error ();
3727 #line 1393 "./parse.y"
3728 {yyerror ("'(' expected"); RECOVER;;
3731 #line 1395 "./parse.y"
3732 {yyerror ("')' expected"); RECOVER;;
3735 #line 1397 "./parse.y"
3736 {yyerror ("')' expected"); RECOVER;;
3739 #line 1399 "./parse.y"
3740 {yyerror ("';' expected"); RECOVER;;
3743 #line 1401 "./parse.y"
3744 {yyerror ("';' expected"); RECOVER;;
3747 #line 1416 "./parse.y"
3749 yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node,
3750 yyvsp[0].node, NULL_TREE);
3754 #line 1421 "./parse.y"
3755 {yyerror ("'(' expected"); RECOVER;;
3758 #line 1423 "./parse.y"
3759 {yyerror ("Missing term"); RECOVER;;
3762 #line 1425 "./parse.y"
3763 {yyerror ("')' expected"); RECOVER;;
3766 #line 1430 "./parse.y"
3767 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3770 #line 1435 "./parse.y"
3771 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3774 #line 1440 "./parse.y"
3780 #line 1444 "./parse.y"
3782 /* Make into "proper list" of COMPOUND_EXPRs.
3783 I.e. make the last statment also have its own
3785 maybe_absorb_scoping_blocks ();
3786 TREE_OPERAND (yyvsp[-2].node, 1) = exit_block ();
3787 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-2].node), yyvsp[-2].node);
3791 #line 1456 "./parse.y"
3793 yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE);
3794 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3798 #line 1461 "./parse.y"
3799 {yyerror ("'(' expected"); RECOVER;;
3802 #line 1463 "./parse.y"
3803 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;
3806 #line 1465 "./parse.y"
3807 {yyerror ("'{' expected"); RECOVER;;
3810 #line 1473 "./parse.y"
3811 { yyval.node = NULL_TREE; ;
3814 #line 1475 "./parse.y"
3815 { yyval.node = NULL_TREE; ;
3818 #line 1477 "./parse.y"
3819 { yyval.node = NULL_TREE; ;
3822 #line 1479 "./parse.y"
3823 { yyval.node = NULL_TREE; ;
3826 #line 1498 "./parse.y"
3828 tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node);
3829 EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location;
3830 java_method_add_stmt (current_function_decl, lab);
3834 #line 1504 "./parse.y"
3836 tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
3837 EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location;
3838 java_method_add_stmt (current_function_decl, lab);
3842 #line 1510 "./parse.y"
3843 {yyerror ("Missing or invalid constant expression"); RECOVER;;
3846 #line 1512 "./parse.y"
3847 {yyerror ("':' expected"); RECOVER;;
3850 #line 1514 "./parse.y"
3851 {yyerror ("':' expected"); RECOVER;;
3854 #line 1519 "./parse.y"
3856 tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
3857 yyval.node = build_new_loop (body);
3861 #line 1527 "./parse.y"
3862 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3865 #line 1529 "./parse.y"
3866 {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;
3869 #line 1531 "./parse.y"
3870 {yyerror ("Missing term and ')' expected"); RECOVER;;
3873 #line 1533 "./parse.y"
3874 {yyerror ("')' expected"); RECOVER;;
3877 #line 1538 "./parse.y"
3878 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3881 #line 1543 "./parse.y"
3883 tree body = build_loop_body (0, NULL_TREE, 1);
3884 yyval.node = build_new_loop (body);
3888 #line 1552 "./parse.y"
3889 { yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ;
3892 #line 1557 "./parse.y"
3893 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3896 #line 1559 "./parse.y"
3898 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3899 /* We have not condition, so we get rid of the EXIT_EXPR */
3900 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
3905 #line 1566 "./parse.y"
3906 {yyerror ("Invalid control expression"); RECOVER;;
3909 #line 1568 "./parse.y"
3910 {yyerror ("Invalid update expression"); RECOVER;;
3913 #line 1570 "./parse.y"
3914 {yyerror ("Invalid update expression"); RECOVER;;
3917 #line 1575 "./parse.y"
3918 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
3921 #line 1577 "./parse.y"
3923 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3924 /* We have not condition, so we get rid of the EXIT_EXPR */
3925 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
3930 #line 1587 "./parse.y"
3932 /* This scope defined for local variable that may be
3933 defined within the scope of the for loop */
3938 #line 1593 "./parse.y"
3939 {yyerror ("'(' expected"); DRECOVER(for_1);;
3942 #line 1595 "./parse.y"
3943 {yyerror ("Invalid init statement"); RECOVER;;
3946 #line 1600 "./parse.y"
3948 /* We now declare the loop body. The loop is
3949 declared as a for loop. */
3950 tree body = build_loop_body (0, NULL_TREE, 0);
3951 yyval.node = build_new_loop (body);
3952 IS_FOR_LOOP_P (yyval.node) = 1;
3953 /* The loop is added to the current block the for
3954 statement is defined within */
3955 java_method_add_stmt (current_function_decl, yyval.node);
3959 #line 1612 "./parse.y"
3960 { yyval.node = empty_stmt_node; ;
3963 #line 1614 "./parse.y"
3965 /* Init statement recorded within the previously
3966 defined block scope */
3967 yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node);
3971 #line 1620 "./parse.y"
3973 /* Local variable are recorded within the previously
3974 defined block scope */
3975 yyval.node = NULL_TREE;
3979 #line 1626 "./parse.y"
3980 {yyerror ("';' expected"); DRECOVER(for_init_1);;
3983 #line 1630 "./parse.y"
3984 {yyval.node = empty_stmt_node;;
3987 #line 1632 "./parse.y"
3988 { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ;
3991 #line 1637 "./parse.y"
3992 { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ;
3995 #line 1639 "./parse.y"
3996 { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ;
3999 #line 1641 "./parse.y"
4000 {yyerror ("Missing term"); RECOVER;;
4003 #line 1646 "./parse.y"
4004 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ;
4007 #line 1648 "./parse.y"
4008 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ;
4011 #line 1650 "./parse.y"
4012 {yyerror ("Missing term"); RECOVER;;
4015 #line 1652 "./parse.y"
4016 {yyerror ("';' expected"); RECOVER;;
4019 #line 1657 "./parse.y"
4020 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ;
4023 #line 1659 "./parse.y"
4024 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ;
4027 #line 1661 "./parse.y"
4028 {yyerror ("Missing term"); RECOVER;;
4031 #line 1663 "./parse.y"
4032 {yyerror ("';' expected"); RECOVER;;
4035 #line 1668 "./parse.y"
4036 { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ;
4039 #line 1670 "./parse.y"
4040 { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ;
4043 #line 1672 "./parse.y"
4044 {yyerror ("Missing term"); RECOVER;;
4047 #line 1674 "./parse.y"
4048 {yyerror ("';' expected"); RECOVER;;
4051 #line 1679 "./parse.y"
4053 yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node);
4054 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
4058 #line 1684 "./parse.y"
4059 {yyerror ("Missing term"); RECOVER;;
4062 #line 1686 "./parse.y"
4063 {yyerror ("';' expected"); RECOVER;;
4066 #line 1691 "./parse.y"
4068 yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
4069 EXPR_WFL_LINECOL (yyval.node) =
4070 EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));
4074 #line 1697 "./parse.y"
4075 {yyerror ("'{' expected"); RECOVER;;
4078 #line 1699 "./parse.y"
4079 {yyerror ("'(' expected"); RECOVER;;
4082 #line 1701 "./parse.y"
4083 {yyerror ("Missing term"); RECOVER;;
4086 #line 1703 "./parse.y"
4087 {yyerror ("Missing term"); RECOVER;;
4090 #line 1708 "./parse.y"
4093 "Illegal modifier `%s'. Only `synchronized' was expected here",
4094 yyvsp[0].value, ACC_SYNCHRONIZED);
4095 if (yyvsp[0].value != ACC_SYNCHRONIZED)
4096 MODIFIER_WFL (SYNCHRONIZED_TK) =
4097 build_wfl_node (NULL_TREE);
4101 #line 1720 "./parse.y"
4102 { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
4105 #line 1722 "./parse.y"
4106 { yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
4109 #line 1724 "./parse.y"
4110 { yyval.node = build_try_finally_statement
4111 (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location,
4112 yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node);
4116 #line 1729 "./parse.y"
4117 {yyerror ("'{' expected"); DRECOVER (try_statement);;
4120 #line 1735 "./parse.y"
4122 TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node;
4123 yyval.node = yyvsp[0].node;
4127 #line 1743 "./parse.y"
4129 java_method_add_stmt (current_function_decl, yyvsp[0].node);
4131 yyval.node = yyvsp[-1].node;
4135 #line 1751 "./parse.y"
4137 /* We add a block to define a scope for
4138 formal_parameter (CCBP). The formal parameter is
4139 declared initialized by the appropriate function
4141 tree ccpb = enter_block ();
4142 tree init = build_assignment (ASSIGN_TK, yyvsp[-2].operator.location,
4143 TREE_PURPOSE (yyvsp[-1].node),
4144 soft_exceptioninfo_call_node);
4145 declare_local_variables (0, TREE_VALUE (yyvsp[-1].node),
4146 build_tree_list (TREE_PURPOSE (yyvsp[-1].node),
4148 yyval.node = build1 (CATCH_EXPR, NULL_TREE, ccpb);
4149 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4153 #line 1767 "./parse.y"
4154 {yyerror ("'(' expected"); RECOVER; yyval.node = NULL_TREE;;
4157 #line 1769 "./parse.y"
4159 yyerror ("Missing term or ')' expected");
4160 RECOVER; yyval.node = NULL_TREE;
4164 #line 1774 "./parse.y"
4165 {yyerror ("Missing term"); RECOVER; yyval.node = NULL_TREE;;
4168 #line 1779 "./parse.y"
4169 { yyval.node = yyvsp[0].node; ;
4172 #line 1781 "./parse.y"
4173 {yyerror ("'{' expected"); RECOVER; ;
4176 #line 1793 "./parse.y"
4177 { yyval.node = build_this (yyvsp[0].operator.location); ;
4180 #line 1795 "./parse.y"
4181 {yyval.node = yyvsp[-1].node;;
4184 #line 1804 "./parse.y"
4185 { yyval.node = parse_jdk1_1_error ("named class literals"); ;
4188 #line 1806 "./parse.y"
4189 { yyval.node = build_class_ref (yyvsp[-2].node); ;
4192 #line 1808 "./parse.y"
4193 { yyval.node = build_class_ref (void_type_node); ;
4196 #line 1813 "./parse.y"
4197 { yyval.node = parse_jdk1_1_error ("class literals"); ;
4200 #line 1815 "./parse.y"
4201 {yyerror ("')' expected"); RECOVER;;
4204 #line 1817 "./parse.y"
4205 {yyerror ("'class' or 'this' expected" ); RECOVER;;
4208 #line 1819 "./parse.y"
4209 {yyerror ("'class' expected" ); RECOVER;;
4212 #line 1821 "./parse.y"
4213 {yyerror ("'class' expected" ); RECOVER;;
4216 #line 1826 "./parse.y"
4217 { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4220 #line 1828 "./parse.y"
4221 { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ;
4224 #line 1833 "./parse.y"
4225 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4228 #line 1835 "./parse.y"
4229 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4232 #line 1844 "./parse.y"
4233 {yyerror ("'(' expected"); DRECOVER(new_1);;
4236 #line 1846 "./parse.y"
4237 {yyerror ("'(' expected"); RECOVER;;
4240 #line 1848 "./parse.y"
4241 {yyerror ("')' or term expected"); RECOVER;;
4244 #line 1850 "./parse.y"
4245 {yyerror ("')' expected"); RECOVER;;
4248 #line 1852 "./parse.y"
4249 {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;;
4252 #line 1854 "./parse.y"
4253 {yyerror ("'(' expected"); RECOVER;;
4256 #line 1864 "./parse.y"
4258 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
4259 ctxp->formal_parameter_number = 1;
4263 #line 1869 "./parse.y"
4265 ctxp->formal_parameter_number += 1;
4266 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
4270 #line 1874 "./parse.y"
4271 {yyerror ("Missing term"); RECOVER;;
4274 #line 1879 "./parse.y"
4275 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4278 #line 1881 "./parse.y"
4279 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4282 #line 1883 "./parse.y"
4283 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4286 #line 1885 "./parse.y"
4287 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4290 #line 1889 "./parse.y"
4291 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4294 #line 1891 "./parse.y"
4295 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4298 #line 1893 "./parse.y"
4299 {yyerror ("'[' expected"); DRECOVER ("]");;
4302 #line 1895 "./parse.y"
4303 {yyerror ("']' expected"); RECOVER;;
4306 #line 1900 "./parse.y"
4307 { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ;
4310 #line 1902 "./parse.y"
4311 { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ;
4314 #line 1907 "./parse.y"
4316 EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
4317 yyval.node = yyvsp[-1].node;
4321 #line 1912 "./parse.y"
4322 {yyerror ("']' expected"); RECOVER;;
4325 #line 1914 "./parse.y"
4327 yyerror ("Missing term");
4328 yyerror ("']' expected");
4333 #line 1923 "./parse.y"
4336 /* If not initialized, allocate memory for the osb
4338 if (!ctxp->osb_limit)
4340 allocate = ctxp->osb_limit = 32;
4341 ctxp->osb_depth = -1;
4343 /* If capacity overflown, reallocate a bigger chuck */
4344 else if (ctxp->osb_depth+1 == ctxp->osb_limit)
4345 allocate = ctxp->osb_limit << 1;
4349 allocate *= sizeof (int);
4350 if (ctxp->osb_number)
4351 ctxp->osb_number = (int *)xrealloc (ctxp->osb_number,
4354 ctxp->osb_number = (int *)xmalloc (allocate);
4357 CURRENT_OSB (ctxp) = 1;
4361 #line 1949 "./parse.y"
4362 { CURRENT_OSB (ctxp)++; ;
4365 #line 1951 "./parse.y"
4366 { yyerror ("']' expected"); RECOVER;;
4369 #line 1956 "./parse.y"
4370 { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
4373 #line 1960 "./parse.y"
4376 build_wfl_node (super_identifier_node);
4377 EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location;
4378 yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location);
4382 #line 1967 "./parse.y"
4383 {yyerror ("Field expected"); DRECOVER (super_field_acces);;
4386 #line 1972 "./parse.y"
4387 { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ;
4390 #line 1974 "./parse.y"
4391 { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4394 #line 1976 "./parse.y"
4396 if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR)
4397 yyval.node = build_this_super_qualified_invocation
4398 (1, yyvsp[-2].node, NULL_TREE, 0, yyvsp[-3].operator.location);
4401 tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE);
4402 yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location);
4407 #line 1987 "./parse.y"
4409 if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR)
4410 yyval.node = build_this_super_qualified_invocation
4411 (1, yyvsp[-3].node, yyvsp[-1].node, 0, yyvsp[-4].operator.location);
4414 tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node);
4415 yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location);
4420 #line 1998 "./parse.y"
4422 yyval.node = build_this_super_qualified_invocation
4423 (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location);
4427 #line 2003 "./parse.y"
4429 yyval.node = build_this_super_qualified_invocation
4430 (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location);
4434 #line 2012 "./parse.y"
4435 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4438 #line 2014 "./parse.y"
4439 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4442 #line 2019 "./parse.y"
4443 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4446 #line 2021 "./parse.y"
4447 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4450 #line 2023 "./parse.y"
4452 yyerror ("Missing term and ']' expected");
4453 DRECOVER(array_access);
4457 #line 2028 "./parse.y"
4459 yyerror ("']' expected");
4460 DRECOVER(array_access);
4464 #line 2033 "./parse.y"
4466 yyerror ("Missing term and ']' expected");
4467 DRECOVER(array_access);
4471 #line 2038 "./parse.y"
4473 yyerror ("']' expected");
4474 DRECOVER(array_access);
4478 #line 2053 "./parse.y"
4479 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4482 #line 2058 "./parse.y"
4483 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4486 #line 2065 "./parse.y"
4487 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4490 #line 2067 "./parse.y"
4491 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4494 #line 2070 "./parse.y"
4495 {yyerror ("Missing term"); RECOVER;
4498 #line 2072 "./parse.y"
4499 {yyerror ("Missing term"); RECOVER;
4502 #line 2077 "./parse.y"
4503 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4506 #line 2079 "./parse.y"
4507 {yyerror ("Missing term"); RECOVER;
4510 #line 2084 "./parse.y"
4511 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4514 #line 2086 "./parse.y"
4515 {yyerror ("Missing term"); RECOVER;
4518 #line 2092 "./parse.y"
4519 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4522 #line 2094 "./parse.y"
4523 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4526 #line 2097 "./parse.y"
4527 {yyerror ("Missing term"); RECOVER;
4530 #line 2099 "./parse.y"
4531 {yyerror ("Missing term"); RECOVER;
4534 #line 2104 "./parse.y"
4536 tree type = yyvsp[-3].node;
4537 while (CURRENT_OSB (ctxp)--)
4538 type = build_java_array_type (type, -1);
4540 yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node);
4544 #line 2112 "./parse.y"
4545 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4548 #line 2114 "./parse.y"
4549 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4552 #line 2116 "./parse.y"
4555 while (CURRENT_OSB (ctxp)--)
4556 obstack_1grow (&temporary_obstack, '[');
4558 obstack_grow0 (&temporary_obstack,
4559 IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)),
4560 IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node)));
4561 ptr = obstack_finish (&temporary_obstack);
4562 EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr);
4563 yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node);
4567 #line 2129 "./parse.y"
4568 {yyerror ("']' expected, invalid type expression");;
4571 #line 2131 "./parse.y"
4573 if (ctxp->prevent_ese != lineno)
4574 yyerror ("Invalid type expression"); RECOVER;
4579 #line 2137 "./parse.y"
4580 {yyerror ("Missing term"); RECOVER;;
4583 #line 2139 "./parse.y"
4584 {yyerror ("Missing term"); RECOVER;;
4587 #line 2141 "./parse.y"
4588 {yyerror ("Missing term"); RECOVER;;
4591 #line 2147 "./parse.y"
4593 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token),
4594 yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
4598 #line 2152 "./parse.y"
4600 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4601 yyvsp[-2].node, yyvsp[0].node);
4605 #line 2157 "./parse.y"
4607 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4608 yyvsp[-2].node, yyvsp[0].node);
4612 #line 2162 "./parse.y"
4613 {yyerror ("Missing term"); RECOVER;;
4616 #line 2164 "./parse.y"
4617 {yyerror ("Missing term"); RECOVER;;
4620 #line 2166 "./parse.y"
4621 {yyerror ("Missing term"); RECOVER;;
4624 #line 2172 "./parse.y"
4626 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4627 yyvsp[-2].node, yyvsp[0].node);
4631 #line 2177 "./parse.y"
4633 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4634 yyvsp[-2].node, yyvsp[0].node);
4638 #line 2182 "./parse.y"
4639 {yyerror ("Missing term"); RECOVER;;
4642 #line 2184 "./parse.y"
4643 {yyerror ("Missing term"); RECOVER;;
4646 #line 2190 "./parse.y"
4648 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4649 yyvsp[-2].node, yyvsp[0].node);
4653 #line 2195 "./parse.y"
4655 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4656 yyvsp[-2].node, yyvsp[0].node);
4660 #line 2200 "./parse.y"
4662 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4663 yyvsp[-2].node, yyvsp[0].node);
4667 #line 2205 "./parse.y"
4668 {yyerror ("Missing term"); RECOVER;;
4671 #line 2207 "./parse.y"
4672 {yyerror ("Missing term"); RECOVER;;
4675 #line 2209 "./parse.y"
4676 {yyerror ("Missing term"); RECOVER;;
4679 #line 2215 "./parse.y"
4681 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4682 yyvsp[-2].node, yyvsp[0].node);
4686 #line 2220 "./parse.y"
4688 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4689 yyvsp[-2].node, yyvsp[0].node);
4693 #line 2225 "./parse.y"
4695 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4696 yyvsp[-2].node, yyvsp[0].node);
4700 #line 2230 "./parse.y"
4702 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4703 yyvsp[-2].node, yyvsp[0].node);
4707 #line 2235 "./parse.y"
4708 { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4711 #line 2237 "./parse.y"
4712 {yyerror ("Missing term"); RECOVER;;
4715 #line 2239 "./parse.y"
4716 {yyerror ("Missing term"); RECOVER;;
4719 #line 2241 "./parse.y"
4720 {yyerror ("Missing term"); RECOVER;;
4723 #line 2243 "./parse.y"
4724 {yyerror ("Missing term"); RECOVER;;
4727 #line 2245 "./parse.y"
4728 {yyerror ("Invalid reference type"); RECOVER;;
4731 #line 2251 "./parse.y"
4733 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4734 yyvsp[-2].node, yyvsp[0].node);
4738 #line 2256 "./parse.y"
4740 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4741 yyvsp[-2].node, yyvsp[0].node);
4745 #line 2261 "./parse.y"
4746 {yyerror ("Missing term"); RECOVER;;
4749 #line 2263 "./parse.y"
4750 {yyerror ("Missing term"); RECOVER;;
4753 #line 2269 "./parse.y"
4755 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4756 yyvsp[-2].node, yyvsp[0].node);
4760 #line 2274 "./parse.y"
4761 {yyerror ("Missing term"); RECOVER;;
4764 #line 2280 "./parse.y"
4766 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4767 yyvsp[-2].node, yyvsp[0].node);
4771 #line 2285 "./parse.y"
4772 {yyerror ("Missing term"); RECOVER;;
4775 #line 2291 "./parse.y"
4777 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4778 yyvsp[-2].node, yyvsp[0].node);
4782 #line 2296 "./parse.y"
4783 {yyerror ("Missing term"); RECOVER;;
4786 #line 2302 "./parse.y"
4788 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4789 yyvsp[-2].node, yyvsp[0].node);
4793 #line 2307 "./parse.y"
4794 {yyerror ("Missing term"); RECOVER;;
4797 #line 2313 "./parse.y"
4799 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4800 yyvsp[-2].node, yyvsp[0].node);
4804 #line 2318 "./parse.y"
4805 {yyerror ("Missing term"); RECOVER;;
4808 #line 2324 "./parse.y"
4810 yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
4811 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4815 #line 2329 "./parse.y"
4818 yyerror ("Missing term");
4823 #line 2335 "./parse.y"
4824 {yyerror ("Missing term"); DRECOVER (2);;
4827 #line 2337 "./parse.y"
4828 {yyerror ("Missing term"); DRECOVER (3);;
4831 #line 2347 "./parse.y"
4832 { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4835 #line 2349 "./parse.y"
4837 if (ctxp->prevent_ese != lineno)
4838 yyerror ("Missing term");
4843 /* the action file gets copied in in place of this dollarsign */
4844 #line 543 "/usr/lib/bison.simple"
4855 short *ssp1 = yyss - 1;
4856 fprintf (stderr, "state stack now");
4857 while (ssp1 != yyssp)
4858 fprintf (stderr, " %d", *++ssp1);
4859 fprintf (stderr, "\n");
4869 yylsp->first_line = yylloc.first_line;
4870 yylsp->first_column = yylloc.first_column;
4871 yylsp->last_line = (yylsp-1)->last_line;
4872 yylsp->last_column = (yylsp-1)->last_column;
4877 yylsp->last_line = (yylsp+yylen-1)->last_line;
4878 yylsp->last_column = (yylsp+yylen-1)->last_column;
4882 /* Now "shift" the result of the reduction.
4883 Determine what state that goes to,
4884 based on the state we popped back to
4885 and the rule number reduced by. */
4889 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
4890 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4891 yystate = yytable[yystate];
4893 yystate = yydefgoto[yyn - YYNTBASE];
4897 yyerrlab: /* here on detecting error */
4900 /* If not already recovering from an error, report this error. */
4904 #ifdef YYERROR_VERBOSE
4905 yyn = yypact[yystate];
4907 if (yyn > YYFLAG && yyn < YYLAST)
4914 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
4915 for (x = (yyn < 0 ? -yyn : 0);
4916 x < (sizeof(yytname) / sizeof(char *)); x++)
4917 if (yycheck[x + yyn] == x)
4918 size += strlen(yytname[x]) + 15, count++;
4919 msg = (char *) malloc(size + 15);
4922 strcpy(msg, "parse error");
4927 for (x = (yyn < 0 ? -yyn : 0);
4928 x < (sizeof(yytname) / sizeof(char *)); x++)
4929 if (yycheck[x + yyn] == x)
4931 strcat(msg, count == 0 ? ", expecting `" : " or `");
4932 strcat(msg, yytname[x]);
4941 yyerror ("parse error; also virtual memory exceeded");
4944 #endif /* YYERROR_VERBOSE */
4945 yyerror("parse error");
4949 yyerrlab1: /* here on error raised explicitly by an action */
4951 if (yyerrstatus == 3)
4953 /* if just tried and failed to reuse lookahead token after an error, discard it. */
4955 /* return failure if at end of input */
4956 if (yychar == YYEOF)
4961 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
4967 /* Else will try to reuse lookahead token
4968 after shifting the error token. */
4970 yyerrstatus = 3; /* Each real token shifted decrements this */
4974 yyerrdefault: /* current state does not do anything special for the error token. */
4977 /* This is wrong; only states that explicitly want error tokens
4978 should shift them. */
4979 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4980 if (yyn) goto yydefault;
4983 yyerrpop: /* pop the current state because it cannot handle the error token */
4985 if (yyssp == yyss) YYABORT;
4995 short *ssp1 = yyss - 1;
4996 fprintf (stderr, "Error: state stack now");
4997 while (ssp1 != yyssp)
4998 fprintf (stderr, " %d", *++ssp1);
4999 fprintf (stderr, "\n");
5005 yyn = yypact[yystate];
5010 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5029 fprintf(stderr, "Shifting error token, ");
5041 /* YYACCEPT comes here. */
5053 /* YYABORT comes here. */
5064 #line 2375 "./parse.y"
5068 /* Flag for the error report routine to issue the error the first time
5069 it's called (overriding the default behavior which is to drop the
5070 first invocation and honor the second one, taking advantage of a
5072 static int force_error = 0;
5074 /* Create a new parser context and make it the current one. */
5077 java_push_parser_context ()
5079 struct parser_ctxt *new =
5080 (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
5082 bzero ((PTR) new, sizeof (struct parser_ctxt));
5087 ctxp->incomplete_class = ctxp->next->incomplete_class;
5088 ctxp->gclass_list = ctxp->next->gclass_list;
5093 java_parser_context_save_global ()
5097 java_push_parser_context ();
5098 ctxp->saved_data_ctx = 1;
5100 else if (ctxp->saved_data)
5102 struct parser_ctxt *new =
5103 (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
5104 bzero ((PTR)new, sizeof (struct parser_ctxt));
5105 memcpy ((PTR)new, (PTR)ctxp, sizeof (struct parser_ctxt));
5108 ctxp->saved_data_ctx = 1;
5110 ctxp->finput = finput;
5111 ctxp->lineno = lineno;
5112 ctxp->current_class = current_class;
5113 ctxp->filename = input_filename;
5114 ctxp->current_function_decl = current_function_decl;
5115 ctxp->saved_data = 1;
5119 java_parser_context_restore_global ()
5121 finput = ctxp->finput;
5122 lineno = ctxp->lineno;
5123 current_class = ctxp->current_class;
5124 input_filename = ctxp->filename;
5125 ctxp->saved_data = 0;
5126 current_function_decl = ctxp->current_function_decl;
5127 if (ctxp->saved_data_ctx)
5128 java_pop_parser_context (0);
5132 java_pop_parser_context (generate)
5136 struct parser_ctxt *toFree, *next;
5145 next->incomplete_class = ctxp->incomplete_class;
5146 next->gclass_list = ctxp->gclass_list;
5147 lineno = ctxp->lineno;
5148 finput = ctxp->finput;
5149 current_class = ctxp->current_class;
5152 /* Set the single import class file flag to 0 for the current list
5153 of imported things */
5154 for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
5155 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0;
5157 /* And restore those of the previous context */
5158 if ((ctxp = next)) /* Assignment is really meant here */
5159 for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
5160 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1;
5164 toFree->next = ctxp_for_generation;
5165 ctxp_for_generation = toFree;
5171 /* Dump the stacked up parser contexts. Intended to be called from a
5175 java_debug_context_do (tab)
5178 #define JAVA_TAB_CONTEXT(C) \
5179 {int i; for (i = 0; i < (C); i++) fputc (' ', stderr);}
5181 struct parser_ctxt *copy = ctxp;
5184 JAVA_TAB_CONTEXT (tab);
5185 fprintf (stderr, "ctxt: 0x%0lX\n", (unsigned long)copy);
5186 JAVA_TAB_CONTEXT (tab);
5187 fprintf (stderr, "filename: %s\n", copy->filename);
5188 JAVA_TAB_CONTEXT (tab);
5189 fprintf (stderr, "package: %s\n",
5191 IDENTIFIER_POINTER (copy->package) : "<none>"));
5192 JAVA_TAB_CONTEXT (tab);
5193 fprintf (stderr, "context for saving: %d\n", copy->saved_data_ctx);
5194 JAVA_TAB_CONTEXT (tab);
5195 fprintf (stderr, "saved data: %d\n", copy->saved_data);
5199 #undef JAVA_TAB_CONTEXT
5203 java_debug_context ()
5205 java_debug_context_do (0);
5209 /* Reporting an constructor invocation error. */
5211 parse_ctor_invocation_error ()
5213 if (DECL_CONSTRUCTOR_P (current_function_decl))
5214 yyerror ("Constructor invocation must be first thing in a constructor");
5216 yyerror ("Only constructors can invoke constructors");
5219 /* Reporting JDK1.1 features not implemented. */
5222 parse_jdk1_1_error (msg)
5225 sorry (": `%s' JDK1.1(TM) feature", msg);
5227 return empty_stmt_node;
5230 static int do_warning = 0;
5237 static int prev_lineno;
5238 static const char *prev_msg;
5241 char *remainder, *code_from_source;
5242 extern struct obstack temporary_obstack;
5244 if (!force_error && prev_lineno == lineno)
5247 /* Save current error location but report latter, when the context is
5249 if (ctxp->java_error_flag == 0)
5251 ctxp->java_error_flag = 1;
5253 /* Do something to use the previous line if we're reaching the
5254 end of the file... */
5255 #ifdef VERBOSE_SKELETON
5256 printf ("* Error detected (%s)\n", (msg ? msg : "(null)"));
5261 /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
5262 if (!force_error && msg == prev_msg && prev_lineno == elc.line)
5265 ctxp->java_error_flag = 0;
5267 java_warning_count++;
5271 if (elc.col == 0 && msg[1] == ';')
5273 elc.col = ctxp->p_line->char_col-1;
5274 elc.line = ctxp->p_line->lineno;
5277 save_lineno = lineno;
5278 prev_lineno = lineno = elc.line;
5281 code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col);
5282 obstack_grow0 (&temporary_obstack,
5283 code_from_source, strlen (code_from_source));
5284 remainder = obstack_finish (&temporary_obstack);
5286 warning ("%s.\n%s", msg, remainder);
5288 error ("%s.\n%s", msg, remainder);
5290 /* This allow us to cheaply avoid an extra 'Invalid expression
5291 statement' error report when errors have been already reported on
5292 the same line. This occurs when we report an error but don't have
5293 a synchronization point other than ';', which
5294 expression_statement is the only one to take care of. */
5295 ctxp->prevent_ese = lineno = save_lineno;
5299 issue_warning_error_from_context (cl, msg, ap)
5304 char *saved, *saved_input_filename;
5306 vsprintf (buffer, msg, ap);
5309 ctxp->elc.line = EXPR_WFL_LINENO (cl);
5310 ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 :
5311 (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl)));
5313 /* We have a CL, that's a good reason for using it if it contains data */
5314 saved = ctxp->filename;
5315 if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl))
5316 ctxp->filename = EXPR_WFL_FILENAME (cl);
5317 saved_input_filename = input_filename;
5318 input_filename = ctxp->filename;
5320 java_error (buffer);
5321 ctxp->filename = saved;
5322 input_filename = saved_input_filename;
5326 /* Issue an error message at a current source line CL */
5329 parse_error_context VPARAMS ((tree cl, const char *msg, ...))
5331 #ifndef ANSI_PROTOTYPES
5338 #ifndef ANSI_PROTOTYPES
5339 cl = va_arg (ap, tree);
5340 msg = va_arg (ap, const char *);
5342 issue_warning_error_from_context (cl, msg, ap);
5346 /* Issue a warning at a current source line CL */
5349 parse_warning_context VPARAMS ((tree cl, const char *msg, ...))
5351 #ifndef ANSI_PROTOTYPES
5358 #ifndef ANSI_PROTOTYPES
5359 cl = va_arg (ap, tree);
5360 msg = va_arg (ap, const char *);
5363 force_error = do_warning = 1;
5364 issue_warning_error_from_context (cl, msg, ap);
5365 do_warning = force_error = 0;
5370 find_expr_with_wfl (node)
5378 switch (TREE_CODE (node))
5381 node = BLOCK_EXPR_BODY (node);
5385 to_return = find_expr_with_wfl (TREE_OPERAND (node, 0));
5388 node = TREE_OPERAND (node, 1);
5392 node = TREE_OPERAND (node, 0);
5395 case LABELED_BLOCK_EXPR:
5396 node = TREE_OPERAND (node, 1);
5400 code = TREE_CODE_CLASS (TREE_CODE (node));
5401 if (((code == '1') || (code == '2') || (code == 'e'))
5402 && EXPR_WFL_LINECOL (node))
5410 /* Issue a missing return statement error. Uses METHOD to figure the
5411 last line of the method the error occurs in. */
5414 missing_return_error (method)
5417 EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2);
5418 parse_error_context (wfl_operator, "Missing return statement");
5421 /* Issue an unreachable statement error. From NODE, find the next
5422 statement to report appropriately. */
5424 unreachable_stmt_error (node)
5427 /* Browse node to find the next expression node that has a WFL. Use
5428 the location to report the error */
5429 if (TREE_CODE (node) == COMPOUND_EXPR)
5430 node = find_expr_with_wfl (TREE_OPERAND (node, 1));
5432 node = find_expr_with_wfl (node);
5436 EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2);
5437 parse_error_context (wfl_operator, "Unreachable statement");
5440 fatal ("Can't get valid statement - unreachable_stmt_error");
5444 java_report_errors ()
5446 if (java_error_count)
5447 fprintf (stderr, "%d error%s",
5448 java_error_count, (java_error_count == 1 ? "" : "s"));
5449 if (java_warning_count)
5450 fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""),
5451 java_warning_count, (java_warning_count == 1 ? "" : "s"));
5452 if (java_error_count || java_warning_count)
5453 putc ('\n', stderr);
5454 return java_error_count;
5458 java_accstring_lookup (flags)
5461 static char buffer [80];
5462 #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
5464 /* Access modifier looked-up first for easier report on forbidden
5466 if (flags & ACC_PUBLIC) COPY_RETURN ("public");
5467 if (flags & ACC_PRIVATE) COPY_RETURN ("private");
5468 if (flags & ACC_PROTECTED) COPY_RETURN ("protected");
5469 if (flags & ACC_STATIC) COPY_RETURN ("static");
5470 if (flags & ACC_FINAL) COPY_RETURN ("final");
5471 if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized");
5472 if (flags & ACC_VOLATILE) COPY_RETURN ("volatile");
5473 if (flags & ACC_TRANSIENT) COPY_RETURN ("transient");
5474 if (flags & ACC_NATIVE) COPY_RETURN ("native");
5475 if (flags & ACC_INTERFACE) COPY_RETURN ("interface");
5476 if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract");
5483 /* Issuing error messages upon redefinition of classes, interfaces or
5487 classitf_redefinition_error (context, id, decl, cl)
5488 const char *context;
5491 parse_error_context (cl, "%s `%s' already defined in %s:%d",
5492 context, IDENTIFIER_POINTER (id),
5493 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
5494 /* Here we should point out where its redefined. It's a unicode. FIXME */
5498 variable_redefinition_error (context, name, type, line)
5499 tree context, name, type;
5502 const char *type_name;
5504 /* Figure a proper name for type. We might haven't resolved it */
5505 if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type))
5506 type_name = IDENTIFIER_POINTER (TYPE_NAME (type));
5508 type_name = lang_printable_name (type, 0);
5510 parse_error_context (context,
5511 "Variable `%s' is already defined in this method and was declared `%s %s' at line %d",
5512 IDENTIFIER_POINTER (name),
5513 type_name, IDENTIFIER_POINTER (name), line);
5517 build_array_from_name (type, type_wfl, name, ret_name)
5518 tree type, type_wfl, name, *ret_name;
5523 /* Eventually get more dims */
5524 string = IDENTIFIER_POINTER (name);
5525 while (string [more_dims] == '[')
5528 /* If we have, then craft a new type for this variable */
5531 name = get_identifier (&string [more_dims]);
5533 /* If we have a pointer, use its type */
5534 if (TREE_CODE (type) == POINTER_TYPE)
5535 type = TREE_TYPE (type);
5537 /* Building the first dimension of a primitive type uses this
5539 if (JPRIMITIVE_TYPE_P (type))
5541 type = build_java_array_type (type, -1);
5542 CLASS_LOADED_P (type) = 1;
5545 /* Otherwise, if we have a WFL for this type, use it (the type
5546 is already an array on an unresolved type, and we just keep
5547 on adding dimensions) */
5551 /* Add all the dimensions */
5553 type = build_unresolved_array_type (type);
5555 /* The type may have been incomplete in the first place */
5557 type = obtain_incomplete_type (type);
5564 /* Build something that the type identifier resolver will identify as
5565 being an array to an unresolved type. TYPE_WFL is a WFL on a
5569 build_unresolved_array_type (type_or_wfl)
5574 /* TYPE_OR_WFL might be an array on a resolved type. In this case,
5575 just create a array type */
5576 if (TREE_CODE (type_or_wfl) == RECORD_TYPE)
5578 tree type = build_java_array_type (type_or_wfl, -1);
5579 CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl);
5583 obstack_1grow (&temporary_obstack, '[');
5584 obstack_grow0 (&temporary_obstack,
5585 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
5586 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
5587 ptr = obstack_finish (&temporary_obstack);
5588 return build_expr_wfl (get_identifier (ptr),
5589 EXPR_WFL_FILENAME (type_or_wfl),
5590 EXPR_WFL_LINENO (type_or_wfl),
5591 EXPR_WFL_COLNO (type_or_wfl));
5595 parser_add_interface (class_decl, interface_decl, wfl)
5596 tree class_decl, interface_decl, wfl;
5598 if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
5599 parse_error_context (wfl, "Interface `%s' repeated",
5600 IDENTIFIER_POINTER (DECL_NAME (interface_decl)));
5603 /* Bulk of common class/interface checks. Return 1 if an error was
5604 encountered. TAG is 0 for a class, 1 for an interface. */
5607 check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl)
5608 int is_interface, flags;
5609 tree raw_name, qualified_name, decl, cl;
5614 fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"),
5615 IDENTIFIER_POINTER (qualified_name));
5617 /* Scope of an interface/class type name:
5618 - Can't be imported by a single type import
5619 - Can't already exists in the package */
5620 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name)
5621 && (node = find_name_in_single_imports (raw_name)))
5624 (cl, "%s name `%s' clashes with imported type `%s'",
5625 (is_interface ? "Interface" : "Class"),
5626 IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node));
5629 if (decl && CLASS_COMPLETE_P (decl))
5631 classitf_redefinition_error ((is_interface ? "Interface" : "Class"),
5632 qualified_name, decl, cl);
5636 /* If public, file name should match class/interface name */
5637 if (flags & ACC_PUBLIC)
5641 /* Contains OS dependent assumption on path separator. FIXME */
5642 for (f = &input_filename [strlen (input_filename)];
5643 f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR;
5646 if (f[0] == '/' || f[0] == DIR_SEPARATOR)
5648 if (strncmp (IDENTIFIER_POINTER (raw_name),
5649 f , IDENTIFIER_LENGTH (raw_name)) ||
5650 f [IDENTIFIER_LENGTH (raw_name)] != '.')
5652 (cl, "Public %s `%s' must be defined in a file called `%s.java'",
5653 (is_interface ? "interface" : "class"),
5654 IDENTIFIER_POINTER (qualified_name),
5655 IDENTIFIER_POINTER (raw_name));
5659 check_modifiers ("Illegal modifier `%s' for interface declaration",
5660 flags, INTERFACE_MODIFIERS);
5662 check_modifiers ("Illegal modifier `%s' for class declaration",
5663 flags, CLASS_MODIFIERS);
5667 /* If DECL is NULL, create and push a new DECL, record the current
5668 line CL and do other maintenance things. */
5671 maybe_create_class_interface_decl (decl, qualified_name, cl)
5672 tree decl, qualified_name, cl;
5675 decl = push_class (make_class (), qualified_name);
5677 /* Take care of the file and line business */
5678 DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
5679 /* If we're emiting xrefs, store the line/col number information */
5681 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (cl);
5683 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
5684 CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
5685 CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) =
5686 IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
5688 ctxp->current_parsed_class = decl;
5690 /* Link the declaration to the already seen ones */
5691 TREE_CHAIN (decl) = ctxp->class_list;
5692 ctxp->class_list = decl;
5694 /* Create a new nodes in the global lists */
5695 ctxp->gclass_list = tree_cons (NULL_TREE, decl, ctxp->gclass_list);
5696 all_class_list = tree_cons (NULL_TREE, decl, all_class_list);
5698 /* Install a new dependency list element */
5699 create_jdep_list (ctxp);
5701 SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
5702 IDENTIFIER_POINTER (qualified_name)));
5707 add_superinterfaces (decl, interface_list)
5708 tree decl, interface_list;
5711 /* Superinterface(s): if present and defined, parser_check_super_interface ()
5712 takes care of ensuring that:
5713 - This is an accessible interface type,
5714 - Circularity detection.
5715 parser_add_interface is then called. If present but not defined,
5716 the check operation is delayed until the super interface gets
5718 for (node = interface_list; node; node = TREE_CHAIN (node))
5720 tree current = TREE_PURPOSE (node);
5721 tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current));
5722 if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl)))
5724 if (!parser_check_super_interface (idecl, decl, current))
5725 parser_add_interface (decl, idecl, current);
5728 register_incomplete_type (JDEP_INTERFACE,
5729 current, decl, NULL_TREE);
5733 /* Create an interface in pass1 and return its decl. Return the
5734 interface's decl in pass 2. */
5737 create_interface (flags, id, super)
5741 tree raw_name = EXPR_WFL_NODE (id);
5742 tree q_name = parser_qualified_classname (id);
5743 tree decl = IDENTIFIER_CLASS_VALUE (q_name);
5745 EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */
5747 /* Basic checks: scope, redefinition, modifiers */
5748 if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id))
5751 /* Interface modifiers check
5752 - public/abstract allowed (already done at that point)
5753 - abstract is obsolete (comes first, it's a warning, or should be)
5754 - Can't use twice the same (checked in the modifier rule) */
5755 if ((flags & ACC_ABSTRACT) && flag_redundant)
5756 parse_warning_context
5757 (MODIFIER_WFL (ABSTRACT_TK),
5758 "Redundant use of `abstract' modifier. Interface `%s' is implicitely abstract", IDENTIFIER_POINTER (raw_name));
5760 /* Create a new decl if DECL is NULL, otherwise fix it */
5761 decl = maybe_create_class_interface_decl (decl, q_name, id);
5763 /* Set super info and mark the class a complete */
5764 set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl),
5765 object_type_node, ctxp->interface_number);
5766 ctxp->interface_number = 0;
5767 CLASS_COMPLETE_P (decl) = 1;
5768 add_superinterfaces (decl, super);
5773 /* Create an class in pass1 and return its decl. Return class
5774 interface's decl in pass 2. */
5777 create_class (flags, id, super, interfaces)
5779 tree id, super, interfaces;
5781 tree raw_name = EXPR_WFL_NODE (id);
5782 tree class_id, decl;
5783 tree super_decl_type;
5785 class_id = parser_qualified_classname (id);
5786 decl = IDENTIFIER_CLASS_VALUE (class_id);
5787 ctxp->current_parsed_class_un = EXPR_WFL_NODE (id);
5788 EXPR_WFL_NODE (id) = class_id;
5790 /* Basic check: scope, redefinition, modifiers */
5791 if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id))
5794 /* Class modifier check:
5795 - Allowed modifier (already done at that point)
5796 - abstract AND final forbidden
5797 - Public classes defined in the correct file */
5798 if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
5800 (id, "Class `%s' can't be declared both abstract and final",
5801 IDENTIFIER_POINTER (raw_name));
5803 /* Create a new decl if DECL is NULL, otherwise fix it */
5804 decl = maybe_create_class_interface_decl (decl, class_id, id);
5806 /* If SUPER exists, use it, otherwise use Object */
5809 /* Can't extend java.lang.Object */
5810 if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
5812 parse_error_context (id, "Can't extend `java.lang.Object'");
5817 register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE);
5819 else if (TREE_TYPE (decl) != object_type_node)
5820 super_decl_type = object_type_node;
5821 /* We're defining java.lang.Object */
5823 super_decl_type = NULL_TREE;
5825 /* Set super info and mark the class a complete */
5826 set_super_info (flags, TREE_TYPE (decl), super_decl_type,
5827 ctxp->interface_number);
5828 ctxp->interface_number = 0;
5829 CLASS_COMPLETE_P (decl) = 1;
5830 add_superinterfaces (decl, interfaces);
5832 /* If doing xref, store the location at which the inherited class
5833 (if any) was seen. */
5834 if (flag_emit_xref && super)
5835 DECL_INHERITED_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (super);
5837 /* Eventually sets the @deprecated tag flag */
5838 CHECK_DEPRECATED (decl);
5843 /* Can't use lookup_field () since we don't want to load the class and
5844 can't set the CLASS_LOADED_P flag */
5847 find_field (class, name)
5852 for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl))
5854 if (DECL_NAME (decl) == name)
5860 /* Wrap around lookup_field that doesn't potentially upset the value
5864 lookup_field_wrapper (class, name)
5869 java_parser_context_save_global ();
5870 decl = lookup_field (&type, name);
5871 java_parser_context_restore_global ();
5872 return decl == error_mark_node ? NULL : decl;
5875 /* Find duplicate field within the same class declarations and report
5876 the error. Returns 1 if a duplicated field was found, 0
5880 duplicate_declaration_error_p (new_field_name, new_type, cl)
5881 tree new_field_name, new_type, cl;
5883 /* This might be modified to work with method decl as well */
5884 tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class),
5888 char *t1 = xstrdup (purify_type_name
5889 ((TREE_CODE (new_type) == POINTER_TYPE
5890 && TREE_TYPE (new_type) == NULL_TREE) ?
5891 IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
5892 lang_printable_name (new_type, 1)));
5893 /* The type may not have been completed by the time we report
5895 char *t2 = xstrdup (purify_type_name
5896 ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
5897 && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
5898 IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
5899 lang_printable_name (TREE_TYPE (decl), 1)));
5901 (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
5902 t1, IDENTIFIER_POINTER (new_field_name),
5903 t2, IDENTIFIER_POINTER (DECL_NAME (decl)),
5904 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
5912 /* Field registration routine. If TYPE doesn't exist, field
5913 declarations are linked to the undefined TYPE dependency list, to
5914 be later resolved in java_complete_class () */
5917 register_fields (flags, type, variable_list)
5919 tree type, variable_list;
5921 tree current, saved_type;
5922 tree class_type = TREE_TYPE (ctxp->current_parsed_class);
5923 int saved_lineno = lineno;
5925 tree wfl = NULL_TREE;
5927 /* If we're adding fields to interfaces, those fields are public,
5929 if (CLASS_INTERFACE (TYPE_NAME (class_type)))
5931 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK),
5932 flags, ACC_PUBLIC, "interface field(s)");
5933 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
5934 flags, ACC_STATIC, "interface field(s)");
5935 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
5936 flags, ACC_FINAL, "interface field(s)");
5937 check_modifiers ("Illegal interface member modifier `%s'", flags,
5938 INTERFACE_FIELD_MODIFIERS);
5939 flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL);
5942 /* Obtain a suitable type for resolution, if necessary */
5943 SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain);
5945 /* If TYPE is fully resolved and we don't have a reference, make one */
5946 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5948 for (current = variable_list, saved_type = type; current;
5949 current = TREE_CHAIN (current), type = saved_type)
5953 tree cl = TREE_PURPOSE (current);
5954 tree init = TREE_VALUE (current);
5955 tree current_name = EXPR_WFL_NODE (cl);
5957 /* Process NAME, as it may specify extra dimension(s) for it */
5958 type = build_array_from_name (type, wfl, current_name, ¤t_name);
5960 /* Type adjustment. We may have just readjusted TYPE because
5961 the variable specified more dimensions. Make sure we have
5962 a reference if we can and don't have one already. Also
5963 change the name if we have an init. */
5964 if (type != saved_type)
5966 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5968 EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name;
5971 real_type = GET_REAL_TYPE (type);
5972 /* Check for redeclarations */
5973 if (duplicate_declaration_error_p (current_name, real_type, cl))
5976 /* Set lineno to the line the field was found and create a
5977 declaration for it. Eventually sets the @deprecated tag flag. */
5979 lineno = EXPR_WFL_LINECOL (cl);
5981 lineno = EXPR_WFL_LINENO (cl);
5982 field_decl = add_field (class_type, current_name, real_type, flags);
5983 CHECK_DEPRECATED (field_decl);
5985 /* Check if we must chain. */
5987 register_incomplete_type (JDEP_FIELD, wfl, field_decl, type);
5989 /* If we have an initialization value tied to the field */
5992 /* The field is declared static */
5993 if (flags & ACC_STATIC)
5995 /* We include the field and its initialization part into
5996 a list used to generate <clinit>. After <clinit> is
5997 walked, field initializations will be processed and
5998 fields initialized with known constants will be taken
5999 out of <clinit> and have their DECL_INITIAL set
6001 TREE_CHAIN (init) = ctxp->static_initialized;
6002 ctxp->static_initialized = init;
6003 if (TREE_OPERAND (init, 1)
6004 && TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT)
6005 TREE_STATIC (TREE_OPERAND (init, 1)) = 1;
6007 /* A non-static field declared with an immediate initialization is
6008 to be initialized in <init>, if any. This field is remembered
6009 to be processed at the time of the generation of <init>. */
6012 TREE_CHAIN (init) = ctxp->non_static_initialized;
6013 ctxp->non_static_initialized = init;
6015 MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
6016 DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1);
6019 lineno = saved_lineno;
6022 /* Generate the method $finit$ that initializes fields initialized
6023 upon declaration. */
6026 maybe_generate_finit ()
6028 tree mdecl, current;
6030 if (!ctxp->non_static_initialized || java_error_count)
6033 mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
6034 ACC_PRIVATE, void_type_node,
6035 finit_identifier_node, end_params_node);
6036 start_artificial_method_body (mdecl);
6038 ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized);
6039 for (current = ctxp->non_static_initialized; current;
6040 current = TREE_CHAIN (current))
6041 java_method_add_stmt (mdecl,
6042 build_debugable_stmt (EXPR_WFL_LINECOL (current),
6045 end_artificial_method_body (mdecl);
6046 CLASS_HAS_FINIT_P (TREE_TYPE (ctxp->current_parsed_class)) = 1;
6047 ctxp->non_static_initialized = NULL_TREE;
6050 /* Check whether it is necessary to generate a <clinit> for the class
6054 maybe_generate_clinit ()
6058 if (!ctxp->static_initialized || java_error_count)
6061 mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
6062 ACC_STATIC, void_type_node,
6063 clinit_identifier_node, end_params_node);
6064 start_artificial_method_body (mdecl);
6066 /* Keep initialization in order to enforce 8.5 */
6067 ctxp->static_initialized = nreverse (ctxp->static_initialized);
6069 /* We process the list of assignment we produced as the result of
6070 the declaration of initialized static field and add them as
6071 statement to the <clinit> method. */
6072 for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c))
6074 /* We build the assignment expression that will initialize the
6075 field to its value. There are strict rules on static
6076 initializers (8.5). FIXME */
6077 java_method_add_stmt (mdecl,
6078 build_debugable_stmt (EXPR_WFL_LINECOL (c), c));
6081 end_artificial_method_body (mdecl);
6082 ctxp->static_initialized = NULL_TREE;
6085 /* Shared accros method_declarator and method_header to remember the
6086 patch stage that was reached during the declaration of the method.
6087 A method DECL is built differently is there is no patch
6088 (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
6089 pending on the currently defined method. */
6091 static int patch_stage;
6093 /* Check the method declaration and add the method to its current
6094 class. If the argument list is known to contain incomplete types,
6095 the method is partially added and the registration will be resume
6096 once the method arguments resolved. If TYPE is NULL, we're dealing
6097 with a constructor. */
6100 method_header (flags, type, mdecl, throws)
6102 tree type, mdecl, throws;
6104 tree meth = TREE_VALUE (mdecl);
6105 tree id = TREE_PURPOSE (mdecl);
6106 tree type_wfl = NULL_TREE;
6107 tree meth_name = NULL_TREE;
6108 tree current, orig_arg, this_class;
6110 int constructor_ok = 0, must_chain;
6112 check_modifiers_consistency (flags);
6114 if (ctxp->current_parsed_class)
6115 this_class = TREE_TYPE (ctxp->current_parsed_class);
6119 /* There are some forbidden modifiers for an abstract method and its
6120 class must be abstract as well. */
6121 if (type && (flags & ACC_ABSTRACT))
6123 ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private");
6124 ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static");
6125 ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final");
6126 ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native");
6127 ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized");
6128 if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
6129 && !CLASS_INTERFACE (TYPE_NAME (this_class)))
6131 (id, "Class `%s' must be declared abstract to define abstract method `%s'",
6132 IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)),
6133 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
6135 /* Things to be checked when declaring a constructor */
6138 int ec = java_error_count;
6139 /* 8.6: Constructor declarations: we might be trying to define a
6140 method without specifying a return type. */
6141 if (EXPR_WFL_NODE (id) != ctxp->current_parsed_class_un)
6143 (id, "Invalid method declaration, return type required");
6144 /* 8.6.3: Constructor modifiers */
6147 JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract");
6148 JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static");
6149 JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final");
6150 JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native");
6151 JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized");
6153 /* If we found error here, we don't consider it's OK to tread
6154 the method definition as a constructor, for the rest of this
6156 if (ec == java_error_count)
6160 /* Method declared within the scope of an interface are implicitly
6161 abstract and public. Conflicts with other erroneously provided
6162 modifiers are checked right after. */
6164 if (CLASS_INTERFACE (TYPE_NAME (this_class)))
6166 /* If FLAGS isn't set because of a modifier, turn the
6167 corresponding modifier WFL to NULL so we issue a warning on
6168 the obsolete use of the modifier */
6169 if (!(flags & ACC_PUBLIC))
6170 MODIFIER_WFL (PUBLIC_TK) = NULL;
6171 if (!(flags & ACC_ABSTRACT))
6172 MODIFIER_WFL (ABSTRACT_TK) = NULL;
6173 flags |= ACC_PUBLIC;
6174 flags |= ACC_ABSTRACT;
6177 /* Modifiers context reset moved up, so abstract method declaration
6178 modifiers can be later checked. */
6180 /* Set constructor returned type to void and method name to <init>,
6181 unless we found an error identifier the constructor (in which
6182 case we retain the original name) */
6185 type = void_type_node;
6187 meth_name = init_identifier_node;
6190 meth_name = EXPR_WFL_NODE (id);
6192 /* Do the returned type resolution and registration if necessary */
6193 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
6196 type = build_array_from_name (type, type_wfl, meth_name, &meth_name);
6197 EXPR_WFL_NODE (id) = meth_name;
6198 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
6202 patch_stage = JDEP_METHOD_RETURN;
6203 register_incomplete_type (patch_stage, type_wfl, id, type);
6204 TREE_TYPE (meth) = GET_REAL_TYPE (type);
6207 TREE_TYPE (meth) = type;
6209 saved_lineno = lineno;
6210 /* When defining an abstract or interface method, the curly
6211 bracket at level 1 doesn't exist because there is no function
6213 lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
6214 EXPR_WFL_LINENO (id));
6216 /* Remember the original argument list */
6217 orig_arg = TYPE_ARG_TYPES (meth);
6219 if (patch_stage) /* includes ret type and/or all args */
6222 meth = add_method_1 (this_class, flags, meth_name, meth);
6223 /* Patch for the return type */
6224 if (patch_stage == JDEP_METHOD_RETURN)
6226 jdep = CLASSD_LAST (ctxp->classd_list);
6227 JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth));
6229 /* This is the stop JDEP. METH allows the function's signature
6231 register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE);
6234 meth = add_method (this_class, flags, meth_name,
6235 build_java_signature (meth));
6237 /* Fix the method argument list so we have the argument name
6239 fix_method_argument_names (orig_arg, meth);
6241 /* Register the parameter number and re-install the current line
6243 DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1;
6244 lineno = saved_lineno;
6246 /* Register exception specified by the `throws' keyword for
6247 resolution and set the method decl appropriate field to the list.
6248 Note: the grammar ensures that what we get here are class
6252 throws = nreverse (throws);
6253 for (current = throws; current; current = TREE_CHAIN (current))
6255 register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current),
6256 NULL_TREE, NULL_TREE);
6257 JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
6258 &TREE_VALUE (current);
6260 DECL_FUNCTION_THROWS (meth) = throws;
6263 /* We set the DECL_NAME to ID so we can track the location where
6264 the function was declared. This allow us to report
6265 redefinition error accurately. When method are verified,
6266 DECL_NAME is reinstalled properly (using the content of the
6267 WFL node ID) (see check_method_redefinition). We don't do that
6268 when Object is being defined. Constructor <init> names will be
6269 reinstalled the same way. */
6270 if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node)
6271 DECL_NAME (meth) = id;
6273 /* Set the flag if we correctly processed a constructor */
6275 DECL_CONSTRUCTOR_P (meth) = 1;
6277 /* Eventually set the @deprecated tag flag */
6278 CHECK_DEPRECATED (meth);
6280 /* If doing xref, store column and line number information instead
6281 of the line number only. */
6283 DECL_SOURCE_LINE (meth) = EXPR_WFL_LINECOL (id);
6289 fix_method_argument_names (orig_arg, meth)
6290 tree orig_arg, meth;
6292 tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth));
6293 if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE)
6295 TREE_PURPOSE (arg) = this_identifier_node;
6296 arg = TREE_CHAIN (arg);
6298 while (orig_arg != end_params_node)
6300 TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg);
6301 orig_arg = TREE_CHAIN (orig_arg);
6302 arg = TREE_CHAIN (arg);
6306 /* Complete the method declaration with METHOD_BODY. */
6309 finish_method_declaration (method_body)
6314 if (!current_function_decl)
6317 flags = get_access_flags_from_decl (current_function_decl);
6319 /* 8.4.5 Method Body */
6320 if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
6322 tree wfl = DECL_NAME (current_function_decl);
6323 parse_error_context (wfl,
6324 "%s method `%s' can't have a body defined",
6325 (METHOD_NATIVE (current_function_decl) ?
6326 "Native" : "Abstract"),
6327 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
6328 method_body = NULL_TREE;
6330 else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body)
6332 tree wfl = DECL_NAME (current_function_decl);
6335 "Non native and non abstract method `%s' must have a body defined",
6336 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
6337 method_body = NULL_TREE;
6340 if (flag_emit_class_files && method_body
6341 && TREE_CODE (method_body) == NOP_EXPR
6342 && TREE_TYPE (current_function_decl)
6343 && TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node)
6344 method_body = build1 (RETURN_EXPR, void_type_node, NULL);
6346 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body;
6347 maybe_absorb_scoping_blocks ();
6348 /* Exit function's body */
6350 /* Merge last line of the function with first line, directly in the
6351 function decl. It will be used to emit correct debug info. */
6352 if (!flag_emit_xref)
6353 DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1);
6354 /* So we don't have an irrelevant function declaration context for
6355 the next static block we'll see. */
6356 current_function_decl = NULL_TREE;
6359 /* Build a an error message for constructor circularity errors. */
6362 constructor_circularity_msg (from, to)
6365 static char string [4096];
6366 char *t = xstrdup (lang_printable_name (from, 0));
6367 sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
6372 /* Verify a circular call to METH. Return 1 if an error is found, 0
6376 verify_constructor_circularity (meth, current)
6379 static tree list = NULL_TREE;
6381 for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
6383 if (TREE_VALUE (c) == meth)
6389 list = nreverse (list);
6390 for (liste = list; liste; liste = TREE_CHAIN (liste))
6393 (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
6394 constructor_circularity_msg
6395 (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
6399 t = xstrdup (lang_printable_name (meth, 0));
6400 parse_error_context (TREE_PURPOSE (c),
6401 "%s: recursive invocation of constructor `%s'",
6402 constructor_circularity_msg (current, meth), t);
6408 for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
6410 list = tree_cons (c, current, list);
6411 if (verify_constructor_circularity (meth, TREE_VALUE (c)))
6413 list = TREE_CHAIN (list);
6418 /* Check modifiers that can be declared but exclusively */
6421 check_modifiers_consistency (flags)
6425 tree cl = NULL_TREE;
6427 THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl);
6428 THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl);
6429 THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl);
6432 (cl, "Inconsistent member declaration. At most one of `public', `private', or `protected' may be specified");
6435 /* Check the methode header METH for abstract specifics features */
6438 check_abstract_method_header (meth)
6441 int flags = get_access_flags_from_decl (meth);
6442 /* DECL_NAME might still be a WFL node */
6443 tree name = GET_METHOD_NAME (meth);
6445 OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags,
6446 ACC_ABSTRACT, "abstract method",
6447 IDENTIFIER_POINTER (name));
6448 OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags,
6449 ACC_PUBLIC, "abstract method",
6450 IDENTIFIER_POINTER (name));
6452 check_modifiers ("Illegal modifier `%s' for interface method",
6453 flags, INTERFACE_METHOD_MODIFIERS);
6456 /* Create a FUNCTION_TYPE node and start augmenting it with the
6457 declared function arguments. Arguments type that can't be resolved
6458 are left as they are, but the returned node is marked as containing
6459 incomplete types. */
6462 method_declarator (id, list)
6465 tree arg_types = NULL_TREE, current, node;
6466 tree meth = make_node (FUNCTION_TYPE);
6469 patch_stage = JDEP_NO_PATCH;
6471 for (current = list; current; current = TREE_CHAIN (current))
6474 tree wfl_name = TREE_PURPOSE (current);
6475 tree type = TREE_VALUE (current);
6476 tree name = EXPR_WFL_NODE (wfl_name);
6477 tree already, arg_node;
6478 tree type_wfl = NULL_TREE;
6481 /* Obtain a suitable type for resolution, if necessary */
6482 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
6484 /* Process NAME, as it may specify extra dimension(s) for it */
6485 type = build_array_from_name (type, type_wfl, name, &name);
6486 EXPR_WFL_NODE (wfl_name) = name;
6488 real_type = GET_REAL_TYPE (type);
6489 if (TREE_CODE (real_type) == RECORD_TYPE)
6491 real_type = promote_type (real_type);
6492 if (TREE_CODE (type) == TREE_LIST)
6493 TREE_PURPOSE (type) = real_type;
6496 /* Check redefinition */
6497 for (already = arg_types; already; already = TREE_CHAIN (already))
6498 if (TREE_PURPOSE (already) == name)
6501 (wfl_name, "Variable `%s' is used more than once in the argument list of method `%s'",
6502 IDENTIFIER_POINTER (name),
6503 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
6507 /* If we've an incomplete argument type, we know there is a location
6508 to patch when the type get resolved, later. */
6512 patch_stage = JDEP_METHOD;
6513 type = register_incomplete_type (patch_stage,
6514 type_wfl, wfl_name, type);
6515 jdep = CLASSD_LAST (ctxp->classd_list);
6516 JDEP_MISC (jdep) = id;
6519 /* The argument node: a name and a (possibly) incomplete type */
6520 arg_node = build_tree_list (name, real_type);
6522 JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node);
6523 TREE_CHAIN (arg_node) = arg_types;
6524 arg_types = arg_node;
6526 TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node);
6527 node = build_tree_list (id, meth);
6532 unresolved_type_p (wfl, returned)
6537 if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
6539 tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
6541 *returned = (decl ? TREE_TYPE (decl) : NULL_TREE);
6549 /* From NAME, build a qualified identifier node using the
6550 qualification from the current package definition. */
6553 parser_qualified_classname (name)
6557 return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name));
6559 return EXPR_WFL_NODE (name);
6562 /* Called once the type a interface extends is resolved. Returns 0 if
6563 everything is OK. */
6566 parser_check_super_interface (super_decl, this_decl, this_wfl)
6567 tree super_decl, this_decl, this_wfl;
6569 tree super_type = TREE_TYPE (super_decl);
6571 /* Has to be an interface */
6572 if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl))))
6575 (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'",
6576 (TYPE_ARRAY_P (super_type) ? "array" : "class"),
6577 IDENTIFIER_POINTER (DECL_NAME (super_decl)),
6578 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
6579 "interface" : "class"),
6580 IDENTIFIER_POINTER (DECL_NAME (this_decl)));
6584 /* Check scope: same package OK, other package: OK if public */
6585 if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl)))
6588 SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
6589 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6590 IDENTIFIER_POINTER (DECL_NAME (super_decl))));
6594 /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
6595 0 if everthing is OK. */
6598 parser_check_super (super_decl, this_decl, wfl)
6599 tree super_decl, this_decl, wfl;
6601 tree super_type = TREE_TYPE (super_decl);
6603 /* SUPER should be a CLASS (neither an array nor an interface) */
6604 if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type)))
6607 (wfl, "Class `%s' can't subclass %s `%s'",
6608 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6609 (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"),
6610 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
6614 if (CLASS_FINAL (TYPE_NAME (super_type)))
6616 parse_error_context (wfl, "Can't subclass final classes: %s",
6617 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
6621 /* Check scope: same package OK, other package: OK if public */
6622 if (check_pkg_class_access (DECL_NAME (super_decl), wfl))
6625 SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
6626 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6627 IDENTIFIER_POINTER (DECL_NAME (super_decl))));
6631 /* Create a new dependency list and link it (in a LIFO manner) to the
6632 CTXP list of type dependency list. */
6635 create_jdep_list (ctxp)
6636 struct parser_ctxt *ctxp;
6638 jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist));
6639 new->first = new->last = NULL;
6640 new->next = ctxp->classd_list;
6641 ctxp->classd_list = new;
6645 reverse_jdep_list (ctxp)
6646 struct parser_ctxt *ctxp;
6648 register jdeplist *prev = NULL, *current, *next;
6649 for (current = ctxp->classd_list; current; current = next)
6651 next = current->next;
6652 current->next = prev;
6658 /* Create a fake pointer based on the ID stored in
6659 TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
6660 registered again. */
6663 obtain_incomplete_type (type_name)
6668 if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION)
6669 name = EXPR_WFL_NODE (type_name);
6670 else if (INCOMPLETE_TYPE_P (type_name))
6671 name = TYPE_NAME (type_name);
6673 fatal ("invalid type name - obtain_incomplete_type");
6675 for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr))
6676 if (TYPE_NAME (ptr) == name)
6681 push_obstacks (&permanent_obstack, &permanent_obstack);
6682 BUILD_PTR_FROM_NAME (ptr, name);
6685 TREE_CHAIN (ptr) = ctxp->incomplete_class;
6686 ctxp->incomplete_class = ptr;
6692 /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
6693 non NULL instead of computing a new fake type based on WFL. The new
6694 dependency is inserted in the current type dependency list, in FIFO
6698 register_incomplete_type (kind, wfl, decl, ptr)
6700 tree wfl, decl, ptr;
6702 jdep *new = (jdep *)xmalloc (sizeof (jdep));
6704 if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */
6705 ptr = obtain_incomplete_type (wfl);
6707 JDEP_KIND (new) = kind;
6708 JDEP_DECL (new) = decl;
6709 JDEP_SOLV (new) = ptr;
6710 JDEP_WFL (new) = wfl;
6711 JDEP_CHAIN (new) = NULL;
6712 JDEP_MISC (new) = NULL_TREE;
6713 JDEP_GET_PATCH (new) = (tree *)NULL;
6715 JDEP_INSERT (ctxp->classd_list, new);
6721 java_check_circular_reference ()
6724 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
6726 tree type = TREE_TYPE (current);
6727 if (CLASS_INTERFACE (current))
6729 /* Check all interfaces this class extends */
6730 tree basetype_vec = TYPE_BINFO_BASETYPES (type);
6735 n = TREE_VEC_LENGTH (basetype_vec);
6736 for (i = 0; i < n; i++)
6738 tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
6739 if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node
6740 && interface_of_p (type, BINFO_TYPE (vec_elt)))
6741 parse_error_context (lookup_cl (current),
6742 "Cyclic interface inheritance");
6746 if (inherits_from_p (CLASSTYPE_SUPER (type), type))
6747 parse_error_context (lookup_cl (current),
6748 "Cyclic class inheritance");
6752 /* Fix the constructors. This will be called right after circular
6753 references have been checked. It is necessary to fix constructors
6754 early even if no code generation will take place for that class:
6755 some generated constructor might be required by the class whose
6756 compilation triggered this one to be simply loaded. */
6759 java_fix_constructors ()
6763 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
6766 tree class_type = TREE_TYPE (current);
6769 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
6771 if (DECL_CONSTRUCTOR_P (decl))
6773 fix_constructors (decl);
6780 int flags = (get_access_flags_from_decl (current) & ACC_PUBLIC ?
6782 decl = create_artificial_method (class_type, flags, void_type_node,
6783 init_identifier_node,
6785 DECL_CONSTRUCTOR_P (decl) = 1;
6790 /* safe_layout_class just makes sure that we can load a class without
6791 disrupting the current_class, input_file, lineno, etc, information
6792 about the class processed currently. */
6795 safe_layout_class (class)
6798 tree save_current_class = current_class;
6799 char *save_input_filename = input_filename;
6800 int save_lineno = lineno;
6802 push_obstacks (&permanent_obstack, &permanent_obstack);
6804 layout_class (class);
6807 current_class = save_current_class;
6808 input_filename = save_input_filename;
6809 lineno = save_lineno;
6810 CLASS_LOADED_P (class) = 1;
6814 jdep_resolve_class (dep)
6819 if (JDEP_RESOLVED_P (dep))
6820 decl = JDEP_RESOLVED_DECL (dep);
6823 decl = resolve_class (JDEP_TO_RESOLVE (dep),
6824 JDEP_DECL (dep), JDEP_WFL (dep));
6825 JDEP_RESOLVED (dep, decl);
6829 complete_class_report_errors (dep);
6834 /* Complete unsatisfied class declaration and their dependencies */
6837 java_complete_class ()
6844 push_obstacks (&permanent_obstack, &permanent_obstack);
6846 /* Process imports and reverse the import on demand list */
6848 if (ctxp->import_demand_list)
6849 ctxp->import_demand_list = nreverse (ctxp->import_demand_list);
6851 /* Rever things so we have the right order */
6852 ctxp->class_list = nreverse (ctxp->class_list);
6853 ctxp->classd_list = reverse_jdep_list (ctxp);
6855 for (cclassd = ctxp->classd_list, cclass = ctxp->class_list;
6857 cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd))
6860 for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep))
6863 if (!(decl = jdep_resolve_class (dep)))
6866 /* Now it's time to patch */
6867 switch (JDEP_KIND (dep))
6870 /* Simply patch super */
6871 if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
6873 BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
6874 (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
6879 /* We do part of the job done in add_field */
6880 tree field_decl = JDEP_DECL (dep);
6881 tree field_type = TREE_TYPE (decl);
6882 push_obstacks (&permanent_obstack, &permanent_obstack);
6883 if (TREE_CODE (field_type) == RECORD_TYPE)
6884 field_type = promote_type (field_type);
6886 TREE_TYPE (field_decl) = field_type;
6887 DECL_ALIGN (field_decl) = 0;
6888 layout_decl (field_decl, 0);
6889 SOURCE_FRONTEND_DEBUG
6890 (("Completed field/var decl `%s' with `%s'",
6891 IDENTIFIER_POINTER (DECL_NAME (field_decl)),
6892 IDENTIFIER_POINTER (DECL_NAME (decl))));
6895 case JDEP_METHOD: /* We start patching a method */
6896 case JDEP_METHOD_RETURN:
6902 type = TREE_TYPE(decl);
6903 if (TREE_CODE (type) == RECORD_TYPE)
6904 type = promote_type (type);
6905 JDEP_APPLY_PATCH (dep, type);
6906 SOURCE_FRONTEND_DEBUG
6907 (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ?
6908 "Completing fct `%s' with ret type `%s'":
6909 "Completing arg `%s' with type `%s'"),
6910 IDENTIFIER_POINTER (EXPR_WFL_NODE
6911 (JDEP_DECL_WFL (dep))),
6912 IDENTIFIER_POINTER (DECL_NAME (decl))));
6916 dep = JDEP_CHAIN (dep);
6917 if (JDEP_KIND (dep) == JDEP_METHOD_END)
6920 decl = jdep_resolve_class (dep);
6924 tree mdecl = JDEP_DECL (dep), signature;
6925 push_obstacks (&permanent_obstack, &permanent_obstack);
6926 /* Recompute and reset the signature */
6927 signature = build_java_signature (TREE_TYPE (mdecl));
6928 set_java_signature (TREE_TYPE (mdecl), signature);
6935 case JDEP_INTERFACE:
6936 if (parser_check_super_interface (decl, JDEP_DECL (dep),
6939 parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep));
6944 type = TREE_TYPE(decl);
6945 if (TREE_CODE (type) == RECORD_TYPE)
6946 type = promote_type (type);
6947 JDEP_APPLY_PATCH (dep, type);
6951 JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
6952 SOURCE_FRONTEND_DEBUG
6953 (("Completing a random type dependency on a '%s' node",
6954 tree_code_name [TREE_CODE (JDEP_DECL (dep))]));
6957 case JDEP_EXCEPTION:
6958 JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
6959 SOURCE_FRONTEND_DEBUG
6960 (("Completing `%s' `throws' argument node",
6961 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))));
6965 fatal ("Can't handle patch code %d - java_complete_class",
6974 /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
6978 resolve_class (class_type, decl, cl)
6979 tree class_type, decl, cl;
6981 const char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type));
6982 const char *base = name;
6983 tree resolved_type = TREE_TYPE (class_type);
6984 tree resolved_type_decl;
6986 if (resolved_type != NULL_TREE)
6988 tree resolved_type_decl = TYPE_NAME (resolved_type);
6989 if (resolved_type_decl == NULL_TREE
6990 || TREE_CODE (resolved_type_decl) == IDENTIFIER_NODE)
6992 resolved_type_decl = build_decl (TYPE_DECL,
6993 TYPE_NAME (class_type),
6996 return resolved_type_decl;
6999 /* 1- Check to see if we have an array. If true, find what we really
7001 while (name[0] == '[')
7004 TYPE_NAME (class_type) = get_identifier (name);
7006 /* 2- Resolve the bare type */
7007 if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl)))
7009 resolved_type = TREE_TYPE (resolved_type_decl);
7011 /* 3- If we have and array, reconstruct the array down to its nesting */
7014 while (base != name)
7016 if (TREE_CODE (resolved_type) == RECORD_TYPE)
7017 resolved_type = promote_type (resolved_type);
7018 resolved_type = build_java_array_type (resolved_type, -1);
7019 CLASS_LOADED_P (resolved_type) = 1;
7022 /* Build a fake decl for this, since this is what is expected to
7024 resolved_type_decl =
7025 build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type);
7026 /* Figure how those two things are important for error report. FIXME */
7027 DECL_SOURCE_LINE (resolved_type_decl) = 0;
7028 DECL_SOURCE_FILE (resolved_type_decl) = input_filename;
7029 TYPE_NAME (class_type) = TYPE_NAME (resolved_type);
7031 TREE_TYPE (class_type) = resolved_type;
7032 return resolved_type_decl;
7035 /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
7036 are used to report error messages. */
7039 do_resolve_class (class_type, decl, cl)
7044 tree new_class_decl;
7045 tree original_name = NULL_TREE;
7047 /* Do not try to replace TYPE_NAME (class_type) by a variable, since
7048 its is changed by find_in_imports{_on_demand} */
7050 /* 1- Check for the type in single imports */
7051 if (find_in_imports (class_type))
7054 /* 2- And check for the type in the current compilation unit. If it fails,
7055 try with a name qualified with the package name we've seen so far */
7056 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
7058 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
7059 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
7060 load_class (TYPE_NAME (class_type), 0);
7061 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7064 original_name = TYPE_NAME (class_type);
7065 if (!QUALIFIED_P (TYPE_NAME (class_type)))
7068 for (package = package_list; package; package = TREE_CHAIN (package))
7072 new_qualified = merge_qualified_name (TREE_PURPOSE (package),
7074 TYPE_NAME (class_type) = new_qualified;
7075 new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7076 if (!new_class_decl)
7077 load_class (TYPE_NAME (class_type), 0);
7078 new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7081 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
7082 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
7083 load_class (TYPE_NAME (class_type), 0);
7084 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7088 TYPE_NAME (class_type) = original_name;
7090 /* 3- Check an other compilation unit that bears the name of type */
7091 load_class (TYPE_NAME (class_type), 0);
7092 if (check_pkg_class_access (TYPE_NAME (class_type),
7093 (cl ? cl : lookup_cl (decl))))
7096 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
7097 return new_class_decl;
7099 /* 4- Check the import on demands. Don't allow bar.baz to be
7100 imported from foo.* */
7101 if (!QUALIFIED_P (TYPE_NAME (class_type)))
7102 if (find_in_imports_on_demand (class_type))
7105 /* 5- Last call for a resolution */
7106 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7109 /* Resolve NAME and lay it out (if not done and if not the current
7110 parsed class). Return a decl node. This function is meant to be
7111 called when type resolution is necessary during the walk pass. */
7114 resolve_and_layout (something, cl)
7120 /* Don't do that on the current class */
7121 if (something == current_class)
7122 return TYPE_NAME (current_class);
7124 /* Don't do anything for void and other primitive types */
7125 if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
7128 /* Pointer types can be reall pointer types or fake pointers. When
7129 finding a real pointer, recheck for primitive types */
7130 if (TREE_CODE (something) == POINTER_TYPE)
7132 if (TREE_TYPE (something))
7134 something = TREE_TYPE (something);
7135 if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
7139 something = TYPE_NAME (something);
7142 /* Don't do anything for arrays of primitive types */
7143 if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something)
7144 && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something)))
7147 /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
7149 if (TREE_CODE (something) != IDENTIFIER_NODE)
7150 something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ?
7151 DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something));
7153 if (!(decl = resolve_no_layout (something, cl)))
7156 /* Resolve and layout if necessary */
7157 layout_class_methods (TREE_TYPE (decl));
7158 /* Check methods, but only once */
7159 if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl))
7160 && !CLASS_LOADED_P (TREE_TYPE (decl)))
7161 CHECK_METHODS (decl);
7162 if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
7163 safe_layout_class (TREE_TYPE (decl));
7168 /* Resolve a class, returns its decl but doesn't perform any
7169 layout. The current parsing context is saved and restored */
7172 resolve_no_layout (name, cl)
7176 BUILD_PTR_FROM_NAME (ptr, name);
7177 java_parser_context_save_global ();
7178 decl = resolve_class (ptr, NULL_TREE, cl);
7179 java_parser_context_restore_global ();
7184 /* Called when reporting errors. Skip leader '[' in a complex array
7185 type description that failed to be resolved. */
7188 purify_type_name (name)
7191 while (*name && *name == '[')
7196 /* The type CURRENT refers to can't be found. We print error messages. */
7199 complete_class_report_errors (dep)
7204 if (!JDEP_WFL (dep))
7207 name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)));
7208 switch (JDEP_KIND (dep))
7212 (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found",
7213 purify_type_name (name),
7214 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7218 (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'",
7219 purify_type_name (name),
7220 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7222 case JDEP_METHOD: /* Covers arguments */
7224 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the argument `%s' of method `%s'",
7225 purify_type_name (name),
7226 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))),
7227 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep))));
7229 case JDEP_METHOD_RETURN: /* Covers return type */
7231 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the return type of method `%s'",
7232 purify_type_name (name),
7233 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
7235 case JDEP_INTERFACE:
7237 (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found",
7238 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
7239 (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")),
7240 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7244 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the local variable `%s'",
7245 purify_type_name (IDENTIFIER_POINTER
7246 (EXPR_WFL_NODE (JDEP_WFL (dep)))),
7247 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7249 case JDEP_EXCEPTION: /* As specified by `throws' */
7251 (JDEP_WFL (dep), "Class `%s' not found in `throws'",
7252 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))));
7255 /* Fix for -Wall. Just break doing nothing. The error will be
7261 /* Check uninitialized final. */
7268 /* Return a static string containing the DECL prototype string. If
7269 DECL is a constructor, use the class name instead of the form
7273 get_printable_method_name (decl)
7276 const char *to_return;
7277 tree name = NULL_TREE;
7279 if (DECL_CONSTRUCTOR_P (decl))
7281 name = DECL_NAME (decl);
7282 DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
7285 to_return = lang_printable_name (decl, 0);
7286 if (DECL_CONSTRUCTOR_P (decl))
7287 DECL_NAME (decl) = name;
7292 /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
7293 nevertheless needs to be verfied, 1 otherwise. */
7296 reset_method_name (method)
7299 if (!IS_CLINIT (method) && DECL_NAME (method) != finit_identifier_node)
7301 /* NAME is just the plain name when Object is being defined */
7302 if (DECL_CONTEXT (method) != object_type_node)
7303 DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ?
7304 init_identifier_node : GET_METHOD_NAME (method));
7311 /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
7314 java_get_real_method_name (method_decl)
7317 tree method_name = DECL_NAME (method_decl);
7318 if (DECL_CONSTRUCTOR_P (method_decl))
7319 return init_identifier_node;
7321 /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
7322 and still can be a constructor. FIXME */
7324 /* Don't confuse method only bearing the name of their class as
7326 else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl))
7328 && ctxp->current_parsed_class_un == EXPR_WFL_NODE (method_name)
7329 && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED
7330 && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node)
7331 return init_identifier_node;
7333 return EXPR_WFL_NODE (method_name);
7336 /* Track method being redefined inside the same class. As a side
7337 effect, set DECL_NAME to an IDENTIFIER (prior entering this
7338 function it's a FWL, so we can track errors more accurately.) */
7341 check_method_redefinition (class, method)
7345 tree cl = DECL_NAME (method);
7346 tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
7347 /* decl name of artificial <clinit> and $finit$ doesn't need to be
7348 fixed and checked */
7350 /* Reset the method name before running the check. If it returns 1,
7351 the method doesn't need to be verified with respect to method
7352 redeclaration and we return 0 */
7353 if (reset_method_name (method))
7356 name = DECL_NAME (method);
7357 for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
7359 if (redef == method)
7361 if (DECL_NAME (redef) == name
7362 && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef)))
7365 (cl, "Duplicate %s declaration `%s'",
7366 (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
7367 get_printable_method_name (redef));
7375 check_abstract_method_definitions (do_interface, class_decl, type)
7377 tree class_decl, type;
7379 tree class = TREE_TYPE (class_decl);
7380 tree method, end_type;
7382 end_type = (do_interface ? object_type_node : type);
7383 for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
7385 tree other_super, other_method, method_sig, method_name;
7388 if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
7391 /* Now verify that somewhere in between TYPE and CLASS,
7392 abstract method METHOD gets a non abstract definition
7393 that is inherited by CLASS. */
7395 method_sig = build_java_signature (TREE_TYPE (method));
7396 method_name = DECL_NAME (method);
7397 if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
7398 method_name = EXPR_WFL_NODE (method_name);
7400 for (other_super = class; other_super != end_type;
7401 other_super = CLASSTYPE_SUPER (other_super))
7403 for (other_method = TYPE_METHODS (other_super); other_method;
7404 other_method = TREE_CHAIN (other_method))
7406 tree s = build_java_signature (TREE_TYPE (other_method));
7407 tree other_name = DECL_NAME (other_method);
7409 if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
7410 other_name = EXPR_WFL_NODE (other_name);
7411 if (!IS_CLINIT (other_method)
7412 && !DECL_CONSTRUCTOR_P (other_method)
7413 && method_name == other_name && method_sig == s)
7421 /* Report that abstract METHOD didn't find an implementation
7422 that CLASS can use. */
7425 char *t = xstrdup (lang_printable_name
7426 (TREE_TYPE (TREE_TYPE (method)), 0));
7427 tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
7428 tree saved_wfl = NULL_TREE;
7430 if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION)
7432 saved_wfl = DECL_NAME (method);
7433 DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method));
7437 (lookup_cl (class_decl),
7438 "Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract",
7439 IDENTIFIER_POINTER (DECL_NAME (class_decl)),
7440 t, lang_printable_name (method, 0),
7441 (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
7442 "interface" : "class"),
7443 IDENTIFIER_POINTER (ccn),
7444 (CLASS_INTERFACE (class_decl) ? "interface" : "class"),
7445 IDENTIFIER_POINTER (DECL_NAME (class_decl)));
7450 DECL_NAME (method) = saved_wfl;
7455 /* Check that CLASS_DECL somehow implements all inherited abstract
7459 java_check_abstract_method_definitions (class_decl)
7462 tree class = TREE_TYPE (class_decl);
7466 if (CLASS_ABSTRACT (class_decl))
7469 /* Check for inherited types */
7470 for (super = CLASSTYPE_SUPER (class); super != object_type_node;
7471 super = CLASSTYPE_SUPER (super))
7473 if (!CLASS_ABSTRACT (TYPE_NAME (super)))
7476 check_abstract_method_definitions (0, class_decl, super);
7479 /* Check for implemented interfaces. */
7480 vector = TYPE_BINFO_BASETYPES (class);
7481 for (i = 1; i < TREE_VEC_LENGTH (vector); i++)
7483 super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
7484 check_abstract_method_definitions (1, class_decl, super);
7488 /* Check all the methods of CLASS_DECL. Methods are first completed
7489 then checked according to regular method existance rules. If no
7490 constructor for CLASS_DECL were encountered, then build its
7494 java_check_regular_methods (class_decl)
7497 int saw_constructor = 0;
7499 tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl));
7500 tree saved_found_wfl = NULL_TREE, found = NULL_TREE;
7503 /* It is not necessary to check methods defined in java.lang.Object */
7504 if (class == object_type_node)
7507 if (!TYPE_NVIRTUALS (class))
7508 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7510 /* Should take interfaces into account. FIXME */
7511 for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method))
7514 tree method_wfl = DECL_NAME (method);
7517 /* If we previously found something and its name was saved,
7519 if (found && saved_found_wfl)
7521 DECL_NAME (found) = saved_found_wfl;
7522 saved_found_wfl = NULL_TREE;
7525 /* Check for redefinitions */
7526 if (check_method_redefinition (class, method))
7529 /* If we see one constructor a mark so we don't generate the
7530 default one. Also skip other verifications: constructors
7531 can't be inherited hence hiden or overriden */
7532 if (DECL_CONSTRUCTOR_P (method))
7534 saw_constructor = 1;
7538 /* We verify things thrown by the method. They must inherits from
7539 java.lang.Throwable */
7540 for (mthrows = DECL_FUNCTION_THROWS (method);
7541 mthrows; mthrows = TREE_CHAIN (mthrows))
7543 if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node))
7545 (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be a subclass of class `java.lang.Throwable'",
7547 (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
7550 sig = build_java_argument_signature (TREE_TYPE (method));
7551 found = lookup_argument_method2 (class, DECL_NAME (method), sig);
7553 /* Nothing overrides or it's a private method. */
7556 if (METHOD_PRIVATE (found))
7562 /* If found wasn't verified, it's DECL_NAME won't be set properly.
7563 We set it temporarily for the sake of the error report. */
7564 saved_found_wfl = DECL_NAME (found);
7565 reset_method_name (found);
7567 /* If `found' is declared in an interface, make sure the
7568 modifier matches. */
7569 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
7570 && clinit_identifier_node != DECL_NAME (found)
7571 && !METHOD_PUBLIC (method))
7573 tree found_decl = TYPE_NAME (DECL_CONTEXT (found));
7574 parse_error_context (method_wfl, "Class `%s' must override `%s' with a public method in order to implement interface `%s'",
7575 IDENTIFIER_POINTER (DECL_NAME (class_decl)),
7576 lang_printable_name (method, 0),
7577 IDENTIFIER_POINTER (DECL_NAME (found_decl)));
7580 /* Can't override a method with the same name and different return
7582 if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
7585 (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
7588 "Method `%s' was defined with return type `%s' in class `%s'",
7589 lang_printable_name (found, 0), t,
7591 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7595 aflags = get_access_flags_from_decl (found);
7596 /* If the method has default, access in an other package, then
7597 issue a warning that the current method doesn't override the
7598 one that was found elsewhere. Do not issue this warning when
7599 the match was found in java.lang.Object. */
7600 if (DECL_CONTEXT (found) != object_type_node
7601 && ((aflags & ACC_VISIBILITY) == 0)
7602 && !class_in_current_package (DECL_CONTEXT (found))
7603 && DECL_NAME (found) != clinit_identifier_node
7604 && flag_not_overriding)
7606 parse_warning_context
7607 (method_wfl, "Method `%s' in class `%s' does not override the corresponding method in class `%s', which is private to a different package",
7608 lang_printable_name (found, 0),
7609 IDENTIFIER_POINTER (DECL_NAME (class_decl)),
7610 IDENTIFIER_POINTER (DECL_NAME
7611 (TYPE_NAME (DECL_CONTEXT (found)))));
7615 /* Can't override final. Can't override static. */
7616 if (METHOD_FINAL (found) || METHOD_STATIC (found))
7618 /* Static *can* override static */
7619 if (METHOD_STATIC (found) && METHOD_STATIC (method))
7623 "%s methods can't be overriden. Method `%s' is %s in class `%s'",
7624 (METHOD_FINAL (found) ? "Final" : "Static"),
7625 lang_printable_name (found, 0),
7626 (METHOD_FINAL (found) ? "final" : "static"),
7628 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7632 /* Static method can't override instance method. */
7633 if (METHOD_STATIC (method))
7637 "Instance methods can't be overriden by a static method. Method `%s' is an instance method in class `%s'",
7638 lang_printable_name (found, 0),
7640 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7644 /* - Overriding/hiding public must be public
7645 - Overriding/hiding protected must be protected or public
7646 - If the overriden or hidden method has default (package)
7647 access, then the overriding or hiding method must not be
7648 private; otherwise, a compile-time error occurs. If
7649 `found' belongs to an interface, things have been already
7651 if (!CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
7652 && ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method))
7653 || (METHOD_PROTECTED (found)
7654 && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method)))
7655 || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC))
7656 && METHOD_PRIVATE (method))))
7660 "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 0),
7661 (METHOD_PUBLIC (method) ? "public" :
7662 (METHOD_PRIVATE (method) ? "private" : "protected")),
7663 IDENTIFIER_POINTER (DECL_NAME
7664 (TYPE_NAME (DECL_CONTEXT (found)))));
7668 /* Overriding methods must have compatible `throws' clauses on checked
7669 exceptions, if any */
7670 check_throws_clauses (method, method_wfl, found);
7672 /* Inheriting multiple methods with the same signature. FIXME */
7675 /* Don't forget eventual pending found and saved_found_wfl. Take
7676 into account that we might have exited because we saw an
7677 artificial method as the last entry. */
7679 if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
7680 DECL_NAME (found) = saved_found_wfl;
7682 if (!TYPE_NVIRTUALS (class))
7683 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7685 /* Search for inherited abstract method not yet implemented in this
7687 java_check_abstract_method_definitions (class_decl);
7689 if (!saw_constructor)
7690 fatal ("No constructor found");
7693 /* Return a non zero value if the `throws' clause of METHOD (if any)
7694 is incompatible with the `throws' clause of FOUND (if any). */
7697 check_throws_clauses (method, method_wfl, found)
7698 tree method, method_wfl, found;
7700 tree mthrows, fthrows;
7702 /* Can't check these things with class loaded from bytecode. FIXME */
7703 if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found)))
7706 for (mthrows = DECL_FUNCTION_THROWS (method);
7707 mthrows; mthrows = TREE_CHAIN (mthrows))
7709 /* We don't verify unchecked expressions */
7710 if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows)))
7712 /* Checked expression must be compatible */
7713 for (fthrows = DECL_FUNCTION_THROWS (found);
7714 fthrows; fthrows = TREE_CHAIN (fthrows))
7715 if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows)))
7720 (method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'",
7721 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
7722 lang_printable_name (found, 0),
7724 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7729 /* Check abstract method of interface INTERFACE */
7732 java_check_abstract_methods (interface_decl)
7733 tree interface_decl;
7736 tree method, basetype_vec, found;
7737 tree interface = TREE_TYPE (interface_decl);
7739 for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method))
7741 tree method_wfl = DECL_NAME (method);
7743 /* 2- Check for double definition inside the defining interface */
7744 if (check_method_redefinition (interface, method))
7747 /* 3- Overriding is OK as far as we preserve the return type and
7748 the thrown exceptions (FIXME) */
7749 found = lookup_java_interface_method2 (interface, method);
7753 tree saved_found_wfl = DECL_NAME (found);
7754 reset_method_name (found);
7755 t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
7758 "Method `%s' was defined with return type `%s' in class `%s'",
7759 lang_printable_name (found, 0), t,
7761 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7763 DECL_NAME (found) = saved_found_wfl;
7768 /* 4- Inherited methods can't differ by their returned types */
7769 if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface)))
7771 n = TREE_VEC_LENGTH (basetype_vec);
7772 for (i = 0; i < n; i++)
7774 tree sub_interface_method, sub_interface;
7775 tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
7778 sub_interface = BINFO_TYPE (vec_elt);
7779 for (sub_interface_method = TYPE_METHODS (sub_interface);
7780 sub_interface_method;
7781 sub_interface_method = TREE_CHAIN (sub_interface_method))
7783 found = lookup_java_interface_method2 (interface,
7784 sub_interface_method);
7785 if (found && (found != sub_interface_method))
7787 tree saved_found_wfl = DECL_NAME (found);
7788 reset_method_name (found);
7790 (lookup_cl (sub_interface_method),
7791 "Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'",
7792 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
7793 lang_printable_name (found, 0),
7795 (DECL_NAME (TYPE_NAME
7796 (DECL_CONTEXT (sub_interface_method)))),
7798 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7799 DECL_NAME (found) = saved_found_wfl;
7805 /* Lookup methods in interfaces using their name and partial
7806 signature. Return a matching method only if their types differ. */
7809 lookup_java_interface_method2 (class, method_decl)
7810 tree class, method_decl;
7813 tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return;
7818 n = TREE_VEC_LENGTH (basetype_vec);
7819 for (i = 0; i < n; i++)
7821 tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return;
7822 if ((BINFO_TYPE (vec_elt) != object_type_node)
7824 lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1)))
7827 for (i = 0; i < n; i++)
7829 to_return = lookup_java_interface_method2
7830 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl);
7838 /* Lookup method using their name and partial signature. Return a
7839 matching method only if their types differ. */
7842 lookup_java_method2 (clas, method_decl, do_interface)
7843 tree clas, method_decl;
7846 tree method, method_signature, method_name, method_type, name;
7848 method_signature = build_java_argument_signature (TREE_TYPE (method_decl));
7849 name = DECL_NAME (method_decl);
7850 method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
7851 EXPR_WFL_NODE (name) : name);
7852 method_type = TREE_TYPE (TREE_TYPE (method_decl));
7854 while (clas != NULL_TREE)
7856 for (method = TYPE_METHODS (clas);
7857 method != NULL_TREE; method = TREE_CHAIN (method))
7859 tree method_sig = build_java_argument_signature (TREE_TYPE (method));
7860 tree name = DECL_NAME (method);
7861 if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
7862 EXPR_WFL_NODE (name) : name) == method_name
7863 && method_sig == method_signature
7864 && TREE_TYPE (TREE_TYPE (method)) != method_type)
7867 clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas));
7872 /* Return the line that matches DECL line number, and try its best to
7873 position the column number. Used during error reports. */
7879 static tree cl = NULL_TREE;
7885 if (cl == NULL_TREE)
7886 cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
7888 EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
7889 EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
7891 line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)),
7892 EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl));
7894 found = strstr ((const char *)line,
7895 (const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
7897 EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line);
7902 /* Look for a simple name in the single-type import list */
7905 find_name_in_single_imports (name)
7910 for (node = ctxp->import_list; node; node = TREE_CHAIN (node))
7911 if (TREE_VALUE (node) == name)
7912 return (EXPR_WFL_NODE (TREE_PURPOSE (node)));
7917 /* Process all single-type import. */
7925 for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
7927 tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
7929 /* Don't load twice something already defined. */
7930 if (IDENTIFIER_CLASS_VALUE (to_be_found))
7932 QUALIFIED_P (to_be_found) = 1;
7933 load_class (to_be_found, 0);
7935 check_pkg_class_access (to_be_found, TREE_PURPOSE (import));
7936 if (!IDENTIFIER_CLASS_VALUE (to_be_found))
7938 parse_error_context (TREE_PURPOSE (import),
7939 "Class or interface `%s' not found in import",
7940 IDENTIFIER_POINTER (to_be_found));
7949 /* Possibly find a class imported by a single-type import statement. Return
7950 1 if an error occured, 0 otherwise. */
7953 find_in_imports (class_type)
7958 for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
7959 if (TREE_VALUE (import) == TYPE_NAME (class_type))
7961 TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import));
7962 QUALIFIED_P (TYPE_NAME (class_type)) = 1;
7968 note_possible_classname (name, len)
7973 if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0)
7975 else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0)
7979 node = ident_subst (name, len, "", '/', '.', "");
7980 IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
7981 QUALIFIED_P (node) = strchr (name, '/') ? 1 : 0;
7985 /* Read a import directory, gathering potential match for further type
7986 references. Indifferently reads a filesystem or a ZIP archive
7990 read_import_dir (wfl)
7993 tree package_id = EXPR_WFL_NODE (wfl);
7994 const char *package_name = IDENTIFIER_POINTER (package_id);
7995 int package_length = IDENTIFIER_LENGTH (package_id);
7997 JCF *saved_jcf = current_jcf;
8002 struct buffer filename[1];
8005 if (IS_AN_IMPORT_ON_DEMAND_P (package_id))
8007 IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1;
8009 BUFFER_INIT (filename);
8010 buffer_grow (filename, package_length + 100);
8012 for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
8014 const char *entry_name = jcf_path_name (entry);
8015 int entry_length = strlen (entry_name);
8016 if (jcf_path_is_zipfile (entry))
8019 buffer_grow (filename, entry_length);
8020 memcpy (filename->data, entry_name, entry_length - 1);
8021 filename->data[entry_length-1] = '\0';
8022 zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry));
8024 error ("malformed .zip archive in CLASSPATH: %s", entry_name);
8027 ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory;
8028 BUFFER_RESET (filename);
8029 for (k = 0; k < package_length; k++)
8031 char ch = package_name[k];
8032 *filename->ptr++ = ch == '.' ? '/' : ch;
8034 *filename->ptr++ = '/';
8036 for (k = 0; k < zipf->count; k++, zipd = ZIPDIR_NEXT (zipd))
8038 const char *current_entry = ZIPDIR_FILENAME (zipd);
8039 int current_entry_len = zipd->filename_length;
8041 if (current_entry_len >= BUFFER_LENGTH (filename)
8042 && strncmp (filename->data, current_entry,
8043 BUFFER_LENGTH (filename)) != 0)
8045 found |= note_possible_classname (current_entry,
8052 BUFFER_RESET (filename);
8053 buffer_grow (filename, entry_length + package_length + 4);
8054 strcpy (filename->data, entry_name);
8055 filename->ptr = filename->data + entry_length;
8056 for (k = 0; k < package_length; k++)
8058 char ch = package_name[k];
8059 *filename->ptr++ = ch == '.' ? '/' : ch;
8061 *filename->ptr = '\0';
8063 dirp = opendir (filename->data);
8066 *filename->ptr++ = '/';
8071 struct dirent *direntp = readdir (dirp);
8074 d_name = direntp->d_name;
8075 len = strlen (direntp->d_name);
8076 buffer_grow (filename, len+1);
8077 strcpy (filename->ptr, d_name);
8078 found |= note_possible_classname (filename->data + entry_length,
8079 package_length+len+1);
8086 free (filename->data);
8088 /* Here we should have a unified way of retrieving an entry, to be
8092 static int first = 1;
8095 error ("Can't find default package `%s'. Check the CLASSPATH environment variable and the access to the archives.", package_name);
8100 parse_error_context (wfl, "Package `%s' not found in import",
8102 current_jcf = saved_jcf;
8105 current_jcf = saved_jcf;
8108 /* Possibly find a type in the import on demands specified
8109 types. Returns 1 if an error occured, 0 otherwise. Run throught the
8110 entire list, to detected potential double definitions. */
8113 find_in_imports_on_demand (class_type)
8116 tree node, import, node_to_use = NULL_TREE;
8118 tree cl = NULL_TREE;
8120 for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import))
8122 const char *id_name;
8123 obstack_grow (&temporary_obstack,
8124 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
8125 IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
8126 obstack_1grow (&temporary_obstack, '.');
8127 obstack_grow0 (&temporary_obstack,
8128 IDENTIFIER_POINTER (TYPE_NAME (class_type)),
8129 IDENTIFIER_LENGTH (TYPE_NAME (class_type)));
8130 id_name = obstack_finish (&temporary_obstack);
8132 node = maybe_get_identifier (id_name);
8133 if (node && IS_A_CLASSFILE_NAME (node))
8137 cl = TREE_PURPOSE (import);
8145 (import, "Type `%s' also potentially defined in package `%s'",
8146 IDENTIFIER_POINTER (TYPE_NAME (class_type)),
8147 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))));
8154 /* Setup lineno so that it refers to the line of the import (in
8155 case we parse a class file and encounter errors */
8157 int saved_lineno = lineno;
8158 lineno = EXPR_WFL_LINENO (cl);
8159 TYPE_NAME (class_type) = node_to_use;
8160 QUALIFIED_P (TYPE_NAME (class_type)) = 1;
8161 decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
8162 /* If there is no DECL set for the class or if the class isn't
8163 loaded and not seen in source yet, the load */
8164 if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl))
8165 && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl))))
8166 load_class (node_to_use, 0);
8167 lineno = saved_lineno;
8168 return check_pkg_class_access (TYPE_NAME (class_type), cl);
8171 return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
8175 resolve_package (pkg, next)
8179 tree type_name = NULL_TREE;
8180 const char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg));
8182 /* The trick is to determine when the package name stops and were
8183 the name of something contained in the package starts. Then we
8184 return a fully qualified name of what we want to get. */
8186 /* Do a quick search on well known package names */
8187 if (!strncmp (name, "java.lang.reflect", 17))
8190 TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg))));
8191 type_name = lookup_package_type (name, 17);
8193 else if (!strncmp (name, "java.lang", 9))
8195 *next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)));
8196 type_name = lookup_package_type (name, 9);
8199 /* If we found something here, return */
8203 *next = EXPR_WFL_QUALIFICATION (pkg);
8205 /* Try the current package. */
8206 if (ctxp->package && !strncmp (name, IDENTIFIER_POINTER (ctxp->package),
8207 IDENTIFIER_LENGTH (ctxp->package)))
8210 lookup_package_type_and_set_next (name,
8211 IDENTIFIER_LENGTH (ctxp->package),
8217 /* Search in imported package */
8218 for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
8220 tree current_pkg_name = EXPR_WFL_NODE (TREE_PURPOSE (current));
8221 int len = IDENTIFIER_LENGTH (current_pkg_name);
8222 if (!strncmp (name, IDENTIFIER_POINTER (current_pkg_name), len))
8226 breakdown_qualified (&left, &dummy, current_pkg_name);
8227 len = IDENTIFIER_LENGTH (left);
8228 type_name = lookup_package_type_and_set_next (name, len, next);
8238 lookup_package_type_and_set_next (name, len, next)
8244 tree type_name = lookup_package_type (name, len);
8249 ptr = IDENTIFIER_POINTER (type_name);
8250 while (ptr && (ptr = strchr (ptr, '.')))
8252 *next = TREE_CHAIN (*next);
8259 lookup_package_type (name, from)
8264 const char *sub = &name[from+1];
8265 while (*sub != '.' && *sub)
8267 strncpy (subname, name, sub-name);
8268 subname [sub-name] = '\0';
8269 return get_identifier (subname);
8272 /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
8273 access violations were found, 1 otherwise. */
8276 check_pkg_class_access (class_name, cl)
8282 if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name))
8285 if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name))))
8288 if (!CLASS_PUBLIC (TYPE_NAME (type)))
8290 /* Access to a private class within the same package is
8293 breakdown_qualified (&l, &r, class_name);
8294 if (l == ctxp->package)
8298 (cl, "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed",
8299 (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
8300 IDENTIFIER_POINTER (class_name));
8306 /* Local variable declaration. */
8309 declare_local_variables (modifier, type, vlist)
8314 tree decl, current, saved_type;
8315 tree type_wfl = NULL_TREE;
8318 /* Push a new block if statements were seen between the last time we
8319 pushed a block and now. Keep a cound of block to close */
8320 if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl)))
8322 tree body = GET_CURRENT_BLOCK (current_function_decl);
8323 tree b = enter_block ();
8324 BLOCK_EXPR_ORIGIN (b) = body;
8330 for (i = 0; i <= 10; i++) if (1 << i & modifier) break;
8331 if (modifier == ACC_FINAL)
8333 if (flag_static_local_jdk1_1)
8334 parse_warning_context (ctxp->modifier_ctx [i],
8335 "Unsupported JDK1.1 `final' local variable (treated as non final)");
8340 (ctxp->modifier_ctx [i],
8341 "Only `final' is allowed as a local variables modifier");
8346 /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
8347 hold the TYPE value if a new incomplete has to be created (as
8348 opposed to being found already existing and reused). */
8349 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
8351 /* If TYPE is fully resolved and we don't have a reference, make one */
8352 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
8354 /* Go through all the declared variables */
8355 for (current = vlist, saved_type = type; current;
8356 current = TREE_CHAIN (current), type = saved_type)
8358 tree other, real_type;
8359 tree wfl = TREE_PURPOSE (current);
8360 tree name = EXPR_WFL_NODE (wfl);
8361 tree init = TREE_VALUE (current);
8363 /* Process NAME, as it may specify extra dimension(s) for it */
8364 type = build_array_from_name (type, type_wfl, name, &name);
8366 /* Variable redefinition check */
8367 if ((other = lookup_name_in_blocks (name)))
8369 variable_redefinition_error (wfl, name, TREE_TYPE (other),
8370 DECL_SOURCE_LINE (other));
8374 /* Type adjustment. We may have just readjusted TYPE because
8375 the variable specified more dimensions. Make sure we have
8376 a reference if we can and don't have one already. */
8377 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
8379 real_type = GET_REAL_TYPE (type);
8380 /* Never layout this decl. This will be done when its scope
8382 decl = build_decl (VAR_DECL, name, real_type);
8383 BLOCK_CHAIN_DECL (decl);
8385 /* If doing xreferencing, replace the line number with the WFL
8388 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl);
8390 /* Don't try to use an INIT statement when an error was found */
8391 if (init && java_error_count)
8394 /* Add the initialization function to the current function's code */
8397 /* Name might have been readjusted */
8398 EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name;
8399 MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
8400 java_method_add_stmt (current_function_decl,
8401 build_debugable_stmt (EXPR_WFL_LINECOL (init),
8405 /* Setup dependency the type of the decl */
8409 register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type);
8410 dep = CLASSD_LAST (ctxp->classd_list);
8411 JDEP_GET_PATCH (dep) = &TREE_TYPE (decl);
8414 SOURCE_FRONTEND_DEBUG (("Defined locals"));
8417 /* Called during parsing. Build decls from argument list. */
8420 source_start_java_method (fndecl)
8430 current_function_decl = fndecl;
8432 /* New scope for the function */
8434 for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
8435 tem != end_params_node; tem = TREE_CHAIN (tem), i++)
8437 tree type = TREE_VALUE (tem);
8438 tree name = TREE_PURPOSE (tem);
8440 /* If type is incomplete. Create an incomplete decl and ask for
8441 the decl to be patched later */
8442 if (INCOMPLETE_TYPE_P (type))
8445 tree real_type = GET_REAL_TYPE (type);
8446 parm_decl = build_decl (PARM_DECL, name, real_type);
8447 type = obtain_incomplete_type (type);
8448 register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type);
8449 jdep = CLASSD_LAST (ctxp->classd_list);
8450 JDEP_MISC (jdep) = name;
8451 JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl);
8454 parm_decl = build_decl (PARM_DECL, name, type);
8456 BLOCK_CHAIN_DECL (parm_decl);
8458 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
8459 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) =
8461 DECL_ARG_SLOT_COUNT (current_function_decl) = i;
8464 /* Called during parsing. Creates an artificial method declaration. */
8467 create_artificial_method (class, flags, type, name, args)
8470 tree type, name, args;
8472 int saved_lineno = lineno;
8476 mdecl = make_node (FUNCTION_TYPE);
8477 TREE_TYPE (mdecl) = type;
8478 TYPE_ARG_TYPES (mdecl) = args;
8479 mdecl = add_method (class, flags, name, build_java_signature (mdecl));
8480 lineno = saved_lineno;
8481 DECL_ARTIFICIAL (mdecl) = 1;
8485 /* Starts the body if an artifical method. */
8488 start_artificial_method_body (mdecl)
8491 DECL_SOURCE_LINE (mdecl) = 1;
8492 DECL_SOURCE_LINE_MERGE (mdecl, 1);
8493 source_start_java_method (mdecl);
8498 end_artificial_method_body (mdecl)
8501 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block ();
8505 /* Called during expansion. Push decls formerly built from argument
8506 list so they're usable during expansion. */
8509 expand_start_java_method (fndecl)
8514 current_function_decl = fndecl;
8516 announce_function (fndecl);
8517 pushlevel (1); /* Push parameters */
8518 ptr = &DECL_ARGUMENTS (fndecl);
8519 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
8522 tree next = TREE_CHAIN (tem);
8523 tree type = TREE_TYPE (tem);
8524 if (PROMOTE_PROTOTYPES
8525 && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
8526 && INTEGRAL_TYPE_P (type))
8527 type = integer_type_node;
8528 DECL_ARG_TYPE (tem) = type;
8529 layout_decl (tem, 0);
8532 ptr = &TREE_CHAIN (tem);
8536 pushdecl_force_head (DECL_ARGUMENTS (fndecl));
8537 lineno = DECL_SOURCE_LINE_FIRST (fndecl);
8540 /* Terminate a function and expand its body. */
8543 source_end_java_method ()
8545 tree fndecl = current_function_decl;
8546 int flag_asynchronous_exceptions = asynchronous_exceptions;
8551 java_parser_context_save_global ();
8552 lineno = ctxp->last_ccb_indent1;
8554 /* Set EH language codes */
8555 java_set_exception_lang_code ();
8557 /* Turn function bodies with only a NOP expr null, so they don't get
8558 generated at all and we won't get warnings when using the -W
8560 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node)
8561 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
8563 /* Generate function's code */
8564 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
8565 && ! flag_emit_class_files
8566 && ! flag_emit_xref)
8567 expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)));
8569 /* pop out of its parameters */
8570 pushdecl_force_head (DECL_ARGUMENTS (fndecl));
8572 BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
8574 /* Generate rtl for function exit. */
8575 if (! flag_emit_class_files && ! flag_emit_xref)
8577 lineno = DECL_SOURCE_LINE_LAST (fndecl);
8578 /* Emit catch-finally clauses */
8580 expand_function_end (input_filename, lineno, 0);
8582 /* FIXME: If the current method contains any exception handlers,
8583 force asynchronous_exceptions: this is necessary because signal
8584 handlers in libjava may throw exceptions. This is far from being
8585 a perfect solution, but it's better than doing nothing at all.*/
8587 asynchronous_exceptions = 1;
8589 /* Run the optimizers and output assembler code for this function. */
8590 rest_of_compilation (fndecl);
8593 current_function_decl = NULL_TREE;
8594 permanent_allocation (1);
8595 java_parser_context_restore_global ();
8596 asynchronous_exceptions = flag_asynchronous_exceptions;
8599 /* Record EXPR in the current function block. Complements compound
8600 expression second operand if necessary. */
8603 java_method_add_stmt (fndecl, expr)
8606 if (!GET_CURRENT_BLOCK (fndecl))
8608 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
8612 add_stmt_to_block (b, type, stmt)
8615 tree body = BLOCK_EXPR_BODY (b), c;
8617 if (java_error_count)
8620 if ((c = add_stmt_to_compound (body, type, stmt)) == body)
8623 BLOCK_EXPR_BODY (b) = c;
8624 TREE_SIDE_EFFECTS (c) = 1;
8628 /* Add STMT to EXISTING if possible, otherwise create a new
8629 COMPOUND_EXPR and add STMT to it. */
8632 add_stmt_to_compound (existing, type, stmt)
8633 tree existing, type, stmt;
8636 return build (COMPOUND_EXPR, type, existing, stmt);
8641 /* Hold THIS for the scope of the current public method decl. */
8642 static tree current_this;
8644 void java_layout_seen_class_methods ()
8646 tree previous_list = all_class_list;
8647 tree end = NULL_TREE;
8652 for (current = previous_list;
8653 current != end; current = TREE_CHAIN (current))
8654 layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
8656 if (previous_list != all_class_list)
8658 end = previous_list;
8659 previous_list = all_class_list;
8666 /* Layout the methods of all classes loaded in one way on an
8667 other. Check methods of source parsed classes. Then reorder the
8668 fields and layout the classes or the type of all source parsed
8672 java_layout_classes ()
8675 int save_error_count = java_error_count;
8677 /* Layout the methods of all classes seen so far */
8678 java_layout_seen_class_methods ();
8679 java_parse_abort_on_error ();
8680 all_class_list = NULL_TREE;
8682 /* Then check the methods of all parsed classes */
8683 for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
8684 if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current))))
8685 CHECK_METHODS (TREE_VALUE (current));
8686 java_parse_abort_on_error ();
8688 for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
8690 current_class = TREE_TYPE (TREE_VALUE (current));
8692 /* Reverse the fields, but leave the dummy field in front.
8693 Fields are already ordered for Object and Class */
8694 if (TYPE_FIELDS (current_class) && current_class != object_type_node
8695 && current_class != class_type_node)
8697 /* If the dummy field is there, reverse the right fields and
8698 just layout the type for proper fields offset */
8699 if (!DECL_NAME (TYPE_FIELDS (current_class)))
8701 tree fields = TYPE_FIELDS (current_class);
8702 TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields));
8703 TYPE_SIZE (current_class) = NULL_TREE;
8704 layout_type (current_class);
8706 /* We don't have a dummy field, we need to layout the class,
8707 after having reversed the fields */
8710 TYPE_FIELDS (current_class) =
8711 nreverse (TYPE_FIELDS (current_class));
8712 TYPE_SIZE (current_class) = NULL_TREE;
8713 layout_class (current_class);
8717 layout_class (current_class);
8719 /* From now on, the class is considered completely loaded */
8720 CLASS_LOADED_P (current_class) = 1;
8722 /* Error reported by the caller */
8723 if (java_error_count)
8727 /* We might have reloaded classes durign the process of laying out
8728 classes for code generation. We must layout the methods of those
8729 late additions, as constructor checks might use them */
8730 java_layout_seen_class_methods ();
8731 java_parse_abort_on_error ();
8734 /* Expand all methods in all registered classes. */
8737 java_complete_expand_methods ()
8741 do_not_fold = flag_emit_xref;
8743 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
8746 tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current));
8747 tree decl, prev_decl;
8749 current_class = TREE_TYPE (current);
8750 is_interface = CLASS_INTERFACE (TYPE_NAME (current_class));
8752 /* Initialize a new constant pool */
8753 init_outgoing_cpool ();
8755 /* We want <clinit> (if any) to be processed first. */
8756 for (prev_decl = NULL_TREE, decl = TYPE_METHODS (class_type);
8757 decl; prev_decl= decl, decl = TREE_CHAIN (decl))
8758 if (IS_CLINIT (decl))
8760 if (!java_pre_expand_clinit (decl))
8763 TREE_CHAIN (prev_decl) = TREE_CHAIN (decl);
8765 TYPE_METHODS (class_type) = TREE_CHAIN (decl);
8770 /* Now go on for regular business. */
8771 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
8773 current_function_decl = decl;
8774 /* Don't generate debug info on line zero when expanding a
8775 generated constructor. */
8776 if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl))
8778 /* If we found errors, it's too dangerous to try to
8779 generate and expand a constructor */
8780 if (!java_error_count)
8782 restore_line_number_status (1);
8783 java_complete_expand_method (decl);
8784 restore_line_number_status (0);
8787 else if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl))
8790 java_complete_expand_method (decl);
8793 /* Now verify constructor circularity (stop after the first one
8796 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
8797 if (DECL_CONSTRUCTOR_P (decl) &&
8798 verify_constructor_circularity (decl, decl))
8801 /* Make the class data, register it and run the rest of decl
8802 compilation on it */
8803 if (!java_error_count)
8805 if (flag_emit_class_files)
8806 write_classfile (current_class);
8808 expand_xref (current_class);
8809 else if (! flag_syntax_only)
8815 /* Hold a list of catch clauses list. The first element of this list is
8816 the list of the catch clauses of the currently analysed try block. */
8817 static tree currently_caught_type_list;
8819 /* Complete and expand <clinit>. Return a non zero value if <clinit>
8820 is worth keeping. */
8823 java_pre_expand_clinit (decl)
8826 tree fbody = DECL_FUNCTION_BODY (decl);
8829 if (fbody != NULL_TREE)
8831 /* First check if we can ignore empty <clinit> */
8832 tree block_body = BLOCK_EXPR_BODY (fbody);
8834 current_this = NULL_TREE;
8835 current_function_decl = decl;
8836 if (block_body != NULL_TREE)
8838 /* Prevent the use of `this' inside <clinit> */
8839 ctxp->explicit_constructor_p = 1;
8840 block_body = java_complete_tree (block_body);
8841 ctxp->explicit_constructor_p = 0;
8843 BLOCK_EXPR_BODY (fbody) = block_body;
8844 if (block_body != NULL_TREE && TREE_CODE (block_body) == BLOCK
8845 && BLOCK_EXPR_BODY (block_body) == empty_stmt_node)
8852 /* Complete and expand a method. */
8855 java_complete_expand_method (mdecl)
8858 /* Fix constructors before expanding them */
8859 if (DECL_CONSTRUCTOR_P (mdecl))
8860 fix_constructors (mdecl);
8862 /* Expand functions that have a body */
8863 if (DECL_FUNCTION_BODY (mdecl))
8865 tree fbody = DECL_FUNCTION_BODY (mdecl);
8866 tree block_body = BLOCK_EXPR_BODY (fbody);
8867 tree exception_copy = NULL_TREE;
8868 expand_start_java_method (mdecl);
8869 build_result_decl (mdecl);
8872 = (!METHOD_STATIC (mdecl) ?
8873 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
8875 /* Purge the `throws' list of unchecked exceptions. If we're
8876 doing xref, save a copy of the list and re-install it
8879 exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl));
8881 purge_unchecked_exceptions (mdecl);
8883 /* Install exceptions thrown with `throws' */
8884 PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
8886 if (block_body != NULL_TREE)
8888 block_body = java_complete_tree (block_body);
8889 if (!flag_emit_xref)
8890 check_for_initialization (block_body);
8891 ctxp->explicit_constructor_p = 0;
8893 BLOCK_EXPR_BODY (fbody) = block_body;
8895 if ((block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body))
8896 && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE
8898 missing_return_error (current_function_decl);
8900 complete_start_java_method (mdecl);
8902 /* Don't go any further if we've found error(s) during the
8904 if (!java_error_count)
8905 source_end_java_method ();
8908 pushdecl_force_head (DECL_ARGUMENTS (mdecl));
8912 /* Pop the exceptions and sanity check */
8914 if (currently_caught_type_list)
8915 fatal ("Exception list non empty - java_complete_expand_method");
8918 DECL_FUNCTION_THROWS (mdecl) = exception_copy;
8922 /* Craft a body for default constructor. Patch existing constructor
8923 bodies with call to super() and field initialization statements if
8927 fix_constructors (mdecl)
8930 tree body = DECL_FUNCTION_BODY (mdecl);
8934 /* The constructor body must be crafted by hand. It's the
8935 constructor we defined when we realize we didn't have the
8936 CLASSNAME() constructor */
8940 /* It is an error for the compiler to generate a default
8941 constructor if the superclass doesn't have a constructor that
8942 takes no argument */
8943 if (verify_constructor_super ())
8945 tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class));
8946 const char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
8948 (lookup_cl (TYPE_NAME (current_class)),
8949 "No constructor matching `%s()' found in class `%s'", n, n);
8952 start_artificial_method_body (mdecl);
8954 /* We don't generate a super constructor invocation if we're
8955 compiling java.lang.Object. build_super_invocation takes care
8957 compound = java_method_add_stmt (mdecl, build_super_invocation (mdecl));
8959 end_artificial_method_body (mdecl);
8961 /* Search for an explicit constructor invocation */
8965 tree main_block = BLOCK_EXPR_BODY (body);
8966 tree compound = NULL_TREE;
8969 switch (TREE_CODE (body))
8972 found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
8976 case EXPR_WITH_FILE_LOCATION:
8977 body = TREE_OPERAND (body, 0);
8980 body = BLOCK_EXPR_BODY (body);
8986 /* The constructor is missing an invocation of super() */
8988 compound = add_stmt_to_compound (compound, NULL_TREE,
8989 build_super_invocation (mdecl));
8991 /* Fix the constructor main block if we're adding extra stmts */
8994 compound = add_stmt_to_compound (compound, NULL_TREE,
8995 BLOCK_EXPR_BODY (main_block));
8996 BLOCK_EXPR_BODY (main_block) = compound;
9001 /* Browse constructors in the super class, searching for a constructor
9002 that doesn't take any argument. Return 0 if one is found, 1
9006 verify_constructor_super ()
9008 tree class = CLASSTYPE_SUPER (current_class);
9015 for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
9017 if (DECL_CONSTRUCTOR_P (mdecl)
9018 && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl)))
9026 /* Expand finals. */
9029 java_expand_finals ()
9033 /* Generate code for all context remembered for code generation. */
9036 java_expand_classes ()
9038 int save_error_count = 0;
9039 java_parse_abort_on_error ();
9040 if (!(ctxp = ctxp_for_generation))
9042 java_layout_classes ();
9043 java_parse_abort_on_error ();
9045 for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
9047 ctxp = ctxp_for_generation;
9048 lang_init_source (2); /* Error msgs have method prototypes */
9049 java_complete_expand_methods (); /* Complete and expand method bodies */
9050 java_parse_abort_on_error ();
9051 java_expand_finals (); /* Expand and check the finals */
9052 java_parse_abort_on_error ();
9053 java_check_final (); /* Check unitialized final */
9054 java_parse_abort_on_error ();
9058 /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
9059 a tree list node containing RIGHT. Fore coming RIGHTs will be
9060 chained to this hook. LOCATION contains the location of the
9061 separating `.' operator. */
9064 make_qualified_primary (primary, right, location)
9065 tree primary, right;
9070 /* We want to process THIS . xxx symbolicaly, to keep it consistent
9071 with the way we're processing SUPER. A THIS from a primary as a
9072 different form than a SUPER. Turn THIS into something symbolic */
9073 if (TREE_CODE (primary) == THIS_EXPR)
9075 wfl = build_wfl_node (this_identifier_node);
9076 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
9077 wfl = make_qualified_name (wfl, right, location);
9078 PRIMARY_P (wfl) = 1;
9081 /* Other non WFL node are wrapped around a WFL */
9082 else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
9084 wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
9085 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
9086 EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE);
9091 if (!EXPR_WFL_QUALIFICATION (primary))
9092 EXPR_WFL_QUALIFICATION (primary) =
9093 build_tree_list (primary, NULL_TREE);
9096 EXPR_WFL_LINECOL (right) = location;
9097 chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE));
9098 PRIMARY_P (wfl) = 1;
9102 /* Simple merge of two name separated by a `.' */
9105 merge_qualified_name (left, right)
9109 obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left),
9110 IDENTIFIER_LENGTH (left));
9111 obstack_1grow (&temporary_obstack, '.');
9112 obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right),
9113 IDENTIFIER_LENGTH (right));
9114 node = get_identifier (obstack_base (&temporary_obstack));
9115 obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
9116 QUALIFIED_P (node) = 1;
9120 /* Merge the two parts of a qualified name into LEFT. Set the
9121 location information of the resulting node to LOCATION, usually
9122 inherited from the location information of the `.' operator. */
9125 make_qualified_name (left, right, location)
9129 #ifdef USE_COMPONENT_REF
9130 tree node = build (COMPONENT_REF, NULL_TREE, left, right);
9131 EXPR_WFL_LINECOL (node) = location;
9134 tree left_id = EXPR_WFL_NODE (left);
9135 tree right_id = EXPR_WFL_NODE (right);
9138 merge = merge_qualified_name (left_id, right_id);
9140 /* Left wasn't qualified and is now qualified */
9141 if (!QUALIFIED_P (left_id))
9143 tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0);
9144 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left);
9145 EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
9148 wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0);
9149 EXPR_WFL_LINECOL (wfl) = location;
9150 chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE));
9152 EXPR_WFL_NODE (left) = merge;
9157 /* Extract the last identifier component of the qualified in WFL. The
9158 last identifier is removed from the linked list */
9161 cut_identifier_in_qualified (wfl)
9165 tree previous = NULL_TREE;
9166 for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q))
9167 if (!TREE_CHAIN (q))
9170 fatal ("Operating on a non qualified qualified WFL - cut_identifier_in_qualified");
9171 TREE_CHAIN (previous) = NULL_TREE;
9172 return TREE_PURPOSE (q);
9176 /* Resolve the expression name NAME. Return its decl. */
9179 resolve_expression_name (id, orig)
9183 tree name = EXPR_WFL_NODE (id);
9186 /* 6.5.5.1: Simple expression names */
9187 if (!PRIMARY_P (id) && !QUALIFIED_P (name))
9189 /* 15.13.1: NAME can appear within the scope of a local variable
9191 if ((decl = IDENTIFIER_LOCAL_VALUE (name)))
9194 /* 15.13.1: NAME can appear within a class declaration */
9197 decl = lookup_field_wrapper (current_class, name);
9200 int fs = FIELD_STATIC (decl);
9201 /* Instance variable (8.3.1.1) can't appear within
9202 static method, static initializer or initializer for
9203 a static variable. */
9204 if (!fs && METHOD_STATIC (current_function_decl))
9206 static_ref_err (id, name, current_class);
9207 return error_mark_node;
9209 /* Instance variables can't appear as an argument of
9210 an explicit constructor invocation */
9211 if (!fs && ctxp->explicit_constructor_p)
9214 (id, "Can't reference `%s' before the superclass constructor has been called", IDENTIFIER_POINTER (name));
9215 return error_mark_node;
9218 /* Otherwise build what it takes to access the field */
9219 decl = build_field_ref ((fs ? NULL_TREE : current_this),
9220 DECL_CONTEXT (decl), name);
9221 if (fs && !flag_emit_class_files && !flag_emit_xref)
9222 decl = build_class_init (DECL_CONTEXT (decl), decl);
9223 /* We may be asked to save the real field access node */
9226 /* And we return what we got */
9229 /* Fall down to error report on undefined variable */
9232 /* 6.5.5.2 Qualified Expression Names */
9237 qualify_ambiguous_name (id);
9238 /* 15.10.1 Field Access Using a Primary and/or Expression Name */
9239 /* 15.10.2: Accessing Superclass Members using super */
9240 return resolve_field_access (id, orig, NULL);
9243 /* We've got an error here */
9244 parse_error_context (id, "Undefined variable `%s'",
9245 IDENTIFIER_POINTER (name));
9247 return error_mark_node;
9251 static_ref_err (wfl, field_id, class_type)
9252 tree wfl, field_id, class_type;
9256 "Can't make a static reference to nonstatic variable `%s' in class `%s'",
9257 IDENTIFIER_POINTER (field_id),
9258 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))));
9261 /* 15.10.1 Field Acess Using a Primary and/or Expression Name.
9262 We return something suitable to generate the field access. We also
9263 return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
9264 recipient's address can be null. */
9267 resolve_field_access (qual_wfl, field_decl, field_type)
9269 tree *field_decl, *field_type;
9273 tree decl, where_found, type_found;
9275 if (resolve_qualified_expression_name (qual_wfl, &decl,
9276 &where_found, &type_found))
9277 return error_mark_node;
9279 /* Resolve the LENGTH field of an array here */
9280 if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found)
9281 && ! flag_emit_class_files && ! flag_emit_xref)
9283 tree length = build_java_array_length_access (where_found);
9285 build_java_arraynull_check (type_found, length, int_type_node);
9287 /* We might have been trying to resolve field.method(). In which
9288 case, the resolution is over and decl is the answer */
9289 else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
9291 else if (JDECL_P (decl))
9293 int static_final_found = 0;
9295 type_found = DECL_CONTEXT (decl);
9296 is_static = JDECL_P (decl) && FIELD_STATIC (decl);
9297 if (FIELD_FINAL (decl)
9298 && JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
9299 && DECL_LANG_SPECIFIC (decl)
9300 && DECL_INITIAL (decl))
9302 field_ref = DECL_INITIAL (decl);
9303 static_final_found = 1;
9306 field_ref = build_field_ref ((is_static && !flag_emit_xref?
9307 NULL_TREE : where_found),
9308 type_found, DECL_NAME (decl));
9309 if (field_ref == error_mark_node)
9310 return error_mark_node;
9311 if (is_static && !static_final_found
9312 && !flag_emit_class_files && !flag_emit_xref)
9313 field_ref = build_class_init (type_found, field_ref);
9321 *field_type = (QUAL_DECL_TYPE (decl) ?
9322 QUAL_DECL_TYPE (decl) : TREE_TYPE (decl));
9326 /* If NODE is an access to f static field, strip out the class
9327 initialization part and return the field decl, otherwise, return
9331 strip_out_static_field_access_decl (node)
9334 if (TREE_CODE (node) == COMPOUND_EXPR)
9336 tree op1 = TREE_OPERAND (node, 1);
9337 if (TREE_CODE (op1) == COMPOUND_EXPR)
9339 tree call = TREE_OPERAND (op1, 0);
9340 if (TREE_CODE (call) == CALL_EXPR
9341 && TREE_CODE (TREE_OPERAND (call, 0)) == ADDR_EXPR
9342 && TREE_OPERAND (TREE_OPERAND (call, 0), 0)
9343 == soft_initclass_node)
9344 return TREE_OPERAND (op1, 1);
9346 else if (JDECL_P (op1))
9352 /* 6.5.5.2: Qualified Expression Names */
9355 resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
9357 tree *found_decl, *type_found, *where_found;
9359 int from_type = 0; /* Field search initiated from a type */
9360 int from_super = 0, from_cast = 0;
9361 int previous_call_static = 0;
9363 tree decl = NULL_TREE, type = NULL_TREE, q;
9364 *type_found = *where_found = NULL_TREE;
9366 for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
9368 tree qual_wfl = QUAL_WFL (q);
9369 tree ret_decl; /* for EH checking */
9370 int location; /* for EH checking */
9372 /* 15.10.1 Field Access Using a Primary */
9373 switch (TREE_CODE (qual_wfl))
9376 case NEW_CLASS_EXPR:
9377 /* If the access to the function call is a non static field,
9378 build the code to access it. */
9379 if (JDECL_P (decl) && !FIELD_STATIC (decl))
9381 decl = maybe_access_field (decl, *where_found,
9382 DECL_CONTEXT (decl));
9383 if (decl == error_mark_node)
9386 /* And code for the function call */
9387 if (complete_function_arguments (qual_wfl))
9390 if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
9391 CALL_USING_SUPER (qual_wfl) = 1;
9392 location = (TREE_CODE (qual_wfl) == CALL_EXPR ?
9393 EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0);
9394 *where_found = patch_method_invocation (qual_wfl, decl, type,
9395 &is_static, &ret_decl);
9396 if (*where_found == error_mark_node)
9398 *type_found = type = QUAL_DECL_TYPE (*where_found);
9402 check_thrown_exceptions (location, ret_decl);
9404 /* If the previous call was static and this one is too,
9405 build a compound expression to hold the two (because in
9406 that case, previous function calls aren't transported as
9407 forcoming function's argument. */
9408 if (previous_call_static && is_static)
9410 decl = build (COMPOUND_EXPR, type, decl, *where_found);
9411 TREE_SIDE_EFFECTS (decl) = 1;
9415 previous_call_static = is_static;
9416 decl = *where_found;
9420 case NEW_ARRAY_EXPR:
9421 *where_found = decl = java_complete_tree (qual_wfl);
9422 if (decl == error_mark_node)
9424 *type_found = type = QUAL_DECL_TYPE (decl);
9425 CLASS_LOADED_P (type) = 1;
9429 *where_found = decl = java_complete_tree (qual_wfl);
9430 if (decl == error_mark_node)
9432 *type_found = type = QUAL_DECL_TYPE (decl);
9436 case CONDITIONAL_EXPR:
9439 *where_found = decl = java_complete_tree (qual_wfl);
9440 if (decl == error_mark_node)
9442 *type_found = type = QUAL_DECL_TYPE (decl);
9446 /* If the access to the function call is a non static field,
9447 build the code to access it. */
9448 if (JDECL_P (decl) && !FIELD_STATIC (decl))
9450 decl = maybe_access_field (decl, *where_found, type);
9451 if (decl == error_mark_node)
9454 /* And code for the array reference expression */
9455 decl = java_complete_tree (qual_wfl);
9456 if (decl == error_mark_node)
9458 type = QUAL_DECL_TYPE (decl);
9462 if ((decl = java_complete_tree (qual_wfl)) == error_mark_node)
9464 if ((type = patch_string (decl)))
9466 *where_found = QUAL_RESOLUTION (q) = decl;
9467 *type_found = type = TREE_TYPE (decl);
9471 /* Fix for -Wall Just go to the next statement. Don't
9476 /* If we fall here, we weren't processing a (static) function call. */
9477 previous_call_static = 0;
9479 /* It can be the keyword THIS */
9480 if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
9485 (wfl, "Keyword `this' used outside allowed context");
9488 if (ctxp->explicit_constructor_p)
9490 parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called");
9493 /* We have to generate code for intermediate acess */
9494 *where_found = decl = current_this;
9495 *type_found = type = QUAL_DECL_TYPE (decl);
9499 /* 15.10.2 Accessing Superclass Members using SUPER */
9500 if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
9503 /* Check on the restricted use of SUPER */
9504 if (METHOD_STATIC (current_function_decl)
9505 || current_class == object_type_node)
9508 (wfl, "Keyword `super' used outside allowed context");
9511 /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
9512 node = build_cast (EXPR_WFL_LINECOL (qual_wfl),
9513 CLASSTYPE_SUPER (current_class),
9514 build_this (EXPR_WFL_LINECOL (qual_wfl)));
9515 *where_found = decl = java_complete_tree (node);
9516 if (decl == error_mark_node)
9518 *type_found = type = QUAL_DECL_TYPE (decl);
9519 from_super = from_type = 1;
9523 /* 15.13.1: Can't search for field name in packages, so we
9524 assume a variable/class name was meant. */
9525 if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
9527 tree name = resolve_package (wfl, &q);
9530 *where_found = decl = resolve_no_layout (name, qual_wfl);
9531 /* We wan't to be absolutely that the class is laid
9532 out. We're going to search something inside it. */
9533 *type_found = type = TREE_TYPE (decl);
9534 layout_class (type);
9536 /* Should be a list, really. FIXME */
9537 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 1;
9538 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 0;
9542 if (from_super || from_cast)
9544 ((from_cast ? qual_wfl : wfl),
9545 "No variable `%s' defined in class `%s'",
9546 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
9547 lang_printable_name (type, 0));
9550 (qual_wfl, "Undefined variable or class name: `%s'",
9551 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)));
9556 /* We have a type name. It's been already resolved when the
9557 expression was qualified. */
9558 else if (RESOLVE_TYPE_NAME_P (qual_wfl))
9560 if (!(decl = QUAL_RESOLUTION (q)))
9561 return 1; /* Error reported already */
9563 if (not_accessible_p (TREE_TYPE (decl), decl, 0))
9566 (qual_wfl, "Can't access %s field `%s.%s' from `%s'",
9567 java_accstring_lookup (get_access_flags_from_decl (decl)),
9568 GET_TYPE_NAME (type),
9569 IDENTIFIER_POINTER (DECL_NAME (decl)),
9570 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
9573 check_deprecation (qual_wfl, decl);
9575 type = TREE_TYPE (decl);
9578 /* We resolve and expression name */
9581 tree field_decl = NULL_TREE;
9583 /* If there exists an early resolution, use it. That occurs
9584 only once and we know that there are more things to
9585 come. Don't do that when processing something after SUPER
9586 (we need more thing to be put in place below */
9587 if (!from_super && QUAL_RESOLUTION (q))
9589 decl = QUAL_RESOLUTION (q);
9592 if (TREE_CODE (decl) == FIELD_DECL && !FIELD_STATIC (decl))
9595 *where_found = current_this;
9598 static_ref_err (qual_wfl, DECL_NAME (decl),
9605 *where_found = TREE_TYPE (decl);
9606 if (TREE_CODE (*where_found) == POINTER_TYPE)
9607 *where_found = TREE_TYPE (*where_found);
9612 /* We have to search for a field, knowing the type of its
9613 container. The flag FROM_TYPE indicates that we resolved
9614 the last member of the expression as a type name, which
9615 means that for the resolution of this field, we'll look
9616 for other errors than if it was resolved as a member of
9621 tree field_decl_type; /* For layout */
9623 if (!from_type && !JREFERENCE_TYPE_P (type))
9626 (qual_wfl, "Attempt to reference field `%s' in `%s %s'",
9627 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
9628 lang_printable_name (type, 0),
9629 IDENTIFIER_POINTER (DECL_NAME (field_decl)));
9633 field_decl = lookup_field_wrapper (type,
9634 EXPR_WFL_NODE (qual_wfl));
9635 if (field_decl == NULL_TREE)
9638 (qual_wfl, "No variable `%s' defined in type `%s'",
9639 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
9640 GET_TYPE_NAME (type));
9643 if (field_decl == error_mark_node)
9646 /* Layout the type of field_decl, since we may need
9647 it. Don't do primitive types or loaded classes. The
9648 situation of non primitive arrays may not handled
9649 properly here. FIXME */
9650 if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE)
9651 field_decl_type = TREE_TYPE (TREE_TYPE (field_decl));
9653 field_decl_type = TREE_TYPE (field_decl);
9654 if (!JPRIMITIVE_TYPE_P (field_decl_type)
9655 && !CLASS_LOADED_P (field_decl_type)
9656 && !TYPE_ARRAY_P (field_decl_type))
9657 resolve_and_layout (field_decl_type, NULL_TREE);
9658 if (TYPE_ARRAY_P (field_decl_type))
9659 CLASS_LOADED_P (field_decl_type) = 1;
9661 /* Check on accessibility here */
9662 if (not_accessible_p (type, field_decl, from_super))
9666 "Can't access %s field `%s.%s' from `%s'",
9667 java_accstring_lookup
9668 (get_access_flags_from_decl (field_decl)),
9669 GET_TYPE_NAME (type),
9670 IDENTIFIER_POINTER (DECL_NAME (field_decl)),
9672 (DECL_NAME (TYPE_NAME (current_class))));
9675 check_deprecation (qual_wfl, field_decl);
9677 /* There are things to check when fields are accessed
9678 from type. There are no restrictions on a static
9679 declaration of the field when it is accessed from an
9681 is_static = FIELD_STATIC (field_decl);
9682 if (!from_super && from_type
9683 && !TYPE_INTERFACE_P (type) && !is_static)
9685 static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type);
9688 from_cast = from_super = 0;
9690 /* If we need to generate something to get a proper
9691 handle on what this field is accessed from, do it
9695 decl = maybe_access_field (decl, *where_found, *type_found);
9696 if (decl == error_mark_node)
9700 /* We want to keep the location were found it, and the type
9702 *where_found = decl;
9705 /* This is the decl found and eventually the next one to
9710 type = QUAL_DECL_TYPE (decl);
9717 /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
9718 can't be accessed from REFERENCE (a record type). */
9721 not_accessible_p (reference, member, from_super)
9722 tree reference, member;
9725 int access_flag = get_access_flags_from_decl (member);
9727 /* Access always granted for members declared public */
9728 if (access_flag & ACC_PUBLIC)
9731 /* Check access on protected members */
9732 if (access_flag & ACC_PROTECTED)
9734 /* Access granted if it occurs from within the package
9735 containing the class in which the protected member is
9737 if (class_in_current_package (DECL_CONTEXT (member)))
9740 /* If accessed with the form `super.member', then access is granted */
9744 /* Otherwise, access is granted if occuring from the class where
9745 member is declared or a subclass of it */
9746 if (inherits_from_p (reference, current_class))
9751 /* Check access on private members. Access is granted only if it
9752 occurs from within the class in witch it is declared */
9753 if (access_flag & ACC_PRIVATE)
9754 return (current_class == DECL_CONTEXT (member) ? 0 : 1);
9756 /* Default access are permitted only when occuring within the
9757 package in which the type (REFERENCE) is declared. In other words,
9758 REFERENCE is defined in the current package */
9760 return !class_in_current_package (reference);
9762 /* Otherwise, access is granted */
9766 /* Test deprecated decl access. */
9768 check_deprecation (wfl, decl)
9771 const char *file = DECL_SOURCE_FILE (decl);
9772 /* Complain if the field is deprecated and the file it was defined
9773 in isn't compiled at the same time the file which contains its
9775 if (DECL_DEPRECATED (decl)
9776 && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file)))
9779 switch (TREE_CODE (decl))
9782 strcpy (the, "method");
9785 strcpy (the, "field");
9788 strcpy (the, "class");
9791 fatal ("unexpected DECL code - check_deprecation");
9793 parse_warning_context
9794 (wfl, "The %s `%s' in class `%s' has been deprecated",
9795 the, lang_printable_name (decl, 0),
9796 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)))));
9800 /* Returns 1 if class was declared in the current package, 0 otherwise */
9803 class_in_current_package (class)
9806 static tree cache = NULL_TREE;
9813 qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
9815 /* If the current package is empty and the name of CLASS is
9816 qualified, class isn't in the current package. If there is a
9817 current package and the name of the CLASS is not qualified, class
9818 isn't in the current package */
9819 if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag))
9822 /* If there is not package and the name of CLASS isn't qualified,
9823 they belong to the same unnamed package */
9824 if (!ctxp->package && !qualified_flag)
9827 /* Compare the left part of the name of CLASS with the package name */
9828 breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
9829 if (ctxp->package == left)
9837 /* This function may generate code to access DECL from WHERE. This is
9838 done only if certain conditions meet. */
9841 maybe_access_field (decl, where, type)
9842 tree decl, where, type;
9844 if (TREE_CODE (decl) == FIELD_DECL && decl != current_this
9845 && !FIELD_STATIC (decl))
9846 decl = build_field_ref (where ? where : current_this,
9847 (type ? type : DECL_CONTEXT (decl)),
9852 /* Build a method invocation, by patching PATCH. If non NULL
9853 and according to the situation, PRIMARY and WHERE may be
9854 used. IS_STATIC is set to 1 if the invoked function is static. */
9857 patch_method_invocation (patch, primary, where, is_static, ret_decl)
9858 tree patch, primary, where;
9862 tree wfl = TREE_OPERAND (patch, 0);
9863 tree args = TREE_OPERAND (patch, 1);
9864 tree name = EXPR_WFL_NODE (wfl);
9866 int is_static_flag = 0;
9867 int is_super_init = 0;
9868 tree this_arg = NULL_TREE;
9870 /* Should be overriden if everything goes well. Otherwise, if
9871 something fails, it should keep this value. It stop the
9872 evaluation of a bogus assignment. See java_complete_tree,
9873 MODIFY_EXPR: for the reasons why we sometimes want to keep on
9874 evaluating an assignment */
9875 TREE_TYPE (patch) = error_mark_node;
9877 /* Since lookup functions are messing with line numbers, save the
9879 java_parser_context_save_global ();
9881 /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
9883 /* Resolution of qualified name, excluding constructors */
9884 if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch))
9886 tree class_decl, identifier, identifier_wfl;
9887 /* Extract the last IDENTIFIER of the qualified
9888 expression. This is a wfl and we will use it's location
9889 data during error report. */
9890 identifier_wfl = cut_identifier_in_qualified (wfl);
9891 identifier = EXPR_WFL_NODE (identifier_wfl);
9893 /* Given the context, IDENTIFIER is syntactically qualified
9894 as a MethodName. We need to qualify what's before */
9895 qualify_ambiguous_name (wfl);
9897 /* Package resolution */
9898 if (RESOLVE_PACKAGE_NAME_P (wfl))
9900 tree next, decl, name = resolve_package (wfl, &next);
9905 breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
9907 (wfl, "Can't search method `%s' in package `%s'",
9908 IDENTIFIER_POINTER (identifier),
9909 IDENTIFIER_POINTER (remainder));
9910 PATCH_METHOD_RETURN_ERROR ();
9912 RESOLVE_PACKAGE_NAME_P (wfl) = 0;
9913 if ((decl = resolve_no_layout (name, QUAL_WFL (next))))
9915 QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)) = decl;
9916 RESOLVE_EXPRESSION_NAME_P (wfl) = 0;
9917 RESOLVE_TYPE_NAME_P (wfl) = 1;
9921 RESOLVE_EXPRESSION_NAME_P (wfl) = 1;
9922 RESOLVE_TYPE_NAME_P (wfl) = 0;
9926 /* We're resolving a call from a type */
9927 if (RESOLVE_TYPE_NAME_P (wfl))
9929 tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl));
9930 tree name = DECL_NAME (decl);
9933 class_decl = resolve_and_layout (name, wfl);
9934 if (CLASS_INTERFACE (decl))
9938 "Can't make static reference to method `%s' in interface `%s'",
9939 IDENTIFIER_POINTER (identifier),
9940 IDENTIFIER_POINTER (name));
9941 PATCH_METHOD_RETURN_ERROR ();
9943 /* Look the method up in the type selector. The method ought
9945 type = TREE_TYPE (class_decl);
9946 list = lookup_method_invoke (0, wfl, type, identifier, args);
9947 if (list && !METHOD_STATIC (list))
9949 char *fct_name = xstrdup (lang_printable_name (list, 0));
9952 "Can't make static reference to method `%s %s' in class `%s'",
9953 lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
9954 fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
9956 PATCH_METHOD_RETURN_ERROR ();
9958 args = nreverse (args);
9960 /* We're resolving an expression name */
9965 /* 1- Find the field to which the call applies */
9966 field = resolve_field_access (wfl, NULL, &type);
9967 if (field == error_mark_node)
9968 PATCH_METHOD_RETURN_ERROR ();
9969 /* field is used in lieu of a primary. It alows us not to
9970 report errors on erroneous use of `this' in
9974 /* 2- Do the layout of the class where the last field
9975 was found, so we can search it. */
9976 class_decl = resolve_and_layout (type, NULL_TREE);
9977 if (class_decl != NULL_TREE)
9978 type = TREE_TYPE (class_decl);
9980 /* 3- Retrieve a filtered list of method matches, Refine
9981 if necessary. In any cases, point out errors. */
9982 list = lookup_method_invoke (0, identifier_wfl, type,
9985 /* 4- Add the field as an argument */
9986 args = nreverse (args);
9990 /* IDENTIFIER_WFL will be used to report any problem further */
9991 wfl = identifier_wfl;
9993 /* Resolution of simple names, names generated after a primary: or
9997 tree class_to_search = NULL_TREE;
9998 int lc; /* Looking for Constructor */
10000 /* We search constructor in their target class */
10001 if (CALL_CONSTRUCTOR_P (patch))
10003 if (TREE_CODE (patch) == NEW_CLASS_EXPR)
10004 class_to_search = EXPR_WFL_NODE (wfl);
10005 else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
10006 this_identifier_node)
10007 class_to_search = NULL_TREE;
10008 else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
10009 super_identifier_node)
10012 if (CLASSTYPE_SUPER (current_class))
10014 DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class)));
10017 parse_error_context (wfl, "Can't invoke super constructor on java.lang.Object");
10018 PATCH_METHOD_RETURN_ERROR ();
10022 /* Class to search is NULL if we're searching the current one */
10023 if (class_to_search)
10025 class_to_search = resolve_and_layout (class_to_search,
10027 if (!class_to_search)
10029 parse_error_context
10030 (wfl, "Class `%s' not found in type declaration",
10031 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
10032 PATCH_METHOD_RETURN_ERROR ();
10035 /* Can't instantiate an abstract class, but we can
10036 invoke it's constructor. It's use within the `new'
10037 context is denied here. */
10038 if (CLASS_ABSTRACT (class_to_search)
10039 && TREE_CODE (patch) == NEW_CLASS_EXPR)
10041 parse_error_context
10042 (wfl, "Class `%s' is an abstract class. It can't be instantiated",
10043 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
10044 PATCH_METHOD_RETURN_ERROR ();
10046 class_to_search = TREE_TYPE (class_to_search);
10049 class_to_search = current_class;
10052 /* This is a regular search in the local class, unless an
10053 alternate class is specified. */
10056 class_to_search = (where ? where : current_class);
10060 /* NAME is a simple identifier or comes from a primary. Search
10061 in the class whose declaration contain the method being
10063 resolve_and_layout (class_to_search, NULL_TREE);
10064 list = lookup_method_invoke (lc, wfl, class_to_search, name, args);
10066 /* Don't continue if no method were found, as the next statement
10067 can't be executed then. */
10069 PATCH_METHOD_RETURN_ERROR ();
10071 /* Check for static reference if non static methods */
10072 if (check_for_static_method_reference (wfl, patch, list,
10073 class_to_search, primary))
10074 PATCH_METHOD_RETURN_ERROR ();
10076 /* Non static methods are called with the current object extra
10077 argument. If patch a `new TYPE()', the argument is the value
10078 returned by the object allocator. If method is resolved as a
10079 primary, use the primary otherwise use the current THIS. */
10080 args = nreverse (args);
10081 if (TREE_CODE (patch) != NEW_CLASS_EXPR)
10082 this_arg = primary ? primary : current_this;
10085 /* Merge point of all resolution schemes. If we have nothing, this
10086 is an error, already signaled */
10088 PATCH_METHOD_RETURN_ERROR ();
10090 /* Check accessibility, position the is_static flag, build and
10092 if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0))
10094 char *fct_name = xstrdup (lang_printable_name (list, 0));
10095 parse_error_context
10096 (wfl, "Can't access %s method `%s %s.%s' from `%s'",
10097 java_accstring_lookup (get_access_flags_from_decl (list)),
10098 lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
10099 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list)))),
10100 fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
10102 PATCH_METHOD_RETURN_ERROR ();
10104 check_deprecation (wfl, list);
10106 is_static_flag = METHOD_STATIC (list);
10107 if (! METHOD_STATIC (list) && this_arg != NULL_TREE)
10108 args = tree_cons (NULL_TREE, this_arg, args);
10110 /* In the context of an explicit constructor invocation, we can't
10111 invoke any method relying on `this'. Exceptions are: we're
10112 invoking a static function, primary exists and is not the current
10113 this, we're creating a new object. */
10114 if (ctxp->explicit_constructor_p
10116 && (!primary || primary == current_this)
10117 && (TREE_CODE (patch) != NEW_CLASS_EXPR))
10119 parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called");
10120 PATCH_METHOD_RETURN_ERROR ();
10122 java_parser_context_restore_global ();
10124 *is_static = is_static_flag;
10125 /* Sometimes, we want the decl of the selected method. Such as for
10129 patch = patch_invoke (patch, list, args);
10130 if (is_super_init && CLASS_HAS_FINIT_P (current_class))
10132 /* Generate the code used to initialize fields declared with an
10133 initialization statement. For now, it returns a call the the
10134 artificial function $finit$, if required. */
10137 build_method_invocation (build_expr_wfl (finit_identifier_node,
10138 input_filename, 0, 0),
10140 patch = build (COMPOUND_EXPR, void_type_node, patch,
10141 java_complete_tree (finit_call));
10142 CAN_COMPLETE_NORMALLY (patch) = 1;
10147 /* Check that we're not trying to do a static reference to a method in
10148 non static method. Return 1 if it's the case, 0 otherwise. */
10151 check_for_static_method_reference (wfl, node, method, where, primary)
10152 tree wfl, node, method, where, primary;
10154 if (METHOD_STATIC (current_function_decl)
10155 && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
10157 char *fct_name = xstrdup (lang_printable_name (method, 0));
10158 parse_error_context
10159 (wfl, "Can't make static reference to method `%s %s' in class `%s'",
10160 lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
10161 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where))));
10168 /* Patch an invoke expression METHOD and ARGS, based on its invocation
10172 patch_invoke (patch, method, args)
10173 tree patch, method, args;
10176 tree original_call, t, ta;
10178 /* Last step for args: convert build-in types. If we're dealing with
10179 a new TYPE() type call, the first argument to the constructor
10180 isn't found in the incomming argument list, but delivered by
10182 t = TYPE_ARG_TYPES (TREE_TYPE (method));
10183 if (TREE_CODE (patch) == NEW_CLASS_EXPR)
10184 t = TREE_CHAIN (t);
10185 for (ta = args; t != end_params_node && ta;
10186 t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
10187 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
10188 TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
10189 TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
10191 /* Resolve unresolved returned type isses */
10192 t = TREE_TYPE (TREE_TYPE (method));
10193 if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t)))
10194 resolve_and_layout (TREE_TYPE (t), NULL);
10196 if (flag_emit_class_files || flag_emit_xref)
10200 tree signature = build_java_signature (TREE_TYPE (method));
10201 switch (invocation_mode (method, CALL_USING_SUPER (patch)))
10203 case INVOKE_VIRTUAL:
10204 dtable = invoke_build_dtable (0, args);
10205 func = build_invokevirtual (dtable, method);
10209 case INVOKE_STATIC:
10210 func = build_known_method_ref (method, TREE_TYPE (method),
10211 DECL_CONTEXT (method),
10215 case INVOKE_INTERFACE:
10216 dtable = invoke_build_dtable (1, args);
10217 func = build_invokeinterface (dtable, method);
10221 fatal ("internal error - unknown invocation_mode result");
10224 /* Ensure self_type is initialized, (invokestatic). FIXME */
10225 func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func);
10228 TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method));
10229 TREE_OPERAND (patch, 0) = func;
10230 TREE_OPERAND (patch, 1) = args;
10231 original_call = patch;
10233 /* We're processing a `new TYPE ()' form. New is called an its
10234 returned value is the first argument to the constructor. We build
10235 a COMPOUND_EXPR and use saved expression so that the overall NEW
10236 expression value is a pointer to a newly created and initialized
10238 if (TREE_CODE (original_call) == NEW_CLASS_EXPR)
10240 tree class = DECL_CONTEXT (method);
10241 tree c1, saved_new, size, new;
10242 if (flag_emit_class_files || flag_emit_xref)
10244 TREE_TYPE (patch) = build_pointer_type (class);
10247 if (!TYPE_SIZE (class))
10248 safe_layout_class (class);
10249 size = size_in_bytes (class);
10250 new = build (CALL_EXPR, promote_type (class),
10251 build_address_of (alloc_object_node),
10252 tree_cons (NULL_TREE, build_class_ref (class),
10253 build_tree_list (NULL_TREE,
10254 size_in_bytes (class))),
10256 saved_new = save_expr (new);
10257 c1 = build_tree_list (NULL_TREE, saved_new);
10258 TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1);
10259 TREE_OPERAND (original_call, 1) = c1;
10260 TREE_SET_CODE (original_call, CALL_EXPR);
10261 patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
10267 invocation_mode (method, super)
10271 int access = get_access_flags_from_decl (method);
10274 return INVOKE_SUPER;
10276 if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE)
10277 return INVOKE_STATIC;
10279 if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
10280 return INVOKE_STATIC;
10282 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
10283 return INVOKE_INTERFACE;
10285 if (DECL_CONSTRUCTOR_P (method))
10286 return INVOKE_STATIC;
10288 return INVOKE_VIRTUAL;
10291 /* Retrieve a refined list of matching methods. It covers the step
10292 15.11.2 (Compile-Time Step 2) */
10295 lookup_method_invoke (lc, cl, class, name, arg_list)
10298 tree class, name, arg_list;
10300 tree atl = end_params_node; /* Arg Type List */
10301 tree method, signature, list, node;
10302 const char *candidates; /* Used for error report */
10305 /* Fix the arguments */
10306 for (node = arg_list; node; node = TREE_CHAIN (node))
10308 tree current_arg = TREE_TYPE (TREE_VALUE (node));
10309 /* Non primitive type may have to be resolved */
10310 if (!JPRIMITIVE_TYPE_P (current_arg))
10311 resolve_and_layout (current_arg, NULL_TREE);
10313 if (TREE_CODE (current_arg) == RECORD_TYPE)
10314 current_arg = promote_type (current_arg);
10315 atl = tree_cons (NULL_TREE, current_arg, atl);
10318 /* Find all candidates and then refine the list, searching for the
10319 most specific method. */
10320 list = find_applicable_accessible_methods_list (lc, class, name, atl);
10321 list = find_most_specific_methods_list (list);
10322 if (list && !TREE_CHAIN (list))
10323 return TREE_VALUE (list);
10325 /* Issue an error. List candidates if any. Candidates are listed
10326 only if accessible (non accessible methods may end-up here for
10327 the sake of a better error report). */
10332 obstack_grow (&temporary_obstack, ". Candidates are:\n", 18);
10333 for (current = list; current; current = TREE_CHAIN (current))
10335 tree cm = TREE_VALUE (current);
10336 char string [4096];
10337 if (!cm || not_accessible_p (class, cm, 0))
10340 (string, " `%s' in `%s'%s",
10341 get_printable_method_name (cm),
10342 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))),
10343 (TREE_CHAIN (current) ? "\n" : ""));
10344 obstack_grow (&temporary_obstack, string, strlen (string));
10346 obstack_1grow (&temporary_obstack, '\0');
10347 candidates = obstack_finish (&temporary_obstack);
10349 /* Issue the error message */
10350 method = make_node (FUNCTION_TYPE);
10351 TYPE_ARG_TYPES (method) = atl;
10352 signature = build_java_argument_signature (method);
10353 dup = xstrdup (lang_printable_name (class, 0));
10354 parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s",
10355 (lc ? "constructor" : "method"),
10356 (lc ? dup : IDENTIFIER_POINTER (name)),
10357 IDENTIFIER_POINTER (signature), dup,
10358 (candidates ? candidates : ""));
10363 /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
10364 when we're looking for a constructor. */
10367 find_applicable_accessible_methods_list (lc, class, name, arglist)
10369 tree class, name, arglist;
10371 tree list = NULL_TREE, all_list = NULL_TREE;
10373 /* Search interfaces */
10374 if (CLASS_INTERFACE (TYPE_NAME (class))
10375 || CLASS_ABSTRACT (TYPE_NAME (class)))
10377 static tree searched_interfaces = NULL_TREE;
10378 static int search_not_done = 0;
10380 tree basetype_vec = TYPE_BINFO_BASETYPES (class);
10382 /* Have we searched this interface already? */
10383 if (searched_interfaces)
10386 for (current = searched_interfaces;
10387 current; current = TREE_CHAIN (current))
10388 if (TREE_VALUE (current) == class)
10391 searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces);
10393 search_applicable_methods_list
10394 (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
10396 n = TREE_VEC_LENGTH (basetype_vec);
10397 for (i = 0; i < n; i++)
10399 tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
10402 /* Skip java.lang.Object (we'll search it once later.) */
10403 if (t == object_type_node)
10407 rlist = find_applicable_accessible_methods_list (lc, t, name,
10409 all_list = chainon (rlist, (list ? list : all_list));
10413 /* We're done. Reset the searched interfaces list and finally search
10414 java.lang.Object */
10415 if (!search_not_done)
10417 searched_interfaces = NULL_TREE;
10418 search_applicable_methods_list (lc, TYPE_METHODS (object_type_node),
10419 name, arglist, &list, &all_list);
10422 /* Search classes */
10424 while (class != NULL_TREE)
10426 search_applicable_methods_list
10427 (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
10428 class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class));
10431 /* Either return the list obtained or all selected (but
10432 inaccessible) methods for better error report. */
10433 return (!list ? all_list : list);
10436 /* Effectively search for the approriate method in method */
10439 search_applicable_methods_list(lc, method, name, arglist, list, all_list)
10441 tree method, name, arglist;
10442 tree *list, *all_list;
10444 for (; method; method = TREE_CHAIN (method))
10446 /* When dealing with constructor, stop here, otherwise search
10448 if (lc && !DECL_CONSTRUCTOR_P (method))
10450 else if (!lc && (DECL_CONSTRUCTOR_P (method)
10451 || (GET_METHOD_NAME (method) != name)))
10454 if (argument_types_convertible (method, arglist))
10456 /* Retain accessible methods only */
10457 if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
10459 *list = tree_cons (NULL_TREE, method, *list);
10461 /* Also retain all selected method here */
10462 *all_list = tree_cons (NULL_TREE, method, *list);
10467 /* 15.11.2.2 Choose the Most Specific Method */
10470 find_most_specific_methods_list (list)
10474 tree current, new_list = NULL_TREE;
10475 for (current = list; current; current = TREE_CHAIN (current))
10478 DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0;
10480 for (method = list; method; method = TREE_CHAIN (method))
10482 /* Don't test a method against itself */
10483 if (method == current)
10486 /* Compare arguments and location where method where declared */
10487 if (argument_types_convertible (TREE_VALUE (method),
10488 TREE_VALUE (current))
10489 && valid_method_invocation_conversion_p
10490 (DECL_CONTEXT (TREE_VALUE (method)),
10491 DECL_CONTEXT (TREE_VALUE (current))))
10493 int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current));
10494 max = (v > max ? v : max);
10499 /* Review the list and select the maximally specific methods */
10500 for (current = list; current; current = TREE_CHAIN (current))
10501 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
10502 new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
10504 /* If we can't find one, lower expectations and try to gather multiple
10505 maximally specific methods */
10510 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
10511 new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
10519 /* Make sure that the type of each M2_OR_ARGLIST arguments can be
10520 converted by method invocation conversion (5.3) to the type of the
10521 corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
10522 to change less often than M1. */
10525 argument_types_convertible (m1, m2_or_arglist)
10526 tree m1, m2_or_arglist;
10528 static tree m2_arg_value = NULL_TREE;
10529 static tree m2_arg_cache = NULL_TREE;
10531 register tree m1_arg, m2_arg;
10533 m1_arg = TYPE_ARG_TYPES (TREE_TYPE (m1));
10534 if (!METHOD_STATIC (m1))
10535 m1_arg = TREE_CHAIN (m1_arg);
10537 if (m2_arg_value == m2_or_arglist)
10538 m2_arg = m2_arg_cache;
10541 /* M2_OR_ARGLIST can be a function DECL or a raw list of
10543 if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL)
10545 m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist));
10546 if (!METHOD_STATIC (m2_or_arglist))
10547 m2_arg = TREE_CHAIN (m2_arg);
10550 m2_arg = m2_or_arglist;
10552 m2_arg_value = m2_or_arglist;
10553 m2_arg_cache = m2_arg;
10556 while (m1_arg != end_params_node && m2_arg != end_params_node)
10558 resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE);
10559 if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg),
10560 TREE_VALUE (m2_arg)))
10562 m1_arg = TREE_CHAIN (m1_arg);
10563 m2_arg = TREE_CHAIN (m2_arg);
10565 return m1_arg == end_params_node && m2_arg == end_params_node;
10568 /* Qualification routines */
10571 qualify_ambiguous_name (id)
10574 tree qual, qual_wfl, name = NULL_TREE, decl, ptr_type = NULL_TREE,
10575 saved_current_class;
10576 int again, super_found = 0, this_found = 0, new_array_found = 0;
10579 /* We first qualify the first element, then derive qualification of
10580 others based on the first one. If the first element is qualified
10581 by a resolution (field or type), this resolution is stored in the
10582 QUAL_RESOLUTION of the qual element being examined. We need to
10583 save the current_class since the use of SUPER might change the
10585 saved_current_class = current_class;
10586 qual = EXPR_WFL_QUALIFICATION (id);
10589 /* Simple qualified expression feature a qual_wfl that is a
10590 WFL. Expression derived from a primary feature more complicated
10591 things like a CALL_EXPR. Expression from primary need to be
10592 worked out to extract the part on which the qualification will
10594 qual_wfl = QUAL_WFL (qual);
10595 switch (TREE_CODE (qual_wfl))
10598 qual_wfl = TREE_OPERAND (qual_wfl, 0);
10599 if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
10601 qual = EXPR_WFL_QUALIFICATION (qual_wfl);
10602 qual_wfl = QUAL_WFL (qual);
10605 case NEW_ARRAY_EXPR:
10606 qual = TREE_CHAIN (qual);
10607 again = new_array_found = 1;
10609 case NEW_CLASS_EXPR:
10611 qual_wfl = TREE_OPERAND (qual_wfl, 0);
10614 while (TREE_CODE (qual_wfl) == ARRAY_REF)
10615 qual_wfl = TREE_OPERAND (qual_wfl, 0);
10618 qual = TREE_CHAIN (qual);
10619 qual_wfl = QUAL_WFL (qual);
10622 /* Fix for -Wall. Just break doing nothing */
10626 ptr_type = current_class;
10628 code = TREE_CODE (qual_wfl);
10630 /* Pos evaluation: non WFL leading expression nodes */
10631 if (code == CONVERT_EXPR
10632 && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
10633 name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
10635 else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) &&
10636 TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
10637 name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
10639 else if (code == STRING_CST || code == CONDITIONAL_EXPR
10640 || code == PLUS_EXPR)
10642 qual = TREE_CHAIN (qual);
10643 qual_wfl = QUAL_WFL (qual);
10648 name = EXPR_WFL_NODE (qual_wfl);
10651 qual = EXPR_WFL_QUALIFICATION (qual_wfl);
10656 /* If we have a THIS (from a primary), we set the context accordingly */
10657 if (name == this_identifier_node)
10659 qual = TREE_CHAIN (qual);
10660 qual_wfl = QUAL_WFL (qual);
10661 if (TREE_CODE (qual_wfl) == CALL_EXPR)
10664 name = EXPR_WFL_NODE (qual_wfl);
10667 /* If we have a SUPER, we set the context accordingly */
10668 if (name == super_identifier_node)
10670 current_class = CLASSTYPE_SUPER (ptr_type);
10671 /* Check that there is such a thing as a super class. If not,
10672 return. The error will be caught later on, during the
10674 if (!current_class)
10676 current_class = saved_current_class;
10679 qual = TREE_CHAIN (qual);
10680 /* Do one more interation to set things up */
10681 super_found = again = 1;
10685 /* If name appears within the scope of a location variable
10686 declaration or parameter declaration, then it is an expression
10687 name. We don't carry this test out if we're in the context of the
10688 use of SUPER or THIS */
10689 if (!this_found && !super_found &&
10690 TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name)))
10692 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
10693 QUAL_RESOLUTION (qual) = decl;
10696 /* If within the class/interface NAME was found to be used there
10697 exists a (possibly inherited) field named NAME, then this is an
10698 expression name. If we saw a NEW_ARRAY_EXPR before and want to
10699 address length, it is OK. */
10700 else if ((decl = lookup_field_wrapper (ptr_type, name))
10701 || (new_array_found && name == length_identifier_node))
10703 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
10704 QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
10707 /* We reclassify NAME as yielding to a type name resolution if:
10708 - NAME is a class/interface declared within the compilation
10709 unit containing NAME,
10710 - NAME is imported via a single-type-import declaration,
10711 - NAME is declared in an another compilation unit of the package
10712 of the compilation unit containing NAME,
10713 - NAME is declared by exactly on type-import-on-demand declaration
10714 of the compilation unit containing NAME.
10715 - NAME is actually a STRING_CST. */
10716 else if (TREE_CODE (name) == STRING_CST ||
10717 (decl = resolve_and_layout (name, NULL_TREE)))
10719 RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
10720 QUAL_RESOLUTION (qual) = decl;
10723 /* Method call are expression name */
10724 else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
10725 || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF
10726 || TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR)
10727 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
10729 /* Check here that NAME isn't declared by more than one
10730 type-import-on-demand declaration of the compilation unit
10731 containing NAME. FIXME */
10733 /* Otherwise, NAME is reclassified as a package name */
10735 RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
10737 /* Propagate the qualification accross other components of the
10739 for (qual = TREE_CHAIN (qual); qual;
10740 qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual))
10742 if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
10743 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1;
10745 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1;
10748 /* Store the global qualification for the ambiguous part of ID back
10750 if (RESOLVE_EXPRESSION_NAME_P (qual_wfl))
10751 RESOLVE_EXPRESSION_NAME_P (id) = 1;
10752 else if (RESOLVE_TYPE_NAME_P (qual_wfl))
10753 RESOLVE_TYPE_NAME_P (id) = 1;
10754 else if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
10755 RESOLVE_PACKAGE_NAME_P (id) = 1;
10757 /* Restore the current class */
10758 current_class = saved_current_class;
10762 breakdown_qualified (left, right, source)
10763 tree *left, *right, source;
10765 char *p = IDENTIFIER_POINTER (source), *base;
10766 int l = IDENTIFIER_LENGTH (source);
10768 /* Breakdown NAME into REMAINDER . IDENTIFIER */
10771 while (*p != '.' && p != base)
10774 /* We didn't find a '.'. Return an error */
10780 *right = get_identifier (p+1);
10781 *left = get_identifier (IDENTIFIER_POINTER (source));
10787 /* Patch tree nodes in a function body. When a BLOCK is found, push
10788 local variable decls if present.
10789 Same as java_complete_lhs, but does resolve static finals to values. */
10792 java_complete_tree (node)
10795 node = java_complete_lhs (node);
10796 if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node)
10797 && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE
10798 && !flag_emit_xref)
10800 tree value = DECL_INITIAL (node);
10801 DECL_INITIAL (node) = NULL_TREE;
10802 push_obstacks (&permanent_obstack, &permanent_obstack);
10803 value = fold_constant_for_init (value, node);
10805 DECL_INITIAL (node) = value;
10806 if (value != NULL_TREE)
10813 java_stabilize_reference (node)
10816 if (TREE_CODE (node) == COMPOUND_EXPR)
10818 tree op0 = TREE_OPERAND (node, 0);
10819 tree op1 = TREE_OPERAND (node, 1);
10820 TREE_OPERAND (node, 0) = save_expr (op0);
10821 TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
10824 return stabilize_reference (node);
10827 /* Patch tree nodes in a function body. When a BLOCK is found, push
10828 local variable decls if present.
10829 Same as java_complete_tree, but does not resolve static finals to values. */
10832 java_complete_lhs (node)
10835 tree nn, cn, wfl_op1, wfl_op2, wfl_op3;
10838 /* CONVERT_EXPR always has its type set, even though it needs to be
10840 if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR)
10843 /* The switch block implements cases processing container nodes
10844 first. Contained nodes are always written back. Leaves come
10845 next and return a value. */
10846 switch (TREE_CODE (node))
10850 /* 1- Block section.
10851 Set the local values on decl names so we can identify them
10852 faster when they're referenced. At that stage, identifiers
10853 are legal so we don't check for declaration errors. */
10854 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
10856 DECL_CONTEXT (cn) = current_function_decl;
10857 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn;
10859 if (BLOCK_EXPR_BODY (node) == NULL_TREE)
10860 CAN_COMPLETE_NORMALLY (node) = 1;
10863 tree stmt = BLOCK_EXPR_BODY (node);
10865 int error_seen = 0;
10866 if (TREE_CODE (stmt) == COMPOUND_EXPR)
10868 /* Re-order from (((A; B); C); ...; Z) to
10869 (A; (B; (C ; (...; Z)))).
10870 This makes it easier to scan the statements left-to-right
10871 without using recursion (which might overflow the stack
10872 if the block has many statements. */
10875 tree left = TREE_OPERAND (stmt, 0);
10876 if (TREE_CODE (left) != COMPOUND_EXPR)
10878 TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1);
10879 TREE_OPERAND (left, 1) = stmt;
10882 BLOCK_EXPR_BODY (node) = stmt;
10885 /* Now do the actual complete, without deep recursion for
10887 ptr = &BLOCK_EXPR_BODY (node);
10888 while (TREE_CODE (*ptr) == COMPOUND_EXPR
10889 && TREE_OPERAND (*ptr, 1) != empty_stmt_node)
10891 tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
10892 tree *next = &TREE_OPERAND (*ptr, 1);
10893 TREE_OPERAND (*ptr, 0) = cur;
10894 if (cur == empty_stmt_node)
10896 /* Optimization; makes it easier to detect empty bodies.
10897 Most useful for <clinit> with all-constant initializer. */
10901 if (TREE_CODE (cur) == ERROR_MARK)
10903 else if (! CAN_COMPLETE_NORMALLY (cur))
10908 if (TREE_CODE (wfl_op2) == BLOCK)
10909 wfl_op2 = BLOCK_EXPR_BODY (wfl_op2);
10910 else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR)
10911 wfl_op2 = TREE_OPERAND (wfl_op2, 0);
10915 if (TREE_CODE (wfl_op2) != CASE_EXPR
10916 && TREE_CODE (wfl_op2) != DEFAULT_EXPR)
10917 unreachable_stmt_error (*ptr);
10921 *ptr = java_complete_tree (*ptr);
10923 if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0)
10924 return error_mark_node;
10925 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr);
10927 /* Turn local bindings to null */
10928 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
10929 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE;
10931 TREE_TYPE (node) = void_type_node;
10934 /* 2- They are expressions but ultimately deal with statements */
10937 wfl_op1 = TREE_OPERAND (node, 0);
10938 COMPLETE_CHECK_OP_0 (node);
10939 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10940 return patch_throw_statement (node, wfl_op1);
10942 case SYNCHRONIZED_EXPR:
10943 wfl_op1 = TREE_OPERAND (node, 0);
10944 return patch_synchronized_statement (node, wfl_op1);
10947 return patch_try_statement (node);
10949 case TRY_FINALLY_EXPR:
10950 COMPLETE_CHECK_OP_0 (node);
10951 COMPLETE_CHECK_OP_1 (node);
10952 CAN_COMPLETE_NORMALLY (node)
10953 = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0))
10954 && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)));
10955 TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 0));
10958 case CLEANUP_POINT_EXPR:
10959 COMPLETE_CHECK_OP_0 (node);
10960 TREE_TYPE (node) = void_type_node;
10961 CAN_COMPLETE_NORMALLY (node) =
10962 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
10965 case WITH_CLEANUP_EXPR:
10966 COMPLETE_CHECK_OP_0 (node);
10967 COMPLETE_CHECK_OP_2 (node);
10968 CAN_COMPLETE_NORMALLY (node) =
10969 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
10970 TREE_TYPE (node) = void_type_node;
10973 case LABELED_BLOCK_EXPR:
10974 PUSH_LABELED_BLOCK (node);
10975 if (LABELED_BLOCK_BODY (node))
10976 COMPLETE_CHECK_OP_1 (node);
10977 TREE_TYPE (node) = void_type_node;
10978 POP_LABELED_BLOCK ();
10980 if (LABELED_BLOCK_BODY (node) == empty_stmt_node)
10982 LABELED_BLOCK_BODY (node) = NULL_TREE;
10983 CAN_COMPLETE_NORMALLY (node) = 1;
10985 else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node)))
10986 CAN_COMPLETE_NORMALLY (node) = 1;
10989 case EXIT_BLOCK_EXPR:
10990 /* We don't complete operand 1, because it's the return value of
10991 the EXIT_BLOCK_EXPR which doesn't exist it Java */
10992 return patch_bc_statement (node);
10995 cn = java_complete_tree (TREE_OPERAND (node, 0));
10996 if (cn == error_mark_node)
10999 /* First, the case expression must be constant. Values of final
11000 fields are accepted. */
11002 if ((TREE_CODE (cn) == COMPOUND_EXPR || TREE_CODE (cn) == COMPONENT_REF)
11003 && JDECL_P (TREE_OPERAND (cn, 1))
11004 && FIELD_FINAL (TREE_OPERAND (cn, 1))
11005 && DECL_INITIAL (TREE_OPERAND (cn, 1)))
11007 push_obstacks (&permanent_obstack, &permanent_obstack);
11008 cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
11009 TREE_OPERAND (cn, 1));
11013 if (!TREE_CONSTANT (cn) && !flag_emit_xref)
11015 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11016 parse_error_context (node, "Constant expression required");
11017 return error_mark_node;
11020 nn = ctxp->current_loop;
11022 /* It must be assignable to the type of the switch expression. */
11023 if (!try_builtin_assignconv (NULL_TREE,
11024 TREE_TYPE (TREE_OPERAND (nn, 0)), cn))
11026 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11027 parse_error_context
11029 "Incompatible type for case. Can't convert `%s' to `int'",
11030 lang_printable_name (TREE_TYPE (cn), 0));
11031 return error_mark_node;
11034 cn = fold (convert (int_type_node, cn));
11036 /* Multiple instance of a case label bearing the same
11037 value is checked during code generation. The case
11038 expression is allright so far. */
11039 TREE_OPERAND (node, 0) = cn;
11040 TREE_TYPE (node) = void_type_node;
11041 CAN_COMPLETE_NORMALLY (node) = 1;
11042 TREE_SIDE_EFFECTS (node) = 1;
11046 nn = ctxp->current_loop;
11047 /* Only one default label is allowed per switch statement */
11048 if (SWITCH_HAS_DEFAULT (nn))
11050 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11051 parse_error_context (wfl_operator,
11052 "Duplicate case label: `default'");
11053 return error_mark_node;
11056 SWITCH_HAS_DEFAULT (nn) = 1;
11057 TREE_TYPE (node) = void_type_node;
11058 TREE_SIDE_EFFECTS (node) = 1;
11059 CAN_COMPLETE_NORMALLY (node) = 1;
11065 /* Check whether the loop was enclosed in a labeled
11066 statement. If not, create one, insert the loop in it and
11068 nn = patch_loop_statement (node);
11070 /* Anyways, walk the body of the loop */
11071 if (TREE_CODE (node) == LOOP_EXPR)
11072 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
11073 /* Switch statement: walk the switch expression and the cases */
11075 node = patch_switch_statement (node);
11077 if (TREE_OPERAND (node, 0) == error_mark_node)
11078 nn = error_mark_node;
11081 TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node;
11082 /* If we returned something different, that's because we
11083 inserted a label. Pop the label too. */
11086 if (CAN_COMPLETE_NORMALLY (node))
11087 CAN_COMPLETE_NORMALLY (nn) = 1;
11088 POP_LABELED_BLOCK ();
11095 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
11096 return patch_exit_expr (node);
11100 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
11101 if (TREE_OPERAND (node, 0) == error_mark_node)
11102 return error_mark_node;
11103 /* then-else branches */
11104 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
11105 if (TREE_OPERAND (node, 1) == error_mark_node)
11106 return error_mark_node;
11107 TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2));
11108 if (TREE_OPERAND (node, 2) == error_mark_node)
11109 return error_mark_node;
11110 return patch_if_else_statement (node);
11113 case CONDITIONAL_EXPR:
11115 wfl_op1 = TREE_OPERAND (node, 0);
11116 COMPLETE_CHECK_OP_0 (node);
11117 wfl_op2 = TREE_OPERAND (node, 1);
11118 COMPLETE_CHECK_OP_1 (node);
11119 wfl_op3 = TREE_OPERAND (node, 2);
11120 COMPLETE_CHECK_OP_2 (node);
11121 return patch_conditional_expr (node, wfl_op1, wfl_op2);
11123 /* 3- Expression section */
11124 case COMPOUND_EXPR:
11125 wfl_op2 = TREE_OPERAND (node, 1);
11126 TREE_OPERAND (node, 0) = nn =
11127 java_complete_tree (TREE_OPERAND (node, 0));
11128 if (wfl_op2 == empty_stmt_node)
11129 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn);
11132 if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK)
11134 /* An unreachable condition in a do-while statement
11135 is *not* (technically) an unreachable statement. */
11137 if (TREE_CODE (nn) == EXPR_WITH_FILE_LOCATION)
11138 nn = EXPR_WFL_NODE (nn);
11139 if (TREE_CODE (nn) != EXIT_EXPR)
11141 SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
11142 parse_error_context (wfl_operator, "Unreachable statement");
11145 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
11146 if (TREE_OPERAND (node, 1) == error_mark_node)
11147 return error_mark_node;
11148 CAN_COMPLETE_NORMALLY (node)
11149 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1));
11151 TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1));
11155 /* CAN_COMPLETE_NORMALLY (node) = 0; */
11156 return patch_return (node);
11158 case EXPR_WITH_FILE_LOCATION:
11159 if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
11160 || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
11163 node = resolve_expression_name (node, NULL);
11164 if (node == error_mark_node)
11166 /* Keep line number information somewhere were it doesn't
11167 disrupt the completion process. */
11168 if (flag_emit_xref && TREE_CODE (node) != CALL_EXPR)
11170 EXPR_WFL_NODE (wfl) = TREE_OPERAND (node, 1);
11171 TREE_OPERAND (node, 1) = wfl;
11173 CAN_COMPLETE_NORMALLY (node) = 1;
11178 int save_lineno = lineno;
11179 lineno = EXPR_WFL_LINENO (node);
11180 body = java_complete_tree (EXPR_WFL_NODE (node));
11181 lineno = save_lineno;
11182 EXPR_WFL_NODE (node) = body;
11183 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body);
11184 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
11185 if (body == empty_stmt_node)
11187 /* Optimization; makes it easier to detect empty bodies. */
11190 if (body == error_mark_node)
11192 /* Its important for the evaluation of assignment that
11193 this mark on the TREE_TYPE is propagated. */
11194 TREE_TYPE (node) = error_mark_node;
11195 return error_mark_node;
11198 TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node));
11203 case NEW_ARRAY_EXPR:
11204 /* Patch all the dimensions */
11206 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
11208 int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
11209 tree dim = convert (int_type_node,
11210 java_complete_tree (TREE_VALUE (cn)));
11211 if (dim == error_mark_node)
11218 TREE_VALUE (cn) = dim;
11219 /* Setup the location of the current dimension, for
11220 later error report. */
11221 TREE_PURPOSE (cn) =
11222 build_expr_wfl (NULL_TREE, input_filename, 0, 0);
11223 EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
11226 /* They complete the array creation expression, if no errors
11228 CAN_COMPLETE_NORMALLY (node) = 1;
11229 return (flag ? error_mark_node
11230 : force_evaluation_order (patch_newarray (node)));
11232 case NEW_CLASS_EXPR:
11234 /* Complete function's argument(s) first */
11235 if (complete_function_arguments (node))
11236 return error_mark_node;
11239 tree decl, wfl = TREE_OPERAND (node, 0);
11240 int in_this = CALL_THIS_CONSTRUCTOR_P (node);
11242 node = patch_method_invocation (node, NULL_TREE,
11243 NULL_TREE, 0, &decl);
11244 if (node == error_mark_node)
11245 return error_mark_node;
11247 check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl);
11248 /* If we call this(...), register signature and positions */
11250 DECL_CONSTRUCTOR_CALLS (current_function_decl) =
11251 tree_cons (wfl, decl,
11252 DECL_CONSTRUCTOR_CALLS (current_function_decl));
11253 CAN_COMPLETE_NORMALLY (node) = 1;
11254 return force_evaluation_order (node);
11258 /* Save potential wfls */
11259 wfl_op1 = TREE_OPERAND (node, 0);
11260 TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1);
11261 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)
11262 && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
11263 && DECL_INITIAL (nn) != NULL_TREE)
11267 push_obstacks (&permanent_obstack, &permanent_obstack);
11268 value = fold_constant_for_init (nn, nn);
11270 if (value != NULL_TREE)
11272 tree type = TREE_TYPE (value);
11273 if (JPRIMITIVE_TYPE_P (type) || type == string_ptr_type_node)
11274 return empty_stmt_node;
11276 DECL_INITIAL (nn) = NULL_TREE;
11278 wfl_op2 = TREE_OPERAND (node, 1);
11280 if (TREE_OPERAND (node, 0) == error_mark_node)
11281 return error_mark_node;
11283 flag = COMPOUND_ASSIGN_P (wfl_op2);
11286 tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
11288 /* Hand stablize the lhs on both places */
11289 TREE_OPERAND (node, 0) = lvalue;
11290 TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
11291 (flag_emit_class_files ? lvalue : save_expr (lvalue));
11293 /* 15.25.2.a: Left hand is not an array access. FIXME */
11294 /* Now complete the RHS. We write it back later on. */
11295 nn = java_complete_tree (TREE_OPERAND (node, 1));
11297 if ((cn = patch_string (nn)))
11300 /* The last part of the rewrite for E1 op= E2 is to have
11301 E1 = (T)(E1 op E2), with T being the type of E1. */
11302 nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
11303 TREE_TYPE (lvalue), nn));
11305 /* 15.25.2.b: Left hand is an array access. FIXME */
11308 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
11309 function to complete this RHS */
11310 else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT)
11311 nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)),
11312 TREE_OPERAND (node, 1));
11313 /* Otherwise we simply complete the RHS */
11315 nn = java_complete_tree (TREE_OPERAND (node, 1));
11317 if (nn == error_mark_node)
11318 return error_mark_node;
11320 /* Write back the RHS as we evaluated it. */
11321 TREE_OPERAND (node, 1) = nn;
11323 /* In case we're handling = with a String as a RHS, we need to
11324 produce a String out of the RHS (it might still be a
11325 STRING_CST or a StringBuffer at this stage */
11326 if ((nn = patch_string (TREE_OPERAND (node, 1))))
11327 TREE_OPERAND (node, 1) = nn;
11328 node = patch_assignment (node, wfl_op1, wfl_op2);
11329 /* Reorganize the tree if necessary. */
11330 if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
11331 || JSTRING_P (TREE_TYPE (node))))
11332 node = java_refold (node);
11333 CAN_COMPLETE_NORMALLY (node) = 1;
11345 case TRUNC_MOD_EXPR:
11347 case TRUTH_ANDIF_EXPR:
11348 case TRUTH_ORIF_EXPR:
11355 /* Operands 0 and 1 are WFL in certain cases only. patch_binop
11356 knows how to handle those cases. */
11357 wfl_op1 = TREE_OPERAND (node, 0);
11358 wfl_op2 = TREE_OPERAND (node, 1);
11360 CAN_COMPLETE_NORMALLY (node) = 1;
11361 /* Don't complete string nodes if dealing with the PLUS operand. */
11362 if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1))
11364 nn = java_complete_tree (wfl_op1);
11365 if (nn == error_mark_node)
11366 return error_mark_node;
11367 if ((cn = patch_string (nn)))
11369 TREE_OPERAND (node, 0) = nn;
11371 if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2))
11373 nn = java_complete_tree (wfl_op2);
11374 if (nn == error_mark_node)
11375 return error_mark_node;
11376 if ((cn = patch_string (nn)))
11378 TREE_OPERAND (node, 1) = nn;
11380 return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2));
11382 case INSTANCEOF_EXPR:
11383 wfl_op1 = TREE_OPERAND (node, 0);
11384 COMPLETE_CHECK_OP_0 (node);
11385 if (flag_emit_xref)
11387 TREE_TYPE (node) = boolean_type_node;
11390 return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1));
11392 case UNARY_PLUS_EXPR:
11394 case TRUTH_NOT_EXPR:
11396 case PREDECREMENT_EXPR:
11397 case PREINCREMENT_EXPR:
11398 case POSTDECREMENT_EXPR:
11399 case POSTINCREMENT_EXPR:
11401 /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
11402 how to handle those cases. */
11403 wfl_op1 = TREE_OPERAND (node, 0);
11404 CAN_COMPLETE_NORMALLY (node) = 1;
11405 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
11406 if (TREE_OPERAND (node, 0) == error_mark_node)
11407 return error_mark_node;
11408 node = patch_unaryop (node, wfl_op1);
11409 CAN_COMPLETE_NORMALLY (node) = 1;
11413 /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
11414 how to handle those cases. */
11415 wfl_op1 = TREE_OPERAND (node, 0);
11416 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
11417 if (TREE_OPERAND (node, 0) == error_mark_node)
11418 return error_mark_node;
11419 if (!flag_emit_class_files && !flag_emit_xref)
11420 TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0));
11421 /* The same applies to wfl_op2 */
11422 wfl_op2 = TREE_OPERAND (node, 1);
11423 TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
11424 if (TREE_OPERAND (node, 1) == error_mark_node)
11425 return error_mark_node;
11426 if (!flag_emit_class_files && !flag_emit_xref)
11427 TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1));
11428 return patch_array_ref (node);
11433 case COMPONENT_REF:
11434 /* The first step in the re-write of qualified name handling. FIXME.
11435 So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
11436 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
11437 if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE)
11439 tree name = TREE_OPERAND (node, 1);
11440 tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name);
11441 if (field == NULL_TREE)
11443 error ("missing static field `%s'", IDENTIFIER_POINTER (name));
11444 return error_mark_node;
11446 if (! FIELD_STATIC (field))
11448 error ("not a static field `%s'", IDENTIFIER_POINTER (name));
11449 return error_mark_node;
11454 fatal ("unimplemented java_complete_tree for COMPONENT_REF");
11458 /* Can't use THIS in a static environment */
11461 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11462 parse_error_context (wfl_operator,
11463 "Keyword `this' used outside allowed context");
11464 TREE_TYPE (node) = error_mark_node;
11465 return error_mark_node;
11467 if (ctxp->explicit_constructor_p)
11469 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11470 parse_error_context
11471 (wfl_operator, "Can't reference `this' or `super' before the superclass constructor has been called");
11472 TREE_TYPE (node) = error_mark_node;
11473 return error_mark_node;
11475 return current_this;
11478 CAN_COMPLETE_NORMALLY (node) = 1;
11479 /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
11480 and it's time to turn it into the appropriate String object
11482 if ((node = patch_string (node)))
11484 fatal ("No case for tree code `%s' - java_complete_tree\n",
11485 tree_code_name [TREE_CODE (node)]);
11490 /* Complete function call's argument. Return a non zero value is an
11491 error was found. */
11494 complete_function_arguments (node)
11500 ctxp->explicit_constructor_p += (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0);
11501 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
11503 tree wfl = TREE_VALUE (cn), parm, temp;
11504 parm = java_complete_tree (wfl);
11505 if (parm == error_mark_node)
11510 /* If have a string literal that we haven't transformed yet or a
11511 crafted string buffer, as a result of use of the the String
11512 `+' operator. Build `parm.toString()' and expand it. */
11513 if ((temp = patch_string (parm)))
11515 /* Inline PRIMTYPE.TYPE read access */
11516 parm = maybe_build_primttype_type_ref (parm, wfl);
11518 TREE_VALUE (cn) = parm;
11520 ctxp->explicit_constructor_p -= (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0);
11524 /* Sometimes (for loops and variable initialized during their
11525 declaration), we want to wrap a statement around a WFL and turn it
11529 build_debugable_stmt (location, stmt)
11533 if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
11535 stmt = build_expr_wfl (stmt, input_filename, 0, 0);
11536 EXPR_WFL_LINECOL (stmt) = location;
11538 JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
11543 build_expr_block (body, decls)
11546 tree node = make_node (BLOCK);
11547 BLOCK_EXPR_DECLS (node) = decls;
11548 BLOCK_EXPR_BODY (node) = body;
11550 TREE_TYPE (node) = TREE_TYPE (body);
11551 TREE_SIDE_EFFECTS (node) = 1;
11555 /* Create a new function block and link it approriately to current
11556 function block chain */
11561 return (enter_a_block (build_expr_block (NULL_TREE, NULL_TREE)));
11564 /* Link block B supercontext to the previous block. The current
11565 function DECL is used as supercontext when enter_a_block is called
11566 for the first time for a given function. The current function body
11567 (DECL_FUNCTION_BODY) is set to be block B. */
11573 tree fndecl = current_function_decl;
11576 BLOCK_SUPERCONTEXT (b) = current_static_block;
11577 current_static_block = b;
11580 else if (!DECL_FUNCTION_BODY (fndecl))
11582 BLOCK_SUPERCONTEXT (b) = fndecl;
11583 DECL_FUNCTION_BODY (fndecl) = b;
11587 BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl);
11588 DECL_FUNCTION_BODY (fndecl) = b;
11593 /* Exit a block by changing the current function body
11594 (DECL_FUNCTION_BODY) to the current block super context, only if
11595 the block being exited isn't the method's top level one. */
11601 if (current_function_decl)
11603 b = DECL_FUNCTION_BODY (current_function_decl);
11604 if (BLOCK_SUPERCONTEXT (b) != current_function_decl)
11605 DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b);
11609 b = current_static_block;
11611 if (BLOCK_SUPERCONTEXT (b))
11612 current_static_block = BLOCK_SUPERCONTEXT (b);
11617 /* Lookup for NAME in the nested function's blocks, all the way up to
11618 the current toplevel one. It complies with Java's local variable
11622 lookup_name_in_blocks (name)
11625 tree b = GET_CURRENT_BLOCK (current_function_decl);
11627 while (b != current_function_decl)
11631 /* Paranoid sanity check. To be removed */
11632 if (TREE_CODE (b) != BLOCK)
11633 fatal ("non block expr function body - lookup_name_in_blocks");
11635 for (current = BLOCK_EXPR_DECLS (b); current;
11636 current = TREE_CHAIN (current))
11637 if (DECL_NAME (current) == name)
11639 b = BLOCK_SUPERCONTEXT (b);
11645 maybe_absorb_scoping_blocks ()
11647 while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl)))
11649 tree b = exit_block ();
11650 java_method_add_stmt (current_function_decl, b);
11651 SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno));
11656 /* This section of the source is reserved to build_* functions that
11657 are building incomplete tree nodes and the patch_* functions that
11658 are completing them. */
11660 /* Build a super() constructor invocation. Returns empty_stmt_node if
11661 we're currently dealing with the class java.lang.Object. */
11664 build_super_invocation (mdecl)
11667 if (DECL_CONTEXT (mdecl) == object_type_node)
11668 return empty_stmt_node;
11671 tree super_wfl = build_wfl_node (super_identifier_node);
11672 return build_method_invocation (super_wfl, NULL_TREE);
11676 /* Build a SUPER/THIS qualified method invocation. */
11679 build_this_super_qualified_invocation (use_this, name, args, lloc, rloc)
11687 build_wfl_node (use_this ? this_identifier_node : super_identifier_node);
11688 EXPR_WFL_LINECOL (wfl) = lloc;
11689 invok = build_method_invocation (name, args);
11690 return make_qualified_primary (wfl, invok, rloc);
11693 /* Build an incomplete CALL_EXPR node. */
11696 build_method_invocation (name, args)
11700 tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE);
11701 TREE_SIDE_EFFECTS (call) = 1;
11702 EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
11706 /* Build an incomplete new xxx(...) node. */
11709 build_new_invocation (name, args)
11712 tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE);
11713 TREE_SIDE_EFFECTS (call) = 1;
11714 EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
11718 /* Build an incomplete assignment expression. */
11721 build_assignment (op, op_location, lhs, rhs)
11722 int op, op_location;
11726 /* Build the corresponding binop if we deal with a Compound
11727 Assignment operator. Mark the binop sub-tree as part of a
11728 Compound Assignment expression */
11729 if (op != ASSIGN_TK)
11731 rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs);
11732 COMPOUND_ASSIGN_P (rhs) = 1;
11734 assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs);
11735 TREE_SIDE_EFFECTS (assignment) = 1;
11736 EXPR_WFL_LINECOL (assignment) = op_location;
11740 /* Print an INTEGER_CST node in a static buffer, and return the buffer. */
11743 print_int_node (node)
11746 static char buffer [80];
11747 if (TREE_CONSTANT_OVERFLOW (node))
11748 sprintf (buffer, "<overflow>");
11750 if (TREE_INT_CST_HIGH (node) == 0)
11751 sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED,
11752 TREE_INT_CST_LOW (node));
11753 else if (TREE_INT_CST_HIGH (node) == -1
11754 && TREE_INT_CST_LOW (node) != 0)
11757 sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED,
11758 -TREE_INT_CST_LOW (node));
11761 sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
11762 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
11767 /* Return 1 if an assignment to a FINAL is attempted in a non suitable
11771 check_final_assignment (lvalue, wfl)
11774 if (JDECL_P (lvalue)
11775 && FIELD_FINAL (lvalue) && !IS_CLINIT (current_function_decl))
11777 parse_error_context
11778 (wfl, "Can't assign a value to the final variable `%s'",
11779 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
11785 /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
11786 read. This is needed to avoid circularities in the implementation
11787 of these fields in libjava. */
11790 maybe_build_primttype_type_ref (rhs, wfl)
11793 tree to_return = NULL_TREE;
11794 tree rhs_type = TREE_TYPE (rhs);
11795 if (TREE_CODE (rhs) == COMPOUND_EXPR)
11797 tree n = TREE_OPERAND (rhs, 1);
11798 if (TREE_CODE (n) == VAR_DECL
11799 && DECL_NAME (n) == TYPE_identifier_node
11800 && rhs_type == class_ptr_type)
11802 const char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
11803 if (!strncmp (self_name, "java.lang.", 10))
11804 to_return = build_primtype_type_ref (self_name);
11807 return (to_return ? to_return : rhs );
11810 /* 15.25 Assignment operators. */
11813 patch_assignment (node, wfl_op1, wfl_op2)
11818 tree rhs = TREE_OPERAND (node, 1);
11819 tree lvalue = TREE_OPERAND (node, 0), llvalue;
11820 tree lhs_type = NULL_TREE, rhs_type, new_rhs = NULL_TREE;
11821 int error_found = 0;
11822 int lvalue_from_array = 0;
11824 /* Can't assign to a final. */
11825 if (check_final_assignment (lvalue, wfl_op1))
11828 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11830 /* Lhs can be a named variable */
11831 if (JDECL_P (lvalue))
11833 lhs_type = TREE_TYPE (lvalue);
11835 /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
11836 comment on reason why */
11837 else if (TREE_CODE (wfl_op1) == ARRAY_REF)
11839 lhs_type = TREE_TYPE (lvalue);
11840 lvalue_from_array = 1;
11842 /* Or a field access */
11843 else if (TREE_CODE (lvalue) == COMPONENT_REF)
11844 lhs_type = TREE_TYPE (lvalue);
11845 /* Or a function return slot */
11846 else if (TREE_CODE (lvalue) == RESULT_DECL)
11847 lhs_type = TREE_TYPE (lvalue);
11848 /* Otherwise, we might want to try to write into an optimized static
11849 final, this is an of a different nature, reported further on. */
11850 else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION
11851 && resolve_expression_name (wfl_op1, &llvalue))
11853 if (check_final_assignment (llvalue, wfl_op1))
11855 /* What we should do instead is resetting the all the flags
11856 previously set, exchange lvalue for llvalue and continue. */
11858 return error_mark_node;
11861 lhs_type = TREE_TYPE (lvalue);
11865 parse_error_context (wfl_op1, "Invalid left hand side of assignment");
11869 rhs_type = TREE_TYPE (rhs);
11870 /* 5.1 Try the assignment conversion for builtin type. */
11871 new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs);
11873 /* 5.2 If it failed, try a reference conversion */
11874 if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs)))
11875 lhs_type = promote_type (rhs_type);
11877 /* 15.25.2 If we have a compound assignment, convert RHS into the
11879 else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
11880 new_rhs = convert (lhs_type, rhs);
11882 /* Explicit cast required. This is an error */
11885 char *t1 = xstrdup (lang_printable_name (TREE_TYPE (rhs), 0));
11886 char *t2 = xstrdup (lang_printable_name (lhs_type, 0));
11888 char operation [32]; /* Max size known */
11890 /* If the assignment is part of a declaration, we use the WFL of
11891 the declared variable to point out the error and call it a
11892 declaration problem. If the assignment is a genuine =
11893 operator, we call is a operator `=' problem, otherwise we
11894 call it an assignment problem. In both of these last cases,
11895 we use the WFL of the operator to indicate the error. */
11897 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node))
11900 strcpy (operation, "declaration");
11904 wfl = wfl_operator;
11905 if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
11906 strcpy (operation, "assignment");
11907 else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL)
11908 strcpy (operation, "`return'");
11910 strcpy (operation, "`='");
11913 if (!valid_cast_to_p (rhs_type, lhs_type))
11914 parse_error_context
11915 (wfl, "Incompatible type for %s. Can't convert `%s' to `%s'",
11916 operation, t1, t2);
11918 parse_error_context (wfl, "Incompatible type for %s. Explicit cast needed to convert `%s' to `%s'",
11919 operation, t1, t2);
11920 free (t1); free (t2);
11924 /* Inline read access to java.lang.PRIMTYPE.TYPE */
11926 new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2);
11929 return error_mark_node;
11931 /* 10.10: Array Store Exception runtime check */
11932 if (!flag_emit_class_files
11934 && lvalue_from_array
11935 && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type)))
11938 tree base = lvalue;
11940 /* We need to retrieve the right argument for _Jv_CheckArrayStore */
11941 if (TREE_CODE (lvalue) == COMPOUND_EXPR)
11942 base = TREE_OPERAND (lvalue, 0);
11945 if (flag_bounds_check)
11946 base = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base, 0), 1), 0);
11948 base = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
11951 /* Build the invocation of _Jv_CheckArrayStore */
11952 new_rhs = save_expr (new_rhs);
11953 check = build (CALL_EXPR, void_type_node,
11954 build_address_of (soft_checkarraystore_node),
11955 tree_cons (NULL_TREE, base,
11956 build_tree_list (NULL_TREE, new_rhs)),
11958 TREE_SIDE_EFFECTS (check) = 1;
11960 /* We have to decide on an insertion point */
11961 if (TREE_CODE (lvalue) == COMPOUND_EXPR)
11964 if (flag_bounds_check)
11966 t = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0);
11967 TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0) =
11968 build (COMPOUND_EXPR, void_type_node, t, check);
11971 TREE_OPERAND (lvalue, 1) = build (COMPOUND_EXPR, lhs_type,
11972 check, TREE_OPERAND (lvalue, 1));
11976 /* Make sure the bound check will happen before the store check */
11977 if (flag_bounds_check)
11978 TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0) =
11979 build (COMPOUND_EXPR, void_type_node,
11980 TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0), check);
11982 lvalue = build (COMPOUND_EXPR, lhs_type, check, lvalue);
11986 TREE_OPERAND (node, 0) = lvalue;
11987 TREE_OPERAND (node, 1) = new_rhs;
11988 TREE_TYPE (node) = lhs_type;
11992 /* Check that type SOURCE can be cast into type DEST. If the cast
11993 can't occur at all, return 0 otherwise 1. This function is used to
11994 produce accurate error messages on the reasons why an assignment
11998 try_reference_assignconv (lhs_type, rhs)
11999 tree lhs_type, rhs;
12001 tree new_rhs = NULL_TREE;
12002 tree rhs_type = TREE_TYPE (rhs);
12004 if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type))
12006 /* `null' may be assigned to any reference type */
12007 if (rhs == null_pointer_node)
12008 new_rhs = null_pointer_node;
12009 /* Try the reference assignment conversion */
12010 else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0))
12012 /* This is a magic assignment that we process differently */
12013 else if (rhs == soft_exceptioninfo_call_node)
12019 /* Check that RHS can be converted into LHS_TYPE by the assignment
12020 conversion (5.2), for the cases of RHS being a builtin type. Return
12021 NULL_TREE if the conversion fails or if because RHS isn't of a
12022 builtin type. Return a converted RHS if the conversion is possible. */
12025 try_builtin_assignconv (wfl_op1, lhs_type, rhs)
12026 tree wfl_op1, lhs_type, rhs;
12028 tree new_rhs = NULL_TREE;
12029 tree rhs_type = TREE_TYPE (rhs);
12031 /* Zero accepted everywhere */
12032 if (TREE_CODE (rhs) == INTEGER_CST
12033 && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0
12034 && JPRIMITIVE_TYPE_P (rhs_type))
12035 new_rhs = convert (lhs_type, rhs);
12037 /* 5.1.1 Try Identity Conversion,
12038 5.1.2 Try Widening Primitive Conversion */
12039 else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type))
12040 new_rhs = convert (lhs_type, rhs);
12042 /* Try a narrowing primitive conversion (5.1.3):
12043 - expression is a constant expression of type int AND
12044 - variable is byte, short or char AND
12045 - The value of the expression is representable in the type of the
12047 else if (rhs_type == int_type_node && TREE_CONSTANT (rhs)
12048 && (lhs_type == byte_type_node || lhs_type == char_type_node
12049 || lhs_type == short_type_node))
12051 if (int_fits_type_p (rhs, lhs_type))
12052 new_rhs = convert (lhs_type, rhs);
12053 else if (wfl_op1) /* Might be called with a NULL */
12054 parse_warning_context
12055 (wfl_op1, "Constant expression `%s' to wide for narrowing primitive conversion to `%s'",
12056 print_int_node (rhs), lang_printable_name (lhs_type, 0));
12057 /* Reported a warning that will turn into an error further
12058 down, so we don't return */
12064 /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
12065 conversion (5.1.1) or widening primitve conversion (5.1.2). Return
12066 0 is the conversion test fails. This implements parts the method
12067 invocation convertion (5.3). */
12070 valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)
12071 tree lhs_type, rhs_type;
12073 /* 5.1.1: This is the identity conversion part. */
12074 if (lhs_type == rhs_type)
12077 /* Reject non primitive types */
12078 if (!JPRIMITIVE_TYPE_P (lhs_type) || !JPRIMITIVE_TYPE_P (rhs_type))
12081 /* 5.1.2: widening primitive conversion. byte, even if it's smaller
12082 than a char can't be converted into a char. Short can't too, but
12083 the < test below takes care of that */
12084 if (lhs_type == char_type_node && rhs_type == byte_type_node)
12087 /* Accept all promoted type here. Note, we can't use <= in the test
12088 below, because we still need to bounce out assignments of short
12089 to char and the likes */
12090 if (lhs_type == int_type_node
12091 && (rhs_type == promoted_byte_type_node
12092 || rhs_type == promoted_short_type_node
12093 || rhs_type == promoted_char_type_node
12094 || rhs_type == promoted_boolean_type_node))
12097 /* From here, an integral is widened if its precision is smaller
12098 than the precision of the LHS or if the LHS is a floating point
12099 type, or the RHS is a float and the RHS a double. */
12100 if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type)
12101 && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)))
12102 || (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type))
12103 || (rhs_type == float_type_node && lhs_type == double_type_node))
12109 /* Check that something of SOURCE type can be assigned or cast to
12110 something of DEST type at runtime. Return 1 if the operation is
12111 valid, 0 otherwise. If CAST is set to 1, we're treating the case
12112 were SOURCE is cast into DEST, which borrows a lot of the
12113 assignment check. */
12116 valid_ref_assignconv_cast_p (source, dest, cast)
12121 /* SOURCE or DEST might be null if not from a declared entity. */
12122 if (!source || !dest)
12124 if (JNULLP_TYPE_P (source))
12126 if (TREE_CODE (source) == POINTER_TYPE)
12127 source = TREE_TYPE (source);
12128 if (TREE_CODE (dest) == POINTER_TYPE)
12129 dest = TREE_TYPE (dest);
12130 /* Case where SOURCE is a class type */
12131 if (TYPE_CLASS_P (source))
12133 if (TYPE_CLASS_P (dest))
12134 return source == dest || inherits_from_p (source, dest)
12135 || (cast && inherits_from_p (dest, source));
12136 if (TYPE_INTERFACE_P (dest))
12138 /* If doing a cast and SOURCE is final, the operation is
12139 always correct a compile time (because even if SOURCE
12140 does not implement DEST, a subclass of SOURCE might). */
12141 if (cast && !CLASS_FINAL (TYPE_NAME (source)))
12143 /* Otherwise, SOURCE must implement DEST */
12144 return interface_of_p (dest, source);
12146 /* DEST is an array, cast permited if SOURCE is of Object type */
12147 return (cast && source == object_type_node ? 1 : 0);
12149 if (TYPE_INTERFACE_P (source))
12151 if (TYPE_CLASS_P (dest))
12153 /* If not casting, DEST must be the Object type */
12155 return dest == object_type_node;
12156 /* We're doing a cast. The cast is always valid is class
12157 DEST is not final, otherwise, DEST must implement SOURCE */
12158 else if (!CLASS_FINAL (TYPE_NAME (dest)))
12161 return interface_of_p (source, dest);
12163 if (TYPE_INTERFACE_P (dest))
12165 /* If doing a cast, then if SOURCE and DEST contain method
12166 with the same signature but different return type, then
12167 this is a (compile time) error */
12170 tree method_source, method_dest;
12174 for (method_source = TYPE_METHODS (source); method_source;
12175 method_source = TREE_CHAIN (method_source))
12178 build_java_argument_signature (TREE_TYPE (method_source));
12179 source_type = TREE_TYPE (TREE_TYPE (method_source));
12180 source_name = DECL_NAME (method_source);
12181 for (method_dest = TYPE_METHODS (dest);
12182 method_dest; method_dest = TREE_CHAIN (method_dest))
12184 build_java_argument_signature (TREE_TYPE (method_dest))
12185 && source_name == DECL_NAME (method_dest)
12186 && source_type != TREE_TYPE (TREE_TYPE (method_dest)))
12192 return source == dest || interface_of_p (dest, source);
12196 (DECL_NAME (TYPE_NAME (source)) == java_lang_cloneable) : 0);
12198 if (TYPE_ARRAY_P (source))
12200 if (TYPE_CLASS_P (dest))
12201 return dest == object_type_node;
12202 /* Can't cast an array to an interface unless the interface is
12203 java.lang.Cloneable */
12204 if (TYPE_INTERFACE_P (dest))
12205 return (DECL_NAME (TYPE_NAME (dest)) == java_lang_cloneable ? 1 : 0);
12208 tree source_element_type = TYPE_ARRAY_ELEMENT (source);
12209 tree dest_element_type = TYPE_ARRAY_ELEMENT (dest);
12211 /* In case of severe errors, they turn out null */
12212 if (!dest_element_type || !source_element_type)
12214 if (source_element_type == dest_element_type)
12216 return valid_ref_assignconv_cast_p (source_element_type,
12217 dest_element_type, cast);
12225 valid_cast_to_p (source, dest)
12229 if (TREE_CODE (source) == POINTER_TYPE)
12230 source = TREE_TYPE (source);
12231 if (TREE_CODE (dest) == POINTER_TYPE)
12232 dest = TREE_TYPE (dest);
12234 if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE)
12235 return valid_ref_assignconv_cast_p (source, dest, 1);
12237 else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest))
12243 /* Method invocation conversion test. Return 1 if type SOURCE can be
12244 converted to type DEST through the methond invocation conversion
12248 do_unary_numeric_promotion (arg)
12251 tree type = TREE_TYPE (arg);
12252 if (TREE_CODE (type) == INTEGER_TYPE ? TYPE_PRECISION (type) < 32
12253 : TREE_CODE (type) == CHAR_TYPE)
12254 arg = convert (int_type_node, arg);
12258 /* Return a non zero value if SOURCE can be converted into DEST using
12259 the method invocation conversion rule (5.3). */
12261 valid_method_invocation_conversion_p (dest, source)
12264 return ((JPRIMITIVE_TYPE_P (source) && JPRIMITIVE_TYPE_P (dest)
12265 && valid_builtin_assignconv_identity_widening_p (dest, source))
12266 || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source))
12267 && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest))
12268 && valid_ref_assignconv_cast_p (source, dest, 0)));
12271 /* Build an incomplete binop expression. */
12274 build_binop (op, op_location, op1, op2)
12279 tree binop = build (op, NULL_TREE, op1, op2);
12280 TREE_SIDE_EFFECTS (binop) = 1;
12281 /* Store the location of the operator, for better error report. The
12282 string of the operator will be rebuild based on the OP value. */
12283 EXPR_WFL_LINECOL (binop) = op_location;
12287 /* Build the string of the operator retained by NODE. If NODE is part
12288 of a compound expression, add an '=' at the end of the string. This
12289 function is called when an error needs to be reported on an
12290 operator. The string is returned as a pointer to a static character
12294 operator_string (node)
12297 #define BUILD_OPERATOR_STRING(S) \
12299 sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
12303 static char buffer [10];
12304 switch (TREE_CODE (node))
12306 case MULT_EXPR: BUILD_OPERATOR_STRING ("*");
12307 case RDIV_EXPR: BUILD_OPERATOR_STRING ("/");
12308 case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%");
12309 case PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
12310 case MINUS_EXPR: BUILD_OPERATOR_STRING ("-");
12311 case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<");
12312 case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>");
12313 case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>");
12314 case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&");
12315 case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^");
12316 case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|");
12317 case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&");
12318 case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||");
12319 case EQ_EXPR: BUILD_OPERATOR_STRING ("==");
12320 case NE_EXPR: BUILD_OPERATOR_STRING ("!=");
12321 case GT_EXPR: BUILD_OPERATOR_STRING (">");
12322 case GE_EXPR: BUILD_OPERATOR_STRING (">=");
12323 case LT_EXPR: BUILD_OPERATOR_STRING ("<");
12324 case LE_EXPR: BUILD_OPERATOR_STRING ("<=");
12325 case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
12326 case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-");
12327 case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!");
12328 case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~");
12329 case PREINCREMENT_EXPR: /* Fall through */
12330 case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++");
12331 case PREDECREMENT_EXPR: /* Fall through */
12332 case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--");
12334 fatal ("unregistered operator %s - operator_string",
12335 tree_code_name [TREE_CODE (node)]);
12338 #undef BUILD_OPERATOR_STRING
12341 /* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
12344 java_decl_equiv (var_acc1, var_acc2)
12345 tree var_acc1, var_acc2;
12347 if (JDECL_P (var_acc1))
12348 return (var_acc1 == var_acc2);
12350 return (TREE_CODE (var_acc1) == COMPONENT_REF
12351 && TREE_CODE (var_acc2) == COMPONENT_REF
12352 && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
12353 == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0)
12354 && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1));
12357 /* Return a non zero value if CODE is one of the operators that can be
12358 used in conjunction with the `=' operator in a compound assignment. */
12361 binop_compound_p (code)
12362 enum tree_code code;
12365 for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++)
12366 if (binop_lookup [i] == code)
12369 return i < BINOP_COMPOUND_CANDIDATES;
12372 /* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
12378 tree c, b, ns, decl;
12380 if (TREE_CODE (t) != MODIFY_EXPR)
12383 c = TREE_OPERAND (t, 1);
12384 if (! (c && TREE_CODE (c) == COMPOUND_EXPR
12385 && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR
12386 && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1)))))
12389 /* Now the left branch of the binary operator. */
12390 b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
12391 if (! (b && TREE_CODE (b) == NOP_EXPR
12392 && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
12395 ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0);
12396 if (! (ns && TREE_CODE (ns) == NOP_EXPR
12397 && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR))
12400 decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0);
12401 if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF)
12402 /* It's got to be the an equivalent decl */
12403 && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0)))
12405 /* Shorten the NOP_EXPR/SAVE_EXPR path. */
12406 TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0);
12407 /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
12408 TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1);
12409 /* Change the right part of the BINOP_EXPR */
12410 TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0);
12416 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
12417 errors but we modify NODE so that it contains the type computed
12418 according to the expression, when it's fixed. Otherwise, we write
12419 error_mark_node as the type. It allows us to further the analysis
12420 of remaining nodes and detects more errors in certain cases. */
12423 patch_binop (node, wfl_op1, wfl_op2)
12428 tree op1 = TREE_OPERAND (node, 0);
12429 tree op2 = TREE_OPERAND (node, 1);
12430 tree op1_type = TREE_TYPE (op1);
12431 tree op2_type = TREE_TYPE (op2);
12432 tree prom_type = NULL_TREE;
12433 int code = TREE_CODE (node);
12435 /* If 1, tell the routine that we have to return error_mark_node
12436 after checking for the initialization of the RHS */
12437 int error_found = 0;
12439 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
12443 /* 15.16 Multiplicative operators */
12444 case MULT_EXPR: /* 15.16.1 Multiplication Operator * */
12445 case RDIV_EXPR: /* 15.16.2 Division Operator / */
12446 case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */
12447 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
12449 if (!JPRIMITIVE_TYPE_P (op1_type))
12450 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
12451 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
12452 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
12453 TREE_TYPE (node) = error_mark_node;
12457 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12458 /* Change the division operator if necessary */
12459 if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
12460 TREE_SET_CODE (node, TRUNC_DIV_EXPR);
12462 if (TREE_CODE (prom_type) == INTEGER_TYPE
12463 && flag_use_divide_subroutine
12464 && ! flag_emit_class_files
12465 && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
12466 return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
12468 /* This one is more complicated. FLOATs are processed by a
12469 function call to soft_fmod. Duplicate the value of the
12470 COMPOUND_ASSIGN_P flag. */
12471 if (code == TRUNC_MOD_EXPR)
12473 tree mod = build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2);
12474 COMPOUND_ASSIGN_P (mod) = COMPOUND_ASSIGN_P (node);
12475 TREE_SIDE_EFFECTS (mod)
12476 = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12481 /* 15.17 Additive Operators */
12482 case PLUS_EXPR: /* 15.17.1 String Concatenation Operator + */
12484 /* Operation is valid if either one argument is a string
12485 constant, a String object or a StringBuffer crafted for the
12486 purpose of the a previous usage of the String concatenation
12489 if (TREE_CODE (op1) == STRING_CST
12490 || TREE_CODE (op2) == STRING_CST
12491 || JSTRING_TYPE_P (op1_type)
12492 || JSTRING_TYPE_P (op2_type)
12493 || IS_CRAFTED_STRING_BUFFER_P (op1)
12494 || IS_CRAFTED_STRING_BUFFER_P (op2))
12495 return build_string_concatenation (op1, op2);
12497 case MINUS_EXPR: /* 15.17.2 Additive Operators (+ and -) for
12499 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
12501 if (!JPRIMITIVE_TYPE_P (op1_type))
12502 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
12503 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
12504 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
12505 TREE_TYPE (node) = error_mark_node;
12509 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12512 /* 15.18 Shift Operators */
12516 if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type))
12518 if (!JINTEGRAL_TYPE_P (op1_type))
12519 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
12522 if (JPRIMITIVE_TYPE_P (op2_type))
12523 parse_error_context (wfl_operator,
12524 "Incompatible type for `%s'. Explicit cast needed to convert shift distance from `%s' to integral",
12525 operator_string (node),
12526 lang_printable_name (op2_type, 0));
12528 parse_error_context (wfl_operator,
12529 "Incompatible type for `%s'. Can't convert shift distance from `%s' to integral",
12530 operator_string (node),
12531 lang_printable_name (op2_type, 0));
12533 TREE_TYPE (node) = error_mark_node;
12538 /* Unary numeric promotion (5.6.1) is performed on each operand
12540 op1 = do_unary_numeric_promotion (op1);
12541 op2 = do_unary_numeric_promotion (op2);
12543 /* The type of the shift expression is the type of the promoted
12544 type of the left-hand operand */
12545 prom_type = TREE_TYPE (op1);
12547 /* Shift int only up to 0x1f and long up to 0x3f. The bytecode
12548 generator should take care of removing this operation. FIXME */
12549 op2 = fold (build (BIT_AND_EXPR, prom_type, convert (prom_type, op2),
12550 (prom_type == int_type_node ? build_int_2 (0x1f, 0) :
12551 convert (prom_type, build_int_2 (0x3f, 0)))));
12553 /* The >>> operator is a >> operating on unsigned quantities */
12554 if (code == URSHIFT_EXPR && ! flag_emit_class_files)
12557 tree utype = unsigned_type (prom_type);
12558 op1 = convert (utype, op1);
12559 TREE_SET_CODE (node, RSHIFT_EXPR);
12560 TREE_OPERAND (node, 0) = op1;
12561 TREE_OPERAND (node, 1) = op2;
12562 TREE_TYPE (node) = utype;
12563 to_return = convert (prom_type, node);
12564 /* Copy the original value of the COMPOUND_ASSIGN_P flag */
12565 COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node);
12566 TREE_SIDE_EFFECTS (to_return)
12567 = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12572 /* 15.19.1 Type Comparison Operator instaceof */
12573 case INSTANCEOF_EXPR:
12575 TREE_TYPE (node) = boolean_type_node;
12577 if (!(op2_type = resolve_type_during_patch (op2)))
12578 return error_mark_node;
12580 /* The first operand must be a reference type or the null type */
12581 if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node)
12582 error_found = 1; /* Error reported further below */
12584 /* The second operand must be a reference type */
12585 if (!JREFERENCE_TYPE_P (op2_type))
12587 SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
12588 parse_error_context
12589 (wfl_operator, "Invalid argument `%s' for `instanceof'",
12590 lang_printable_name (op2_type, 0));
12594 if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1))
12596 /* If the first operand is null, the result is always false */
12597 if (op1 == null_pointer_node)
12598 return boolean_false_node;
12599 else if (flag_emit_class_files)
12601 TREE_OPERAND (node, 1) = op2_type;
12602 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1);
12605 /* Otherwise we have to invoke instance of to figure it out */
12609 build (CALL_EXPR, boolean_type_node,
12610 build_address_of (soft_instanceof_node),
12613 build_tree_list (NULL_TREE,
12614 build_class_ref (op2_type))),
12616 TREE_SIDE_EFFECTS (call) = TREE_SIDE_EFFECTS (op1);
12620 /* There is no way the expression operand can be an instance of
12621 the type operand. This is a compile time error. */
12624 char *t1 = xstrdup (lang_printable_name (op1_type, 0));
12625 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
12626 parse_error_context
12627 (wfl_operator, "Impossible for `%s' to be instance of `%s'",
12628 t1, lang_printable_name (op2_type, 0));
12635 /* 15.21 Bitwise and Logical Operators */
12639 if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type))
12640 /* Binary numeric promotion is performed on both operand and the
12641 expression retain that type */
12642 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12644 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE
12645 && TREE_CODE (op1_type) == BOOLEAN_TYPE)
12646 /* The type of the bitwise operator expression is BOOLEAN */
12647 prom_type = boolean_type_node;
12650 if (!JINTEGRAL_TYPE_P (op1_type))
12651 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
12652 if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type))
12653 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type);
12654 TREE_TYPE (node) = error_mark_node;
12656 /* Insert a break here if adding thing before the switch's
12657 break for this case */
12661 /* 15.22 Conditional-And Operator */
12662 case TRUTH_ANDIF_EXPR:
12663 /* 15.23 Conditional-Or Operator */
12664 case TRUTH_ORIF_EXPR:
12665 /* Operands must be of BOOLEAN type */
12666 if (TREE_CODE (op1_type) != BOOLEAN_TYPE ||
12667 TREE_CODE (op2_type) != BOOLEAN_TYPE)
12669 if (TREE_CODE (op1_type) != BOOLEAN_TYPE)
12670 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type);
12671 if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type))
12672 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type);
12673 TREE_TYPE (node) = boolean_type_node;
12677 /* The type of the conditional operators is BOOLEAN */
12678 prom_type = boolean_type_node;
12681 /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
12686 /* The type of each of the operands must be a primitive numeric
12688 if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type))
12690 if (!JNUMERIC_TYPE_P (op1_type))
12691 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
12692 if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
12693 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
12694 TREE_TYPE (node) = boolean_type_node;
12698 /* Binary numeric promotion is performed on the operands */
12699 binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12700 /* The type of the relation expression is always BOOLEAN */
12701 prom_type = boolean_type_node;
12704 /* 15.20 Equality Operator */
12707 /* 15.20.1 Numerical Equality Operators == and != */
12708 /* Binary numeric promotion is performed on the operands */
12709 if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))
12710 binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12712 /* 15.20.2 Boolean Equality Operators == and != */
12713 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE &&
12714 TREE_CODE (op2_type) == BOOLEAN_TYPE)
12715 ; /* Nothing to do here */
12717 /* 15.20.3 Reference Equality Operators == and != */
12718 /* Types have to be either references or the null type. If
12719 they're references, it must be possible to convert either
12720 type to the other by casting conversion. */
12721 else if (op1 == null_pointer_node || op2 == null_pointer_node
12722 || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type)
12723 && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1)
12724 || valid_ref_assignconv_cast_p (op2_type,
12726 ; /* Nothing to do here */
12728 /* Else we have an error figure what can't be converted into
12729 what and report the error */
12733 t1 = xstrdup (lang_printable_name (op1_type, 0));
12734 parse_error_context
12736 "Incompatible type for `%s'. Can't convert `%s' to `%s'",
12737 operator_string (node), t1,
12738 lang_printable_name (op2_type, 0));
12740 TREE_TYPE (node) = boolean_type_node;
12744 prom_type = boolean_type_node;
12749 return error_mark_node;
12751 TREE_OPERAND (node, 0) = op1;
12752 TREE_OPERAND (node, 1) = op2;
12753 TREE_TYPE (node) = prom_type;
12754 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12756 if (flag_emit_xref)
12759 /* fold does not respect side-effect order as required for Java but not C.
12760 * Also, it sometimes create SAVE_EXPRs which are bad when emitting
12763 if (flag_emit_class_files ? (TREE_CONSTANT (op1) && TREE_CONSTANT (op2))
12764 : ! TREE_SIDE_EFFECTS (node))
12765 node = fold (node);
12769 /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
12770 zero value, the value of CSTE comes after the valude of STRING */
12773 do_merge_string_cste (cste, string, string_len, after)
12775 const char *string;
12776 int string_len, after;
12778 int len = TREE_STRING_LENGTH (cste) + string_len;
12779 const char *old = TREE_STRING_POINTER (cste);
12780 TREE_STRING_LENGTH (cste) = len;
12781 TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1);
12784 strcpy (TREE_STRING_POINTER (cste), string);
12785 strcat (TREE_STRING_POINTER (cste), old);
12789 strcpy (TREE_STRING_POINTER (cste), old);
12790 strcat (TREE_STRING_POINTER (cste), string);
12795 /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
12796 new STRING_CST on success, NULL_TREE on failure */
12799 merge_string_cste (op1, op2, after)
12803 /* Handle two string constants right away */
12804 if (TREE_CODE (op2) == STRING_CST)
12805 return do_merge_string_cste (op1, TREE_STRING_POINTER (op2),
12806 TREE_STRING_LENGTH (op2), after);
12808 /* Reasonable integer constant can be treated right away */
12809 if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2))
12811 static const char *boolean_true = "true";
12812 static const char *boolean_false = "false";
12813 static const char *null_pointer = "null";
12815 const char *string;
12817 if (op2 == boolean_true_node)
12818 string = boolean_true;
12819 else if (op2 == boolean_false_node)
12820 string = boolean_false;
12821 else if (op2 == null_pointer_node)
12822 string = null_pointer;
12823 else if (TREE_TYPE (op2) == char_type_node)
12825 ch[0] = (char )TREE_INT_CST_LOW (op2);
12830 string = print_int_node (op2);
12832 return do_merge_string_cste (op1, string, strlen (string), after);
12837 /* Tries to statically concatenate OP1 and OP2 if possible. Either one
12838 has to be a STRING_CST and the other part must be a STRING_CST or a
12839 INTEGRAL constant. Return a new STRING_CST if the operation
12840 succeed, NULL_TREE otherwise.
12842 If the case we want to optimize for space, we might want to return
12843 NULL_TREE for each invocation of this routine. FIXME */
12846 string_constant_concatenation (op1, op2)
12849 if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST))
12854 string = (TREE_CODE (op1) == STRING_CST ? op1 : op2);
12855 rest = (string == op1 ? op2 : op1);
12856 invert = (string == op1 ? 0 : 1 );
12858 /* Walk REST, only if it looks reasonable */
12859 if (TREE_CODE (rest) != STRING_CST
12860 && !IS_CRAFTED_STRING_BUFFER_P (rest)
12861 && !JSTRING_TYPE_P (TREE_TYPE (rest))
12862 && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION)
12864 rest = java_complete_tree (rest);
12865 if (rest == error_mark_node)
12866 return error_mark_node;
12867 rest = fold (rest);
12869 return merge_string_cste (string, rest, invert);
12874 /* Implement the `+' operator. Does static optimization if possible,
12875 otherwise create (if necessary) and append elements to a
12876 StringBuffer. The StringBuffer will be carried around until it is
12877 used for a function call or an assignment. Then toString() will be
12878 called on it to turn it into a String object. */
12881 build_string_concatenation (op1, op2)
12885 int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12887 if (flag_emit_xref)
12888 return build (PLUS_EXPR, string_type_node, op1, op2);
12890 /* Try to do some static optimization */
12891 if ((result = string_constant_concatenation (op1, op2)))
12894 /* Discard empty strings on either side of the expression */
12895 if (TREE_CODE (op1) == STRING_CST && TREE_STRING_LENGTH (op1) == 0)
12900 else if (TREE_CODE (op2) == STRING_CST && TREE_STRING_LENGTH (op2) == 0)
12903 /* If operands are string constant, turn then into object references */
12904 if (TREE_CODE (op1) == STRING_CST)
12905 op1 = patch_string_cst (op1);
12906 if (op2 && TREE_CODE (op2) == STRING_CST)
12907 op2 = patch_string_cst (op2);
12909 /* If either one of the constant is null and the other non null
12910 operand is a String object, return it. */
12911 if (JSTRING_TYPE_P (TREE_TYPE (op1)) && !op2)
12914 /* If OP1 isn't already a StringBuffer, create and
12915 initialize a new one */
12916 if (!IS_CRAFTED_STRING_BUFFER_P (op1))
12918 /* Two solutions here:
12919 1) OP1 is a constant string reference, we call new StringBuffer(OP1)
12920 2) OP1 is something else, we call new StringBuffer().append(OP1). */
12921 if (TREE_CONSTANT (op1) && JSTRING_TYPE_P (TREE_TYPE (op1)))
12922 op1 = BUILD_STRING_BUFFER (op1);
12925 tree aNew = BUILD_STRING_BUFFER (NULL_TREE);
12926 op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0);
12932 /* OP1 is no longer the last node holding a crafted StringBuffer */
12933 IS_CRAFTED_STRING_BUFFER_P (op1) = 0;
12934 /* Create a node for `{new...,xxx}.append (op2)' */
12936 op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0);
12939 /* Mark the last node holding a crafted StringBuffer */
12940 IS_CRAFTED_STRING_BUFFER_P (op1) = 1;
12942 TREE_SIDE_EFFECTS (op1) = side_effects;
12946 /* Patch the string node NODE. NODE can be a STRING_CST of a crafted
12947 StringBuffer. If no string were found to be patched, return
12951 patch_string (node)
12954 if (node == error_mark_node)
12955 return error_mark_node;
12956 if (TREE_CODE (node) == STRING_CST)
12957 return patch_string_cst (node);
12958 else if (IS_CRAFTED_STRING_BUFFER_P (node))
12960 int saved = ctxp->explicit_constructor_p;
12961 tree invoke = build_method_invocation (wfl_to_string, NULL_TREE);
12963 /* Temporary disable forbid the use of `this'. */
12964 ctxp->explicit_constructor_p = 0;
12965 ret = java_complete_tree (make_qualified_primary (node, invoke, 0));
12966 /* String concatenation arguments must be evaluated in order too. */
12967 ret = force_evaluation_order (ret);
12968 /* Restore it at its previous value */
12969 ctxp->explicit_constructor_p = saved;
12975 /* Build the internal representation of a string constant. */
12978 patch_string_cst (node)
12982 if (! flag_emit_class_files)
12984 push_obstacks (&permanent_obstack, &permanent_obstack);
12985 node = get_identifier (TREE_STRING_POINTER (node));
12986 location = alloc_name_constant (CONSTANT_String, node);
12987 node = build_ref_from_constant_pool (location);
12990 TREE_TYPE (node) = string_ptr_type_node;
12991 TREE_CONSTANT (node) = 1;
12995 /* Build an incomplete unary operator expression. */
12998 build_unaryop (op_token, op_location, op1)
12999 int op_token, op_location;
13006 case PLUS_TK: op = UNARY_PLUS_EXPR; break;
13007 case MINUS_TK: op = NEGATE_EXPR; break;
13008 case NEG_TK: op = TRUTH_NOT_EXPR; break;
13009 case NOT_TK: op = BIT_NOT_EXPR; break;
13010 default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
13014 unaryop = build1 (op, NULL_TREE, op1);
13015 TREE_SIDE_EFFECTS (unaryop) = 1;
13016 /* Store the location of the operator, for better error report. The
13017 string of the operator will be rebuild based on the OP value. */
13018 EXPR_WFL_LINECOL (unaryop) = op_location;
13022 /* Special case for the ++/-- operators, since they require an extra
13023 argument to build, which is set to NULL and patched
13024 later. IS_POST_P is 1 if the operator, 0 otherwise. */
13027 build_incdec (op_token, op_location, op1, is_post_p)
13028 int op_token, op_location;
13032 static enum tree_code lookup [2][2] =
13034 { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
13035 { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
13037 tree node = build (lookup [is_post_p][(op_token - DECR_TK)],
13038 NULL_TREE, op1, NULL_TREE);
13039 TREE_SIDE_EFFECTS (node) = 1;
13040 /* Store the location of the operator, for better error report. The
13041 string of the operator will be rebuild based on the OP value. */
13042 EXPR_WFL_LINECOL (node) = op_location;
13046 /* Build an incomplete cast operator, based on the use of the
13047 CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
13048 set. java_complete_tree is trained to walk a CONVERT_EXPR even
13049 though its type is already set. */
13052 build_cast (location, type, exp)
13056 tree node = build1 (CONVERT_EXPR, type, exp);
13057 EXPR_WFL_LINECOL (node) = location;
13061 /* 15.14 Unary operators. We return error_mark_node in case of error,
13062 but preserve the type of NODE if the type is fixed. */
13065 patch_unaryop (node, wfl_op)
13069 tree op = TREE_OPERAND (node, 0);
13070 tree op_type = TREE_TYPE (op);
13071 tree prom_type = NULL_TREE, value, decl;
13072 int code = TREE_CODE (node);
13073 int error_found = 0;
13075 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13079 /* 15.13.2 Postfix Increment Operator ++ */
13080 case POSTINCREMENT_EXPR:
13081 /* 15.13.3 Postfix Increment Operator -- */
13082 case POSTDECREMENT_EXPR:
13083 /* 15.14.1 Prefix Increment Operator ++ */
13084 case PREINCREMENT_EXPR:
13085 /* 15.14.2 Prefix Decrement Operator -- */
13086 case PREDECREMENT_EXPR:
13087 op = decl = strip_out_static_field_access_decl (op);
13088 /* We really should have a JAVA_ARRAY_EXPR to avoid this */
13089 if (!JDECL_P (decl)
13090 && TREE_CODE (decl) != COMPONENT_REF
13091 && !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF)
13092 && TREE_CODE (decl) != INDIRECT_REF
13093 && !(TREE_CODE (decl) == COMPOUND_EXPR
13094 && TREE_OPERAND (decl, 1)
13095 && (TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF)))
13098 /* Before screaming, check that we're not in fact trying to
13099 increment a optimized static final access, in which case
13100 we issue an different error message. */
13101 if (!(TREE_CODE (wfl_op) == EXPR_WITH_FILE_LOCATION
13102 && resolve_expression_name (wfl_op, &lvalue)
13103 && check_final_assignment (lvalue, wfl_op)))
13104 parse_error_context (wfl_operator, "Invalid argument to `%s'",
13105 operator_string (node));
13106 TREE_TYPE (node) = error_mark_node;
13109 else if (check_final_assignment (op, wfl_op))
13112 /* From now on, we know that op if a variable and that it has a
13113 valid wfl. We use wfl_op to locate errors related to the
13115 else if (!JNUMERIC_TYPE_P (op_type))
13117 parse_error_context
13118 (wfl_op, "Invalid argument type `%s' to `%s'",
13119 lang_printable_name (op_type, 0), operator_string (node));
13120 TREE_TYPE (node) = error_mark_node;
13125 /* Before the addition, binary numeric promotion is performed on
13126 both operands, if really necessary */
13127 if (JINTEGRAL_TYPE_P (op_type))
13129 value = build_int_2 (1, 0);
13130 TREE_TYPE (value) = TREE_TYPE (node) = op_type;
13134 value = build_int_2 (1, 0);
13136 binary_numeric_promotion (op_type,
13137 TREE_TYPE (value), &op, &value);
13139 /* And write back into the node. */
13140 TREE_OPERAND (node, 0) = op;
13141 TREE_OPERAND (node, 1) = value;
13142 /* Convert the overall back into its original type, if
13143 necessary, and return */
13144 if (JINTEGRAL_TYPE_P (op_type))
13145 return fold (node);
13147 return fold (convert (op_type, node));
13151 /* 15.14.3 Unary Plus Operator + */
13152 case UNARY_PLUS_EXPR:
13153 /* 15.14.4 Unary Minus Operator - */
13155 if (!JNUMERIC_TYPE_P (op_type))
13157 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type);
13158 TREE_TYPE (node) = error_mark_node;
13161 /* Unary numeric promotion is performed on operand */
13164 op = do_unary_numeric_promotion (op);
13165 prom_type = TREE_TYPE (op);
13166 if (code == UNARY_PLUS_EXPR)
13171 /* 15.14.5 Bitwise Complement Operator ~ */
13173 if (!JINTEGRAL_TYPE_P (op_type))
13175 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type);
13176 TREE_TYPE (node) = error_mark_node;
13181 op = do_unary_numeric_promotion (op);
13182 prom_type = TREE_TYPE (op);
13186 /* 15.14.6 Logical Complement Operator ! */
13187 case TRUTH_NOT_EXPR:
13188 if (TREE_CODE (op_type) != BOOLEAN_TYPE)
13190 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type);
13191 /* But the type is known. We will report an error if further
13192 attempt of a assignment is made with this rhs */
13193 TREE_TYPE (node) = boolean_type_node;
13197 prom_type = boolean_type_node;
13200 /* 15.15 Cast Expression */
13202 value = patch_cast (node, wfl_operator);
13203 if (value == error_mark_node)
13205 /* If this cast is part of an assignment, we tell the code
13206 that deals with it not to complain about a mismatch,
13207 because things have been cast, anyways */
13208 TREE_TYPE (node) = error_mark_node;
13213 value = fold (value);
13214 TREE_SIDE_EFFECTS (value) = TREE_SIDE_EFFECTS (op);
13221 return error_mark_node;
13223 /* There are cases where node has been replaced by something else
13224 and we don't end up returning here: UNARY_PLUS_EXPR,
13225 CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
13226 TREE_OPERAND (node, 0) = fold (op);
13227 TREE_TYPE (node) = prom_type;
13228 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op);
13229 return fold (node);
13232 /* Generic type resolution that sometimes takes place during node
13233 patching. Returned the resolved type or generate an error
13234 message. Return the resolved type or NULL_TREE. */
13237 resolve_type_during_patch (type)
13240 if (unresolved_type_p (type, NULL))
13242 tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE);
13245 parse_error_context (type,
13246 "Class `%s' not found in type declaration",
13247 IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
13252 CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1;
13253 return TREE_TYPE (type_decl);
13258 /* 5.5 Casting Conversion. error_mark_node is returned if an error is
13259 found. Otherwise NODE or something meant to replace it is returned. */
13262 patch_cast (node, wfl_operator)
13266 tree op = TREE_OPERAND (node, 0);
13267 tree op_type = TREE_TYPE (op);
13268 tree cast_type = TREE_TYPE (node);
13271 /* First resolve OP_TYPE if unresolved */
13272 if (!(cast_type = resolve_type_during_patch (cast_type)))
13273 return error_mark_node;
13275 /* Check on cast that are proven correct at compile time */
13276 if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
13279 if (cast_type == op_type)
13282 /* float and double type are converted to the original type main
13283 variant and then to the target type. */
13284 if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE)
13285 op = convert (integer_type_node, op);
13287 /* Try widening/narowwing convertion. Potentially, things need
13288 to be worked out in gcc so we implement the extreme cases
13289 correctly. fold_convert() needs to be fixed. */
13290 return convert (cast_type, op);
13293 /* It's also valid to cast a boolean into a boolean */
13294 if (op_type == boolean_type_node && cast_type == boolean_type_node)
13297 /* null can be casted to references */
13298 if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type))
13299 return build_null_of_type (cast_type);
13301 /* The remaining legal casts involve conversion between reference
13302 types. Check for their compile time correctness. */
13303 if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type)
13304 && valid_ref_assignconv_cast_p (op_type, cast_type, 1))
13306 TREE_TYPE (node) = promote_type (cast_type);
13307 /* Now, the case can be determined correct at compile time if
13308 OP_TYPE can be converted into CAST_TYPE by assignment
13309 conversion (5.2) */
13311 if (valid_ref_assignconv_cast_p (op_type, cast_type, 0))
13313 TREE_SET_CODE (node, NOP_EXPR);
13317 if (flag_emit_class_files)
13319 TREE_SET_CODE (node, CONVERT_EXPR);
13323 /* The cast requires a run-time check */
13324 return build (CALL_EXPR, promote_type (cast_type),
13325 build_address_of (soft_checkcast_node),
13326 tree_cons (NULL_TREE, build_class_ref (cast_type),
13327 build_tree_list (NULL_TREE, op)),
13331 /* Any other casts are proven incorrect at compile time */
13332 t1 = xstrdup (lang_printable_name (op_type, 0));
13333 parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
13334 t1, lang_printable_name (cast_type, 0));
13336 return error_mark_node;
13339 /* Build a null constant and give it the type TYPE. */
13342 build_null_of_type (type)
13345 tree node = build_int_2 (0, 0);
13346 TREE_TYPE (node) = promote_type (type);
13350 /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
13351 a list of indices. */
13353 build_array_ref (location, array, index)
13357 tree node = build (ARRAY_REF, NULL_TREE, array, index);
13358 EXPR_WFL_LINECOL (node) = location;
13362 /* 15.12 Array Access Expression */
13365 patch_array_ref (node)
13368 tree array = TREE_OPERAND (node, 0);
13369 tree array_type = TREE_TYPE (array);
13370 tree index = TREE_OPERAND (node, 1);
13371 tree index_type = TREE_TYPE (index);
13372 int error_found = 0;
13374 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13376 if (TREE_CODE (array_type) == POINTER_TYPE)
13377 array_type = TREE_TYPE (array_type);
13379 /* The array reference must be an array */
13380 if (!TYPE_ARRAY_P (array_type))
13382 parse_error_context
13384 "`[]' can only be applied to arrays. It can't be applied to `%s'",
13385 lang_printable_name (array_type, 0));
13386 TREE_TYPE (node) = error_mark_node;
13390 /* The array index underdoes unary numeric promotion. The promoted
13391 type must be int */
13392 index = do_unary_numeric_promotion (index);
13393 if (TREE_TYPE (index) != int_type_node)
13395 if (valid_cast_to_p (index_type, int_type_node))
13396 parse_error_context (wfl_operator,
13397 "Incompatible type for `[]'. Explicit cast needed to convert `%s' to `int'",
13398 lang_printable_name (index_type, 0));
13400 parse_error_context (wfl_operator,
13401 "Incompatible type for `[]'. Can't convert `%s' to `int'",
13402 lang_printable_name (index_type, 0));
13403 TREE_TYPE (node) = error_mark_node;
13408 return error_mark_node;
13410 array_type = TYPE_ARRAY_ELEMENT (array_type);
13412 if (flag_emit_class_files || flag_emit_xref)
13414 TREE_OPERAND (node, 0) = array;
13415 TREE_OPERAND (node, 1) = index;
13419 /* The save_expr is for correct evaluation order. It would be cleaner
13420 to use force_evaluation_order (see comment there), but that is
13421 difficult when we also have to deal with bounds checking. */
13422 if (TREE_SIDE_EFFECTS (index))
13423 array = save_expr (array);
13424 node = build_java_arrayaccess (array, array_type, index);
13425 if (TREE_SIDE_EFFECTS (index))
13426 node = build (COMPOUND_EXPR, array_type, array, node);
13428 TREE_TYPE (node) = array_type;
13432 /* 15.9 Array Creation Expressions */
13435 build_newarray_node (type, dims, extra_dims)
13441 build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims),
13442 build_int_2 (extra_dims, 0));
13447 patch_newarray (node)
13450 tree type = TREE_OPERAND (node, 0);
13451 tree dims = TREE_OPERAND (node, 1);
13452 tree cdim, array_type;
13453 int error_found = 0;
13455 int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2));
13457 /* Dimension types are verified. It's better for the types to be
13458 verified in order. */
13459 for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ )
13462 tree dim = TREE_VALUE (cdim);
13464 /* Dim might have been saved during its evaluation */
13465 dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim);
13467 /* The type of each specified dimension must be an integral type. */
13468 if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim)))
13471 /* Each expression undergoes an unary numeric promotion (5.6.1) and the
13472 promoted type must be int. */
13475 dim = do_unary_numeric_promotion (dim);
13476 if (TREE_TYPE (dim) != int_type_node)
13480 /* Report errors on types here */
13483 parse_error_context
13484 (TREE_PURPOSE (cdim),
13485 "Incompatible type for dimension in array creation expression. %s convert `%s' to `int'",
13486 (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ?
13487 "Explicit cast needed to" : "Can't"),
13488 lang_printable_name (TREE_TYPE (dim), 0));
13492 TREE_PURPOSE (cdim) = NULL_TREE;
13495 /* Resolve array base type if unresolved */
13496 if (!(type = resolve_type_during_patch (type)))
13501 /* We don't want further evaluation of this bogus array creation
13503 TREE_TYPE (node) = error_mark_node;
13504 return error_mark_node;
13507 /* Set array_type to the actual (promoted) array type of the result. */
13508 if (TREE_CODE (type) == RECORD_TYPE)
13509 type = build_pointer_type (type);
13510 while (--xdims >= 0)
13512 type = promote_type (build_java_array_type (type, -1));
13514 dims = nreverse (dims);
13516 for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim))
13519 array_type = build_java_array_type (type,
13520 TREE_CODE (cdim) == INTEGER_CST ?
13521 TREE_INT_CST_LOW (cdim) : -1);
13522 array_type = promote_type (array_type);
13524 dims = nreverse (dims);
13526 /* The node is transformed into a function call. Things are done
13527 differently according to the number of dimensions. If the number
13528 of dimension is equal to 1, then the nature of the base type
13529 (primitive or not) matters. */
13531 return build_new_array (type, TREE_VALUE (dims));
13533 /* Can't reuse what's already written in expr.c because it uses the
13534 JVM stack representation. Provide a build_multianewarray. FIXME */
13535 return build (CALL_EXPR, array_type,
13536 build_address_of (soft_multianewarray_node),
13537 tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)),
13538 tree_cons (NULL_TREE,
13539 build_int_2 (ndims, 0), dims )),
13543 /* 10.6 Array initializer. */
13545 /* Build a wfl for array element that don't have one, so we can
13546 pin-point errors. */
13549 maybe_build_array_element_wfl (node)
13552 if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION)
13553 return build_expr_wfl (NULL_TREE, ctxp->filename,
13554 ctxp->elc.line, ctxp->elc.prev_col);
13559 /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
13560 identification of initialized arrays easier to detect during walk
13564 build_new_array_init (location, values)
13568 tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values);
13569 tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor);
13570 EXPR_WFL_LINECOL (to_return) = location;
13574 /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
13575 occurred. Otherwise return NODE after having set its type
13579 patch_new_array_init (type, node)
13582 int error_seen = 0;
13583 tree current, element_type;
13584 HOST_WIDE_INT length;
13585 int all_constant = 1;
13586 tree init = TREE_OPERAND (node, 0);
13588 if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type)))
13590 parse_error_context (node,
13591 "Invalid array initializer for non-array type `%s'",
13592 lang_printable_name (type, 1));
13593 return error_mark_node;
13595 type = TREE_TYPE (type);
13596 element_type = TYPE_ARRAY_ELEMENT (type);
13598 CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init));
13600 for (length = 0, current = CONSTRUCTOR_ELTS (init);
13601 current; length++, current = TREE_CHAIN (current))
13603 tree elt = TREE_VALUE (current);
13604 if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT)
13606 error_seen |= array_constructor_check_entry (element_type, current);
13607 elt = TREE_VALUE (current);
13608 /* When compiling to native code, STRING_CST is converted to
13609 INDIRECT_REF, but still with a TREE_CONSTANT flag. */
13610 if (! TREE_CONSTANT (elt) || TREE_CODE (elt) == INDIRECT_REF)
13615 TREE_VALUE (current) = patch_new_array_init (element_type, elt);
13616 TREE_PURPOSE (current) = NULL_TREE;
13619 if (elt && TREE_VALUE (elt) == error_mark_node)
13624 return error_mark_node;
13626 /* Create a new type. We can't reuse the one we have here by
13627 patching its dimension because it originally is of dimension -1
13628 hence reused by gcc. This would prevent triangular arrays. */
13629 type = build_java_array_type (element_type, length);
13630 TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type))));
13631 TREE_TYPE (node) = promote_type (type);
13632 TREE_CONSTANT (init) = all_constant;
13633 TREE_CONSTANT (node) = all_constant;
13637 /* Verify that one entry of the initializer element list can be
13638 assigned to the array base type. Report 1 if an error occurred, 0
13642 array_constructor_check_entry (type, entry)
13645 char *array_type_string = NULL; /* For error reports */
13646 tree value, type_value, new_value, wfl_value, patched;
13647 int error_seen = 0;
13649 new_value = NULL_TREE;
13650 wfl_value = TREE_VALUE (entry);
13652 push_obstacks (&permanent_obstack, &permanent_obstack);
13653 value = java_complete_tree (TREE_VALUE (entry));
13654 /* patch_string return error_mark_node if arg is error_mark_node */
13655 if ((patched = patch_string (value)))
13657 if (value == error_mark_node)
13660 type_value = TREE_TYPE (value);
13662 /* At anytime, try_builtin_assignconv can report a warning on
13663 constant overflow during narrowing. */
13664 SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value);
13665 new_value = try_builtin_assignconv (wfl_operator, type, value);
13666 if (!new_value && (new_value = try_reference_assignconv (type, value)))
13667 type_value = promote_type (type);
13670 /* Check and report errors */
13673 const char *msg = (!valid_cast_to_p (type_value, type) ?
13674 "Can't" : "Explicit cast needed to");
13675 if (!array_type_string)
13676 array_type_string = xstrdup (lang_printable_name (type, 1));
13677 parse_error_context
13678 (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
13679 msg, lang_printable_name (type_value, 1), array_type_string);
13685 new_value = maybe_build_primttype_type_ref (new_value, wfl_operator);
13686 TREE_VALUE (entry) = new_value;
13689 if (array_type_string)
13690 free (array_type_string);
13692 TREE_PURPOSE (entry) = NULL_TREE;
13697 build_this (location)
13700 tree node = build_wfl_node (this_identifier_node);
13701 TREE_SET_CODE (node, THIS_EXPR);
13702 EXPR_WFL_LINECOL (node) = location;
13706 /* 14.15 The return statement. It builds a modify expression that
13707 assigns the returned value to the RESULT_DECL that hold the value
13711 build_return (location, op)
13715 tree node = build1 (RETURN_EXPR, NULL_TREE, op);
13716 EXPR_WFL_LINECOL (node) = location;
13717 node = build_debugable_stmt (location, node);
13722 patch_return (node)
13725 tree return_exp = TREE_OPERAND (node, 0);
13726 tree meth = current_function_decl;
13727 tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl));
13728 int error_found = 0;
13730 TREE_TYPE (node) = error_mark_node;
13731 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13733 /* It's invalid to have a return value within a function that is
13734 declared with the keyword void or that is a constructor */
13735 if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth)))
13738 /* It's invalid to use a return statement in a static block */
13739 if (IS_CLINIT (current_function_decl))
13742 /* It's invalid to have a no return value within a function that
13743 isn't declared with the keyword `void' */
13744 if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth)))
13749 if (IS_CLINIT (current_function_decl))
13750 parse_error_context (wfl_operator,
13751 "`return' inside static initializer.");
13753 else if (!DECL_CONSTRUCTOR_P (meth))
13755 char *t = xstrdup (lang_printable_name (mtype, 0));
13756 parse_error_context (wfl_operator,
13757 "`return' with%s value from `%s %s'",
13758 (error_found == 1 ? "" : "out"),
13759 t, lang_printable_name (meth, 0));
13763 parse_error_context (wfl_operator,
13764 "`return' with value from constructor `%s'",
13765 lang_printable_name (meth, 0));
13766 return error_mark_node;
13769 /* If we have a return_exp, build a modify expression and expand
13770 it. Note: at that point, the assignment is declared valid, but we
13771 may want to carry some more hacks */
13774 tree exp = java_complete_tree (return_exp);
13775 tree modify, patched;
13777 /* If the function returned value and EXP are booleans, EXP has
13778 to be converted into the type of DECL_RESULT, which is integer
13779 (see complete_start_java_method) */
13780 if (TREE_TYPE (exp) == boolean_type_node &&
13781 TREE_TYPE (TREE_TYPE (meth)) == boolean_type_node)
13782 exp = convert_to_integer (TREE_TYPE (DECL_RESULT (meth)), exp);
13784 /* `null' can be assigned to a function returning a reference */
13785 if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth))) &&
13786 exp == null_pointer_node)
13787 exp = build_null_of_type (TREE_TYPE (TREE_TYPE (meth)));
13789 if ((patched = patch_string (exp)))
13792 modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp);
13793 EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node);
13794 modify = java_complete_tree (modify);
13796 if (modify != error_mark_node)
13798 TREE_SIDE_EFFECTS (modify) = 1;
13799 TREE_OPERAND (node, 0) = modify;
13802 return error_mark_node;
13804 TREE_TYPE (node) = void_type_node;
13805 TREE_SIDE_EFFECTS (node) = 1;
13809 /* 14.8 The if Statement */
13812 build_if_else_statement (location, expression, if_body, else_body)
13814 tree expression, if_body, else_body;
13818 else_body = empty_stmt_node;
13819 node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body);
13820 EXPR_WFL_LINECOL (node) = location;
13821 node = build_debugable_stmt (location, node);
13826 patch_if_else_statement (node)
13829 tree expression = TREE_OPERAND (node, 0);
13831 TREE_TYPE (node) = error_mark_node;
13832 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13834 /* The type of expression must be boolean */
13835 if (TREE_TYPE (expression) != boolean_type_node
13836 && TREE_TYPE (expression) != promoted_boolean_type_node)
13838 parse_error_context
13840 "Incompatible type for `if'. Can't convert `%s' to `boolean'",
13841 lang_printable_name (TREE_TYPE (expression), 0));
13842 return error_mark_node;
13845 TREE_TYPE (node) = void_type_node;
13846 TREE_SIDE_EFFECTS (node) = 1;
13847 CAN_COMPLETE_NORMALLY (node)
13848 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
13849 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2));
13853 /* 14.6 Labeled Statements */
13855 /* Action taken when a lableled statement is parsed. a new
13856 LABELED_BLOCK_EXPR is created. No statement is attached to the
13857 label, yet. LABEL can be NULL_TREE for artificially-generated blocks. */
13860 build_labeled_block (location, label)
13865 tree label_decl, node;
13866 if (label == NULL_TREE || label == continue_identifier_node)
13867 label_name = label;
13870 label_name = merge_qualified_name (label_id, label);
13871 /* Issue an error if we try to reuse a label that was previously
13873 if (IDENTIFIER_LOCAL_VALUE (label_name))
13875 EXPR_WFL_LINECOL (wfl_operator) = location;
13876 parse_error_context (wfl_operator,
13877 "Declaration of `%s' shadows a previous label declaration",
13878 IDENTIFIER_POINTER (label));
13879 EXPR_WFL_LINECOL (wfl_operator) =
13880 EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
13881 parse_error_context (wfl_operator,
13882 "This is the location of the previous declaration of label `%s'",
13883 IDENTIFIER_POINTER (label));
13884 java_error_count--;
13888 label_decl = create_label_decl (label_name);
13889 node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE);
13890 EXPR_WFL_LINECOL (node) = location;
13891 TREE_SIDE_EFFECTS (node) = 1;
13895 /* A labeled statement LBE is attached a statement. */
13898 finish_labeled_statement (lbe, statement)
13899 tree lbe; /* Labeled block expr */
13902 /* In anyways, tie the loop to its statement */
13903 LABELED_BLOCK_BODY (lbe) = statement;
13904 pop_labeled_block ();
13905 POP_LABELED_BLOCK ();
13909 /* 14.10, 14.11, 14.12 Loop Statements */
13911 /* Create an empty LOOP_EXPR and make it the last in the nested loop
13915 build_new_loop (loop_body)
13918 tree loop = build (LOOP_EXPR, NULL_TREE, loop_body);
13919 TREE_SIDE_EFFECTS (loop) = 1;
13924 /* Create a loop body according to the following structure:
13926 COMPOUND_EXPR (loop main body)
13927 EXIT_EXPR (this order is for while/for loops.
13928 LABELED_BLOCK_EXPR the order is reversed for do loops)
13929 LABEL_DECL (a continue occuring here branches at the
13930 BODY end of this labeled block)
13933 REVERSED, if non zero, tells that the loop condition expr comes
13934 after the body, like in the do-while loop.
13936 To obtain a loop, the loop body structure described above is
13937 encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
13940 LABEL_DECL (use this label to exit the loop)
13942 <structure described above> */
13945 build_loop_body (location, condition, reversed)
13950 tree first, second, body;
13952 condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */
13953 EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */
13954 condition = build_debugable_stmt (location, condition);
13955 TREE_SIDE_EFFECTS (condition) = 1;
13957 body = build_labeled_block (0, continue_identifier_node);
13958 first = (reversed ? body : condition);
13959 second = (reversed ? condition : body);
13961 build (COMPOUND_EXPR, NULL_TREE,
13962 build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node);
13965 /* Install CONDITION (if any) and loop BODY (using REVERSED to tell
13966 their order) on the current loop. Unlink the current loop from the
13970 finish_loop_body (location, condition, body, reversed)
13972 tree condition, body;
13975 tree to_return = ctxp->current_loop;
13976 tree loop_body = LOOP_EXPR_BODY (to_return);
13979 tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed);
13980 /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
13981 The real EXIT_EXPR is one operand further. */
13982 EXPR_WFL_LINECOL (cnode) = location;
13983 /* This one is for accurate error reports */
13984 EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location;
13985 TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition;
13987 LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body;
13992 /* Tailored version of finish_loop_body for FOR loops, when FOR
13993 loops feature the condition part */
13996 finish_for_loop (location, condition, update, body)
13998 tree condition, update, body;
14000 /* Put the condition and the loop body in place */
14001 tree loop = finish_loop_body (location, condition, body, 0);
14002 /* LOOP is the current loop which has been now popped of the loop
14003 stack. Install the update block */
14004 LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
14008 /* Try to find the loop a block might be related to. This comprises
14009 the case where the LOOP_EXPR is found as the second operand of a
14010 COMPOUND_EXPR, because the loop happens to have an initialization
14011 part, then expressed as the first operand of the COMPOUND_EXPR. If
14012 the search finds something, 1 is returned. Otherwise, 0 is
14013 returned. The search is assumed to start from a
14014 LABELED_BLOCK_EXPR's block. */
14017 search_loop (statement)
14020 if (TREE_CODE (statement) == LOOP_EXPR)
14023 if (TREE_CODE (statement) == BLOCK)
14024 statement = BLOCK_SUBBLOCKS (statement);
14028 if (statement && TREE_CODE (statement) == COMPOUND_EXPR)
14029 while (statement && TREE_CODE (statement) == COMPOUND_EXPR)
14030 statement = TREE_OPERAND (statement, 1);
14032 return (TREE_CODE (statement) == LOOP_EXPR
14033 && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE);
14036 /* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
14037 returned otherwise. */
14040 labeled_block_contains_loop_p (block, loop)
14046 if (LABELED_BLOCK_BODY (block) == loop)
14049 if (IS_FOR_LOOP_P (loop)
14050 && search_loop (LABELED_BLOCK_BODY (block)) == loop)
14056 /* If the loop isn't surrounded by a labeled statement, create one and
14057 insert LOOP as its body. */
14060 patch_loop_statement (loop)
14065 TREE_TYPE (loop) = void_type_node;
14066 if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop))
14069 loop_label = build_labeled_block (0, NULL_TREE);
14070 /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
14071 that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
14072 LABELED_BLOCK_BODY (loop_label) = loop;
14073 PUSH_LABELED_BLOCK (loop_label);
14077 /* 14.13, 14.14: break and continue Statements */
14079 /* Build a break or a continue statement. a null NAME indicates an
14080 unlabeled break/continue statement. */
14083 build_bc_statement (location, is_break, name)
14084 int location, is_break;
14087 tree break_continue, label_block_expr = NULL_TREE;
14091 if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE
14092 (merge_qualified_name (label_id, EXPR_WFL_NODE (name)))))
14093 /* Null means that we don't have a target for this named
14094 break/continue. In this case, we make the target to be the
14095 label name, so that the error can be reported accuratly in
14096 patch_bc_statement. */
14097 label_block_expr = EXPR_WFL_NODE (name);
14099 /* Unlabeled break/continue will be handled during the
14100 break/continue patch operation */
14102 = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE);
14104 IS_BREAK_STMT_P (break_continue) = is_break;
14105 TREE_SIDE_EFFECTS (break_continue) = 1;
14106 EXPR_WFL_LINECOL (break_continue) = location;
14107 break_continue = build_debugable_stmt (location, break_continue);
14108 return break_continue;
14111 /* Verification of a break/continue statement. */
14114 patch_bc_statement (node)
14117 tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt;
14118 tree labeled_block = ctxp->current_labeled_block;
14119 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
14121 /* Having an identifier here means that the target is unknown. */
14122 if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE)
14124 parse_error_context (wfl_operator, "No label definition found for `%s'",
14125 IDENTIFIER_POINTER (bc_label));
14126 return error_mark_node;
14128 if (! IS_BREAK_STMT_P (node))
14130 /* It's a continue statement. */
14131 for (;; labeled_block = TREE_CHAIN (labeled_block))
14133 if (labeled_block == NULL_TREE)
14135 if (bc_label == NULL_TREE)
14136 parse_error_context (wfl_operator,
14137 "`continue' must be in loop");
14139 parse_error_context
14140 (wfl_operator, "continue label `%s' does not name a loop",
14141 IDENTIFIER_POINTER (bc_label));
14142 return error_mark_node;
14144 if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block))
14145 == continue_identifier_node)
14146 && (bc_label == NULL_TREE
14147 || TREE_CHAIN (labeled_block) == bc_label))
14149 bc_label = labeled_block;
14154 else if (!bc_label)
14156 for (;; labeled_block = TREE_CHAIN (labeled_block))
14158 if (labeled_block == NULL_TREE)
14160 parse_error_context (wfl_operator,
14161 "`break' must be in loop or switch");
14162 return error_mark_node;
14164 target_stmt = LABELED_BLOCK_BODY (labeled_block);
14165 if (TREE_CODE (target_stmt) == SWITCH_EXPR
14166 || search_loop (target_stmt))
14168 bc_label = labeled_block;
14174 EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
14175 CAN_COMPLETE_NORMALLY (bc_label) = 1;
14177 /* Our break/continue don't return values. */
14178 TREE_TYPE (node) = void_type_node;
14179 /* Encapsulate the break within a compound statement so that it's
14180 expanded all the times by expand_expr (and not clobbered
14181 sometimes, like after a if statement) */
14182 node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
14183 TREE_SIDE_EFFECTS (node) = 1;
14187 /* Process the exit expression belonging to a loop. Its type must be
14191 patch_exit_expr (node)
14194 tree expression = TREE_OPERAND (node, 0);
14195 TREE_TYPE (node) = error_mark_node;
14196 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
14198 /* The type of expression must be boolean */
14199 if (TREE_TYPE (expression) != boolean_type_node)
14201 parse_error_context
14203 "Incompatible type for loop conditional. Can't convert `%s' to `boolean'",
14204 lang_printable_name (TREE_TYPE (expression), 0));
14205 return error_mark_node;
14207 /* Now we know things are allright, invert the condition, fold and
14209 TREE_OPERAND (node, 0) =
14210 fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression));
14212 if (! integer_zerop (TREE_OPERAND (node, 0))
14213 && ctxp->current_loop != NULL_TREE
14214 && TREE_CODE (ctxp->current_loop) == LOOP_EXPR)
14215 CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1;
14216 if (! integer_onep (TREE_OPERAND (node, 0)))
14217 CAN_COMPLETE_NORMALLY (node) = 1;
14220 TREE_TYPE (node) = void_type_node;
14224 /* 14.9 Switch statement */
14227 patch_switch_statement (node)
14230 tree se = TREE_OPERAND (node, 0), se_type;
14232 /* Complete the switch expression */
14233 se = TREE_OPERAND (node, 0) = java_complete_tree (se);
14234 se_type = TREE_TYPE (se);
14235 /* The type of the switch expression must be char, byte, short or
14237 if (!JINTEGRAL_TYPE_P (se_type))
14239 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
14240 parse_error_context (wfl_operator,
14241 "Incompatible type for `switch'. Can't convert `%s' to `int'",
14242 lang_printable_name (se_type, 0));
14243 /* This is what java_complete_tree will check */
14244 TREE_OPERAND (node, 0) = error_mark_node;
14245 return error_mark_node;
14248 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
14250 /* Ready to return */
14251 if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK)
14253 TREE_TYPE (node) = error_mark_node;
14254 return error_mark_node;
14256 TREE_TYPE (node) = void_type_node;
14257 TREE_SIDE_EFFECTS (node) = 1;
14258 CAN_COMPLETE_NORMALLY (node)
14259 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
14260 || ! SWITCH_HAS_DEFAULT (node);
14264 /* 14.18 The try statement */
14267 build_try_statement (location, try_block, catches)
14269 tree try_block, catches;
14271 tree node = build (TRY_EXPR, NULL_TREE, try_block, catches);
14272 EXPR_WFL_LINECOL (node) = location;
14277 build_try_finally_statement (location, try_block, finally)
14279 tree try_block, finally;
14281 tree node = build (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally);
14282 EXPR_WFL_LINECOL (node) = location;
14287 patch_try_statement (node)
14290 int error_found = 0;
14291 tree try = TREE_OPERAND (node, 0);
14292 /* Exception handlers are considered in left to right order */
14293 tree catch = nreverse (TREE_OPERAND (node, 1));
14294 tree current, caught_type_list = NULL_TREE;
14296 /* Check catch clauses, if any. Every time we find an error, we try
14297 to process the next catch clause. We process the catch clause before
14298 the try block so that when processing the try block we can check thrown
14299 exceptions againts the caught type list. */
14300 for (current = catch; current; current = TREE_CHAIN (current))
14302 tree carg_decl, carg_type;
14303 tree sub_current, catch_block, catch_clause;
14306 /* At this point, the structure of the catch clause is
14307 CATCH_EXPR (catch node)
14308 BLOCK (with the decl of the parameter)
14310 MODIFY_EXPR (assignment of the catch parameter)
14311 BLOCK (catch clause block)
14313 catch_clause = TREE_OPERAND (current, 0);
14314 carg_decl = BLOCK_EXPR_DECLS (catch_clause);
14315 carg_type = TREE_TYPE (TREE_TYPE (carg_decl));
14317 /* Catch clauses can't have more than one parameter declared,
14318 but it's already enforced by the grammar. Make sure that the
14319 only parameter of the clause statement in of class Throwable
14320 or a subclass of Throwable, but that was done earlier. The
14321 catch clause parameter type has also been resolved. */
14323 /* Just make sure that the catch clause parameter type inherits
14324 from java.lang.Throwable */
14325 if (!inherits_from_p (carg_type, throwable_type_node))
14327 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
14328 parse_error_context (wfl_operator,
14329 "Can't catch class `%s'. Catch clause parameter type must be a subclass of class `java.lang.Throwable'",
14330 lang_printable_name (carg_type, 0));
14335 /* Partial check for unreachable catch statement: The catch
14336 clause is reachable iff is no earlier catch block A in
14337 the try statement such that the type of the catch
14338 clause's parameter is the same as or a subclass of the
14339 type of A's parameter */
14341 for (sub_current = catch;
14342 sub_current != current; sub_current = TREE_CHAIN (sub_current))
14344 tree sub_catch_clause, decl;
14345 sub_catch_clause = TREE_OPERAND (sub_current, 0);
14346 decl = BLOCK_EXPR_DECLS (sub_catch_clause);
14348 if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl))))
14350 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
14351 parse_error_context
14353 "`catch' not reached because of the catch clause at line %d",
14354 EXPR_WFL_LINENO (sub_current));
14355 unreachable = error_found = 1;
14359 /* Complete the catch clause block */
14360 catch_block = java_complete_tree (TREE_OPERAND (current, 0));
14361 if (catch_block == error_mark_node)
14366 if (CAN_COMPLETE_NORMALLY (catch_block))
14367 CAN_COMPLETE_NORMALLY (node) = 1;
14368 TREE_OPERAND (current, 0) = catch_block;
14373 /* Things to do here: the exception must be thrown */
14375 /* Link this type to the caught type list */
14376 caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list);
14379 PUSH_EXCEPTIONS (caught_type_list);
14380 if ((try = java_complete_tree (try)) == error_mark_node)
14382 if (CAN_COMPLETE_NORMALLY (try))
14383 CAN_COMPLETE_NORMALLY (node) = 1;
14386 /* Verification ends here */
14388 return error_mark_node;
14390 TREE_OPERAND (node, 0) = try;
14391 TREE_OPERAND (node, 1) = catch;
14392 TREE_TYPE (node) = void_type_node;
14396 /* 14.17 The synchronized Statement */
14399 patch_synchronized_statement (node, wfl_op1)
14400 tree node, wfl_op1;
14402 tree expr = java_complete_tree (TREE_OPERAND (node, 0));
14403 tree block = TREE_OPERAND (node, 1);
14405 tree enter, exit, expr_decl, assignment;
14407 if (expr == error_mark_node)
14409 block = java_complete_tree (block);
14413 /* The TYPE of expr must be a reference type */
14414 if (!JREFERENCE_TYPE_P (TREE_TYPE (expr)))
14416 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
14417 parse_error_context (wfl_operator, "Incompatible type for `synchronized'. Can't convert `%s' to `java.lang.Object'",
14418 lang_printable_name (TREE_TYPE (expr), 0));
14419 return error_mark_node;
14422 if (flag_emit_xref)
14424 TREE_OPERAND (node, 0) = expr;
14425 TREE_OPERAND (node, 1) = java_complete_tree (block);
14426 CAN_COMPLETE_NORMALLY (node) = 1;
14430 /* Generate a try-finally for the synchronized statement, except
14431 that the handler that catches all throw exception calls
14432 _Jv_MonitorExit and then rethrow the exception.
14433 The synchronized statement is then implemented as:
14436 _Jv_MonitorEnter (expression)
14438 _Jv_MonitorExit (expression)
14442 e = _Jv_exception_info ();
14443 _Jv_MonitorExit (expression)
14447 expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr));
14448 BUILD_MONITOR_ENTER (enter, expr_decl);
14449 BUILD_MONITOR_EXIT (exit, expr_decl);
14450 CAN_COMPLETE_NORMALLY (enter) = 1;
14451 CAN_COMPLETE_NORMALLY (exit) = 1;
14452 assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr);
14453 TREE_SIDE_EFFECTS (assignment) = 1;
14454 node = build1 (CLEANUP_POINT_EXPR, NULL_TREE,
14455 build (COMPOUND_EXPR, NULL_TREE,
14456 build (WITH_CLEANUP_EXPR, NULL_TREE,
14457 build (COMPOUND_EXPR, NULL_TREE,
14458 assignment, enter),
14461 node = build_expr_block (node, expr_decl);
14463 return java_complete_tree (node);
14466 /* 14.16 The throw Statement */
14469 patch_throw_statement (node, wfl_op1)
14470 tree node, wfl_op1;
14472 tree expr = TREE_OPERAND (node, 0);
14473 tree type = TREE_TYPE (expr);
14474 int unchecked_ok = 0, tryblock_throws_ok = 0;
14476 /* Thrown expression must be assignable to java.lang.Throwable */
14477 if (!try_reference_assignconv (throwable_type_node, expr))
14479 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
14480 parse_error_context (wfl_operator,
14481 "Can't throw `%s'; it must be a subclass of class `java.lang.Throwable'",
14482 lang_printable_name (type, 0));
14483 /* If the thrown expression was a reference, we further the
14484 compile-time check. */
14485 if (!JREFERENCE_TYPE_P (type))
14486 return error_mark_node;
14489 /* At least one of the following must be true */
14491 /* The type of the throw expression is a not checked exception,
14492 i.e. is a unchecked expression. */
14493 unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type));
14495 /* Throw is contained in a try statement and at least one catch
14496 clause can receive the thrown expression or the current method is
14497 declared to throw such an exception. Or, the throw statement is
14498 contained in a method or constructor declaration and the type of
14499 the Expression is assignable to at least one type listed in the
14500 throws clause the declaration. */
14501 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
14503 tryblock_throws_ok = check_thrown_exceptions_do (TREE_TYPE (expr));
14504 if (!(unchecked_ok || tryblock_throws_ok))
14506 /* If there is a surrounding try block that has no matching
14507 clatch clause, report it first. A surrounding try block exits
14508 only if there is something after the list of checked
14509 exception thrown by the current function (if any). */
14510 if (IN_TRY_BLOCK_P ())
14511 parse_error_context (wfl_operator, "Checked exception `%s' can't be caught by any of the catch clause(s) of the surrounding `try' block",
14512 lang_printable_name (type, 0));
14513 /* If we have no surrounding try statement and the method doesn't have
14514 any throws, report it now. FIXME */
14516 /* We report that the exception can't be throw from a try block
14517 in all circumstances but when the `throw' is inside a static
14519 else if (!EXCEPTIONS_P (currently_caught_type_list)
14520 && !tryblock_throws_ok)
14522 if (IS_CLINIT (current_function_decl))
14523 parse_error_context (wfl_operator,
14524 "Checked exception `%s' can't be thrown in initializer",
14525 lang_printable_name (type, 0));
14527 parse_error_context (wfl_operator,
14528 "Checked exception `%s' isn't thrown from a `try' block",
14529 lang_printable_name (type, 0));
14531 /* Otherwise, the current method doesn't have the appropriate
14532 throws declaration */
14534 parse_error_context (wfl_operator, "Checked exception `%s' doesn't match any of current method's `throws' declaration(s)",
14535 lang_printable_name (type, 0));
14536 return error_mark_node;
14539 if (! flag_emit_class_files && ! flag_emit_xref)
14540 BUILD_THROW (node, expr);
14542 /* If doing xrefs, keep the location where the `throw' was seen. */
14543 if (flag_emit_xref)
14544 EXPR_WFL_LINECOL (node) = EXPR_WFL_LINECOL (wfl_op1);
14548 /* Check that exception said to be thrown by method DECL can be
14549 effectively caught from where DECL is invoked. */
14552 check_thrown_exceptions (location, decl)
14557 /* For all the unchecked exceptions thrown by DECL */
14558 for (throws = DECL_FUNCTION_THROWS (decl); throws;
14559 throws = TREE_CHAIN (throws))
14560 if (!check_thrown_exceptions_do (TREE_VALUE (throws)))
14563 /* Temporary hack to suppresses errors about cloning arrays. FIXME */
14564 if (DECL_NAME (decl) == get_identifier ("clone"))
14567 EXPR_WFL_LINECOL (wfl_operator) = location;
14568 if (DECL_NAME (current_function_decl) == finit_identifier_node)
14569 parse_error_context
14570 (wfl_operator, "Exception `%s' can't be thrown in initializer",
14571 lang_printable_name (TREE_VALUE (throws), 0));
14574 parse_error_context
14575 (wfl_operator, "Exception `%s' must be caught, or it must be declared in the `throws' clause of `%s'",
14576 lang_printable_name (TREE_VALUE (throws), 0),
14577 (DECL_NAME (current_function_decl) == init_identifier_node ?
14578 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
14579 IDENTIFIER_POINTER (DECL_NAME (current_function_decl))));
14584 /* Return 1 if checked EXCEPTION is caught at the current nesting level of
14585 try-catch blocks, OR is listed in the `throws' clause of the
14589 check_thrown_exceptions_do (exception)
14592 tree list = currently_caught_type_list;
14593 resolve_and_layout (exception, NULL_TREE);
14594 /* First, all the nested try-catch-finally at that stage. The
14595 last element contains `throws' clause exceptions, if any. */
14596 if (IS_UNCHECKED_EXCEPTION_P (exception))
14601 for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught))
14602 if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0))
14604 list = TREE_CHAIN (list);
14610 purge_unchecked_exceptions (mdecl)
14613 tree throws = DECL_FUNCTION_THROWS (mdecl);
14614 tree new = NULL_TREE;
14618 tree next = TREE_CHAIN (throws);
14619 if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws)))
14621 TREE_CHAIN (throws) = new;
14626 /* List is inverted here, but it doesn't matter */
14627 DECL_FUNCTION_THROWS (mdecl) = new;
14630 /* 15.24 Conditional Operator ?: */
14633 patch_conditional_expr (node, wfl_cond, wfl_op1)
14634 tree node, wfl_cond, wfl_op1;
14636 tree cond = TREE_OPERAND (node, 0);
14637 tree op1 = TREE_OPERAND (node, 1);
14638 tree op2 = TREE_OPERAND (node, 2);
14639 tree resulting_type = NULL_TREE;
14640 tree t1, t2, patched;
14641 int error_found = 0;
14643 /* Operands of ?: might be StringBuffers crafted as a result of a
14644 string concatenation. Obtain a descent operand here. */
14645 if ((patched = patch_string (op1)))
14646 TREE_OPERAND (node, 1) = op1 = patched;
14647 if ((patched = patch_string (op2)))
14648 TREE_OPERAND (node, 2) = op2 = patched;
14650 t1 = TREE_TYPE (op1);
14651 t2 = TREE_TYPE (op2);
14653 /* The first expression must be a boolean */
14654 if (TREE_TYPE (cond) != boolean_type_node)
14656 SET_WFL_OPERATOR (wfl_operator, node, wfl_cond);
14657 parse_error_context (wfl_operator,
14658 "Incompatible type for `?:'. Can't convert `%s' to `boolean'",
14659 lang_printable_name (TREE_TYPE (cond), 0));
14663 /* Second and third can be numeric, boolean (i.e. primitive),
14664 references or null. Anything else results in an error */
14665 if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2))
14666 || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node)
14667 && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node))
14668 || (t1 == boolean_type_node && t2 == boolean_type_node)))
14671 /* Determine the type of the conditional expression. Same types are
14672 easy to deal with */
14674 resulting_type = t1;
14676 /* There are different rules for numeric types */
14677 else if (JNUMERIC_TYPE_P (t1))
14679 /* if byte/short found, the resulting type is short */
14680 if ((t1 == byte_type_node && t2 == short_type_node)
14681 || (t1 == short_type_node && t2 == byte_type_node))
14682 resulting_type = short_type_node;
14684 /* If t1 is a constant int and t2 is of type byte, short or char
14685 and t1's value fits in t2, then the resulting type is t2 */
14686 else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1)))
14687 && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2))
14688 resulting_type = t2;
14690 /* If t2 is a constant int and t1 is of type byte, short or char
14691 and t2's value fits in t1, then the resulting type is t1 */
14692 else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2)))
14693 && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1))
14694 resulting_type = t1;
14696 /* Otherwise, binary numeric promotion is applied and the
14697 resulting type is the promoted type of operand 1 and 2 */
14699 resulting_type = binary_numeric_promotion (t1, t2,
14700 &TREE_OPERAND (node, 1),
14701 &TREE_OPERAND (node, 2));
14704 /* Cases of a reference and a null type */
14705 else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node)
14706 resulting_type = t1;
14708 else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node)
14709 resulting_type = t2;
14711 /* Last case: different reference types. If a type can be converted
14712 into the other one by assignment conversion, the latter
14713 determines the type of the expression */
14714 else if ((resulting_type = try_reference_assignconv (t1, op2)))
14715 resulting_type = promote_type (t1);
14717 else if ((resulting_type = try_reference_assignconv (t2, op1)))
14718 resulting_type = promote_type (t2);
14720 /* If we don't have any resulting type, we're in trouble */
14721 if (!resulting_type)
14723 char *t = xstrdup (lang_printable_name (t1, 0));
14724 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
14725 parse_error_context (wfl_operator,
14726 "Incompatible type for `?:'. Can't convert `%s' to `%s'",
14727 t, lang_printable_name (t2, 0));
14734 TREE_TYPE (node) = error_mark_node;
14735 return error_mark_node;
14738 TREE_TYPE (node) = resulting_type;
14739 TREE_SET_CODE (node, COND_EXPR);
14740 CAN_COMPLETE_NORMALLY (node) = 1;
14744 /* Try to constant fold NODE.
14745 If NODE is not a constant expression, return NULL_EXPR.
14746 CONTEXT is a static final VAR_DECL whose initializer we are folding. */
14749 fold_constant_for_init (node, context)
14753 tree op0, op1, val;
14754 enum tree_code code = TREE_CODE (node);
14756 if (code == STRING_CST)
14759 if (code == INTEGER_CST || code == REAL_CST)
14760 return convert (TREE_TYPE (context), node);
14761 if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
14769 case TRUNC_MOD_EXPR:
14777 case TRUTH_ANDIF_EXPR:
14778 case TRUTH_ORIF_EXPR:
14785 op0 = TREE_OPERAND (node, 0);
14786 op1 = TREE_OPERAND (node, 1);
14787 val = fold_constant_for_init (op0, context);
14788 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14790 TREE_OPERAND (node, 0) = val;
14791 val = fold_constant_for_init (op1, context);
14792 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14794 TREE_OPERAND (node, 1) = val;
14795 return patch_binop (node, op0, op1);
14797 case UNARY_PLUS_EXPR:
14799 case TRUTH_NOT_EXPR:
14802 op0 = TREE_OPERAND (node, 0);
14803 val = fold_constant_for_init (op0, context);
14804 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14806 TREE_OPERAND (node, 0) = val;
14807 return patch_unaryop (node, op0);
14811 val = fold_constant_for_init (TREE_OPERAND (node, 0), context);
14812 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14814 TREE_OPERAND (node, 0) = val;
14815 val = fold_constant_for_init (TREE_OPERAND (node, 1), context);
14816 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14818 TREE_OPERAND (node, 1) = val;
14819 val = fold_constant_for_init (TREE_OPERAND (node, 2), context);
14820 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14822 TREE_OPERAND (node, 2) = val;
14823 return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1)
14824 : TREE_OPERAND (node, 2);
14828 if (! FIELD_FINAL (node)
14829 || DECL_INITIAL (node) == NULL_TREE)
14831 val = DECL_INITIAL (node);
14832 /* Guard against infinite recursion. */
14833 DECL_INITIAL (node) = NULL_TREE;
14834 val = fold_constant_for_init (val, node);
14835 DECL_INITIAL (node) = val;
14838 case EXPR_WITH_FILE_LOCATION:
14839 /* Compare java_complete_tree and resolve_expression_name. */
14840 if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
14841 || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
14843 tree name = EXPR_WFL_NODE (node);
14845 if (PRIMARY_P (node))
14847 else if (! QUALIFIED_P (name))
14849 decl = lookup_field_wrapper (DECL_CONTEXT (context), name);
14850 if (decl == NULL_TREE
14851 || (! FIELD_STATIC (decl) && ! FIELD_FINAL (decl)))
14853 return fold_constant_for_init (decl, decl);
14857 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
14858 qualify_ambiguous_name (node);
14859 if (resolve_field_access (node, &decl, NULL)
14860 && decl != NULL_TREE)
14861 return fold_constant_for_init (decl, decl);
14867 op0 = TREE_OPERAND (node, 0);
14868 val = fold_constant_for_init (op0, context);
14869 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14871 TREE_OPERAND (node, 0) = val;
14875 #ifdef USE_COMPONENT_REF
14877 case COMPONENT_REF:
14886 #ifdef USE_COMPONENT_REF
14887 /* Context is 'T' for TypeName, 'P' for PackageName,
14888 'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */
14891 resolve_simple_name (name, context)
14898 resolve_qualified_name (name, context)