2 /* A Bison parser, made from ./parse.y
3 by GNU Bison version 1.25
6 #define YYBISON 1 /* Identify Bison output. */
8 #define yyparse java_parse
10 #define yyerror java_error
11 #define yylval java_lval
12 #define yychar java_char
13 #define yydebug java_debug
14 #define yynerrs java_nerrs
26 #define BOOL_AND_TK 269
27 #define BOOL_OR_TK 270
34 #define PLUS_ASSIGN_TK 277
35 #define MINUS_ASSIGN_TK 278
36 #define MULT_ASSIGN_TK 279
37 #define DIV_ASSIGN_TK 280
38 #define REM_ASSIGN_TK 281
39 #define LS_ASSIGN_TK 282
40 #define SRS_ASSIGN_TK 283
41 #define ZRS_ASSIGN_TK 284
42 #define AND_ASSIGN_TK 285
43 #define XOR_ASSIGN_TK 286
44 #define OR_ASSIGN_TK 287
46 #define PRIVATE_TK 289
47 #define PROTECTED_TK 290
50 #define SYNCHRONIZED_TK 293
51 #define VOLATILE_TK 294
52 #define TRANSIENT_TK 295
55 #define ABSTRACT_TK 298
56 #define MODIFIER_TK 299
59 #define DEFAULT_TK 302
62 #define BOOLEAN_TK 305
64 #define IMPLEMENTS_TK 307
69 #define INSTANCEOF_TK 312
73 #define INTERFACE_TK 316
75 #define EXTENDS_TK 318
76 #define FINALLY_TK 319
85 #define CONTINUE_TK 328
87 #define PACKAGE_TK 330
94 #define INTEGRAL_TK 337
100 #define REL_CL_TK 343
103 #define ASSIGN_ANY_TK 346
104 #define ASSIGN_TK 347
114 #define STRING_LIT_TK 357
115 #define CHAR_LIT_TK 358
116 #define INT_LIT_TK 359
117 #define FP_LIT_TK 360
120 #define BOOL_LIT_TK 363
133 #include "java-tree.h"
143 #ifndef DIR_SEPARATOR
144 #define DIR_SEPARATOR '/'
147 /* Local function prototypes */
148 static char *java_accstring_lookup PROTO ((int));
149 static void classitf_redefinition_error PROTO ((char *,tree, tree, tree));
150 static void variable_redefinition_error PROTO ((tree, tree, tree, int));
151 static void check_modifiers PROTO ((char *, int, int));
152 static tree create_class PROTO ((int, tree, tree, tree));
153 static tree create_interface PROTO ((int, tree, tree));
154 static tree find_field PROTO ((tree, tree));
155 static tree lookup_field_wrapper PROTO ((tree, tree));
156 static int duplicate_declaration_error_p PROTO ((tree, tree, tree));
157 static void register_fields PROTO ((int, tree, tree));
158 static tree parser_qualified_classname PROTO ((tree));
159 static int parser_check_super PROTO ((tree, tree, tree));
160 static int parser_check_super_interface PROTO ((tree, tree, tree));
161 static void check_modifiers_consistency PROTO ((int));
162 static tree lookup_cl PROTO ((tree));
163 static tree lookup_java_method2 PROTO ((tree, tree, int));
164 static tree method_header PROTO ((int, tree, tree, tree));
165 static void fix_method_argument_names PROTO ((tree ,tree));
166 static tree method_declarator PROTO ((tree, tree));
167 static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...))
169 static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list));
170 static tree parse_jdk1_1_error PROTO ((char *));
171 static void complete_class_report_errors PROTO ((jdep *));
172 static int process_imports PROTO ((void));
173 static void read_import_dir PROTO ((tree));
174 static int find_in_imports_on_demand PROTO ((tree));
175 static int find_in_imports PROTO ((tree));
176 static int check_pkg_class_access PROTO ((tree, tree));
177 static tree resolve_package PROTO ((tree, tree *));
178 static tree lookup_package_type PROTO ((char *, int));
179 static tree resolve_class PROTO ((tree, tree, tree));
180 static void declare_local_variables PROTO ((int, tree, tree));
181 static void source_start_java_method PROTO ((tree));
182 static void source_end_java_method PROTO ((void));
183 static void expand_start_java_method PROTO ((tree));
184 static tree find_name_in_single_imports PROTO ((tree));
185 static void check_abstract_method_header PROTO ((tree));
186 static tree lookup_java_interface_method2 PROTO ((tree, tree));
187 static tree resolve_expression_name PROTO ((tree, tree *));
188 static tree maybe_create_class_interface_decl PROTO ((tree, tree, tree));
189 static int check_class_interface_creation PROTO ((int, int, tree,
191 static tree patch_method_invocation PROTO ((tree, tree, tree,
193 static int breakdown_qualified PROTO ((tree *, tree *, tree));
194 static tree resolve_and_layout PROTO ((tree, tree));
195 static tree resolve_no_layout PROTO ((tree, tree));
196 static int invocation_mode PROTO ((tree, int));
197 static tree find_applicable_accessible_methods_list PROTO ((int, tree,
199 static void search_applicable_methods_list PROTO ((int, tree, tree, tree,
201 static tree find_most_specific_methods_list PROTO ((tree));
202 static int argument_types_convertible PROTO ((tree, tree));
203 static tree patch_invoke PROTO ((tree, tree, tree));
204 static tree lookup_method_invoke PROTO ((int, tree, tree, tree, tree));
205 static tree register_incomplete_type PROTO ((int, tree, tree, tree));
206 static tree obtain_incomplete_type PROTO ((tree));
207 static tree java_complete_lhs PROTO ((tree));
208 static tree java_complete_tree PROTO ((tree));
209 static void java_complete_expand_method PROTO ((tree));
210 static int unresolved_type_p PROTO ((tree, tree *));
211 static void create_jdep_list PROTO ((struct parser_ctxt *));
212 static tree build_expr_block PROTO ((tree, tree));
213 static tree enter_block PROTO ((void));
214 static tree enter_a_block PROTO ((tree));
215 static tree exit_block PROTO ((void));
216 static tree lookup_name_in_blocks PROTO ((tree));
217 static void maybe_absorb_scoping_blocks PROTO ((void));
218 static tree build_method_invocation PROTO ((tree, tree));
219 static tree build_new_invocation PROTO ((tree, tree));
220 static tree build_assignment PROTO ((int, int, tree, tree));
221 static tree build_binop PROTO ((enum tree_code, int, tree, tree));
222 static int check_final_assignment PROTO ((tree ,tree));
223 static tree patch_assignment PROTO ((tree, tree, tree ));
224 static tree patch_binop PROTO ((tree, tree, tree));
225 static tree build_unaryop PROTO ((int, int, tree));
226 static tree build_incdec PROTO ((int, int, tree, int));
227 static tree patch_unaryop PROTO ((tree, tree));
228 static tree build_cast PROTO ((int, tree, tree));
229 static tree build_null_of_type PROTO ((tree));
230 static tree patch_cast PROTO ((tree, tree));
231 static int valid_ref_assignconv_cast_p PROTO ((tree, tree, int));
232 static int valid_builtin_assignconv_identity_widening_p PROTO ((tree, tree));
233 static int valid_cast_to_p PROTO ((tree, tree));
234 static int valid_method_invocation_conversion_p PROTO ((tree, tree));
235 static tree try_builtin_assignconv PROTO ((tree, tree, tree));
236 static tree try_reference_assignconv PROTO ((tree, tree));
237 static tree build_unresolved_array_type PROTO ((tree));
238 static tree build_array_from_name PROTO ((tree, tree, tree, tree *));
239 static tree build_array_ref PROTO ((int, tree, tree));
240 static tree patch_array_ref PROTO ((tree));
241 static tree make_qualified_name PROTO ((tree, tree, int));
242 static tree merge_qualified_name PROTO ((tree, tree));
243 static tree make_qualified_primary PROTO ((tree, tree, int));
244 static int resolve_qualified_expression_name PROTO ((tree, tree *,
246 static void qualify_ambiguous_name PROTO ((tree));
247 static void maybe_generate_clinit PROTO ((void));
248 static tree resolve_field_access PROTO ((tree, tree *, tree *));
249 static tree build_newarray_node PROTO ((tree, tree, int));
250 static tree patch_newarray PROTO ((tree));
251 static tree resolve_type_during_patch PROTO ((tree));
252 static tree build_this PROTO ((int));
253 static tree build_return PROTO ((int, tree));
254 static tree patch_return PROTO ((tree));
255 static tree maybe_access_field PROTO ((tree, tree, tree));
256 static int complete_function_arguments PROTO ((tree));
257 static int check_for_static_method_reference PROTO ((tree, tree, tree, tree, tree));
258 static int not_accessible_p PROTO ((tree, tree, int));
259 static void check_deprecation PROTO ((tree, tree));
260 static int class_in_current_package PROTO ((tree));
261 static tree build_if_else_statement PROTO ((int, tree, tree, tree));
262 static tree patch_if_else_statement PROTO ((tree));
263 static tree add_stmt_to_compound PROTO ((tree, tree, tree));
264 static tree add_stmt_to_block PROTO ((tree, tree, tree));
265 static tree patch_exit_expr PROTO ((tree));
266 static tree build_labeled_block PROTO ((int, tree));
267 static tree finish_labeled_statement PROTO ((tree, tree));
268 static tree build_bc_statement PROTO ((int, int, tree));
269 static tree patch_bc_statement PROTO ((tree));
270 static tree patch_loop_statement PROTO ((tree));
271 static tree build_new_loop PROTO ((tree));
272 static tree build_loop_body PROTO ((int, tree, int));
273 static tree finish_loop_body PROTO ((int, tree, tree, int));
274 static tree build_debugable_stmt PROTO ((int, tree));
275 static tree finish_for_loop PROTO ((int, tree, tree, tree));
276 static tree patch_switch_statement PROTO ((tree));
277 static tree string_constant_concatenation PROTO ((tree, tree));
278 static tree build_string_concatenation PROTO ((tree, tree));
279 static tree patch_string_cst PROTO ((tree));
280 static tree patch_string PROTO ((tree));
281 static tree build_try_statement PROTO ((int, tree, tree));
282 static tree build_try_finally_statement PROTO ((int, tree, tree));
283 static tree patch_try_statement PROTO ((tree));
284 static tree patch_synchronized_statement PROTO ((tree, tree));
285 static tree patch_throw_statement PROTO ((tree, tree));
286 static void check_thrown_exceptions PROTO ((int, tree));
287 static int check_thrown_exceptions_do PROTO ((tree));
288 static void purge_unchecked_exceptions PROTO ((tree));
289 static void check_throws_clauses PROTO ((tree, tree, tree));
290 static void finish_method_declaration PROTO ((tree));
291 static tree build_super_invocation PROTO (());
292 static int verify_constructor_circularity PROTO ((tree, tree));
293 static char *constructor_circularity_msg PROTO ((tree, tree));
294 static tree build_this_super_qualified_invocation PROTO ((int, tree, tree,
296 static char *get_printable_method_name PROTO ((tree));
297 static tree patch_conditional_expr PROTO ((tree, tree, tree));
298 static void maybe_generate_finit PROTO (());
299 static void fix_constructors PROTO ((tree));
300 static int verify_constructor_super PROTO (());
301 static tree create_artificial_method PROTO ((tree, int, tree, tree, tree));
302 static void start_artificial_method_body PROTO ((tree));
303 static void end_artificial_method_body PROTO ((tree));
304 static int check_method_redefinition PROTO ((tree, tree));
305 static int reset_method_name PROTO ((tree));
306 static void java_check_regular_methods PROTO ((tree));
307 static void java_check_abstract_methods PROTO ((tree));
308 static tree maybe_build_primttype_type_ref PROTO ((tree, tree));
309 static void unreachable_stmt_error PROTO ((tree));
310 static tree find_expr_with_wfl PROTO ((tree));
311 static void missing_return_error PROTO ((tree));
312 static tree build_new_array_init PROTO ((int, tree));
313 static tree patch_new_array_init PROTO ((tree, tree));
314 static tree maybe_build_array_element_wfl PROTO ((tree));
315 static int array_constructor_check_entry PROTO ((tree, tree));
316 static char *purify_type_name PROTO ((char *));
317 static tree fold_constant_for_init PROTO ((tree, tree));
318 static tree strip_out_static_field_access_decl PROTO ((tree));
319 static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *));
320 static void static_ref_err PROTO ((tree, tree, tree));
322 /* Number of error found so far. */
323 int java_error_count;
324 /* Number of warning found so far. */
325 int java_warning_count;
326 /* Tell when not to fold, when doing xrefs */
329 /* The current parser context */
330 struct parser_ctxt *ctxp;
332 /* List of things that were analyzed for which code will be generated */
333 static struct parser_ctxt *ctxp_for_generation = NULL;
335 /* binop_lookup maps token to tree_code. It is used where binary
336 operations are involved and required by the parser. RDIV_EXPR
337 covers both integral/floating point division. The code is changed
338 once the type of both operator is worked out. */
340 static enum tree_code binop_lookup[19] =
342 PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR,
343 LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR,
344 BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR,
345 TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR,
346 EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR,
348 #define BINOP_LOOKUP(VALUE) \
349 binop_lookup [((VALUE) - PLUS_TK)% \
350 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
352 /* Fake WFL used to report error message. It is initialized once if
353 needed and reused with it's location information is overriden. */
354 tree wfl_operator = NULL_TREE;
356 /* The "$L" identifier we use to create labels. */
357 static tree label_id = NULL_TREE;
359 /* The "StringBuffer" identifier used for the String `+' operator. */
360 static tree wfl_string_buffer = NULL_TREE;
362 /* The "append" identifier used for String `+' operator. */
363 static tree wfl_append = NULL_TREE;
365 /* The "toString" identifier used for String `+' operator. */
366 static tree wfl_to_string = NULL_TREE;
368 /* The "java.lang" import qualified name. */
369 static tree java_lang_id = NULL_TREE;
371 /* The "java.lang.Cloneable" qualified name. */
372 static tree java_lang_cloneable = NULL_TREE;
374 /* Context and flag for static blocks */
375 static tree current_static_block = NULL_TREE;
378 #line 303 "./parse.y"
388 #line 313 "./parse.y"
406 #define YYFLAG -32768
409 #define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 266)
411 static const char yytranslate[] = { 0,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
438 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
439 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
440 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
441 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
442 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
443 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
444 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
445 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
446 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
447 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
452 static const short yyprhs[] = { 0,
453 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
454 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
455 46, 50, 54, 56, 58, 60, 64, 66, 67, 69,
456 71, 73, 76, 79, 82, 86, 88, 91, 93, 96,
457 100, 103, 107, 109, 111, 115, 118, 122, 128, 133,
458 139, 141, 143, 145, 147, 149, 152, 153, 161, 162,
459 169, 173, 176, 180, 185, 186, 189, 193, 196, 197,
460 200, 203, 205, 209, 213, 216, 220, 222, 225, 227,
461 229, 231, 233, 235, 238, 240, 242, 244, 248, 253,
462 255, 259, 263, 265, 269, 273, 278, 280, 284, 287,
463 291, 295, 297, 299, 300, 304, 307, 311, 315, 320,
464 325, 328, 332, 335, 339, 342, 346, 351, 355, 359,
465 363, 365, 369, 373, 376, 380, 383, 387, 388, 391,
466 394, 396, 400, 404, 406, 409, 411, 414, 418, 420,
467 421, 425, 428, 432, 436, 441, 444, 448, 452, 457,
468 459, 462, 467, 473, 481, 488, 490, 492, 493, 498,
469 499, 505, 506, 512, 513, 520, 524, 529, 532, 536,
470 539, 543, 546, 550, 552, 555, 557, 559, 561, 563,
471 565, 568, 571, 574, 578, 583, 585, 589, 593, 596,
472 600, 602, 604, 606, 609, 611, 613, 615, 618, 621,
473 625, 627, 629, 631, 633, 635, 637, 639, 641, 643,
474 645, 647, 649, 651, 653, 655, 657, 659, 661, 663,
475 665, 667, 669, 671, 674, 677, 680, 683, 686, 689,
476 692, 695, 699, 704, 709, 715, 720, 726, 733, 741,
477 748, 750, 752, 754, 756, 758, 760, 762, 768, 771,
478 775, 780, 788, 796, 797, 801, 806, 809, 813, 819,
479 822, 826, 830, 835, 837, 840, 843, 845, 848, 852,
480 855, 858, 862, 865, 870, 873, 876, 880, 885, 888,
481 890, 898, 906, 913, 917, 923, 928, 936, 943, 946,
482 949, 953, 956, 957, 959, 961, 964, 965, 967, 969,
483 973, 977, 980, 984, 987, 991, 994, 998, 1001, 1005,
484 1008, 1012, 1015, 1019, 1023, 1026, 1030, 1036, 1042, 1045,
485 1050, 1054, 1056, 1060, 1064, 1069, 1072, 1074, 1077, 1080,
486 1085, 1088, 1092, 1097, 1100, 1103, 1105, 1107, 1109, 1111,
487 1115, 1117, 1119, 1121, 1123, 1127, 1131, 1135, 1139, 1143,
488 1147, 1151, 1155, 1161, 1166, 1173, 1179, 1184, 1190, 1196,
489 1203, 1207, 1211, 1216, 1222, 1225, 1229, 1233, 1237, 1239,
490 1243, 1247, 1251, 1255, 1260, 1265, 1270, 1275, 1279, 1283,
491 1285, 1288, 1292, 1296, 1299, 1302, 1306, 1310, 1314, 1318,
492 1321, 1325, 1330, 1336, 1343, 1349, 1356, 1361, 1366, 1371,
493 1376, 1380, 1385, 1389, 1394, 1396, 1398, 1400, 1402, 1405,
494 1408, 1410, 1412, 1415, 1418, 1420, 1423, 1426, 1429, 1432,
495 1435, 1438, 1440, 1443, 1446, 1448, 1451, 1454, 1460, 1465,
496 1470, 1476, 1481, 1484, 1490, 1495, 1501, 1503, 1507, 1511,
497 1515, 1519, 1523, 1527, 1529, 1533, 1537, 1541, 1545, 1547,
498 1551, 1555, 1559, 1563, 1567, 1571, 1573, 1577, 1581, 1585,
499 1589, 1593, 1597, 1601, 1605, 1609, 1613, 1615, 1619, 1623,
500 1627, 1631, 1633, 1637, 1641, 1643, 1647, 1651, 1653, 1657,
501 1661, 1663, 1667, 1671, 1673, 1677, 1681, 1683, 1689, 1694,
502 1698, 1704, 1706, 1708, 1712, 1716, 1718, 1720, 1722, 1724,
506 static const short yyrhs[] = { 123,
507 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
508 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
509 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
510 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
511 0, 118, 97, 98, 0, 113, 97, 1, 0, 118,
512 97, 1, 0, 120, 0, 121, 0, 122, 0, 119,
513 101, 122, 0, 86, 0, 0, 126, 0, 124, 0,
514 125, 0, 126, 124, 0, 126, 125, 0, 124, 125,
515 0, 126, 124, 125, 0, 127, 0, 124, 127, 0,
516 130, 0, 125, 130, 0, 75, 119, 99, 0, 75,
517 1, 0, 75, 119, 1, 0, 128, 0, 129, 0,
518 55, 119, 99, 0, 55, 1, 0, 55, 119, 1,
519 0, 55, 119, 101, 5, 99, 0, 55, 119, 101,
520 1, 0, 55, 119, 101, 5, 1, 0, 132, 0,
521 166, 0, 99, 0, 1, 0, 44, 0, 131, 44,
522 0, 0, 131, 67, 122, 135, 136, 133, 138, 0,
523 0, 67, 122, 135, 136, 134, 138, 0, 131, 67,
524 1, 0, 67, 1, 0, 67, 122, 1, 0, 131,
525 67, 122, 1, 0, 0, 63, 116, 0, 63, 116,
526 1, 0, 63, 1, 0, 0, 52, 137, 0, 52,
527 1, 0, 117, 0, 137, 100, 117, 0, 137, 100,
528 1, 0, 95, 96, 0, 95, 139, 96, 0, 140,
529 0, 139, 140, 0, 141, 0, 156, 0, 158, 0,
530 179, 0, 142, 0, 142, 99, 0, 147, 0, 132,
531 0, 166, 0, 112, 143, 99, 0, 131, 112, 143,
532 99, 0, 144, 0, 143, 100, 144, 0, 143, 100,
533 1, 0, 145, 0, 145, 92, 146, 0, 145, 92,
534 1, 0, 145, 92, 146, 1, 0, 122, 0, 145,
535 97, 98, 0, 122, 1, 0, 145, 97, 1, 0,
536 145, 98, 1, 0, 264, 0, 177, 0, 0, 149,
537 148, 155, 0, 149, 1, 0, 112, 150, 153, 0,
538 59, 150, 153, 0, 131, 112, 150, 153, 0, 131,
539 59, 150, 153, 0, 112, 1, 0, 131, 112, 1,
540 0, 59, 1, 0, 131, 59, 1, 0, 131, 1,
541 0, 122, 93, 94, 0, 122, 93, 151, 94, 0,
542 150, 97, 98, 0, 122, 93, 1, 0, 150, 97,
543 1, 0, 152, 0, 151, 100, 152, 0, 151, 100,
544 1, 0, 112, 145, 0, 131, 112, 145, 0, 112,
545 1, 0, 131, 112, 1, 0, 0, 53, 154, 0,
546 53, 1, 0, 116, 0, 154, 100, 116, 0, 154,
547 100, 1, 0, 179, 0, 179, 99, 0, 99, 0,
548 157, 179, 0, 157, 179, 99, 0, 44, 0, 0,
549 160, 159, 162, 0, 161, 153, 0, 131, 161, 153,
550 0, 120, 93, 94, 0, 120, 93, 151, 94, 0,
551 180, 163, 0, 180, 164, 163, 0, 180, 182, 163,
552 0, 180, 164, 182, 163, 0, 181, 0, 181, 99,
553 0, 165, 93, 94, 99, 0, 165, 93, 233, 94,
554 99, 0, 119, 101, 65, 93, 233, 94, 99, 0,
555 119, 101, 65, 93, 94, 99, 0, 76, 0, 65,
556 0, 0, 61, 122, 167, 172, 0, 0, 131, 61,
557 122, 168, 172, 0, 0, 61, 122, 171, 169, 172,
558 0, 0, 131, 61, 122, 171, 170, 172, 0, 61,
559 122, 1, 0, 131, 61, 122, 1, 0, 63, 117,
560 0, 171, 100, 117, 0, 63, 1, 0, 171, 100,
561 1, 0, 95, 96, 0, 95, 173, 96, 0, 174,
562 0, 173, 174, 0, 175, 0, 176, 0, 132, 0,
563 166, 0, 142, 0, 149, 99, 0, 149, 1, 0,
564 95, 96, 0, 95, 178, 96, 0, 95, 178, 100,
565 96, 0, 146, 0, 178, 100, 146, 0, 178, 100,
566 1, 0, 95, 96, 0, 180, 182, 181, 0, 95,
567 0, 96, 0, 183, 0, 182, 183, 0, 184, 0,
568 186, 0, 132, 0, 185, 99, 0, 112, 143, 0,
569 131, 112, 143, 0, 188, 0, 191, 0, 195, 0,
570 196, 0, 207, 0, 211, 0, 188, 0, 192, 0,
571 197, 0, 208, 0, 212, 0, 179, 0, 189, 0,
572 193, 0, 198, 0, 210, 0, 218, 0, 219, 0,
573 220, 0, 222, 0, 221, 0, 224, 0, 99, 0,
574 122, 88, 0, 190, 186, 0, 122, 1, 0, 190,
575 187, 0, 194, 99, 0, 1, 99, 0, 1, 95,
576 0, 1, 96, 0, 165, 93, 1, 0, 165, 93,
577 94, 1, 0, 165, 93, 233, 1, 0, 165, 93,
578 233, 94, 1, 0, 119, 101, 65, 1, 0, 119,
579 101, 65, 93, 1, 0, 119, 101, 65, 93, 233,
580 1, 0, 119, 101, 65, 93, 233, 94, 1, 0,
581 119, 101, 65, 93, 94, 1, 0, 261, 0, 245,
582 0, 246, 0, 242, 0, 243, 0, 239, 0, 231,
583 0, 48, 93, 264, 94, 186, 0, 48, 1, 0,
584 48, 93, 1, 0, 48, 93, 264, 1, 0, 48,
585 93, 264, 94, 187, 56, 186, 0, 48, 93, 264,
586 94, 187, 56, 187, 0, 0, 200, 199, 201, 0,
587 68, 93, 264, 94, 0, 68, 1, 0, 68, 93,
588 1, 0, 68, 93, 264, 94, 1, 0, 95, 96,
589 0, 95, 204, 96, 0, 95, 202, 96, 0, 95,
590 202, 204, 96, 0, 203, 0, 202, 203, 0, 204,
591 182, 0, 205, 0, 204, 205, 0, 62, 265, 88,
592 0, 47, 88, 0, 62, 1, 0, 62, 265, 1,
593 0, 47, 1, 0, 66, 93, 264, 94, 0, 206,
594 186, 0, 66, 1, 0, 66, 93, 1, 0, 66,
595 93, 264, 1, 0, 206, 187, 0, 51, 0, 209,
596 186, 66, 93, 264, 94, 99, 0, 214, 99, 264,
597 99, 216, 94, 186, 0, 214, 99, 99, 216, 94,
598 186, 0, 214, 99, 1, 0, 214, 99, 264, 99,
599 1, 0, 214, 99, 99, 1, 0, 214, 99, 264,
600 99, 216, 94, 187, 0, 214, 99, 99, 216, 94,
601 187, 0, 71, 93, 0, 71, 1, 0, 71, 93,
602 1, 0, 213, 215, 0, 0, 217, 0, 185, 0,
603 217, 1, 0, 0, 217, 0, 194, 0, 217, 100,
604 194, 0, 217, 100, 1, 0, 54, 99, 0, 54,
605 122, 99, 0, 54, 1, 0, 54, 122, 1, 0,
606 73, 99, 0, 73, 122, 99, 0, 73, 1, 0,
607 73, 122, 1, 0, 58, 99, 0, 58, 264, 99,
608 0, 58, 1, 0, 58, 264, 1, 0, 49, 264,
609 99, 0, 49, 1, 0, 49, 264, 1, 0, 223,
610 93, 264, 94, 179, 0, 223, 93, 264, 94, 1,
611 0, 223, 1, 0, 223, 93, 1, 94, 0, 223,
612 93, 1, 0, 44, 0, 70, 179, 225, 0, 70,
613 179, 228, 0, 70, 179, 225, 228, 0, 70, 1,
614 0, 226, 0, 225, 226, 0, 227, 179, 0, 60,
615 93, 152, 94, 0, 60, 1, 0, 60, 93, 1,
616 0, 60, 93, 1, 94, 0, 64, 179, 0, 64,
617 1, 0, 230, 0, 234, 0, 111, 0, 76, 0,
618 93, 264, 94, 0, 231, 0, 238, 0, 239, 0,
619 240, 0, 119, 101, 67, 0, 113, 101, 67, 0,
620 59, 101, 67, 0, 119, 101, 76, 0, 93, 264,
621 1, 0, 119, 101, 1, 0, 113, 101, 1, 0,
622 59, 101, 1, 0, 72, 116, 93, 233, 94, 0,
623 72, 116, 93, 94, 0, 72, 116, 93, 233, 94,
624 138, 0, 72, 116, 93, 94, 138, 0, 232, 122,
625 93, 94, 0, 232, 122, 93, 94, 138, 0, 232,
626 122, 93, 233, 94, 0, 232, 122, 93, 233, 94,
627 138, 0, 72, 1, 99, 0, 72, 116, 1, 0,
628 72, 116, 93, 1, 0, 72, 116, 93, 233, 1,
629 0, 232, 1, 0, 232, 122, 1, 0, 119, 101,
630 72, 0, 229, 101, 72, 0, 264, 0, 233, 100,
631 264, 0, 233, 100, 1, 0, 72, 113, 235, 0,
632 72, 115, 235, 0, 72, 113, 235, 237, 0, 72,
633 115, 235, 237, 0, 72, 115, 237, 177, 0, 72,
634 113, 237, 177, 0, 72, 1, 98, 0, 72, 1,
635 97, 0, 236, 0, 235, 236, 0, 97, 264, 98,
636 0, 97, 264, 1, 0, 97, 1, 0, 97, 98,
637 0, 237, 97, 98, 0, 237, 97, 1, 0, 229,
638 101, 122, 0, 65, 101, 122, 0, 65, 1, 0,
639 119, 93, 94, 0, 119, 93, 233, 94, 0, 229,
640 101, 122, 93, 94, 0, 229, 101, 122, 93, 233,
641 94, 0, 65, 101, 122, 93, 94, 0, 65, 101,
642 122, 93, 233, 94, 0, 65, 101, 1, 94, 0,
643 65, 101, 1, 101, 0, 119, 97, 264, 98, 0,
644 230, 97, 264, 98, 0, 119, 97, 1, 0, 119,
645 97, 264, 1, 0, 230, 97, 1, 0, 230, 97,
646 264, 1, 0, 229, 0, 119, 0, 242, 0, 243,
647 0, 241, 46, 0, 241, 45, 0, 245, 0, 246,
648 0, 3, 244, 0, 4, 244, 0, 247, 0, 3,
649 1, 0, 4, 1, 0, 46, 244, 0, 46, 1,
650 0, 45, 244, 0, 45, 1, 0, 241, 0, 89,
651 244, 0, 90, 244, 0, 248, 0, 89, 1, 0,
652 90, 1, 0, 93, 113, 237, 94, 244, 0, 93,
653 113, 94, 244, 0, 93, 264, 94, 247, 0, 93,
654 119, 237, 94, 247, 0, 93, 113, 97, 1, 0,
655 93, 1, 0, 93, 113, 237, 94, 1, 0, 93,
656 113, 94, 1, 0, 93, 119, 237, 94, 1, 0,
657 244, 0, 249, 5, 244, 0, 249, 6, 244, 0,
658 249, 7, 244, 0, 249, 5, 1, 0, 249, 6,
659 1, 0, 249, 7, 1, 0, 249, 0, 250, 3,
660 249, 0, 250, 4, 249, 0, 250, 3, 1, 0,
661 250, 4, 1, 0, 250, 0, 251, 8, 250, 0,
662 251, 9, 250, 0, 251, 10, 250, 0, 251, 8,
663 1, 0, 251, 9, 1, 0, 251, 10, 1, 0,
664 251, 0, 252, 20, 251, 0, 252, 18, 251, 0,
665 252, 21, 251, 0, 252, 19, 251, 0, 252, 57,
666 114, 0, 252, 20, 1, 0, 252, 18, 1, 0,
667 252, 21, 1, 0, 252, 19, 1, 0, 252, 57,
668 1, 0, 252, 0, 253, 16, 252, 0, 253, 17,
669 252, 0, 253, 16, 1, 0, 253, 17, 1, 0,
670 253, 0, 254, 11, 253, 0, 254, 11, 1, 0,
671 254, 0, 255, 12, 254, 0, 255, 12, 1, 0,
672 255, 0, 256, 13, 255, 0, 256, 13, 1, 0,
673 256, 0, 257, 14, 256, 0, 257, 14, 1, 0,
674 257, 0, 258, 15, 257, 0, 258, 15, 1, 0,
675 258, 0, 258, 87, 264, 88, 259, 0, 258, 87,
676 88, 1, 0, 258, 87, 1, 0, 258, 87, 264,
677 88, 1, 0, 259, 0, 261, 0, 262, 263, 260,
678 0, 262, 263, 1, 0, 119, 0, 238, 0, 240,
679 0, 91, 0, 92, 0, 260, 0, 264, 0
685 static const short yyrline[] = { 0,
686 457, 463, 465, 466, 467, 468, 469, 473, 475, 478,
687 480, 481, 484, 486, 489, 493, 497, 501, 507, 509,
688 511, 513, 518, 520, 523, 527, 532, 537, 539, 540,
689 541, 542, 543, 544, 545, 548, 553, 559, 561, 564,
690 567, 569, 573, 575, 578, 605, 607, 611, 624, 626,
691 630, 637, 642, 644, 654, 659, 674, 678, 681, 684,
692 687, 689, 691, 696, 700, 702, 704, 706, 710, 712,
693 714, 721, 727, 732, 736, 745, 755, 757, 760, 762,
694 763, 764, 768, 770, 772, 773, 775, 780, 783, 793,
695 796, 798, 802, 805, 812, 818, 826, 828, 830, 832,
696 834, 838, 840, 844, 851, 852, 856, 859, 861, 863,
697 865, 867, 869, 871, 873, 880, 883, 885, 894, 896,
698 900, 905, 910, 914, 919, 924, 926, 933, 935, 937,
699 941, 944, 946, 950, 952, 953, 958, 964, 971, 979,
700 986, 989, 992, 996, 999, 1003, 1012, 1014, 1016, 1020,
701 1022, 1025, 1032, 1040, 1042, 1046, 1053, 1063, 1067, 1070,
702 1073, 1076, 1079, 1082, 1085, 1088, 1090, 1094, 1100, 1105,
703 1107, 1111, 1114, 1118, 1120, 1123, 1125, 1126, 1128, 1132,
704 1136, 1142, 1147, 1150, 1152, 1156, 1162, 1166, 1171, 1180,
705 1184, 1189, 1201, 1203, 1206, 1208, 1210, 1214, 1218, 1221,
706 1225, 1227, 1228, 1229, 1230, 1231, 1235, 1237, 1238, 1239,
707 1240, 1244, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253,
708 1254, 1255, 1258, 1263, 1274, 1277, 1281, 1288, 1298, 1304,
709 1310, 1316, 1318, 1324, 1326, 1332, 1334, 1336, 1338, 1340,
710 1344, 1346, 1347, 1348, 1349, 1350, 1351, 1354, 1360, 1362,
711 1364, 1368, 1373, 1378, 1384, 1394, 1400, 1402, 1404, 1411,
712 1414, 1416, 1418, 1422, 1424, 1427, 1431, 1433, 1436, 1443,
713 1449, 1451, 1453, 1457, 1465, 1468, 1470, 1472, 1476, 1481,
714 1490, 1495, 1498, 1505, 1507, 1509, 1513, 1516, 1525, 1532,
715 1534, 1538, 1551, 1553, 1559, 1565, 1569, 1571, 1575, 1578,
716 1580, 1584, 1587, 1589, 1591, 1595, 1598, 1600, 1602, 1606,
717 1609, 1611, 1613, 1617, 1623, 1625, 1629, 1636, 1638, 1640,
718 1642, 1646, 1654, 1657, 1659, 1664, 1668, 1670, 1677, 1685,
719 1702, 1704, 1706, 1710, 1713, 1718, 1720, 1723, 1725, 1727,
720 1729, 1730, 1731, 1732, 1736, 1738, 1740, 1745, 1747, 1749,
721 1751, 1753, 1757, 1760, 1765, 1767, 1772, 1773, 1774, 1775,
722 1776, 1778, 1780, 1782, 1784, 1786, 1790, 1792, 1795, 1801,
723 1806, 1810, 1813, 1815, 1817, 1821, 1823, 1825, 1827, 1831,
724 1834, 1838, 1844, 1846, 1854, 1881, 1883, 1887, 1892, 1899,
725 1903, 1906, 1908, 1919, 1930, 1935, 1944, 1946, 1950, 1953,
726 1955, 1960, 1965, 1970, 1977, 1979, 1980, 1981, 1984, 1989,
727 1994, 1996, 1997, 1999, 2001, 2002, 2004, 2008, 2011, 2015,
728 2018, 2022, 2024, 2026, 2028, 2029, 2031, 2035, 2044, 2046,
729 2048, 2061, 2063, 2069, 2071, 2073, 2077, 2079, 2084, 2089,
730 2094, 2096, 2098, 2102, 2104, 2109, 2114, 2116, 2120, 2122,
731 2127, 2132, 2137, 2139, 2141, 2145, 2147, 2152, 2157, 2162,
732 2167, 2169, 2171, 2173, 2175, 2177, 2181, 2183, 2188, 2193,
733 2195, 2199, 2201, 2206, 2210, 2212, 2217, 2221, 2223, 2228,
734 2232, 2234, 2239, 2243, 2245, 2250, 2254, 2256, 2261, 2267,
735 2269, 2273, 2275, 2278, 2281, 2289, 2291, 2292, 2295, 2297,
741 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
743 static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK",
744 "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
745 "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
746 "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
747 "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
748 "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
749 "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
750 "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
751 "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
752 "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
753 "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
754 "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
755 "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
756 "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
757 "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
758 "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
759 "goal","literal","type","primitive_type","reference_type","class_or_interface_type",
760 "class_type","interface_type","array_type","name","simple_name","qualified_name",
761 "identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
762 "import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
763 "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
764 "interface_type_list","class_body","class_body_declarations","class_body_declaration",
765 "class_member_declaration","field_declaration","variable_declarators","variable_declarator",
766 "variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
767 "method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list",
768 "method_body","static_initializer","static","constructor_declaration","@4","constructor_header",
769 "constructor_declarator","constructor_body","constructor_block_end","explicit_constructor_invocation",
770 "this_or_super","interface_declaration","@5","@6","@7","@8","extends_interfaces",
771 "interface_body","interface_member_declarations","interface_member_declaration",
772 "constant_declaration","abstract_method_declaration","array_initializer","variable_initializers",
773 "block","block_begin","block_end","block_statements","block_statement","local_variable_declaration_statement",
774 "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
775 "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
776 "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
777 "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups",
778 "switch_block_statement_group","switch_labels","switch_label","while_expression",
779 "while_statement","while_statement_nsi","do_statement_begin","do_statement",
780 "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update",
781 "statement_expression_list","break_statement","continue_statement","return_statement",
782 "throw_statement","synchronized_statement","synchronized","try_statement","catches",
783 "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array",
784 "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression",
785 "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access",
786 "postfix_expression","post_increment_expression","post_decrement_expression",
787 "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus",
788 "cast_expression","multiplicative_expression","additive_expression","shift_expression",
789 "relational_expression","equality_expression","and_expression","exclusive_or_expression",
790 "inclusive_or_expression","conditional_and_expression","conditional_or_expression",
791 "conditional_expression","assignment_expression","assignment","left_hand_side",
792 "assignment_operator","expression","constant_expression", NULL
796 static const short yyr1[] = { 0,
797 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
798 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
799 118, 118, 119, 119, 120, 121, 122, 123, 123, 123,
800 123, 123, 123, 123, 123, 124, 124, 125, 125, 126,
801 126, 126, 127, 127, 128, 128, 128, 129, 129, 129,
802 130, 130, 130, 130, 131, 131, 133, 132, 134, 132,
803 132, 132, 132, 132, 135, 135, 135, 135, 136, 136,
804 136, 137, 137, 137, 138, 138, 139, 139, 140, 140,
805 140, 140, 141, 141, 141, 141, 141, 142, 142, 143,
806 143, 143, 144, 144, 144, 144, 145, 145, 145, 145,
807 145, 146, 146, 148, 147, 147, 149, 149, 149, 149,
808 149, 149, 149, 149, 149, 150, 150, 150, 150, 150,
809 151, 151, 151, 152, 152, 152, 152, 153, 153, 153,
810 154, 154, 154, 155, 155, 155, 156, 156, 157, 159,
811 158, 160, 160, 161, 161, 162, 162, 162, 162, 163,
812 163, 164, 164, 164, 164, 165, 165, 167, 166, 168,
813 166, 169, 166, 170, 166, 166, 166, 171, 171, 171,
814 171, 172, 172, 173, 173, 174, 174, 174, 174, 175,
815 176, 176, 177, 177, 177, 178, 178, 178, 179, 179,
816 180, 181, 182, 182, 183, 183, 183, 184, 185, 185,
817 186, 186, 186, 186, 186, 186, 187, 187, 187, 187,
818 187, 188, 188, 188, 188, 188, 188, 188, 188, 188,
819 188, 188, 189, 190, 191, 191, 192, 193, 193, 193,
820 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
821 194, 194, 194, 194, 194, 194, 194, 195, 195, 195,
822 195, 196, 197, 199, 198, 200, 200, 200, 200, 201,
823 201, 201, 201, 202, 202, 203, 204, 204, 205, 205,
824 205, 205, 205, 206, 207, 207, 207, 207, 208, 209,
825 210, 211, 211, 211, 211, 211, 212, 212, 213, 213,
826 213, 214, 215, 215, 215, 215, 216, 216, 217, 217,
827 217, 218, 218, 218, 218, 219, 219, 219, 219, 220,
828 220, 220, 220, 221, 221, 221, 222, 222, 222, 222,
829 222, 223, 224, 224, 224, 224, 225, 225, 226, 227,
830 227, 227, 227, 228, 228, 229, 229, 230, 230, 230,
831 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
832 230, 230, 231, 231, 231, 231, 231, 231, 231, 231,
833 231, 231, 231, 231, 231, 231, 232, 232, 233, 233,
834 233, 234, 234, 234, 234, 234, 234, 234, 234, 235,
835 235, 236, 236, 236, 237, 237, 237, 238, 238, 238,
836 239, 239, 239, 239, 239, 239, 239, 239, 240, 240,
837 240, 240, 240, 240, 241, 241, 241, 241, 242, 243,
838 244, 244, 244, 244, 244, 244, 244, 245, 245, 246,
839 246, 247, 247, 247, 247, 247, 247, 248, 248, 248,
840 248, 248, 248, 248, 248, 248, 249, 249, 249, 249,
841 249, 249, 249, 250, 250, 250, 250, 250, 251, 251,
842 251, 251, 251, 251, 251, 252, 252, 252, 252, 252,
843 252, 252, 252, 252, 252, 252, 253, 253, 253, 253,
844 253, 254, 254, 254, 255, 255, 255, 256, 256, 256,
845 257, 257, 257, 258, 258, 258, 259, 259, 259, 259,
846 259, 260, 260, 261, 261, 262, 262, 262, 263, 263,
850 static const short yyr2[] = { 0,
851 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
852 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
853 3, 3, 1, 1, 1, 3, 1, 0, 1, 1,
854 1, 2, 2, 2, 3, 1, 2, 1, 2, 3,
855 2, 3, 1, 1, 3, 2, 3, 5, 4, 5,
856 1, 1, 1, 1, 1, 2, 0, 7, 0, 6,
857 3, 2, 3, 4, 0, 2, 3, 2, 0, 2,
858 2, 1, 3, 3, 2, 3, 1, 2, 1, 1,
859 1, 1, 1, 2, 1, 1, 1, 3, 4, 1,
860 3, 3, 1, 3, 3, 4, 1, 3, 2, 3,
861 3, 1, 1, 0, 3, 2, 3, 3, 4, 4,
862 2, 3, 2, 3, 2, 3, 4, 3, 3, 3,
863 1, 3, 3, 2, 3, 2, 3, 0, 2, 2,
864 1, 3, 3, 1, 2, 1, 2, 3, 1, 0,
865 3, 2, 3, 3, 4, 2, 3, 3, 4, 1,
866 2, 4, 5, 7, 6, 1, 1, 0, 4, 0,
867 5, 0, 5, 0, 6, 3, 4, 2, 3, 2,
868 3, 2, 3, 1, 2, 1, 1, 1, 1, 1,
869 2, 2, 2, 3, 4, 1, 3, 3, 2, 3,
870 1, 1, 1, 2, 1, 1, 1, 2, 2, 3,
871 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
872 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
873 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
874 2, 3, 4, 4, 5, 4, 5, 6, 7, 6,
875 1, 1, 1, 1, 1, 1, 1, 5, 2, 3,
876 4, 7, 7, 0, 3, 4, 2, 3, 5, 2,
877 3, 3, 4, 1, 2, 2, 1, 2, 3, 2,
878 2, 3, 2, 4, 2, 2, 3, 4, 2, 1,
879 7, 7, 6, 3, 5, 4, 7, 6, 2, 2,
880 3, 2, 0, 1, 1, 2, 0, 1, 1, 3,
881 3, 2, 3, 2, 3, 2, 3, 2, 3, 2,
882 3, 2, 3, 3, 2, 3, 5, 5, 2, 4,
883 3, 1, 3, 3, 4, 2, 1, 2, 2, 4,
884 2, 3, 4, 2, 2, 1, 1, 1, 1, 3,
885 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
886 3, 3, 5, 4, 6, 5, 4, 5, 5, 6,
887 3, 3, 4, 5, 2, 3, 3, 3, 1, 3,
888 3, 3, 3, 4, 4, 4, 4, 3, 3, 1,
889 2, 3, 3, 2, 2, 3, 3, 3, 3, 2,
890 3, 4, 5, 6, 5, 6, 4, 4, 4, 4,
891 3, 4, 3, 4, 1, 1, 1, 1, 2, 2,
892 1, 1, 2, 2, 1, 2, 2, 2, 2, 2,
893 2, 1, 2, 2, 1, 2, 2, 5, 4, 4,
894 5, 4, 2, 5, 4, 5, 1, 3, 3, 3,
895 3, 3, 3, 1, 3, 3, 3, 3, 1, 3,
896 3, 3, 3, 3, 3, 1, 3, 3, 3, 3,
897 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
898 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
899 1, 3, 3, 1, 3, 3, 1, 5, 4, 3,
900 5, 1, 1, 3, 3, 1, 1, 1, 1, 1,
904 static const short yydefact[] = { 0,
905 54, 55, 0, 0, 0, 0, 53, 1, 0, 0,
906 0, 36, 43, 44, 38, 0, 51, 52, 46, 27,
907 0, 23, 24, 25, 0, 62, 0, 41, 0, 0,
908 37, 39, 0, 0, 56, 0, 0, 47, 45, 0,
909 166, 0, 0, 162, 63, 0, 69, 42, 40, 0,
910 0, 0, 61, 0, 49, 0, 26, 170, 17, 168,
911 15, 0, 159, 0, 0, 68, 16, 0, 0, 59,
912 167, 0, 164, 64, 69, 50, 48, 12, 0, 10,
913 11, 172, 0, 8, 9, 13, 14, 15, 0, 178,
914 180, 0, 179, 0, 174, 176, 177, 171, 169, 163,
915 67, 71, 72, 70, 0, 161, 0, 57, 113, 0,
916 128, 111, 0, 0, 90, 93, 128, 0, 0, 0,
917 115, 0, 0, 182, 181, 173, 175, 0, 0, 60,
918 165, 0, 0, 0, 0, 108, 99, 88, 0, 0,
919 0, 0, 107, 21, 18, 22, 20, 19, 114, 128,
920 112, 0, 128, 74, 73, 55, 191, 75, 23, 0,
921 86, 0, 77, 79, 83, 85, 0, 80, 0, 81,
922 140, 128, 87, 82, 0, 58, 119, 116, 0, 0,
923 0, 121, 130, 131, 129, 120, 118, 92, 0, 91,
924 95, 0, 0, 0, 0, 0, 0, 0, 339, 0,
925 0, 0, 0, 6, 5, 2, 3, 4, 7, 338,
926 0, 406, 0, 103, 405, 336, 341, 0, 337, 342,
927 343, 344, 422, 407, 408, 437, 411, 412, 415, 425,
928 444, 449, 456, 467, 472, 475, 478, 481, 484, 487,
929 492, 501, 493, 0, 102, 100, 98, 101, 110, 89,
930 109, 189, 0, 128, 76, 78, 84, 106, 0, 137,
931 0, 142, 0, 55, 0, 0, 280, 0, 0, 0,
932 0, 0, 0, 0, 0, 339, 0, 223, 0, 8,
933 406, 0, 0, 197, 0, 212, 0, 193, 195, 0,
934 196, 201, 213, 0, 202, 214, 0, 203, 204, 215,
935 254, 0, 205, 0, 216, 206, 293, 0, 217, 218,
936 219, 221, 220, 0, 222, 247, 246, 0, 244, 245,
937 242, 243, 241, 126, 124, 0, 117, 0, 0, 416,
938 406, 342, 344, 413, 417, 414, 421, 420, 419, 418,
939 0, 390, 0, 0, 0, 16, 0, 426, 423, 427,
940 424, 433, 0, 406, 0, 183, 186, 0, 0, 0,
941 0, 0, 96, 0, 0, 365, 0, 410, 409, 0,
942 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
943 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
944 499, 500, 0, 144, 0, 143, 136, 105, 134, 138,
945 191, 141, 0, 230, 231, 229, 249, 0, 315, 0,
946 304, 302, 0, 312, 310, 0, 276, 0, 257, 0,
947 326, 0, 290, 0, 308, 306, 0, 0, 199, 0,
948 0, 226, 224, 0, 0, 192, 190, 194, 198, 322,
949 406, 225, 228, 0, 275, 0, 406, 0, 295, 299,
950 292, 0, 0, 319, 0, 127, 125, 123, 122, 133,
951 132, 352, 347, 0, 389, 379, 378, 361, 0, 372,
952 380, 0, 373, 0, 362, 0, 0, 0, 0, 0,
953 0, 349, 340, 184, 0, 351, 346, 391, 0, 369,
954 401, 0, 350, 345, 367, 348, 368, 388, 403, 0,
955 366, 0, 441, 438, 442, 439, 443, 440, 447, 445,
956 448, 446, 453, 450, 454, 451, 455, 452, 463, 458,
957 465, 460, 462, 457, 464, 459, 466, 0, 461, 470,
958 468, 471, 469, 474, 473, 477, 476, 480, 479, 483,
959 482, 486, 485, 490, 0, 0, 495, 494, 145, 135,
960 406, 146, 0, 0, 150, 0, 250, 0, 316, 314,
961 305, 303, 313, 311, 277, 0, 258, 0, 0, 0,
962 323, 327, 0, 324, 291, 309, 307, 340, 0, 200,
963 232, 0, 0, 0, 255, 0, 296, 0, 284, 0,
964 0, 321, 0, 397, 398, 0, 384, 385, 0, 381,
965 374, 0, 377, 375, 376, 363, 354, 0, 435, 429,
966 432, 0, 0, 430, 188, 185, 187, 392, 0, 402,
967 399, 0, 404, 400, 357, 0, 489, 0, 0, 147,
968 0, 0, 151, 148, 251, 0, 278, 274, 0, 331,
969 0, 335, 334, 328, 325, 329, 236, 0, 233, 234,
970 0, 0, 0, 260, 0, 264, 0, 267, 0, 301,
971 300, 286, 0, 298, 0, 320, 0, 395, 0, 383,
972 382, 387, 386, 356, 364, 353, 434, 428, 436, 431,
973 371, 370, 393, 0, 358, 359, 491, 488, 0, 149,
974 0, 0, 0, 248, 0, 201, 0, 208, 209, 0,
975 210, 211, 0, 259, 332, 0, 237, 0, 0, 235,
976 273, 270, 271, 502, 0, 262, 265, 0, 261, 0,
977 268, 0, 0, 285, 0, 318, 317, 396, 355, 394,
978 360, 0, 152, 0, 0, 0, 227, 279, 0, 333,
979 330, 240, 238, 0, 272, 269, 263, 0, 283, 0,
980 0, 0, 153, 0, 252, 0, 0, 239, 281, 282,
981 155, 0, 0, 0, 0, 154, 0, 0, 0, 0,
982 288, 0, 253, 287, 0, 0, 0
985 static const short yydefgoto[] = { 775,
986 210, 279, 211, 85, 86, 68, 60, 87, 212, 22,
987 23, 24, 8, 9, 10, 11, 12, 13, 14, 15,
988 283, 284, 132, 105, 47, 70, 104, 130, 162, 163,
989 164, 91, 114, 115, 116, 213, 166, 259, 92, 111,
990 181, 182, 136, 185, 398, 168, 169, 170, 261, 171,
991 172, 402, 552, 553, 285, 18, 43, 72, 65, 107,
992 44, 63, 94, 95, 96, 97, 214, 358, 286, 175,
993 555, 720, 288, 289, 290, 291, 695, 292, 293, 294,
994 295, 698, 296, 297, 298, 299, 699, 300, 444, 301,
995 585, 655, 656, 657, 658, 302, 303, 701, 304, 305,
996 306, 702, 307, 308, 451, 663, 664, 309, 310, 311,
997 312, 313, 314, 315, 571, 572, 573, 574, 215, 216,
998 217, 218, 489, 219, 470, 471, 472, 220, 221, 222,
999 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
1000 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
1001 243, 244, 393, 490, 715
1004 static const short yypact[] = { 507,
1005 -32768,-32768, 15, -30, 18, 244,-32768,-32768, 414, 443,
1006 556,-32768,-32768,-32768,-32768, 714,-32768,-32768,-32768,-32768,
1007 23,-32768,-32768,-32768, 359,-32768, 340,-32768, 49, 601,
1008 -32768,-32768, 585, 603,-32768, -30, 417,-32768,-32768, 92,
1009 -32768, 489, -24, 107,-32768, 529, 295,-32768,-32768, -30,
1010 710, 452,-32768, 344,-32768, 40,-32768,-32768,-32768,-32768,
1011 192, 1047,-32768, 530, -24,-32768,-32768, 388, 534,-32768,
1012 -32768, -24, 107,-32768, 295,-32768,-32768,-32768, 540,-32768,
1013 -32768,-32768, 548, 258,-32768,-32768, 307, 442, 736,-32768,
1014 -32768, 77,-32768, 1638,-32768,-32768,-32768,-32768,-32768,-32768,
1015 -32768,-32768,-32768, 312, 406,-32768, -24,-32768,-32768, 379,
1016 -18,-32768, 426, 331,-32768, 693, -18, 120, 210, 429,
1017 -32768, 564, 587,-32768,-32768,-32768,-32768, 593, 951,-32768,
1018 -32768, 406, 607, 617, 214,-32768,-32768,-32768, 618, 1077,
1019 219, 531,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -18,
1020 -32768, 361, -18,-32768,-32768, 460, 471,-32768, 494, 736,
1021 -32768, 1204,-32768,-32768, 500,-32768, 180,-32768, 535,-32768,
1022 -32768, 591,-32768,-32768, 1759,-32768,-32768,-32768, 620, 728,
1023 377,-32768,-32768,-32768, 613,-32768,-32768,-32768, 157,-32768,
1024 -32768, 2663, 2728, 2779, 2844, 655, 32, 707,-32768, 2895,
1025 2960, 3011, 5025,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1026 673, 881, 56,-32768, 678, 746,-32768, 640,-32768, 671,
1027 -32768, 715, 866,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1028 899, 921, 1006, 838, 920, 654, 814, 820, 847, 263,
1029 -32768,-32768,-32768, 850,-32768,-32768,-32768,-32768,-32768,-32768,
1030 -32768,-32768, 963, 591,-32768,-32768,-32768,-32768, 484, 769,
1031 775,-32768, -1, 306, 353, 3076,-32768, 232, 1357, 35,
1032 392, 419, 228, 424, 234, 779, 5324,-32768, -30, 538,
1033 974, 265, 872,-32768, 784,-32768, 1691,-32768,-32768, 789,
1034 -32768,-32768,-32768, 1827,-32768,-32768, 797,-32768,-32768,-32768,
1035 -32768, 1827,-32768, 1827,-32768,-32768, 5375, 802,-32768,-32768,
1036 -32768,-32768,-32768, 427,-32768, 737, 806, 866, 902, 916,
1037 -32768,-32768,-32768,-32768, 891, 642,-32768, 592, 660,-32768,
1038 189,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1039 409,-32768, 666, 964, 793, 793, 428,-32768,-32768,-32768,
1040 -32768,-32768, 777, 1121, 66,-32768,-32768, 622, 432, 5092,
1041 3127, 729,-32768, -28, 3192,-32768, 435,-32768,-32768, 3243,
1042 3308, 3359, 3424, 3475, 3540, 3591, 3656, 3707, 3772, 3823,
1043 3888, 864, 3939, 4004, 4055, 4120, 4171, 4236, 4287, 2032,
1044 -32768,-32768, 4352,-32768, 605,-32768,-32768,-32768, 810,-32768,
1045 -32768,-32768, 1691,-32768,-32768,-32768,-32768, 4403,-32768, 95,
1046 -32768,-32768, 126,-32768,-32768, 174,-32768, 4468,-32768, 4519,
1047 -32768, 785,-32768, 4933,-32768,-32768, 182, 269, 815, 2083,
1048 604,-32768,-32768, -30, 2148,-32768,-32768,-32768,-32768,-32768,
1049 1158,-32768,-32768, 823,-32768, 861, 1018, 728,-32768,-32768,
1050 -32768, 86, 2199,-32768, 4584,-32768, 891,-32768,-32768,-32768,
1051 -32768,-32768,-32768, 565, 836,-32768,-32768,-32768, 2264, 793,
1052 -32768, 590, 793, 590,-32768, 2315, 4635, 223, -43, 2380,
1053 191,-32768, 894,-32768, 1967,-32768,-32768,-32768, 649,-32768,
1054 -32768, 237,-32768,-32768,-32768,-32768,-32768, 839,-32768, 239,
1055 -32768, 5143,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 899,
1056 -32768, 899,-32768, 921,-32768, 921,-32768, 921,-32768, 1006,
1057 -32768, 1006,-32768, 1006,-32768, 1006,-32768, 258,-32768,-32768,
1058 838,-32768, 838,-32768, 920,-32768, 654,-32768, 814,-32768,
1059 820,-32768, 847,-32768, 933, 857,-32768,-32768,-32768,-32768,
1060 1254,-32768, 1691, 859, 856, 1691,-32768, 314,-32768,-32768,
1061 -32768,-32768,-32768,-32768,-32768, 348,-32768, 870, 461, 229,
1062 785,-32768, 535,-32768,-32768,-32768,-32768,-32768, 467, 815,
1063 -32768, 967, 14, 444,-32768, 878,-32768, 5067,-32768, 4958,
1064 876, 887, 892,-32768,-32768, 5208,-32768,-32768, 241,-32768,
1065 895, 299,-32768, 895,-32768,-32768, 406, 17,-32768,-32768,
1066 -32768, 4700, 487,-32768,-32768,-32768,-32768,-32768, 4751,-32768,
1067 -32768, 5259,-32768,-32768, 406, 704,-32768, 4816, 662,-32768,
1068 1691, 2431,-32768,-32768,-32768, 1893,-32768,-32768, 343,-32768,
1069 835,-32768,-32768,-32768,-32768,-32768,-32768, 2496,-32768,-32768,
1070 999, 91, 4867,-32768, 674,-32768, 1467,-32768, 5324,-32768,
1071 -32768,-32768, 928, 923, 5000,-32768, 410,-32768, 723,-32768,
1072 -32768,-32768,-32768,-32768,-32768, 406,-32768,-32768,-32768,-32768,
1073 -32768,-32768,-32768, 731,-32768, 406,-32768,-32768, 477,-32768,
1074 243, 108, 485,-32768, 978, 979, 1893,-32768,-32768, 1893,
1075 -32768,-32768, 942,-32768, 948, 950,-32768, 1053, 128,-32768,
1076 -32768,-32768,-32768,-32768, 328,-32768,-32768, 1540,-32768, 1608,
1077 -32768, 961, 1827,-32768, 970,-32768,-32768,-32768,-32768,-32768,
1078 -32768, 2547,-32768, 262, 4403, 1827,-32768,-32768, 2612,-32768,
1079 -32768,-32768,-32768, 1071,-32768,-32768,-32768, 980,-32768, 1827,
1080 296, 202,-32768, 358,-32768, 4958, 983,-32768,-32768,-32768,
1081 -32768, 302, 1893, 990, 5000,-32768, 1021, 1893, 992, 1893,
1082 -32768, 1893,-32768,-32768, 1087, 1089,-32768
1085 static const short yypgoto[] = {-32768,
1086 -32768, -57, -60, 711, -16, -123, 568,-32768, -3, 552,
1087 -32768, 130,-32768, 1085, 791,-32768, 22,-32768,-32768, 778,
1088 12, 154,-32768,-32768, 1044, 1030,-32768, -128,-32768, 945,
1089 -32768, 382, -106, 973, -165, -193,-32768,-32768, 469, -58,
1090 865, -327, -40,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1091 957,-32768, 142,-32768, 718, -10,-32768,-32768,-32768,-32768,
1092 1072, 584,-32768, 1031,-32768,-32768, 372,-32768, -122, 867,
1093 843, -166, -279,-32768, 819, -234, 197, -551,-32768, -529,
1094 -32768,-32768,-32768, -301,-32768,-32768,-32768,-32768,-32768,-32768,
1095 -32768,-32768, 476, 486, -619, -496,-32768,-32768,-32768,-32768,
1096 -32768,-32768,-32768, -436,-32768, -603, 832,-32768,-32768,-32768,
1097 -32768,-32768,-32768,-32768,-32768, 569,-32768, 573,-32768,-32768,
1098 119,-32768, -386,-32768, 799, 362, -326, 858, 163, 1120,
1099 320, 437, 438, -112, 560, 636, -470,-32768, 632, 724,
1100 651, 625, 761, 765, 760, 764, 776,-32768, 526, 771,
1101 717,-32768,-32768, 29,-32768
1108 static const short yytable[] = { 21,
1109 459, 84, 29, 176, 83, 450, 174, 438, 287, 357,
1110 184, 16, 614, 325, 650, 19, 152, 675, 26, 474,
1111 16, 16, 16, 38, 117, 59, 479, 481, 84, 67,
1112 31, 123, 342, 84, 134, 342, 83, 721, 61, 174,
1113 76, 16, 61, 497, 16, 16, 260, 59, 583, 48,
1114 612, 93, 59, 602, 31, 20, 363, 20, 88, 442,
1115 61, 725, 16, 150, 153, 61, 482, 445, 84, 446,
1116 62, 83, 84, 89, 347, 179, 143, 124, 135, 334,
1117 336, 338, 340, 93, 696, 88, 587, 349, 351, 608,
1118 88, 711, 55, 404, 405, 559, 56, 406, 721, 84,
1119 20, 84, 123, 20, 83, 89, 697, 651, 650, 249,
1120 676, 59, 251, 619, 280, 626, 619, 67, 173, 84,
1121 144, 39, 326, 40, 61, 88, 561, -157, 743, 88,
1122 61, 262, 343, 25, 27, 343, 399, 345, 77, 700,
1123 160, 353, 680, 601, 180, 696, 604, 49, 696, 50,
1124 422, 173, 764, 17, -94, -94, 88, 137, 88, 483,
1125 457, 769, 17, 17, 17, 52, 54, 697, 245, 57,
1126 697, 281, 429, 160, 563, 125, 88, 20, 712, 57,
1127 258, 346, 576, 17, -294, 588, 17, 17, 331, 331,
1128 331, 331, 84, 560, 61, 179, 331, 331, 354, 703,
1129 700, 734, 743, 700, 17, 461, 64, 619, 110, 669,
1130 146, 696, 113, 396, 186, 90, 696, 145, 696, 246,
1131 696, 744, 84, 611, 562, 434, 280, 619, 421, 642,
1132 355, 245, 411, 697, 425, 684, 556, 620, 697, 623,
1133 697, 670, 697, 649, 28, 692, 280, 90, -97, 88,
1134 -97, 110, 113, -97, -97, -97, -97, 504, 506, 508,
1135 703, 709, 710, 703, 180, 432, 700, 84, 189, 482,
1136 179, 700, 564, 700, -104, 700, 438, 389, -104, 88,
1137 577, 360, 161, 281, 613, 361, 661, 602, 450, 362,
1138 441, 617, 50, 316, 410, 762, 742, 416, 441, 672,
1139 441, 619, 758, 447, 282, 428, -322, 147, 189, -25,
1140 -25, 187, 67, 706, 635, 161, 247, 20, 448, 20,
1141 598, 528, 157, 157, 88, 61, 703, 580, 745, 20,
1142 412, 703, 426, 703, 621, 703, 624, 317, 671, 180,
1143 45, 733, 280, 704, 74, 752, 69, 367, 637, 390,
1144 -25, 438, 433, 407, 118, -25, -25, -25, 635, 41,
1145 753, -25, 578, 450, 610, -25, 331, 331, 331, 331,
1146 331, 331, 331, 331, 331, 331, 331, 331, 88, 331,
1147 331, 331, 331, 331, 331, 331, 631, 84, 101, 492,
1148 434, -65, 417, 500, 761, -65, 673, 413, -322, 551,
1149 766, 694, 46, 119, 427, 316, 46, 636, 189, 462,
1150 726, 128, 316, -30, 1, 746, 282, 53, 546, 419,
1151 316, 42, 316, 282, 423, 316, 137, 454, 475, 138,
1152 139, 282, 486, 282, -65, 501, 558, -256, -65, -66,
1153 438, 638, -31, 1, 88, 408, 566, 643, 568, 317,
1154 646, 763, 71, -158, 450, 189, 317, 2, 492, 250,
1155 139, 640, 442, 450, 317, 445, 317, 647, 3, 317,
1156 327, 133, 465, 331, 4, 463, 328, 647, 674, 331,
1157 5, 591, -66, 593, 418, 407, 2, 679, 749, 58,
1158 652, 57, 280, 498, 318, 280, 685, 599, 487, 678,
1159 129, 755, 20, 4, 157, 653, -28, 1, 492, 5,
1160 165, 420, 7, 245, 42, 760, 424, -97, 133, 455,
1161 476, 316, -97, -97, -97, -97, 148, 502, 694, 66,
1162 98, 248, 282, 749, 102, 755, 78, 760, 120, 654,
1163 109, 7, 50, 165, 727, 196, -160, 729, 112, 281,
1164 2, 197, 281, 641, -139, -29, 1, 731, 198, 648,
1165 57, 3, 199, 189, 149, 317, 252, 4, 80, 732,
1166 280, 81, 20, 5, 20, 200, 201, 735, 157, 202,
1167 84, 6, 397, 179, -32, 1, 253, 151, 204, 205,
1168 206, 207, 458, 154, 208, 209, 280, 167, 257, 2,
1169 -34, 1, -33, 1, 493, 7, 318, 177, 331, 331,
1170 3, 319, 320, 318, 20, 20, 4, 183, 188, 20,
1171 324, 318, 5, 318, 331, 20, 318, 281, 2, 157,
1172 167, 99, 441, 20, 118, 2, 103, 88, 359, 3,
1173 366, 78, 456, 134, 2, 4, 2, 682, 100, 20,
1174 2, 5, 180, 281, 7, 106, 78, 280, 594, 280,
1175 460, 4, 493, 4, 385, 595, 464, 5, 579, 5,
1176 494, 316, 20, 80, 316, 495, 81, 20, 20, 496,
1177 159, 714, 282, 7, 203, 282, 602, 722, 80, 20,
1178 131, 81, 20, 441, 630, 155, 441, 634, 549, 7,
1179 178, 7, 20, 20, 328, 20, 316, 344, 316, -35,
1180 1, 159, 329, 159, 281, 317, 281, 484, 317, 441,
1181 652, 485, 318, 319, 320, 20, 689, 20, 494, 493,
1182 319, 320, 441, 495, 321, 653, 121, 496, 319, 320,
1183 319, 320, 618, 319, 320, 20, 441, 20, 619, 316,
1184 317, 20, 317, 2, 316, 341, 78, 35, 57, 441,
1185 282, -497, -497, 754, 441, 282, 441, 757, 441, 716,
1186 4, 35, 690, 359, 36, 316, 5, 78, 364, 35,
1187 37, -341, -341, 316, 140, 78, 282, 32, 80, 141,
1188 142, 81, 20, 317, 122, 494, 36, 686, 317, 30,
1189 495, 34, 37, 619, 496, -498, -498, 32, 7, 80,
1190 322, 32, 81, 20, 20, 316, 728, 80, 316, 317,
1191 81, 20, 619, 51, 730, 386, 282, 317, 32, 282,
1192 619, 600, 387, -341, 600, 705, 316, -341, 316, 319,
1193 320, 316, 365, 603, 569, 605, 321, 282, 570, 282,
1194 -343, -343, 282, 321, 316, 378, 379, 380, 381, 317,
1195 388, 321, 317, 321, 527, 282, 321, 400, 316, 401,
1196 477, -156, 318, 478, 316, 318, 435, 359, 2, 282,
1197 317, 316, 317, 316, 78, 317, 316, 439, 316, 469,
1198 316, 323, 282, 737, 382, 443, 738, 282, 317, 282,
1199 453, 282, -343, 370, 371, 372, -343, 318, 550, 318,
1200 368, 369, 317, 78, 139, 35, 80, 584, 317, 81,
1201 20, 78, 322, 373, 374, 317, 586, 317, 596, 322,
1202 317, 622, 317, 627, 317, 383, 384, 322, 37, 322,
1203 391, 392, 322, 78, 628, 80, -407, -407, 81, 20,
1204 318, 632, 196, 80, 633, 318, 81, 20, 197, 767,
1205 -408, -408, 321, 639, 771, 198, 773, 649, 774, 199,
1206 659, -496, -496, 360, 665, 80, 318, 361, 81, 20,
1207 666, 362, 200, 201, 318, 667, 202, 141, 142, 319,
1208 320, 602, 319, 320, 156, 204, 205, 206, 207, 710,
1209 78, 208, 209, 323, 510, 512, 2, 531, 533, 79,
1210 323, 4, 78, 375, 376, 377, 318, 5, 323, 318,
1211 323, 723, 588, 323, 319, 320, 319, 320, 520, 522,
1212 524, 526, 80, 736, -207, 81, 20, 318, 322, 318,
1213 739, 740, 318, 741, 80, 157, 158, 81, 20, 332,
1214 332, 332, 332, 742, 748, 318, 394, 332, 332, -15,
1215 466, 467, 468, 750, -496, -496, 360, 319, 320, 318,
1216 430, 758, 319, 320, 431, 318, 770, 191, 759, 192,
1217 193, 765, 318, 768, 318, 772, 776, 318, 777, 318,
1218 2, 318, 529, 319, 320, 33, 78, 75, 514, 516,
1219 518, 319, 320, -15, 108, 79, 256, 4, -496, -496,
1220 360, 190, 321, 5, 430, 321, 254, 395, 362, 323,
1221 554, 194, 195, 73, 127, 449, 78, 403, 80, 437,
1222 717, 81, 20, 319, 320, 196, 319, 320, 452, 644,
1223 718, 197, 82, 645, 473, 535, 539, 321, 198, 321,
1224 537, 541, 199, 688, 319, 320, 319, 320, 80, 319,
1225 320, 81, 20, 548, 543, 200, 201, 0, 0, 202,
1226 0, 203, 319, 320, 0, 0, 0, 0, 204, 205,
1227 206, 207, 0, 0, 208, 209, 319, 320, 322, 0,
1228 321, 322, 319, 320, 0, 321, 0, 0, 0, 319,
1229 320, 319, 320, 0, 319, 320, 319, 320, 319, 320,
1230 0, -496, -496, 360, 0, 0, 321, 480, 0, 0,
1231 0, 362, 0, 322, 321, 322, 0, 332, 332, 332,
1232 332, 332, 332, 332, 332, 332, 332, 332, 332, 0,
1233 332, 332, 332, 332, 332, 332, 332, 156, -496, -496,
1234 360, 0, 0, 78, 361, 0, 321, 0, 431, 321,
1235 0, 0, 79, 0, 4, 0, 322, 0, 0, 323,
1236 5, 322, 323, 0, 0, 0, 0, 321, 0, 321,
1237 0, 0, 321, 0, 0, 80, 0, 0, 81, 20,
1238 0, 0, 322, 0, 0, 321, 0, 0, 157, 255,
1239 322, 0, 0, 0, 323, 0, 323, 0, 0, 321,
1240 0, 333, 333, 333, 333, 321, 0, 0, 0, 333,
1241 333, 0, 321, 0, 321, 0, 0, 321, 0, 321,
1242 0, 321, 322, 0, 332, 322, 0, 0, 0, -15,
1243 332, 0, 0, 0, -496, -496, 360, 323, 0, 0,
1244 430, 0, 323, 322, 629, 322, 0, 414, 322, 192,
1245 193, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1246 0, 322, 0, 323, 0, 0, 0, 0, 0, 0,
1247 0, 323, 0, 0, 0, 322, 0, 0, 0, 0,
1248 0, 322, 0, 0, 0, 0, 0, 0, 322, 0,
1249 322, 194, 195, 322, 0, 322, 78, 322, 0, 0,
1250 0, 0, 0, 323, 0, 196, 323, 0, 0, 0,
1251 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1252 0, 0, 199, 0, 323, 0, 323, 0, 80, 323,
1253 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1254 0, 0, 323, 0, 0, 415, 0, 0, 204, 205,
1255 206, 207, 0, 0, 208, 209, 323, 263, 0, 332,
1256 332, 0, 323, 0, 0, 0, 0, 0, 0, 323,
1257 0, 323, 0, 0, 323, 332, 323, 0, 323, 333,
1258 333, 333, 333, 333, 333, 333, 333, 333, 333, 333,
1259 333, 0, 333, 333, 333, 333, 333, 333, 333, 0,
1260 264, 194, 195, 652, 265, 266, 78, 267, 0, 0,
1261 268, 0, 0, 0, 269, 196, 0, 0, 653, 0,
1262 0, 270, 271, 5, 272, 0, 273, 274, 198, 275,
1263 263, 0, 276, 0, 0, 0, 0, 0, 80, 0,
1264 0, 81, 20, 0, 0, 0, 0, 0, 0, 277,
1265 0, 157, 719, 0, 0, 278, 0, 0, 204, 205,
1266 206, 207, 0, 0, 208, 209, 0, 0, 0, 0,
1267 0, 0, 0, 264, 194, 195, 652, 265, 266, 78,
1268 267, 0, 0, 268, 0, 0, 333, 269, 196, 0,
1269 0, 653, 333, 0, 270, 271, 5, 272, 263, 273,
1270 274, 198, 275, 0, 0, 276, 0, 0, 0, 0,
1271 0, 80, 0, 0, 81, 20, 0, 0, 0, 0,
1272 0, 0, 277, 0, 157, 747, 0, 0, 278, 0,
1273 0, 204, 205, 206, 207, 0, 0, 208, 209, 0,
1274 0, 264, 194, 195, -266, 265, 266, 78, 267, 0,
1275 0, 268, 0, 0, 0, 269, 196, 0, 0, -266,
1276 0, 0, 270, 271, 5, 272, 0, 273, 274, 198,
1277 275, 2, 0, 276, 0, 0, 0, 78, 0, 80,
1278 0, 263, 81, 20, 0, 0, 79, 0, 4, 0,
1279 277, 0, 157, -266, 5, 0, 278, 0, 0, 204,
1280 205, 206, 207, 0, 0, 208, 209, 0, 0, 80,
1281 0, 0, 81, 20, 0, 0, 0, 0, 0, 0,
1282 0, 333, 333, 126, 264, 194, 195, 0, 265, 266,
1283 78, 267, 0, 0, 268, 0, 0, 333, 269, 196,
1284 0, 0, 0, 0, 0, 270, 271, 5, 272, 263,
1285 273, 274, 198, 275, 0, 0, 276, 0, 0, 0,
1286 0, 0, 80, 0, 0, 81, 20, 0, 0, 0,
1287 0, 0, 0, 277, 0, 157, 436, 0, 0, 278,
1288 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1289 0, 0, 264, 194, 195, 0, 265, 266, 78, 267,
1290 0, 0, 268, 0, 0, 0, 269, 196, 0, 0,
1291 0, 0, 0, 270, 271, 5, 272, 263, 273, 274,
1292 198, 275, 0, 0, 276, 0, 0, 0, 0, 0,
1293 80, 0, 0, 81, 20, 0, 0, 0, 0, 0,
1294 0, 277, 0, 157, 0, 0, 0, 278, 0, 0,
1295 204, 205, 206, 207, 0, 0, 208, 209, 0, 0,
1296 440, 194, 195, 0, 265, 266, 78, 267, 0, 0,
1297 268, 0, 0, 0, 269, 196, 0, 0, 0, 0,
1298 0, 270, 271, 263, 272, 0, 273, 274, 198, 275,
1299 0, 0, 276, 0, 0, 0, 0, 0, 80, 0,
1300 0, 81, 20, 0, 0, 0, 0, 0, 0, 277,
1301 0, 157, 0, 0, 0, 278, 0, 0, 204, 205,
1302 206, 207, 0, 0, 208, 209, 440, 194, 195, 0,
1303 693, 266, 78, 267, 0, 0, 268, 0, 0, 0,
1304 269, 196, 0, 0, 0, 0, 0, 270, 271, 0,
1305 272, 0, 273, 274, 198, 275, 0, 615, 276, 192,
1306 193, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1307 0, 0, 0, 0, 0, 277, 0, 157, 0, 0,
1308 0, 278, 0, 0, 204, 205, 206, 207, 0, 0,
1309 208, 209, 0, 0, 0, 0, 0, 0, 0, 0,
1310 0, 194, 195, 0, 0, 0, 78, 0, 0, 0,
1311 0, 0, 0, 0, 0, 196, 0, 0, 0, 0,
1312 0, 197, 544, 0, 192, 193, 0, 0, 198, 0,
1313 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1314 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1315 0, 203, 616, 0, 0, 0, 0, 0, 204, 205,
1316 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1317 0, 78, 0, 491, 0, 192, 193, 0, 0, 0,
1318 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1319 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1320 0, 0, 0, 80, 0, 0, 81, 20, 0, 545,
1321 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1322 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1323 209, 196, 0, 0, 0, 0, 0, 197, 581, 0,
1324 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1325 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1326 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1327 148, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1328 208, 209, 194, 195, 0, 0, 0, 78, 0, 589,
1329 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1330 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1331 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1332 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1333 202, 582, 0, 194, 195, 0, 0, 0, 78, 204,
1334 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1335 0, 0, 0, 197, 597, 0, 192, 193, 0, 0,
1336 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1337 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1338 0, 202, 0, 0, 0, 0, 0, 590, 0, 0,
1339 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1340 0, 0, 0, 78, 0, 606, 0, 192, 193, 0,
1341 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1342 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1343 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1344 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1345 195, 598, 0, 0, 78, 204, 205, 206, 207, 0,
1346 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1347 491, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1348 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1349 20, 0, 0, 200, 201, 0, 0, 202, 607, 0,
1350 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1351 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1352 0, 581, 0, 192, 193, 0, 0, 0, 196, 0,
1353 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1354 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1355 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1356 0, 0, 202, 0, 0, 194, 195, 598, 0, 0,
1357 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1358 0, 0, 0, 0, 0, 197, 707, 0, 192, 193,
1359 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1360 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1361 201, 0, 0, 202, 691, 0, 0, 0, 0, 0,
1362 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1363 194, 195, 0, 0, 0, 78, 0, 707, 0, 192,
1364 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1365 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1366 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1367 81, 20, 0, 0, 200, 201, 0, 0, 202, 708,
1368 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1369 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1370 0, 197, 589, 0, 192, 193, 0, 0, 198, 0,
1371 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1372 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1373 751, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1374 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1375 0, 78, 0, 330, 0, 192, 193, 0, 0, 0,
1376 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1377 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1378 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1379 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1380 756, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1381 209, 196, 0, 0, 0, 0, 0, 197, 335, 0,
1382 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1383 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1384 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1385 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1386 208, 209, 194, 195, 0, 0, 0, 78, 0, 337,
1387 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1388 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1389 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1390 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1391 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1392 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1393 0, 0, 0, 197, 339, 0, 192, 193, 0, 0,
1394 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1395 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1396 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1397 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1398 0, 0, 0, 78, 0, 348, 0, 192, 193, 0,
1399 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1400 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1401 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1402 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1403 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1404 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1405 350, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1406 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1407 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1408 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1409 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1410 0, 352, 0, 192, 193, 0, 0, 0, 196, 0,
1411 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1412 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1413 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1414 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1415 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1416 0, 0, 0, 0, 0, 197, 409, 0, 192, 193,
1417 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1418 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1419 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1420 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1421 194, 195, 0, 0, 0, 78, 0, 491, 0, 192,
1422 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1423 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1424 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1425 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1426 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1427 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1428 0, 197, 499, 0, 192, 193, 0, 0, 198, 0,
1429 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1430 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1431 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1432 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1433 0, 78, 0, 503, 0, 192, 193, 0, 0, 0,
1434 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1435 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1436 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1437 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1438 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1439 209, 196, 0, 0, 0, 0, 0, 197, 505, 0,
1440 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1441 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1442 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1443 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1444 208, 209, 194, 195, 0, 0, 0, 78, 0, 507,
1445 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1446 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1447 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1448 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1449 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1450 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1451 0, 0, 0, 197, 509, 0, 192, 193, 0, 0,
1452 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1453 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1454 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1455 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1456 0, 0, 0, 78, 0, 511, 0, 192, 193, 0,
1457 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1458 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1459 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1460 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1461 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1462 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1463 513, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1464 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1465 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1466 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1467 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1468 0, 515, 0, 192, 193, 0, 0, 0, 196, 0,
1469 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1470 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1471 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1472 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1473 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1474 0, 0, 0, 0, 0, 197, 517, 0, 192, 193,
1475 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1476 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1477 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1478 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1479 194, 195, 0, 0, 0, 78, 0, 519, 0, 192,
1480 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1481 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1482 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1483 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1484 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1485 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1486 0, 197, 521, 0, 192, 193, 0, 0, 198, 0,
1487 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1488 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1489 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1490 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1491 0, 78, 0, 523, 0, 192, 193, 0, 0, 0,
1492 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1493 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1494 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1495 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1496 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1497 209, 196, 0, 0, 0, 0, 0, 197, 525, 0,
1498 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1499 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1500 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1501 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1502 208, 209, 194, 195, 0, 0, 0, 78, 0, 530,
1503 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1504 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1505 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1506 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1507 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1508 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1509 0, 0, 0, 197, 532, 0, 192, 193, 0, 0,
1510 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1511 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1512 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1513 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1514 0, 0, 0, 78, 0, 534, 0, 192, 193, 0,
1515 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1516 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1517 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1518 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1519 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1520 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1521 536, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1522 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1523 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1524 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1525 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1526 0, 538, 0, 192, 193, 0, 0, 0, 196, 0,
1527 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1528 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1529 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1530 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1531 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1532 0, 0, 0, 0, 0, 197, 540, 0, 192, 193,
1533 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1534 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1535 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1536 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1537 194, 195, 0, 0, 0, 78, 0, 542, 0, 192,
1538 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1539 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1540 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1541 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1542 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1543 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1544 0, 197, 547, 0, 192, 193, 0, 0, 198, 0,
1545 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1546 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1547 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1548 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1549 0, 78, 0, 557, 0, 192, 193, 0, 0, 0,
1550 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1551 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1552 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1553 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1554 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1555 209, 196, 0, 0, 0, 0, 0, 197, 565, 0,
1556 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1557 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1558 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1559 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1560 208, 209, 194, 195, 0, 0, 0, 78, 0, 567,
1561 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1562 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1563 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1564 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1565 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1566 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1567 0, 0, 0, 197, 592, 0, 192, 193, 0, 0,
1568 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1569 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1570 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1571 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1572 0, 0, 0, 78, 0, 609, 0, 192, 193, 0,
1573 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1574 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1575 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1576 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1577 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1578 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1579 677, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1580 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1581 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1582 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1583 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1584 0, 681, 0, 192, 193, 0, 0, 0, 196, 0,
1585 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1586 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1587 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1588 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1589 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1590 0, 0, 0, 0, 0, 197, 687, 0, 192, 193,
1591 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1592 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1593 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1594 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1595 194, 195, 0, 0, 0, 78, 0, 713, 0, 192,
1596 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1597 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1598 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1599 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1600 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1601 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1602 0, 197, 0, 575, 0, 0, 0, 0, 198, 0,
1603 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1604 0, 81, 20, 0, 0, 200, 201, 0, 662, 202,
1605 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1606 206, 207, 0, 0, 208, 209, -289, -289, -289, 0,
1607 0, 0, -289, 0, 0, 0, 0, 0, 0, 0,
1608 0, -289, 0, 0, 0, 0, 0, -289, 0, 0,
1609 724, 0, 194, 195, -289, 0, 0, 78, -289, 0,
1610 0, 0, 0, 0, -289, 0, 196, -289, -289, 0,
1611 0, 0, 197, 0, 0, -289, 0, 192, 193, 198,
1612 0, -289, 0, 199, -289, -289, -289, -289, 0, 80,
1613 -289, -289, 81, 20, 194, 195, 0, 0, 0, 78,
1614 277, -297, 0, 0, 0, 0, 0, 0, 196, 204,
1615 205, 206, 207, 0, 197, 208, 209, 660, 0, 194,
1616 195, 198, 0, 0, 78, 199, 0, 0, 0, 0,
1617 0, 80, 0, 196, 81, 20, 0, 0, 0, 197,
1618 0, 0, 277, -297, 192, 193, 198, 0, 0, 0,
1619 199, 204, 205, 206, 207, 0, 80, 208, 209, 81,
1620 20, 194, 195, 200, 201, 0, 78, 202, 0, 203,
1621 356, 0, 0, 0, 0, 196, 204, 205, 206, 207,
1622 0, 197, 208, 209, 0, 0, 194, 195, 198, 0,
1623 0, 78, 199, 0, 0, 192, 193, 0, 80, 0,
1624 196, 81, 20, 0, 0, 0, 197, 0, 0, 277,
1625 0, 0, 0, 198, 0, 0, 0, 199, 204, 205,
1626 206, 207, 0, 80, 208, 209, 81, 20, 0, 0,
1627 200, 201, 0, 0, 202, 488, 0, 194, 195, 0,
1628 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1629 209, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1630 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1631 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1632 0, 200, 201, 0, 0, 202, 625, 0, 0, 0,
1633 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1634 208, 209, 194, 195, 0, 0, 0, 78, 0, 0,
1635 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1636 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1637 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1638 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1639 202, 668, 0, 194, 195, 0, 0, 0, 78, 204,
1640 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1641 0, 0, 0, 197, 0, 0, 192, 193, 0, 0,
1642 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1643 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1644 0, 202, 683, 0, 0, 0, 0, 0, 0, 0,
1645 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1646 0, 0, 0, 78, 0, 0, 0, 0, 0, 0,
1647 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1648 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1649 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1650 0, 0, 200, 201, 0, 0, 202, 0, 2, 194,
1651 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1652 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1653 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1654 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1655 20, 0, 0, 0, 0, 0, 0, 277, 0, 0,
1656 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1660 static const short yycheck[] = { 3,
1661 328, 62, 6, 132, 62, 307, 129, 287, 175, 203,
1662 134, 0, 483, 179, 1, 1, 123, 1, 1, 346,
1663 9, 10, 11, 1, 83, 42, 353, 354, 89, 46,
1664 9, 89, 1, 94, 53, 1, 94, 657, 42, 162,
1665 1, 30, 46, 72, 33, 34, 169, 64, 435, 1,
1666 94, 62, 69, 97, 33, 86, 1, 86, 62, 294,
1667 64, 665, 51, 122, 123, 69, 1, 302, 129, 304,
1668 95, 129, 133, 62, 198, 133, 117, 1, 97, 192,
1669 193, 194, 195, 94, 636, 89, 1, 200, 201, 476,
1670 94, 1, 1, 95, 96, 1, 5, 99, 718, 160,
1671 86, 162, 160, 86, 162, 94, 636, 94, 1, 150,
1672 94, 128, 153, 100, 175, 502, 100, 134, 129, 180,
1673 1, 99, 180, 101, 128, 129, 1, 93, 1, 133,
1674 134, 172, 101, 4, 5, 101, 259, 198, 99, 636,
1675 129, 202, 613, 470, 133, 697, 473, 99, 700, 101,
1676 273, 162, 756, 0, 99, 100, 160, 1, 162, 94,
1677 326, 765, 9, 10, 11, 36, 37, 697, 140, 40,
1678 700, 175, 279, 162, 1, 99, 180, 86, 88, 50,
1679 1, 198, 1, 30, 99, 100, 33, 34, 192, 193,
1680 194, 195, 253, 99, 198, 253, 200, 201, 202, 636,
1681 697, 94, 1, 700, 51, 329, 100, 100, 79, 596,
1682 1, 763, 83, 254, 1, 62, 768, 98, 770, 1,
1683 772, 94, 283, 1, 99, 283, 287, 100, 1, 1,
1684 202, 203, 1, 763, 1, 622, 403, 1, 768, 1,
1685 770, 1, 772, 1, 1, 632, 307, 94, 92, 253,
1686 94, 122, 123, 97, 98, 99, 100, 370, 371, 372,
1687 697, 648, 1, 700, 253, 1, 763, 328, 139, 1,
1688 328, 768, 99, 770, 95, 772, 556, 15, 99, 283,
1689 99, 93, 129, 287, 94, 97, 588, 97, 590, 101,
1690 294, 485, 101, 175, 266, 94, 1, 269, 302, 1,
1691 304, 100, 1, 307, 175, 277, 1, 98, 179, 45,
1692 46, 98, 329, 641, 1, 162, 98, 86, 307, 86,
1693 98, 382, 95, 95, 328, 329, 763, 434, 1, 86,
1694 99, 768, 99, 770, 98, 772, 98, 175, 98, 328,
1695 1, 99, 403, 1, 1, 732, 52, 218, 1, 87,
1696 86, 631, 88, 1, 97, 91, 92, 93, 1, 1,
1697 99, 97, 94, 665, 477, 101, 370, 371, 372, 373,
1698 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
1699 384, 385, 386, 387, 388, 389, 553, 448, 1, 361,
1700 448, 52, 1, 365, 99, 52, 98, 268, 93, 403,
1701 99, 636, 63, 97, 275, 287, 63, 94, 279, 1,
1702 1, 100, 294, 0, 1, 88, 287, 1, 390, 1,
1703 302, 63, 304, 294, 1, 307, 1, 1, 1, 99,
1704 100, 302, 1, 304, 95, 1, 408, 95, 95, 52,
1705 720, 94, 0, 1, 448, 93, 418, 570, 420, 287,
1706 573, 94, 1, 95, 756, 326, 294, 44, 430, 99,
1707 100, 1, 697, 765, 302, 700, 304, 1, 55, 307,
1708 94, 93, 343, 477, 61, 67, 100, 1, 607, 483,
1709 67, 453, 95, 455, 93, 1, 44, 1, 723, 1,
1710 47, 362, 553, 364, 175, 556, 625, 469, 67, 612,
1711 95, 736, 86, 61, 95, 62, 0, 1, 480, 67,
1712 129, 93, 99, 485, 63, 750, 93, 92, 93, 93,
1713 93, 403, 97, 98, 99, 100, 98, 93, 763, 1,
1714 1, 1, 403, 768, 1, 770, 50, 772, 97, 96,
1715 1, 99, 101, 162, 667, 59, 95, 676, 1, 553,
1716 44, 65, 556, 93, 95, 0, 1, 686, 72, 93,
1717 431, 55, 76, 434, 1, 403, 96, 61, 82, 93,
1718 631, 85, 86, 67, 86, 89, 90, 93, 95, 93,
1719 641, 75, 99, 641, 0, 1, 93, 1, 102, 103,
1720 104, 105, 1, 1, 108, 109, 657, 129, 99, 44,
1721 0, 1, 0, 1, 1, 99, 287, 1, 612, 613,
1722 55, 175, 175, 294, 86, 86, 61, 1, 1, 86,
1723 1, 302, 67, 304, 628, 86, 307, 631, 44, 95,
1724 162, 64, 636, 86, 97, 44, 69, 641, 101, 55,
1725 1, 50, 1, 53, 44, 61, 44, 619, 65, 86,
1726 44, 67, 641, 657, 99, 72, 50, 718, 94, 720,
1727 1, 61, 1, 61, 11, 101, 1, 67, 65, 67,
1728 67, 553, 86, 82, 556, 72, 85, 86, 86, 76,
1729 129, 653, 553, 99, 95, 556, 97, 659, 82, 86,
1730 107, 85, 86, 697, 553, 128, 700, 556, 94, 99,
1731 94, 99, 86, 86, 100, 86, 588, 1, 590, 0,
1732 1, 160, 100, 162, 718, 553, 720, 96, 556, 723,
1733 47, 100, 403, 287, 287, 86, 65, 86, 67, 1,
1734 294, 294, 736, 72, 175, 62, 1, 76, 302, 302,
1735 304, 304, 94, 307, 307, 86, 750, 86, 100, 631,
1736 588, 86, 590, 44, 636, 101, 50, 44, 629, 763,
1737 631, 91, 92, 735, 768, 636, 770, 739, 772, 96,
1738 61, 44, 631, 101, 61, 657, 67, 50, 101, 44,
1739 67, 45, 46, 665, 92, 50, 657, 10, 82, 97,
1740 98, 85, 86, 631, 59, 67, 61, 94, 636, 9,
1741 72, 11, 67, 100, 76, 91, 92, 30, 99, 82,
1742 175, 34, 85, 86, 86, 697, 94, 82, 700, 657,
1743 85, 86, 100, 33, 94, 12, 697, 665, 51, 700,
1744 100, 470, 13, 97, 473, 1, 718, 101, 720, 403,
1745 403, 723, 97, 472, 60, 474, 287, 718, 64, 720,
1746 45, 46, 723, 294, 736, 18, 19, 20, 21, 697,
1747 14, 302, 700, 304, 1, 736, 307, 99, 750, 95,
1748 94, 93, 553, 97, 756, 556, 93, 101, 44, 750,
1749 718, 763, 720, 765, 50, 723, 768, 99, 770, 97,
1750 772, 175, 763, 697, 57, 99, 700, 768, 736, 770,
1751 99, 772, 97, 5, 6, 7, 101, 588, 99, 590,
1752 45, 46, 750, 50, 100, 44, 82, 95, 756, 85,
1753 86, 50, 287, 3, 4, 763, 66, 765, 93, 294,
1754 768, 93, 770, 1, 772, 16, 17, 302, 67, 304,
1755 91, 92, 307, 50, 88, 82, 45, 46, 85, 86,
1756 631, 93, 59, 82, 99, 636, 85, 86, 65, 763,
1757 45, 46, 403, 94, 768, 72, 770, 1, 772, 76,
1758 93, 91, 92, 93, 99, 82, 657, 97, 85, 86,
1759 94, 101, 89, 90, 665, 94, 93, 97, 98, 553,
1760 553, 97, 556, 556, 44, 102, 103, 104, 105, 1,
1761 50, 108, 109, 287, 373, 374, 44, 383, 384, 59,
1762 294, 61, 50, 8, 9, 10, 697, 67, 302, 700,
1763 304, 94, 100, 307, 588, 588, 590, 590, 378, 379,
1764 380, 381, 82, 56, 56, 85, 86, 718, 403, 720,
1765 99, 94, 723, 94, 82, 95, 96, 85, 86, 192,
1766 193, 194, 195, 1, 94, 736, 94, 200, 201, 86,
1767 97, 98, 99, 94, 91, 92, 93, 631, 631, 750,
1768 97, 1, 636, 636, 101, 756, 56, 1, 99, 3,
1769 4, 99, 763, 94, 765, 94, 0, 768, 0, 770,
1770 44, 772, 382, 657, 657, 11, 50, 54, 375, 376,
1771 377, 665, 665, 86, 75, 59, 162, 61, 91, 92,
1772 93, 139, 553, 67, 97, 556, 160, 253, 101, 403,
1773 403, 45, 46, 52, 94, 307, 50, 261, 82, 287,
1774 655, 85, 86, 697, 697, 59, 700, 700, 307, 571,
1775 655, 65, 96, 571, 346, 385, 387, 588, 72, 590,
1776 386, 388, 76, 628, 718, 718, 720, 720, 82, 723,
1777 723, 85, 86, 393, 389, 89, 90, -1, -1, 93,
1778 -1, 95, 736, 736, -1, -1, -1, -1, 102, 103,
1779 104, 105, -1, -1, 108, 109, 750, 750, 553, -1,
1780 631, 556, 756, 756, -1, 636, -1, -1, -1, 763,
1781 763, 765, 765, -1, 768, 768, 770, 770, 772, 772,
1782 -1, 91, 92, 93, -1, -1, 657, 97, -1, -1,
1783 -1, 101, -1, 588, 665, 590, -1, 370, 371, 372,
1784 373, 374, 375, 376, 377, 378, 379, 380, 381, -1,
1785 383, 384, 385, 386, 387, 388, 389, 44, 91, 92,
1786 93, -1, -1, 50, 97, -1, 697, -1, 101, 700,
1787 -1, -1, 59, -1, 61, -1, 631, -1, -1, 553,
1788 67, 636, 556, -1, -1, -1, -1, 718, -1, 720,
1789 -1, -1, 723, -1, -1, 82, -1, -1, 85, 86,
1790 -1, -1, 657, -1, -1, 736, -1, -1, 95, 96,
1791 665, -1, -1, -1, 588, -1, 590, -1, -1, 750,
1792 -1, 192, 193, 194, 195, 756, -1, -1, -1, 200,
1793 201, -1, 763, -1, 765, -1, -1, 768, -1, 770,
1794 -1, 772, 697, -1, 477, 700, -1, -1, -1, 86,
1795 483, -1, -1, -1, 91, 92, 93, 631, -1, -1,
1796 97, -1, 636, 718, 101, 720, -1, 1, 723, 3,
1797 4, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1798 -1, 736, -1, 657, -1, -1, -1, -1, -1, -1,
1799 -1, 665, -1, -1, -1, 750, -1, -1, -1, -1,
1800 -1, 756, -1, -1, -1, -1, -1, -1, 763, -1,
1801 765, 45, 46, 768, -1, 770, 50, 772, -1, -1,
1802 -1, -1, -1, 697, -1, 59, 700, -1, -1, -1,
1803 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1804 -1, -1, 76, -1, 718, -1, 720, -1, 82, 723,
1805 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1806 -1, -1, 736, -1, -1, 99, -1, -1, 102, 103,
1807 104, 105, -1, -1, 108, 109, 750, 1, -1, 612,
1808 613, -1, 756, -1, -1, -1, -1, -1, -1, 763,
1809 -1, 765, -1, -1, 768, 628, 770, -1, 772, 370,
1810 371, 372, 373, 374, 375, 376, 377, 378, 379, 380,
1811 381, -1, 383, 384, 385, 386, 387, 388, 389, -1,
1812 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1813 54, -1, -1, -1, 58, 59, -1, -1, 62, -1,
1814 -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
1815 1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1816 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1817 -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
1818 104, 105, -1, -1, 108, 109, -1, -1, -1, -1,
1819 -1, -1, -1, 44, 45, 46, 47, 48, 49, 50,
1820 51, -1, -1, 54, -1, -1, 477, 58, 59, -1,
1821 -1, 62, 483, -1, 65, 66, 67, 68, 1, 70,
1822 71, 72, 73, -1, -1, 76, -1, -1, -1, -1,
1823 -1, 82, -1, -1, 85, 86, -1, -1, -1, -1,
1824 -1, -1, 93, -1, 95, 96, -1, -1, 99, -1,
1825 -1, 102, 103, 104, 105, -1, -1, 108, 109, -1,
1826 -1, 44, 45, 46, 47, 48, 49, 50, 51, -1,
1827 -1, 54, -1, -1, -1, 58, 59, -1, -1, 62,
1828 -1, -1, 65, 66, 67, 68, -1, 70, 71, 72,
1829 73, 44, -1, 76, -1, -1, -1, 50, -1, 82,
1830 -1, 1, 85, 86, -1, -1, 59, -1, 61, -1,
1831 93, -1, 95, 96, 67, -1, 99, -1, -1, 102,
1832 103, 104, 105, -1, -1, 108, 109, -1, -1, 82,
1833 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1834 -1, 612, 613, 96, 44, 45, 46, -1, 48, 49,
1835 50, 51, -1, -1, 54, -1, -1, 628, 58, 59,
1836 -1, -1, -1, -1, -1, 65, 66, 67, 68, 1,
1837 70, 71, 72, 73, -1, -1, 76, -1, -1, -1,
1838 -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
1839 -1, -1, -1, 93, -1, 95, 96, -1, -1, 99,
1840 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1841 -1, -1, 44, 45, 46, -1, 48, 49, 50, 51,
1842 -1, -1, 54, -1, -1, -1, 58, 59, -1, -1,
1843 -1, -1, -1, 65, 66, 67, 68, 1, 70, 71,
1844 72, 73, -1, -1, 76, -1, -1, -1, -1, -1,
1845 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
1846 -1, 93, -1, 95, -1, -1, -1, 99, -1, -1,
1847 102, 103, 104, 105, -1, -1, 108, 109, -1, -1,
1848 44, 45, 46, -1, 48, 49, 50, 51, -1, -1,
1849 54, -1, -1, -1, 58, 59, -1, -1, -1, -1,
1850 -1, 65, 66, 1, 68, -1, 70, 71, 72, 73,
1851 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1852 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1853 -1, 95, -1, -1, -1, 99, -1, -1, 102, 103,
1854 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
1855 48, 49, 50, 51, -1, -1, 54, -1, -1, -1,
1856 58, 59, -1, -1, -1, -1, -1, 65, 66, -1,
1857 68, -1, 70, 71, 72, 73, -1, 1, 76, 3,
1858 4, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1859 -1, -1, -1, -1, -1, 93, -1, 95, -1, -1,
1860 -1, 99, -1, -1, 102, 103, 104, 105, -1, -1,
1861 108, 109, -1, -1, -1, -1, -1, -1, -1, -1,
1862 -1, 45, 46, -1, -1, -1, 50, -1, -1, -1,
1863 -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
1864 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
1865 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1866 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1867 -1, 95, 96, -1, -1, -1, -1, -1, 102, 103,
1868 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
1869 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
1870 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
1871 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1872 -1, -1, -1, 82, -1, -1, 85, 86, -1, 88,
1873 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
1874 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
1875 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
1876 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
1877 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1878 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
1879 98, -1, -1, -1, 102, 103, 104, 105, -1, -1,
1880 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
1881 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
1882 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
1883 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1884 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1885 93, 94, -1, 45, 46, -1, -1, -1, 50, 102,
1886 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
1887 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
1888 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1889 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1890 -1, 93, -1, -1, -1, -1, -1, 99, -1, -1,
1891 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
1892 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
1893 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
1894 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
1895 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1896 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
1897 46, 98, -1, -1, 50, 102, 103, 104, 105, -1,
1898 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
1899 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
1900 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1901 86, -1, -1, 89, 90, -1, -1, 93, 94, -1,
1902 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
1903 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
1904 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
1905 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
1906 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1907 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1908 -1, -1, 93, -1, -1, 45, 46, 98, -1, -1,
1909 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
1910 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
1911 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1912 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1913 90, -1, -1, 93, 94, -1, -1, -1, -1, -1,
1914 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1915 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
1916 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
1917 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1918 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1919 85, 86, -1, -1, 89, 90, -1, -1, 93, 94,
1920 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
1921 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
1922 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
1923 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1924 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1925 94, -1, -1, -1, -1, -1, -1, -1, 102, 103,
1926 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
1927 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
1928 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
1929 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1930 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1931 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
1932 99, -1, 50, 102, 103, 104, 105, -1, -1, 108,
1933 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
1934 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
1935 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1936 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
1937 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
1938 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
1939 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
1940 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
1941 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1942 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1943 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
1944 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
1945 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
1946 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1947 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1948 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
1949 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
1950 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
1951 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
1952 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
1953 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1954 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
1955 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
1956 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
1957 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
1958 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1959 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1960 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
1961 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
1962 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
1963 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
1964 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1965 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1966 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
1967 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
1968 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
1969 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1970 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1971 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
1972 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1973 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
1974 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
1975 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1976 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1977 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1978 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
1979 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
1980 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
1981 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1982 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1983 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
1984 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
1985 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
1986 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
1987 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1988 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1989 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
1990 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
1991 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
1992 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
1993 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1994 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
1995 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
1996 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
1997 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
1998 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
1999 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2000 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2001 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2002 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2003 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2004 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2005 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2006 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2007 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2008 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2009 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2010 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2011 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2012 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2013 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2014 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2015 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2016 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2017 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2018 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2019 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2020 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2021 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2022 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2023 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2024 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2025 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2026 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2027 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2028 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2029 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2030 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2031 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2032 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2033 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2034 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2035 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2036 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2037 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2038 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2039 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2040 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2041 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2042 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2043 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2044 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2045 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2046 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2047 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2048 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2049 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2050 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2051 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2052 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2053 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2054 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2055 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2056 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2057 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2058 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2059 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2060 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2061 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2062 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2063 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2064 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2065 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2066 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2067 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2068 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2069 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2070 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2071 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2072 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2073 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2074 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2075 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2076 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2077 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2078 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2079 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2080 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2081 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2082 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2083 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2084 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2085 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2086 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2087 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2088 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2089 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2090 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2091 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2092 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2093 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2094 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2095 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2096 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2097 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2098 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2099 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2100 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2101 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2102 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2103 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2104 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2105 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2106 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2107 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2108 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2109 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2110 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2111 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2112 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2113 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2114 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2115 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2116 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2117 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2118 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2119 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2120 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2121 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2122 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2123 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2124 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2125 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2126 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2127 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2128 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2129 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2130 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2131 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2132 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2133 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2134 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2135 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2136 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2137 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2138 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2139 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2140 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2141 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2142 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2143 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2144 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2145 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2146 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2147 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2148 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2149 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2150 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2151 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2152 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2153 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2154 -1, 65, -1, 1, -1, -1, -1, -1, 72, -1,
2155 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2156 -1, 85, 86, -1, -1, 89, 90, -1, 1, 93,
2157 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2158 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
2159 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2160 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2161 1, -1, 45, 46, 72, -1, -1, 50, 76, -1,
2162 -1, -1, -1, -1, 82, -1, 59, 85, 86, -1,
2163 -1, -1, 65, -1, -1, 93, -1, 3, 4, 72,
2164 -1, 99, -1, 76, 102, 103, 104, 105, -1, 82,
2165 108, 109, 85, 86, 45, 46, -1, -1, -1, 50,
2166 93, 94, -1, -1, -1, -1, -1, -1, 59, 102,
2167 103, 104, 105, -1, 65, 108, 109, 1, -1, 45,
2168 46, 72, -1, -1, 50, 76, -1, -1, -1, -1,
2169 -1, 82, -1, 59, 85, 86, -1, -1, -1, 65,
2170 -1, -1, 93, 94, 3, 4, 72, -1, -1, -1,
2171 76, 102, 103, 104, 105, -1, 82, 108, 109, 85,
2172 86, 45, 46, 89, 90, -1, 50, 93, -1, 95,
2173 96, -1, -1, -1, -1, 59, 102, 103, 104, 105,
2174 -1, 65, 108, 109, -1, -1, 45, 46, 72, -1,
2175 -1, 50, 76, -1, -1, 3, 4, -1, 82, -1,
2176 59, 85, 86, -1, -1, -1, 65, -1, -1, 93,
2177 -1, -1, -1, 72, -1, -1, -1, 76, 102, 103,
2178 104, 105, -1, 82, 108, 109, 85, 86, -1, -1,
2179 89, 90, -1, -1, 93, 94, -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, 94, -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, 94, -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, 94, -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, -1, -1, -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, 44, 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, -1, -1, -1, -1, 72, -1, -1, -1,
2206 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2207 86, -1, -1, -1, -1, -1, -1, 93, -1, -1,
2208 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2213 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2214 #line 3 "/usr/lib/bison.simple"
2216 /* Skeleton output parser for bison,
2217 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2219 This program is free software; you can redistribute it and/or modify
2220 it under the terms of the GNU General Public License as published by
2221 the Free Software Foundation; either version 2, or (at your option)
2224 This program is distributed in the hope that it will be useful,
2225 but WITHOUT ANY WARRANTY; without even the implied warranty of
2226 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2227 GNU General Public License for more details.
2229 You should have received a copy of the GNU General Public License
2230 along with this program; if not, write to the Free Software
2231 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
2233 /* As a special exception, when this file is copied by Bison into a
2234 Bison output file, you may use that output file without restriction.
2235 This special exception was added by the Free Software Foundation
2236 in version 1.24 of Bison. */
2240 #define alloca __builtin_alloca
2241 #else /* not GNU C. */
2242 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
2244 #else /* not sparc */
2245 #if defined (MSDOS) && !defined (__TURBOC__)
2247 #else /* not MSDOS, or __TURBOC__ */
2251 #else /* not MSDOS, __TURBOC__, or _AIX */
2255 void *alloca (unsigned int);
2257 #else /* not __cplusplus */
2259 #endif /* not __cplusplus */
2261 #endif /* not _AIX */
2262 #endif /* not MSDOS, or __TURBOC__ */
2263 #endif /* not sparc. */
2264 #endif /* not GNU C. */
2265 #endif /* alloca not defined. */
2267 /* This is the parser code that is written into each bison parser
2268 when the %semantic_parser declaration is not specified in the grammar.
2269 It was written by Richard Stallman by simplifying the hairy parser
2270 used when %semantic_parser is specified. */
2272 /* Note: there must be only one dollar sign in this file.
2273 It is replaced by the list of actions, each action
2274 as one case of the switch. */
2276 #define yyerrok (yyerrstatus = 0)
2277 #define yyclearin (yychar = YYEMPTY)
2280 #define YYACCEPT return(0)
2281 #define YYABORT return(1)
2282 #define YYERROR goto yyerrlab1
2283 /* Like YYERROR except do call yyerror.
2284 This remains here temporarily to ease the
2285 transition to the new meaning of YYERROR, for GCC.
2286 Once GCC version 2 has supplanted version 1, this can go. */
2287 #define YYFAIL goto yyerrlab
2288 #define YYRECOVERING() (!!yyerrstatus)
2289 #define YYBACKUP(token, value) \
2291 if (yychar == YYEMPTY && yylen == 1) \
2292 { yychar = (token), yylval = (value); \
2293 yychar1 = YYTRANSLATE (yychar); \
2298 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2302 #define YYERRCODE 256
2305 #define YYLEX yylex()
2311 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2313 #define YYLEX yylex(&yylval, &yylloc)
2315 #else /* not YYLSP_NEEDED */
2317 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2319 #define YYLEX yylex(&yylval)
2321 #endif /* not YYLSP_NEEDED */
2324 /* If nonreentrant, generate the variables here */
2328 int yychar; /* the lookahead symbol */
2329 YYSTYPE yylval; /* the semantic value of the */
2330 /* lookahead symbol */
2333 YYLTYPE yylloc; /* location data for the lookahead */
2337 int yynerrs; /* number of parse errors so far */
2338 #endif /* not YYPURE */
2341 int yydebug; /* nonzero means print parse trace */
2342 /* Since this is uninitialized, it does not stop multiple parsers
2346 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2349 #define YYINITDEPTH 200
2352 /* YYMAXDEPTH is the maximum size the stacks can grow to
2353 (effective only if the built-in stack extension method is used). */
2360 #define YYMAXDEPTH 10000
2363 /* Prevent warning if -Wstrict-prototypes. */
2368 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2369 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2370 #else /* not GNU C or C++ */
2373 /* This is the most reliable way to avoid incompatibilities
2374 in available built-in functions on various systems. */
2376 __yy_memcpy (to, from, count)
2381 register char *f = from;
2382 register char *t = to;
2383 register int i = count;
2389 #else /* __cplusplus */
2391 /* This is the most reliable way to avoid incompatibilities
2392 in available built-in functions on various systems. */
2394 __yy_memcpy (char *to, char *from, int count)
2396 register char *f = from;
2397 register char *t = to;
2398 register int i = count;
2407 #line 196 "/usr/lib/bison.simple"
2409 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2410 into yyparse. The argument should have type void *.
2411 It should actually point to an object.
2412 Grammar actions can access the variable by casting it
2413 to the proper pointer type. */
2415 #ifdef YYPARSE_PARAM
2417 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2418 #define YYPARSE_PARAM_DECL
2419 #else /* not __cplusplus */
2420 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2421 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2422 #endif /* not __cplusplus */
2423 #else /* not YYPARSE_PARAM */
2424 #define YYPARSE_PARAM_ARG
2425 #define YYPARSE_PARAM_DECL
2426 #endif /* not YYPARSE_PARAM */
2429 yyparse(YYPARSE_PARAM_ARG)
2432 register int yystate;
2434 register short *yyssp;
2435 register YYSTYPE *yyvsp;
2436 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2437 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2439 short yyssa[YYINITDEPTH]; /* the state stack */
2440 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2442 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2443 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2446 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2447 YYLTYPE *yyls = yylsa;
2450 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2452 #define YYPOPSTACK (yyvsp--, yyssp--)
2455 int yystacksize = YYINITDEPTH;
2466 YYSTYPE yyval; /* the variable used to return */
2467 /* semantic values from the action */
2474 fprintf(stderr, "Starting parse\n");
2480 yychar = YYEMPTY; /* Cause a token to be read. */
2482 /* Initialize stack pointers.
2483 Waste one element of value and location stack
2484 so that they stay on the same level as the state stack.
2485 The wasted elements are never initialized. */
2493 /* Push a new state, which is found in yystate . */
2494 /* In all cases, when you get here, the value and location stacks
2495 have just been pushed. so pushing a state here evens the stacks. */
2500 if (yyssp >= yyss + yystacksize - 1)
2502 /* Give user a chance to reallocate the stack */
2503 /* Use copies of these so that the &'s don't force the real ones into memory. */
2504 YYSTYPE *yyvs1 = yyvs;
2505 short *yyss1 = yyss;
2507 YYLTYPE *yyls1 = yyls;
2510 /* Get the current used size of the three stacks, in elements. */
2511 int size = yyssp - yyss + 1;
2514 /* Each stack pointer address is followed by the size of
2515 the data in use in that stack, in bytes. */
2517 /* This used to be a conditional around just the two extra args,
2518 but that might be undefined if yyoverflow is a macro. */
2519 yyoverflow("parser stack overflow",
2520 &yyss1, size * sizeof (*yyssp),
2521 &yyvs1, size * sizeof (*yyvsp),
2522 &yyls1, size * sizeof (*yylsp),
2525 yyoverflow("parser stack overflow",
2526 &yyss1, size * sizeof (*yyssp),
2527 &yyvs1, size * sizeof (*yyvsp),
2531 yyss = yyss1; yyvs = yyvs1;
2535 #else /* no yyoverflow */
2536 /* Extend the stack our own way. */
2537 if (yystacksize >= YYMAXDEPTH)
2539 yyerror("parser stack overflow");
2543 if (yystacksize > YYMAXDEPTH)
2544 yystacksize = YYMAXDEPTH;
2545 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
2546 __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
2547 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
2548 __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
2550 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
2551 __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
2553 #endif /* no yyoverflow */
2555 yyssp = yyss + size - 1;
2556 yyvsp = yyvs + size - 1;
2558 yylsp = yyls + size - 1;
2563 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2566 if (yyssp >= yyss + yystacksize - 1)
2572 fprintf(stderr, "Entering state %d\n", yystate);
2578 /* Do appropriate processing given the current state. */
2579 /* Read a lookahead token if we need one and don't already have one. */
2582 /* First try to decide what to do without reference to lookahead token. */
2584 yyn = yypact[yystate];
2588 /* Not known => get a lookahead token if don't already have one. */
2590 /* yychar is either YYEMPTY or YYEOF
2591 or a valid token in external form. */
2593 if (yychar == YYEMPTY)
2597 fprintf(stderr, "Reading a token: ");
2602 /* Convert token to internal form (in yychar1) for indexing tables with */
2604 if (yychar <= 0) /* This means end of input. */
2607 yychar = YYEOF; /* Don't call YYLEX any more */
2611 fprintf(stderr, "Now at end of input.\n");
2616 yychar1 = YYTRANSLATE(yychar);
2621 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2622 /* Give the individual parser a way to print the precise meaning
2623 of a token, for further debugging info. */
2625 YYPRINT (stderr, yychar, yylval);
2627 fprintf (stderr, ")\n");
2633 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2638 /* yyn is what to do for this token type in this state.
2639 Negative => reduce, -yyn is rule number.
2640 Positive => shift, yyn is new state.
2641 New state is final state => don't bother to shift,
2642 just return success.
2643 0, or most negative number => error. */
2658 /* Shift the lookahead token. */
2662 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2665 /* Discard the token being shifted unless it is eof. */
2666 if (yychar != YYEOF)
2674 /* count tokens shifted since error; after three, turn off error status. */
2675 if (yyerrstatus) yyerrstatus--;
2680 /* Do the default action for the current state. */
2683 yyn = yydefact[yystate];
2687 /* Do a reduction. yyn is the number of a rule to reduce with. */
2691 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2698 fprintf (stderr, "Reducing via rule %d (line %d), ",
2701 /* Print the symbols being reduced, and their result. */
2702 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2703 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2704 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2712 #line 459 "./parse.y"
2716 #line 503 "./parse.y"
2718 yyval.node = build_java_array_type (yyvsp[-2].node, -1);
2719 CLASS_LOADED_P (yyval.node) = 1;
2723 #line 508 "./parse.y"
2724 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2727 #line 510 "./parse.y"
2728 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2731 #line 512 "./parse.y"
2732 {RULE ("']' expected"); RECOVER;;
2735 #line 514 "./parse.y"
2736 {RULE ("']' expected"); RECOVER;;
2739 #line 529 "./parse.y"
2740 { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
2743 #line 538 "./parse.y"
2744 {yyval.node = NULL;;
2747 #line 550 "./parse.y"
2753 #line 554 "./parse.y"
2759 #line 566 "./parse.y"
2760 { ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ;
2763 #line 568 "./parse.y"
2764 {yyerror ("Missing name"); RECOVER;;
2767 #line 570 "./parse.y"
2768 {yyerror ("';' expected"); RECOVER;;
2771 #line 580 "./parse.y"
2773 tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name;
2774 int i = IDENTIFIER_LENGTH (name)-1;
2775 char *last = &IDENTIFIER_POINTER (name)[i];
2776 while (last != IDENTIFIER_POINTER (name))
2778 if (last [0] == '.')
2782 last_name = get_identifier (++last);
2783 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name))
2785 tree err = find_name_in_single_imports (last_name);
2786 if (err && err != name)
2788 (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'",
2789 IDENTIFIER_POINTER (name),
2790 IDENTIFIER_POINTER (err));
2792 REGISTER_IMPORT (yyvsp[-1].node, last_name)
2795 REGISTER_IMPORT (yyvsp[-1].node, last_name);
2799 #line 606 "./parse.y"
2800 {yyerror ("Missing name"); RECOVER;;
2803 #line 608 "./parse.y"
2804 {yyerror ("';' expected"); RECOVER;;
2807 #line 613 "./parse.y"
2809 tree name = EXPR_WFL_NODE (yyvsp[-3].node);
2810 /* Don't import java.lang.* twice. */
2811 if (name != java_lang_id)
2813 tree node = build_tree_list (yyvsp[-3].node, NULL_TREE);
2814 read_import_dir (yyvsp[-3].node);
2815 TREE_CHAIN (node) = ctxp->import_demand_list;
2816 ctxp->import_demand_list = node;
2821 #line 625 "./parse.y"
2822 {yyerror ("'*' expected"); RECOVER;;
2825 #line 627 "./parse.y"
2826 {yyerror ("';' expected"); RECOVER;;
2829 #line 632 "./parse.y"
2831 maybe_generate_finit ();
2832 maybe_generate_clinit ();
2833 yyval.node = yyvsp[0].node;
2837 #line 638 "./parse.y"
2839 maybe_generate_clinit ();
2840 yyval.node = yyvsp[0].node;
2844 #line 643 "./parse.y"
2845 { yyval.node = NULL; ;
2848 #line 645 "./parse.y"
2851 yyerror ("Class or interface declaration expected");
2855 #line 656 "./parse.y"
2857 yyval.value = (1 << yyvsp[0].value);
2861 #line 660 "./parse.y"
2863 int acc = (1 << yyvsp[0].value);
2864 if (yyval.value & acc)
2866 (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice",
2867 java_accstring_lookup (acc));
2875 #line 676 "./parse.y"
2876 { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2879 #line 678 "./parse.y"
2881 yyval.node = yyvsp[0].node;
2885 #line 682 "./parse.y"
2886 { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2889 #line 684 "./parse.y"
2891 yyval.node = yyvsp[0].node;
2895 #line 688 "./parse.y"
2896 {yyerror ("Missing class name"); RECOVER;;
2899 #line 690 "./parse.y"
2900 {yyerror ("Missing class name"); RECOVER;;
2903 #line 692 "./parse.y"
2905 if (!ctxp->class_err) yyerror ("'{' expected");
2910 #line 697 "./parse.y"
2911 {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;;
2914 #line 701 "./parse.y"
2915 { yyval.node = NULL; ;
2918 #line 703 "./parse.y"
2919 { yyval.node = yyvsp[0].node; ;
2922 #line 705 "./parse.y"
2923 {yyerror ("'{' expected"); ctxp->class_err=1;;
2926 #line 707 "./parse.y"
2927 {yyerror ("Missing super class name"); ctxp->class_err=1;;
2930 #line 711 "./parse.y"
2931 { yyval.node = NULL_TREE; ;
2934 #line 713 "./parse.y"
2935 { yyval.node = yyvsp[0].node; ;
2938 #line 715 "./parse.y"
2941 yyerror ("Missing interface name");
2945 #line 723 "./parse.y"
2947 ctxp->interface_number = 1;
2948 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
2952 #line 728 "./parse.y"
2954 ctxp->interface_number++;
2955 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
2959 #line 733 "./parse.y"
2960 {yyerror ("Missing interface name"); RECOVER;;
2963 #line 738 "./parse.y"
2965 /* Store the location of the `}' when doing xrefs */
2967 DECL_END_SOURCE_LINE (ctxp->current_parsed_class) =
2968 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
2969 yyval.node = ctxp->current_parsed_class;
2973 #line 746 "./parse.y"
2975 /* Store the location of the `}' when doing xrefs */
2977 DECL_END_SOURCE_LINE (ctxp->current_parsed_class) =
2978 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
2979 yyval.node = ctxp->current_parsed_class;
2983 #line 765 "./parse.y"
2984 { yyval.node = parse_jdk1_1_error ("instance initializer"); ;
2987 #line 771 "./parse.y"
2988 { yyval.node = yyvsp[-1].node; ;
2991 #line 774 "./parse.y"
2992 { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ;
2995 #line 776 "./parse.y"
2996 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
2999 #line 782 "./parse.y"
3000 { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ;
3003 #line 784 "./parse.y"
3006 ("Illegal modifier `%s' for field declaration",
3007 yyvsp[-3].value, FIELD_MODIFIERS);
3008 check_modifiers_consistency (yyvsp[-3].value);
3009 register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node);
3013 #line 797 "./parse.y"
3014 { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ;
3017 #line 799 "./parse.y"
3018 {yyerror ("Missing term"); RECOVER;;
3021 #line 804 "./parse.y"
3022 { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ;
3025 #line 806 "./parse.y"
3027 if (java_error_count)
3028 yyvsp[0].node = NULL_TREE;
3029 yyval.node = build_tree_list
3030 (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node));
3034 #line 813 "./parse.y"
3036 yyerror ("Missing variable initializer");
3037 yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
3042 #line 819 "./parse.y"
3044 yyerror ("';' expected");
3045 yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
3050 #line 829 "./parse.y"
3051 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
3054 #line 831 "./parse.y"
3055 {yyerror ("Invalid declaration"); DRECOVER(vdi);;
3058 #line 833 "./parse.y"
3059 {yyerror ("']' expected"); DRECOVER(vdi);;
3062 #line 835 "./parse.y"
3063 {yyerror ("Unbalanced ']'"); DRECOVER(vdi);;
3066 #line 846 "./parse.y"
3068 current_function_decl = yyvsp[0].node;
3069 source_start_java_method (current_function_decl);
3073 #line 851 "./parse.y"
3074 { finish_method_declaration (yyvsp[0].node); ;
3077 #line 853 "./parse.y"
3078 {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;
3081 #line 858 "./parse.y"
3082 { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3085 #line 860 "./parse.y"
3086 { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
3089 #line 862 "./parse.y"
3090 { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3093 #line 864 "./parse.y"
3094 { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
3097 #line 866 "./parse.y"
3101 #line 868 "./parse.y"
3105 #line 870 "./parse.y"
3106 {yyerror ("Identifier expected"); RECOVER;;
3109 #line 872 "./parse.y"
3110 {yyerror ("Identifier expected"); RECOVER;;
3113 #line 874 "./parse.y"
3115 yyerror ("Invalid method declaration, return type required");
3120 #line 882 "./parse.y"
3121 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3124 #line 884 "./parse.y"
3125 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3128 #line 886 "./parse.y"
3130 EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location;
3131 TREE_PURPOSE (yyvsp[-2].node) =
3132 build_unresolved_array_type (TREE_PURPOSE (yyvsp[-2].node));
3133 parse_warning_context
3135 "Discouraged form of returned type specification");
3139 #line 895 "./parse.y"
3140 {yyerror ("')' expected"); DRECOVER(method_declarator);;
3143 #line 897 "./parse.y"
3144 {yyerror ("']' expected"); RECOVER;;
3147 #line 902 "./parse.y"
3149 ctxp->formal_parameter_number = 1;
3153 #line 906 "./parse.y"
3155 ctxp->formal_parameter_number += 1;
3156 yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
3160 #line 911 "./parse.y"
3161 {yyerror ("Missing formal parameter term"); RECOVER;;
3164 #line 916 "./parse.y"
3166 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3170 #line 920 "./parse.y"
3172 parse_jdk1_1_error ("final parameters");
3173 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3177 #line 925 "./parse.y"
3178 {yyerror ("Missing identifier"); RECOVER;;
3181 #line 927 "./parse.y"
3183 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value));
3184 yyerror ("Missing identifier"); RECOVER;
3188 #line 934 "./parse.y"
3189 { yyval.node = NULL_TREE; ;
3192 #line 936 "./parse.y"
3193 { yyval.node = yyvsp[0].node; ;
3196 #line 938 "./parse.y"
3197 {yyerror ("Missing class type term"); RECOVER;;
3200 #line 943 "./parse.y"
3201 { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ;
3204 #line 945 "./parse.y"
3205 { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ;
3208 #line 947 "./parse.y"
3209 {yyerror ("Missing class type term"); RECOVER;;
3212 #line 954 "./parse.y"
3213 { yyval.node = NULL_TREE; ;
3216 #line 960 "./parse.y"
3218 TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized;
3219 ctxp->static_initialized = yyvsp[0].node;
3223 #line 965 "./parse.y"
3225 TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized;
3226 ctxp->static_initialized = yyvsp[-1].node;
3230 #line 973 "./parse.y"
3232 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
3236 #line 981 "./parse.y"
3238 current_function_decl = yyvsp[0].node;
3239 source_start_java_method (current_function_decl);
3243 #line 986 "./parse.y"
3244 { finish_method_declaration (yyvsp[0].node); ;
3247 #line 991 "./parse.y"
3248 { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3251 #line 993 "./parse.y"
3252 { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3255 #line 998 "./parse.y"
3256 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3259 #line 1000 "./parse.y"
3260 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3263 #line 1008 "./parse.y"
3265 BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node;
3266 yyval.node = yyvsp[0].node;
3270 #line 1013 "./parse.y"
3271 { yyval.node = yyvsp[0].node; ;
3274 #line 1015 "./parse.y"
3275 { yyval.node = yyvsp[0].node; ;
3278 #line 1017 "./parse.y"
3279 { yyval.node = yyvsp[0].node; ;
3282 #line 1027 "./parse.y"
3284 yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE);
3285 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node);
3286 yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
3290 #line 1033 "./parse.y"
3292 yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node);
3293 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node);
3294 yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
3298 #line 1041 "./parse.y"
3299 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3302 #line 1043 "./parse.y"
3303 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3306 #line 1048 "./parse.y"
3308 tree wfl = build_wfl_node (this_identifier_node);
3309 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3314 #line 1054 "./parse.y"
3316 tree wfl = build_wfl_node (super_identifier_node);
3317 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3322 #line 1065 "./parse.y"
3323 { create_interface (0, yyvsp[0].node, NULL_TREE); ;
3326 #line 1067 "./parse.y"
3328 yyval.node = yyvsp[0].node;
3332 #line 1071 "./parse.y"
3333 { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ;
3336 #line 1073 "./parse.y"
3338 yyval.node = yyvsp[0].node;
3342 #line 1077 "./parse.y"
3343 { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ;
3346 #line 1079 "./parse.y"
3348 yyval.node = yyvsp[0].node;
3352 #line 1083 "./parse.y"
3353 { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ;
3356 #line 1085 "./parse.y"
3358 yyval.node = yyvsp[0].node;
3362 #line 1089 "./parse.y"
3363 {yyerror ("'{' expected"); RECOVER;;
3366 #line 1091 "./parse.y"
3367 {yyerror ("'{' expected"); RECOVER;;
3370 #line 1096 "./parse.y"
3372 ctxp->interface_number = 1;
3373 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3377 #line 1101 "./parse.y"
3379 ctxp->interface_number++;
3380 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3384 #line 1106 "./parse.y"
3385 {yyerror ("Invalid interface type"); RECOVER;;
3388 #line 1108 "./parse.y"
3389 {yyerror ("Missing term"); RECOVER;;
3392 #line 1113 "./parse.y"
3393 { yyval.node = NULL_TREE; ;
3396 #line 1115 "./parse.y"
3397 { yyval.node = NULL_TREE; ;
3400 #line 1127 "./parse.y"
3401 { yyval.node = parse_jdk1_1_error ("inner class declaration"); ;
3404 #line 1129 "./parse.y"
3405 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
3408 #line 1138 "./parse.y"
3410 check_abstract_method_header (yyvsp[-1].node);
3411 current_function_decl = NULL_TREE; /* FIXME ? */
3415 #line 1143 "./parse.y"
3416 {yyerror ("';' expected"); RECOVER;;
3419 #line 1149 "./parse.y"
3420 { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ;
3423 #line 1151 "./parse.y"
3424 { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3427 #line 1153 "./parse.y"
3428 { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ;
3431 #line 1158 "./parse.y"
3433 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node),
3434 yyvsp[0].node, NULL_TREE);
3438 #line 1163 "./parse.y"
3440 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node);
3444 #line 1167 "./parse.y"
3445 {yyerror ("Missing term"); RECOVER;;
3448 #line 1173 "./parse.y"
3450 /* Store the location of the `}' when doing xrefs */
3451 if (current_function_decl && flag_emit_xref)
3452 DECL_END_SOURCE_LINE (current_function_decl) =
3453 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3454 yyval.node = empty_stmt_node;
3458 #line 1181 "./parse.y"
3459 { yyval.node = yyvsp[0].node; ;
3462 #line 1186 "./parse.y"
3466 #line 1191 "./parse.y"
3468 maybe_absorb_scoping_blocks ();
3469 /* Store the location of the `}' when doing xrefs */
3470 if (current_function_decl && flag_emit_xref)
3471 DECL_END_SOURCE_LINE (current_function_decl) =
3472 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3473 yyval.node = exit_block ();
3477 #line 1209 "./parse.y"
3478 { java_method_add_stmt (current_function_decl, yyvsp[0].node); ;
3481 #line 1211 "./parse.y"
3482 { parse_jdk1_1_error ("inner class declaration"); ;
3485 #line 1220 "./parse.y"
3486 { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ;
3489 #line 1222 "./parse.y"
3490 { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ;
3493 #line 1232 "./parse.y"
3494 { yyval.node = exit_block (); ;
3497 #line 1241 "./parse.y"
3498 { yyval.node = exit_block (); ;
3501 #line 1260 "./parse.y"
3502 { yyval.node = empty_stmt_node; ;
3505 #line 1265 "./parse.y"
3507 yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node),
3508 EXPR_WFL_NODE (yyvsp[-1].node));
3510 push_labeled_block (yyval.node);
3511 PUSH_LABELED_BLOCK (yyval.node);
3515 #line 1276 "./parse.y"
3516 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3519 #line 1278 "./parse.y"
3520 {yyerror ("':' expected"); RECOVER;;
3523 #line 1283 "./parse.y"
3524 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3527 #line 1290 "./parse.y"
3529 /* We have a statement. Generate a WFL around it so
3531 yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0);
3532 /* We know we have a statement, so set the debug
3533 info to be eventually generate here. */
3534 yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node);
3538 #line 1299 "./parse.y"
3540 if (ctxp->prevent_ese != lineno)
3541 yyerror ("Invalid expression statement");
3542 DRECOVER (expr_stmt);
3546 #line 1305 "./parse.y"
3548 if (ctxp->prevent_ese != lineno)
3549 yyerror ("Invalid expression statement");
3550 DRECOVER (expr_stmt);
3554 #line 1311 "./parse.y"
3556 if (ctxp->prevent_ese != lineno)
3557 yyerror ("Invalid expression statement");
3558 DRECOVER (expr_stmt);
3562 #line 1317 "./parse.y"
3563 {yyerror ("')' expected"); RECOVER;;
3566 #line 1319 "./parse.y"
3568 yyerror ("Constructor invocation must be first "
3569 "thing in a constructor");
3574 #line 1325 "./parse.y"
3575 {yyerror ("')' expected"); RECOVER;;
3578 #line 1327 "./parse.y"
3580 yyerror ("Constructor invocation must be first "
3581 "thing in a constructor");
3586 #line 1333 "./parse.y"
3587 {yyerror ("'(' expected"); RECOVER;;
3590 #line 1335 "./parse.y"
3591 {yyerror ("')' expected"); RECOVER;;
3594 #line 1337 "./parse.y"
3595 {yyerror ("')' expected"); RECOVER;;
3598 #line 1339 "./parse.y"
3599 {yyerror ("';' expected"); RECOVER;;
3602 #line 1341 "./parse.y"
3603 {yyerror ("';' expected"); RECOVER;;
3606 #line 1356 "./parse.y"
3608 yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node,
3609 yyvsp[0].node, NULL_TREE);
3613 #line 1361 "./parse.y"
3614 {yyerror ("'(' expected"); RECOVER;;
3617 #line 1363 "./parse.y"
3618 {yyerror ("Missing term"); RECOVER;;
3621 #line 1365 "./parse.y"
3622 {yyerror ("')' expected"); RECOVER;;
3625 #line 1370 "./parse.y"
3626 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3629 #line 1375 "./parse.y"
3630 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3633 #line 1380 "./parse.y"
3639 #line 1384 "./parse.y"
3641 /* Make into "proper list" of COMPOUND_EXPRs.
3642 I.e. make the last statment also have its own
3644 maybe_absorb_scoping_blocks ();
3645 TREE_OPERAND (yyvsp[-2].node, 1) = exit_block ();
3646 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-2].node), yyvsp[-2].node);
3650 #line 1396 "./parse.y"
3652 yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE);
3653 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3657 #line 1401 "./parse.y"
3658 {yyerror ("'(' expected"); RECOVER;;
3661 #line 1403 "./parse.y"
3662 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;
3665 #line 1405 "./parse.y"
3666 {yyerror ("'{' expected"); RECOVER;;
3669 #line 1413 "./parse.y"
3670 { yyval.node = NULL_TREE; ;
3673 #line 1415 "./parse.y"
3674 { yyval.node = NULL_TREE; ;
3677 #line 1417 "./parse.y"
3678 { yyval.node = NULL_TREE; ;
3681 #line 1419 "./parse.y"
3682 { yyval.node = NULL_TREE; ;
3685 #line 1438 "./parse.y"
3687 tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node);
3688 EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location;
3689 java_method_add_stmt (current_function_decl, lab);
3693 #line 1444 "./parse.y"
3695 tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
3696 EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location;
3697 java_method_add_stmt (current_function_decl, lab);
3701 #line 1450 "./parse.y"
3702 {yyerror ("Missing or invalid constant expression"); RECOVER;;
3705 #line 1452 "./parse.y"
3706 {yyerror ("':' expected"); RECOVER;;
3709 #line 1454 "./parse.y"
3710 {yyerror ("':' expected"); RECOVER;;
3713 #line 1459 "./parse.y"
3715 tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
3716 yyval.node = build_new_loop (body);
3720 #line 1467 "./parse.y"
3721 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3724 #line 1469 "./parse.y"
3725 {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;
3728 #line 1471 "./parse.y"
3729 {yyerror ("Missing term and ')' expected"); RECOVER;;
3732 #line 1473 "./parse.y"
3733 {yyerror ("')' expected"); RECOVER;;
3736 #line 1478 "./parse.y"
3737 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3740 #line 1483 "./parse.y"
3742 tree body = build_loop_body (0, NULL_TREE, 1);
3743 yyval.node = build_new_loop (body);
3747 #line 1492 "./parse.y"
3748 { yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ;
3751 #line 1497 "./parse.y"
3752 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3755 #line 1499 "./parse.y"
3757 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3758 /* We have not condition, so we get rid of the EXIT_EXPR */
3759 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
3764 #line 1506 "./parse.y"
3765 {yyerror ("Invalid control expression"); RECOVER;;
3768 #line 1508 "./parse.y"
3769 {yyerror ("Invalid update expression"); RECOVER;;
3772 #line 1510 "./parse.y"
3773 {yyerror ("Invalid update expression"); RECOVER;;
3776 #line 1515 "./parse.y"
3777 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
3780 #line 1517 "./parse.y"
3782 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3783 /* We have not condition, so we get rid of the EXIT_EXPR */
3784 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
3789 #line 1527 "./parse.y"
3791 /* This scope defined for local variable that may be
3792 defined within the scope of the for loop */
3797 #line 1533 "./parse.y"
3798 {yyerror ("'(' expected"); DRECOVER(for_1);;
3801 #line 1535 "./parse.y"
3802 {yyerror ("Invalid init statement"); RECOVER;;
3805 #line 1540 "./parse.y"
3807 /* We now declare the loop body. The loop is
3808 declared as a for loop. */
3809 tree body = build_loop_body (0, NULL_TREE, 0);
3810 yyval.node = build_new_loop (body);
3811 IS_FOR_LOOP_P (yyval.node) = 1;
3812 /* The loop is added to the current block the for
3813 statement is defined within */
3814 java_method_add_stmt (current_function_decl, yyval.node);
3818 #line 1552 "./parse.y"
3819 { yyval.node = empty_stmt_node; ;
3822 #line 1554 "./parse.y"
3824 /* Init statement recorded within the previously
3825 defined block scope */
3826 yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node);
3830 #line 1560 "./parse.y"
3832 /* Local variable are recorded within the previously
3833 defined block scope */
3834 yyval.node = NULL_TREE;
3838 #line 1566 "./parse.y"
3839 {yyerror ("';' expected"); DRECOVER(for_init_1);;
3842 #line 1570 "./parse.y"
3843 {yyval.node = empty_stmt_node;;
3846 #line 1572 "./parse.y"
3847 { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ;
3850 #line 1577 "./parse.y"
3851 { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ;
3854 #line 1579 "./parse.y"
3855 { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ;
3858 #line 1581 "./parse.y"
3859 {yyerror ("Missing term"); RECOVER;;
3862 #line 1586 "./parse.y"
3863 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ;
3866 #line 1588 "./parse.y"
3867 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ;
3870 #line 1590 "./parse.y"
3871 {yyerror ("Missing term"); RECOVER;;
3874 #line 1592 "./parse.y"
3875 {yyerror ("';' expected"); RECOVER;;
3878 #line 1597 "./parse.y"
3879 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ;
3882 #line 1599 "./parse.y"
3883 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ;
3886 #line 1601 "./parse.y"
3887 {yyerror ("Missing term"); RECOVER;;
3890 #line 1603 "./parse.y"
3891 {yyerror ("';' expected"); RECOVER;;
3894 #line 1608 "./parse.y"
3895 { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ;
3898 #line 1610 "./parse.y"
3899 { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3902 #line 1612 "./parse.y"
3903 {yyerror ("Missing term"); RECOVER;;
3906 #line 1614 "./parse.y"
3907 {yyerror ("';' expected"); RECOVER;;
3910 #line 1619 "./parse.y"
3912 yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node);
3913 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3917 #line 1624 "./parse.y"
3918 {yyerror ("Missing term"); RECOVER;;
3921 #line 1626 "./parse.y"
3922 {yyerror ("';' expected"); RECOVER;;
3925 #line 1631 "./parse.y"
3927 yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3928 EXPR_WFL_LINECOL (yyval.node) =
3929 EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));
3933 #line 1637 "./parse.y"
3934 {yyerror ("'{' expected"); RECOVER;;
3937 #line 1639 "./parse.y"
3938 {yyerror ("'(' expected"); RECOVER;;
3941 #line 1641 "./parse.y"
3942 {yyerror ("Missing term"); RECOVER;;
3945 #line 1643 "./parse.y"
3946 {yyerror ("Missing term"); RECOVER;;
3949 #line 1648 "./parse.y"
3951 if ((1 << yyvsp[0].value) != ACC_SYNCHRONIZED)
3952 fatal ("synchronized was '%d' - yyparse", (1 << yyvsp[0].value));
3956 #line 1656 "./parse.y"
3957 { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
3960 #line 1658 "./parse.y"
3961 { yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
3964 #line 1660 "./parse.y"
3965 { yyval.node = build_try_finally_statement
3966 (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location,
3967 yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node);
3971 #line 1665 "./parse.y"
3972 {yyerror ("'{' expected"); DRECOVER (try_statement);;
3975 #line 1671 "./parse.y"
3977 TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node;
3978 yyval.node = yyvsp[0].node;
3982 #line 1679 "./parse.y"
3984 java_method_add_stmt (current_function_decl, yyvsp[0].node);
3986 yyval.node = yyvsp[-1].node;
3990 #line 1687 "./parse.y"
3992 /* We add a block to define a scope for
3993 formal_parameter (CCBP). The formal parameter is
3994 declared initialized by the appropriate function
3996 tree ccpb = enter_block ();
3997 tree init = build_assignment (ASSIGN_TK, yyvsp[-2].operator.location,
3998 TREE_PURPOSE (yyvsp[-1].node),
3999 soft_exceptioninfo_call_node);
4000 declare_local_variables (0, TREE_VALUE (yyvsp[-1].node),
4001 build_tree_list (TREE_PURPOSE (yyvsp[-1].node),
4003 yyval.node = build1 (CATCH_EXPR, NULL_TREE, ccpb);
4004 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4008 #line 1703 "./parse.y"
4009 {yyerror ("'(' expected"); RECOVER;;
4012 #line 1705 "./parse.y"
4013 {yyerror ("Missing term or ')' expected"); DRECOVER (2);;
4016 #line 1707 "./parse.y"
4017 {yyerror ("')' expected"); DRECOVER (1);;
4020 #line 1712 "./parse.y"
4021 { yyval.node = yyvsp[0].node; ;
4024 #line 1714 "./parse.y"
4025 {yyerror ("'{' expected"); RECOVER; ;
4028 #line 1726 "./parse.y"
4029 { yyval.node = build_this (yyvsp[0].operator.location); ;
4032 #line 1728 "./parse.y"
4033 {yyval.node = yyvsp[-1].node;;
4036 #line 1737 "./parse.y"
4037 { yyval.node = parse_jdk1_1_error ("named class literals"); ;
4040 #line 1739 "./parse.y"
4041 { yyval.node = build_class_ref (yyvsp[-2].node); ;
4044 #line 1741 "./parse.y"
4045 { yyval.node = build_class_ref (void_type_node); ;
4048 #line 1746 "./parse.y"
4049 { yyval.node = parse_jdk1_1_error ("class literals"); ;
4052 #line 1748 "./parse.y"
4053 {yyerror ("')' expected"); RECOVER;;
4056 #line 1750 "./parse.y"
4057 {yyerror ("'class' or 'this' expected" ); RECOVER;;
4060 #line 1752 "./parse.y"
4061 {yyerror ("'class' expected" ); RECOVER;;
4064 #line 1754 "./parse.y"
4065 {yyerror ("'class' expected" ); RECOVER;;
4068 #line 1759 "./parse.y"
4069 { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4072 #line 1761 "./parse.y"
4073 { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ;
4076 #line 1766 "./parse.y"
4077 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4080 #line 1768 "./parse.y"
4081 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4084 #line 1777 "./parse.y"
4085 {yyerror ("'(' expected"); DRECOVER(new_1);;
4088 #line 1779 "./parse.y"
4089 {yyerror ("'(' expected"); RECOVER;;
4092 #line 1781 "./parse.y"
4093 {yyerror ("')' or term expected"); RECOVER;;
4096 #line 1783 "./parse.y"
4097 {yyerror ("')' expected"); RECOVER;;
4100 #line 1785 "./parse.y"
4101 {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;;
4104 #line 1787 "./parse.y"
4105 {yyerror ("'(' expected"); RECOVER;;
4108 #line 1797 "./parse.y"
4110 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
4111 ctxp->formal_parameter_number = 1;
4115 #line 1802 "./parse.y"
4117 ctxp->formal_parameter_number += 1;
4118 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
4122 #line 1807 "./parse.y"
4123 {yyerror ("Missing term"); RECOVER;;
4126 #line 1812 "./parse.y"
4127 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4130 #line 1814 "./parse.y"
4131 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4134 #line 1816 "./parse.y"
4135 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4138 #line 1818 "./parse.y"
4139 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4142 #line 1822 "./parse.y"
4143 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4146 #line 1824 "./parse.y"
4147 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4150 #line 1826 "./parse.y"
4151 {yyerror ("'[' expected"); DRECOVER ("]");;
4154 #line 1828 "./parse.y"
4155 {yyerror ("']' expected"); RECOVER;;
4158 #line 1833 "./parse.y"
4159 { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ;
4162 #line 1835 "./parse.y"
4163 { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ;
4166 #line 1840 "./parse.y"
4168 EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
4169 yyval.node = yyvsp[-1].node;
4173 #line 1845 "./parse.y"
4174 {yyerror ("']' expected"); RECOVER;;
4177 #line 1847 "./parse.y"
4179 yyerror ("Missing term");
4180 yyerror ("']' expected");
4185 #line 1856 "./parse.y"
4188 /* If not initialized, allocate memory for the osb
4190 if (!ctxp->osb_limit)
4192 allocate = ctxp->osb_limit = 32;
4193 ctxp->osb_depth = -1;
4195 /* If capacity overflown, reallocate a bigger chuck */
4196 else if (ctxp->osb_depth+1 == ctxp->osb_limit)
4197 allocate = ctxp->osb_limit << 1;
4201 allocate *= sizeof (int);
4202 if (ctxp->osb_number)
4203 ctxp->osb_number = (int *)xrealloc (ctxp->osb_number,
4206 ctxp->osb_number = (int *)xmalloc (allocate);
4209 CURRENT_OSB (ctxp) = 1;
4213 #line 1882 "./parse.y"
4214 { CURRENT_OSB (ctxp)++; ;
4217 #line 1884 "./parse.y"
4218 { yyerror ("']' expected"); RECOVER;;
4221 #line 1889 "./parse.y"
4222 { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
4225 #line 1893 "./parse.y"
4228 build_wfl_node (super_identifier_node);
4229 EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location;
4230 yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location);
4234 #line 1900 "./parse.y"
4235 {yyerror ("Field expected"); DRECOVER (super_field_acces);;
4238 #line 1905 "./parse.y"
4239 { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ;
4242 #line 1907 "./parse.y"
4243 { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4246 #line 1909 "./parse.y"
4248 if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR)
4249 yyval.node = build_this_super_qualified_invocation
4250 (1, yyvsp[-2].node, NULL_TREE, 0, yyvsp[-3].operator.location);
4253 tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE);
4254 yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location);
4259 #line 1920 "./parse.y"
4261 if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR)
4262 yyval.node = build_this_super_qualified_invocation
4263 (1, yyvsp[-3].node, yyvsp[-1].node, 0, yyvsp[-4].operator.location);
4266 tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node);
4267 yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location);
4272 #line 1931 "./parse.y"
4274 yyval.node = build_this_super_qualified_invocation
4275 (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location);
4279 #line 1936 "./parse.y"
4281 yyval.node = build_this_super_qualified_invocation
4282 (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location);
4286 #line 1945 "./parse.y"
4287 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4290 #line 1947 "./parse.y"
4291 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4294 #line 1952 "./parse.y"
4295 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4298 #line 1954 "./parse.y"
4299 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4302 #line 1956 "./parse.y"
4304 yyerror ("Missing term and ']' expected");
4305 DRECOVER(array_access);
4309 #line 1961 "./parse.y"
4311 yyerror ("']' expected");
4312 DRECOVER(array_access);
4316 #line 1966 "./parse.y"
4318 yyerror ("Missing term and ']' expected");
4319 DRECOVER(array_access);
4323 #line 1971 "./parse.y"
4325 yyerror ("']' expected");
4326 DRECOVER(array_access);
4330 #line 1986 "./parse.y"
4331 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4334 #line 1991 "./parse.y"
4335 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4338 #line 1998 "./parse.y"
4339 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4342 #line 2000 "./parse.y"
4343 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4346 #line 2003 "./parse.y"
4347 {yyerror ("Missing term"); RECOVER;
4350 #line 2005 "./parse.y"
4351 {yyerror ("Missing term"); RECOVER;
4354 #line 2010 "./parse.y"
4355 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4358 #line 2012 "./parse.y"
4359 {yyerror ("Missing term"); RECOVER;
4362 #line 2017 "./parse.y"
4363 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4366 #line 2019 "./parse.y"
4367 {yyerror ("Missing term"); RECOVER;
4370 #line 2025 "./parse.y"
4371 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4374 #line 2027 "./parse.y"
4375 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4378 #line 2030 "./parse.y"
4379 {yyerror ("Missing term"); RECOVER;
4382 #line 2032 "./parse.y"
4383 {yyerror ("Missing term"); RECOVER;
4386 #line 2037 "./parse.y"
4388 tree type = yyvsp[-3].node;
4389 while (CURRENT_OSB (ctxp)--)
4390 type = build_java_array_type (type, -1);
4392 yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node);
4396 #line 2045 "./parse.y"
4397 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4400 #line 2047 "./parse.y"
4401 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4404 #line 2049 "./parse.y"
4407 while (CURRENT_OSB (ctxp)--)
4408 obstack_1grow (&temporary_obstack, '[');
4410 obstack_grow0 (&temporary_obstack,
4411 IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)),
4412 IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node)));
4413 ptr = obstack_finish (&temporary_obstack);
4414 EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr);
4415 yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node);
4419 #line 2062 "./parse.y"
4420 {yyerror ("']' expected, invalid type expression");;
4423 #line 2064 "./parse.y"
4425 if (ctxp->prevent_ese != lineno)
4426 yyerror ("Invalid type expression"); RECOVER;
4431 #line 2070 "./parse.y"
4432 {yyerror ("Missing term"); RECOVER;;
4435 #line 2072 "./parse.y"
4436 {yyerror ("Missing term"); RECOVER;;
4439 #line 2074 "./parse.y"
4440 {yyerror ("Missing term"); RECOVER;;
4443 #line 2080 "./parse.y"
4445 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token),
4446 yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
4450 #line 2085 "./parse.y"
4452 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4453 yyvsp[-2].node, yyvsp[0].node);
4457 #line 2090 "./parse.y"
4459 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4460 yyvsp[-2].node, yyvsp[0].node);
4464 #line 2095 "./parse.y"
4465 {yyerror ("Missing term"); RECOVER;;
4468 #line 2097 "./parse.y"
4469 {yyerror ("Missing term"); RECOVER;;
4472 #line 2099 "./parse.y"
4473 {yyerror ("Missing term"); RECOVER;;
4476 #line 2105 "./parse.y"
4478 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4479 yyvsp[-2].node, yyvsp[0].node);
4483 #line 2110 "./parse.y"
4485 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4486 yyvsp[-2].node, yyvsp[0].node);
4490 #line 2115 "./parse.y"
4491 {yyerror ("Missing term"); RECOVER;;
4494 #line 2117 "./parse.y"
4495 {yyerror ("Missing term"); RECOVER;;
4498 #line 2123 "./parse.y"
4500 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4501 yyvsp[-2].node, yyvsp[0].node);
4505 #line 2128 "./parse.y"
4507 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4508 yyvsp[-2].node, yyvsp[0].node);
4512 #line 2133 "./parse.y"
4514 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4515 yyvsp[-2].node, yyvsp[0].node);
4519 #line 2138 "./parse.y"
4520 {yyerror ("Missing term"); RECOVER;;
4523 #line 2140 "./parse.y"
4524 {yyerror ("Missing term"); RECOVER;;
4527 #line 2142 "./parse.y"
4528 {yyerror ("Missing term"); RECOVER;;
4531 #line 2148 "./parse.y"
4533 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4534 yyvsp[-2].node, yyvsp[0].node);
4538 #line 2153 "./parse.y"
4540 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4541 yyvsp[-2].node, yyvsp[0].node);
4545 #line 2158 "./parse.y"
4547 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4548 yyvsp[-2].node, yyvsp[0].node);
4552 #line 2163 "./parse.y"
4554 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4555 yyvsp[-2].node, yyvsp[0].node);
4559 #line 2168 "./parse.y"
4560 { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4563 #line 2170 "./parse.y"
4564 {yyerror ("Missing term"); RECOVER;;
4567 #line 2172 "./parse.y"
4568 {yyerror ("Missing term"); RECOVER;;
4571 #line 2174 "./parse.y"
4572 {yyerror ("Missing term"); RECOVER;;
4575 #line 2176 "./parse.y"
4576 {yyerror ("Missing term"); RECOVER;;
4579 #line 2178 "./parse.y"
4580 {yyerror ("Invalid reference type"); RECOVER;;
4583 #line 2184 "./parse.y"
4585 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4586 yyvsp[-2].node, yyvsp[0].node);
4590 #line 2189 "./parse.y"
4592 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4593 yyvsp[-2].node, yyvsp[0].node);
4597 #line 2194 "./parse.y"
4598 {yyerror ("Missing term"); RECOVER;;
4601 #line 2196 "./parse.y"
4602 {yyerror ("Missing term"); RECOVER;;
4605 #line 2202 "./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 2207 "./parse.y"
4613 {yyerror ("Missing term"); RECOVER;;
4616 #line 2213 "./parse.y"
4618 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4619 yyvsp[-2].node, yyvsp[0].node);
4623 #line 2218 "./parse.y"
4624 {yyerror ("Missing term"); RECOVER;;
4627 #line 2224 "./parse.y"
4629 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4630 yyvsp[-2].node, yyvsp[0].node);
4634 #line 2229 "./parse.y"
4635 {yyerror ("Missing term"); RECOVER;;
4638 #line 2235 "./parse.y"
4640 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4641 yyvsp[-2].node, yyvsp[0].node);
4645 #line 2240 "./parse.y"
4646 {yyerror ("Missing term"); RECOVER;;
4649 #line 2246 "./parse.y"
4651 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4652 yyvsp[-2].node, yyvsp[0].node);
4656 #line 2251 "./parse.y"
4657 {yyerror ("Missing term"); RECOVER;;
4660 #line 2257 "./parse.y"
4662 yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
4663 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4667 #line 2262 "./parse.y"
4670 yyerror ("Missing term");
4675 #line 2268 "./parse.y"
4676 {yyerror ("Missing term"); DRECOVER (2);;
4679 #line 2270 "./parse.y"
4680 {yyerror ("Missing term"); DRECOVER (3);;
4683 #line 2280 "./parse.y"
4684 { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4687 #line 2282 "./parse.y"
4689 if (ctxp->prevent_ese != lineno)
4690 yyerror ("Missing term");
4695 /* the action file gets copied in in place of this dollarsign */
4696 #line 498 "/usr/lib/bison.simple"
4707 short *ssp1 = yyss - 1;
4708 fprintf (stderr, "state stack now");
4709 while (ssp1 != yyssp)
4710 fprintf (stderr, " %d", *++ssp1);
4711 fprintf (stderr, "\n");
4721 yylsp->first_line = yylloc.first_line;
4722 yylsp->first_column = yylloc.first_column;
4723 yylsp->last_line = (yylsp-1)->last_line;
4724 yylsp->last_column = (yylsp-1)->last_column;
4729 yylsp->last_line = (yylsp+yylen-1)->last_line;
4730 yylsp->last_column = (yylsp+yylen-1)->last_column;
4734 /* Now "shift" the result of the reduction.
4735 Determine what state that goes to,
4736 based on the state we popped back to
4737 and the rule number reduced by. */
4741 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
4742 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4743 yystate = yytable[yystate];
4745 yystate = yydefgoto[yyn - YYNTBASE];
4749 yyerrlab: /* here on detecting error */
4752 /* If not already recovering from an error, report this error. */
4756 #ifdef YYERROR_VERBOSE
4757 yyn = yypact[yystate];
4759 if (yyn > YYFLAG && yyn < YYLAST)
4766 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
4767 for (x = (yyn < 0 ? -yyn : 0);
4768 x < (sizeof(yytname) / sizeof(char *)); x++)
4769 if (yycheck[x + yyn] == x)
4770 size += strlen(yytname[x]) + 15, count++;
4771 msg = (char *) malloc(size + 15);
4774 strcpy(msg, "parse error");
4779 for (x = (yyn < 0 ? -yyn : 0);
4780 x < (sizeof(yytname) / sizeof(char *)); x++)
4781 if (yycheck[x + yyn] == x)
4783 strcat(msg, count == 0 ? ", expecting `" : " or `");
4784 strcat(msg, yytname[x]);
4793 yyerror ("parse error; also virtual memory exceeded");
4796 #endif /* YYERROR_VERBOSE */
4797 yyerror("parse error");
4801 yyerrlab1: /* here on error raised explicitly by an action */
4803 if (yyerrstatus == 3)
4805 /* if just tried and failed to reuse lookahead token after an error, discard it. */
4807 /* return failure if at end of input */
4808 if (yychar == YYEOF)
4813 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
4819 /* Else will try to reuse lookahead token
4820 after shifting the error token. */
4822 yyerrstatus = 3; /* Each real token shifted decrements this */
4826 yyerrdefault: /* current state does not do anything special for the error token. */
4829 /* This is wrong; only states that explicitly want error tokens
4830 should shift them. */
4831 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4832 if (yyn) goto yydefault;
4835 yyerrpop: /* pop the current state because it cannot handle the error token */
4837 if (yyssp == yyss) YYABORT;
4847 short *ssp1 = yyss - 1;
4848 fprintf (stderr, "Error: state stack now");
4849 while (ssp1 != yyssp)
4850 fprintf (stderr, " %d", *++ssp1);
4851 fprintf (stderr, "\n");
4857 yyn = yypact[yystate];
4862 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
4881 fprintf(stderr, "Shifting error token, ");
4892 #line 2308 "./parse.y"
4896 /* Flag for the error report routine to issue the error the first time
4897 it's called (overriding the default behavior which is to drop the
4898 first invocation and honor the second one, taking advantage of a
4900 static int force_error = 0;
4902 /* Create a new parser context and make it the current one. */
4905 java_push_parser_context ()
4907 struct parser_ctxt *new =
4908 (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
4910 bzero ((PTR) new, sizeof (struct parser_ctxt));
4915 ctxp->incomplete_class = ctxp->next->incomplete_class;
4916 ctxp->gclass_list = ctxp->next->gclass_list;
4920 /* If the first file of a file list was a class file, no context
4921 exists for a source file to be parsed. This boolean remembers that
4922 java_parser_context_save_global might have created a dummy one, so
4923 that java_parser_context_restore_global can pop it. */
4924 static int extra_ctxp_pushed_p = 0;
4927 java_parser_context_save_global ()
4931 java_push_parser_context ();
4932 extra_ctxp_pushed_p = 1;
4934 ctxp->finput = finput;
4935 ctxp->lineno = lineno;
4936 ctxp->current_class = current_class;
4937 ctxp->filename = input_filename;
4938 ctxp->current_function_decl = current_function_decl;
4942 java_parser_context_restore_global ()
4944 finput = ctxp->finput;
4945 lineno = ctxp->lineno;
4946 current_class = ctxp->current_class;
4947 input_filename = ctxp->filename;
4948 current_function_decl = ctxp->current_function_decl;
4949 if (!ctxp->next && extra_ctxp_pushed_p)
4951 java_pop_parser_context (0);
4952 extra_ctxp_pushed_p = 0;
4957 java_pop_parser_context (generate)
4961 struct parser_ctxt *toFree, *next;
4970 next->incomplete_class = ctxp->incomplete_class;
4971 next->gclass_list = ctxp->gclass_list;
4972 lineno = ctxp->lineno;
4973 finput = ctxp->finput;
4974 current_class = ctxp->current_class;
4977 /* Set the single import class file flag to 0 for the current list
4978 of imported things */
4979 for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
4980 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0;
4982 /* And restore those of the previous context */
4983 if ((ctxp = next)) /* Assignment is really meant here */
4984 for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
4985 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1;
4989 toFree->next = ctxp_for_generation;
4990 ctxp_for_generation = toFree;
4996 /* Reporting JDK1.1 features not implemented */
4999 parse_jdk1_1_error (msg)
5002 sorry (": `%s' JDK1.1(TM) feature", msg);
5004 return empty_stmt_node;
5007 static int do_warning = 0;
5014 static int prev_lineno;
5015 static char *prev_msg;
5018 char *remainder, *code_from_source;
5019 extern struct obstack temporary_obstack;
5021 if (!force_error && prev_lineno == lineno)
5024 /* Save current error location but report latter, when the context is
5026 if (ctxp->java_error_flag == 0)
5028 ctxp->java_error_flag = 1;
5030 /* Do something to use the previous line if we're reaching the
5031 end of the file... */
5032 #ifdef VERBOSE_SKELETON
5033 printf ("* Error detected (%s)\n", (msg ? msg : "(null)"));
5038 /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
5039 if (!force_error && msg == prev_msg && prev_lineno == elc.line)
5042 ctxp->java_error_flag = 0;
5044 java_warning_count++;
5048 if (elc.col == 0 && msg[1] == ';')
5050 elc.col = ctxp->p_line->char_col-1;
5051 elc.line = ctxp->p_line->lineno;
5054 save_lineno = lineno;
5055 prev_lineno = lineno = elc.line;
5058 code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col);
5059 obstack_grow0 (&temporary_obstack,
5060 code_from_source, strlen (code_from_source));
5061 remainder = obstack_finish (&temporary_obstack);
5063 warning ("%s.\n%s", msg, remainder);
5065 error ("%s.\n%s", msg, remainder);
5067 /* This allow us to cheaply avoid an extra 'Invalid expression
5068 statement' error report when errors have been already reported on
5069 the same line. This occurs when we report an error but don't have
5070 a synchronization point other than ';', which
5071 expression_statement is the only one to take care of. */
5072 ctxp->prevent_ese = lineno = save_lineno;
5076 issue_warning_error_from_context (cl, msg, ap)
5081 char *saved, *saved_input_filename;
5083 vsprintf (buffer, msg, ap);
5086 ctxp->elc.line = EXPR_WFL_LINENO (cl);
5087 ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 :
5088 (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl)));
5090 /* We have a CL, that's a good reason for using it if it contains data */
5091 saved = ctxp->filename;
5092 if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl))
5093 ctxp->filename = EXPR_WFL_FILENAME (cl);
5094 saved_input_filename = input_filename;
5095 input_filename = ctxp->filename;
5097 java_error (buffer);
5098 ctxp->filename = saved;
5099 input_filename = saved_input_filename;
5103 /* Issue an error message at a current source line CL */
5106 parse_error_context VPROTO ((tree cl, const char *msg, ...))
5108 #ifndef ANSI_PROTOTYPES
5115 #ifndef ANSI_PROTOTYPES
5116 cl = va_arg (ap, tree);
5117 msg = va_arg (ap, const char *);
5119 issue_warning_error_from_context (cl, msg, ap);
5123 /* Issue a warning at a current source line CL */
5126 parse_warning_context VPROTO ((tree cl, const char *msg, ...))
5128 #ifndef ANSI_PROTOTYPES
5135 #ifndef ANSI_PROTOTYPES
5136 cl = va_arg (ap, tree);
5137 msg = va_arg (ap, const char *);
5140 force_error = do_warning = 1;
5141 issue_warning_error_from_context (cl, msg, ap);
5142 do_warning = force_error = 0;
5147 find_expr_with_wfl (node)
5155 switch (TREE_CODE (node))
5158 node = BLOCK_EXPR_BODY (node);
5162 to_return = find_expr_with_wfl (TREE_OPERAND (node, 0));
5165 node = TREE_OPERAND (node, 1);
5169 node = TREE_OPERAND (node, 0);
5172 case LABELED_BLOCK_EXPR:
5173 node = TREE_OPERAND (node, 1);
5177 code = TREE_CODE_CLASS (TREE_CODE (node));
5178 if (((code == '1') || (code == '2') || (code == 'e'))
5179 && EXPR_WFL_LINECOL (node))
5187 /* Issue a missing return statement error. Uses METHOD to figure the
5188 last line of the method the error occurs in. */
5191 missing_return_error (method)
5194 EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2);
5195 parse_error_context (wfl_operator, "Missing return statement");
5198 /* Issue an unreachable statement error. From NODE, find the next
5199 statement to report appropriately. */
5201 unreachable_stmt_error (node)
5204 /* Browse node to find the next expression node that has a WFL. Use
5205 the location to report the error */
5206 if (TREE_CODE (node) == COMPOUND_EXPR)
5207 node = find_expr_with_wfl (TREE_OPERAND (node, 1));
5209 node = find_expr_with_wfl (node);
5213 EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2);
5214 parse_error_context (wfl_operator, "Unreachable statement");
5217 fatal ("Can't get valid statement - unreachable_stmt_error");
5221 java_report_errors ()
5223 if (java_error_count)
5224 fprintf (stderr, "%d error%s",
5225 java_error_count, (java_error_count == 1 ? "" : "s"));
5226 if (java_warning_count)
5227 fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""),
5228 java_warning_count, (java_warning_count == 1 ? "" : "s"));
5229 if (java_error_count || java_warning_count)
5230 putc ('\n', stderr);
5231 return java_error_count;
5235 java_accstring_lookup (flags)
5238 static char buffer [80];
5239 #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
5241 /* Access modifier looked-up first for easier report on forbidden
5243 if (flags & ACC_PUBLIC) COPY_RETURN ("public");
5244 if (flags & ACC_PRIVATE) COPY_RETURN ("private");
5245 if (flags & ACC_PROTECTED) COPY_RETURN ("protected");
5246 if (flags & ACC_STATIC) COPY_RETURN ("static");
5247 if (flags & ACC_FINAL) COPY_RETURN ("final");
5248 if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized");
5249 if (flags & ACC_VOLATILE) COPY_RETURN ("volatile");
5250 if (flags & ACC_TRANSIENT) COPY_RETURN ("transient");
5251 if (flags & ACC_NATIVE) COPY_RETURN ("native");
5252 if (flags & ACC_INTERFACE) COPY_RETURN ("interface");
5253 if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract");
5260 /* Issuing error messages upon redefinition of classes, interfaces or
5264 classitf_redefinition_error (context, id, decl, cl)
5268 parse_error_context (cl, "%s `%s' already defined in %s:%d",
5269 context, IDENTIFIER_POINTER (id),
5270 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
5271 /* Here we should point out where its redefined. It's a unicode. FIXME */
5275 variable_redefinition_error (context, name, type, line)
5276 tree context, name, type;
5281 /* Figure a proper name for type. We might haven't resolved it */
5282 if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type))
5283 type_name = IDENTIFIER_POINTER (TYPE_NAME (type));
5285 type_name = lang_printable_name (type, 0);
5287 parse_error_context (context,
5288 "Variable `%s' is already defined in this method and "
5289 "was declared `%s %s' at line %d",
5290 IDENTIFIER_POINTER (name),
5291 type_name, IDENTIFIER_POINTER (name), line);
5295 build_array_from_name (type, type_wfl, name, ret_name)
5296 tree type, type_wfl, name, *ret_name;
5301 /* Eventually get more dims */
5302 string = IDENTIFIER_POINTER (name);
5303 while (string [more_dims] == '[')
5306 /* If we have, then craft a new type for this variable */
5309 name = get_identifier (&string [more_dims]);
5311 /* If we have a pointer, use its type */
5312 if (TREE_CODE (type) == POINTER_TYPE)
5313 type = TREE_TYPE (type);
5315 /* Building the first dimension of a primitive type uses this
5317 if (JPRIMITIVE_TYPE_P (type))
5319 type = build_java_array_type (type, -1);
5320 CLASS_LOADED_P (type) = 1;
5323 /* Otherwise, if we have a WFL for this type, use it (the type
5324 is already an array on an unresolved type, and we just keep
5325 on adding dimensions) */
5329 /* Add all the dimensions */
5331 type = build_unresolved_array_type (type);
5333 /* The type may have been incomplete in the first place */
5335 type = obtain_incomplete_type (type);
5342 /* Build something that the type identifier resolver will identify as
5343 being an array to an unresolved type. TYPE_WFL is a WFL on a
5347 build_unresolved_array_type (type_or_wfl)
5352 /* TYPE_OR_WFL might be an array on a resolved type. In this case,
5353 just create a array type */
5354 if (TREE_CODE (type_or_wfl) == RECORD_TYPE)
5356 tree type = build_java_array_type (type_or_wfl, -1);
5357 CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl);
5361 obstack_1grow (&temporary_obstack, '[');
5362 obstack_grow0 (&temporary_obstack,
5363 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
5364 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
5365 ptr = obstack_finish (&temporary_obstack);
5366 return build_expr_wfl (get_identifier (ptr),
5367 EXPR_WFL_FILENAME (type_or_wfl),
5368 EXPR_WFL_LINENO (type_or_wfl),
5369 EXPR_WFL_COLNO (type_or_wfl));
5372 /* Check modifiers. If one doesn't fit, retrieve it in its declaration line
5373 and point it out. */
5376 check_modifiers (message, value, mask)
5381 /* Should point out the one that don't fit. ASCII/unicode,
5382 going backward. FIXME */
5385 int i, remainder = value & ~mask;
5386 for (i = 0; i <= 10; i++)
5387 if ((1 << i) & remainder)
5388 parse_error_context (ctxp->modifier_ctx [i], message,
5389 java_accstring_lookup (1 << i));
5394 parser_add_interface (class_decl, interface_decl, wfl)
5395 tree class_decl, interface_decl, wfl;
5397 if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
5398 parse_error_context (wfl, "Interface `%s' repeated",
5399 IDENTIFIER_POINTER (DECL_NAME (interface_decl)));
5402 /* Bulk of common class/interface checks. Return 1 if an error was
5403 encountered. TAG is 0 for a class, 1 for an interface. */
5406 check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl)
5407 int is_interface, flags;
5408 tree raw_name, qualified_name, decl, cl;
5413 fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"),
5414 IDENTIFIER_POINTER (qualified_name));
5416 /* Scope of an interface/class type name:
5417 - Can't be imported by a single type import
5418 - Can't already exists in the package */
5419 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name)
5420 && (node = find_name_in_single_imports (raw_name)))
5423 (cl, "%s name `%s' clashes with imported type `%s'",
5424 (is_interface ? "Interface" : "Class"),
5425 IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node));
5428 if (decl && CLASS_COMPLETE_P (decl))
5430 classitf_redefinition_error ((is_interface ? "Interface" : "Class"),
5431 qualified_name, decl, cl);
5435 /* If public, file name should match class/interface name */
5436 if (flags & ACC_PUBLIC)
5440 /* Contains OS dependent assumption on path separator. FIXME */
5441 for (f = &input_filename [strlen (input_filename)];
5442 f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR;
5445 if (f[0] == '/' || f[0] == DIR_SEPARATOR)
5447 if (strncmp (IDENTIFIER_POINTER (raw_name),
5448 f , IDENTIFIER_LENGTH (raw_name)) ||
5449 f [IDENTIFIER_LENGTH (raw_name)] != '.')
5450 parse_error_context (cl, "Public %s `%s' must be defined in a file "
5452 (is_interface ? "interface" : "class"),
5453 IDENTIFIER_POINTER (qualified_name),
5454 IDENTIFIER_POINTER (raw_name));
5457 check_modifiers ((is_interface ?
5458 "Illegal modifier `%s' for interface declaration" :
5459 "Illegal modifier `%s' for class declaration"), flags,
5460 (is_interface ? INTERFACE_MODIFIERS : CLASS_MODIFIERS));
5464 /* If DECL is NULL, create and push a new DECL, record the current
5465 line CL and do other maintenance things. */
5468 maybe_create_class_interface_decl (decl, qualified_name, cl)
5469 tree decl, qualified_name, cl;
5472 decl = push_class (make_class (), qualified_name);
5474 /* Take care of the file and line business */
5475 DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
5476 /* If we're emiting xrefs, store the line/col number information */
5478 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (cl);
5480 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
5481 CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
5482 CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) =
5483 IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
5485 ctxp->current_parsed_class = decl;
5487 /* Link the declaration to the already seen ones */
5488 TREE_CHAIN (decl) = ctxp->class_list;
5489 ctxp->class_list = decl;
5491 /* Create a new nodes in the global lists */
5492 ctxp->gclass_list = tree_cons (NULL_TREE, decl, ctxp->gclass_list);
5493 all_class_list = tree_cons (NULL_TREE, decl, all_class_list);
5495 /* Install a new dependency list element */
5496 create_jdep_list (ctxp);
5498 SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
5499 IDENTIFIER_POINTER (qualified_name)));
5504 add_superinterfaces (decl, interface_list)
5505 tree decl, interface_list;
5508 /* Superinterface(s): if present and defined, parser_check_super_interface ()
5509 takes care of ensuring that:
5510 - This is an accessible interface type,
5511 - Circularity detection.
5512 parser_add_interface is then called. If present but not defined,
5513 the check operation is delayed until the super interface gets
5515 for (node = interface_list; node; node = TREE_CHAIN (node))
5517 tree current = TREE_PURPOSE (node);
5518 tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current));
5519 if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl)))
5521 if (!parser_check_super_interface (idecl, decl, current))
5522 parser_add_interface (decl, idecl, current);
5525 register_incomplete_type (JDEP_INTERFACE,
5526 current, decl, NULL_TREE);
5530 /* Create an interface in pass1 and return its decl. Return the
5531 interface's decl in pass 2. */
5534 create_interface (flags, id, super)
5538 tree raw_name = EXPR_WFL_NODE (id);
5539 tree q_name = parser_qualified_classname (id);
5540 tree decl = IDENTIFIER_CLASS_VALUE (q_name);
5542 EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */
5544 /* Basic checks: scope, redefinition, modifiers */
5545 if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id))
5548 /* Interface modifiers check
5549 - public/abstract allowed (already done at that point)
5550 - abstract is obsolete (comes first, it's a warning, or should be)
5551 - Can't use twice the same (checked in the modifier rule) */
5552 if ((flags & ACC_ABSTRACT) && flag_redundant)
5553 parse_warning_context
5554 (MODIFIER_WFL (ABSTRACT_TK),
5555 "Redundant use of `abstract' modifier. Interface `%s' is implicitely "
5556 "abstract", IDENTIFIER_POINTER (raw_name));
5558 /* Create a new decl if DECL is NULL, otherwise fix it */
5559 decl = maybe_create_class_interface_decl (decl, q_name, id);
5561 /* Set super info and mark the class a complete */
5562 set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl),
5563 object_type_node, ctxp->interface_number);
5564 ctxp->interface_number = 0;
5565 CLASS_COMPLETE_P (decl) = 1;
5566 add_superinterfaces (decl, super);
5571 /* Create an class in pass1 and return its decl. Return class
5572 interface's decl in pass 2. */
5575 create_class (flags, id, super, interfaces)
5577 tree id, super, interfaces;
5579 tree raw_name = EXPR_WFL_NODE (id);
5580 tree class_id, decl;
5581 tree super_decl_type;
5583 class_id = parser_qualified_classname (id);
5584 decl = IDENTIFIER_CLASS_VALUE (class_id);
5585 ctxp->current_parsed_class_un = EXPR_WFL_NODE (id);
5586 EXPR_WFL_NODE (id) = class_id;
5588 /* Basic check: scope, redefinition, modifiers */
5589 if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id))
5592 /* Class modifier check:
5593 - Allowed modifier (already done at that point)
5594 - abstract AND final forbidden
5595 - Public classes defined in the correct file */
5596 if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
5597 parse_error_context (id, "Class `%s' can't be declared both abstract "
5598 "and final", IDENTIFIER_POINTER (raw_name));
5600 /* Create a new decl if DECL is NULL, otherwise fix it */
5601 decl = maybe_create_class_interface_decl (decl, class_id, id);
5603 /* If SUPER exists, use it, otherwise use Object */
5606 /* Can't extend java.lang.Object */
5607 if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
5609 parse_error_context (id, "Can't extend `java.lang.Object'");
5614 register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE);
5616 else if (TREE_TYPE (decl) != object_type_node)
5617 super_decl_type = object_type_node;
5618 /* We're defining java.lang.Object */
5620 super_decl_type = NULL_TREE;
5622 /* Set super info and mark the class a complete */
5623 set_super_info (flags, TREE_TYPE (decl), super_decl_type,
5624 ctxp->interface_number);
5625 ctxp->interface_number = 0;
5626 CLASS_COMPLETE_P (decl) = 1;
5627 add_superinterfaces (decl, interfaces);
5629 /* If doing xref, store the location at which the inherited class
5630 (if any) was seen. */
5631 if (flag_emit_xref && super)
5632 DECL_INHERITED_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (super);
5634 /* Eventually sets the @deprecated tag flag */
5635 CHECK_DEPRECATED (decl);
5640 /* Can't use lookup_field () since we don't want to load the class and
5641 can't set the CLASS_LOADED_P flag */
5644 find_field (class, name)
5649 for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl))
5651 if (DECL_NAME (decl) == name)
5657 /* Wrap around lookup_field that doesn't potentially upset the value
5661 lookup_field_wrapper (class, name)
5666 java_parser_context_save_global ();
5667 decl = lookup_field (&type, name);
5668 java_parser_context_restore_global ();
5669 return decl == error_mark_node ? NULL : decl;
5672 /* Find duplicate field within the same class declarations and report
5673 the error. Returns 1 if a duplicated field was found, 0
5677 duplicate_declaration_error_p (new_field_name, new_type, cl)
5678 tree new_field_name, new_type, cl;
5680 /* This might be modified to work with method decl as well */
5681 tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class),
5685 char *t1 = strdup (purify_type_name
5686 ((TREE_CODE (new_type) == POINTER_TYPE
5687 && TREE_TYPE (new_type) == NULL_TREE) ?
5688 IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
5689 lang_printable_name (new_type, 1)));
5690 /* The type may not have been completed by the time we report
5692 char *t2 = strdup (purify_type_name
5693 ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
5694 && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
5695 IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
5696 lang_printable_name (TREE_TYPE (decl), 1)));
5698 (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
5699 t1, IDENTIFIER_POINTER (new_field_name),
5700 t2, IDENTIFIER_POINTER (DECL_NAME (decl)),
5701 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
5709 /* Field registration routine. If TYPE doesn't exist, field
5710 declarations are linked to the undefined TYPE dependency list, to
5711 be later resolved in java_complete_class () */
5714 register_fields (flags, type, variable_list)
5716 tree type, variable_list;
5718 tree current, saved_type;
5719 tree class_type = TREE_TYPE (ctxp->current_parsed_class);
5720 int saved_lineno = lineno;
5722 tree wfl = NULL_TREE;
5724 /* If we're adding fields to interfaces, those fields are public,
5726 if (CLASS_INTERFACE (TYPE_NAME (class_type)))
5728 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK),
5730 "%s", "interface field(s)");
5731 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
5733 "%s", "interface field(s)");
5734 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
5735 flags, ACC_FINAL, "%s", "interface field(s)");
5736 check_modifiers ("Illegal interface member modifier `%s'", flags,
5737 INTERFACE_FIELD_MODIFIERS);
5738 flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL);
5741 /* Obtain a suitable type for resolution, if necessary */
5742 SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain);
5744 /* If TYPE is fully resolved and we don't have a reference, make one */
5745 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5747 for (current = variable_list, saved_type = type; current;
5748 current = TREE_CHAIN (current), type = saved_type)
5752 tree cl = TREE_PURPOSE (current);
5753 tree init = TREE_VALUE (current);
5754 tree current_name = EXPR_WFL_NODE (cl);
5756 /* Process NAME, as it may specify extra dimension(s) for it */
5757 type = build_array_from_name (type, wfl, current_name, ¤t_name);
5759 /* Type adjustment. We may have just readjusted TYPE because
5760 the variable specified more dimensions. Make sure we have
5761 a reference if we can and don't have one already. Also
5762 change the name if we have an init. */
5763 if (type != saved_type)
5765 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5767 EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name;
5770 real_type = GET_REAL_TYPE (type);
5771 /* Check for redeclarations */
5772 if (duplicate_declaration_error_p (current_name, real_type, cl))
5775 /* Set lineno to the line the field was found and create a
5776 declaration for it. Eventually sets the @deprecated tag flag. */
5778 lineno = EXPR_WFL_LINECOL (cl);
5780 lineno = EXPR_WFL_LINENO (cl);
5781 field_decl = add_field (class_type, current_name, real_type, flags);
5782 CHECK_DEPRECATED (field_decl);
5784 /* Check if we must chain. */
5786 register_incomplete_type (JDEP_FIELD, wfl, field_decl, type);
5788 /* If we have an initialization value tied to the field */
5791 /* The field is declared static */
5792 if (flags & ACC_STATIC)
5794 /* We include the field and its initialization part into
5795 a list used to generate <clinit>. After <clinit> is
5796 walked, field initializations will be processed and
5797 fields initialized with known constants will be taken
5798 out of <clinit> and have their DECL_INITIAL set
5800 TREE_CHAIN (init) = ctxp->static_initialized;
5801 ctxp->static_initialized = init;
5802 DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1);
5803 if (TREE_OPERAND (init, 1)
5804 && TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT)
5805 TREE_STATIC (TREE_OPERAND (init, 1)) = 1;
5807 /* A non-static field declared with an immediate initialization is
5808 to be initialized in <init>, if any. This field is remembered
5809 to be processed at the time of the generation of <init>. */
5812 TREE_CHAIN (init) = ctxp->non_static_initialized;
5813 ctxp->non_static_initialized = init;
5815 MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
5818 lineno = saved_lineno;
5821 /* Generate the method $finit$ that initializes fields initialized
5822 upon declaration. */
5825 maybe_generate_finit ()
5827 tree mdecl, current;
5829 if (!ctxp->non_static_initialized || java_error_count)
5832 mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
5833 ACC_PRIVATE, void_type_node,
5834 finit_identifier_node, end_params_node);
5835 start_artificial_method_body (mdecl);
5837 ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized);
5838 for (current = ctxp->non_static_initialized; current;
5839 current = TREE_CHAIN (current))
5840 java_method_add_stmt (mdecl,
5841 build_debugable_stmt (EXPR_WFL_LINECOL (current),
5844 end_artificial_method_body (mdecl);
5845 CLASS_HAS_FINIT_P (TREE_TYPE (ctxp->current_parsed_class)) = 1;
5846 ctxp->non_static_initialized = NULL_TREE;
5849 /* Check whether it is necessary to generate a <clinit> for the class
5853 maybe_generate_clinit ()
5857 if (!ctxp->static_initialized || java_error_count)
5860 mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
5861 ACC_STATIC, void_type_node,
5862 clinit_identifier_node, end_params_node);
5863 start_artificial_method_body (mdecl);
5865 /* Keep initialization in order to enforce 8.5 */
5866 ctxp->static_initialized = nreverse (ctxp->static_initialized);
5868 /* We process the list of assignment we produced as the result of
5869 the declaration of initialized static field and add them as
5870 statement to the <clinit> method. */
5871 for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c))
5873 /* We build the assignment expression that will initialize the
5874 field to its value. There are strict rules on static
5875 initializers (8.5). FIXME */
5876 java_method_add_stmt (mdecl,
5877 build_debugable_stmt (EXPR_WFL_LINECOL (c), c));
5880 end_artificial_method_body (mdecl);
5881 ctxp->static_initialized = NULL_TREE;
5884 /* Shared accros method_declarator and method_header to remember the
5885 patch stage that was reached during the declaration of the method.
5886 A method DECL is built differently is there is no patch
5887 (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
5888 pending on the currently defined method. */
5890 static int patch_stage;
5892 /* Check the method declaration and add the method to its current
5893 class. If the argument list is known to contain incomplete types,
5894 the method is partially added and the registration will be resume
5895 once the method arguments resolved. If TYPE is NULL, we're dealing
5896 with a constructor. */
5899 method_header (flags, type, mdecl, throws)
5901 tree type, mdecl, throws;
5903 tree meth = TREE_VALUE (mdecl);
5904 tree id = TREE_PURPOSE (mdecl);
5905 tree this_class = TREE_TYPE (ctxp->current_parsed_class);
5906 tree type_wfl = NULL_TREE;
5907 tree meth_name = NULL_TREE, current, orig_arg;
5909 int constructor_ok = 0, must_chain;
5911 check_modifiers_consistency (flags);
5913 /* There are some forbidden modifiers for an abstract method and its
5914 class must be abstract as well. */
5915 if (type && (flags & ACC_ABSTRACT))
5917 ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private");
5918 ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static");
5919 ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final");
5920 ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native");
5921 ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized");
5922 if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
5923 && !CLASS_INTERFACE (TYPE_NAME (this_class)))
5925 (id, "Class `%s' must be declared abstract to define abstract "
5927 IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)),
5928 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
5930 /* Things to be checked when declaring a constructor */
5933 int ec = java_error_count;
5934 /* 8.6: Constructor declarations: we might be trying to define a
5935 method without specifying a return type. */
5936 if (EXPR_WFL_NODE (id) != ctxp->current_parsed_class_un)
5938 (id, "Invalid method declaration, return type required");
5939 /* 8.6.3: Constructor modifiers */
5942 JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract");
5943 JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static");
5944 JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final");
5945 JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native");
5946 JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized");
5948 /* If we found error here, we don't consider it's OK to tread
5949 the method definition as a constructor, for the rest of this
5951 if (ec == java_error_count)
5955 /* Method declared within the scope of an interface are implicitly
5956 abstract and public. Conflicts with other erroneously provided
5957 modifiers are checked right after. */
5959 if (CLASS_INTERFACE (TYPE_NAME (this_class)))
5961 /* If FLAGS isn't set because of a modifier, turn the
5962 corresponding modifier WFL to NULL so we issue a warning on
5963 the obsolete use of the modifier */
5964 if (!(flags & ACC_PUBLIC))
5965 MODIFIER_WFL (PUBLIC_TK) = NULL;
5966 if (!(flags & ACC_ABSTRACT))
5967 MODIFIER_WFL (ABSTRACT_TK) = NULL;
5968 flags |= ACC_PUBLIC;
5969 flags |= ACC_ABSTRACT;
5972 /* Modifiers context reset moved up, so abstract method declaration
5973 modifiers can be later checked. */
5975 /* Set constructor returned type to void and method name to <init>,
5976 unless we found an error identifier the constructor (in which
5977 case we retain the original name) */
5980 type = void_type_node;
5982 meth_name = init_identifier_node;
5985 meth_name = EXPR_WFL_NODE (id);
5987 /* Do the returned type resolution and registration if necessary */
5988 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
5991 type = build_array_from_name (type, type_wfl, meth_name, &meth_name);
5992 EXPR_WFL_NODE (id) = meth_name;
5993 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5997 patch_stage = JDEP_METHOD_RETURN;
5998 register_incomplete_type (patch_stage, type_wfl, id, type);
5999 TREE_TYPE (meth) = GET_REAL_TYPE (type);
6002 TREE_TYPE (meth) = type;
6004 saved_lineno = lineno;
6005 /* When defining an abstract or interface method, the curly
6006 bracket at level 1 doesn't exist because there is no function
6008 lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
6009 EXPR_WFL_LINENO (id));
6011 /* Remember the original argument list */
6012 orig_arg = TYPE_ARG_TYPES (meth);
6014 if (patch_stage) /* includes ret type and/or all args */
6017 meth = add_method_1 (this_class, flags, meth_name, meth);
6018 /* Patch for the return type */
6019 if (patch_stage == JDEP_METHOD_RETURN)
6021 jdep = CLASSD_LAST (ctxp->classd_list);
6022 JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth));
6024 /* This is the stop JDEP. METH allows the function's signature
6026 register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE);
6029 meth = add_method (this_class, flags, meth_name,
6030 build_java_signature (meth));
6032 /* Fix the method argument list so we have the argument name
6034 fix_method_argument_names (orig_arg, meth);
6036 /* Register the parameter number and re-install the current line
6038 DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1;
6039 lineno = saved_lineno;
6041 /* Register exception specified by the `throws' keyword for
6042 resolution and set the method decl appropriate field to the list.
6043 Note: the grammar ensures that what we get here are class
6047 throws = nreverse (throws);
6048 for (current = throws; current; current = TREE_CHAIN (current))
6050 register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current),
6051 NULL_TREE, NULL_TREE);
6052 JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
6053 &TREE_VALUE (current);
6055 DECL_FUNCTION_THROWS (meth) = throws;
6058 /* We set the DECL_NAME to ID so we can track the location where
6059 the function was declared. This allow us to report
6060 redefinition error accurately. When method are verified,
6061 DECL_NAME is reinstalled properly (using the content of the
6062 WFL node ID) (see check_method_redefinition). We don't do that
6063 when Object is being defined. Constructor <init> names will be
6064 reinstalled the same way. */
6065 if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node)
6066 DECL_NAME (meth) = id;
6068 /* Set the flag if we correctly processed a constructor */
6070 DECL_CONSTRUCTOR_P (meth) = 1;
6072 /* Eventually set the @deprecated tag flag */
6073 CHECK_DEPRECATED (meth);
6075 /* If doing xref, store column and line number information instead
6076 of the line number only. */
6078 DECL_SOURCE_LINE (meth) = EXPR_WFL_LINECOL (id);
6084 fix_method_argument_names (orig_arg, meth)
6085 tree orig_arg, meth;
6087 tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth));
6088 if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE)
6090 TREE_PURPOSE (arg) = this_identifier_node;
6091 arg = TREE_CHAIN (arg);
6093 while (orig_arg != end_params_node)
6095 TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg);
6096 orig_arg = TREE_CHAIN (orig_arg);
6097 arg = TREE_CHAIN (arg);
6101 /* Complete the method declaration with METHOD_BODY. */
6104 finish_method_declaration (method_body)
6107 int flags = get_access_flags_from_decl (current_function_decl);
6109 /* 8.4.5 Method Body */
6110 if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
6112 tree wfl = DECL_NAME (current_function_decl);
6113 parse_error_context (wfl,
6114 "%s method `%s' can't have a body defined",
6115 (METHOD_NATIVE (current_function_decl) ?
6116 "Native" : "Abstract"),
6117 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
6118 method_body = NULL_TREE;
6120 else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body)
6122 tree wfl = DECL_NAME (current_function_decl);
6123 parse_error_context (wfl,
6124 "Non native and non abstract method `%s' must "
6125 "have a body defined",
6126 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
6127 method_body = NULL_TREE;
6130 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body;
6131 maybe_absorb_scoping_blocks ();
6132 /* Exit function's body */
6134 /* Merge last line of the function with first line, directly in the
6135 function decl. It will be used to emit correct debug info. */
6136 if (!flag_emit_xref)
6137 DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1);
6138 /* So we don't have an irrelevant function declaration context for
6139 the next static block we'll see. */
6140 current_function_decl = NULL_TREE;
6143 /* Build a an error message for constructor circularity errors. */
6146 constructor_circularity_msg (from, to)
6149 static char string [4096];
6150 char *t = strdup (lang_printable_name (from, 0));
6151 sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
6156 /* Verify a circular call to METH. Return 1 if an error is found, 0
6160 verify_constructor_circularity (meth, current)
6163 static tree list = NULL_TREE;
6165 for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
6167 if (TREE_VALUE (c) == meth)
6173 list = nreverse (list);
6174 for (liste = list; liste; liste = TREE_CHAIN (liste))
6177 (TREE_PURPOSE (TREE_PURPOSE (liste)),
6178 constructor_circularity_msg
6179 (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
6183 t = strdup (lang_printable_name (meth, 0));
6184 parse_error_context (TREE_PURPOSE (c),
6185 "%s: recursive invocation of constructor `%s'",
6186 constructor_circularity_msg (current, meth), t);
6192 for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
6194 list = tree_cons (c, current, list);
6195 if (verify_constructor_circularity (meth, TREE_VALUE (c)))
6197 list = TREE_CHAIN (list);
6202 /* Check modifiers that can be declared but exclusively */
6205 check_modifiers_consistency (flags)
6209 tree cl = NULL_TREE;
6211 THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl);
6212 THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl);
6213 THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl);
6216 (cl, "Inconsistent member declaration. At most one of `public', "
6217 "`private', or `protected' may be specified");
6220 /* Check the methode header METH for abstract specifics features */
6223 check_abstract_method_header (meth)
6226 int flags = get_access_flags_from_decl (meth);
6227 /* DECL_NAME might still be a WFL node */
6228 tree name = GET_METHOD_NAME (meth);
6230 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK), flags,
6231 ACC_ABSTRACT, "abstract method `%s'",
6232 IDENTIFIER_POINTER (name));
6233 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), flags,
6234 ACC_PUBLIC, "abstract method `%s'",
6235 IDENTIFIER_POINTER (name));
6237 check_modifiers ("Illegal modifier `%s' for interface method",
6238 flags, INTERFACE_METHOD_MODIFIERS);
6241 /* Create a FUNCTION_TYPE node and start augmenting it with the
6242 declared function arguments. Arguments type that can't be resolved
6243 are left as they are, but the returned node is marked as containing
6244 incomplete types. */
6247 method_declarator (id, list)
6250 tree arg_types = NULL_TREE, current, node;
6251 tree meth = make_node (FUNCTION_TYPE);
6254 patch_stage = JDEP_NO_PATCH;
6256 for (current = list; current; current = TREE_CHAIN (current))
6259 tree wfl_name = TREE_PURPOSE (current);
6260 tree type = TREE_VALUE (current);
6261 tree name = EXPR_WFL_NODE (wfl_name);
6262 tree already, arg_node;
6263 tree type_wfl = NULL_TREE;
6266 /* Obtain a suitable type for resolution, if necessary */
6267 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
6269 /* Process NAME, as it may specify extra dimension(s) for it */
6270 type = build_array_from_name (type, type_wfl, name, &name);
6271 EXPR_WFL_NODE (wfl_name) = name;
6273 real_type = GET_REAL_TYPE (type);
6274 if (TREE_CODE (real_type) == RECORD_TYPE)
6276 real_type = promote_type (real_type);
6277 if (TREE_CODE (type) == TREE_LIST)
6278 TREE_PURPOSE (type) = real_type;
6281 /* Check redefinition */
6282 for (already = arg_types; already; already = TREE_CHAIN (already))
6283 if (TREE_PURPOSE (already) == name)
6286 (wfl_name, "Variable `%s' is used more than once in the "
6287 "argument list of method `%s'", IDENTIFIER_POINTER (name),
6288 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
6292 /* If we've an incomplete argument type, we know there is a location
6293 to patch when the type get resolved, later. */
6297 patch_stage = JDEP_METHOD;
6298 type = register_incomplete_type (patch_stage,
6299 type_wfl, wfl_name, type);
6300 jdep = CLASSD_LAST (ctxp->classd_list);
6301 JDEP_MISC (jdep) = id;
6304 /* The argument node: a name and a (possibly) incomplete type */
6305 arg_node = build_tree_list (name, real_type);
6307 JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node);
6308 TREE_CHAIN (arg_node) = arg_types;
6309 arg_types = arg_node;
6311 TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node);
6312 node = build_tree_list (id, meth);
6317 unresolved_type_p (wfl, returned)
6322 if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
6324 tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
6326 *returned = (decl ? TREE_TYPE (decl) : NULL_TREE);
6334 /* From NAME, build a qualified identifier node using the
6335 qualification from the current package definition. */
6338 parser_qualified_classname (name)
6342 return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name));
6344 return EXPR_WFL_NODE (name);
6347 /* Called once the type a interface extends is resolved. Returns 0 if
6348 everything is OK. */
6351 parser_check_super_interface (super_decl, this_decl, this_wfl)
6352 tree super_decl, this_decl, this_wfl;
6354 tree super_type = TREE_TYPE (super_decl);
6356 /* Has to be an interface */
6357 if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl))))
6360 (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'",
6361 (TYPE_ARRAY_P (super_type) ? "array" : "class"),
6362 IDENTIFIER_POINTER (DECL_NAME (super_decl)),
6363 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
6364 "interface" : "class"),
6365 IDENTIFIER_POINTER (DECL_NAME (this_decl)));
6369 /* Check scope: same package OK, other package: OK if public */
6370 if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl)))
6373 SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
6374 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6375 IDENTIFIER_POINTER (DECL_NAME (super_decl))));
6379 /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
6380 0 if everthing is OK. */
6383 parser_check_super (super_decl, this_decl, wfl)
6384 tree super_decl, this_decl, wfl;
6386 tree super_type = TREE_TYPE (super_decl);
6388 /* SUPER should be a CLASS (neither an array nor an interface) */
6389 if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type)))
6392 (wfl, "Class `%s' can't subclass %s `%s'",
6393 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6394 (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"),
6395 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
6399 if (CLASS_FINAL (TYPE_NAME (super_type)))
6401 parse_error_context (wfl, "Can't subclass final classes: %s",
6402 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
6406 /* Check scope: same package OK, other package: OK if public */
6407 if (check_pkg_class_access (DECL_NAME (super_decl), wfl))
6410 SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
6411 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6412 IDENTIFIER_POINTER (DECL_NAME (super_decl))));
6416 /* Create a new dependency list and link it (in a LIFO manner) to the
6417 CTXP list of type dependency list. */
6420 create_jdep_list (ctxp)
6421 struct parser_ctxt *ctxp;
6423 jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist));
6424 new->first = new->last = NULL;
6425 new->next = ctxp->classd_list;
6426 ctxp->classd_list = new;
6430 reverse_jdep_list (ctxp)
6431 struct parser_ctxt *ctxp;
6433 register jdeplist *prev = NULL, *current, *next;
6434 for (current = ctxp->classd_list; current; current = next)
6436 next = current->next;
6437 current->next = prev;
6443 /* Create a fake pointer based on the ID stored in
6444 TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
6445 registered again. */
6448 obtain_incomplete_type (type_name)
6453 if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION)
6454 name = EXPR_WFL_NODE (type_name);
6455 else if (INCOMPLETE_TYPE_P (type_name))
6456 name = TYPE_NAME (type_name);
6458 fatal ("invalid type name - obtain_incomplete_type");
6460 for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr))
6461 if (TYPE_NAME (ptr) == name)
6466 push_obstacks (&permanent_obstack, &permanent_obstack);
6467 BUILD_PTR_FROM_NAME (ptr, name);
6470 TREE_CHAIN (ptr) = ctxp->incomplete_class;
6471 ctxp->incomplete_class = ptr;
6477 /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
6478 non NULL instead of computing a new fake type based on WFL. The new
6479 dependency is inserted in the current type dependency list, in FIFO
6483 register_incomplete_type (kind, wfl, decl, ptr)
6485 tree wfl, decl, ptr;
6487 jdep *new = (jdep *)xmalloc (sizeof (jdep));
6489 if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */
6490 ptr = obtain_incomplete_type (wfl);
6492 JDEP_KIND (new) = kind;
6493 JDEP_DECL (new) = decl;
6494 JDEP_SOLV (new) = ptr;
6495 JDEP_WFL (new) = wfl;
6496 JDEP_CHAIN (new) = NULL;
6497 JDEP_MISC (new) = NULL_TREE;
6498 JDEP_GET_PATCH (new) = (tree *)NULL;
6500 JDEP_INSERT (ctxp->classd_list, new);
6506 java_check_circular_reference ()
6509 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
6511 tree type = TREE_TYPE (current);
6512 if (CLASS_INTERFACE (TYPE_NAME (type)))
6514 /* Check all interfaces this class extends */
6515 tree basetype_vec = TYPE_BINFO_BASETYPES (type);
6520 n = TREE_VEC_LENGTH (basetype_vec);
6521 for (i = 0; i < n; i++)
6523 tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
6524 if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node
6525 && interface_of_p (type, BINFO_TYPE (vec_elt)))
6526 parse_error_context (lookup_cl (current),
6527 "Cyclic interface inheritance");
6531 if (inherits_from_p (CLASSTYPE_SUPER (type), type))
6532 parse_error_context (lookup_cl (current),
6533 "Cyclic class inheritance");
6537 /* safe_layout_class just makes sure that we can load a class without
6538 disrupting the current_class, input_file, lineno, etc, information
6539 about the class processed currently. */
6542 safe_layout_class (class)
6545 tree save_current_class = current_class;
6546 char *save_input_filename = input_filename;
6547 int save_lineno = lineno;
6549 push_obstacks (&permanent_obstack, &permanent_obstack);
6551 layout_class (class);
6554 current_class = save_current_class;
6555 input_filename = save_input_filename;
6556 lineno = save_lineno;
6557 CLASS_LOADED_P (class) = 1;
6561 jdep_resolve_class (dep)
6566 if (JDEP_RESOLVED_P (dep))
6567 decl = JDEP_RESOLVED_DECL (dep);
6570 decl = resolve_class (JDEP_TO_RESOLVE (dep),
6571 JDEP_DECL (dep), JDEP_WFL (dep));
6572 JDEP_RESOLVED (dep, decl);
6576 complete_class_report_errors (dep);
6581 /* Complete unsatisfied class declaration and their dependencies */
6584 java_complete_class ()
6591 push_obstacks (&permanent_obstack, &permanent_obstack);
6593 /* Process imports and reverse the import on demand list */
6595 if (ctxp->import_demand_list)
6596 ctxp->import_demand_list = nreverse (ctxp->import_demand_list);
6598 /* Rever things so we have the right order */
6599 ctxp->class_list = nreverse (ctxp->class_list);
6600 ctxp->classd_list = reverse_jdep_list (ctxp);
6602 for (cclassd = ctxp->classd_list, cclass = ctxp->class_list;
6604 cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd))
6607 for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep))
6610 if (!(decl = jdep_resolve_class (dep)))
6613 /* Now it's time to patch */
6614 switch (JDEP_KIND (dep))
6617 /* Simply patch super */
6618 if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
6620 BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
6621 (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
6626 /* We do part of the job done in add_field */
6627 tree field_decl = JDEP_DECL (dep);
6628 tree field_type = TREE_TYPE (decl);
6629 push_obstacks (&permanent_obstack, &permanent_obstack);
6630 if (TREE_CODE (field_type) == RECORD_TYPE)
6631 field_type = promote_type (field_type);
6633 TREE_TYPE (field_decl) = field_type;
6634 DECL_ALIGN (field_decl) = 0;
6635 layout_decl (field_decl, 0);
6636 SOURCE_FRONTEND_DEBUG
6637 (("Completed field/var decl `%s' with `%s'",
6638 IDENTIFIER_POINTER (DECL_NAME (field_decl)),
6639 IDENTIFIER_POINTER (DECL_NAME (decl))));
6642 case JDEP_METHOD: /* We start patching a method */
6643 case JDEP_METHOD_RETURN:
6649 type = TREE_TYPE(decl);
6650 if (TREE_CODE (type) == RECORD_TYPE)
6651 type = promote_type (type);
6652 JDEP_APPLY_PATCH (dep, type);
6653 SOURCE_FRONTEND_DEBUG
6654 (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ?
6655 "Completing fct `%s' with ret type `%s'":
6656 "Completing arg `%s' with type `%s'"),
6657 IDENTIFIER_POINTER (EXPR_WFL_NODE
6658 (JDEP_DECL_WFL (dep))),
6659 IDENTIFIER_POINTER (DECL_NAME (decl))));
6663 dep = JDEP_CHAIN (dep);
6664 if (JDEP_KIND (dep) == JDEP_METHOD_END)
6667 decl = jdep_resolve_class (dep);
6671 tree mdecl = JDEP_DECL (dep), signature;
6672 push_obstacks (&permanent_obstack, &permanent_obstack);
6673 /* Recompute and reset the signature */
6674 signature = build_java_signature (TREE_TYPE (mdecl));
6675 set_java_signature (TREE_TYPE (mdecl), signature);
6682 case JDEP_INTERFACE:
6683 if (parser_check_super_interface (decl, JDEP_DECL (dep),
6686 parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep));
6691 type = TREE_TYPE(decl);
6692 if (TREE_CODE (type) == RECORD_TYPE)
6693 type = promote_type (type);
6694 JDEP_APPLY_PATCH (dep, type);
6698 JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
6699 SOURCE_FRONTEND_DEBUG
6700 (("Completing a random type dependency on a '%s' node",
6701 tree_code_name [TREE_CODE (JDEP_DECL (dep))]));
6704 case JDEP_EXCEPTION:
6705 JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
6706 SOURCE_FRONTEND_DEBUG
6707 (("Completing `%s' `throws' argument node",
6708 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))));
6712 fatal ("Can't handle patch code %d - java_complete_class",
6721 /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
6725 resolve_class (class_type, decl, cl)
6726 tree class_type, decl, cl;
6728 char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type));
6730 tree resolved_type = TREE_TYPE (class_type);
6731 tree resolved_type_decl;
6733 if (resolved_type != NULL_TREE)
6735 tree resolved_type_decl = TYPE_NAME (resolved_type);
6736 if (resolved_type_decl == NULL_TREE
6737 || TREE_CODE (resolved_type_decl) == IDENTIFIER_NODE)
6739 resolved_type_decl = build_decl (TYPE_DECL,
6740 TYPE_NAME (class_type),
6743 return resolved_type_decl;
6746 /* 1- Check to see if we have an array. If true, find what we really
6748 while (name[0] == '[')
6751 TYPE_NAME (class_type) = get_identifier (name);
6753 /* 2- Resolve the bare type */
6754 if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl)))
6756 resolved_type = TREE_TYPE (resolved_type_decl);
6758 /* 3- If we have and array, reconstruct the array down to its nesting */
6761 while (base != name)
6763 if (TREE_CODE (resolved_type) == RECORD_TYPE)
6764 resolved_type = promote_type (resolved_type);
6765 resolved_type = build_java_array_type (resolved_type, -1);
6766 CLASS_LOADED_P (resolved_type) = 1;
6769 /* Build a fake decl for this, since this is what is expected to
6771 resolved_type_decl =
6772 build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type);
6773 /* Figure how those two things are important for error report. FIXME */
6774 DECL_SOURCE_LINE (resolved_type_decl) = 0;
6775 DECL_SOURCE_FILE (resolved_type_decl) = input_filename;
6776 TYPE_NAME (class_type) = TYPE_NAME (resolved_type);
6778 TREE_TYPE (class_type) = resolved_type;
6779 return resolved_type_decl;
6782 /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
6783 are used to report error messages. */
6786 do_resolve_class (class_type, decl, cl)
6791 tree new_class_decl;
6792 tree original_name = NULL_TREE;
6794 /* Do not try to replace TYPE_NAME (class_type) by a variable, since
6795 its is changed by find_in_imports{_on_demand} */
6797 /* 1- Check for the type in single imports */
6798 if (find_in_imports (class_type))
6801 /* 2- And check for the type in the current compilation unit. If it fails,
6802 try with a name qualified with the package name if appropriate. */
6803 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6805 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
6806 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
6807 load_class (TYPE_NAME (class_type), 0);
6808 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6811 original_name = TYPE_NAME (class_type);
6812 if (!QUALIFIED_P (TYPE_NAME (class_type)) && ctxp->package)
6813 TYPE_NAME (class_type) = merge_qualified_name (ctxp->package,
6814 TYPE_NAME (class_type));
6816 if (!(new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6817 load_class (TYPE_NAME (class_type), 0);
6818 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6820 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
6821 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
6822 load_class (TYPE_NAME (class_type), 0);
6823 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6826 new_name = TYPE_NAME (class_type);
6827 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_name)) != NULL_TREE)
6829 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
6830 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
6831 load_class (new_name, 0);
6832 return IDENTIFIER_CLASS_VALUE (new_name);
6836 tree class = read_class (new_name);
6837 if (class != NULL_TREE)
6839 tree decl = IDENTIFIER_CLASS_VALUE (new_name);
6840 if (decl == NULL_TREE)
6841 decl = push_class (class, new_name);
6846 TYPE_NAME (class_type) = original_name;
6848 /* 3- Check an other compilation unit that bears the name of type */
6849 load_class (TYPE_NAME (class_type), 0);
6850 if (check_pkg_class_access (TYPE_NAME (class_type),
6851 (cl ? cl : lookup_cl (decl))))
6854 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6855 return new_class_decl;
6857 /* 4- Check the import on demands. Don't allow bar.baz to be
6858 imported from foo.* */
6859 if (!QUALIFIED_P (TYPE_NAME (class_type)))
6860 if (find_in_imports_on_demand (class_type))
6863 /* 5- Last call for a resolution */
6864 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6867 /* Resolve NAME and lay it out (if not done and if not the current
6868 parsed class). Return a decl node. This function is meant to be
6869 called when type resolution is necessary during the walk pass. */
6872 resolve_and_layout (something, cl)
6878 /* Don't do that on the current class */
6879 if (something == current_class)
6880 return TYPE_NAME (current_class);
6882 /* Don't do anything for void and other primitive types */
6883 if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
6886 /* Pointer types can be reall pointer types or fake pointers. When
6887 finding a real pointer, recheck for primitive types */
6888 if (TREE_CODE (something) == POINTER_TYPE)
6890 if (TREE_TYPE (something))
6892 something = TREE_TYPE (something);
6893 if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
6897 something = TYPE_NAME (something);
6900 /* Don't do anything for arrays of primitive types */
6901 if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something)
6902 && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something)))
6905 /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
6907 if (TREE_CODE (something) != IDENTIFIER_NODE)
6908 something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ?
6909 DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something));
6911 if (!(decl = resolve_no_layout (something, cl)))
6914 /* Resolve and layout if necessary */
6915 layout_class_methods (TREE_TYPE (decl));
6916 if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))
6917 CHECK_METHODS (decl);
6918 if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
6919 safe_layout_class (TREE_TYPE (decl));
6924 /* Resolve a class, returns its decl but doesn't perform any
6925 layout. The current parsing context is saved and restored */
6928 resolve_no_layout (name, cl)
6932 BUILD_PTR_FROM_NAME (ptr, name);
6933 java_parser_context_save_global ();
6934 decl = resolve_class (ptr, NULL_TREE, cl);
6935 java_parser_context_restore_global ();
6940 /* Called when reporting errors. Skip leader '[' in a complex array
6941 type description that failed to be resolved. */
6944 purify_type_name (name)
6947 while (*name && *name == '[')
6952 /* The type CURRENT refers to can't be found. We print error messages. */
6955 complete_class_report_errors (dep)
6960 if (!JDEP_WFL (dep))
6963 name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)));
6964 switch (JDEP_KIND (dep))
6968 (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found",
6969 purify_type_name (name),
6970 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6974 (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'",
6975 purify_type_name (name),
6976 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6978 case JDEP_METHOD: /* Covers arguments */
6980 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
6981 "argument `%s' of method `%s'",
6982 purify_type_name (name),
6983 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))),
6984 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep))));
6986 case JDEP_METHOD_RETURN: /* Covers return type */
6988 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
6989 "return type of method `%s'",
6990 purify_type_name (name),
6991 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
6993 case JDEP_INTERFACE:
6995 (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found",
6996 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
6997 (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")),
6998 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7002 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
7003 "local variable `%s'",
7004 purify_type_name (IDENTIFIER_POINTER
7005 (EXPR_WFL_NODE (JDEP_WFL (dep)))),
7006 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7008 case JDEP_EXCEPTION: /* As specified by `throws' */
7010 (JDEP_WFL (dep), "Class `%s' not found in `throws'",
7011 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))));
7014 /* Fix for -Wall. Just break doing nothing. The error will be
7020 /* Check uninitialized final. */
7027 /* Return a static string containing the DECL prototype string. If
7028 DECL is a constructor, use the class name instead of the form
7032 get_printable_method_name (decl)
7036 tree name = NULL_TREE;
7038 if (DECL_CONSTRUCTOR_P (decl))
7040 name = DECL_NAME (decl);
7041 DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
7044 to_return = lang_printable_name (decl, 0);
7045 if (DECL_CONSTRUCTOR_P (decl))
7046 DECL_NAME (decl) = name;
7051 /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
7052 nevertheless needs to be verfied, 1 otherwise. */
7055 reset_method_name (method)
7058 if (!IS_CLINIT (method) && DECL_NAME (method) != finit_identifier_node)
7060 /* NAME is just the plain name when Object is being defined */
7061 if (DECL_CONTEXT (method) != object_type_node)
7062 DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ?
7063 init_identifier_node : GET_METHOD_NAME (method));
7070 /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
7073 java_get_real_method_name (method_decl)
7076 tree method_name = DECL_NAME (method_decl);
7077 if (DECL_CONSTRUCTOR_P (method_decl))
7078 return init_identifier_node;
7080 /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
7081 and still can be a constructor. FIXME */
7083 /* Don't confuse method only bearing the name of their class as
7085 else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl))
7087 && ctxp->current_parsed_class_un == EXPR_WFL_NODE (method_name)
7088 && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED
7089 && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node)
7090 return init_identifier_node;
7092 return EXPR_WFL_NODE (method_name);
7095 /* Track method being redefined inside the same class. As a side
7096 effect, set DECL_NAME to an IDENTIFIER (prior entering this
7097 function it's a FWL, so we can track errors more accurately */
7100 check_method_redefinition (class, method)
7104 tree cl = DECL_NAME (method);
7105 tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
7106 /* decl name of artificial <clinit> and $finit$ doesn't need to be
7107 fixed and checked */
7109 /* Reset the method name before running the check. If it returns 1,
7110 the method doesn't need to be verified with respect to method
7111 redeclaration and we return 0 */
7112 if (reset_method_name (method))
7115 name = DECL_NAME (method);
7116 for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
7118 if (redef == method)
7120 if (DECL_NAME (redef) == name
7121 && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef)))
7124 (cl, "Duplicate %s declaration `%s'",
7125 (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
7126 get_printable_method_name (redef));
7133 /* Check all the methods of CLASS. Methods are first completed then
7134 checked according to regular method existance rules.
7135 If no constructor were encountered, then build its declaration. */
7138 java_check_regular_methods (class_decl)
7141 int saw_constructor = 0;
7143 tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl));
7144 tree super_class = CLASSTYPE_SUPER (class);
7145 tree saved_found_wfl = NULL_TREE, found = NULL_TREE;
7148 /* It is not necessary to check methods defined in java.lang.Object */
7149 if (class == object_type_node)
7152 if (!TYPE_NVIRTUALS (class))
7153 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7155 /* Should take interfaces into account. FIXME */
7156 for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method))
7159 tree method_wfl = DECL_NAME (method);
7162 /* If we previously found something and its name was saved,
7164 if (found && saved_found_wfl)
7166 DECL_NAME (found) = saved_found_wfl;
7167 saved_found_wfl = NULL_TREE;
7170 /* Check for redefinitions */
7171 if (check_method_redefinition (class, method))
7174 /* If we see one constructor a mark so we don't generate the
7175 default one. Also skip other verifications: constructors
7176 can't be inherited hence hiden or overriden */
7177 if (DECL_CONSTRUCTOR_P (method))
7179 saw_constructor = 1;
7183 /* We verify things thrown by the method. They must inherits from
7184 java.lang.Throwable */
7185 for (mthrows = DECL_FUNCTION_THROWS (method);
7186 mthrows; mthrows = TREE_CHAIN (mthrows))
7188 if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node))
7190 (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be "
7191 "a subclass of class `java.lang.Throwable'",
7193 (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
7196 sig = build_java_argument_signature (TREE_TYPE (method));
7197 found = lookup_argument_method (super_class, DECL_NAME (method), sig);
7199 /* Nothing overrides or it's a private method. */
7202 if (METHOD_PRIVATE (found))
7208 /* If found wasn't verified, it's DECL_NAME won't be set properly.
7209 We set it temporarily for the sake of the error report. */
7210 saved_found_wfl = DECL_NAME (found);
7211 reset_method_name (found);
7213 /* Can't override a method with the same name and different return
7215 if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
7217 char *t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)),
7221 "Method `%s' was defined with return type `%s' in class `%s'",
7222 lang_printable_name (found, 0), t,
7224 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7228 aflags = get_access_flags_from_decl (found);
7229 /* If the method has default, access in an other package, then
7230 issue a warning that the current method doesn't override the
7231 one that was found elsewhere. Do not issue this warning when
7232 the match was found in java.lang.Object. */
7233 if (DECL_CONTEXT (found) != object_type_node
7234 && ((aflags & 0x7) == 0)
7235 && !class_in_current_package (DECL_CONTEXT (found))
7236 && DECL_NAME (found) != clinit_identifier_node
7237 && flag_not_overriding)
7239 parse_warning_context
7240 (method_wfl, "Method `%s' in class `%s' does not "
7241 "override the corresponding method in class `%s', which is "
7242 "private to a different package",
7243 lang_printable_name (found, 0),
7244 IDENTIFIER_POINTER (DECL_NAME (class_decl)),
7245 IDENTIFIER_POINTER (DECL_NAME
7246 (TYPE_NAME (DECL_CONTEXT (found)))));
7250 /* Can't override final. Can't override static. */
7251 if (METHOD_FINAL (found) || METHOD_STATIC (found))
7253 /* Static *can* override static */
7254 if (METHOD_STATIC (found) && METHOD_STATIC (method))
7258 "%s methods can't be overriden. Method `%s' is %s in class `%s'",
7259 (METHOD_FINAL (found) ? "Final" : "Static"),
7260 lang_printable_name (found, 0),
7261 (METHOD_FINAL (found) ? "final" : "static"),
7263 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7267 /* Static method can't override instance method. */
7268 if (METHOD_STATIC (method))
7272 "Instance methods can't be overriden by a static method. Method "
7273 "`%s' is an instance method in class `%s'",
7274 lang_printable_name (found, 0),
7276 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7280 /* - Overriding/hiding public must be public
7281 - Overriding/hiding protected must be protected or public
7282 - If the overriden or hidden method has default (package)
7283 access, then the overriding or hiding method must not be
7284 private; otherwise, a compile-time error occurs */
7285 if ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method))
7286 || (METHOD_PROTECTED (found)
7287 && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method)))
7288 || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC))
7289 && METHOD_PRIVATE (method)))
7293 "Methods can't be overridden to be more private. Method `%s' is "
7294 "not %s in class `%s'", lang_printable_name (method, 0),
7295 (METHOD_PUBLIC (method) ? "public" :
7296 (METHOD_PRIVATE (method) ? "private" : "protected")),
7297 IDENTIFIER_POINTER (DECL_NAME
7298 (TYPE_NAME (DECL_CONTEXT (found)))));
7302 /* Overriding methods must have compatible `throws' clauses on checked
7303 exceptions, if any */
7304 check_throws_clauses (method, method_wfl, found);
7306 /* Inheriting multiple methods with the same signature. FIXME */
7309 /* Don't forget eventual pending found and saved_found_wfl. Take
7310 into account that we might have exited because we saw an
7311 aritifical method as the last entry. */
7313 if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
7314 DECL_NAME (found) = saved_found_wfl;
7316 if (!TYPE_NVIRTUALS (class))
7317 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7319 if (!saw_constructor)
7321 /* No constructor seen, we craft one, at line 0. Since this
7322 operation takes place after we laid methods out
7323 (layout_class_methods), we prepare the its DECL
7328 /* If the class is declared PUBLIC, the default constructor is
7329 PUBLIC otherwise it has default access implied by no access
7331 flags = (get_access_flags_from_decl (class_decl) & ACC_PUBLIC ?
7333 decl = create_artificial_method (class, flags, void_type_node,
7334 init_identifier_node, end_params_node);
7335 DECL_CONSTRUCTOR_P (decl) = 1;
7336 layout_class_method (TREE_TYPE (class_decl), NULL_TREE, decl, NULL_TREE);
7340 /* Return a non zero value if the `throws' clause of METHOD (if any)
7341 is incompatible with the `throws' clause of FOUND (if any). */
7344 check_throws_clauses (method, method_wfl, found)
7345 tree method, method_wfl, found;
7347 tree mthrows, fthrows;
7349 /* Can't check these things with class loaded from bytecode. FIXME */
7350 if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found)))
7353 for (mthrows = DECL_FUNCTION_THROWS (method);
7354 mthrows; mthrows = TREE_CHAIN (mthrows))
7356 /* We don't verify unchecked expressions */
7357 if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows)))
7359 /* Checked expression must be compatible */
7360 for (fthrows = DECL_FUNCTION_THROWS (found);
7361 fthrows; fthrows = TREE_CHAIN (fthrows))
7362 if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows)))
7367 (method_wfl, "Invalid checked exception class `%s' in "
7368 "`throws' clause. The exception must be a subclass of an "
7369 "exception thrown by `%s' from class `%s'",
7370 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
7371 lang_printable_name (found, 0),
7373 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7378 /* Check abstract method of interface INTERFACE */
7381 java_check_abstract_methods (interface_decl)
7382 tree interface_decl;
7385 tree method, basetype_vec, found;
7386 tree interface = TREE_TYPE (interface_decl);
7388 for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method))
7390 tree method_wfl = DECL_NAME (method);
7392 /* 2- Check for double definition inside the defining interface */
7393 if (check_method_redefinition (interface, method))
7396 /* 3- Overriding is OK as far as we preserve the return type and
7397 the thrown exceptions (FIXME) */
7398 found = lookup_java_interface_method2 (interface, method);
7402 tree saved_found_wfl = DECL_NAME (found);
7403 reset_method_name (found);
7404 t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
7407 "Method `%s' was defined with return type `%s' in class `%s'",
7408 lang_printable_name (found, 0), t,
7410 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7414 DECL_NAME (found) = saved_found_wfl;
7418 /* 4- Inherited methods can't differ by their returned types */
7419 if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface)))
7421 n = TREE_VEC_LENGTH (basetype_vec);
7422 for (i = 0; i < n; i++)
7424 tree sub_interface_method, sub_interface;
7425 tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
7428 sub_interface = BINFO_TYPE (vec_elt);
7429 for (sub_interface_method = TYPE_METHODS (sub_interface);
7430 sub_interface_method;
7431 sub_interface_method = TREE_CHAIN (sub_interface_method))
7433 found = lookup_java_interface_method2 (interface,
7434 sub_interface_method);
7435 if (found && (found != sub_interface_method))
7437 tree saved_found_wfl = DECL_NAME (found);
7438 reset_method_name (found);
7440 (lookup_cl (sub_interface_method),
7441 "Interface `%s' inherits method `%s' from interface `%s'. "
7442 "This method is redefined with a different return type in "
7444 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
7445 lang_printable_name (found, 0),
7447 (DECL_NAME (TYPE_NAME
7448 (DECL_CONTEXT (sub_interface_method)))),
7450 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7451 DECL_NAME (found) = saved_found_wfl;
7457 /* Lookup methods in interfaces using their name and partial
7458 signature. Return a matching method only if their types differ. */
7461 lookup_java_interface_method2 (class, method_decl)
7462 tree class, method_decl;
7465 tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return;
7470 n = TREE_VEC_LENGTH (basetype_vec);
7471 for (i = 0; i < n; i++)
7473 tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return;
7474 if ((BINFO_TYPE (vec_elt) != object_type_node)
7476 lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1)))
7479 for (i = 0; i < n; i++)
7481 to_return = lookup_java_interface_method2
7482 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl);
7490 /* Lookup method using their name and partial signature. Return a
7491 matching method only if their types differ. */
7494 lookup_java_method2 (clas, method_decl, do_interface)
7495 tree clas, method_decl;
7498 tree method, method_signature, method_name, method_type, name;
7500 method_signature = build_java_argument_signature (TREE_TYPE (method_decl));
7501 name = DECL_NAME (method_decl);
7502 method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
7503 EXPR_WFL_NODE (name) : name);
7504 method_type = TREE_TYPE (TREE_TYPE (method_decl));
7506 while (clas != NULL_TREE)
7508 for (method = TYPE_METHODS (clas);
7509 method != NULL_TREE; method = TREE_CHAIN (method))
7511 tree method_sig = build_java_argument_signature (TREE_TYPE (method));
7512 tree name = DECL_NAME (method);
7513 if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
7514 EXPR_WFL_NODE (name) : name) == method_name
7515 && method_sig == method_signature
7516 && TREE_TYPE (TREE_TYPE (method)) != method_type)
7519 clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas));
7524 /* Return the line that matches DECL line number. Used during error
7531 static tree cl = NULL_TREE;
7536 if (cl == NULL_TREE)
7537 cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
7539 EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
7540 EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
7545 /* Look for a simple name in the single-type import list */
7548 find_name_in_single_imports (name)
7553 for (node = ctxp->import_list; node; node = TREE_CHAIN (node))
7554 if (TREE_VALUE (node) == name)
7555 return (EXPR_WFL_NODE (TREE_PURPOSE (node)));
7560 /* Process all single-type import. */
7568 for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
7570 tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
7572 /* Don't load twice something already defined. */
7573 if (IDENTIFIER_CLASS_VALUE (to_be_found))
7575 QUALIFIED_P (to_be_found) = 1;
7576 load_class (to_be_found, 0);
7578 check_pkg_class_access (to_be_found, TREE_PURPOSE (import));
7579 if (!IDENTIFIER_CLASS_VALUE (to_be_found))
7581 parse_error_context (TREE_PURPOSE (import),
7582 "Class or interface `%s' not found in import",
7583 IDENTIFIER_POINTER (to_be_found));
7592 /* Possibly find a class imported by a single-type import statement. Return
7593 1 if an error occured, 0 otherwise. */
7596 find_in_imports (class_type)
7601 for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
7602 if (TREE_VALUE (import) == TYPE_NAME (class_type))
7604 TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import));
7605 QUALIFIED_P (TYPE_NAME (class_type)) = 1;
7611 note_possible_classname (name, len)
7616 if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0)
7618 else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0)
7622 node = ident_subst (name, len, "", '/', '.', "");
7623 IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
7624 QUALIFIED_P (node) = strchr (name, '/') ? 1 : 0;
7628 /* Read a import directory, gathering potential match for further type
7629 references. Indifferently reads a filesystem or a ZIP archive
7633 read_import_dir (wfl)
7636 tree package_id = EXPR_WFL_NODE (wfl);
7637 char *package_name = IDENTIFIER_POINTER (package_id);
7638 int package_length = IDENTIFIER_LENGTH (package_id);
7640 JCF *saved_jcf = current_jcf;
7645 struct buffer filename[1];
7648 if (IS_AN_IMPORT_ON_DEMAND_P (package_id))
7650 IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1;
7652 BUFFER_INIT (filename);
7653 buffer_grow (filename, package_length + 100);
7655 for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
7657 char *entry_name = jcf_path_name (entry);
7658 int entry_length = strlen (entry_name);
7659 if (jcf_path_is_zipfile (entry))
7662 buffer_grow (filename, entry_length);
7663 memcpy (filename->data, entry_name, entry_length - 1);
7664 filename->data[entry_length-1] = '\0';
7665 zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry));
7667 error ("malformed .zip archive in CLASSPATH: %s", entry_name);
7670 ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory;
7671 BUFFER_RESET (filename);
7672 for (k = 0; k < package_length; k++)
7674 char ch = package_name[k];
7675 *filename->ptr++ = ch == '.' ? '/' : ch;
7677 *filename->ptr++ = '/';
7679 for (k = 0; k < zipf->count; k++, zipd = ZIPDIR_NEXT (zipd))
7681 char *current_entry = ZIPDIR_FILENAME (zipd);
7682 int current_entry_len = zipd->filename_length;
7684 if (current_entry_len >= BUFFER_LENGTH (filename)
7685 && strncmp (filename->data, current_entry,
7686 BUFFER_LENGTH (filename)) != 0)
7688 found |= note_possible_classname (current_entry,
7695 BUFFER_RESET (filename);
7696 buffer_grow (filename, entry_length + package_length + 4);
7697 strcpy (filename->data, entry_name);
7698 filename->ptr = filename->data + entry_length;
7699 for (k = 0; k < package_length; k++)
7701 char ch = package_name[k];
7702 *filename->ptr++ = ch == '.' ? '/' : ch;
7704 *filename->ptr = '\0';
7706 dirp = opendir (filename->data);
7709 *filename->ptr++ = '/';
7714 struct dirent *direntp = readdir (dirp);
7717 d_name = direntp->d_name;
7718 len = strlen (direntp->d_name);
7719 buffer_grow (filename, len+1);
7720 strcpy (filename->ptr, d_name);
7721 found |= note_possible_classname (filename->data + entry_length,
7722 package_length+len+1);
7729 free (filename->data);
7731 /* Here we should have a unified way of retrieving an entry, to be
7735 static int first = 1;
7739 sprintf (buffer, "Can't find default package `%s'. Check "
7740 "the CLASSPATH environment variable and the access to the "
7741 "archives.", package_name);
7747 parse_error_context (wfl, "Package `%s' not found in import",
7749 current_jcf = saved_jcf;
7752 current_jcf = saved_jcf;
7755 /* Possibly find a type in the import on demands specified
7756 types. Returns 1 if an error occured, 0 otherwise. Run throught the
7757 entire list, to detected potential double definitions. */
7760 find_in_imports_on_demand (class_type)
7763 tree node, import, node_to_use = NULL_TREE;
7765 tree cl = NULL_TREE;
7767 for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import))
7770 obstack_grow (&temporary_obstack,
7771 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
7772 IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
7773 obstack_1grow (&temporary_obstack, '.');
7774 obstack_grow0 (&temporary_obstack,
7775 IDENTIFIER_POINTER (TYPE_NAME (class_type)),
7776 IDENTIFIER_LENGTH (TYPE_NAME (class_type)));
7777 id_name = obstack_finish (&temporary_obstack);
7779 node = maybe_get_identifier (id_name);
7780 if (node && IS_A_CLASSFILE_NAME (node))
7784 cl = TREE_PURPOSE (import);
7792 (import, "Type `%s' also potentially defined in package `%s'",
7793 IDENTIFIER_POINTER (TYPE_NAME (class_type)),
7794 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))));
7801 /* Setup lineno so that it refers to the line of the import (in
7802 case we parse a class file and encounter errors */
7804 int saved_lineno = lineno;
7805 lineno = EXPR_WFL_LINENO (cl);
7806 TYPE_NAME (class_type) = node_to_use;
7807 QUALIFIED_P (TYPE_NAME (class_type)) = 1;
7808 decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7809 /* If there is no DECL set for the class or if the class isn't
7810 loaded and not seen in source yet, the load */
7811 if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl))
7812 && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl))))
7813 load_class (node_to_use, 0);
7814 lineno = saved_lineno;
7815 return check_pkg_class_access (TYPE_NAME (class_type), cl);
7818 return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
7822 resolve_package (pkg, next)
7825 tree type_name = NULL_TREE;
7826 char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg));
7828 /* The trick is to determine when the package name stops and were
7829 the name of something contained in the package starts. Then we
7830 return a fully qualified name of what we want to get. */
7832 /* Do a quick search on well known package names */
7833 if (!strncmp (name, "java.lang.reflect", 17))
7836 TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg))));
7837 type_name = lookup_package_type (name, 17);
7839 else if (!strncmp (name, "java.lang", 9))
7841 *next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)));
7842 type_name = lookup_package_type (name, 9);
7845 return NULL_TREE; /* FIXME, search all imported packages. */
7851 lookup_package_type (name, from)
7856 char *sub = &name[from+1];
7857 while (*sub != '.' && *sub)
7859 strncpy (subname, name, sub-name);
7860 subname [sub-name] = '\0';
7861 return get_identifier (subname);
7864 /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
7865 access violations were found, 1 otherwise. */
7868 check_pkg_class_access (class_name, cl)
7874 if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name))
7877 if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name))))
7880 if (!CLASS_PUBLIC (TYPE_NAME (type)))
7882 /* Access to a private class within the same package is
7885 breakdown_qualified (&l, &r, class_name);
7886 if (l == ctxp->package)
7890 (cl, "Can't access %s `%s'. Only public classes and interfaces in "
7891 "other packages can be accessed",
7892 (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
7893 IDENTIFIER_POINTER (class_name));
7899 /* Local variable declaration. */
7902 declare_local_variables (modifier, type, vlist)
7907 tree decl, current, saved_type;
7908 tree type_wfl = NULL_TREE;
7911 /* Push a new block if statements were seen between the last time we
7912 pushed a block and now. Keep a cound of block to close */
7913 if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl)))
7915 tree body = GET_CURRENT_BLOCK (current_function_decl);
7916 tree b = enter_block ();
7917 BLOCK_EXPR_ORIGIN (b) = body;
7923 for (i = 0; i <= 10; i++) if (1 << i & modifier) break;
7924 if (modifier == ACC_FINAL)
7926 if (flag_static_local_jdk1_1)
7927 parse_warning_context (ctxp->modifier_ctx [i],
7928 "Unsupported JDK1.1 `final' local variable "
7929 "(treated as non final)");
7934 (ctxp->modifier_ctx [i],
7935 "Only `final' is allowed as a local variables modifier");
7940 /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
7941 hold the TYPE value if a new incomplete has to be created (as
7942 opposed to being found already existing and reused). */
7943 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
7945 /* If TYPE is fully resolved and we don't have a reference, make one */
7946 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
7948 /* Go through all the declared variables */
7949 for (current = vlist, saved_type = type; current;
7950 current = TREE_CHAIN (current), type = saved_type)
7952 tree other, real_type;
7953 tree wfl = TREE_PURPOSE (current);
7954 tree name = EXPR_WFL_NODE (wfl);
7955 tree init = TREE_VALUE (current);
7957 /* Process NAME, as it may specify extra dimension(s) for it */
7958 type = build_array_from_name (type, type_wfl, name, &name);
7960 /* Variable redefinition check */
7961 if ((other = lookup_name_in_blocks (name)))
7963 variable_redefinition_error (wfl, name, TREE_TYPE (other),
7964 DECL_SOURCE_LINE (other));
7968 /* Type adjustment. We may have just readjusted TYPE because
7969 the variable specified more dimensions. Make sure we have
7970 a reference if we can and don't have one already. */
7971 PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
7973 real_type = GET_REAL_TYPE (type);
7974 /* Never layout this decl. This will be done when its scope
7976 decl = build_decl (VAR_DECL, name, real_type);
7977 BLOCK_CHAIN_DECL (decl);
7979 /* If doing xreferencing, replace the line number with the WFL
7982 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl);
7984 /* Don't try to use an INIT statement when an error was found */
7985 if (init && java_error_count)
7988 /* Add the initialization function to the current function's code */
7991 /* Name might have been readjusted */
7992 EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name;
7993 MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
7994 java_method_add_stmt (current_function_decl,
7995 build_debugable_stmt (EXPR_WFL_LINECOL (init),
7999 /* Setup dependency the type of the decl */
8003 register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type);
8004 dep = CLASSD_LAST (ctxp->classd_list);
8005 JDEP_GET_PATCH (dep) = &TREE_TYPE (decl);
8008 SOURCE_FRONTEND_DEBUG (("Defined locals"));
8011 /* Called during parsing. Build decls from argument list. */
8014 source_start_java_method (fndecl)
8021 current_function_decl = fndecl;
8023 /* New scope for the function */
8025 for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
8026 tem != end_params_node; tem = TREE_CHAIN (tem), i++)
8028 tree type = TREE_VALUE (tem);
8029 tree name = TREE_PURPOSE (tem);
8031 /* If type is incomplete. Create an incomplete decl and ask for
8032 the decl to be patched later */
8033 if (INCOMPLETE_TYPE_P (type))
8036 tree real_type = GET_REAL_TYPE (type);
8037 parm_decl = build_decl (PARM_DECL, name, real_type);
8038 type = obtain_incomplete_type (type);
8039 register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type);
8040 jdep = CLASSD_LAST (ctxp->classd_list);
8041 JDEP_MISC (jdep) = name;
8042 JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl);
8045 parm_decl = build_decl (PARM_DECL, name, type);
8047 BLOCK_CHAIN_DECL (parm_decl);
8049 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
8050 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) =
8052 DECL_ARG_SLOT_COUNT (current_function_decl) = i;
8055 /* Called during parsing. Creates an artificial method declaration. */
8058 create_artificial_method (class, flags, type, name, args)
8061 tree type, name, args;
8063 int saved_lineno = lineno;
8067 mdecl = make_node (FUNCTION_TYPE);
8068 TREE_TYPE (mdecl) = type;
8069 TYPE_ARG_TYPES (mdecl) = args;
8070 mdecl = add_method (class, flags, name, build_java_signature (mdecl));
8071 lineno = saved_lineno;
8072 DECL_ARTIFICIAL (mdecl) = 1;
8076 /* Starts the body if an artifical method. */
8079 start_artificial_method_body (mdecl)
8082 DECL_SOURCE_LINE (mdecl) = 1;
8083 DECL_SOURCE_LINE_MERGE (mdecl, 1);
8084 source_start_java_method (mdecl);
8089 end_artificial_method_body (mdecl)
8092 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block ();
8096 /* Called during expansion. Push decls formerly built from argument
8097 list so they're usable during expansion. */
8100 expand_start_java_method (fndecl)
8105 current_function_decl = fndecl;
8107 announce_function (fndecl);
8108 pushlevel (1); /* Push parameters */
8109 ptr = &DECL_ARGUMENTS (fndecl);
8110 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
8113 tree next = TREE_CHAIN (tem);
8114 tree type = TREE_TYPE (tem);
8115 #ifdef PROMOTE_PROTOTYPES
8116 if (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
8117 && INTEGRAL_TYPE_P (type))
8118 type = integer_type_node;
8120 DECL_ARG_TYPE (tem) = type;
8121 layout_decl (tem, 0);
8124 ptr = &TREE_CHAIN (tem);
8128 pushdecl_force_head (DECL_ARGUMENTS (fndecl));
8129 lineno = DECL_SOURCE_LINE_FIRST (fndecl);
8132 /* Terminate a function and expand its body. */
8135 source_end_java_method ()
8137 tree fndecl = current_function_decl;
8138 int flag_asynchronous_exceptions = asynchronous_exceptions;
8140 java_parser_context_save_global ();
8141 lineno = ctxp->last_ccb_indent1;
8143 /* Set EH language codes */
8144 java_set_exception_lang_code ();
8146 /* Turn function bodies with only a NOP expr null, so they don't get
8147 generated at all and we won't get warnings when using the -W
8149 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node)
8150 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
8152 /* Generate function's code */
8153 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
8154 && ! flag_emit_class_files
8155 && ! flag_emit_xref)
8156 expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)));
8158 /* pop out of its parameters */
8159 pushdecl_force_head (DECL_ARGUMENTS (fndecl));
8161 BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
8163 /* Generate rtl for function exit. */
8164 if (! flag_emit_class_files && ! flag_emit_xref)
8166 lineno = DECL_SOURCE_LINE_LAST (fndecl);
8167 /* Emit catch-finally clauses */
8169 expand_function_end (input_filename, lineno, 0);
8171 /* FIXME: If the current method contains any exception handlers,
8172 force asynchronous_exceptions: this is necessary because signal
8173 handlers in libjava may throw exceptions. This is far from being
8174 a perfect solution, but it's better than doing nothing at all.*/
8176 asynchronous_exceptions = 1;
8178 /* Run the optimizers and output assembler code for this function. */
8179 rest_of_compilation (fndecl);
8182 current_function_decl = NULL_TREE;
8183 /* permanent_allocation (1); */
8184 java_parser_context_restore_global ();
8185 asynchronous_exceptions = flag_asynchronous_exceptions;
8188 /* Record EXPR in the current function block. Complements compound
8189 expression second operand if necessary. */
8192 java_method_add_stmt (fndecl, expr)
8195 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
8199 add_stmt_to_block (b, type, stmt)
8202 tree body = BLOCK_EXPR_BODY (b), c;
8204 if (java_error_count)
8207 if ((c = add_stmt_to_compound (body, type, stmt)) == body)
8210 BLOCK_EXPR_BODY (b) = c;
8211 TREE_SIDE_EFFECTS (c) = 1;
8215 /* Add STMT to EXISTING if possible, otherwise create a new
8216 COMPOUND_EXPR and add STMT to it. */
8219 add_stmt_to_compound (existing, type, stmt)
8220 tree existing, type, stmt;
8223 return build (COMPOUND_EXPR, type, existing, stmt);
8228 /* Hold THIS for the scope of the current public method decl. */
8229 static tree current_this;
8231 void java_layout_seen_class_methods ()
8233 tree previous_list = all_class_list;
8234 tree end = NULL_TREE;
8239 for (current = previous_list;
8240 current != end; current = TREE_CHAIN (current))
8241 layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
8243 if (previous_list != all_class_list)
8245 end = previous_list;
8246 previous_list = all_class_list;
8253 /* Layout the methods of all classes loaded in one way on an
8254 other. Check methods of source parsed classes. Then reorder the
8255 fields and layout the classes or the type of all source parsed
8259 java_layout_classes ()
8262 int save_error_count = java_error_count;
8264 /* Layout the methods of all classes seen so far */
8265 java_layout_seen_class_methods ();
8266 java_parse_abort_on_error ();
8267 all_class_list = NULL_TREE;
8269 /* Then check the methods of all parsed classes */
8270 for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
8271 if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current))))
8272 CHECK_METHODS (TREE_VALUE (current));
8273 java_parse_abort_on_error ();
8275 for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
8277 current_class = TREE_TYPE (TREE_VALUE (current));
8279 /* Reverse the fields, but leave the dummy field in front.
8280 Fields are already ordered for Object and Class */
8281 if (TYPE_FIELDS (current_class) && current_class != object_type_node
8282 && current_class != class_type_node)
8284 /* If the dummy field is there, reverse the right fields and
8285 just layout the type for proper fields offset */
8286 if (!DECL_NAME (TYPE_FIELDS (current_class)))
8288 tree fields = TYPE_FIELDS (current_class);
8289 TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields));
8290 TYPE_SIZE (current_class) = NULL_TREE;
8291 layout_type (current_class);
8293 /* We don't have a dummy field, we need to layout the class,
8294 after having reversed the fields */
8297 TYPE_FIELDS (current_class) =
8298 nreverse (TYPE_FIELDS (current_class));
8299 TYPE_SIZE (current_class) = NULL_TREE;
8300 layout_class (current_class);
8304 layout_class (current_class);
8306 /* From now on, the class is considered completely loaded */
8307 CLASS_LOADED_P (current_class) = 1;
8309 /* Error reported by the caller */
8310 if (java_error_count)
8314 /* We might have reloaded classes durign the process of laying out
8315 classes for code generation. We must layout the methods of those
8316 late additions, as constructor checks might use them */
8317 java_layout_seen_class_methods ();
8318 java_parse_abort_on_error ();
8321 /* Expand all methods in all registered classes. */
8324 java_complete_expand_methods ()
8328 do_not_fold = flag_emit_xref;
8330 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
8333 tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current));
8336 current_class = TREE_TYPE (current);
8337 is_interface = CLASS_INTERFACE (TYPE_NAME (current_class));
8339 /* Initialize a new constant pool */
8340 init_outgoing_cpool ();
8342 /* We want <clinit> (if any) to be processed first. */
8343 decl = tree_last (TYPE_METHODS (class_type));
8344 if (IS_CLINIT (decl))
8346 tree fbody = DECL_FUNCTION_BODY (decl);
8348 if (fbody != NULL_TREE)
8350 /* First check if we can ignore empty <clinit> */
8351 tree block_body = BLOCK_EXPR_BODY (fbody);
8353 current_this = NULL_TREE;
8354 current_function_decl = decl;
8355 if (block_body != NULL_TREE)
8357 /* Prevent the use of `this' inside <clinit> */
8358 ctxp->explicit_constructor_p = 1;
8360 block_body = java_complete_tree (block_body);
8361 ctxp->explicit_constructor_p = 0;
8362 BLOCK_EXPR_BODY (fbody) = block_body;
8363 if (block_body != NULL_TREE
8364 && TREE_CODE (block_body) == BLOCK
8365 && BLOCK_EXPR_BODY (block_body) == empty_stmt_node)
8369 list = nreverse (TREE_CHAIN (nreverse (TYPE_METHODS (class_type))));
8370 if (decl != NULL_TREE)
8372 TREE_CHAIN (decl) = list;
8373 TYPE_METHODS (class_type) = decl;
8376 TYPE_METHODS (class_type) = list;
8379 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
8381 current_function_decl = decl;
8382 /* Don't generate debug info on line zero when expanding a
8383 generated constructor. */
8384 if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl))
8386 /* If we found errors, it's too dangerous to try to
8387 generate and expand a constructor */
8388 if (!java_error_count)
8390 restore_line_number_status (1);
8391 java_complete_expand_method (decl);
8392 restore_line_number_status (0);
8395 else if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl))
8398 java_complete_expand_method (decl);
8401 /* Now verify constructor circularity (stop after the first one
8404 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
8405 if (DECL_CONSTRUCTOR_P (decl) &&
8406 verify_constructor_circularity (decl, decl))
8409 /* Make the class data, register it and run the rest of decl
8410 compilation on it */
8411 if (!java_error_count)
8413 if (flag_emit_class_files)
8414 write_classfile (current_class);
8416 expand_xref (current_class);
8417 else if (! flag_syntax_only)
8418 finish_class (current_class);
8423 /* Hold a list of catch clauses list. The first element of this list is
8424 the list of the catch clauses of the currently analysed try block. */
8425 static tree currently_caught_type_list;
8427 /* Complete and expand a method. */
8430 java_complete_expand_method (mdecl)
8433 /* Fix constructors before expanding them */
8434 if (DECL_CONSTRUCTOR_P (mdecl))
8435 fix_constructors (mdecl);
8437 /* Expand functions that have a body */
8438 if (DECL_FUNCTION_BODY (mdecl))
8440 tree fbody = DECL_FUNCTION_BODY (mdecl);
8441 tree block_body = BLOCK_EXPR_BODY (fbody);
8442 tree exception_copy;
8443 expand_start_java_method (mdecl);
8444 build_result_decl (mdecl);
8447 = (!METHOD_STATIC (mdecl) ?
8448 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
8450 /* Purge the `throws' list of unchecked exceptions. If we're
8451 doing xref, save a copy of the list and re-install it
8454 exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl));
8456 purge_unchecked_exceptions (mdecl);
8458 /* Install exceptions thrown with `throws' */
8459 PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
8461 if (block_body != NULL_TREE)
8463 block_body = java_complete_tree (block_body);
8464 if (!flag_emit_xref)
8465 check_for_initialization (block_body);
8466 ctxp->explicit_constructor_p = 0;
8468 BLOCK_EXPR_BODY (fbody) = block_body;
8470 if ((block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body))
8471 && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE
8473 missing_return_error (current_function_decl);
8475 complete_start_java_method (mdecl);
8477 /* Don't go any further if we've found error(s) during the
8479 if (!java_error_count)
8480 source_end_java_method ();
8483 pushdecl_force_head (DECL_ARGUMENTS (mdecl));
8487 /* Pop the exceptions and sanity check */
8489 if (currently_caught_type_list)
8490 fatal ("Exception list non empty - java_complete_expand_method");
8493 DECL_FUNCTION_THROWS (mdecl) = exception_copy;
8497 /* Craft a body for default constructor. Patch existing constructor
8498 bodies with call to super() and field initialization statements if
8502 fix_constructors (mdecl)
8505 tree body = DECL_FUNCTION_BODY (mdecl);
8509 /* The constructor body must be crafted by hand. It's the
8510 constructor we defined when we realize we didn't have the
8511 CLASSNAME() constructor */
8515 /* It is an error for the compiler to generate a default
8516 constructor if the superclass doesn't have a constructor that
8517 takes no argument */
8518 if (verify_constructor_super ())
8520 tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class));
8521 char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
8522 parse_error_context (lookup_cl (TYPE_NAME (current_class)),
8523 "No constructor matching `%s()' found in "
8524 "class `%s'", n, n);
8527 start_artificial_method_body (mdecl);
8529 /* We don't generate a super constructor invocation if we're
8530 compiling java.lang.Object. build_super_invocation takes care
8532 compound = java_method_add_stmt (mdecl, build_super_invocation ());
8534 end_artificial_method_body (mdecl);
8536 /* Search for an explicit constructor invocation */
8540 tree main_block = BLOCK_EXPR_BODY (body);
8541 tree compound = NULL_TREE;
8544 switch (TREE_CODE (body))
8547 found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
8551 case EXPR_WITH_FILE_LOCATION:
8552 body = TREE_OPERAND (body, 0);
8555 body = BLOCK_EXPR_BODY (body);
8561 /* The constructor is missing an invocation of super() */
8563 compound = add_stmt_to_compound (compound, NULL_TREE,
8564 build_super_invocation ());
8566 /* Fix the constructor main block if we're adding extra stmts */
8569 compound = add_stmt_to_compound (compound, NULL_TREE,
8570 BLOCK_EXPR_BODY (main_block));
8571 BLOCK_EXPR_BODY (main_block) = compound;
8576 /* Browse constructors in the super class, searching for a constructor
8577 that doesn't take any argument. Return 0 if one is found, 1
8581 verify_constructor_super ()
8583 tree class = CLASSTYPE_SUPER (current_class);
8590 for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
8592 if (DECL_CONSTRUCTOR_P (mdecl)
8593 && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node)
8600 /* Expand finals. */
8603 java_expand_finals ()
8607 /* Generate code for all context remembered for code generation. */
8610 java_expand_classes ()
8612 int save_error_count = 0;
8613 java_parse_abort_on_error ();
8614 if (!(ctxp = ctxp_for_generation))
8616 java_layout_classes ();
8617 java_parse_abort_on_error ();
8619 for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
8621 ctxp = ctxp_for_generation;
8622 lang_init_source (2); /* Error msgs have method prototypes */
8623 java_complete_expand_methods (); /* Complete and expand method bodies */
8624 java_parse_abort_on_error ();
8625 java_expand_finals (); /* Expand and check the finals */
8626 java_parse_abort_on_error ();
8627 java_check_final (); /* Check unitialized final */
8628 java_parse_abort_on_error ();
8632 /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
8633 a tree list node containing RIGHT. Fore coming RIGHTs will be
8634 chained to this hook. LOCATION contains the location of the
8635 separating `.' operator. */
8638 make_qualified_primary (primary, right, location)
8639 tree primary, right;
8644 /* We want to process THIS . xxx symbolicaly, to keep it consistent
8645 with the way we're processing SUPER. A THIS from a primary as a
8646 different form than a SUPER. Turn THIS into something symbolic */
8647 if (TREE_CODE (primary) == THIS_EXPR)
8649 wfl = build_wfl_node (this_identifier_node);
8650 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
8651 wfl = make_qualified_name (wfl, right, location);
8652 PRIMARY_P (wfl) = 1;
8655 /* Other non WFL node are wrapped around a WFL */
8656 else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
8658 wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
8659 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
8660 EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE);
8665 if (!EXPR_WFL_QUALIFICATION (primary))
8666 EXPR_WFL_QUALIFICATION (primary) =
8667 build_tree_list (primary, NULL_TREE);
8670 EXPR_WFL_LINECOL (right) = location;
8671 chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE));
8672 PRIMARY_P (wfl) = 1;
8676 /* Simple merge of two name separated by a `.' */
8679 merge_qualified_name (left, right)
8683 obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left),
8684 IDENTIFIER_LENGTH (left));
8685 obstack_1grow (&temporary_obstack, '.');
8686 obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right),
8687 IDENTIFIER_LENGTH (right));
8688 node = get_identifier (obstack_base (&temporary_obstack));
8689 obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
8690 QUALIFIED_P (node) = 1;
8694 /* Merge the two parts of a qualified name into LEFT. Set the
8695 location information of the resulting node to LOCATION, usually
8696 inherited from the location information of the `.' operator. */
8699 make_qualified_name (left, right, location)
8703 #ifdef USE_COMPONENT_REF
8704 tree node = build (COMPONENT_REF, NULL_TREE, left, right);
8705 EXPR_WFL_LINECOL (node) = location;
8708 tree left_id = EXPR_WFL_NODE (left);
8709 tree right_id = EXPR_WFL_NODE (right);
8712 merge = merge_qualified_name (left_id, right_id);
8714 /* Left wasn't qualified and is now qualified */
8715 if (!QUALIFIED_P (left_id))
8717 tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0);
8718 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left);
8719 EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
8722 wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0);
8723 EXPR_WFL_LINECOL (wfl) = location;
8724 chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE));
8726 EXPR_WFL_NODE (left) = merge;
8731 /* Extract the last identifier component of the qualified in WFL. The
8732 last identifier is removed from the linked list */
8735 cut_identifier_in_qualified (wfl)
8739 tree previous = NULL_TREE;
8740 for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q))
8741 if (!TREE_CHAIN (q))
8744 fatal ("Operating on a non qualified qualified WFL - "
8745 "cut_identifier_in_qualified");
8746 TREE_CHAIN (previous) = NULL_TREE;
8747 return TREE_PURPOSE (q);
8751 /* Resolve the expression name NAME. Return its decl. */
8754 resolve_expression_name (id, orig)
8758 tree name = EXPR_WFL_NODE (id);
8761 /* 6.5.5.1: Simple expression names */
8762 if (!PRIMARY_P (id) && !QUALIFIED_P (name))
8764 /* 15.13.1: NAME can appear within the scope of a local variable
8766 if ((decl = IDENTIFIER_LOCAL_VALUE (name)))
8769 /* 15.13.1: NAME can appear within a class declaration */
8772 decl = lookup_field_wrapper (current_class, name);
8775 int fs = FIELD_STATIC (decl);
8776 /* Instance variable (8.3.1.1) can't appear within
8777 static method, static initializer or initializer for
8778 a static variable. */
8779 if (!fs && METHOD_STATIC (current_function_decl))
8781 static_ref_err (id, name, current_class);
8782 return error_mark_node;
8784 /* Instance variables can't appear as an argument of
8785 an explicit constructor invocation */
8786 if (!fs && ctxp->explicit_constructor_p)
8789 (id, "Can't reference `%s' before the superclass "
8790 "constructor has been called", IDENTIFIER_POINTER (name));
8791 return error_mark_node;
8794 /* Otherwise build what it takes to access the field */
8795 decl = build_field_ref ((fs ? NULL_TREE : current_this),
8796 DECL_CONTEXT (decl), name);
8797 if (fs && !flag_emit_class_files && !flag_emit_xref)
8798 decl = build_class_init (DECL_CONTEXT (decl), decl);
8799 /* We may be asked to save the real field access node */
8802 /* And we return what we got */
8805 /* Fall down to error report on undefined variable */
8808 /* 6.5.5.2 Qualified Expression Names */
8813 qualify_ambiguous_name (id);
8814 /* 15.10.1 Field Access Using a Primary and/or Expression Name */
8815 /* 15.10.2: Accessing Superclass Members using super */
8816 return resolve_field_access (id, NULL, NULL);
8819 /* We've got an error here */
8820 parse_error_context (id, "Undefined variable `%s'",
8821 IDENTIFIER_POINTER (name));
8823 return error_mark_node;
8827 static_ref_err (wfl, field_id, class_type)
8828 tree wfl, field_id, class_type;
8832 "Can't make a static reference to nonstatic variable `%s' in class `%s'",
8833 IDENTIFIER_POINTER (field_id),
8834 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))));
8837 /* 15.10.1 Field Acess Using a Primary and/or Expression Name.
8838 We return something suitable to generate the field access. We also
8839 return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
8840 recipient's address can be null. */
8843 resolve_field_access (qual_wfl, field_decl, field_type)
8845 tree *field_decl, *field_type;
8849 tree decl, where_found, type_found;
8851 if (resolve_qualified_expression_name (qual_wfl, &decl,
8852 &where_found, &type_found))
8853 return error_mark_node;
8855 /* Resolve the LENGTH field of an array here */
8856 if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found)
8857 && ! flag_emit_class_files && ! flag_emit_xref)
8859 tree length = build_java_array_length_access (where_found);
8861 build_java_arraynull_check (type_found, length, int_type_node);
8863 /* We might have been trying to resolve field.method(). In which
8864 case, the resolution is over and decl is the answer */
8865 else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
8867 else if (JDECL_P (decl))
8869 int static_final_found = 0;
8871 type_found = DECL_CONTEXT (decl);
8872 is_static = JDECL_P (decl) && FIELD_STATIC (decl);
8873 if (FIELD_FINAL (decl)
8874 && JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
8875 && DECL_LANG_SPECIFIC (decl)
8876 && DECL_INITIAL (decl))
8878 field_ref = DECL_INITIAL (decl);
8879 static_final_found = 1;
8882 field_ref = build_field_ref ((is_static && !flag_emit_xref?
8883 NULL_TREE : where_found),
8884 type_found, DECL_NAME (decl));
8885 if (field_ref == error_mark_node)
8886 return error_mark_node;
8887 if (is_static && !static_final_found
8888 && !flag_emit_class_files && !flag_emit_xref)
8890 field_ref = build_class_init (type_found, field_ref);
8891 /* If the static field was identified by an expression that
8892 needs to be generated, make the field access a compound
8893 expression whose first part is the evaluation of the
8894 field selector part. */
8895 if (where_found && TREE_CODE (where_found) != TYPE_DECL
8896 && TREE_CODE (where_found) != RECORD_TYPE)
8898 tree type = QUAL_DECL_TYPE (field_ref);
8899 field_ref = build (COMPOUND_EXPR, type, where_found, field_ref);
8909 *field_type = (QUAL_DECL_TYPE (decl) ?
8910 QUAL_DECL_TYPE (decl) : TREE_TYPE (decl));
8914 /* If NODE is an access to f static field, strip out the class
8915 initialization part and return the field decl, otherwise, return
8919 strip_out_static_field_access_decl (node)
8922 if (TREE_CODE (node) == COMPOUND_EXPR)
8924 tree op1 = TREE_OPERAND (node, 1);
8925 if (TREE_CODE (op1) == COMPOUND_EXPR)
8927 tree call = TREE_OPERAND (op1, 0);
8928 if (TREE_CODE (call) == CALL_EXPR
8929 && TREE_CODE (TREE_OPERAND (call, 0)) == ADDR_EXPR
8930 && TREE_OPERAND (TREE_OPERAND (call, 0), 0)
8931 == soft_initclass_node)
8932 return TREE_OPERAND (op1, 1);
8938 /* 6.5.5.2: Qualified Expression Names */
8941 resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
8943 tree *found_decl, *type_found, *where_found;
8945 int from_type = 0; /* Field search initiated from a type */
8946 int from_super = 0, from_cast = 0;
8947 int previous_call_static = 0;
8949 tree decl = NULL_TREE, type = NULL_TREE, q;
8950 *type_found = *where_found = NULL_TREE;
8952 for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
8954 tree qual_wfl = QUAL_WFL (q);
8956 /* 15.10.1 Field Access Using a Primary */
8957 switch (TREE_CODE (qual_wfl))
8960 case NEW_CLASS_EXPR:
8961 /* If the access to the function call is a non static field,
8962 build the code to access it. */
8963 if (JDECL_P (decl) && !FIELD_STATIC (decl))
8965 decl = maybe_access_field (decl, *where_found,
8966 DECL_CONTEXT (decl));
8967 if (decl == error_mark_node)
8970 /* And code for the function call */
8971 if (complete_function_arguments (qual_wfl))
8973 if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
8974 CALL_USING_SUPER (qual_wfl) = 1;
8976 patch_method_invocation (qual_wfl, decl, type, &is_static, NULL);
8977 if (*where_found == error_mark_node)
8979 *type_found = type = QUAL_DECL_TYPE (*where_found);
8981 /* If the previous call was static and this one is too,
8982 build a compound expression to hold the two (because in
8983 that case, previous function calls aren't transported as
8984 forcoming function's argument. */
8985 if (previous_call_static && is_static)
8987 decl = build (COMPOUND_EXPR, type, decl, *where_found);
8988 TREE_SIDE_EFFECTS (decl) = 1;
8992 previous_call_static = is_static;
8993 decl = *where_found;
8997 case NEW_ARRAY_EXPR:
8998 *where_found = decl = java_complete_tree (qual_wfl);
8999 if (decl == error_mark_node)
9001 *type_found = type = QUAL_DECL_TYPE (decl);
9002 CLASS_LOADED_P (type) = 1;
9006 *where_found = decl = java_complete_tree (qual_wfl);
9007 if (decl == error_mark_node)
9009 *type_found = type = QUAL_DECL_TYPE (decl);
9013 case CONDITIONAL_EXPR:
9015 *where_found = decl = java_complete_tree (qual_wfl);
9016 if (decl == error_mark_node)
9018 *type_found = type = QUAL_DECL_TYPE (decl);
9022 /* If the access to the function call is a non static field,
9023 build the code to access it. */
9024 if (JDECL_P (decl) && !FIELD_STATIC (decl))
9026 decl = maybe_access_field (decl, *where_found, type);
9027 if (decl == error_mark_node)
9030 /* And code for the array reference expression */
9031 decl = java_complete_tree (qual_wfl);
9032 if (decl == error_mark_node)
9034 type = QUAL_DECL_TYPE (decl);
9038 /* Fix for -Wall Just go to the next statement. Don't
9043 /* If we fall here, we weren't processing a (static) function call. */
9044 previous_call_static = 0;
9046 /* It can be the keyword THIS */
9047 if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
9052 (wfl, "Keyword `this' used outside allowed context");
9055 /* We have to generate code for intermediate acess */
9056 *where_found = decl = current_this;
9057 *type_found = type = QUAL_DECL_TYPE (decl);
9061 /* 15.10.2 Accessing Superclass Members using SUPER */
9062 if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
9065 /* Check on the restricted use of SUPER */
9066 if (METHOD_STATIC (current_function_decl)
9067 || current_class == object_type_node)
9070 (wfl, "Keyword `super' used outside allowed context");
9073 /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
9074 node = build_cast (EXPR_WFL_LINECOL (qual_wfl),
9075 CLASSTYPE_SUPER (current_class),
9076 build_this (EXPR_WFL_LINECOL (qual_wfl)));
9077 *where_found = decl = java_complete_tree (node);
9078 if (decl == error_mark_node)
9080 *type_found = type = QUAL_DECL_TYPE (decl);
9081 from_super = from_type = 1;
9085 /* 15.13.1: Can't search for field name in packages, so we
9086 assume a variable/class name was meant. */
9087 if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
9089 tree name = resolve_package (wfl, &q);
9092 *where_found = decl = resolve_no_layout (name, qual_wfl);
9093 /* We wan't to be absolutely that the class is laid
9094 out. We're going to search something inside it. */
9095 *type_found = type = TREE_TYPE (decl);
9096 layout_class (type);
9098 /* Should be a list, really. FIXME */
9099 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 1;
9100 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 0;
9104 if (from_super || from_cast)
9106 ((from_cast ? qual_wfl : wfl),
9107 "No variable `%s' defined in class `%s'",
9108 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
9109 lang_printable_name (type, 0));
9112 (qual_wfl, "Undefined variable or class name: `%s'",
9113 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)));
9118 /* We have a type name. It's been already resolved when the
9119 expression was qualified. */
9120 else if (RESOLVE_TYPE_NAME_P (qual_wfl))
9122 if (!(decl = QUAL_RESOLUTION (q)))
9123 return 1; /* Error reported already */
9125 if (not_accessible_p (TREE_TYPE (decl), decl, 0))
9128 (qual_wfl, "Can't access %s field `%s.%s' from `%s'",
9129 java_accstring_lookup (get_access_flags_from_decl (decl)),
9130 GET_TYPE_NAME (type),
9131 IDENTIFIER_POINTER (DECL_NAME (decl)),
9132 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
9135 check_deprecation (qual_wfl, decl);
9137 type = TREE_TYPE (decl);
9140 /* We resolve and expression name */
9145 /* If there exists an early resolution, use it. That occurs
9146 only once and we know that there are more things to
9147 come. Don't do that when processing something after SUPER
9148 (we need more thing to be put in place below */
9149 if (!from_super && QUAL_RESOLUTION (q))
9151 decl = QUAL_RESOLUTION (q);
9154 if (TREE_CODE (decl) == FIELD_DECL && !FIELD_STATIC (decl))
9157 *where_found = current_this;
9160 static_ref_err (qual_wfl, DECL_NAME (decl),
9167 *where_found = TREE_TYPE (decl);
9168 if (TREE_CODE (*where_found) == POINTER_TYPE)
9169 *where_found = TREE_TYPE (*where_found);
9174 /* We have to search for a field, knowing the type of its
9175 container. The flag FROM_TYPE indicates that we resolved
9176 the last member of the expression as a type name, which
9177 means that for the resolution of this field, we'll look
9178 for other errors than if it was resolved as a member of
9183 tree field_decl_type; /* For layout */
9185 if (!from_type && !JREFERENCE_TYPE_P (type))
9188 (qual_wfl, "Attempt to reference field `%s' in `%s %s'",
9189 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
9190 lang_printable_name (type, 0),
9191 IDENTIFIER_POINTER (DECL_NAME (field_decl)));
9195 field_decl = lookup_field_wrapper (type,
9196 EXPR_WFL_NODE (qual_wfl));
9197 if (field_decl == NULL_TREE)
9200 (qual_wfl, "No variable `%s' defined in type `%s'",
9201 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
9202 GET_TYPE_NAME (type));
9205 if (field_decl == error_mark_node)
9208 /* Layout the type of field_decl, since we may need
9209 it. Don't do primitive types or loaded classes. The
9210 situation of non primitive arrays may not handled
9211 properly here. FIXME */
9212 if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE)
9213 field_decl_type = TREE_TYPE (TREE_TYPE (field_decl));
9215 field_decl_type = TREE_TYPE (field_decl);
9216 if (!JPRIMITIVE_TYPE_P (field_decl_type)
9217 && !CLASS_LOADED_P (field_decl_type)
9218 && !TYPE_ARRAY_P (field_decl_type))
9219 resolve_and_layout (field_decl_type, NULL_TREE);
9220 if (TYPE_ARRAY_P (field_decl_type))
9221 CLASS_LOADED_P (field_decl_type) = 1;
9223 /* Check on accessibility here */
9224 if (not_accessible_p (type, field_decl, from_super))
9228 "Can't access %s field `%s.%s' from `%s'",
9229 java_accstring_lookup
9230 (get_access_flags_from_decl (field_decl)),
9231 GET_TYPE_NAME (type),
9232 IDENTIFIER_POINTER (DECL_NAME (field_decl)),
9234 (DECL_NAME (TYPE_NAME (current_class))));
9237 check_deprecation (qual_wfl, field_decl);
9239 /* There are things to check when fields are accessed
9240 from type. There are no restrictions on a static
9241 declaration of the field when it is accessed from an
9243 is_static = FIELD_STATIC (field_decl);
9244 if (!from_super && from_type
9245 && !TYPE_INTERFACE_P (type) && !is_static)
9247 static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type);
9250 from_cast = from_super = 0;
9252 /* If we need to generate something to get a proper
9253 handle on what this field is accessed from, do it
9257 decl = maybe_access_field (decl, *where_found, *type_found);
9258 if (decl == error_mark_node)
9262 /* We want to keep the location were found it, and the type
9264 *where_found = decl;
9267 /* This is the decl found and eventually the next one to
9272 type = QUAL_DECL_TYPE (decl);
9279 /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
9280 can't be accessed from REFERENCE (a record type). */
9282 int not_accessible_p (reference, member, from_super)
9283 tree reference, member;
9286 int access_flag = get_access_flags_from_decl (member);
9288 /* Access always granted for members declared public */
9289 if (access_flag & ACC_PUBLIC)
9292 /* Check access on protected members */
9293 if (access_flag & ACC_PROTECTED)
9295 /* Access granted if it occurs from within the package
9296 containing the class in which the protected member is
9298 if (class_in_current_package (DECL_CONTEXT (member)))
9301 /* If accessed with the form `super.member', then access is granted */
9305 /* Otherwise, access is granted if occuring from the class where
9306 member is declared or a subclass of it */
9307 if (inherits_from_p (reference, current_class))
9312 /* Check access on private members. Access is granted only if it
9313 occurs from within the class in witch it is declared */
9314 if (access_flag & ACC_PRIVATE)
9315 return (current_class == DECL_CONTEXT (member) ? 0 : 1);
9317 /* Default access are permitted only when occuring within the
9318 package in which the type (REFERENCE) is declared. In other words,
9319 REFERENCE is defined in the current package */
9321 return !class_in_current_package (reference);
9323 /* Otherwise, access is granted */
9327 /* Test deprecated decl access. */
9329 check_deprecation (wfl, decl)
9332 char *file = DECL_SOURCE_FILE (decl);
9333 /* Complain if the field is deprecated and the file it was defined
9334 in isn't compiled at the same time the file which contains its
9336 if (DECL_DEPRECATED (decl)
9337 && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file)))
9340 switch (TREE_CODE (decl))
9343 strcpy (the, "method");
9346 strcpy (the, "field");
9349 strcpy (the, "class");
9352 fatal ("unexpected DECL code - check_deprecation");
9354 parse_warning_context
9355 (wfl, "The %s `%s' in class `%s' has been deprecated",
9356 the, lang_printable_name (decl, 0),
9357 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)))));
9361 /* Returns 1 if class was declared in the current package, 0 otherwise */
9364 class_in_current_package (class)
9367 static tree cache = NULL_TREE;
9374 qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
9376 /* If the current package is empty and the name of CLASS is
9377 qualified, class isn't in the current package. If there is a
9378 current package and the name of the CLASS is not qualified, class
9379 isn't in the current package */
9380 if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag))
9383 /* If there is not package and the name of CLASS isn't qualified,
9384 they belong to the same unnamed package */
9385 if (!ctxp->package && !qualified_flag)
9388 /* Compare the left part of the name of CLASS with the package name */
9389 breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
9390 if (ctxp->package == left)
9398 /* This function may generate code to access DECL from WHERE. This is
9399 done only if certain conditions meet. */
9402 maybe_access_field (decl, where, type)
9403 tree decl, where, type;
9405 if (TREE_CODE (decl) == FIELD_DECL && decl != current_this
9406 && !FIELD_STATIC (decl))
9407 decl = build_field_ref (where ? where : current_this,
9408 (type ? type : DECL_CONTEXT (decl)),
9413 /* Build a method invocation, by patching PATCH. If non NULL
9414 and according to the situation, PRIMARY and WHERE may be
9415 used. IS_STATIC is set to 1 if the invoked function is static. */
9418 patch_method_invocation (patch, primary, where, is_static, ret_decl)
9419 tree patch, primary, where;
9423 tree wfl = TREE_OPERAND (patch, 0);
9424 tree args = TREE_OPERAND (patch, 1);
9425 tree name = EXPR_WFL_NODE (wfl);
9427 int is_static_flag = 0;
9428 int is_super_init = 0;
9429 tree this_arg = NULL_TREE;
9431 /* Should be overriden if everything goes well. Otherwise, if
9432 something fails, it should keep this value. It stop the
9433 evaluation of a bogus assignment. See java_complete_tree,
9434 MODIFY_EXPR: for the reasons why we sometimes want to keep on
9435 evaluating an assignment */
9436 TREE_TYPE (patch) = error_mark_node;
9438 /* Since lookup functions are messing with line numbers, save the
9440 java_parser_context_save_global ();
9442 /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
9444 /* Resolution of qualified name, excluding constructors */
9445 if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch))
9447 tree class_decl, identifier, identifier_wfl;
9448 /* Extract the last IDENTIFIER of the qualified
9449 expression. This is a wfl and we will use it's location
9450 data during error report. */
9451 identifier_wfl = cut_identifier_in_qualified (wfl);
9452 identifier = EXPR_WFL_NODE (identifier_wfl);
9454 /* Given the context, IDENTIFIER is syntactically qualified
9455 as a MethodName. We need to qualify what's before */
9456 qualify_ambiguous_name (wfl);
9458 /* Package resolution are erroneous */
9459 if (RESOLVE_PACKAGE_NAME_P (wfl))
9462 breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
9463 parse_error_context (wfl, "Can't search method `%s' in package "
9464 "`%s'",IDENTIFIER_POINTER (identifier),
9465 IDENTIFIER_POINTER (remainder));
9466 PATCH_METHOD_RETURN_ERROR ();
9468 /* We're resolving a call from a type */
9469 else if (RESOLVE_TYPE_NAME_P (wfl))
9471 tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl));
9472 tree name = DECL_NAME (decl);
9475 class_decl = resolve_and_layout (name, wfl);
9476 if (CLASS_INTERFACE (decl))
9479 (identifier_wfl, "Can't make static reference to method "
9480 "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier),
9481 IDENTIFIER_POINTER (name));
9482 PATCH_METHOD_RETURN_ERROR ();
9484 /* Look the method up in the type selector. The method ought
9486 type = TREE_TYPE (class_decl);
9487 list = lookup_method_invoke (0, wfl, type, identifier, args);
9488 if (list && !METHOD_STATIC (list))
9490 char *fct_name = strdup (lang_printable_name (list, 0));
9493 "Can't make static reference to method `%s %s' in class `%s'",
9494 lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
9495 fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
9497 PATCH_METHOD_RETURN_ERROR ();
9499 args = nreverse (args);
9501 /* We're resolving an expression name */
9506 /* 1- Find the field to which the call applies */
9507 field = resolve_field_access (wfl, NULL, &type);
9508 if (field == error_mark_node)
9509 PATCH_METHOD_RETURN_ERROR ();
9510 /* field is used in lieu of a primary. It alows us not to
9511 report errors on erroneous use of `this' in
9515 /* 2- Do the layout of the class where the last field
9516 was found, so we can search it. */
9517 class_decl = resolve_and_layout (type, NULL_TREE);
9518 if (class_decl != NULL_TREE)
9519 type = TREE_TYPE (class_decl);
9521 /* 3- Retrieve a filtered list of method matches, Refine
9522 if necessary. In any cases, point out errors. */
9523 list = lookup_method_invoke (0, identifier_wfl, type,
9526 /* 4- Add the field as an argument */
9527 args = nreverse (args);
9531 /* IDENTIFIER_WFL will be used to report any problem further */
9532 wfl = identifier_wfl;
9534 /* Resolution of simple names, names generated after a primary: or
9538 tree class_to_search;
9539 int lc; /* Looking for Constructor */
9541 /* We search constructor in their target class */
9542 if (CALL_CONSTRUCTOR_P (patch))
9544 if (TREE_CODE (patch) == NEW_CLASS_EXPR)
9545 class_to_search = EXPR_WFL_NODE (wfl);
9546 else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
9547 this_identifier_node)
9548 class_to_search = NULL_TREE;
9549 else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
9550 super_identifier_node)
9553 if (CLASSTYPE_SUPER (current_class))
9555 DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class)));
9558 parse_error_context (wfl, "Can't invoke super constructor "
9559 "on java.lang.Object");
9560 PATCH_METHOD_RETURN_ERROR ();
9564 /* Class to search is NULL if we're searching the current one */
9565 if (class_to_search)
9567 class_to_search = resolve_and_layout (class_to_search,
9569 if (!class_to_search)
9572 (wfl, "Class `%s' not found in type declaration",
9573 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
9574 PATCH_METHOD_RETURN_ERROR ();
9577 /* Can't instantiate an abstract class, but we can
9578 invoke it's constructor. It's use within the `new'
9579 context is denied here. */
9580 if (CLASS_ABSTRACT (class_to_search)
9581 && TREE_CODE (patch) == NEW_CLASS_EXPR)
9584 (wfl, "Class `%s' is an abstract class. It can't be "
9585 "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
9586 PATCH_METHOD_RETURN_ERROR ();
9588 class_to_search = TREE_TYPE (class_to_search);
9591 class_to_search = current_class;
9594 /* This is a regular search in the local class, unless an
9595 alternate class is specified. */
9598 class_to_search = (where ? where : current_class);
9602 /* NAME is a simple identifier or comes from a primary. Search
9603 in the class whose declaration contain the method being
9605 resolve_and_layout (class_to_search, NULL_TREE);
9606 list = lookup_method_invoke (lc, wfl, class_to_search, name, args);
9608 /* Don't continue if no method were found, as the next statement
9609 can't be executed then. */
9611 PATCH_METHOD_RETURN_ERROR ();
9613 /* Check for static reference if non static methods */
9614 if (check_for_static_method_reference (wfl, patch, list,
9615 class_to_search, primary))
9616 PATCH_METHOD_RETURN_ERROR ();
9618 /* Non static methods are called with the current object extra
9619 argument. If patch a `new TYPE()', the argument is the value
9620 returned by the object allocator. If method is resolved as a
9621 primary, use the primary otherwise use the current THIS. */
9622 args = nreverse (args);
9623 if (TREE_CODE (patch) != NEW_CLASS_EXPR)
9624 this_arg = primary ? primary : current_this;
9627 /* Merge point of all resolution schemes. If we have nothing, this
9628 is an error, already signaled */
9630 PATCH_METHOD_RETURN_ERROR ();
9632 /* Check accessibility, position the is_static flag, build and
9634 if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0))
9636 char *fct_name = strdup (lang_printable_name (list, 0));
9638 (wfl, "Can't access %s method `%s %s.%s' from `%s'",
9639 java_accstring_lookup (get_access_flags_from_decl (list)),
9640 lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
9641 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list)))),
9642 fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
9644 PATCH_METHOD_RETURN_ERROR ();
9646 check_deprecation (wfl, list);
9648 is_static_flag = METHOD_STATIC (list);
9649 if (! METHOD_STATIC (list) && this_arg != NULL_TREE)
9650 args = tree_cons (NULL_TREE, this_arg, args);
9652 /* In the context of an explicit constructor invocation, we can't
9653 invoke any method relying on `this'. Exceptions are: we're
9654 invoking a static function, primary exists and is not the current
9655 this, we're creating a new object. */
9656 if (ctxp->explicit_constructor_p
9658 && (!primary || primary == current_this)
9659 && (TREE_CODE (patch) != NEW_CLASS_EXPR))
9662 (wfl, "Can't reference `this' before the superclass constructor has "
9664 PATCH_METHOD_RETURN_ERROR ();
9666 java_parser_context_restore_global ();
9668 *is_static = is_static_flag;
9669 /* Sometimes, we want the decl of the selected method. Such as for
9673 patch = patch_invoke (patch, list, args);
9674 if (is_super_init && CLASS_HAS_FINIT_P (current_class))
9676 /* Generate the code used to initialize fields declared with an
9677 initialization statement. For now, it returns a call the the
9678 artificial function $finit$, if required. */
9681 build_method_invocation (build_expr_wfl (finit_identifier_node,
9682 input_filename, 0, 0),
9684 patch = build (COMPOUND_EXPR, void_type_node, patch,
9685 java_complete_tree (finit_call));
9686 CAN_COMPLETE_NORMALLY (patch) = 1;
9691 /* Check that we're not trying to do a static reference to a method in
9692 non static method. Return 1 if it's the case, 0 otherwise. */
9695 check_for_static_method_reference (wfl, node, method, where, primary)
9696 tree wfl, node, method, where, primary;
9698 if (METHOD_STATIC (current_function_decl)
9699 && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
9701 char *fct_name = strdup (lang_printable_name (method, 0));
9703 (wfl, "Can't make static reference to method `%s %s' in class `%s'",
9704 lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
9705 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where))));
9712 /* Patch an invoke expression METHOD and ARGS, based on its invocation
9716 patch_invoke (patch, method, args)
9717 tree patch, method, args;
9720 tree original_call, t, ta;
9722 /* Last step for args: convert build-in types. If we're dealing with
9723 a new TYPE() type call, the first argument to the constructor
9724 isn't found in the incomming argument list, but delivered by
9726 t = TYPE_ARG_TYPES (TREE_TYPE (method));
9727 if (TREE_CODE (patch) == NEW_CLASS_EXPR)
9729 for (ta = args; t != end_params_node && ta;
9730 t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
9731 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
9732 TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
9733 TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
9735 if (flag_emit_class_files || flag_emit_xref)
9739 tree signature = build_java_signature (TREE_TYPE (method));
9740 switch (invocation_mode (method, CALL_USING_SUPER (patch)))
9742 case INVOKE_VIRTUAL:
9743 dtable = invoke_build_dtable (0, args);
9744 func = build_invokevirtual (dtable, method);
9749 func = build_known_method_ref (method, TREE_TYPE (method),
9750 DECL_CONTEXT (method),
9754 case INVOKE_INTERFACE:
9755 dtable = invoke_build_dtable (1, args);
9756 func = build_invokeinterface (dtable, DECL_NAME (method), signature);
9760 fatal ("internal error - unknown invocation_mode result");
9763 /* Ensure self_type is initialized, (invokestatic). FIXME */
9764 func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func);
9767 TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method));
9768 TREE_OPERAND (patch, 0) = func;
9769 TREE_OPERAND (patch, 1) = args;
9770 original_call = patch;
9772 /* We're processing a `new TYPE ()' form. New is called an its
9773 returned value is the first argument to the constructor. We build
9774 a COMPOUND_EXPR and use saved expression so that the overall NEW
9775 expression value is a pointer to a newly created and initialized
9777 if (TREE_CODE (original_call) == NEW_CLASS_EXPR)
9779 tree class = DECL_CONTEXT (method);
9780 tree c1, saved_new, size, new;
9781 if (flag_emit_class_files || flag_emit_xref)
9783 TREE_TYPE (patch) = build_pointer_type (class);
9786 if (!TYPE_SIZE (class))
9787 safe_layout_class (class);
9788 size = size_in_bytes (class);
9789 new = build (CALL_EXPR, promote_type (class),
9790 build_address_of (alloc_object_node),
9791 tree_cons (NULL_TREE, build_class_ref (class),
9792 build_tree_list (NULL_TREE,
9793 size_in_bytes (class))),
9795 saved_new = save_expr (new);
9796 c1 = build_tree_list (NULL_TREE, saved_new);
9797 TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1);
9798 TREE_OPERAND (original_call, 1) = c1;
9799 TREE_SET_CODE (original_call, CALL_EXPR);
9800 patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
9806 invocation_mode (method, super)
9810 int access = get_access_flags_from_decl (method);
9813 return INVOKE_SUPER;
9815 if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE)
9816 return INVOKE_STATIC;
9818 if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
9819 return INVOKE_STATIC;
9821 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
9822 return INVOKE_INTERFACE;
9824 if (DECL_CONSTRUCTOR_P (method))
9825 return INVOKE_STATIC;
9827 return INVOKE_VIRTUAL;
9830 /* Retrieve a refined list of matching methods. It covers the step
9831 15.11.2 (Compile-Time Step 2) */
9834 lookup_method_invoke (lc, cl, class, name, arg_list)
9837 tree class, name, arg_list;
9839 tree atl = end_params_node; /* Arg Type List */
9840 tree method, signature, list, node;
9841 char *candidates; /* Used for error report */
9843 /* Fix the arguments */
9844 for (node = arg_list; node; node = TREE_CHAIN (node))
9846 tree current_arg = TREE_TYPE (TREE_VALUE (node));
9847 /* Non primitive type may have to be resolved */
9848 if (!JPRIMITIVE_TYPE_P (current_arg))
9849 resolve_and_layout (current_arg, NULL_TREE);
9851 if (TREE_CODE (current_arg) == RECORD_TYPE)
9852 current_arg = promote_type (current_arg);
9853 atl = tree_cons (NULL_TREE, current_arg, atl);
9856 /* Find all candidates and then refine the list, searching for the
9857 most specific method. */
9858 list = find_applicable_accessible_methods_list (lc, class, name, atl);
9859 list = find_most_specific_methods_list (list);
9860 if (list && !TREE_CHAIN (list))
9861 return TREE_VALUE (list);
9863 /* Issue an error. List candidates if any. Candidates are listed
9864 only if accessible (non accessible methods may end-up here for
9865 the sake of a better error report). */
9870 obstack_grow (&temporary_obstack, ". Candidates are:\n", 18);
9871 for (current = list; current; current = TREE_CHAIN (current))
9873 tree cm = TREE_VALUE (current);
9875 if (!cm || not_accessible_p (class, cm, 0))
9878 (string, " `%s' in `%s'%s",
9879 get_printable_method_name (cm),
9880 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))),
9881 (TREE_CHAIN (current) ? "\n" : ""));
9882 obstack_grow (&temporary_obstack, string, strlen (string));
9884 obstack_1grow (&temporary_obstack, '\0');
9885 candidates = obstack_finish (&temporary_obstack);
9887 /* Issue the error message */
9888 method = make_node (FUNCTION_TYPE);
9889 TYPE_ARG_TYPES (method) = atl;
9890 signature = build_java_argument_signature (method);
9891 parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s",
9892 (lc ? "constructor" : "method"),
9894 IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) :
9895 IDENTIFIER_POINTER (name)),
9896 IDENTIFIER_POINTER (signature),
9897 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
9898 (candidates ? candidates : ""));
9902 /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
9903 when we're looking for a constructor. */
9906 find_applicable_accessible_methods_list (lc, class, name, arglist)
9908 tree class, name, arglist;
9910 tree list = NULL_TREE, all_list = NULL_TREE;
9912 /* Search interfaces */
9913 if (CLASS_INTERFACE (TYPE_NAME (class)))
9915 static tree searched_interfaces = NULL_TREE;
9916 static int search_not_done = 0;
9918 tree basetype_vec = TYPE_BINFO_BASETYPES (class);
9920 /* Have we searched this interface already? */
9921 if (searched_interfaces)
9924 for (current = searched_interfaces;
9925 current; current = TREE_CHAIN (current))
9926 if (TREE_VALUE (current) == class)
9929 searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces);
9931 search_applicable_methods_list
9932 (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
9934 n = TREE_VEC_LENGTH (basetype_vec);
9935 for (i = 0; i < n; i++)
9937 tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
9940 /* Skip java.lang.Object (we'll search it once later.) */
9941 if (t == object_type_node)
9945 rlist = find_applicable_accessible_methods_list (lc, t, name,
9947 all_list = chainon (rlist, (list ? list : all_list));
9951 /* We're done. Reset the searched interfaces list and finally search
9953 if (!search_not_done)
9955 searched_interfaces = NULL_TREE;
9956 search_applicable_methods_list (lc, TYPE_METHODS (object_type_node),
9957 name, arglist, &list, &all_list);
9960 /* Search classes */
9962 while (class != NULL_TREE)
9964 search_applicable_methods_list
9965 (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
9966 class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class));
9969 /* Either return the list obtained or all selected (but
9970 inaccessible) methods for better error report. */
9971 return (!list ? all_list : list);
9974 /* Effectively search for the approriate method in method */
9977 search_applicable_methods_list(lc, method, name, arglist, list, all_list)
9979 tree method, name, arglist;
9980 tree *list, *all_list;
9982 for (; method; method = TREE_CHAIN (method))
9984 /* When dealing with constructor, stop here, otherwise search
9986 if (lc && !DECL_CONSTRUCTOR_P (method))
9988 else if (!lc && (DECL_CONSTRUCTOR_P (method)
9989 || (GET_METHOD_NAME (method) != name)))
9992 if (argument_types_convertible (method, arglist))
9994 /* Retain accessible methods only */
9995 if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
9997 *list = tree_cons (NULL_TREE, method, *list);
9999 /* Also retain all selected method here */
10000 *all_list = tree_cons (NULL_TREE, method, *list);
10005 /* 15.11.2.2 Choose the Most Specific Method */
10008 find_most_specific_methods_list (list)
10012 tree current, new_list = NULL_TREE;
10013 for (current = list; current; current = TREE_CHAIN (current))
10016 DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0;
10018 for (method = list; method; method = TREE_CHAIN (method))
10020 /* Don't test a method against itself */
10021 if (method == current)
10024 /* Compare arguments and location where method where declared */
10025 if (argument_types_convertible (TREE_VALUE (method),
10026 TREE_VALUE (current))
10027 && valid_method_invocation_conversion_p
10028 (DECL_CONTEXT (TREE_VALUE (method)),
10029 DECL_CONTEXT (TREE_VALUE (current))))
10031 int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current));
10032 max = (v > max ? v : max);
10037 /* Review the list and select the maximally specific methods */
10038 for (current = list; current; current = TREE_CHAIN (current))
10039 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
10040 new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
10042 /* If we can't find one, lower expectations and try to gather multiple
10043 maximally specific methods */
10048 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
10049 new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
10057 /* Make sure that the type of each M2_OR_ARGLIST arguments can be
10058 converted by method invocation conversion (5.3) to the type of the
10059 corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
10060 to change less often than M1. */
10063 argument_types_convertible (m1, m2_or_arglist)
10064 tree m1, m2_or_arglist;
10066 static tree m2_arg_value = NULL_TREE;
10067 static tree m2_arg_cache = NULL_TREE;
10069 register tree m1_arg, m2_arg;
10071 m1_arg = TYPE_ARG_TYPES (TREE_TYPE (m1));
10072 if (!METHOD_STATIC (m1))
10073 m1_arg = TREE_CHAIN (m1_arg);
10075 if (m2_arg_value == m2_or_arglist)
10076 m2_arg = m2_arg_cache;
10079 /* M2_OR_ARGLIST can be a function DECL or a raw list of
10081 if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL)
10083 m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist));
10084 if (!METHOD_STATIC (m2_or_arglist))
10085 m2_arg = TREE_CHAIN (m2_arg);
10088 m2_arg = m2_or_arglist;
10090 m2_arg_value = m2_or_arglist;
10091 m2_arg_cache = m2_arg;
10094 while (m1_arg != end_params_node && m2_arg != end_params_node)
10096 resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE);
10097 if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg),
10098 TREE_VALUE (m2_arg)))
10100 m1_arg = TREE_CHAIN (m1_arg);
10101 m2_arg = TREE_CHAIN (m2_arg);
10103 return m1_arg == end_params_node && m2_arg == end_params_node;
10106 /* Qualification routines */
10109 qualify_ambiguous_name (id)
10112 tree qual, qual_wfl, name, decl, ptr_type, saved_current_class;
10113 int again, super_found = 0, this_found = 0, new_array_found = 0;
10115 /* We first qualify the first element, then derive qualification of
10116 others based on the first one. If the first element is qualified
10117 by a resolution (field or type), this resolution is stored in the
10118 QUAL_RESOLUTION of the qual element being examined. We need to
10119 save the current_class since the use of SUPER might change the
10121 saved_current_class = current_class;
10122 qual = EXPR_WFL_QUALIFICATION (id);
10125 /* Simple qualified expression feature a qual_wfl that is a
10126 WFL. Expression derived from a primary feature more complicated
10127 things like a CALL_EXPR. Expression from primary need to be
10128 worked out to extract the part on which the qualification will
10130 qual_wfl = QUAL_WFL (qual);
10131 switch (TREE_CODE (qual_wfl))
10134 qual_wfl = TREE_OPERAND (qual_wfl, 0);
10135 if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
10137 qual = EXPR_WFL_QUALIFICATION (qual_wfl);
10138 qual_wfl = QUAL_WFL (qual);
10141 case NEW_ARRAY_EXPR:
10142 qual = TREE_CHAIN (qual);
10143 new_array_found = again = 1;
10145 case NEW_CLASS_EXPR:
10147 qual_wfl = TREE_OPERAND (qual_wfl, 0);
10150 while (TREE_CODE (qual_wfl) == ARRAY_REF)
10151 qual_wfl = TREE_OPERAND (qual_wfl, 0);
10154 /* Fix for -Wall. Just break doing nothing */
10157 name = EXPR_WFL_NODE (qual_wfl);
10158 ptr_type = current_class;
10160 /* If we have a THIS (from a primary), we set the context accordingly */
10161 if (name == this_identifier_node)
10163 qual = TREE_CHAIN (qual);
10164 qual_wfl = QUAL_WFL (qual);
10165 if (TREE_CODE (qual_wfl) == CALL_EXPR)
10168 name = EXPR_WFL_NODE (qual_wfl);
10171 /* If we have a SUPER, we set the context accordingly */
10172 if (name == super_identifier_node)
10174 current_class = CLASSTYPE_SUPER (ptr_type);
10175 /* Check that there is such a thing as a super class. If not,
10176 return. The error will be caught later on, during the
10178 if (!current_class)
10180 current_class = saved_current_class;
10183 qual = TREE_CHAIN (qual);
10184 /* Do one more interation to set things up */
10185 super_found = again = 1;
10187 /* Loop one more time if we're dealing with ?: or a string
10188 constant, or a convert expression */
10189 if (TREE_CODE (qual_wfl) == CONDITIONAL_EXPR
10190 || TREE_CODE (qual_wfl) == STRING_CST
10191 || TREE_CODE (qual_wfl) == CONVERT_EXPR)
10193 if (TREE_CODE (qual_wfl) == CONVERT_EXPR
10194 && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
10195 name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
10198 qual = TREE_CHAIN (qual);
10199 qual_wfl = QUAL_WFL (qual);
10205 /* If name appears within the scope of a location variable
10206 declaration or parameter declaration, then it is an expression
10207 name. We don't carry this test out if we're in the context of the
10208 use of SUPER or THIS */
10209 if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
10211 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
10212 QUAL_RESOLUTION (qual) = decl;
10215 /* If within the class/interface NAME was found to be used there
10216 exists a (possibly inherited) field named NAME, then this is an
10217 expression name. If we saw a NEW_ARRAY_EXPR before and want to
10218 address length, it is OK. */
10219 else if ((decl = lookup_field_wrapper (ptr_type, name))
10220 || (new_array_found && name == length_identifier_node))
10222 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
10223 QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
10226 /* We reclassify NAME as a type name if:
10227 - NAME is a class/interface declared within the compilation
10228 unit containing NAME,
10229 - NAME is imported via a single-type-import declaration,
10230 - NAME is declared in an another compilation unit of the package
10231 of the compilation unit containing NAME,
10232 - NAME is declared by exactly on type-import-on-demand declaration
10233 of the compilation unit containing NAME. */
10234 else if ((decl = resolve_and_layout (name, NULL_TREE)))
10236 RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
10237 QUAL_RESOLUTION (qual) = decl;
10240 /* Method call are expression name */
10241 else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
10242 || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF)
10243 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
10245 /* Check here that NAME isn't declared by more than one
10246 type-import-on-demand declaration of the compilation unit
10247 containing NAME. FIXME */
10249 /* Otherwise, NAME is reclassified as a package name */
10251 RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
10253 /* Propagate the qualification accross other components of the
10255 for (qual = TREE_CHAIN (qual); qual;
10256 qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual))
10258 if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
10259 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1;
10261 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1;
10264 /* Store the global qualification for the ambiguous part of ID back
10266 if (RESOLVE_EXPRESSION_NAME_P (qual_wfl))
10267 RESOLVE_EXPRESSION_NAME_P (id) = 1;
10268 else if (RESOLVE_TYPE_NAME_P (qual_wfl))
10269 RESOLVE_TYPE_NAME_P (id) = 1;
10270 else if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
10271 RESOLVE_PACKAGE_NAME_P (id) = 1;
10273 /* Restore the current class */
10274 current_class = saved_current_class;
10278 breakdown_qualified (left, right, source)
10279 tree *left, *right, source;
10281 char *p = IDENTIFIER_POINTER (source), *base;
10282 int l = IDENTIFIER_LENGTH (source);
10284 /* Breakdown NAME into REMAINDER . IDENTIFIER */
10287 while (*p != '.' && p != base)
10290 /* We didn't find a '.'. Return an error */
10296 *right = get_identifier (p+1);
10297 *left = get_identifier (IDENTIFIER_POINTER (source));
10303 /* Patch tree nodes in a function body. When a BLOCK is found, push
10304 local variable decls if present.
10305 Same as java_complete_lhs, but does resolve static finals to values. */
10308 java_complete_tree (node)
10311 node = java_complete_lhs (node);
10312 if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node)
10313 && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE
10314 && !flag_emit_xref)
10316 tree value = DECL_INITIAL (node);
10317 DECL_INITIAL (node) = NULL_TREE;
10318 value = fold_constant_for_init (value, node);
10319 DECL_INITIAL (node) = value;
10320 if (value != NULL_TREE)
10327 java_stabilize_reference (node)
10330 if (TREE_CODE (node) == COMPOUND_EXPR)
10332 tree op0 = TREE_OPERAND (node, 0);
10333 tree op1 = TREE_OPERAND (node, 1);
10334 TREE_OPERAND (node, 0) = save_expr (op0);
10335 TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
10339 return stabilize_reference (node);
10342 /* Patch tree nodes in a function body. When a BLOCK is found, push
10343 local variable decls if present.
10344 Same as java_complete_tree, but does not resolve static finals to values. */
10347 java_complete_lhs (node)
10350 tree nn, cn, wfl_op1, wfl_op2, wfl_op3;
10353 /* CONVERT_EXPR always has its type set, even though it needs to be
10355 if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR)
10358 /* The switch block implements cases processing container nodes
10359 first. Contained nodes are always written back. Leaves come
10360 next and return a value. */
10361 switch (TREE_CODE (node))
10365 /* 1- Block section.
10366 Set the local values on decl names so we can identify them
10367 faster when they're referenced. At that stage, identifiers
10368 are legal so we don't check for declaration errors. */
10369 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
10371 DECL_CONTEXT (cn) = current_function_decl;
10372 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn;
10374 if (BLOCK_EXPR_BODY (node) == NULL_TREE)
10375 CAN_COMPLETE_NORMALLY (node) = 1;
10378 tree stmt = BLOCK_EXPR_BODY (node);
10380 int error_seen = 0;
10381 if (TREE_CODE (stmt) == COMPOUND_EXPR)
10383 /* Re-order from (((A; B); C); ...; Z) to
10384 (A; (B; (C ; (...; Z)))).
10385 This makes it easier to scan the statements left-to-right
10386 without using recursion (which might overflow the stack
10387 if the block has many statements. */
10390 tree left = TREE_OPERAND (stmt, 0);
10391 if (TREE_CODE (left) != COMPOUND_EXPR)
10393 TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1);
10394 TREE_OPERAND (left, 1) = stmt;
10397 BLOCK_EXPR_BODY (node) = stmt;
10400 /* Now do the actual complete, without deep recursion for
10402 ptr = &BLOCK_EXPR_BODY (node);
10403 while (TREE_CODE (*ptr) == COMPOUND_EXPR
10404 && TREE_OPERAND (*ptr, 1) != empty_stmt_node)
10406 tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
10407 tree *next = &TREE_OPERAND (*ptr, 1);
10408 TREE_OPERAND (*ptr, 0) = cur;
10409 if (cur == empty_stmt_node)
10411 /* Optimization; makes it easier to detect empty bodies.
10412 Most useful for <clinit> with all-constant initializer. */
10416 if (TREE_CODE (cur) == ERROR_MARK)
10418 else if (! CAN_COMPLETE_NORMALLY (cur))
10423 if (TREE_CODE (wfl_op2) == BLOCK)
10424 wfl_op2 = BLOCK_EXPR_BODY (wfl_op2);
10425 else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR)
10426 wfl_op2 = TREE_OPERAND (wfl_op2, 0);
10430 if (TREE_CODE (wfl_op2) != CASE_EXPR
10431 && TREE_CODE (wfl_op2) != DEFAULT_EXPR)
10432 unreachable_stmt_error (*ptr);
10436 *ptr = java_complete_tree (*ptr);
10438 if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0)
10439 return error_mark_node;
10440 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr);
10442 /* Turn local bindings to null */
10443 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
10444 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE;
10446 TREE_TYPE (node) = void_type_node;
10449 /* 2- They are expressions but ultimately deal with statements */
10452 wfl_op1 = TREE_OPERAND (node, 0);
10453 COMPLETE_CHECK_OP_0 (node);
10454 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10455 return patch_throw_statement (node, wfl_op1);
10457 case SYNCHRONIZED_EXPR:
10458 wfl_op1 = TREE_OPERAND (node, 0);
10459 return patch_synchronized_statement (node, wfl_op1);
10462 return patch_try_statement (node);
10464 case TRY_FINALLY_EXPR:
10465 COMPLETE_CHECK_OP_0 (node);
10466 COMPLETE_CHECK_OP_1 (node);
10467 CAN_COMPLETE_NORMALLY (node)
10468 = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0))
10469 && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)));
10470 TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 0));
10473 case CLEANUP_POINT_EXPR:
10474 COMPLETE_CHECK_OP_0 (node);
10475 TREE_TYPE (node) = void_type_node;
10476 CAN_COMPLETE_NORMALLY (node) =
10477 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
10480 case WITH_CLEANUP_EXPR:
10481 COMPLETE_CHECK_OP_0 (node);
10482 COMPLETE_CHECK_OP_2 (node);
10483 CAN_COMPLETE_NORMALLY (node) =
10484 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
10485 TREE_TYPE (node) = void_type_node;
10488 case LABELED_BLOCK_EXPR:
10489 PUSH_LABELED_BLOCK (node);
10490 if (LABELED_BLOCK_BODY (node))
10491 COMPLETE_CHECK_OP_1 (node);
10492 TREE_TYPE (node) = void_type_node;
10493 POP_LABELED_BLOCK ();
10495 if (LABELED_BLOCK_BODY (node) == empty_stmt_node)
10497 LABELED_BLOCK_BODY (node) = NULL_TREE;
10498 CAN_COMPLETE_NORMALLY (node) = 1;
10500 else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node)))
10501 CAN_COMPLETE_NORMALLY (node) = 1;
10504 case EXIT_BLOCK_EXPR:
10505 /* We don't complete operand 1, because it's the return value of
10506 the EXIT_BLOCK_EXPR which doesn't exist it Java */
10507 return patch_bc_statement (node);
10510 cn = java_complete_tree (TREE_OPERAND (node, 0));
10511 if (cn == error_mark_node)
10514 /* First, the case expression must be constant */
10517 if (!TREE_CONSTANT (cn) && !flag_emit_xref)
10519 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10520 parse_error_context (node, "Constant expression required");
10521 return error_mark_node;
10524 nn = ctxp->current_loop;
10526 /* It must be assignable to the type of the switch expression. */
10527 if (!try_builtin_assignconv (NULL_TREE,
10528 TREE_TYPE (TREE_OPERAND (nn, 0)), cn))
10530 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10531 parse_error_context
10533 "Incompatible type for case. Can't convert `%s' to `int'",
10534 lang_printable_name (TREE_TYPE (cn), 0));
10535 return error_mark_node;
10538 cn = fold (convert (int_type_node, cn));
10540 /* Multiple instance of a case label bearing the same
10541 value is checked during code generation. The case
10542 expression is allright so far. */
10543 TREE_OPERAND (node, 0) = cn;
10544 TREE_TYPE (node) = void_type_node;
10545 CAN_COMPLETE_NORMALLY (node) = 1;
10546 TREE_SIDE_EFFECTS (node) = 1;
10550 nn = ctxp->current_loop;
10551 /* Only one default label is allowed per switch statement */
10552 if (SWITCH_HAS_DEFAULT (nn))
10554 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10555 parse_error_context (wfl_operator,
10556 "Duplicate case label: `default'");
10557 return error_mark_node;
10560 SWITCH_HAS_DEFAULT (nn) = 1;
10561 TREE_TYPE (node) = void_type_node;
10562 TREE_SIDE_EFFECTS (node) = 1;
10563 CAN_COMPLETE_NORMALLY (node) = 1;
10569 /* Check whether the loop was enclosed in a labeled
10570 statement. If not, create one, insert the loop in it and
10572 nn = patch_loop_statement (node);
10574 /* Anyways, walk the body of the loop */
10575 if (TREE_CODE (node) == LOOP_EXPR)
10576 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
10577 /* Switch statement: walk the switch expression and the cases */
10579 node = patch_switch_statement (node);
10581 if (TREE_OPERAND (node, 0) == error_mark_node)
10582 nn = error_mark_node;
10585 TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node;
10586 /* If we returned something different, that's because we
10587 inserted a label. Pop the label too. */
10590 if (CAN_COMPLETE_NORMALLY (node))
10591 CAN_COMPLETE_NORMALLY (nn) = 1;
10592 POP_LABELED_BLOCK ();
10599 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
10600 return patch_exit_expr (node);
10604 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
10605 if (TREE_OPERAND (node, 0) == error_mark_node)
10606 return error_mark_node;
10607 /* then-else branches */
10608 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
10609 if (TREE_OPERAND (node, 1) == error_mark_node)
10610 return error_mark_node;
10611 TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2));
10612 if (TREE_OPERAND (node, 2) == error_mark_node)
10613 return error_mark_node;
10614 return patch_if_else_statement (node);
10617 case CONDITIONAL_EXPR:
10619 wfl_op1 = TREE_OPERAND (node, 0);
10620 COMPLETE_CHECK_OP_0 (node);
10621 wfl_op2 = TREE_OPERAND (node, 1);
10622 COMPLETE_CHECK_OP_1 (node);
10623 wfl_op3 = TREE_OPERAND (node, 2);
10624 COMPLETE_CHECK_OP_2 (node);
10625 return patch_conditional_expr (node, wfl_op1, wfl_op2);
10627 /* 3- Expression section */
10628 case COMPOUND_EXPR:
10629 wfl_op2 = TREE_OPERAND (node, 1);
10630 TREE_OPERAND (node, 0) = nn =
10631 java_complete_tree (TREE_OPERAND (node, 0));
10632 if (wfl_op2 == empty_stmt_node)
10633 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn);
10636 if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK)
10638 /* An unreachable condition in a do-while statement
10639 is *not* (technically) an unreachable statement. */
10641 if (TREE_CODE (nn) == EXPR_WITH_FILE_LOCATION)
10642 nn = EXPR_WFL_NODE (nn);
10643 if (TREE_CODE (nn) != EXIT_EXPR)
10645 SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
10646 parse_error_context (wfl_operator, "Unreachable statement");
10649 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
10650 if (TREE_OPERAND (node, 1) == error_mark_node)
10651 return error_mark_node;
10652 CAN_COMPLETE_NORMALLY (node)
10653 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1));
10655 TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1));
10659 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10660 return patch_return (node);
10662 case EXPR_WITH_FILE_LOCATION:
10663 if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
10664 || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
10667 node = resolve_expression_name (node, NULL);
10668 if (node == error_mark_node)
10670 /* Keep line number information somewhere were it doesn't
10671 disrupt the completion process. */
10672 if (flag_emit_xref)
10674 EXPR_WFL_NODE (wfl) = TREE_OPERAND (node, 1);
10675 TREE_OPERAND (node, 1) = wfl;
10677 CAN_COMPLETE_NORMALLY (node) = 1;
10682 int save_lineno = lineno;
10683 lineno = EXPR_WFL_LINENO (node);
10684 body = java_complete_tree (EXPR_WFL_NODE (node));
10685 lineno = save_lineno;
10686 EXPR_WFL_NODE (node) = body;
10687 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body);
10688 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
10689 if (body == empty_stmt_node)
10691 /* Optimization; makes it easier to detect empty bodies. */
10694 if (body == error_mark_node)
10696 /* Its important for the evaluation of assignment that
10697 this mark on the TREE_TYPE is propagated. */
10698 TREE_TYPE (node) = error_mark_node;
10699 return error_mark_node;
10702 TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node));
10707 case NEW_ARRAY_EXPR:
10708 /* Patch all the dimensions */
10710 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
10712 int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
10713 tree dim = java_complete_tree (TREE_VALUE (cn));
10714 if (dim == error_mark_node)
10721 TREE_VALUE (cn) = dim;
10722 /* Setup the location of the current dimension, for
10723 later error report. */
10724 TREE_PURPOSE (cn) =
10725 build_expr_wfl (NULL_TREE, input_filename, 0, 0);
10726 EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
10729 /* They complete the array creation expression, if no errors
10731 CAN_COMPLETE_NORMALLY (node) = 1;
10732 return (flag ? error_mark_node
10733 : force_evaluation_order (patch_newarray (node)));
10735 case NEW_CLASS_EXPR:
10737 /* Complete function's argument(s) first */
10738 if (complete_function_arguments (node))
10739 return error_mark_node;
10742 tree decl, wfl = TREE_OPERAND (node, 0);
10743 int in_this = CALL_THIS_CONSTRUCTOR_P (node);
10745 node = patch_method_invocation (node, NULL_TREE,
10746 NULL_TREE, 0, &decl);
10747 if (node == error_mark_node)
10748 return error_mark_node;
10750 check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl);
10751 /* If we call this(...), register signature and positions */
10753 DECL_CONSTRUCTOR_CALLS (current_function_decl) =
10754 tree_cons (wfl, decl,
10755 DECL_CONSTRUCTOR_CALLS (current_function_decl));
10756 CAN_COMPLETE_NORMALLY (node) = 1;
10757 return force_evaluation_order (node);
10761 /* Save potential wfls */
10762 wfl_op1 = TREE_OPERAND (node, 0);
10763 TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1);
10764 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)
10765 && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
10766 && DECL_INITIAL (nn) != NULL_TREE)
10768 tree value = fold_constant_for_init (nn, nn);
10769 if (value != NULL_TREE)
10771 tree type = TREE_TYPE (value);
10772 if (JPRIMITIVE_TYPE_P (type) || type == string_ptr_type_node)
10773 return empty_stmt_node;
10775 DECL_INITIAL (nn) = NULL_TREE;
10777 wfl_op2 = TREE_OPERAND (node, 1);
10779 if (TREE_OPERAND (node, 0) == error_mark_node)
10780 return error_mark_node;
10782 if (COMPOUND_ASSIGN_P (wfl_op2))
10784 tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
10786 /* Hand stablize the lhs on both places */
10787 TREE_OPERAND (node, 0) = lvalue;
10788 TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue;
10790 /* Now complete the RHS. We write it back later on. */
10791 nn = java_complete_tree (TREE_OPERAND (node, 1));
10793 if ((cn = patch_string (nn)))
10796 /* The last part of the rewrite for E1 op= E2 is to have
10797 E1 = (T)(E1 op E2), with T being the type of E1. */
10798 nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
10799 TREE_TYPE (lvalue), nn));
10802 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
10803 function to complete this RHS */
10804 else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT)
10805 nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)),
10806 TREE_OPERAND (node, 1));
10807 /* Otherwise we simply complete the RHS */
10809 nn = java_complete_tree (TREE_OPERAND (node, 1));
10811 if (nn == error_mark_node)
10812 return error_mark_node;
10814 /* Write back the RHS as we evaluated it. */
10815 TREE_OPERAND (node, 1) = nn;
10817 /* In case we're handling = with a String as a RHS, we need to
10818 produce a String out of the RHS (it might still be a
10819 STRING_CST or a StringBuffer at this stage */
10820 if ((nn = patch_string (TREE_OPERAND (node, 1))))
10821 TREE_OPERAND (node, 1) = nn;
10822 node = patch_assignment (node, wfl_op1, wfl_op2);
10823 CAN_COMPLETE_NORMALLY (node) = 1;
10835 case TRUNC_MOD_EXPR:
10837 case TRUTH_ANDIF_EXPR:
10838 case TRUTH_ORIF_EXPR:
10845 /* Operands 0 and 1 are WFL in certain cases only. patch_binop
10846 knows how to handle those cases. */
10847 wfl_op1 = TREE_OPERAND (node, 0);
10848 wfl_op2 = TREE_OPERAND (node, 1);
10850 CAN_COMPLETE_NORMALLY (node) = 1;
10851 /* Don't complete string nodes if dealing with the PLUS operand. */
10852 if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1))
10854 nn = java_complete_tree (wfl_op1);
10855 if (nn == error_mark_node)
10856 return error_mark_node;
10857 if ((cn = patch_string (nn)))
10859 TREE_OPERAND (node, 0) = nn;
10861 if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2))
10863 nn = java_complete_tree (wfl_op2);
10864 if (nn == error_mark_node)
10865 return error_mark_node;
10866 if ((cn = patch_string (nn)))
10868 TREE_OPERAND (node, 1) = nn;
10870 return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2));
10872 case INSTANCEOF_EXPR:
10873 wfl_op1 = TREE_OPERAND (node, 0);
10874 COMPLETE_CHECK_OP_0 (node);
10875 if (flag_emit_xref)
10877 TREE_TYPE (node) = boolean_type_node;
10880 return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1));
10882 case UNARY_PLUS_EXPR:
10884 case TRUTH_NOT_EXPR:
10886 case PREDECREMENT_EXPR:
10887 case PREINCREMENT_EXPR:
10888 case POSTDECREMENT_EXPR:
10889 case POSTINCREMENT_EXPR:
10891 /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
10892 how to handle those cases. */
10893 wfl_op1 = TREE_OPERAND (node, 0);
10894 CAN_COMPLETE_NORMALLY (node) = 1;
10895 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
10896 if (TREE_OPERAND (node, 0) == error_mark_node)
10897 return error_mark_node;
10898 node = patch_unaryop (node, wfl_op1);
10899 CAN_COMPLETE_NORMALLY (node) = 1;
10903 /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
10904 how to handle those cases. */
10905 wfl_op1 = TREE_OPERAND (node, 0);
10906 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
10907 if (TREE_OPERAND (node, 0) == error_mark_node)
10908 return error_mark_node;
10909 if (!flag_emit_class_files && !flag_emit_xref)
10910 TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0));
10911 /* The same applies to wfl_op2 */
10912 wfl_op2 = TREE_OPERAND (node, 1);
10913 TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
10914 if (TREE_OPERAND (node, 1) == error_mark_node)
10915 return error_mark_node;
10916 if (!flag_emit_class_files && !flag_emit_xref)
10917 TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1));
10918 return patch_array_ref (node);
10923 case COMPONENT_REF:
10924 /* The first step in the re-write of qualified name handling. FIXME.
10925 So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
10926 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
10927 if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE)
10929 tree name = TREE_OPERAND (node, 1);
10930 tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name);
10931 if (field == NULL_TREE)
10933 error ("missing static field `%s'", IDENTIFIER_POINTER (name));
10934 return error_mark_node;
10936 if (! FIELD_STATIC (field))
10938 error ("not a static field `%s'", IDENTIFIER_POINTER (name));
10939 return error_mark_node;
10944 fatal ("unimplemented java_complete_tree for COMPONENT_REF");
10948 /* Can't use THIS in a static environment */
10951 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10952 parse_error_context (wfl_operator, "Keyword `this' used outside "
10953 "allowed context");
10954 TREE_TYPE (node) = error_mark_node;
10955 return error_mark_node;
10957 if (ctxp->explicit_constructor_p)
10959 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10960 parse_error_context
10961 (wfl_operator, "Can't reference `this' or `super' before the "
10962 "superclass constructor has been called");
10963 TREE_TYPE (node) = error_mark_node;
10964 return error_mark_node;
10966 return current_this;
10969 CAN_COMPLETE_NORMALLY (node) = 1;
10970 /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
10971 and it's time to turn it into the appropriate String object
10973 if ((node = patch_string (node)))
10975 fatal ("No case for tree code `%s' - java_complete_tree\n",
10976 tree_code_name [TREE_CODE (node)]);
10981 /* Complete function call's argument. Return a non zero value is an
10982 error was found. */
10985 complete_function_arguments (node)
10991 ctxp->explicit_constructor_p += (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
10992 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
10994 tree wfl = TREE_VALUE (cn), parm, temp;
10995 parm = java_complete_tree (wfl);
10996 if (parm == error_mark_node)
11001 /* If have a string literal that we haven't transformed yet or a
11002 crafted string buffer, as a result of use of the the String
11003 `+' operator. Build `parm.toString()' and expand it. */
11004 if ((temp = patch_string (parm)))
11006 /* Inline PRIMTYPE.TYPE read access */
11007 parm = maybe_build_primttype_type_ref (parm, wfl);
11009 TREE_VALUE (cn) = parm;
11011 ctxp->explicit_constructor_p -= (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
11015 /* Sometimes (for loops and variable initialized during their
11016 declaration), we want to wrap a statement around a WFL and turn it
11020 build_debugable_stmt (location, stmt)
11024 if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
11026 stmt = build_expr_wfl (stmt, input_filename, 0, 0);
11027 EXPR_WFL_LINECOL (stmt) = location;
11029 JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
11034 build_expr_block (body, decls)
11037 tree node = make_node (BLOCK);
11038 BLOCK_EXPR_DECLS (node) = decls;
11039 BLOCK_EXPR_BODY (node) = body;
11041 TREE_TYPE (node) = TREE_TYPE (body);
11042 TREE_SIDE_EFFECTS (node) = 1;
11046 /* Create a new function block and link it approriately to current
11047 function block chain */
11052 return (enter_a_block (build_expr_block (NULL_TREE, NULL_TREE)));
11055 /* Link block B supercontext to the previous block. The current
11056 function DECL is used as supercontext when enter_a_block is called
11057 for the first time for a given function. The current function body
11058 (DECL_FUNCTION_BODY) is set to be block B. */
11064 tree fndecl = current_function_decl;
11067 BLOCK_SUPERCONTEXT (b) = current_static_block;
11068 current_static_block = b;
11071 else if (!DECL_FUNCTION_BODY (fndecl))
11073 BLOCK_SUPERCONTEXT (b) = fndecl;
11074 DECL_FUNCTION_BODY (fndecl) = b;
11078 BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl);
11079 DECL_FUNCTION_BODY (fndecl) = b;
11084 /* Exit a block by changing the current function body
11085 (DECL_FUNCTION_BODY) to the current block super context, only if
11086 the block being exited isn't the method's top level one. */
11092 if (current_function_decl)
11094 b = DECL_FUNCTION_BODY (current_function_decl);
11095 if (BLOCK_SUPERCONTEXT (b) != current_function_decl)
11096 DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b);
11100 b = current_static_block;
11102 if (BLOCK_SUPERCONTEXT (b))
11103 current_static_block = BLOCK_SUPERCONTEXT (b);
11108 /* Lookup for NAME in the nested function's blocks, all the way up to
11109 the current toplevel one. It complies with Java's local variable
11113 lookup_name_in_blocks (name)
11116 tree b = GET_CURRENT_BLOCK (current_function_decl);
11118 while (b != current_function_decl)
11122 /* Paranoid sanity check. To be removed */
11123 if (TREE_CODE (b) != BLOCK)
11124 fatal ("non block expr function body - lookup_name_in_blocks");
11126 for (current = BLOCK_EXPR_DECLS (b); current;
11127 current = TREE_CHAIN (current))
11128 if (DECL_NAME (current) == name)
11130 b = BLOCK_SUPERCONTEXT (b);
11136 maybe_absorb_scoping_blocks ()
11138 while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl)))
11140 tree b = exit_block ();
11141 java_method_add_stmt (current_function_decl, b);
11142 SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno));
11147 /* This section of the source is reserved to build_* functions that
11148 are building incomplete tree nodes and the patch_* functions that
11149 are completing them. */
11151 /* Build a super() constructor invocation. Returns empty_stmt_node if
11152 we're currently dealing with the class java.lang.Object. */
11155 build_super_invocation ()
11157 if (current_class == object_type_node)
11158 return empty_stmt_node;
11161 tree super_wfl = build_wfl_node (super_identifier_node);
11162 return build_method_invocation (super_wfl, NULL_TREE);
11166 /* Build a SUPER/THIS qualified method invocation. */
11169 build_this_super_qualified_invocation (use_this, name, args, lloc, rloc)
11177 build_wfl_node (use_this ? this_identifier_node : super_identifier_node);
11178 EXPR_WFL_LINECOL (wfl) = lloc;
11179 invok = build_method_invocation (name, args);
11180 return make_qualified_primary (wfl, invok, rloc);
11183 /* Build an incomplete CALL_EXPR node. */
11186 build_method_invocation (name, args)
11190 tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE);
11191 TREE_SIDE_EFFECTS (call) = 1;
11192 EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
11196 /* Build an incomplete new xxx(...) node. */
11199 build_new_invocation (name, args)
11202 tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE);
11203 TREE_SIDE_EFFECTS (call) = 1;
11204 EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
11208 /* Build an incomplete assignment expression. */
11211 build_assignment (op, op_location, lhs, rhs)
11212 int op, op_location;
11216 /* Build the corresponding binop if we deal with a Compound
11217 Assignment operator. Mark the binop sub-tree as part of a
11218 Compound Assignment expression */
11219 if (op != ASSIGN_TK)
11221 rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs);
11222 COMPOUND_ASSIGN_P (rhs) = 1;
11224 assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs);
11225 TREE_SIDE_EFFECTS (assignment) = 1;
11226 EXPR_WFL_LINECOL (assignment) = op_location;
11230 /* Print an INTEGER_CST node in a static buffer, and return the buffer. */
11233 print_int_node (node)
11236 static char buffer [80];
11237 if (TREE_CONSTANT_OVERFLOW (node))
11238 sprintf (buffer, "<overflow>");
11240 if (TREE_INT_CST_HIGH (node) == 0)
11241 sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED,
11242 TREE_INT_CST_LOW (node));
11243 else if (TREE_INT_CST_HIGH (node) == -1
11244 && TREE_INT_CST_LOW (node) != 0)
11247 sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED,
11248 -TREE_INT_CST_LOW (node));
11251 sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
11252 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
11257 /* Return 1 if an assignment to a FINAL is attempted in a non suitable
11261 check_final_assignment (lvalue, wfl)
11264 if (JDECL_P (lvalue)
11265 && FIELD_FINAL (lvalue) && !IS_CLINIT (current_function_decl))
11267 parse_error_context
11268 (wfl, "Can't assign a value to the final variable `%s'",
11269 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
11275 /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
11276 read. This is needed to avoid circularities in the implementation
11277 of these fields in libjava. */
11280 maybe_build_primttype_type_ref (rhs, wfl)
11283 tree to_return = NULL_TREE;
11284 tree rhs_type = TREE_TYPE (rhs);
11285 if (TREE_CODE (rhs) == COMPOUND_EXPR)
11287 tree n = TREE_OPERAND (rhs, 1);
11288 if (TREE_CODE (n) == VAR_DECL
11289 && DECL_NAME (n) == TYPE_identifier_node
11290 && rhs_type == class_ptr_type)
11292 char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
11293 if (!strncmp (self_name, "java.lang.", 10))
11294 to_return = build_primtype_type_ref (self_name);
11297 return (to_return ? to_return : rhs );
11300 /* 15.25 Assignment operators. */
11303 patch_assignment (node, wfl_op1, wfl_op2)
11308 tree rhs = TREE_OPERAND (node, 1);
11309 tree lvalue = TREE_OPERAND (node, 0), llvalue;
11310 tree lhs_type, rhs_type, new_rhs = NULL_TREE;
11311 int error_found = 0;
11312 int lvalue_from_array = 0;
11314 /* Can't assign to a final. */
11315 if (check_final_assignment (lvalue, wfl_op1))
11318 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11320 /* Lhs can be a named variable */
11321 if (JDECL_P (lvalue))
11323 lhs_type = TREE_TYPE (lvalue);
11325 /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
11326 comment on reason why */
11327 else if (TREE_CODE (wfl_op1) == ARRAY_REF)
11329 lhs_type = TREE_TYPE (lvalue);
11330 lvalue_from_array = 1;
11332 /* Or a field access */
11333 else if (TREE_CODE (lvalue) == COMPONENT_REF)
11334 lhs_type = TREE_TYPE (lvalue);
11335 /* Or a function return slot */
11336 else if (TREE_CODE (lvalue) == RESULT_DECL)
11337 lhs_type = TREE_TYPE (lvalue);
11338 /* Otherwise, we might want to try to write into an optimized static
11339 final, this is an of a different nature, reported further on. */
11340 else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION
11341 && resolve_expression_name (wfl_op1, &llvalue))
11343 if (check_final_assignment (llvalue, wfl_op1))
11345 /* What we should do instead is resetting the all the flags
11346 previously set, exchange lvalue for llvalue and continue. */
11348 return error_mark_node;
11351 lhs_type = TREE_TYPE (lvalue);
11355 parse_error_context (wfl_op1, "Invalid left hand side of assignment");
11359 rhs_type = TREE_TYPE (rhs);
11360 /* 5.1 Try the assignment conversion for builtin type. */
11361 new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs);
11363 /* 5.2 If it failed, try a reference conversion */
11364 if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs)))
11365 lhs_type = promote_type (rhs_type);
11367 /* 15.25.2 If we have a compound assignment, convert RHS into the
11369 else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
11370 new_rhs = convert (lhs_type, rhs);
11372 /* Explicit cast required. This is an error */
11375 char *t1 = strdup (lang_printable_name (TREE_TYPE (rhs), 0));
11376 char *t2 = strdup (lang_printable_name (lhs_type, 0));
11378 char operation [32]; /* Max size known */
11380 /* If the assignment is part of a declaration, we use the WFL of
11381 the declared variable to point out the error and call it a
11382 declaration problem. If the assignment is a genuine =
11383 operator, we call is a operator `=' problem, otherwise we
11384 call it an assignment problem. In both of these last cases,
11385 we use the WFL of the operator to indicate the error. */
11387 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node))
11390 strcpy (operation, "declaration");
11394 wfl = wfl_operator;
11395 if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
11396 strcpy (operation, "assignment");
11397 else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL)
11398 strcpy (operation, "`return'");
11400 strcpy (operation, "`='");
11403 parse_error_context
11404 (wfl, (!valid_cast_to_p (rhs_type, lhs_type) ?
11405 "Incompatible type for %s. Can't convert `%s' to `%s'" :
11406 "Incompatible type for %s. Explicit cast "
11407 "needed to convert `%s' to `%s'"), operation, t1, t2);
11408 free (t1); free (t2);
11412 /* Inline read access to java.lang.PRIMTYPE.TYPE */
11414 new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2);
11417 return error_mark_node;
11419 /* 10.10: Array Store Exception runtime check */
11420 if (!flag_emit_class_files
11422 && lvalue_from_array
11423 && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type))
11424 && !CLASS_FINAL (TYPE_NAME (GET_SKIP_TYPE (rhs_type))))
11427 tree base = lvalue;
11429 /* We need to retrieve the right argument for _Jv_CheckArrayStore */
11430 if (TREE_CODE (lvalue) == COMPOUND_EXPR)
11431 base = TREE_OPERAND (lvalue, 0);
11434 if (flag_bounds_check)
11435 base = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base, 0), 1), 0);
11437 base = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
11440 /* Build the invocation of _Jv_CheckArrayStore */
11441 new_rhs = save_expr (new_rhs);
11442 check = build (CALL_EXPR, void_type_node,
11443 build_address_of (soft_checkarraystore_node),
11444 tree_cons (NULL_TREE, base,
11445 build_tree_list (NULL_TREE, new_rhs)),
11447 TREE_SIDE_EFFECTS (check) = 1;
11449 /* We have to decide on an insertion point */
11450 if (TREE_CODE (lvalue) == COMPOUND_EXPR)
11453 if (flag_bounds_check)
11455 t = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0);
11456 TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0) =
11457 build (COMPOUND_EXPR, void_type_node, t, check);
11460 TREE_OPERAND (lvalue, 1) = build (COMPOUND_EXPR, lhs_type,
11461 check, TREE_OPERAND (lvalue, 1));
11465 /* Make sure the bound check will happen before the store check */
11466 if (flag_bounds_check)
11467 TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0) =
11468 build (COMPOUND_EXPR, void_type_node,
11469 TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0), check);
11471 lvalue = build (COMPOUND_EXPR, lhs_type, check, lvalue);
11475 TREE_OPERAND (node, 0) = lvalue;
11476 TREE_OPERAND (node, 1) = new_rhs;
11477 TREE_TYPE (node) = lhs_type;
11481 /* Check that type SOURCE can be cast into type DEST. If the cast
11482 can't occur at all, return 0 otherwise 1. This function is used to
11483 produce accurate error messages on the reasons why an assignment
11487 try_reference_assignconv (lhs_type, rhs)
11488 tree lhs_type, rhs;
11490 tree new_rhs = NULL_TREE;
11491 tree rhs_type = TREE_TYPE (rhs);
11493 if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type))
11495 /* `null' may be assigned to any reference type */
11496 if (rhs == null_pointer_node)
11497 new_rhs = null_pointer_node;
11498 /* Try the reference assignment conversion */
11499 else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0))
11501 /* This is a magic assignment that we process differently */
11502 else if (rhs == soft_exceptioninfo_call_node)
11508 /* Check that RHS can be converted into LHS_TYPE by the assignment
11509 conversion (5.2), for the cases of RHS being a builtin type. Return
11510 NULL_TREE if the conversion fails or if because RHS isn't of a
11511 builtin type. Return a converted RHS if the conversion is possible. */
11514 try_builtin_assignconv (wfl_op1, lhs_type, rhs)
11515 tree wfl_op1, lhs_type, rhs;
11517 tree new_rhs = NULL_TREE;
11518 tree rhs_type = TREE_TYPE (rhs);
11520 /* Zero accepted everywhere */
11521 if (TREE_CODE (rhs) == INTEGER_CST
11522 && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0
11523 && JPRIMITIVE_TYPE_P (rhs_type))
11524 new_rhs = convert (lhs_type, rhs);
11526 /* 5.1.1 Try Identity Conversion,
11527 5.1.2 Try Widening Primitive Conversion */
11528 else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type))
11529 new_rhs = convert (lhs_type, rhs);
11531 /* Try a narrowing primitive conversion (5.1.3):
11532 - expression is a constant expression of type int AND
11533 - variable is byte, short or char AND
11534 - The value of the expression is representable in the type of the
11536 else if (rhs_type == int_type_node && TREE_CONSTANT (rhs)
11537 && (lhs_type == byte_type_node || lhs_type == char_type_node
11538 || lhs_type == short_type_node))
11540 if (int_fits_type_p (rhs, lhs_type))
11541 new_rhs = convert (lhs_type, rhs);
11542 else if (wfl_op1) /* Might be called with a NULL */
11543 parse_warning_context
11544 (wfl_op1, "Constant expression `%s' to wide for narrowing "
11545 "primitive conversion to `%s'",
11546 print_int_node (rhs), lang_printable_name (lhs_type, 0));
11547 /* Reported a warning that will turn into an error further
11548 down, so we don't return */
11554 /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
11555 conversion (5.1.1) or widening primitve conversion (5.1.2). Return
11556 0 is the conversion test fails. This implements parts the method
11557 invocation convertion (5.3). */
11560 valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)
11561 tree lhs_type, rhs_type;
11563 /* 5.1.1: This is the identity conversion part. */
11564 if (lhs_type == rhs_type)
11567 /* Reject non primitive types */
11568 if (!JPRIMITIVE_TYPE_P (lhs_type) || !JPRIMITIVE_TYPE_P (rhs_type))
11571 /* 5.1.2: widening primitive conversion. byte, even if it's smaller
11572 than a char can't be converted into a char. Short can't too, but
11573 the < test below takes care of that */
11574 if (lhs_type == char_type_node && rhs_type == byte_type_node)
11577 /* Accept all promoted type here. Note, we can't use <= in the test
11578 below, because we still need to bounce out assignments of short
11579 to char and the likes */
11580 if (lhs_type == int_type_node
11581 && (rhs_type == promoted_byte_type_node
11582 || rhs_type == promoted_short_type_node
11583 || rhs_type == promoted_char_type_node
11584 || rhs_type == promoted_boolean_type_node))
11587 /* From here, an integral is widened if its precision is smaller
11588 than the precision of the LHS or if the LHS is a floating point
11589 type, or the RHS is a float and the RHS a double. */
11590 if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type)
11591 && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)))
11592 || (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type))
11593 || (rhs_type == float_type_node && lhs_type == double_type_node))
11599 /* Check that something of SOURCE type can be assigned or cast to
11600 something of DEST type at runtime. Return 1 if the operation is
11601 valid, 0 otherwise. If CAST is set to 1, we're treating the case
11602 were SOURCE is cast into DEST, which borrows a lot of the
11603 assignment check. */
11606 valid_ref_assignconv_cast_p (source, dest, cast)
11611 /* SOURCE or DEST might be null if not from a declared entity. */
11612 if (!source || !dest)
11614 if (JNULLP_TYPE_P (source))
11616 if (TREE_CODE (source) == POINTER_TYPE)
11617 source = TREE_TYPE (source);
11618 if (TREE_CODE (dest) == POINTER_TYPE)
11619 dest = TREE_TYPE (dest);
11620 /* Case where SOURCE is a class type */
11621 if (TYPE_CLASS_P (source))
11623 if (TYPE_CLASS_P (dest))
11624 return source == dest || inherits_from_p (source, dest)
11625 || (cast && inherits_from_p (dest, source));
11626 if (TYPE_INTERFACE_P (dest))
11628 /* If doing a cast and SOURCE is final, the operation is
11629 always correct a compile time (because even if SOURCE
11630 does not implement DEST, a subclass of SOURCE might). */
11631 if (cast && !CLASS_FINAL (TYPE_NAME (source)))
11633 /* Otherwise, SOURCE must implement DEST */
11634 return interface_of_p (dest, source);
11636 /* DEST is an array, cast permited if SOURCE is of Object type */
11637 return (cast && source == object_type_node ? 1 : 0);
11639 if (TYPE_INTERFACE_P (source))
11641 if (TYPE_CLASS_P (dest))
11643 /* If not casting, DEST must be the Object type */
11645 return dest == object_type_node;
11646 /* We're doing a cast. The cast is always valid is class
11647 DEST is not final, otherwise, DEST must implement SOURCE */
11648 else if (!CLASS_FINAL (TYPE_NAME (dest)))
11651 return interface_of_p (source, dest);
11653 if (TYPE_INTERFACE_P (dest))
11655 /* If doing a cast, then if SOURCE and DEST contain method
11656 with the same signature but different return type, then
11657 this is a (compile time) error */
11660 tree method_source, method_dest;
11664 for (method_source = TYPE_METHODS (source); method_source;
11665 method_source = TREE_CHAIN (method_source))
11668 build_java_argument_signature (TREE_TYPE (method_source));
11669 source_type = TREE_TYPE (TREE_TYPE (method_source));
11670 source_name = DECL_NAME (method_source);
11671 for (method_dest = TYPE_METHODS (dest);
11672 method_dest; method_dest = TREE_CHAIN (method_dest))
11674 build_java_argument_signature (TREE_TYPE (method_dest))
11675 && source_name == DECL_NAME (method_dest)
11676 && source_type != TREE_TYPE (TREE_TYPE (method_dest)))
11682 return source == dest || interface_of_p (dest, source);
11686 (DECL_NAME (TYPE_NAME (source)) == java_lang_cloneable) : 0);
11688 if (TYPE_ARRAY_P (source))
11690 if (TYPE_CLASS_P (dest))
11691 return dest == object_type_node;
11692 /* Can't cast an array to an interface unless the interface is
11693 java.lang.Cloneable */
11694 if (TYPE_INTERFACE_P (dest))
11695 return (DECL_NAME (TYPE_NAME (dest)) == java_lang_cloneable ? 1 : 0);
11698 tree source_element_type = TYPE_ARRAY_ELEMENT (source);
11699 tree dest_element_type = TYPE_ARRAY_ELEMENT (dest);
11701 /* In case of severe errors, they turn out null */
11702 if (!dest_element_type || !source_element_type)
11704 if (source_element_type == dest_element_type)
11706 return valid_ref_assignconv_cast_p (source_element_type,
11707 dest_element_type, cast);
11715 valid_cast_to_p (source, dest)
11719 if (TREE_CODE (source) == POINTER_TYPE)
11720 source = TREE_TYPE (source);
11721 if (TREE_CODE (dest) == POINTER_TYPE)
11722 dest = TREE_TYPE (dest);
11724 if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE)
11725 return valid_ref_assignconv_cast_p (source, dest, 1);
11727 else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest))
11733 /* Method invocation conversion test. Return 1 if type SOURCE can be
11734 converted to type DEST through the methond invocation conversion
11738 do_unary_numeric_promotion (arg)
11741 tree type = TREE_TYPE (arg);
11742 if (TREE_CODE (type) == INTEGER_TYPE ? TYPE_PRECISION (type) < 32
11743 : TREE_CODE (type) == CHAR_TYPE)
11744 arg = convert (int_type_node, arg);
11748 /* Return a non zero value if SOURCE can be converted into DEST using
11749 the method invocation conversion rule (5.3). */
11751 valid_method_invocation_conversion_p (dest, source)
11754 return ((JPRIMITIVE_TYPE_P (source) && JPRIMITIVE_TYPE_P (dest)
11755 && valid_builtin_assignconv_identity_widening_p (dest, source))
11756 || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source))
11757 && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest))
11758 && valid_ref_assignconv_cast_p (source, dest, 0)));
11761 /* Build an incomplete binop expression. */
11764 build_binop (op, op_location, op1, op2)
11769 tree binop = build (op, NULL_TREE, op1, op2);
11770 TREE_SIDE_EFFECTS (binop) = 1;
11771 /* Store the location of the operator, for better error report. The
11772 string of the operator will be rebuild based on the OP value. */
11773 EXPR_WFL_LINECOL (binop) = op_location;
11777 /* Build the string of the operator retained by NODE. If NODE is part
11778 of a compound expression, add an '=' at the end of the string. This
11779 function is called when an error needs to be reported on an
11780 operator. The string is returned as a pointer to a static character
11784 operator_string (node)
11787 #define BUILD_OPERATOR_STRING(S) \
11789 sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
11793 static char buffer [10];
11794 switch (TREE_CODE (node))
11796 case MULT_EXPR: BUILD_OPERATOR_STRING ("*");
11797 case RDIV_EXPR: BUILD_OPERATOR_STRING ("/");
11798 case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%");
11799 case PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
11800 case MINUS_EXPR: BUILD_OPERATOR_STRING ("-");
11801 case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<");
11802 case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>");
11803 case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>");
11804 case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&");
11805 case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^");
11806 case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|");
11807 case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&");
11808 case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||");
11809 case EQ_EXPR: BUILD_OPERATOR_STRING ("==");
11810 case NE_EXPR: BUILD_OPERATOR_STRING ("!=");
11811 case GT_EXPR: BUILD_OPERATOR_STRING (">");
11812 case GE_EXPR: BUILD_OPERATOR_STRING (">=");
11813 case LT_EXPR: BUILD_OPERATOR_STRING ("<");
11814 case LE_EXPR: BUILD_OPERATOR_STRING ("<=");
11815 case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
11816 case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-");
11817 case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!");
11818 case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~");
11819 case PREINCREMENT_EXPR: /* Fall through */
11820 case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++");
11821 case PREDECREMENT_EXPR: /* Fall through */
11822 case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--");
11824 fatal ("unregistered operator %s - operator_string",
11825 tree_code_name [TREE_CODE (node)]);
11828 #undef BUILD_OPERATOR_STRING
11831 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
11832 errors but we modify NODE so that it contains the type computed
11833 according to the expression, when it's fixed. Otherwise, we write
11834 error_mark_node as the type. It allows us to further the analysis
11835 of remaining nodes and detects more errors in certain cases. */
11838 patch_binop (node, wfl_op1, wfl_op2)
11843 tree op1 = TREE_OPERAND (node, 0);
11844 tree op2 = TREE_OPERAND (node, 1);
11845 tree op1_type = TREE_TYPE (op1);
11846 tree op2_type = TREE_TYPE (op2);
11847 tree prom_type = NULL_TREE;
11848 int code = TREE_CODE (node);
11850 /* If 1, tell the routine that we have to return error_mark_node
11851 after checking for the initialization of the RHS */
11852 int error_found = 0;
11854 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11858 /* 15.16 Multiplicative operators */
11859 case MULT_EXPR: /* 15.16.1 Multiplication Operator * */
11860 case RDIV_EXPR: /* 15.16.2 Division Operator / */
11861 case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */
11862 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
11864 if (!JPRIMITIVE_TYPE_P (op1_type))
11865 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
11866 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
11867 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
11868 TREE_TYPE (node) = error_mark_node;
11872 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
11873 /* Change the division operator if necessary */
11874 if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
11875 TREE_SET_CODE (node, TRUNC_DIV_EXPR);
11877 /* This one is more complicated. FLOATs are processed by a
11878 function call to soft_fmod. Duplicate the value of the
11879 COMPOUND_ASSIGN_P flag. */
11880 if (code == TRUNC_MOD_EXPR)
11882 tree mod = build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2);
11883 COMPOUND_ASSIGN_P (mod) = COMPOUND_ASSIGN_P (node);
11884 TREE_SIDE_EFFECTS (mod)
11885 = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
11890 /* 15.17 Additive Operators */
11891 case PLUS_EXPR: /* 15.17.1 String Concatenation Operator + */
11893 /* Operation is valid if either one argument is a string
11894 constant, a String object or a StringBuffer crafted for the
11895 purpose of the a previous usage of the String concatenation
11898 if (TREE_CODE (op1) == STRING_CST
11899 || TREE_CODE (op2) == STRING_CST
11900 || JSTRING_TYPE_P (op1_type)
11901 || JSTRING_TYPE_P (op2_type)
11902 || IS_CRAFTED_STRING_BUFFER_P (op1)
11903 || IS_CRAFTED_STRING_BUFFER_P (op2))
11904 return build_string_concatenation (op1, op2);
11906 case MINUS_EXPR: /* 15.17.2 Additive Operators (+ and -) for
11908 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
11910 if (!JPRIMITIVE_TYPE_P (op1_type))
11911 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
11912 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
11913 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
11914 TREE_TYPE (node) = error_mark_node;
11918 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
11921 /* 15.18 Shift Operators */
11925 if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type))
11927 if (!JINTEGRAL_TYPE_P (op1_type))
11928 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
11930 parse_error_context
11931 (wfl_operator, (JPRIMITIVE_TYPE_P (op2_type) ?
11932 "Incompatible type for `%s'. Explicit cast needed to convert "
11933 "shift distance from `%s' to integral" :
11934 "Incompatible type for `%s'. Can't convert shift distance from "
11935 "`%s' to integral"),
11936 operator_string (node), lang_printable_name (op2_type, 0));
11937 TREE_TYPE (node) = error_mark_node;
11942 /* Unary numeric promotion (5.6.1) is performed on each operand
11944 op1 = do_unary_numeric_promotion (op1);
11945 op2 = do_unary_numeric_promotion (op2);
11947 /* The type of the shift expression is the type of the promoted
11948 type of the left-hand operand */
11949 prom_type = TREE_TYPE (op1);
11951 /* Shift int only up to 0x1f and long up to 0x3f */
11952 if (prom_type == int_type_node)
11953 op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
11954 build_int_2 (0x1f, 0)));
11956 op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
11957 build_int_2 (0x3f, 0)));
11959 /* The >>> operator is a >> operating on unsigned quantities */
11960 if (code == URSHIFT_EXPR && ! flag_emit_class_files)
11963 tree utype = unsigned_type (prom_type);
11964 op1 = convert (utype, op1);
11965 TREE_SET_CODE (node, RSHIFT_EXPR);
11966 TREE_OPERAND (node, 0) = op1;
11967 TREE_OPERAND (node, 1) = op2;
11968 TREE_TYPE (node) = utype;
11969 to_return = convert (prom_type, node);
11970 /* Copy the original value of the COMPOUND_ASSIGN_P flag */
11971 COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node);
11972 TREE_SIDE_EFFECTS (to_return)
11973 = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
11978 /* 15.19.1 Type Comparison Operator instaceof */
11979 case INSTANCEOF_EXPR:
11981 TREE_TYPE (node) = boolean_type_node;
11983 if (!(op2_type = resolve_type_during_patch (op2)))
11984 return error_mark_node;
11986 /* The first operand must be a reference type or the null type */
11987 if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node)
11988 error_found = 1; /* Error reported further below */
11990 /* The second operand must be a reference type */
11991 if (!JREFERENCE_TYPE_P (op2_type))
11993 SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
11994 parse_error_context
11995 (wfl_operator, "Invalid argument `%s' for `instanceof'",
11996 lang_printable_name (op2_type, 0));
12000 if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1))
12002 /* If the first operand is null, the result is always false */
12003 if (op1 == null_pointer_node)
12004 return boolean_false_node;
12005 else if (flag_emit_class_files)
12007 TREE_OPERAND (node, 1) = op2_type;
12008 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1);
12011 /* Otherwise we have to invoke instance of to figure it out */
12015 build (CALL_EXPR, boolean_type_node,
12016 build_address_of (soft_instanceof_node),
12019 build_tree_list (NULL_TREE,
12020 build_class_ref (op2_type))),
12022 TREE_SIDE_EFFECTS (call) = TREE_SIDE_EFFECTS (op1);
12026 /* There is no way the expression operand can be an instance of
12027 the type operand. This is a compile time error. */
12030 char *t1 = strdup (lang_printable_name (op1_type, 0));
12031 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
12032 parse_error_context
12033 (wfl_operator, "Impossible for `%s' to be instance of `%s'",
12034 t1, lang_printable_name (op2_type, 0));
12041 /* 15.21 Bitwise and Logical Operators */
12045 if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type))
12046 /* Binary numeric promotion is performed on both operand and the
12047 expression retain that type */
12048 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12050 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE
12051 && TREE_CODE (op1_type) == BOOLEAN_TYPE)
12052 /* The type of the bitwise operator expression is BOOLEAN */
12053 prom_type = boolean_type_node;
12056 if (!JINTEGRAL_TYPE_P (op1_type))
12057 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
12058 if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type))
12059 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type);
12060 TREE_TYPE (node) = error_mark_node;
12062 /* Insert a break here if adding thing before the switch's
12063 break for this case */
12067 /* 15.22 Conditional-And Operator */
12068 case TRUTH_ANDIF_EXPR:
12069 /* 15.23 Conditional-Or Operator */
12070 case TRUTH_ORIF_EXPR:
12071 /* Operands must be of BOOLEAN type */
12072 if (TREE_CODE (op1_type) != BOOLEAN_TYPE ||
12073 TREE_CODE (op2_type) != BOOLEAN_TYPE)
12075 if (TREE_CODE (op1_type) != BOOLEAN_TYPE)
12076 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type);
12077 if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type))
12078 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type);
12079 TREE_TYPE (node) = boolean_type_node;
12083 /* The type of the conditional operators is BOOLEAN */
12084 prom_type = boolean_type_node;
12087 /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
12092 /* The type of each of the operands must be a primitive numeric
12094 if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type))
12096 if (!JNUMERIC_TYPE_P (op1_type))
12097 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
12098 if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
12099 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
12100 TREE_TYPE (node) = boolean_type_node;
12104 /* Binary numeric promotion is performed on the operands */
12105 binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12106 /* The type of the relation expression is always BOOLEAN */
12107 prom_type = boolean_type_node;
12110 /* 15.20 Equality Operator */
12113 /* 15.20.1 Numerical Equality Operators == and != */
12114 /* Binary numeric promotion is performed on the operands */
12115 if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))
12116 binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12118 /* 15.20.2 Boolean Equality Operators == and != */
12119 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE &&
12120 TREE_CODE (op2_type) == BOOLEAN_TYPE)
12121 ; /* Nothing to do here */
12123 /* 15.20.3 Reference Equality Operators == and != */
12124 /* Types have to be either references or the null type. If
12125 they're references, it must be possible to convert either
12126 type to the other by casting conversion. */
12127 else if (op1 == null_pointer_node || op2 == null_pointer_node
12128 || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type)
12129 && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1)
12130 || valid_ref_assignconv_cast_p (op2_type,
12132 ; /* Nothing to do here */
12134 /* Else we have an error figure what can't be converted into
12135 what and report the error */
12139 t1 = strdup (lang_printable_name (op1_type, 0));
12140 parse_error_context
12141 (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' "
12142 "to `%s'", operator_string (node), t1,
12143 lang_printable_name (op2_type, 0));
12145 TREE_TYPE (node) = boolean_type_node;
12149 prom_type = boolean_type_node;
12154 return error_mark_node;
12156 TREE_OPERAND (node, 0) = op1;
12157 TREE_OPERAND (node, 1) = op2;
12158 TREE_TYPE (node) = prom_type;
12159 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12161 if (flag_emit_xref)
12164 /* fold does not respect side-effect order as required for Java but not C.
12165 * Also, it sometimes create SAVE_EXPRs which are bad when emitting
12168 if (flag_emit_class_files ? (TREE_CONSTANT (op1) && TREE_CONSTANT (op2))
12169 : ! TREE_SIDE_EFFECTS (node))
12170 node = fold (node);
12174 /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
12175 zero value, the value of CSTE comes after the valude of STRING */
12178 do_merge_string_cste (cste, string, string_len, after)
12181 int string_len, after;
12183 int len = TREE_STRING_LENGTH (cste) + string_len;
12184 char *old = TREE_STRING_POINTER (cste);
12185 TREE_STRING_LENGTH (cste) = len;
12186 TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1);
12189 strcpy (TREE_STRING_POINTER (cste), string);
12190 strcat (TREE_STRING_POINTER (cste), old);
12194 strcpy (TREE_STRING_POINTER (cste), old);
12195 strcat (TREE_STRING_POINTER (cste), string);
12200 /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
12201 new STRING_CST on success, NULL_TREE on failure */
12204 merge_string_cste (op1, op2, after)
12208 /* Handle two string constants right away */
12209 if (TREE_CODE (op2) == STRING_CST)
12210 return do_merge_string_cste (op1, TREE_STRING_POINTER (op2),
12211 TREE_STRING_LENGTH (op2), after);
12213 /* Reasonable integer constant can be treated right away */
12214 if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2))
12216 static char *boolean_true = "true";
12217 static char *boolean_false = "false";
12218 static char *null_pointer = "null";
12222 if (op2 == boolean_true_node)
12223 string = boolean_true;
12224 else if (op2 == boolean_false_node)
12225 string = boolean_false;
12226 else if (op2 == null_pointer_node)
12227 string = null_pointer;
12228 else if (TREE_TYPE (op2) == char_type_node)
12230 ch[0] = (char )TREE_INT_CST_LOW (op2);
12235 string = print_int_node (op2);
12237 return do_merge_string_cste (op1, string, strlen (string), after);
12242 /* Tries to statically concatenate OP1 and OP2 if possible. Either one
12243 has to be a STRING_CST and the other part must be a STRING_CST or a
12244 INTEGRAL constant. Return a new STRING_CST if the operation
12245 succeed, NULL_TREE otherwise.
12247 If the case we want to optimize for space, we might want to return
12248 NULL_TREE for each invocation of this routine. FIXME */
12251 string_constant_concatenation (op1, op2)
12254 if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST))
12259 string = (TREE_CODE (op1) == STRING_CST ? op1 : op2);
12260 rest = (string == op1 ? op2 : op1);
12261 invert = (string == op1 ? 0 : 1 );
12263 /* Walk REST, only if it looks reasonable */
12264 if (TREE_CODE (rest) != STRING_CST
12265 && !IS_CRAFTED_STRING_BUFFER_P (rest)
12266 && !JSTRING_TYPE_P (TREE_TYPE (rest))
12267 && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION)
12269 rest = java_complete_tree (rest);
12270 if (rest == error_mark_node)
12271 return error_mark_node;
12272 rest = fold (rest);
12274 return merge_string_cste (string, rest, invert);
12279 /* Implement the `+' operator. Does static optimization if possible,
12280 otherwise create (if necessary) and append elements to a
12281 StringBuffer. The StringBuffer will be carried around until it is
12282 used for a function call or an assignment. Then toString() will be
12283 called on it to turn it into a String object. */
12286 build_string_concatenation (op1, op2)
12290 int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12292 if (flag_emit_xref)
12293 return build (PLUS_EXPR, string_type_node, op1, op2);
12295 /* Try to do some static optimization */
12296 if ((result = string_constant_concatenation (op1, op2)))
12299 /* Discard empty strings on either side of the expression */
12300 if (TREE_CODE (op1) == STRING_CST && TREE_STRING_LENGTH (op1) == 0)
12305 else if (TREE_CODE (op2) == STRING_CST && TREE_STRING_LENGTH (op2) == 0)
12308 /* If operands are string constant, turn then into object references */
12309 if (TREE_CODE (op1) == STRING_CST)
12310 op1 = patch_string_cst (op1);
12311 if (op2 && TREE_CODE (op2) == STRING_CST)
12312 op2 = patch_string_cst (op2);
12314 /* If either one of the constant is null and the other non null
12315 operand is a String object, return it. */
12316 if (JSTRING_TYPE_P (TREE_TYPE (op1)) && !op2)
12319 /* If OP1 isn't already a StringBuffer, create and
12320 initialize a new one */
12321 if (!IS_CRAFTED_STRING_BUFFER_P (op1))
12323 /* Two solutions here:
12324 1) OP1 is a string reference, we call new StringBuffer(OP1)
12325 2) OP1 is something else, we call new StringBuffer().append(OP1). */
12326 if (JSTRING_TYPE_P (TREE_TYPE (op1)))
12327 op1 = BUILD_STRING_BUFFER (op1);
12330 tree aNew = BUILD_STRING_BUFFER (NULL_TREE);
12331 op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0);
12337 /* OP1 is no longer the last node holding a crafted StringBuffer */
12338 IS_CRAFTED_STRING_BUFFER_P (op1) = 0;
12339 /* Create a node for `{new...,xxx}.append (op2)' */
12341 op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0);
12344 /* Mark the last node holding a crafted StringBuffer */
12345 IS_CRAFTED_STRING_BUFFER_P (op1) = 1;
12347 TREE_SIDE_EFFECTS (op1) = side_effects;
12351 /* Patch the string node NODE. NODE can be a STRING_CST of a crafted
12352 StringBuffer. If no string were found to be patched, return
12356 patch_string (node)
12359 if (node == error_mark_node)
12360 return error_mark_node;
12361 if (TREE_CODE (node) == STRING_CST)
12362 return patch_string_cst (node);
12363 else if (IS_CRAFTED_STRING_BUFFER_P (node))
12365 int saved = ctxp->explicit_constructor_p;
12366 tree invoke = build_method_invocation (wfl_to_string, NULL_TREE);
12368 /* Temporary disable forbid the use of `this'. */
12369 ctxp->explicit_constructor_p = 0;
12370 ret = java_complete_tree (make_qualified_primary (node, invoke, 0));
12371 /* Restore it at its previous value */
12372 ctxp->explicit_constructor_p = saved;
12378 /* Build the internal representation of a string constant. */
12381 patch_string_cst (node)
12385 if (! flag_emit_class_files)
12387 push_obstacks (&permanent_obstack, &permanent_obstack);
12388 node = get_identifier (TREE_STRING_POINTER (node));
12389 location = alloc_name_constant (CONSTANT_String, node);
12390 node = build_ref_from_constant_pool (location);
12392 TREE_TYPE (node) = string_ptr_type_node;
12393 TREE_CONSTANT (node) = 1;
12397 /* Build an incomplete unary operator expression. */
12400 build_unaryop (op_token, op_location, op1)
12401 int op_token, op_location;
12408 case PLUS_TK: op = UNARY_PLUS_EXPR; break;
12409 case MINUS_TK: op = NEGATE_EXPR; break;
12410 case NEG_TK: op = TRUTH_NOT_EXPR; break;
12411 case NOT_TK: op = BIT_NOT_EXPR; break;
12412 default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
12416 unaryop = build1 (op, NULL_TREE, op1);
12417 TREE_SIDE_EFFECTS (unaryop) = 1;
12418 /* Store the location of the operator, for better error report. The
12419 string of the operator will be rebuild based on the OP value. */
12420 EXPR_WFL_LINECOL (unaryop) = op_location;
12424 /* Special case for the ++/-- operators, since they require an extra
12425 argument to build, which is set to NULL and patched
12426 later. IS_POST_P is 1 if the operator, 0 otherwise. */
12429 build_incdec (op_token, op_location, op1, is_post_p)
12430 int op_token, op_location;
12434 static enum tree_code lookup [2][2] =
12436 { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
12437 { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
12439 tree node = build (lookup [is_post_p][(op_token - DECR_TK)],
12440 NULL_TREE, op1, NULL_TREE);
12441 TREE_SIDE_EFFECTS (node) = 1;
12442 /* Store the location of the operator, for better error report. The
12443 string of the operator will be rebuild based on the OP value. */
12444 EXPR_WFL_LINECOL (node) = op_location;
12448 /* Build an incomplete cast operator, based on the use of the
12449 CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
12450 set. java_complete_tree is trained to walk a CONVERT_EXPR even
12451 though its type is already set. */
12454 build_cast (location, type, exp)
12458 tree node = build1 (CONVERT_EXPR, type, exp);
12459 EXPR_WFL_LINECOL (node) = location;
12463 /* 15.14 Unary operators. We return error_mark_node in case of error,
12464 but preserve the type of NODE if the type is fixed. */
12467 patch_unaryop (node, wfl_op)
12471 tree op = TREE_OPERAND (node, 0);
12472 tree op_type = TREE_TYPE (op);
12473 tree prom_type = NULL_TREE, value, decl;
12474 int code = TREE_CODE (node);
12475 int error_found = 0;
12477 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
12481 /* 15.13.2 Postfix Increment Operator ++ */
12482 case POSTINCREMENT_EXPR:
12483 /* 15.13.3 Postfix Increment Operator -- */
12484 case POSTDECREMENT_EXPR:
12485 /* 15.14.1 Prefix Increment Operator ++ */
12486 case PREINCREMENT_EXPR:
12487 /* 15.14.2 Prefix Decrement Operator -- */
12488 case PREDECREMENT_EXPR:
12489 decl = strip_out_static_field_access_decl (op);
12490 /* We really should have a JAVA_ARRAY_EXPR to avoid this */
12491 if (!JDECL_P (decl)
12492 && TREE_CODE (decl) != COMPONENT_REF
12493 && !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF)
12494 && TREE_CODE (decl) != INDIRECT_REF
12495 && !(TREE_CODE (decl) == COMPOUND_EXPR
12496 && TREE_OPERAND (decl, 1)
12497 && (TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF)))
12500 /* Before screaming, check that we're not in fact trying to
12501 increment a optimized static final access, in which case
12502 we issue an different error message. */
12503 if (!(TREE_CODE (wfl_op) == EXPR_WITH_FILE_LOCATION
12504 && resolve_expression_name (wfl_op, &lvalue)
12505 && check_final_assignment (lvalue, wfl_op)))
12506 parse_error_context (wfl_operator, "Invalid argument to `%s'",
12507 operator_string (node));
12508 TREE_TYPE (node) = error_mark_node;
12511 else if (check_final_assignment (op, wfl_op))
12514 /* From now on, we know that op if a variable and that it has a
12515 valid wfl. We use wfl_op to locate errors related to the
12517 else if (!JNUMERIC_TYPE_P (op_type))
12519 parse_error_context
12520 (wfl_op, "Invalid argument type `%s' to `%s'",
12521 lang_printable_name (op_type, 0), operator_string (node));
12522 TREE_TYPE (node) = error_mark_node;
12527 /* Before the addition, binary numeric promotion is performed on
12529 value = build_int_2 (1, 0);
12531 binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value);
12532 /* And write the promoted incremented and increment */
12533 TREE_OPERAND (node, 0) = op;
12534 TREE_OPERAND (node, 1) = value;
12535 /* Convert the overall back into its original type. */
12536 return fold (convert (op_type, node));
12540 /* 15.14.3 Unary Plus Operator + */
12541 case UNARY_PLUS_EXPR:
12542 /* 15.14.4 Unary Minus Operator - */
12544 if (!JNUMERIC_TYPE_P (op_type))
12546 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type);
12547 TREE_TYPE (node) = error_mark_node;
12550 /* Unary numeric promotion is performed on operand */
12553 op = do_unary_numeric_promotion (op);
12554 prom_type = TREE_TYPE (op);
12555 if (code == UNARY_PLUS_EXPR)
12560 /* 15.14.5 Bitwise Complement Operator ~ */
12562 if (!JINTEGRAL_TYPE_P (op_type))
12564 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type);
12565 TREE_TYPE (node) = error_mark_node;
12570 op = do_unary_numeric_promotion (op);
12571 prom_type = TREE_TYPE (op);
12575 /* 15.14.6 Logical Complement Operator ! */
12576 case TRUTH_NOT_EXPR:
12577 if (TREE_CODE (op_type) != BOOLEAN_TYPE)
12579 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type);
12580 /* But the type is known. We will report an error if further
12581 attempt of a assignment is made with this rhs */
12582 TREE_TYPE (node) = boolean_type_node;
12586 prom_type = boolean_type_node;
12589 /* 15.15 Cast Expression */
12591 value = patch_cast (node, wfl_operator);
12592 if (value == error_mark_node)
12594 /* If this cast is part of an assignment, we tell the code
12595 that deals with it not to complain about a mismatch,
12596 because things have been cast, anyways */
12597 TREE_TYPE (node) = error_mark_node;
12602 value = fold (value);
12603 TREE_SIDE_EFFECTS (value) = TREE_SIDE_EFFECTS (op);
12610 return error_mark_node;
12612 /* There are cases where node has been replaced by something else
12613 and we don't end up returning here: UNARY_PLUS_EXPR,
12614 CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
12615 TREE_OPERAND (node, 0) = fold (op);
12616 TREE_TYPE (node) = prom_type;
12617 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op);
12618 return fold (node);
12621 /* Generic type resolution that sometimes takes place during node
12622 patching. Returned the resolved type or generate an error
12623 message. Return the resolved type or NULL_TREE. */
12626 resolve_type_during_patch (type)
12629 if (unresolved_type_p (type, NULL))
12631 tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE);
12634 parse_error_context (type,
12635 "Class `%s' not found in type declaration",
12636 IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
12641 CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1;
12642 return TREE_TYPE (type_decl);
12647 /* 5.5 Casting Conversion. error_mark_node is returned if an error is
12648 found. Otherwise NODE or something meant to replace it is returned. */
12651 patch_cast (node, wfl_operator)
12655 tree op = TREE_OPERAND (node, 0);
12656 tree op_type = TREE_TYPE (op);
12657 tree cast_type = TREE_TYPE (node);
12660 /* First resolve OP_TYPE if unresolved */
12661 if (!(cast_type = resolve_type_during_patch (cast_type)))
12662 return error_mark_node;
12664 /* Check on cast that are proven correct at compile time */
12665 if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
12667 static tree convert_narrow ();
12669 if (cast_type == op_type)
12672 /* float and double type are converted to the original type main
12673 variant and then to the target type. */
12674 if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE)
12675 op = convert (integer_type_node, op);
12677 /* Try widening/narowwing convertion. Potentially, things need
12678 to be worked out in gcc so we implement the extreme cases
12679 correctly. fold_convert() needs to be fixed. */
12680 return convert (cast_type, op);
12683 /* It's also valid to cast a boolean into a boolean */
12684 if (op_type == boolean_type_node && cast_type == boolean_type_node)
12687 /* null can be casted to references */
12688 if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type))
12689 return build_null_of_type (cast_type);
12691 /* The remaining legal casts involve conversion between reference
12692 types. Check for their compile time correctness. */
12693 if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type)
12694 && valid_ref_assignconv_cast_p (op_type, cast_type, 1))
12696 TREE_TYPE (node) = promote_type (cast_type);
12697 /* Now, the case can be determined correct at compile time if
12698 OP_TYPE can be converted into CAST_TYPE by assignment
12699 conversion (5.2) */
12701 if (valid_ref_assignconv_cast_p (op_type, cast_type, 0))
12703 TREE_SET_CODE (node, NOP_EXPR);
12707 if (flag_emit_class_files)
12709 TREE_SET_CODE (node, CONVERT_EXPR);
12713 /* The cast requires a run-time check */
12714 return build (CALL_EXPR, promote_type (cast_type),
12715 build_address_of (soft_checkcast_node),
12716 tree_cons (NULL_TREE, build_class_ref (cast_type),
12717 build_tree_list (NULL_TREE, op)),
12721 /* Any other casts are proven incorrect at compile time */
12722 t1 = strdup (lang_printable_name (op_type, 0));
12723 parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
12724 t1, lang_printable_name (cast_type, 0));
12726 return error_mark_node;
12729 /* Build a null constant and give it the type TYPE. */
12732 build_null_of_type (type)
12735 tree node = build_int_2 (0, 0);
12736 TREE_TYPE (node) = promote_type (type);
12740 /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
12741 a list of indices. */
12743 build_array_ref (location, array, index)
12747 tree node = build (ARRAY_REF, NULL_TREE, array, index);
12748 EXPR_WFL_LINECOL (node) = location;
12752 /* 15.12 Array Access Expression */
12755 patch_array_ref (node)
12758 tree array = TREE_OPERAND (node, 0);
12759 tree array_type = TREE_TYPE (array);
12760 tree index = TREE_OPERAND (node, 1);
12761 tree index_type = TREE_TYPE (index);
12762 int error_found = 0;
12764 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
12766 if (TREE_CODE (array_type) == POINTER_TYPE)
12767 array_type = TREE_TYPE (array_type);
12769 /* The array reference must be an array */
12770 if (!TYPE_ARRAY_P (array_type))
12772 parse_error_context
12773 (wfl_operator, "`[]' can only be applied to arrays. It can't be "
12774 "applied to `%s'", lang_printable_name (array_type, 0));
12775 TREE_TYPE (node) = error_mark_node;
12779 /* The array index underdoes unary numeric promotion. The promoted
12780 type must be int */
12781 index = do_unary_numeric_promotion (index);
12782 if (TREE_TYPE (index) != int_type_node)
12784 int could_cast = valid_cast_to_p (index_type, int_type_node);
12785 parse_error_context
12787 (could_cast ? "Incompatible type for `[]'. Explicit cast needed to "
12788 "convert `%s' to `int'" : "Incompatible type for `[]'. "
12789 "Can't convert `%s' to `int'"),
12790 lang_printable_name (index_type, 0));
12791 TREE_TYPE (node) = error_mark_node;
12796 return error_mark_node;
12798 array_type = TYPE_ARRAY_ELEMENT (array_type);
12800 if (flag_emit_class_files || flag_emit_xref)
12802 TREE_OPERAND (node, 0) = array;
12803 TREE_OPERAND (node, 1) = index;
12807 /* The save_expr is for correct evaluation order. It would be cleaner
12808 to use force_evaluation_order (see comment there), but that is
12809 difficult when we also have to deal with bounds checking. */
12810 if (TREE_SIDE_EFFECTS (index))
12811 array = save_expr (array);
12812 node = build_java_arrayaccess (array, array_type, index);
12813 if (TREE_SIDE_EFFECTS (index))
12814 node = build (COMPOUND_EXPR, array_type, array, node);
12816 TREE_TYPE (node) = array_type;
12820 /* 15.9 Array Creation Expressions */
12823 build_newarray_node (type, dims, extra_dims)
12829 build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims),
12830 build_int_2 (extra_dims, 0));
12835 patch_newarray (node)
12838 tree type = TREE_OPERAND (node, 0);
12839 tree dims = TREE_OPERAND (node, 1);
12840 tree cdim, array_type;
12841 int error_found = 0;
12843 int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2));
12845 /* Dimension types are verified. It's better for the types to be
12846 verified in order. */
12847 for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ )
12850 tree dim = TREE_VALUE (cdim);
12852 /* Dim might have been saved during its evaluation */
12853 dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim);
12855 /* The type of each specified dimension must be an integral type. */
12856 if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim)))
12859 /* Each expression undergoes an unary numeric promotion (5.6.1) and the
12860 promoted type must be int. */
12863 dim = do_unary_numeric_promotion (dim);
12864 if (TREE_TYPE (dim) != int_type_node)
12868 /* Report errors on types here */
12871 parse_error_context
12872 (TREE_PURPOSE (cdim),
12873 "Incompatible type for dimension in array creation expression. "
12874 "%s convert `%s' to `int'",
12875 (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ?
12876 "Explicit cast needed to" : "Can't"),
12877 lang_printable_name (TREE_TYPE (dim), 0));
12881 TREE_PURPOSE (cdim) = NULL_TREE;
12884 /* Resolve array base type if unresolved */
12885 if (!(type = resolve_type_during_patch (type)))
12890 /* We don't want further evaluation of this bogus array creation
12892 TREE_TYPE (node) = error_mark_node;
12893 return error_mark_node;
12896 /* Set array_type to the actual (promoted) array type of the result. */
12897 if (TREE_CODE (type) == RECORD_TYPE)
12898 type = build_pointer_type (type);
12899 while (--xdims >= 0)
12901 type = promote_type (build_java_array_type (type, -1));
12903 dims = nreverse (dims);
12905 for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim))
12908 array_type = build_java_array_type (type,
12909 TREE_CODE (cdim) == INTEGER_CST ?
12910 TREE_INT_CST_LOW (cdim) : -1);
12911 array_type = promote_type (array_type);
12913 dims = nreverse (dims);
12915 /* The node is transformed into a function call. Things are done
12916 differently according to the number of dimensions. If the number
12917 of dimension is equal to 1, then the nature of the base type
12918 (primitive or not) matters. */
12920 return build_new_array (type, TREE_VALUE (dims));
12922 /* Can't reuse what's already written in expr.c because it uses the
12923 JVM stack representation. Provide a build_multianewarray. FIXME */
12924 return build (CALL_EXPR, array_type,
12925 build_address_of (soft_multianewarray_node),
12926 tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)),
12927 tree_cons (NULL_TREE,
12928 build_int_2 (ndims, 0), dims )),
12932 /* 10.6 Array initializer. */
12934 /* Build a wfl for array element that don't have one, so we can
12935 pin-point errors. */
12938 maybe_build_array_element_wfl (node)
12941 if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION)
12942 return build_expr_wfl (NULL_TREE, ctxp->filename,
12943 ctxp->elc.line, ctxp->elc.prev_col);
12948 /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
12949 identification of initialized arrays easier to detect during walk
12953 build_new_array_init (location, values)
12957 tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values);
12958 tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor);
12959 EXPR_WFL_LINECOL (to_return) = location;
12963 /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
12964 occurred. Otherwise return NODE after having set its type
12968 patch_new_array_init (type, node)
12971 int error_seen = 0;
12972 tree current, element_type;
12973 HOST_WIDE_INT length;
12974 int all_constant = 1;
12975 tree init = TREE_OPERAND (node, 0);
12977 if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type)))
12979 parse_error_context (node,
12980 "Invalid array initializer for non-array type `%s'",
12981 lang_printable_name (type, 1));
12982 return error_mark_node;
12984 type = TREE_TYPE (type);
12985 element_type = TYPE_ARRAY_ELEMENT (type);
12987 CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init));
12989 for (length = 0, current = CONSTRUCTOR_ELTS (init);
12990 current; length++, current = TREE_CHAIN (current))
12992 tree elt = TREE_VALUE (current);
12993 if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT)
12995 error_seen |= array_constructor_check_entry (element_type, current);
12996 elt = TREE_VALUE (current);
12997 /* When compiling to native code, STRING_CST is converted to
12998 INDIRECT_REF, but still with a TREE_CONSTANT flag. */
12999 if (! TREE_CONSTANT (elt) || TREE_CODE (elt) == INDIRECT_REF)
13004 TREE_VALUE (current) = patch_new_array_init (element_type, elt);
13005 TREE_PURPOSE (current) = NULL_TREE;
13008 if (elt && TREE_VALUE (elt) == error_mark_node)
13013 return error_mark_node;
13015 /* Create a new type. We can't reuse the one we have here by
13016 patching its dimension because it originally is of dimension -1
13017 hence reused by gcc. This would prevent triangular arrays. */
13018 type = build_java_array_type (element_type, length);
13019 TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type))));
13020 TREE_TYPE (node) = promote_type (type);
13021 TREE_CONSTANT (init) = all_constant;
13022 TREE_CONSTANT (node) = all_constant;
13026 /* Verify that one entry of the initializer element list can be
13027 assigned to the array base type. Report 1 if an error occurred, 0
13031 array_constructor_check_entry (type, entry)
13034 char *array_type_string = NULL; /* For error reports */
13035 tree value, type_value, new_value, wfl_value, patched;
13036 int error_seen = 0;
13038 new_value = NULL_TREE;
13039 wfl_value = TREE_VALUE (entry);
13041 value = java_complete_tree (TREE_VALUE (entry));
13042 /* patch_string return error_mark_node if arg is error_mark_node */
13043 if ((patched = patch_string (value)))
13045 if (value == error_mark_node)
13048 type_value = TREE_TYPE (value);
13050 /* At anytime, try_builtin_assignconv can report a warning on
13051 constant overflow during narrowing. */
13052 SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value);
13053 new_value = try_builtin_assignconv (wfl_operator, type, value);
13054 if (!new_value && (new_value = try_reference_assignconv (type, value)))
13055 type_value = promote_type (type);
13057 /* Check and report errors */
13060 char *msg = (!valid_cast_to_p (type_value, type) ?
13061 "Can't" : "Explicit cast needed to");
13062 if (!array_type_string)
13063 array_type_string = strdup (lang_printable_name (type, 1));
13064 parse_error_context
13065 (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
13066 msg, lang_printable_name (type_value, 1), array_type_string);
13072 new_value = maybe_build_primttype_type_ref (new_value, wfl_operator);
13073 TREE_VALUE (entry) = new_value;
13076 if (array_type_string)
13077 free (array_type_string);
13079 TREE_PURPOSE (entry) = NULL_TREE;
13084 build_this (location)
13087 tree node = build_wfl_node (this_identifier_node);
13088 TREE_SET_CODE (node, THIS_EXPR);
13089 EXPR_WFL_LINECOL (node) = location;
13093 /* 14.15 The return statement. It builds a modify expression that
13094 assigns the returned value to the RESULT_DECL that hold the value
13098 build_return (location, op)
13102 tree node = build1 (RETURN_EXPR, NULL_TREE, op);
13103 EXPR_WFL_LINECOL (node) = location;
13104 node = build_debugable_stmt (location, node);
13109 patch_return (node)
13112 tree return_exp = TREE_OPERAND (node, 0);
13113 tree meth = current_function_decl;
13114 tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl));
13115 int error_found = 0;
13117 TREE_TYPE (node) = error_mark_node;
13118 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13120 /* It's invalid to have a return value within a function that is
13121 declared with the keyword void or that is a constructor */
13122 if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth)))
13125 /* It's invalid to use a return statement in a static block */
13126 if (IS_CLINIT (current_function_decl))
13129 /* It's invalid to have a no return value within a function that
13130 isn't declared with the keyword `void' */
13131 if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth)))
13136 if (IS_CLINIT (current_function_decl))
13137 parse_error_context (wfl_operator,
13138 "`return' inside static initializer.");
13140 else if (!DECL_CONSTRUCTOR_P (meth))
13142 char *t = strdup (lang_printable_name (mtype, 0));
13143 parse_error_context (wfl_operator,
13144 "`return' with%s value from `%s %s'",
13145 (error_found == 1 ? "" : "out"),
13146 t, lang_printable_name (meth, 0));
13150 parse_error_context (wfl_operator,
13151 "`return' with value from constructor `%s'",
13152 lang_printable_name (meth, 0));
13153 return error_mark_node;
13156 /* If we have a return_exp, build a modify expression and expand
13157 it. Note: at that point, the assignment is declared valid, but we
13158 may want to carry some more hacks */
13161 tree exp = java_complete_tree (return_exp);
13162 tree modify, patched;
13164 /* If the function returned value and EXP are booleans, EXP has
13165 to be converted into the type of DECL_RESULT, which is integer
13166 (see complete_start_java_method) */
13167 if (TREE_TYPE (exp) == boolean_type_node &&
13168 TREE_TYPE (TREE_TYPE (meth)) == boolean_type_node)
13169 exp = convert_to_integer (TREE_TYPE (DECL_RESULT (meth)), exp);
13171 /* `null' can be assigned to a function returning a reference */
13172 if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth))) &&
13173 exp == null_pointer_node)
13174 exp = build_null_of_type (TREE_TYPE (TREE_TYPE (meth)));
13176 if ((patched = patch_string (exp)))
13179 modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp);
13180 EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node);
13181 modify = java_complete_tree (modify);
13183 if (modify != error_mark_node)
13185 TREE_SIDE_EFFECTS (modify) = 1;
13186 TREE_OPERAND (node, 0) = modify;
13189 return error_mark_node;
13191 TREE_TYPE (node) = void_type_node;
13192 TREE_SIDE_EFFECTS (node) = 1;
13196 /* 14.8 The if Statement */
13199 build_if_else_statement (location, expression, if_body, else_body)
13201 tree expression, if_body, else_body;
13205 else_body = empty_stmt_node;
13206 node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body);
13207 EXPR_WFL_LINECOL (node) = location;
13208 node = build_debugable_stmt (location, node);
13213 patch_if_else_statement (node)
13216 tree expression = TREE_OPERAND (node, 0);
13218 TREE_TYPE (node) = error_mark_node;
13219 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13221 /* The type of expression must be boolean */
13222 if (TREE_TYPE (expression) != boolean_type_node
13223 && TREE_TYPE (expression) != promoted_boolean_type_node)
13225 parse_error_context
13227 "Incompatible type for `if'. Can't convert `%s' to `boolean'",
13228 lang_printable_name (TREE_TYPE (expression), 0));
13229 return error_mark_node;
13232 TREE_TYPE (node) = void_type_node;
13233 TREE_SIDE_EFFECTS (node) = 1;
13234 CAN_COMPLETE_NORMALLY (node)
13235 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
13236 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2));
13240 /* 14.6 Labeled Statements */
13242 /* Action taken when a lableled statement is parsed. a new
13243 LABELED_BLOCK_EXPR is created. No statement is attached to the
13244 label, yet. LABEL can be NULL_TREE for artificially-generated blocks. */
13247 build_labeled_block (location, label)
13252 tree label_decl, node;
13253 if (label == NULL_TREE || label == continue_identifier_node)
13254 label_name = label;
13257 label_name = merge_qualified_name (label_id, label);
13258 /* Issue an error if we try to reuse a label that was previously
13260 if (IDENTIFIER_LOCAL_VALUE (label_name))
13262 EXPR_WFL_LINECOL (wfl_operator) = location;
13263 parse_error_context (wfl_operator, "Declaration of `%s' shadows "
13264 "a previous label declaration",
13265 IDENTIFIER_POINTER (label));
13266 EXPR_WFL_LINECOL (wfl_operator) =
13267 EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
13268 parse_error_context (wfl_operator, "This is the location of the "
13269 "previous declaration of label `%s'",
13270 IDENTIFIER_POINTER (label));
13271 java_error_count--;
13275 label_decl = create_label_decl (label_name);
13276 node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE);
13277 EXPR_WFL_LINECOL (node) = location;
13278 TREE_SIDE_EFFECTS (node) = 1;
13282 /* A labeled statement LBE is attached a statement. */
13285 finish_labeled_statement (lbe, statement)
13286 tree lbe; /* Labeled block expr */
13289 /* In anyways, tie the loop to its statement */
13290 LABELED_BLOCK_BODY (lbe) = statement;
13291 pop_labeled_block ();
13292 POP_LABELED_BLOCK ();
13296 /* 14.10, 14.11, 14.12 Loop Statements */
13298 /* Create an empty LOOP_EXPR and make it the last in the nested loop
13302 build_new_loop (loop_body)
13305 tree loop = build (LOOP_EXPR, NULL_TREE, loop_body);
13306 TREE_SIDE_EFFECTS (loop) = 1;
13311 /* Create a loop body according to the following structure:
13313 COMPOUND_EXPR (loop main body)
13314 EXIT_EXPR (this order is for while/for loops.
13315 LABELED_BLOCK_EXPR the order is reversed for do loops)
13316 LABEL_DECL (a continue occuring here branches at the
13317 BODY end of this labeled block)
13320 REVERSED, if non zero, tells that the loop condition expr comes
13321 after the body, like in the do-while loop.
13323 To obtain a loop, the loop body structure described above is
13324 encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
13327 LABEL_DECL (use this label to exit the loop)
13329 <structure described above> */
13332 build_loop_body (location, condition, reversed)
13337 tree first, second, body;
13339 condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */
13340 EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */
13341 condition = build_debugable_stmt (location, condition);
13342 TREE_SIDE_EFFECTS (condition) = 1;
13344 body = build_labeled_block (0, continue_identifier_node);
13345 first = (reversed ? body : condition);
13346 second = (reversed ? condition : body);
13348 build (COMPOUND_EXPR, NULL_TREE,
13349 build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node);
13352 /* Install CONDITION (if any) and loop BODY (using REVERSED to tell
13353 their order) on the current loop. Unlink the current loop from the
13357 finish_loop_body (location, condition, body, reversed)
13359 tree condition, body;
13362 tree to_return = ctxp->current_loop;
13363 tree loop_body = LOOP_EXPR_BODY (to_return);
13366 tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed);
13367 /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
13368 The real EXIT_EXPR is one operand further. */
13369 EXPR_WFL_LINECOL (cnode) = location;
13370 /* This one is for accurate error reports */
13371 EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location;
13372 TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition;
13374 LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body;
13379 /* Tailored version of finish_loop_body for FOR loops, when FOR
13380 loops feature the condition part */
13383 finish_for_loop (location, condition, update, body)
13385 tree condition, update, body;
13387 /* Put the condition and the loop body in place */
13388 tree loop = finish_loop_body (location, condition, body, 0);
13389 /* LOOP is the current loop which has been now popped of the loop
13390 stack. Install the update block */
13391 LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
13395 /* If the loop isn't surrounded by a labeled statement, create one and
13396 insert LOOP as its body. */
13399 patch_loop_statement (loop)
13403 tree block = ctxp->current_labeled_block;
13404 TREE_TYPE (loop) = void_type_node;
13405 if (block != NULL_TREE)
13407 tree block_body = LABELED_BLOCK_BODY (block);
13408 if (IS_FOR_LOOP_P (loop))
13410 if (TREE_CODE (block_body) == BLOCK)
13412 block_body = BLOCK_EXPR_BODY (block_body);
13413 if (block_body == loop
13414 || (TREE_CODE (block_body) == COMPOUND_EXPR
13415 && TREE_OPERAND (block_body, 1) == loop))
13421 if (block_body == loop)
13425 loop_label = build_labeled_block (0, NULL_TREE);
13426 LABELED_BLOCK_BODY (loop_label) = loop;
13427 PUSH_LABELED_BLOCK (loop_label);
13432 /* 14.13, 14.14: break and continue Statements */
13434 /* Build a break or a continue statement. a null NAME indicates an
13435 unlabeled break/continue statement. */
13438 build_bc_statement (location, is_break, name)
13439 int location, is_break;
13442 tree break_continue, label_block_expr = NULL_TREE;
13446 if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE
13447 (merge_qualified_name (label_id, EXPR_WFL_NODE (name)))))
13448 /* Null means that we don't have a target for this named
13449 break/continue. In this case, we make the target to be the
13450 label name, so that the error can be reported accuratly in
13451 patch_bc_statement. */
13452 label_block_expr = EXPR_WFL_NODE (name);
13454 /* Unlabeled break/continue will be handled during the
13455 break/continue patch operation */
13457 = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE);
13459 IS_BREAK_STMT_P (break_continue) = is_break;
13460 TREE_SIDE_EFFECTS (break_continue) = 1;
13461 EXPR_WFL_LINECOL (break_continue) = location;
13462 break_continue = build_debugable_stmt (location, break_continue);
13463 return break_continue;
13466 /* Verification of a break/continue statement. */
13469 patch_bc_statement (node)
13472 tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt;
13473 tree labeled_block = ctxp->current_labeled_block;
13474 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13476 /* Having an identifier here means that the target is unknown. */
13477 if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE)
13479 parse_error_context (wfl_operator, "No label definition found for `%s'",
13480 IDENTIFIER_POINTER (bc_label));
13481 return error_mark_node;
13483 if (! IS_BREAK_STMT_P (node))
13485 /* It's a continue statement. */
13486 for (;; labeled_block = TREE_CHAIN (labeled_block))
13488 if (labeled_block == NULL_TREE)
13490 if (bc_label == NULL_TREE)
13491 parse_error_context (wfl_operator,
13492 "`continue' must be in loop");
13494 parse_error_context
13495 (wfl_operator, "continue label `%s' does not name a loop",
13496 IDENTIFIER_POINTER (bc_label));
13497 return error_mark_node;
13499 if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block))
13500 == continue_identifier_node)
13501 && (bc_label == NULL_TREE
13502 || TREE_CHAIN (labeled_block) == bc_label))
13504 bc_label = labeled_block;
13509 else if (!bc_label)
13511 for (;; labeled_block = TREE_CHAIN (labeled_block))
13513 if (labeled_block == NULL_TREE)
13515 parse_error_context (wfl_operator,
13516 "`break' must be in loop or switch");
13517 return error_mark_node;
13519 target_stmt = LABELED_BLOCK_BODY (labeled_block);
13520 if (TREE_CODE (target_stmt) == SWITCH_EXPR
13521 || TREE_CODE (target_stmt) == LOOP_EXPR)
13523 bc_label = labeled_block;
13529 EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
13530 CAN_COMPLETE_NORMALLY (bc_label) = 1;
13532 /* Our break/continue don't return values. */
13533 TREE_TYPE (node) = void_type_node;
13534 /* Encapsulate the break within a compound statement so that it's
13535 expanded all the times by expand_expr (and not clobered
13536 sometimes, like after a if statement) */
13537 node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
13538 TREE_SIDE_EFFECTS (node) = 1;
13542 /* Process the exit expression belonging to a loop. Its type must be
13546 patch_exit_expr (node)
13549 tree expression = TREE_OPERAND (node, 0);
13550 TREE_TYPE (node) = error_mark_node;
13551 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13553 /* The type of expression must be boolean */
13554 if (TREE_TYPE (expression) != boolean_type_node)
13556 parse_error_context
13558 "Incompatible type for loop conditional. Can't convert `%s' to "
13560 lang_printable_name (TREE_TYPE (expression), 0));
13561 return error_mark_node;
13563 /* Now we know things are allright, invert the condition, fold and
13565 TREE_OPERAND (node, 0) =
13566 fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression));
13568 if (! integer_zerop (TREE_OPERAND (node, 0))
13569 && ctxp->current_loop != NULL_TREE
13570 && TREE_CODE (ctxp->current_loop) == LOOP_EXPR)
13571 CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1;
13572 if (! integer_onep (TREE_OPERAND (node, 0)))
13573 CAN_COMPLETE_NORMALLY (node) = 1;
13576 TREE_TYPE (node) = void_type_node;
13580 /* 14.9 Switch statement */
13583 patch_switch_statement (node)
13586 tree se = TREE_OPERAND (node, 0), se_type;
13588 /* Complete the switch expression */
13589 se = TREE_OPERAND (node, 0) = java_complete_tree (se);
13590 se_type = TREE_TYPE (se);
13591 /* The type of the switch expression must be char, byte, short or
13593 if (!JINTEGRAL_TYPE_P (se_type))
13595 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13596 parse_error_context (wfl_operator, "Incompatible type for `switch'. "
13597 "Can't convert `%s' to `int'",
13598 lang_printable_name (se_type, 0));
13599 /* This is what java_complete_tree will check */
13600 TREE_OPERAND (node, 0) = error_mark_node;
13601 return error_mark_node;
13604 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
13606 /* Ready to return */
13607 if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK)
13609 TREE_TYPE (node) = error_mark_node;
13610 return error_mark_node;
13612 TREE_TYPE (node) = void_type_node;
13613 TREE_SIDE_EFFECTS (node) = 1;
13614 CAN_COMPLETE_NORMALLY (node)
13615 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
13616 || ! SWITCH_HAS_DEFAULT (node);
13620 /* 14.18 The try statement */
13623 build_try_statement (location, try_block, catches)
13625 tree try_block, catches;
13627 tree node = build (TRY_EXPR, NULL_TREE, try_block, catches);
13628 EXPR_WFL_LINECOL (node) = location;
13633 build_try_finally_statement (location, try_block, finally)
13635 tree try_block, finally;
13637 tree node = build (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally);
13638 EXPR_WFL_LINECOL (node) = location;
13643 patch_try_statement (node)
13646 int error_found = 0;
13647 tree try = TREE_OPERAND (node, 0);
13648 /* Exception handlers are considered in left to right order */
13649 tree catch = nreverse (TREE_OPERAND (node, 1));
13650 tree current, caught_type_list = NULL_TREE;
13652 /* Check catch clauses, if any. Every time we find an error, we try
13653 to process the next catch clause. We process the catch clause before
13654 the try block so that when processing the try block we can check thrown
13655 exceptions againts the caught type list. */
13656 for (current = catch; current; current = TREE_CHAIN (current))
13658 tree carg_decl, carg_type;
13659 tree sub_current, catch_block, catch_clause;
13662 /* At this point, the structure of the catch clause is
13663 CATCH_EXPR (catch node)
13664 BLOCK (with the decl of the parameter)
13666 MODIFY_EXPR (assignment of the catch parameter)
13667 BLOCK (catch clause block)
13669 catch_clause = TREE_OPERAND (current, 0);
13670 carg_decl = BLOCK_EXPR_DECLS (catch_clause);
13671 carg_type = TREE_TYPE (TREE_TYPE (carg_decl));
13673 /* Catch clauses can't have more than one parameter declared,
13674 but it's already enforced by the grammar. Make sure that the
13675 only parameter of the clause statement in of class Throwable
13676 or a subclass of Throwable, but that was done earlier. The
13677 catch clause parameter type has also been resolved. */
13679 /* Just make sure that the catch clause parameter type inherits
13680 from java.lang.Throwable */
13681 if (!inherits_from_p (carg_type, throwable_type_node))
13683 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
13684 parse_error_context (wfl_operator,
13685 "Can't catch class `%s'. Catch clause "
13686 "parameter type must be a subclass of "
13687 "class `java.lang.Throwable'",
13688 lang_printable_name (carg_type, 0));
13693 /* Partial check for unreachable catch statement: The catch
13694 clause is reachable iff is no earlier catch block A in
13695 the try statement such that the type of the catch
13696 clause's parameter is the same as or a subclass of the
13697 type of A's parameter */
13699 for (sub_current = catch;
13700 sub_current != current; sub_current = TREE_CHAIN (sub_current))
13702 tree sub_catch_clause, decl;
13703 sub_catch_clause = TREE_OPERAND (sub_current, 0);
13704 decl = BLOCK_EXPR_DECLS (sub_catch_clause);
13706 if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl))))
13708 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
13709 parse_error_context
13710 (wfl_operator, "`catch' not reached because of the catch "
13711 "clause at line %d", EXPR_WFL_LINENO (sub_current));
13712 unreachable = error_found = 1;
13716 /* Complete the catch clause block */
13717 catch_block = java_complete_tree (TREE_OPERAND (current, 0));
13718 if (catch_block == error_mark_node)
13723 if (CAN_COMPLETE_NORMALLY (catch_block))
13724 CAN_COMPLETE_NORMALLY (node) = 1;
13725 TREE_OPERAND (current, 0) = catch_block;
13730 /* Things to do here: the exception must be thrown */
13732 /* Link this type to the caught type list */
13733 caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list);
13736 PUSH_EXCEPTIONS (caught_type_list);
13737 if ((try = java_complete_tree (try)) == error_mark_node)
13739 if (CAN_COMPLETE_NORMALLY (try))
13740 CAN_COMPLETE_NORMALLY (node) = 1;
13743 /* Verification ends here */
13745 return error_mark_node;
13747 TREE_OPERAND (node, 0) = try;
13748 TREE_OPERAND (node, 1) = catch;
13749 TREE_TYPE (node) = void_type_node;
13753 /* 14.17 The synchronized Statement */
13756 patch_synchronized_statement (node, wfl_op1)
13757 tree node, wfl_op1;
13759 tree expr = java_complete_tree (TREE_OPERAND (node, 0));
13760 tree block = TREE_OPERAND (node, 1);
13762 tree enter, exit, expr_decl, assignment;
13764 if (expr == error_mark_node)
13766 block = java_complete_tree (block);
13770 /* The TYPE of expr must be a reference type */
13771 if (!JREFERENCE_TYPE_P (TREE_TYPE (expr)))
13773 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
13774 parse_error_context (wfl_operator, "Incompatible type for `synchronized'"
13775 ". Can't convert `%s' to `java.lang.Object'",
13776 lang_printable_name (TREE_TYPE (expr), 0));
13777 return error_mark_node;
13780 if (flag_emit_xref)
13782 TREE_OPERAND (node, 0) = expr;
13783 TREE_OPERAND (node, 1) = java_complete_tree (block);
13784 CAN_COMPLETE_NORMALLY (node) = 1;
13788 /* Generate a try-finally for the synchronized statement, except
13789 that the handler that catches all throw exception calls
13790 _Jv_MonitorExit and then rethrow the exception.
13791 The synchronized statement is then implemented as:
13794 _Jv_MonitorEnter (expression)
13796 _Jv_MonitorExit (expression)
13800 e = _Jv_exception_info ();
13801 _Jv_MonitorExit (expression)
13805 expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr));
13806 BUILD_MONITOR_ENTER (enter, expr_decl);
13807 BUILD_MONITOR_EXIT (exit, expr_decl);
13808 CAN_COMPLETE_NORMALLY (enter) = 1;
13809 CAN_COMPLETE_NORMALLY (exit) = 1;
13810 assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr);
13811 TREE_SIDE_EFFECTS (assignment) = 1;
13812 node = build1 (CLEANUP_POINT_EXPR, NULL_TREE,
13813 build (COMPOUND_EXPR, NULL_TREE,
13814 build (WITH_CLEANUP_EXPR, NULL_TREE,
13815 build (COMPOUND_EXPR, NULL_TREE,
13816 assignment, enter),
13819 node = build_expr_block (node, expr_decl);
13821 return java_complete_tree (node);
13824 /* 14.16 The throw Statement */
13827 patch_throw_statement (node, wfl_op1)
13828 tree node, wfl_op1;
13830 tree expr = TREE_OPERAND (node, 0);
13831 tree type = TREE_TYPE (expr);
13832 int unchecked_ok = 0, tryblock_throws_ok = 0;
13834 /* Thrown expression must be assignable to java.lang.Throwable */
13835 if (!try_reference_assignconv (throwable_type_node, expr))
13837 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
13838 parse_error_context (wfl_operator, "Can't throw `%s'; it must be a "
13839 "subclass of class `java.lang.Throwable'",
13840 lang_printable_name (type, 0));
13841 /* If the thrown expression was a reference, we further the
13842 compile-time check. */
13843 if (!JREFERENCE_TYPE_P (type))
13844 return error_mark_node;
13847 /* At least one of the following must be true */
13849 /* The type of the throw expression is a not checked exception,
13850 i.e. is a unchecked expression. */
13851 unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type));
13853 /* Throw is contained in a try statement and at least one catch
13854 clause can receive the thrown expression or the current method is
13855 declared to throw such an exception. Or, the throw statement is
13856 contained in a method or constructor declaration and the type of
13857 the Expression is assignable to at least one type listed in the
13858 throws clause the declaration. */
13859 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
13861 tryblock_throws_ok = check_thrown_exceptions_do (TREE_TYPE (expr));
13862 if (!(unchecked_ok || tryblock_throws_ok))
13864 /* If there is a surrounding try block that has no matching
13865 clatch clause, report it first. A surrounding try block exits
13866 only if there is something after the list of checked
13867 exception thrown by the current function (if any). */
13868 if (IN_TRY_BLOCK_P ())
13869 parse_error_context (wfl_operator, "Checked exception `%s' can't be "
13870 "caught by any of the catch clause(s) "
13871 "of the surrounding `try' block",
13872 lang_printable_name (type, 0));
13873 /* If we have no surrounding try statement and the method doesn't have
13874 any throws, report it now. FIXME */
13876 /* We report that the exception can't be throw from a try block
13877 in all circumstances but when the `throw' is inside a static
13879 else if (!EXCEPTIONS_P (currently_caught_type_list)
13880 && !tryblock_throws_ok)
13882 if (IS_CLINIT (current_function_decl))
13883 parse_error_context (wfl_operator, "Checked exception `%s' can't "
13884 "be thrown in initializer",
13885 lang_printable_name (type, 0));
13887 parse_error_context (wfl_operator, "Checked exception `%s' isn't "
13888 "thrown from a `try' block",
13889 lang_printable_name (type, 0));
13891 /* Otherwise, the current method doesn't have the appropriate
13892 throws declaration */
13894 parse_error_context (wfl_operator, "Checked exception `%s' doesn't "
13895 "match any of current method's `throws' "
13897 lang_printable_name (type, 0));
13898 return error_mark_node;
13901 if (! flag_emit_class_files && ! flag_emit_xref)
13902 BUILD_THROW (node, expr);
13904 /* If doing xrefs, keep the location where the `throw' was seen. */
13905 if (flag_emit_xref)
13906 EXPR_WFL_LINECOL (node) = EXPR_WFL_LINECOL (wfl_op1);
13910 /* Check that exception said to be thrown by method DECL can be
13911 effectively caught from where DECL is invoked. */
13914 check_thrown_exceptions (location, decl)
13919 /* For all the unchecked exceptions thrown by DECL */
13920 for (throws = DECL_FUNCTION_THROWS (decl); throws;
13921 throws = TREE_CHAIN (throws))
13922 if (!check_thrown_exceptions_do (TREE_VALUE (throws)))
13925 /* Temporary hack to suppresses errors about cloning arrays. FIXME */
13926 if (DECL_NAME (decl) == get_identifier ("clone"))
13929 EXPR_WFL_LINECOL (wfl_operator) = location;
13930 parse_error_context
13931 (wfl_operator, "Exception `%s' must be caught, or it must be "
13932 "declared in the `throws' clause of `%s'",
13933 lang_printable_name (TREE_VALUE (throws), 0),
13934 IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
13938 /* Return 1 if checked EXCEPTION is caught at the current nesting level of
13939 try-catch blocks, OR is listed in the `throws' clause of the
13943 check_thrown_exceptions_do (exception)
13946 tree list = currently_caught_type_list;
13947 resolve_and_layout (exception, NULL_TREE);
13948 /* First, all the nested try-catch-finally at that stage. The
13949 last element contains `throws' clause exceptions, if any. */
13950 if (IS_UNCHECKED_EXCEPTION_P (exception))
13955 for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught))
13956 if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0))
13958 list = TREE_CHAIN (list);
13964 purge_unchecked_exceptions (mdecl)
13967 tree throws = DECL_FUNCTION_THROWS (mdecl);
13968 tree new = NULL_TREE;
13972 tree next = TREE_CHAIN (throws);
13973 if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws)))
13975 TREE_CHAIN (throws) = new;
13980 /* List is inverted here, but it doesn't matter */
13981 DECL_FUNCTION_THROWS (mdecl) = new;
13984 /* 15.24 Conditional Operator ?: */
13987 patch_conditional_expr (node, wfl_cond, wfl_op1)
13988 tree node, wfl_cond, wfl_op1;
13990 tree cond = TREE_OPERAND (node, 0);
13991 tree op1 = TREE_OPERAND (node, 1);
13992 tree op2 = TREE_OPERAND (node, 2);
13993 tree resulting_type = NULL_TREE;
13994 tree t1, t2, patched;
13995 int error_found = 0;
13997 /* Operands of ?: might be StringBuffers crafted as a result of a
13998 string concatenation. Obtain a descent operand here. */
13999 if ((patched = patch_string (op1)))
14000 TREE_OPERAND (node, 1) = op1 = patched;
14001 if ((patched = patch_string (op2)))
14002 TREE_OPERAND (node, 2) = op2 = patched;
14004 t1 = TREE_TYPE (op1);
14005 t2 = TREE_TYPE (op2);
14007 /* The first expression must be a boolean */
14008 if (TREE_TYPE (cond) != boolean_type_node)
14010 SET_WFL_OPERATOR (wfl_operator, node, wfl_cond);
14011 parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
14012 "convert `%s' to `boolean'",
14013 lang_printable_name (TREE_TYPE (cond), 0));
14017 /* Second and third can be numeric, boolean (i.e. primitive),
14018 references or null. Anything else results in an error */
14019 if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2))
14020 || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node)
14021 && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node))
14022 || (t1 == boolean_type_node && t2 == boolean_type_node)))
14025 /* Determine the type of the conditional expression. Same types are
14026 easy to deal with */
14028 resulting_type = t1;
14030 /* There are different rules for numeric types */
14031 else if (JNUMERIC_TYPE_P (t1))
14033 /* if byte/short found, the resulting type is short */
14034 if ((t1 == byte_type_node && t2 == short_type_node)
14035 || (t1 == short_type_node && t2 == byte_type_node))
14036 resulting_type = short_type_node;
14038 /* If t1 is a constant int and t2 is of type byte, short or char
14039 and t1's value fits in t2, then the resulting type is t2 */
14040 else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1)))
14041 && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2))
14042 resulting_type = t2;
14044 /* If t2 is a constant int and t1 is of type byte, short or char
14045 and t2's value fits in t1, then the resulting type is t1 */
14046 else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2)))
14047 && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1))
14048 resulting_type = t1;
14050 /* Otherwise, binary numeric promotion is applied and the
14051 resulting type is the promoted type of operand 1 and 2 */
14053 resulting_type = binary_numeric_promotion (t1, t2,
14054 &TREE_OPERAND (node, 1),
14055 &TREE_OPERAND (node, 2));
14058 /* Cases of a reference and a null type */
14059 else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node)
14060 resulting_type = t1;
14062 else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node)
14063 resulting_type = t2;
14065 /* Last case: different reference types. If a type can be converted
14066 into the other one by assignment conversion, the latter
14067 determines the type of the expression */
14068 else if ((resulting_type = try_reference_assignconv (t1, op2)))
14069 resulting_type = promote_type (t1);
14071 else if ((resulting_type = try_reference_assignconv (t2, op1)))
14072 resulting_type = promote_type (t2);
14074 /* If we don't have any resulting type, we're in trouble */
14075 if (!resulting_type)
14077 char *t = strdup (lang_printable_name (t1, 0));
14078 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
14079 parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
14080 "convert `%s' to `%s'", t,
14081 lang_printable_name (t2, 0));
14088 TREE_TYPE (node) = error_mark_node;
14089 return error_mark_node;
14092 TREE_TYPE (node) = resulting_type;
14093 TREE_SET_CODE (node, COND_EXPR);
14094 CAN_COMPLETE_NORMALLY (node) = 1;
14098 /* Try to constant fold NODE.
14099 If NODE is not a constant expression, return NULL_EXPR.
14100 CONTEXT is a static final VAR_DECL whose initializer we are folding. */
14103 fold_constant_for_init (node, context)
14107 tree op0, op1, val;
14108 enum tree_code code = TREE_CODE (node);
14110 if (code == STRING_CST)
14113 if (code == INTEGER_CST || code == REAL_CST)
14114 return convert (TREE_TYPE (context), node);
14115 if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL)
14123 case TRUNC_MOD_EXPR:
14131 case TRUTH_ANDIF_EXPR:
14132 case TRUTH_ORIF_EXPR:
14139 op0 = TREE_OPERAND (node, 0);
14140 op1 = TREE_OPERAND (node, 1);
14141 val = fold_constant_for_init (op0, context);
14142 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14144 TREE_OPERAND (node, 0) = val;
14145 val = fold_constant_for_init (op1, context);
14146 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14148 TREE_OPERAND (node, 1) = val;
14149 return patch_binop (node, op0, op1);
14151 case UNARY_PLUS_EXPR:
14153 case TRUTH_NOT_EXPR:
14156 op0 = TREE_OPERAND (node, 0);
14157 val = fold_constant_for_init (op0, context);
14158 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14160 TREE_OPERAND (node, 0) = val;
14161 return patch_unaryop (node, op0);
14165 val = fold_constant_for_init (TREE_OPERAND (node, 0), context);
14166 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14168 TREE_OPERAND (node, 0) = val;
14169 val = fold_constant_for_init (TREE_OPERAND (node, 1), context);
14170 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14172 TREE_OPERAND (node, 1) = val;
14173 val = fold_constant_for_init (TREE_OPERAND (node, 2), context);
14174 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14176 TREE_OPERAND (node, 2) = val;
14177 return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1)
14178 : TREE_OPERAND (node, 2);
14181 if (! FIELD_STATIC (node) || ! FIELD_FINAL (node)
14182 || DECL_INITIAL (node) == NULL_TREE)
14184 val = DECL_INITIAL (node);
14185 /* Guard against infinite recursion. */
14186 DECL_INITIAL (node) = NULL_TREE;
14187 val = fold_constant_for_init (val, node);
14188 DECL_INITIAL (node) = val;
14191 case EXPR_WITH_FILE_LOCATION:
14192 /* Compare java_complete_tree and resolve_expression_name. */
14193 if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
14194 || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
14196 tree name = EXPR_WFL_NODE (node);
14198 if (PRIMARY_P (node))
14200 else if (! QUALIFIED_P (name))
14202 decl = lookup_field_wrapper (DECL_CONTEXT (context), name);
14203 if (decl == NULL_TREE || ! FIELD_STATIC (decl))
14205 return fold_constant_for_init (decl, decl);
14209 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
14210 qualify_ambiguous_name (node);
14211 if (resolve_field_access (node, &decl, NULL)
14212 && decl != NULL_TREE)
14213 return fold_constant_for_init (decl, decl);
14219 op0 = TREE_OPERAND (node, 0);
14220 val = fold_constant_for_init (op0, context);
14221 if (val == NULL_TREE || ! TREE_CONSTANT (val))
14223 TREE_OPERAND (node, 0) = val;
14227 #ifdef USE_COMPONENT_REF
14229 case COMPONENT_REF:
14238 #ifdef USE_COMPONENT_REF
14239 /* Context is 'T' for TypeName, 'P' for PackageName,
14240 'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */
14243 resolve_simple_name (name, context)
14250 resolve_qualified_name (name, context)