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
141 #include "java-tree.h"
149 #ifndef DIR_SEPARATOR
150 #define DIR_SEPARATOR '/'
153 /* Local function prototypes */
154 static char *java_accstring_lookup
PROTO ((int));
155 static void classitf_redefinition_error
PROTO ((char *,tree
, tree
, tree
));
156 static void variable_redefinition_error
PROTO ((tree
, tree
, tree
, int));
157 static void check_modifiers
PROTO ((char *, int, int));
158 static tree create_class
PROTO ((int, tree
, tree
, tree
));
159 static tree create_interface
PROTO ((int, tree
, tree
));
160 static tree find_field
PROTO ((tree
, tree
));
161 static tree lookup_field_wrapper
PROTO ((tree
, tree
));
162 static int duplicate_declaration_error_p
PROTO ((tree
, tree
, tree
));
163 static void register_fields
PROTO ((int, tree
, tree
));
164 static tree parser_qualified_classname
PROTO ((tree
));
165 static int parser_check_super
PROTO ((tree
, tree
, tree
));
166 static int parser_check_super_interface
PROTO ((tree
, tree
, tree
));
167 static void check_modifiers_consistency
PROTO ((int));
168 static tree lookup_cl
PROTO ((tree
));
169 static tree lookup_java_method2
PROTO ((tree
, tree
, int));
170 static tree method_header
PROTO ((int, tree
, tree
, tree
));
171 static void fix_method_argument_names
PROTO ((tree
,tree
));
172 static tree method_declarator
PROTO ((tree
, tree
));
173 static void parse_warning_context
VPROTO ((tree cl
, char *msg
, ...));
174 static void issue_warning_error_from_context
PROTO ((tree
, char *msg
, va_list));
175 static tree parse_jdk1_1_error
PROTO ((char *));
176 static void complete_class_report_errors
PROTO ((jdep
*));
177 static int process_imports
PROTO ((void));
178 static void read_import_dir
PROTO ((tree
));
179 static int find_in_imports_on_demand
PROTO ((tree
));
180 static int find_in_imports
PROTO ((tree
));
181 static int check_pkg_class_access
PROTO ((tree
, tree
));
182 static tree resolve_package
PROTO ((tree
, tree
*));
183 static tree lookup_package_type
PROTO ((char *, int));
184 static tree resolve_class
PROTO ((tree
, tree
, tree
));
185 static tree do_resolve_class
PROTO ((tree
, tree
, tree
));
186 static void declare_local_variables
PROTO ((int, tree
, tree
));
187 static void source_start_java_method
PROTO ((tree
));
188 static void source_end_java_method
PROTO ((void));
189 static void expand_start_java_method
PROTO ((tree
));
190 static tree find_name_in_single_imports
PROTO ((tree
));
191 static void check_abstract_method_header
PROTO ((tree
));
192 static tree lookup_java_interface_method2
PROTO ((tree
, tree
));
193 static tree resolve_expression_name
PROTO ((tree
, tree
*));
194 static tree maybe_create_class_interface_decl
PROTO ((tree
, tree
, tree
));
195 static int check_class_interface_creation
PROTO ((int, int, tree
,
197 static tree patch_method_invocation
PROTO ((tree
, tree
, tree
,
199 static int breakdown_qualified
PROTO ((tree
*, tree
*, tree
));
200 static tree resolve_and_layout
PROTO ((tree
, tree
));
201 static tree resolve_no_layout
PROTO ((tree
, tree
));
202 static int invocation_mode
PROTO ((tree
, int));
203 static tree find_applicable_accessible_methods_list
PROTO ((int, tree
,
205 static tree find_most_specific_methods_list
PROTO ((tree
));
206 static int argument_types_convertible
PROTO ((tree
, tree
));
207 static tree patch_invoke
PROTO ((tree
, tree
, tree
));
208 static tree lookup_method_invoke
PROTO ((int, tree
, tree
, tree
, tree
));
209 static tree register_incomplete_type
PROTO ((int, tree
, tree
, tree
));
210 static tree obtain_incomplete_type
PROTO ((tree
));
211 static tree java_complete_lhs
PROTO ((tree
));
212 static tree java_complete_tree
PROTO ((tree
));
213 static void java_complete_expand_method
PROTO ((tree
));
214 static int unresolved_type_p
PROTO ((tree
, tree
*));
215 static void create_jdep_list
PROTO ((struct parser_ctxt
*));
216 static tree build_expr_block
PROTO ((tree
, tree
));
217 static tree enter_block
PROTO ((void));
218 static tree enter_a_block
PROTO ((tree
));
219 static tree exit_block
PROTO ((void));
220 static tree lookup_name_in_blocks
PROTO ((tree
));
221 static void maybe_absorb_scoping_blocks
PROTO ((void));
222 static tree build_method_invocation
PROTO ((tree
, tree
));
223 static tree build_new_invocation
PROTO ((tree
, tree
));
224 static tree build_assignment
PROTO ((int, int, tree
, tree
));
225 static tree build_binop
PROTO ((enum tree_code
, int, tree
, tree
));
226 static int check_final_assignment
PROTO ((tree
,tree
));
227 static tree patch_assignment
PROTO ((tree
, tree
, tree
));
228 static tree patch_binop
PROTO ((tree
, tree
, tree
));
229 static tree build_unaryop
PROTO ((int, int, tree
));
230 static tree build_incdec
PROTO ((int, int, tree
, int));
231 static tree patch_unaryop
PROTO ((tree
, tree
));
232 static tree build_cast
PROTO ((int, tree
, tree
));
233 static tree build_null_of_type
PROTO ((tree
));
234 static tree patch_cast
PROTO ((tree
, tree
));
235 static int valid_ref_assignconv_cast_p
PROTO ((tree
, tree
, int));
236 static int valid_builtin_assignconv_identity_widening_p
PROTO ((tree
, tree
));
237 static int valid_cast_to_p
PROTO ((tree
, tree
));
238 static int valid_method_invocation_conversion_p
PROTO ((tree
, tree
));
239 static tree try_builtin_assignconv
PROTO ((tree
, tree
, tree
));
240 static tree try_reference_assignconv
PROTO ((tree
, tree
));
241 static tree build_unresolved_array_type
PROTO ((tree
));
242 static tree build_array_from_name
PROTO ((tree
, tree
, tree
, tree
*));
243 static tree build_array_ref
PROTO ((int, tree
, tree
));
244 static tree patch_array_ref
PROTO ((tree
));
245 static tree make_qualified_name
PROTO ((tree
, tree
, int));
246 static tree merge_qualified_name
PROTO ((tree
, tree
));
247 static tree make_qualified_primary
PROTO ((tree
, tree
, int));
248 static int resolve_qualified_expression_name
PROTO ((tree
, tree
*,
250 static void qualify_ambiguous_name
PROTO ((tree
));
251 static void maybe_generate_clinit
PROTO ((void));
252 static tree resolve_field_access
PROTO ((tree
, tree
*, tree
*));
253 static tree build_newarray_node
PROTO ((tree
, tree
, int));
254 static tree patch_newarray
PROTO ((tree
));
255 static tree resolve_type_during_patch
PROTO ((tree
));
256 static tree build_this
PROTO ((int));
257 static tree build_return
PROTO ((int, tree
));
258 static tree patch_return
PROTO ((tree
));
259 static tree maybe_access_field
PROTO ((tree
, tree
, tree
));
260 static int complete_function_arguments
PROTO ((tree
));
261 static int check_for_static_method_reference
PROTO ((tree
, tree
, tree
, tree
, tree
));
262 static int not_accessible_p
PROTO ((tree
, tree
, int));
263 static void check_deprecation
PROTO ((tree
, tree
));
264 static int class_in_current_package
PROTO ((tree
));
265 static tree build_if_else_statement
PROTO ((int, tree
, tree
, tree
));
266 static tree patch_if_else_statement
PROTO ((tree
));
267 static tree add_stmt_to_compound
PROTO ((tree
, tree
, tree
));
268 static tree add_stmt_to_block
PROTO ((tree
, tree
, tree
));
269 static tree patch_exit_expr
PROTO ((tree
));
270 static tree build_labeled_block
PROTO ((int, tree
));
271 static tree generate_labeled_block
PROTO (());
272 static tree complete_labeled_statement
PROTO ((tree
, tree
));
273 static tree build_bc_statement
PROTO ((int, int, tree
));
274 static tree patch_bc_statement
PROTO ((tree
));
275 static tree patch_loop_statement
PROTO ((tree
));
276 static tree build_new_loop
PROTO ((tree
));
277 static tree build_loop_body
PROTO ((int, tree
, int));
278 static tree complete_loop_body
PROTO ((int, tree
, tree
, int));
279 static tree build_debugable_stmt
PROTO ((int, tree
));
280 static tree complete_for_loop
PROTO ((int, tree
, tree
, tree
));
281 static tree patch_switch_statement
PROTO ((tree
));
282 static tree string_constant_concatenation
PROTO ((tree
, tree
));
283 static tree build_string_concatenation
PROTO ((tree
, tree
));
284 static tree patch_string_cst
PROTO ((tree
));
285 static tree patch_string
PROTO ((tree
));
286 static tree build_jump_to_finally
PROTO ((tree
, tree
, tree
, tree
));
287 static tree build_try_statement
PROTO ((int, tree
, tree
, tree
));
288 static tree patch_try_statement
PROTO ((tree
));
289 static tree patch_synchronized_statement
PROTO ((tree
, tree
));
290 static tree patch_throw_statement
PROTO ((tree
, tree
));
291 static void check_thrown_exceptions
PROTO ((int, tree
));
292 static int check_thrown_exceptions_do
PROTO ((tree
));
293 static void purge_unchecked_exceptions
PROTO ((tree
));
294 static void check_throws_clauses
PROTO ((tree
, tree
, tree
));
295 static void complete_method_declaration
PROTO ((tree
));
296 static tree build_super_invocation
PROTO (());
297 static int verify_constructor_circularity
PROTO ((tree
, tree
));
298 static char *constructor_circularity_msg
PROTO ((tree
, tree
));
299 static tree build_this_super_qualified_invocation
PROTO ((int, tree
, tree
,
301 static char *get_printable_method_name
PROTO ((tree
));
302 static tree patch_conditional_expr
PROTO ((tree
, tree
, tree
));
303 static void maybe_generate_finit
PROTO (());
304 static void fix_constructors
PROTO ((tree
));
305 static int verify_constructor_super
PROTO (());
306 static tree create_artificial_method
PROTO ((tree
, int, tree
, tree
, tree
));
307 static void start_artificial_method_body
PROTO ((tree
));
308 static void end_artificial_method_body
PROTO ((tree
));
309 static int check_method_redefinition
PROTO ((tree
, tree
));
310 static int reset_method_name
PROTO ((tree
));
311 static void java_check_regular_methods
PROTO ((tree
));
312 static void java_check_abstract_methods
PROTO ((tree
));
313 static tree maybe_build_primttype_type_ref
PROTO ((tree
, tree
));
314 static void unreachable_stmt_error
PROTO ((tree
));
315 static tree find_expr_with_wfl
PROTO ((tree
));
316 static void missing_return_error
PROTO ((tree
));
317 static tree build_new_array_init
PROTO ((int, tree
));
318 static tree patch_new_array_init
PROTO ((tree
, tree
));
319 static tree maybe_build_array_element_wfl
PROTO ((tree
));
320 static int array_constructor_check_entry
PROTO ((tree
, tree
));
321 static char *purify_type_name
PROTO ((char *));
322 static tree patch_initialized_static_field
PROTO ((tree
));
323 static tree fold_constant_for_init
PROTO ((tree
, tree
));
325 /* Number of error found so far. */
326 int java_error_count
;
327 /* Number of warning found so far. */
328 int java_warning_count
;
330 /* The current parser context */
331 static struct parser_ctxt
*ctxp
;
333 /* List of things that were anlyzed for which code will be generated */
334 static struct parser_ctxt
*ctxp_for_generation
= NULL
;
336 /* binop_lookup maps token to tree_code. It is used where binary
337 operations are involved and required by the parser. RDIV_EXPR
338 covers both integral/floating point division. The code is changed
339 once the type of both operator is worked out. */
341 static enum tree_code binop_lookup
[19] =
343 PLUS_EXPR
, MINUS_EXPR
, MULT_EXPR
, RDIV_EXPR
, TRUNC_MOD_EXPR
,
344 LSHIFT_EXPR
, RSHIFT_EXPR
, URSHIFT_EXPR
,
345 BIT_AND_EXPR
, BIT_XOR_EXPR
, BIT_IOR_EXPR
,
346 TRUTH_ANDIF_EXPR
, TRUTH_ORIF_EXPR
,
347 EQ_EXPR
, NE_EXPR
, GT_EXPR
, GE_EXPR
, LT_EXPR
, LE_EXPR
,
349 #define BINOP_LOOKUP(VALUE) \
350 binop_lookup [((VALUE) - PLUS_TK)% \
351 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
353 /* Fake WFL used to report error message. It is initialized once if
354 needed and reused with it's location information is overriden. */
355 tree wfl_operator
= NULL_TREE
;
357 /* The "$L" identifier we use to create labels. */
358 static tree label_id
= NULL_TREE
;
360 /* The "StringBuffer" identifier used for the String `+' operator. */
361 static tree wfl_string_buffer
= NULL_TREE
;
363 /* The "append" identifier used for String `+' operator. */
364 static tree wfl_append
= NULL_TREE
;
366 /* The "toString" identifier used for String `+' operator. */
367 static tree wfl_to_string
= NULL_TREE
;
369 #line 294 "./parse.y"
394 #define YYFLAG -32768
397 #define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 265)
399 static const char yytranslate
[] = { 0,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
426 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
427 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
428 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
429 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
430 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
431 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
432 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
433 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
434 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
435 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
440 static const short yyprhs
[] = { 0,
441 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
442 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
443 46, 50, 54, 56, 58, 60, 64, 66, 67, 69,
444 71, 73, 76, 79, 82, 86, 88, 91, 93, 96,
445 100, 103, 107, 109, 111, 115, 118, 122, 128, 133,
446 139, 141, 143, 145, 147, 149, 152, 153, 161, 162,
447 169, 173, 176, 180, 185, 186, 189, 193, 196, 197,
448 200, 203, 205, 209, 213, 216, 220, 222, 225, 227,
449 229, 231, 233, 235, 237, 239, 241, 245, 250, 252,
450 256, 260, 262, 266, 270, 275, 277, 281, 284, 288,
451 292, 294, 296, 297, 301, 304, 308, 312, 317, 322,
452 325, 329, 332, 336, 339, 343, 348, 352, 356, 360,
453 362, 366, 370, 373, 377, 380, 384, 385, 388, 391,
454 393, 397, 401, 403, 406, 408, 411, 415, 417, 418,
455 422, 425, 429, 433, 438, 441, 445, 449, 454, 459,
456 465, 473, 480, 482, 484, 485, 490, 491, 497, 498,
457 504, 505, 512, 516, 521, 524, 528, 531, 535, 538,
458 542, 544, 547, 549, 551, 553, 555, 557, 560, 563,
459 566, 570, 575, 577, 581, 585, 588, 592, 594, 596,
460 598, 601, 603, 605, 607, 610, 613, 617, 619, 621,
461 623, 625, 627, 629, 631, 633, 635, 637, 639, 641,
462 643, 645, 647, 649, 651, 653, 655, 657, 659, 661,
463 663, 666, 669, 672, 675, 678, 681, 684, 687, 691,
464 696, 701, 707, 712, 718, 725, 733, 740, 742, 744,
465 746, 748, 750, 752, 754, 760, 763, 767, 772, 780,
466 788, 789, 793, 798, 801, 805, 811, 814, 818, 822,
467 827, 829, 832, 835, 837, 840, 844, 847, 850, 854,
468 857, 862, 865, 868, 872, 877, 880, 882, 890, 898,
469 905, 909, 915, 920, 928, 935, 938, 941, 945, 948,
470 949, 951, 953, 956, 957, 959, 961, 965, 969, 972,
471 976, 979, 983, 986, 990, 993, 997, 1000, 1004, 1007,
472 1011, 1015, 1018, 1022, 1028, 1034, 1037, 1042, 1046, 1048,
473 1052, 1056, 1061, 1064, 1066, 1069, 1072, 1077, 1080, 1084,
474 1089, 1092, 1095, 1097, 1099, 1101, 1103, 1107, 1109, 1111,
475 1113, 1115, 1119, 1123, 1127, 1131, 1135, 1139, 1143, 1147,
476 1153, 1158, 1165, 1171, 1176, 1182, 1188, 1195, 1199, 1203,
477 1208, 1214, 1217, 1221, 1225, 1229, 1231, 1235, 1239, 1243,
478 1247, 1252, 1257, 1262, 1267, 1271, 1275, 1277, 1280, 1284,
479 1288, 1291, 1294, 1298, 1302, 1306, 1310, 1313, 1317, 1322,
480 1328, 1335, 1341, 1348, 1353, 1358, 1363, 1368, 1372, 1377,
481 1381, 1386, 1388, 1390, 1392, 1394, 1397, 1400, 1402, 1404,
482 1407, 1410, 1412, 1415, 1418, 1421, 1424, 1427, 1430, 1432,
483 1435, 1438, 1440, 1443, 1446, 1452, 1457, 1462, 1468, 1473,
484 1476, 1482, 1487, 1493, 1495, 1499, 1503, 1507, 1511, 1515,
485 1519, 1521, 1525, 1529, 1533, 1537, 1539, 1543, 1547, 1551,
486 1555, 1559, 1563, 1565, 1569, 1573, 1577, 1581, 1585, 1589,
487 1593, 1597, 1601, 1605, 1607, 1611, 1615, 1619, 1623, 1625,
488 1629, 1633, 1635, 1639, 1643, 1645, 1649, 1653, 1655, 1659,
489 1663, 1665, 1669, 1673, 1675, 1681, 1686, 1690, 1696, 1698,
490 1700, 1704, 1708, 1710, 1712, 1714, 1716, 1718, 1720
493 static const short yyrhs
[] = { 123,
494 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
495 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
496 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
497 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
498 0, 118, 97, 98, 0, 113, 97, 1, 0, 118,
499 97, 1, 0, 120, 0, 121, 0, 122, 0, 119,
500 101, 122, 0, 86, 0, 0, 126, 0, 124, 0,
501 125, 0, 126, 124, 0, 126, 125, 0, 124, 125,
502 0, 126, 124, 125, 0, 127, 0, 124, 127, 0,
503 130, 0, 125, 130, 0, 75, 119, 99, 0, 75,
504 1, 0, 75, 119, 1, 0, 128, 0, 129, 0,
505 55, 119, 99, 0, 55, 1, 0, 55, 119, 1,
506 0, 55, 119, 101, 5, 99, 0, 55, 119, 101,
507 1, 0, 55, 119, 101, 5, 1, 0, 132, 0,
508 165, 0, 99, 0, 1, 0, 44, 0, 131, 44,
509 0, 0, 131, 67, 122, 135, 136, 133, 138, 0,
510 0, 67, 122, 135, 136, 134, 138, 0, 131, 67,
511 1, 0, 67, 1, 0, 67, 122, 1, 0, 131,
512 67, 122, 1, 0, 0, 63, 116, 0, 63, 116,
513 1, 0, 63, 1, 0, 0, 52, 137, 0, 52,
514 1, 0, 117, 0, 137, 100, 117, 0, 137, 100,
515 1, 0, 95, 96, 0, 95, 139, 96, 0, 140,
516 0, 139, 140, 0, 141, 0, 156, 0, 158, 0,
517 178, 0, 142, 0, 147, 0, 132, 0, 165, 0,
518 112, 143, 99, 0, 131, 112, 143, 99, 0, 144,
519 0, 143, 100, 144, 0, 143, 100, 1, 0, 145,
520 0, 145, 92, 146, 0, 145, 92, 1, 0, 145,
521 92, 146, 1, 0, 122, 0, 145, 97, 98, 0,
522 122, 1, 0, 145, 97, 1, 0, 145, 98, 1,
523 0, 263, 0, 176, 0, 0, 149, 148, 155, 0,
524 149, 1, 0, 112, 150, 153, 0, 59, 150, 153,
525 0, 131, 112, 150, 153, 0, 131, 59, 150, 153,
526 0, 112, 1, 0, 131, 112, 1, 0, 59, 1,
527 0, 131, 59, 1, 0, 131, 1, 0, 122, 93,
528 94, 0, 122, 93, 151, 94, 0, 150, 97, 98,
529 0, 122, 93, 1, 0, 150, 97, 1, 0, 152,
530 0, 151, 100, 152, 0, 151, 100, 1, 0, 112,
531 145, 0, 131, 112, 145, 0, 112, 1, 0, 131,
532 112, 1, 0, 0, 53, 154, 0, 53, 1, 0,
533 116, 0, 154, 100, 116, 0, 154, 100, 1, 0,
534 178, 0, 178, 99, 0, 99, 0, 157, 178, 0,
535 157, 178, 99, 0, 44, 0, 0, 160, 159, 162,
536 0, 161, 153, 0, 131, 161, 153, 0, 120, 93,
537 94, 0, 120, 93, 151, 94, 0, 179, 180, 0,
538 179, 163, 180, 0, 179, 181, 180, 0, 179, 163,
539 181, 180, 0, 164, 93, 94, 99, 0, 164, 93,
540 232, 94, 99, 0, 119, 101, 65, 93, 232, 94,
541 99, 0, 119, 101, 65, 93, 94, 99, 0, 76,
542 0, 65, 0, 0, 61, 122, 166, 171, 0, 0,
543 131, 61, 122, 167, 171, 0, 0, 61, 122, 170,
544 168, 171, 0, 0, 131, 61, 122, 170, 169, 171,
545 0, 61, 122, 1, 0, 131, 61, 122, 1, 0,
546 63, 117, 0, 170, 100, 117, 0, 63, 1, 0,
547 170, 100, 1, 0, 95, 96, 0, 95, 172, 96,
548 0, 173, 0, 172, 173, 0, 174, 0, 175, 0,
549 132, 0, 165, 0, 142, 0, 149, 99, 0, 149,
550 1, 0, 95, 96, 0, 95, 177, 96, 0, 95,
551 177, 100, 96, 0, 146, 0, 177, 100, 146, 0,
552 177, 100, 1, 0, 95, 96, 0, 179, 181, 180,
553 0, 95, 0, 96, 0, 182, 0, 181, 182, 0,
554 183, 0, 185, 0, 132, 0, 184, 99, 0, 112,
555 143, 0, 131, 112, 143, 0, 187, 0, 190, 0,
556 194, 0, 195, 0, 206, 0, 210, 0, 187, 0,
557 191, 0, 196, 0, 207, 0, 211, 0, 178, 0,
558 188, 0, 192, 0, 197, 0, 209, 0, 217, 0,
559 218, 0, 219, 0, 221, 0, 220, 0, 223, 0,
560 99, 0, 122, 88, 0, 189, 185, 0, 122, 1,
561 0, 189, 186, 0, 193, 99, 0, 1, 99, 0,
562 1, 95, 0, 1, 96, 0, 164, 93, 1, 0,
563 164, 93, 94, 1, 0, 164, 93, 232, 1, 0,
564 164, 93, 232, 94, 1, 0, 119, 101, 65, 1,
565 0, 119, 101, 65, 93, 1, 0, 119, 101, 65,
566 93, 232, 1, 0, 119, 101, 65, 93, 232, 94,
567 1, 0, 119, 101, 65, 93, 94, 1, 0, 260,
568 0, 244, 0, 245, 0, 241, 0, 242, 0, 238,
569 0, 230, 0, 48, 93, 263, 94, 185, 0, 48,
570 1, 0, 48, 93, 1, 0, 48, 93, 263, 1,
571 0, 48, 93, 263, 94, 186, 56, 185, 0, 48,
572 93, 263, 94, 186, 56, 186, 0, 0, 199, 198,
573 200, 0, 68, 93, 263, 94, 0, 68, 1, 0,
574 68, 93, 1, 0, 68, 93, 263, 94, 1, 0,
575 95, 96, 0, 95, 203, 96, 0, 95, 201, 96,
576 0, 95, 201, 203, 96, 0, 202, 0, 201, 202,
577 0, 203, 181, 0, 204, 0, 203, 204, 0, 62,
578 264, 88, 0, 47, 88, 0, 62, 1, 0, 62,
579 264, 1, 0, 47, 1, 0, 66, 93, 263, 94,
580 0, 205, 185, 0, 66, 1, 0, 66, 93, 1,
581 0, 66, 93, 263, 1, 0, 205, 186, 0, 51,
582 0, 208, 185, 66, 93, 263, 94, 99, 0, 213,
583 99, 263, 99, 215, 94, 185, 0, 213, 99, 99,
584 215, 94, 185, 0, 213, 99, 1, 0, 213, 99,
585 263, 99, 1, 0, 213, 99, 99, 1, 0, 213,
586 99, 263, 99, 215, 94, 186, 0, 213, 99, 99,
587 215, 94, 186, 0, 71, 93, 0, 71, 1, 0,
588 71, 93, 1, 0, 212, 214, 0, 0, 216, 0,
589 184, 0, 216, 1, 0, 0, 216, 0, 193, 0,
590 216, 100, 193, 0, 216, 100, 1, 0, 54, 99,
591 0, 54, 122, 99, 0, 54, 1, 0, 54, 122,
592 1, 0, 73, 99, 0, 73, 122, 99, 0, 73,
593 1, 0, 73, 122, 1, 0, 58, 99, 0, 58,
594 263, 99, 0, 58, 1, 0, 58, 263, 1, 0,
595 49, 263, 99, 0, 49, 1, 0, 49, 263, 1,
596 0, 222, 93, 263, 94, 178, 0, 222, 93, 263,
597 94, 1, 0, 222, 1, 0, 222, 93, 1, 94,
598 0, 222, 93, 1, 0, 44, 0, 70, 178, 224,
599 0, 70, 178, 227, 0, 70, 178, 224, 227, 0,
600 70, 1, 0, 225, 0, 224, 225, 0, 226, 178,
601 0, 60, 93, 152, 94, 0, 60, 1, 0, 60,
602 93, 1, 0, 60, 93, 1, 94, 0, 64, 178,
603 0, 64, 1, 0, 229, 0, 233, 0, 111, 0,
604 76, 0, 93, 263, 94, 0, 230, 0, 237, 0,
605 238, 0, 239, 0, 119, 101, 67, 0, 113, 101,
606 67, 0, 59, 101, 67, 0, 119, 101, 76, 0,
607 93, 263, 1, 0, 119, 101, 1, 0, 113, 101,
608 1, 0, 59, 101, 1, 0, 72, 116, 93, 232,
609 94, 0, 72, 116, 93, 94, 0, 72, 116, 93,
610 232, 94, 138, 0, 72, 116, 93, 94, 138, 0,
611 231, 122, 93, 94, 0, 231, 122, 93, 94, 138,
612 0, 231, 122, 93, 232, 94, 0, 231, 122, 93,
613 232, 94, 138, 0, 72, 1, 99, 0, 72, 116,
614 1, 0, 72, 116, 93, 1, 0, 72, 116, 93,
615 232, 1, 0, 231, 1, 0, 231, 122, 1, 0,
616 119, 101, 72, 0, 228, 101, 72, 0, 263, 0,
617 232, 100, 263, 0, 232, 100, 1, 0, 72, 113,
618 234, 0, 72, 115, 234, 0, 72, 113, 234, 236,
619 0, 72, 115, 234, 236, 0, 72, 115, 236, 176,
620 0, 72, 113, 236, 176, 0, 72, 1, 98, 0,
621 72, 1, 97, 0, 235, 0, 234, 235, 0, 97,
622 263, 98, 0, 97, 263, 1, 0, 97, 1, 0,
623 97, 98, 0, 236, 97, 98, 0, 236, 97, 1,
624 0, 228, 101, 122, 0, 65, 101, 122, 0, 65,
625 1, 0, 119, 93, 94, 0, 119, 93, 232, 94,
626 0, 228, 101, 122, 93, 94, 0, 228, 101, 122,
627 93, 232, 94, 0, 65, 101, 122, 93, 94, 0,
628 65, 101, 122, 93, 232, 94, 0, 65, 101, 1,
629 94, 0, 65, 101, 1, 101, 0, 119, 97, 263,
630 98, 0, 229, 97, 263, 98, 0, 119, 97, 1,
631 0, 119, 97, 263, 1, 0, 229, 97, 1, 0,
632 229, 97, 263, 1, 0, 228, 0, 119, 0, 241,
633 0, 242, 0, 240, 46, 0, 240, 45, 0, 244,
634 0, 245, 0, 3, 243, 0, 4, 243, 0, 246,
635 0, 3, 1, 0, 4, 1, 0, 46, 243, 0,
636 46, 1, 0, 45, 243, 0, 45, 1, 0, 240,
637 0, 89, 243, 0, 90, 243, 0, 247, 0, 89,
638 1, 0, 90, 1, 0, 93, 113, 236, 94, 243,
639 0, 93, 113, 94, 243, 0, 93, 263, 94, 246,
640 0, 93, 119, 236, 94, 246, 0, 93, 113, 97,
641 1, 0, 93, 1, 0, 93, 113, 236, 94, 1,
642 0, 93, 113, 94, 1, 0, 93, 119, 236, 94,
643 1, 0, 243, 0, 248, 5, 243, 0, 248, 6,
644 243, 0, 248, 7, 243, 0, 248, 5, 1, 0,
645 248, 6, 1, 0, 248, 7, 1, 0, 248, 0,
646 249, 3, 248, 0, 249, 4, 248, 0, 249, 3,
647 1, 0, 249, 4, 1, 0, 249, 0, 250, 8,
648 249, 0, 250, 9, 249, 0, 250, 10, 249, 0,
649 250, 8, 1, 0, 250, 9, 1, 0, 250, 10,
650 1, 0, 250, 0, 251, 20, 250, 0, 251, 18,
651 250, 0, 251, 21, 250, 0, 251, 19, 250, 0,
652 251, 57, 114, 0, 251, 20, 1, 0, 251, 18,
653 1, 0, 251, 21, 1, 0, 251, 19, 1, 0,
654 251, 57, 1, 0, 251, 0, 252, 16, 251, 0,
655 252, 17, 251, 0, 252, 16, 1, 0, 252, 17,
656 1, 0, 252, 0, 253, 11, 252, 0, 253, 11,
657 1, 0, 253, 0, 254, 12, 253, 0, 254, 12,
658 1, 0, 254, 0, 255, 13, 254, 0, 255, 13,
659 1, 0, 255, 0, 256, 14, 255, 0, 256, 14,
660 1, 0, 256, 0, 257, 15, 256, 0, 257, 15,
661 1, 0, 257, 0, 257, 87, 263, 88, 258, 0,
662 257, 87, 88, 1, 0, 257, 87, 1, 0, 257,
663 87, 263, 88, 1, 0, 258, 0, 260, 0, 261,
664 262, 259, 0, 261, 262, 1, 0, 119, 0, 237,
665 0, 239, 0, 91, 0, 92, 0, 259, 0, 263,
672 static const short yyrline
[] = { 0,
673 444, 450, 452, 453, 454, 455, 456, 460, 462, 465,
674 467, 468, 471, 473, 476, 480, 484, 488, 494, 496,
675 498, 500, 505, 507, 510, 514, 519, 524, 526, 527,
676 528, 529, 530, 531, 532, 535, 540, 546, 548, 551,
677 554, 556, 560, 562, 565, 592, 594, 598, 607, 609,
678 613, 620, 621, 623, 633, 638, 653, 657, 660, 663,
679 666, 668, 670, 672, 676, 678, 680, 682, 686, 688,
680 690, 697, 703, 708, 712, 715, 719, 721, 724, 726,
681 727, 728, 732, 734, 735, 737, 742, 745, 755, 758,
682 760, 764, 767, 774, 780, 788, 790, 792, 794, 796,
683 800, 802, 806, 813, 814, 818, 821, 823, 825, 827,
684 829, 831, 833, 835, 842, 845, 847, 856, 858, 862,
685 867, 872, 876, 881, 883, 885, 892, 894, 896, 900,
686 903, 905, 909, 911, 912, 917, 922, 928, 936, 943,
687 946, 949, 953, 956, 960, 969, 971, 973, 978, 985,
688 993, 995, 999, 1007, 1018, 1022, 1025, 1028, 1031, 1034,
689 1037, 1040, 1043, 1045, 1049, 1055, 1060, 1062, 1066, 1069,
690 1073, 1075, 1078, 1080, 1081, 1083, 1087, 1091, 1097, 1102,
691 1105, 1107, 1111, 1117, 1121, 1126, 1129, 1133, 1138, 1146,
692 1148, 1151, 1153, 1155, 1159, 1163, 1166, 1170, 1172, 1173,
693 1174, 1175, 1176, 1186, 1188, 1189, 1190, 1191, 1194, 1196,
694 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1208,
695 1213, 1224, 1231, 1235, 1246, 1256, 1262, 1268, 1274, 1276,
696 1282, 1284, 1290, 1292, 1294, 1296, 1298, 1302, 1304, 1305,
697 1306, 1307, 1308, 1309, 1312, 1315, 1317, 1319, 1323, 1328,
698 1333, 1339, 1349, 1355, 1357, 1359, 1366, 1369, 1371, 1373,
699 1377, 1379, 1382, 1386, 1388, 1391, 1398, 1404, 1406, 1408,
700 1412, 1420, 1423, 1425, 1427, 1431, 1436, 1445, 1450, 1453,
701 1460, 1462, 1464, 1468, 1471, 1480, 1487, 1489, 1493, 1506,
702 1508, 1514, 1520, 1524, 1526, 1530, 1533, 1535, 1539, 1542,
703 1544, 1546, 1550, 1553, 1555, 1557, 1561, 1564, 1566, 1568,
704 1572, 1578, 1580, 1584, 1591, 1593, 1595, 1597, 1601, 1609,
705 1612, 1614, 1616, 1620, 1622, 1629, 1637, 1654, 1656, 1658,
706 1662, 1668, 1673, 1675, 1678, 1680, 1682, 1684, 1685, 1686,
707 1687, 1691, 1693, 1695, 1700, 1702, 1704, 1706, 1708, 1712,
708 1715, 1720, 1722, 1727, 1728, 1729, 1730, 1731, 1733, 1735,
709 1737, 1739, 1741, 1745, 1747, 1750, 1756, 1761, 1765, 1768,
710 1770, 1772, 1776, 1778, 1780, 1782, 1786, 1789, 1793, 1799,
711 1801, 1809, 1812, 1814, 1818, 1823, 1831, 1835, 1838, 1840,
712 1851, 1862, 1867, 1876, 1878, 1882, 1885, 1887, 1892, 1897,
713 1902, 1909, 1911, 1912, 1913, 1916, 1921, 1926, 1928, 1929,
714 1931, 1933, 1934, 1936, 1940, 1943, 1947, 1950, 1954, 1956,
715 1958, 1960, 1961, 1963, 1967, 1975, 1977, 1979, 1991, 1993,
716 1999, 2001, 2003, 2007, 2009, 2014, 2019, 2024, 2026, 2028,
717 2032, 2034, 2039, 2044, 2046, 2050, 2052, 2057, 2062, 2067,
718 2069, 2071, 2075, 2077, 2082, 2087, 2092, 2097, 2099, 2101,
719 2103, 2105, 2107, 2111, 2113, 2118, 2123, 2125, 2129, 2131,
720 2136, 2140, 2142, 2147, 2151, 2153, 2158, 2162, 2164, 2169,
721 2173, 2175, 2180, 2184, 2186, 2191, 2197, 2199, 2203, 2205,
722 2208, 2211, 2219, 2221, 2222, 2225, 2227, 2230, 2234
727 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
729 static const char * const yytname
[] = { "$","error","$undefined.","PLUS_TK",
730 "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
731 "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
732 "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
733 "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
734 "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
735 "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
736 "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
737 "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
738 "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
739 "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
740 "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
741 "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
742 "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
743 "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
744 "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
745 "goal","literal","type","primitive_type","reference_type","class_or_interface_type",
746 "class_type","interface_type","array_type","name","simple_name","qualified_name",
747 "identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
748 "import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
749 "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
750 "interface_type_list","class_body","class_body_declarations","class_body_declaration",
751 "class_member_declaration","field_declaration","variable_declarators","variable_declarator",
752 "variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
753 "method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list",
754 "method_body","static_initializer","static","constructor_declaration","@4","constructor_header",
755 "constructor_declarator","constructor_body","explicit_constructor_invocation",
756 "this_or_super","interface_declaration","@5","@6","@7","@8","extends_interfaces",
757 "interface_body","interface_member_declarations","interface_member_declaration",
758 "constant_declaration","abstract_method_declaration","array_initializer","variable_initializers",
759 "block","block_begin","block_end","block_statements","block_statement","local_variable_declaration_statement",
760 "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
761 "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
762 "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
763 "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups",
764 "switch_block_statement_group","switch_labels","switch_label","while_expression",
765 "while_statement","while_statement_nsi","do_statement_begin","do_statement",
766 "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update",
767 "statement_expression_list","break_statement","continue_statement","return_statement",
768 "throw_statement","synchronized_statement","synchronized","try_statement","catches",
769 "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array",
770 "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression",
771 "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access",
772 "postfix_expression","post_increment_expression","post_decrement_expression",
773 "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus",
774 "cast_expression","multiplicative_expression","additive_expression","shift_expression",
775 "relational_expression","equality_expression","and_expression","exclusive_or_expression",
776 "inclusive_or_expression","conditional_and_expression","conditional_or_expression",
777 "conditional_expression","assignment_expression","assignment","left_hand_side",
778 "assignment_operator","expression","constant_expression", NULL
782 static const short yyr1
[] = { 0,
783 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
784 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
785 118, 118, 119, 119, 120, 121, 122, 123, 123, 123,
786 123, 123, 123, 123, 123, 124, 124, 125, 125, 126,
787 126, 126, 127, 127, 128, 128, 128, 129, 129, 129,
788 130, 130, 130, 130, 131, 131, 133, 132, 134, 132,
789 132, 132, 132, 132, 135, 135, 135, 135, 136, 136,
790 136, 137, 137, 137, 138, 138, 139, 139, 140, 140,
791 140, 140, 141, 141, 141, 141, 142, 142, 143, 143,
792 143, 144, 144, 144, 144, 145, 145, 145, 145, 145,
793 146, 146, 148, 147, 147, 149, 149, 149, 149, 149,
794 149, 149, 149, 149, 150, 150, 150, 150, 150, 151,
795 151, 151, 152, 152, 152, 152, 153, 153, 153, 154,
796 154, 154, 155, 155, 155, 156, 156, 157, 159, 158,
797 160, 160, 161, 161, 162, 162, 162, 162, 163, 163,
798 163, 163, 164, 164, 166, 165, 167, 165, 168, 165,
799 169, 165, 165, 165, 170, 170, 170, 170, 171, 171,
800 172, 172, 173, 173, 173, 173, 174, 175, 175, 176,
801 176, 176, 177, 177, 177, 178, 178, 179, 180, 181,
802 181, 182, 182, 182, 183, 184, 184, 185, 185, 185,
803 185, 185, 185, 186, 186, 186, 186, 186, 187, 187,
804 187, 187, 187, 187, 187, 187, 187, 187, 187, 188,
805 189, 190, 190, 191, 192, 192, 192, 192, 192, 192,
806 192, 192, 192, 192, 192, 192, 192, 193, 193, 193,
807 193, 193, 193, 193, 194, 194, 194, 194, 195, 196,
808 198, 197, 199, 199, 199, 199, 200, 200, 200, 200,
809 201, 201, 202, 203, 203, 204, 204, 204, 204, 204,
810 205, 206, 206, 206, 206, 207, 208, 209, 210, 210,
811 210, 210, 210, 211, 211, 212, 212, 212, 213, 214,
812 214, 214, 214, 215, 215, 216, 216, 216, 217, 217,
813 217, 217, 218, 218, 218, 218, 219, 219, 219, 219,
814 220, 220, 220, 221, 221, 221, 221, 221, 222, 223,
815 223, 223, 223, 224, 224, 225, 226, 226, 226, 226,
816 227, 227, 228, 228, 229, 229, 229, 229, 229, 229,
817 229, 229, 229, 229, 229, 229, 229, 229, 229, 230,
818 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
819 230, 230, 230, 231, 231, 232, 232, 232, 233, 233,
820 233, 233, 233, 233, 233, 233, 234, 234, 235, 235,
821 235, 236, 236, 236, 237, 237, 237, 238, 238, 238,
822 238, 238, 238, 238, 238, 239, 239, 239, 239, 239,
823 239, 240, 240, 240, 240, 241, 242, 243, 243, 243,
824 243, 243, 243, 243, 244, 244, 245, 245, 246, 246,
825 246, 246, 246, 246, 247, 247, 247, 247, 247, 247,
826 247, 247, 247, 248, 248, 248, 248, 248, 248, 248,
827 249, 249, 249, 249, 249, 250, 250, 250, 250, 250,
828 250, 250, 251, 251, 251, 251, 251, 251, 251, 251,
829 251, 251, 251, 252, 252, 252, 252, 252, 253, 253,
830 253, 254, 254, 254, 255, 255, 255, 256, 256, 256,
831 257, 257, 257, 258, 258, 258, 258, 258, 259, 259,
832 260, 260, 261, 261, 261, 262, 262, 263, 264
835 static const short yyr2
[] = { 0,
836 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
837 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
838 3, 3, 1, 1, 1, 3, 1, 0, 1, 1,
839 1, 2, 2, 2, 3, 1, 2, 1, 2, 3,
840 2, 3, 1, 1, 3, 2, 3, 5, 4, 5,
841 1, 1, 1, 1, 1, 2, 0, 7, 0, 6,
842 3, 2, 3, 4, 0, 2, 3, 2, 0, 2,
843 2, 1, 3, 3, 2, 3, 1, 2, 1, 1,
844 1, 1, 1, 1, 1, 1, 3, 4, 1, 3,
845 3, 1, 3, 3, 4, 1, 3, 2, 3, 3,
846 1, 1, 0, 3, 2, 3, 3, 4, 4, 2,
847 3, 2, 3, 2, 3, 4, 3, 3, 3, 1,
848 3, 3, 2, 3, 2, 3, 0, 2, 2, 1,
849 3, 3, 1, 2, 1, 2, 3, 1, 0, 3,
850 2, 3, 3, 4, 2, 3, 3, 4, 4, 5,
851 7, 6, 1, 1, 0, 4, 0, 5, 0, 5,
852 0, 6, 3, 4, 2, 3, 2, 3, 2, 3,
853 1, 2, 1, 1, 1, 1, 1, 2, 2, 2,
854 3, 4, 1, 3, 3, 2, 3, 1, 1, 1,
855 2, 1, 1, 1, 2, 2, 3, 1, 1, 1,
856 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
857 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
858 2, 2, 2, 2, 2, 2, 2, 2, 3, 4,
859 4, 5, 4, 5, 6, 7, 6, 1, 1, 1,
860 1, 1, 1, 1, 5, 2, 3, 4, 7, 7,
861 0, 3, 4, 2, 3, 5, 2, 3, 3, 4,
862 1, 2, 2, 1, 2, 3, 2, 2, 3, 2,
863 4, 2, 2, 3, 4, 2, 1, 7, 7, 6,
864 3, 5, 4, 7, 6, 2, 2, 3, 2, 0,
865 1, 1, 2, 0, 1, 1, 3, 3, 2, 3,
866 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
867 3, 2, 3, 5, 5, 2, 4, 3, 1, 3,
868 3, 4, 2, 1, 2, 2, 4, 2, 3, 4,
869 2, 2, 1, 1, 1, 1, 3, 1, 1, 1,
870 1, 3, 3, 3, 3, 3, 3, 3, 3, 5,
871 4, 6, 5, 4, 5, 5, 6, 3, 3, 4,
872 5, 2, 3, 3, 3, 1, 3, 3, 3, 3,
873 4, 4, 4, 4, 3, 3, 1, 2, 3, 3,
874 2, 2, 3, 3, 3, 3, 2, 3, 4, 5,
875 6, 5, 6, 4, 4, 4, 4, 3, 4, 3,
876 4, 1, 1, 1, 1, 2, 2, 1, 1, 2,
877 2, 1, 2, 2, 2, 2, 2, 2, 1, 2,
878 2, 1, 2, 2, 5, 4, 4, 5, 4, 2,
879 5, 4, 5, 1, 3, 3, 3, 3, 3, 3,
880 1, 3, 3, 3, 3, 1, 3, 3, 3, 3,
881 3, 3, 1, 3, 3, 3, 3, 3, 3, 3,
882 3, 3, 3, 1, 3, 3, 3, 3, 1, 3,
883 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
884 1, 3, 3, 1, 5, 4, 3, 5, 1, 1,
885 3, 3, 1, 1, 1, 1, 1, 1, 1
888 static const short yydefact
[] = { 0,
889 54, 55, 0, 0, 0, 0, 53, 1, 0, 0,
890 0, 36, 43, 44, 38, 0, 51, 52, 46, 27,
891 0, 23, 24, 25, 0, 62, 0, 41, 0, 0,
892 37, 39, 0, 0, 56, 0, 0, 47, 45, 0,
893 163, 0, 0, 159, 63, 0, 69, 42, 40, 0,
894 0, 0, 61, 0, 49, 0, 26, 167, 17, 165,
895 15, 0, 156, 0, 0, 68, 16, 0, 0, 59,
896 164, 0, 161, 64, 69, 50, 48, 12, 0, 10,
897 11, 169, 0, 8, 9, 13, 14, 15, 0, 175,
898 177, 0, 176, 0, 171, 173, 174, 168, 166, 160,
899 67, 71, 72, 70, 0, 158, 0, 57, 112, 0,
900 127, 110, 0, 0, 89, 92, 127, 0, 0, 0,
901 114, 0, 0, 179, 178, 170, 172, 0, 0, 60,
902 162, 0, 0, 0, 0, 107, 98, 87, 0, 0,
903 0, 0, 106, 21, 18, 22, 20, 19, 113, 127,
904 111, 0, 127, 74, 73, 55, 188, 75, 23, 0,
905 85, 0, 77, 79, 83, 84, 0, 80, 0, 81,
906 139, 127, 86, 82, 0, 58, 118, 115, 0, 0,
907 0, 120, 129, 130, 128, 119, 117, 91, 0, 90,
908 94, 0, 0, 0, 0, 0, 0, 0, 336, 0,
909 0, 0, 0, 6, 5, 2, 3, 4, 7, 335,
910 0, 403, 0, 102, 402, 333, 338, 0, 334, 339,
911 340, 341, 419, 404, 405, 434, 408, 409, 412, 422,
912 441, 446, 453, 464, 469, 472, 475, 478, 481, 484,
913 489, 498, 490, 0, 101, 99, 97, 100, 109, 88,
914 108, 186, 0, 127, 76, 78, 105, 0, 136, 0,
915 141, 0, 55, 0, 0, 277, 0, 0, 0, 0,
916 0, 0, 0, 0, 336, 0, 220, 0, 8, 403,
917 0, 0, 194, 0, 209, 0, 190, 192, 0, 193,
918 198, 210, 0, 199, 211, 0, 200, 201, 212, 251,
919 0, 202, 0, 213, 203, 290, 0, 214, 215, 216,
920 218, 217, 0, 219, 244, 243, 0, 241, 242, 239,
921 240, 238, 125, 123, 0, 116, 0, 0, 413, 403,
922 339, 341, 410, 414, 411, 418, 417, 416, 415, 0,
923 387, 0, 0, 0, 16, 0, 423, 420, 424, 421,
924 430, 0, 403, 0, 180, 183, 0, 0, 0, 0,
925 0, 95, 0, 0, 362, 0, 407, 406, 0, 0,
926 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
927 0, 0, 0, 0, 0, 0, 0, 0, 0, 496,
928 497, 0, 143, 0, 142, 135, 104, 133, 137, 188,
929 140, 0, 227, 228, 226, 246, 0, 312, 0, 301,
930 299, 0, 309, 307, 0, 273, 0, 254, 0, 323,
931 0, 287, 0, 305, 303, 0, 0, 196, 0, 0,
932 223, 221, 0, 0, 189, 187, 191, 195, 319, 403,
933 222, 225, 0, 272, 0, 403, 0, 292, 296, 289,
934 0, 0, 316, 0, 126, 124, 122, 121, 132, 131,
935 349, 344, 0, 386, 376, 375, 358, 0, 369, 377,
936 0, 370, 0, 359, 0, 0, 0, 0, 0, 0,
937 346, 337, 181, 0, 348, 343, 388, 0, 366, 398,
938 0, 347, 342, 364, 345, 365, 385, 400, 0, 363,
939 0, 438, 435, 439, 436, 440, 437, 444, 442, 445,
940 443, 450, 447, 451, 448, 452, 449, 460, 455, 462,
941 457, 459, 454, 461, 456, 463, 0, 458, 467, 465,
942 468, 466, 471, 470, 474, 473, 477, 476, 480, 479,
943 483, 482, 487, 0, 0, 492, 491, 144, 134, 403,
944 0, 0, 145, 0, 247, 0, 313, 311, 302, 300,
945 310, 308, 274, 0, 255, 0, 0, 0, 320, 324,
946 0, 321, 288, 306, 304, 337, 0, 197, 229, 0,
947 0, 0, 252, 0, 293, 0, 281, 0, 0, 318,
948 0, 394, 395, 0, 381, 382, 0, 378, 371, 0,
949 374, 372, 373, 360, 351, 0, 432, 426, 429, 0,
950 0, 427, 185, 182, 184, 389, 0, 399, 396, 0,
951 401, 397, 354, 0, 486, 0, 0, 146, 0, 0,
952 147, 248, 0, 275, 271, 0, 328, 0, 332, 331,
953 325, 322, 326, 233, 0, 230, 231, 0, 0, 0,
954 257, 0, 261, 0, 264, 0, 298, 297, 283, 0,
955 295, 0, 317, 0, 392, 0, 380, 379, 384, 383,
956 353, 361, 350, 431, 425, 433, 428, 368, 367, 390,
957 0, 355, 356, 488, 485, 0, 148, 0, 0, 0,
958 245, 0, 198, 0, 205, 206, 0, 207, 208, 0,
959 256, 329, 0, 234, 0, 0, 232, 270, 267, 268,
960 499, 0, 259, 262, 0, 258, 0, 265, 0, 0,
961 282, 0, 315, 314, 393, 352, 391, 357, 0, 149,
962 0, 0, 0, 224, 276, 0, 330, 327, 237, 235,
963 0, 269, 266, 260, 0, 280, 0, 0, 0, 150,
964 0, 249, 0, 0, 236, 278, 279, 152, 0, 0,
965 0, 0, 151, 0, 0, 0, 0, 285, 0, 250,
969 static const short yydefgoto
[] = { 772,
970 210, 278, 211, 85, 86, 68, 60, 87, 212, 22,
971 23, 24, 8, 9, 10, 11, 12, 13, 14, 15,
972 282, 283, 132, 105, 47, 70, 104, 130, 162, 163,
973 164, 91, 114, 115, 116, 213, 166, 258, 92, 111,
974 181, 182, 136, 185, 397, 168, 169, 170, 260, 171,
975 172, 401, 551, 284, 18, 43, 72, 65, 107, 44,
976 63, 94, 95, 96, 97, 214, 357, 285, 175, 436,
977 717, 287, 288, 289, 290, 692, 291, 292, 293, 294,
978 695, 295, 296, 297, 298, 696, 299, 443, 300, 583,
979 652, 653, 654, 655, 301, 302, 698, 303, 304, 305,
980 699, 306, 307, 450, 660, 661, 308, 309, 310, 311,
981 312, 313, 314, 569, 570, 571, 572, 215, 216, 217,
982 218, 488, 219, 469, 470, 471, 220, 221, 222, 223,
983 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
984 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
988 static const short yypact
[] = { 456,
989 -32768,-32768, 92, -32, 361, 363,-32768,-32768, 208, 445,
990 525,-32768,-32768,-32768,-32768, 617,-32768,-32768,-32768,-32768,
991 18,-32768,-32768,-32768, 45,-32768, 293,-32768, 22, 558,
992 -32768,-32768, 538, 571,-32768, -32, 405,-32768,-32768, 479,
993 -32768, 421, 11, 164,-32768, 432, 182,-32768,-32768, -32,
994 643, 329,-32768, 341,-32768, 59,-32768,-32768,-32768,-32768,
995 194, 968,-32768, 468, 11,-32768,-32768, 20, 471,-32768,
996 -32768, 11, 164,-32768, 182,-32768,-32768,-32768, 476,-32768,
997 -32768,-32768, 504, 373,-32768,-32768, 419, -79, 779,-32768,
998 -32768, 61,-32768, 988,-32768,-32768,-32768,-32768,-32768,-32768,
999 -32768,-32768,-32768, 440, 466,-32768, 11,-32768,-32768, 473,
1000 4,-32768, 143, -25,-32768, 722, 4, 39, 77, 475,
1001 -32768, 518, 520,-32768,-32768,-32768,-32768, 526, 860,-32768,
1002 -32768, 466, 615, 531, 84,-32768,-32768,-32768, 562, 2071,
1003 87, 582,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 4,
1004 -32768, 362, 4,-32768,-32768, 519, 502,-32768, 529, 779,
1005 -32768, 872,-32768,-32768,-32768,-32768, 19,-32768, 536,-32768,
1006 -32768, 670,-32768,-32768, 1798,-32768,-32768,-32768, 583, 893,
1007 10,-32768,-32768,-32768, 634,-32768,-32768,-32768, 317,-32768,
1008 -32768, 2818, 2883, 2934, 2999, 645, 34, 586,-32768, 3050,
1009 3115, 3166, 5306,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1010 652, 795, 29,-32768, 655, 661,-32768, 587,-32768, 461,
1011 -32768, 694, 833,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1012 946, 887, 962, 806, 897, 767, 784, 786, 799, 596,
1013 -32768,-32768,-32768, 832,-32768,-32768,-32768,-32768,-32768,-32768,
1014 -32768,-32768, 826, 670,-32768,-32768,-32768, 150, 718, 727,
1015 -32768, 773, 246, 304, 3231,-32768, 186, 2122, 23, 320,
1016 336, 93, 345, 230, 742, 5603,-32768, -32, 385, 843,
1017 714, 990,-32768, 746,-32768, 1730,-32768,-32768, 751,-32768,
1018 -32768,-32768, 1866,-32768,-32768, 754,-32768,-32768,-32768,-32768,
1019 1866,-32768, 1866,-32768,-32768, 5654, 761,-32768,-32768,-32768,
1020 -32768,-32768, 347,-32768, 758, 788, 833, 920, 928,-32768,
1021 -32768,-32768,-32768, 898, 588,-32768, 697, 590,-32768, 606,
1022 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 217,
1023 -32768, 595, 883, 745, 745, 349,-32768,-32768,-32768,-32768,
1024 -32768, 747, 989, 260,-32768,-32768, 625, 291, 5371, 3282,
1025 780,-32768, 442, 3347,-32768, 388,-32768,-32768, 3398, 3463,
1026 3514, 3579, 3630, 3695, 3746, 3811, 3862, 3927, 3978, 4043,
1027 688, 4094, 4159, 4210, 4275, 4326, 4391, 4442, 2187,-32768,
1028 -32768, 4507,-32768, 253,-32768,-32768,-32768, 763,-32768,-32768,
1029 -32768, 1730,-32768,-32768,-32768,-32768, 4558,-32768, 66,-32768,
1030 -32768, 95,-32768,-32768, 97,-32768, 4623,-32768, 4674,-32768,
1031 711,-32768, 5088,-32768,-32768, 104, 261, 757, 2238, 457,
1032 -32768,-32768, -32, 2303,-32768,-32768,-32768,-32768,-32768, 1007,
1033 -32768,-32768, 750,-32768, 805, 901, 893,-32768,-32768,-32768,
1034 111, 2354,-32768, 4739,-32768, 898,-32768,-32768,-32768,-32768,
1035 -32768,-32768, -38, 781,-32768,-32768,-32768, 2419, 745,-32768,
1036 557, 745, 557,-32768, 2470, 4790, 179, 614, 2535, 642,
1037 -32768, 5679,-32768, 2006,-32768,-32768,-32768, 556,-32768,-32768,
1038 219,-32768,-32768,-32768,-32768,-32768, 790,-32768, 229,-32768,
1039 5422,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 946,-32768,
1040 946,-32768, 887,-32768, 887,-32768, 887,-32768, 962,-32768,
1041 962,-32768, 962,-32768, 962,-32768, 373,-32768,-32768, 806,
1042 -32768, 806,-32768, 897,-32768, 767,-32768, 784,-32768, 786,
1043 -32768, 799,-32768, 894, 809,-32768,-32768,-32768,-32768, 924,
1044 1730, 807,-32768, 1730,-32768, 265,-32768,-32768,-32768,-32768,
1045 -32768,-32768,-32768, 301,-32768, 808, 390, 215, 711,-32768,
1046 536,-32768,-32768,-32768,-32768,-32768, 401, 757,-32768, 904,
1047 47, 532,-32768, 814,-32768, 5222,-32768, 5113, 810, 824,
1048 836,-32768,-32768, 5487,-32768,-32768, 243,-32768, 829, 245,
1049 -32768, 829,-32768,-32768, 466, 69,-32768,-32768,-32768, 4855,
1050 5264,-32768,-32768,-32768,-32768,-32768, 4906,-32768,-32768, 5538,
1051 -32768,-32768, 466, 602,-32768, 4971, 657,-32768, 1730, 2586,
1052 -32768,-32768, 1932,-32768,-32768, 224,-32768, 705,-32768,-32768,
1053 -32768,-32768,-32768,-32768, 2651,-32768,-32768, 931, 333, 5022,
1054 -32768, 669,-32768, 1507,-32768, 5603,-32768,-32768,-32768, 869,
1055 890, 5155,-32768, 225,-32768, 619,-32768,-32768,-32768,-32768,
1056 -32768,-32768, 466,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1057 743,-32768, 466,-32768,-32768, 409,-32768, 133, 112, 417,
1058 -32768, 927, 945, 1932,-32768,-32768, 1932,-32768,-32768, 906,
1059 -32768, 914, 925,-32768, 1013, 154,-32768,-32768,-32768,-32768,
1060 -32768, 360,-32768,-32768, 1580,-32768, 1654,-32768, 936, 1866,
1061 -32768, 937,-32768,-32768,-32768,-32768,-32768,-32768, 2702,-32768,
1062 200, 4558, 1866,-32768,-32768, 2767,-32768,-32768,-32768,-32768,
1063 1036,-32768,-32768,-32768, 940,-32768, 1866, 223, 214,-32768,
1064 332,-32768, 5113, 949,-32768,-32768,-32768,-32768, 227, 1932,
1065 950, 5155,-32768, 995, 1932, 958, 1932,-32768, 1932,-32768,
1066 -32768, 1056, 1061,-32768
1069 static const short yypgoto
[] = {-32768,
1070 -32768, -60, -53, 681, -31, -121, 565,-32768, -3, 566,
1071 -32768, 134,-32768, 1054, 630,-32768, 218,-32768,-32768, 759,
1072 17, 441,-32768,-32768, 1024, 1008,-32768, -127,-32768, 930,
1073 -32768, 331, -122, 948, -173, -191,-32768,-32768, 379, 498,
1074 840, -323, -101,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1075 935,-32768,-32768, 695, -30,-32768,-32768,-32768,-32768, 1050,
1076 503,-32768, 1011,-32768,-32768, 14,-32768, -104, 846, -349,
1077 -165, -278,-32768, 803, -15, 115, -546,-32768, -429,-32768,
1078 -32768,-32768, -299,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1079 -32768, 458, 459, -623, -362,-32768,-32768,-32768,-32768,-32768,
1080 -32768,-32768, -337,-32768, -620, 811,-32768,-32768,-32768,-32768,
1081 -32768,-32768,-32768,-32768, 543,-32768, 544,-32768,-32768, -120,
1082 -32768, -339,-32768, 769, 279, -308, 1141, 244, 1161, 374,
1083 434, 491, -111, 515, 683, -468,-32768, 627, 684, 570,
1084 641, 731, 733, 730, 732, 734,-32768, 497, 737, 740,
1085 -32768,-32768, 36,-32768
1092 static const short yytable
[] = { 21,
1093 152, 83, 29, 458, 176, 324, 449, 437, 84, 286,
1094 59, 356, 184, 612, 67, 143, 16, 120, 38, 257,
1095 101, 50, 48, 341, 174, 16, 16, 16, 123, 362,
1096 718, 93, 59, 83, 341, 84, 473, 59, 61, 144,
1097 84, 722, 61, 478, 480, 41, 16, 647, 249, 16,
1098 16, 251, 553, 20, 315, 592, 134, 174, 88, 76,
1099 61, 124, 593, 93, 259, 61, 557, 16, 83, 672,
1100 261, -66, 179, 138, 139, 84, 346, 146, 89, 84,
1101 333, 335, 337, 339, 186, 88, 693, 246, 348, 350,
1102 88, 718, 19, 420, 581, 559, 59, 561, 173, 123,
1103 135, 83, 67, 326, 574, 62, 84, 42, 84, 327,
1104 89, 585, 647, -103, -66, -154, 39, -103, 40, 325,
1105 49, 279, 50, 342, 61, 88, 84, -93, -93, 88,
1106 61, 173, 761, 646, 342, 606, 145, 25, 27, -155,
1107 648, 766, 677, 137, 344, 160, 617, 693, 352, 180,
1108 693, 456, 395, 398, 740, 428, 88, 77, 88, 125,
1109 599, 624, 673, 602, 558, 315, 345, 421, 617, 52,
1110 54, 280, 315, 57, 147, 245, 88, 20, 160, 609,
1111 315, 187, 315, 57, 247, 315, 410, 157, 330, 330,
1112 330, 330, 179, 560, 61, 562, 330, 330, 353, 84,
1113 707, 628, 575, 694, 631, 731, 460, -30, 1, -291,
1114 586, 617, 110, 693, 740, 639, 113, 461, 693, 618,
1115 693, 433, 693, 739, 701, 723, 31, 755, 84, 621,
1116 424, 730, 279, 69, -96, 133, 554, 354, 245, -96,
1117 -96, -96, -96, 667, 157, 669, -319, 741, 396, 88,
1118 31, 2, 279, 617, 666, 110, 113, 503, 505, 507,
1119 481, 481, 3, 64, 694, 632, 179, 694, 4, 180,
1120 697, 20, 189, 84, 5, 437, 596, 441, 88, 687,
1121 681, 315, 280, 462, 411, 444, 658, 445, 449, 440,
1122 689, 485, 615, 45, 50, 700, 67, 440, 750, 440,
1123 409, 634, 446, 415, 406, 706, 7, 759, 281, 157,
1124 578, 427, 189, 617, 703, 20, 619, 137, -253, 157,
1125 416, 758, 447, 88, 61, 763, 622, 527, 425, 71,
1126 694, 697, 632, 708, 697, 694, 418, 694, -319, 694,
1127 668, 74, 670, 180, -65, 422, 548, 453, 279, 474,
1128 437, 366, 327, 482, 576, 46, 700, 486, 633, 700,
1129 742, 26, 449, 28, 608, 330, 330, 330, 330, 330,
1130 330, 330, 330, 330, 330, 330, 330, 88, 330, 330,
1131 330, 330, 330, 330, 330, 629, 433, -65, 500, 749,
1132 637, 42, -65, 84, 635, 491, 407, 697, 550, 499,
1133 412, 644, 697, 46, 697, 53, 697, 426, -96, 644,
1134 -96, 189, 417, -96, -96, -96, -96, 406, 316, 281,
1135 709, 58, 700, -157, 545, 760, 281, 700, 419, 700,
1136 315, 700, 66, 315, 281, -65, 281, 423, 437, 454,
1137 17, 475, 556, 88, -31, 1, 20, 743, 20, 17,
1138 17, 17, 564, 449, 566, -28, 1, 492, 189, 165,
1139 250, 139, 449, 640, 491, 315, 643, 315, 98, 118,
1140 17, 102, 330, 17, 17, 464, 109, 671, 330, 55,
1141 501, 118, 638, 56, 601, 358, 603, 589, 2, 591,
1142 20, 17, 165, 645, 57, 682, 497, 279, 675, 2,
1143 279, 729, 90, 597, 112, 4, 20, 167, 315, 732,
1144 3, 5, 315, 496, 491, 119, 4, 20, 149, 245,
1145 151, 577, 5, 493, -29, 1, 154, 20, 494, 316,
1146 6, 183, 495, 315, 90, 281, 316, -32, 1, 128,
1147 167, 315, 20, 7, 316, 726, 316, 280, 317, 316,
1148 280, -494, -494, 20, 7, 728, 20, -34, 1, 724,
1149 129, 20, 188, 57, 20, 133, 189, 100, 2, 161,
1150 -33, 1, 148, 315, 106, 279, 315, 179, 649, 3,
1151 117, 2, 248, 323, 84, 4, 343, 365, 455, 20,
1152 459, 5, 3, 650, 315, 463, 315, 252, 4, 315,
1153 279, 2, 161, 20, 5, 20, 330, 330, 318, 131,
1154 388, 20, 315, -138, 2, 177, 20, 691, 4, 150,
1155 153, 253, 330, 7, 5, 280, 315, 651, 99, 440,
1156 157, 4, 315, 103, 88, 78, 7, 5, 30, 315,
1157 34, 315, -35, 1, 315, 316, 315, 20, 315, 616,
1158 280, 203, 679, 600, 180, 617, 7, 492, 2, 317,
1159 35, 279, 51, 279, 78, 319, 317, 80, 20, 7,
1160 81, 20, 20, 20, 317, 20, 317, 36, 441, 317,
1161 20, 444, 389, 37, 281, 711, 2, 281, 526, 320,
1162 440, 719, 155, 440, 159, 683, 80, 457, 359, 81,
1163 20, 617, 360, 4, 746, 702, 361, 610, 178, 5,
1164 600, 280, 725, 280, 431, 649, 440, 752, 617, 318,
1165 483, 686, 134, 493, 484, 159, 318, 159, 494, 440,
1166 650, 757, 495, 328, 318, 611, 318, 78, 600, 318,
1167 2, 7, 20, 440, 691, 340, 78, 598, 2, 746,
1168 598, 752, 358, 757, 78, 363, 440, 364, -25, -25,
1169 57, 440, 281, 440, 713, 440, 281, 751, 32, 80,
1170 567, 754, 81, 20, 568, 317, 319, 384, 80, 121,
1171 492, 81, 20, 319, -495, -495, 80, 281, 32, 81,
1172 20, 319, 32, 319, 316, 385, 319, 316, 386, -25,
1173 320, 432, -338, -338, -25, -25, -25, 320, 734, 32,
1174 -25, 735, 387, 140, -25, 320, 399, 320, 141, 142,
1175 320, 400, 35, 377, 378, 379, 380, 281, 78, 316,
1176 281, 316, -340, -340, -153, 318, 727, 122, 434, 36,
1177 476, 468, 617, 477, 582, 37, 493, 358, 281, 438,
1178 281, 494, 442, 281, -338, 495, 139, 321, -338, 452,
1179 80, 549, 381, 81, 20, 20, 281, 403, 404, 2,
1180 584, 405, 316, 594, 764, 78, 316, 367, 368, 768,
1181 281, 770, 620, 771, -340, -493, -493, 359, -340, 372,
1182 373, 360, 319, 281, 625, 361, 626, 316, 281, 630,
1183 281, 636, 281, 156, 646, 316, 656, 80, 662, 78,
1184 81, 20, 382, 383, 322, 156, 320, 663, 79, 393,
1185 4, 78, 390, 391, 317, 600, 5, 317, -15, 664,
1186 79, 707, 4, -493, -493, 359, 35, 316, 5, 429,
1187 316, 80, 78, 430, 81, 20, 519, 521, 523, 525,
1188 369, 370, 371, 80, 157, 158, 81, 20, 316, 317,
1189 316, 317, 720, 316, -404, -404, 157, 255, 321, 374,
1190 375, 376, -405, -405, 80, 321, 316, 81, 20, 465,
1191 466, 467, 733, 321, 318, 321, -15, 318, 321, 586,
1192 316, -493, -493, 359, 141, 142, 316, 429, 509, 511,
1193 -204, 361, 317, 316, 736, 316, 317, 737, 316, -15,
1194 316, 2, 316, 739, -493, -493, 359, 78, 738, 318,
1195 429, 318, 530, 532, 627, 322, 79, 317, 4, 745,
1196 747, 2, 322, 35, 5, 317, 755, 78, 756, 78,
1197 322, 319, 322, 765, 319, 322, 79, 762, 4, 80,
1198 767, 769, 81, 20, 5, 773, 37, 513, 515, 517,
1199 774, 528, 318, 82, 33, 320, 318, 317, 320, 80,
1200 317, 80, 81, 20, 81, 20, 319, 75, 319, -493,
1201 -493, 359, 108, 126, 321, 479, 190, 318, 317, 361,
1202 317, 256, 394, 317, 254, 318, 552, -493, -493, 359,
1203 320, 73, 320, 360, 127, 402, 317, 430, 448, 714,
1204 715, 641, 642, 472, 534, 538, 451, 536, 540, 319,
1205 317, 542, 685, 319, 0, 0, 317, 318, 547, 0,
1206 318, 0, 0, 317, 0, 317, 0, 0, 317, 0,
1207 317, 322, 317, 320, 319, 0, 0, 320, 318, 0,
1208 318, 0, 319, 318, 0, 0, 0, 0, 0, 0,
1209 0, 0, 0, 0, 0, 0, 318, 0, 320, 0,
1210 0, 0, 0, 0, 0, 0, 320, 0, 0, 0,
1211 318, 0, 0, 0, 319, 0, 318, 319, 0, 0,
1212 0, 0, 0, 318, 0, 318, 0, 0, 318, 0,
1213 318, 0, 318, 0, 0, 319, 0, 319, 320, 0,
1214 319, 320, 0, 0, 0, 0, 0, 0, 0, 0,
1215 0, 0, 0, 319, 0, 0, 0, 0, 0, 320,
1216 0, 320, 0, 321, 320, 0, 321, 319, 0, 0,
1217 0, 0, 0, 319, 0, 0, 0, 320, 0, 0,
1218 319, 0, 319, 0, 0, 319, 0, 319, 0, 319,
1219 0, 320, 0, 0, 0, 0, 0, 320, 321, 0,
1220 321, 0, 0, 0, 320, 0, 320, 0, 0, 320,
1221 0, 320, 0, 320, 0, 0, 0, 0, 0, 0,
1222 322, 0, 0, 322, 0, 0, 0, 0, 0, 0,
1223 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1224 0, 321, 0, 0, 0, 321, 0, 0, 0, 0,
1225 0, 0, 0, 0, 0, 322, 0, 322, 0, 0,
1226 0, 0, 331, 331, 331, 331, 321, 0, 0, 0,
1227 331, 331, 0, 0, 321, 0, 0, 0, 0, 0,
1228 0, 0, 332, 332, 332, 332, 0, 0, 0, 0,
1229 332, 332, 0, 0, 0, 0, 0, 0, 322, 0,
1230 0, 0, 322, 0, 0, 0, 321, 0, 0, 321,
1231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1232 0, 0, 0, 322, 0, 0, 0, 321, 0, 321,
1233 0, 322, 321, 0, 0, 0, 0, 0, 0, 0,
1234 0, 0, 0, 0, 0, 321, 0, 0, 0, 0,
1235 0, 0, 0, 0, 0, 0, 0, 0, 0, 321,
1236 0, 0, 0, 322, 0, 321, 322, 0, 0, 0,
1237 0, 0, 321, 0, 321, 0, 0, 321, 0, 321,
1238 0, 321, 0, 0, 322, 0, 322, 0, 0, 322,
1239 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1240 0, 0, 322, 0, 0, 0, 0, 0, 0, 0,
1241 0, 0, 0, 0, 0, 0, 322, 0, 0, 0,
1242 0, 0, 322, 0, 0, 0, 0, 0, 0, 322,
1243 0, 322, 0, 0, 322, 0, 322, 262, 322, 331,
1244 331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
1245 331, 0, 331, 331, 331, 331, 331, 331, 331, 332,
1246 332, 332, 332, 332, 332, 332, 332, 332, 332, 332,
1247 332, 0, 332, 332, 332, 332, 332, 332, 332, 0,
1248 263, 194, 195, 649, 264, 265, 78, 266, 0, 0,
1249 267, 0, 0, 0, 268, 196, 0, 0, 650, 0,
1250 0, 269, 270, 5, 271, 0, 272, 273, 198, 274,
1251 262, 0, 275, 0, 0, 0, 0, 0, 80, 0,
1252 0, 81, 20, 0, 0, 0, 0, 0, 0, 276,
1253 0, 157, 716, 0, 0, 277, 0, 0, 204, 205,
1254 206, 207, 0, 0, 208, 209, 331, 0, 0, 0,
1255 0, 0, 331, 263, 194, 195, 649, 264, 265, 78,
1256 266, 0, 0, 267, 0, 0, 332, 268, 196, 0,
1257 0, 650, 332, 0, 269, 270, 5, 271, 0, 272,
1258 273, 198, 274, 0, 262, 275, 0, 0, 0, 0,
1259 0, 80, 0, 0, 81, 20, 0, 0, 0, 0,
1260 0, 0, 276, 0, 157, 744, 0, 0, 277, 0,
1261 0, 204, 205, 206, 207, 0, 0, 208, 209, 0,
1262 0, 0, 0, 0, 0, 0, 0, 263, 194, 195,
1263 -263, 264, 265, 78, 266, 0, 0, 267, 0, 0,
1264 0, 268, 196, 0, 0, -263, 0, 0, 269, 270,
1265 5, 271, 0, 272, 273, 198, 274, 0, 0, 275,
1266 262, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1267 0, 0, 0, 0, 0, 0, 276, 0, 157, -263,
1268 331, 331, 277, 0, 0, 204, 205, 206, 207, 0,
1269 0, 208, 209, 0, 0, 0, 331, 0, 0, 0,
1270 332, 332, 0, 263, 194, 195, 0, 264, 265, 78,
1271 266, 0, 0, 267, 0, 0, 332, 268, 196, 0,
1272 0, 0, 0, 0, 269, 270, 5, 271, 262, 272,
1273 273, 198, 274, 0, 0, 275, 0, 0, 0, 0,
1274 0, 80, 0, 0, 81, 20, 0, 0, 0, 0,
1275 0, 0, 276, 0, 157, 435, 0, 0, 277, 0,
1276 0, 204, 205, 206, 207, 0, 0, 208, 209, 0,
1277 0, 263, 194, 195, 0, 264, 265, 78, 266, 0,
1278 0, 267, 0, 0, 0, 268, 196, 0, 0, 0,
1279 0, 0, 269, 270, 5, 271, 262, 272, 273, 198,
1280 274, 0, 0, 275, 0, 0, 0, 0, 0, 80,
1281 0, 0, 81, 20, 0, 0, 0, 0, 0, 0,
1282 276, 0, 157, 0, 0, 0, 277, 0, 0, 204,
1283 205, 206, 207, 0, 0, 208, 209, 0, 0, 439,
1284 194, 195, 0, 264, 265, 78, 266, 0, 0, 267,
1285 0, 0, 0, 268, 196, 0, 0, 0, 0, 0,
1286 269, 270, 262, 271, 0, 272, 273, 198, 274, 0,
1287 0, 275, 0, 0, 0, 0, 0, 80, 0, 0,
1288 81, 20, 0, 0, 0, 0, 0, 0, 276, 0,
1289 157, 0, 0, 0, 277, 0, 0, 204, 205, 206,
1290 207, 0, 0, 208, 209, 439, 194, 195, 0, 690,
1291 265, 78, 266, 0, 0, 267, 0, 0, 0, 268,
1292 196, 0, 0, 0, 0, 0, 269, 270, 0, 271,
1293 0, 272, 273, 198, 274, 0, 613, 275, 192, 193,
1294 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1295 0, 0, 0, 0, 276, 0, 157, 0, 0, 0,
1296 277, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1297 209, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1298 194, 195, 0, 0, 0, 78, 0, 0, 0, 0,
1299 0, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1300 197, 191, 0, 192, 193, 0, 0, 198, 0, 0,
1301 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1302 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1303 203, 614, 0, 0, 0, 0, 0, 204, 205, 206,
1304 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1305 78, 0, 413, 0, 192, 193, 0, 0, 0, 196,
1306 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1307 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1308 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1309 201, 0, 0, 202, 0, 203, 194, 195, 0, 0,
1310 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1311 196, 0, 0, 0, 0, 0, 197, 543, 0, 192,
1312 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1313 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1314 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1315 414, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1316 209, 194, 195, 0, 0, 0, 78, 0, 490, 0,
1317 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1318 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1319 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1320 0, 81, 20, 0, 544, 200, 201, 0, 0, 202,
1321 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1322 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1323 0, 0, 197, 579, 0, 192, 193, 0, 0, 198,
1324 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1325 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1326 202, 0, 0, 0, 0, 148, 0, 0, 0, 204,
1327 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1328 0, 0, 78, 0, 587, 0, 192, 193, 0, 0,
1329 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1330 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1331 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1332 0, 200, 201, 0, 0, 202, 580, 0, 194, 195,
1333 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1334 208, 209, 196, 0, 0, 0, 0, 0, 197, 595,
1335 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1336 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1337 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1338 0, 0, 588, 0, 0, 204, 205, 206, 207, 0,
1339 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1340 604, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1341 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1342 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1343 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1344 0, 202, 0, 0, 194, 195, 596, 0, 0, 78,
1345 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1346 0, 0, 0, 0, 197, 490, 0, 192, 193, 0,
1347 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1348 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1349 0, 0, 202, 605, 0, 0, 0, 0, 0, 0,
1350 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1351 195, 0, 0, 0, 78, 0, 579, 0, 192, 193,
1352 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1353 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1354 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1355 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1356 194, 195, 596, 0, 0, 78, 204, 205, 206, 207,
1357 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1358 197, 704, 0, 192, 193, 0, 0, 198, 0, 0,
1359 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1360 81, 20, 0, 0, 200, 201, 0, 0, 202, 688,
1361 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1362 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1363 78, 0, 704, 0, 192, 193, 0, 0, 0, 196,
1364 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1365 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1366 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1367 201, 0, 0, 202, 705, 0, 194, 195, 0, 0,
1368 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1369 196, 0, 0, 0, 0, 0, 197, 587, 0, 192,
1370 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1371 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1372 200, 201, 0, 0, 202, 748, 0, 0, 0, 0,
1373 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1374 209, 194, 195, 0, 0, 0, 78, 0, 329, 0,
1375 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1376 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1377 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1378 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1379 0, 0, 194, 195, 0, 753, 0, 78, 204, 205,
1380 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1381 0, 0, 197, 334, 0, 192, 193, 0, 0, 198,
1382 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1383 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1384 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1385 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1386 0, 0, 78, 0, 336, 0, 192, 193, 0, 0,
1387 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1388 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1389 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1390 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1391 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1392 208, 209, 196, 0, 0, 0, 0, 0, 197, 338,
1393 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1394 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1395 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1396 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1397 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1398 347, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1399 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1400 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1401 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1402 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1403 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1404 0, 0, 0, 0, 197, 349, 0, 192, 193, 0,
1405 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1406 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1407 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1408 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1409 195, 0, 0, 0, 78, 0, 351, 0, 192, 193,
1410 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1411 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1412 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1413 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1414 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1415 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1416 197, 408, 0, 192, 193, 0, 0, 198, 0, 0,
1417 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1418 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1419 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1420 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1421 78, 0, 490, 0, 192, 193, 0, 0, 0, 196,
1422 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1423 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1424 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1425 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1426 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1427 196, 0, 0, 0, 0, 0, 197, 498, 0, 192,
1428 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1429 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1430 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1431 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1432 209, 194, 195, 0, 0, 0, 78, 0, 502, 0,
1433 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1434 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1435 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1436 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1437 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1438 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1439 0, 0, 197, 504, 0, 192, 193, 0, 0, 198,
1440 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1441 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1442 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1443 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1444 0, 0, 78, 0, 506, 0, 192, 193, 0, 0,
1445 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1446 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1447 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1448 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1449 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1450 208, 209, 196, 0, 0, 0, 0, 0, 197, 508,
1451 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1452 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1453 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1454 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1455 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1456 510, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1457 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1458 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1459 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1460 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1461 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1462 0, 0, 0, 0, 197, 512, 0, 192, 193, 0,
1463 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1464 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1465 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1466 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1467 195, 0, 0, 0, 78, 0, 514, 0, 192, 193,
1468 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1469 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1470 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1471 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1472 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1473 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1474 197, 516, 0, 192, 193, 0, 0, 198, 0, 0,
1475 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1476 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1477 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1478 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1479 78, 0, 518, 0, 192, 193, 0, 0, 0, 196,
1480 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1481 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1482 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1483 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1484 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1485 196, 0, 0, 0, 0, 0, 197, 520, 0, 192,
1486 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1487 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1488 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1489 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1490 209, 194, 195, 0, 0, 0, 78, 0, 522, 0,
1491 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1492 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1493 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1494 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1495 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1496 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1497 0, 0, 197, 524, 0, 192, 193, 0, 0, 198,
1498 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1499 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1500 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1501 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1502 0, 0, 78, 0, 529, 0, 192, 193, 0, 0,
1503 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1504 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1505 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1506 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1507 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1508 208, 209, 196, 0, 0, 0, 0, 0, 197, 531,
1509 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1510 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1511 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1512 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1513 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1514 533, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1515 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1516 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1517 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1518 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1519 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1520 0, 0, 0, 0, 197, 535, 0, 192, 193, 0,
1521 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1522 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1523 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1524 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1525 195, 0, 0, 0, 78, 0, 537, 0, 192, 193,
1526 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1527 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1528 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1529 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1530 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1531 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1532 197, 539, 0, 192, 193, 0, 0, 198, 0, 0,
1533 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1534 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1535 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1536 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1537 78, 0, 541, 0, 192, 193, 0, 0, 0, 196,
1538 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1539 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1540 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1541 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1542 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1543 196, 0, 0, 0, 0, 0, 197, 546, 0, 192,
1544 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1545 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1546 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1547 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1548 209, 194, 195, 0, 0, 0, 78, 0, 555, 0,
1549 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1550 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1551 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1552 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1553 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1554 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1555 0, 0, 197, 563, 0, 192, 193, 0, 0, 198,
1556 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1557 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1558 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1559 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1560 0, 0, 78, 0, 565, 0, 192, 193, 0, 0,
1561 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1562 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1563 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1564 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1565 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1566 208, 209, 196, 0, 0, 0, 0, 0, 197, 590,
1567 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1568 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1569 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1570 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1571 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1572 607, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1573 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1574 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1575 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1576 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1577 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1578 0, 0, 0, 0, 197, 674, 0, 192, 193, 0,
1579 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1580 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1581 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1582 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1583 195, 0, 0, 0, 78, 0, 678, 0, 192, 193,
1584 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1585 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1586 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1587 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1588 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1589 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1590 197, 684, 0, 192, 193, 0, 0, 198, 0, 0,
1591 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1592 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1593 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1594 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1595 78, 0, 710, 0, 192, 193, 0, 0, 0, 196,
1596 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1597 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1598 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1599 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1600 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1601 196, 0, 0, 0, 0, 0, 197, 0, 573, 0,
1602 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1603 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1604 200, 201, 0, 659, 202, 0, 0, 0, 0, 0,
1605 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1606 209, -286, -286, -286, 0, 0, 0, -286, 0, 0,
1607 0, 0, 0, 0, 0, 0, -286, 0, 0, 0,
1608 0, 0, -286, 0, 0, 721, 0, 194, 195, -286,
1609 0, 0, 78, -286, 0, 0, 0, 0, 0, -286,
1610 0, 196, -286, -286, 0, 0, 0, 197, 0, 0,
1611 -286, 0, 0, 0, 198, 0, -286, 0, 199, -286,
1612 -286, -286, -286, 0, 80, -286, -286, 81, 20, 194,
1613 195, 0, 0, 0, 78, 276, -294, 0, 0, 0,
1614 0, 0, 0, 196, 204, 205, 206, 207, 0, 197,
1615 208, 209, 657, 0, 0, 0, 198, 0, 0, 0,
1616 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1617 20, 0, 0, 0, 0, 0, 0, 276, -294, 0,
1618 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1619 0, 0, 208, 209, 676, 0, 194, 195, 0, 0,
1620 0, 78, 0, 0, 0, 0, 0, 0, 0, 0,
1621 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1622 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1623 0, 0, 0, 80, 0, 0, 81, 20, 192, 193,
1624 0, 0, 0, 78, 276, 0, 0, 0, 0, 0,
1625 0, 0, 196, 204, 205, 206, 207, 0, 197, 208,
1626 209, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1627 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1628 194, 195, 200, 201, 0, 78, 202, 0, 0, 0,
1629 0, 0, 0, 0, 196, 204, 205, 206, 207, 0,
1630 197, 208, 209, 192, 193, 0, 0, 198, 0, 0,
1631 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1632 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1633 203, 355, 0, 0, 0, 0, 0, 204, 205, 206,
1634 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1635 78, 0, 0, 0, 192, 193, 0, 0, 0, 196,
1636 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1637 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1638 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1639 201, 0, 0, 202, 487, 0, 194, 195, 0, 0,
1640 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1641 196, 0, 0, 0, 0, 0, 197, 0, 0, 192,
1642 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1643 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1644 200, 201, 0, 0, 202, 623, 0, 0, 0, 0,
1645 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1646 209, 194, 195, 0, 0, 0, 78, 0, 0, 0,
1647 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1648 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1649 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1650 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1651 665, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1652 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1653 0, 0, 197, 0, 0, 192, 193, 0, 0, 198,
1654 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1655 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1656 202, 680, 0, 0, 0, 0, 0, 0, 0, 204,
1657 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1658 0, 0, 78, 0, 0, 0, 0, 0, 0, 0,
1659 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1660 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1661 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1662 0, 200, 201, 0, 0, 202, 0, 2, 194, 195,
1663 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1664 208, 209, 196, 0, 0, 0, 0, 0, 197, 0,
1665 0, 0, 0, 0, 0, 198, 0, 0, 78, 199,
1666 0, 0, 0, 0, 0, 80, 0, 196, 81, 20,
1667 0, 0, 0, 197, 0, 0, 276, 0, 0, 0,
1668 198, 0, 0, 0, 199, 204, 205, 206, 207, 0,
1669 80, 208, 209, 81, 20, 0, 0, 200, 201, 0,
1670 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1671 204, 205, 206, 207, 0, 0, 208, 209
1674 static const short yycheck
[] = { 3,
1675 123, 62, 6, 327, 132, 179, 306, 286, 62, 175,
1676 42, 203, 134, 482, 46, 117, 0, 97, 1, 1,
1677 1, 101, 1, 1, 129, 9, 10, 11, 89, 1,
1678 654, 62, 64, 94, 1, 89, 345, 69, 42, 1,
1679 94, 662, 46, 352, 353, 1, 30, 1, 150, 33,
1680 34, 153, 402, 86, 175, 94, 53, 162, 62, 1,
1681 64, 1, 101, 94, 169, 69, 1, 51, 129, 1,
1682 172, 52, 133, 99, 100, 129, 198, 1, 62, 133,
1683 192, 193, 194, 195, 1, 89, 633, 1, 200, 201,
1684 94, 715, 1, 1, 434, 1, 128, 1, 129, 160,
1685 97, 162, 134, 94, 1, 95, 160, 63, 162, 100,
1686 94, 1, 1, 95, 95, 93, 99, 99, 101, 180,
1687 99, 175, 101, 101, 128, 129, 180, 99, 100, 133,
1688 134, 162, 753, 1, 101, 475, 98, 4, 5, 95,
1689 94, 762, 611, 1, 198, 129, 100, 694, 202, 133,
1690 697, 325, 254, 258, 1, 278, 160, 99, 162, 99,
1691 469, 501, 94, 472, 99, 286, 198, 272, 100, 36,
1692 37, 175, 293, 40, 98, 140, 180, 86, 162, 1,
1693 301, 98, 303, 50, 98, 306, 1, 95, 192, 193,
1694 194, 195, 253, 99, 198, 99, 200, 201, 202, 253,
1695 1, 551, 99, 633, 554, 94, 328, 0, 1, 99,
1696 100, 100, 79, 760, 1, 1, 83, 1, 765, 1,
1697 767, 282, 769, 1, 1, 1, 9, 1, 282, 1,
1698 1, 99, 286, 52, 92, 93, 402, 202, 203, 97,
1699 98, 99, 100, 1, 95, 1, 1, 94, 99, 253,
1700 33, 44, 306, 100, 594, 122, 123, 369, 370, 371,
1701 1, 1, 55, 100, 694, 1, 327, 697, 61, 253,
1702 633, 86, 139, 327, 67, 554, 98, 293, 282, 629,
1703 620, 402, 286, 67, 99, 301, 586, 303, 588, 293,
1704 630, 1, 484, 1, 101, 633, 328, 301, 99, 303,
1705 265, 1, 306, 268, 1, 645, 99, 94, 175, 95,
1706 433, 276, 179, 100, 638, 86, 98, 1, 95, 95,
1707 1, 99, 306, 327, 328, 99, 98, 381, 99, 1,
1708 760, 694, 1, 1, 697, 765, 1, 767, 93, 769,
1709 98, 1, 98, 327, 52, 1, 94, 1, 402, 1,
1710 629, 218, 100, 94, 94, 63, 694, 67, 94, 697,
1711 1, 1, 662, 1, 476, 369, 370, 371, 372, 373,
1712 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
1713 384, 385, 386, 387, 388, 551, 447, 95, 1, 729,
1714 1, 63, 52, 447, 94, 360, 93, 760, 402, 364,
1715 267, 1, 765, 63, 767, 1, 769, 274, 92, 1,
1716 94, 278, 93, 97, 98, 99, 100, 1, 175, 286,
1717 88, 1, 760, 95, 389, 94, 293, 765, 93, 767,
1718 551, 769, 1, 554, 301, 95, 303, 93, 717, 93,
1719 0, 93, 407, 447, 0, 1, 86, 88, 86, 9,
1720 10, 11, 417, 753, 419, 0, 1, 1, 325, 129,
1721 99, 100, 762, 568, 429, 586, 571, 588, 1, 97,
1722 30, 1, 476, 33, 34, 342, 1, 605, 482, 1,
1723 93, 97, 93, 5, 471, 101, 473, 452, 44, 454,
1724 86, 51, 162, 93, 361, 623, 363, 551, 610, 44,
1725 554, 93, 62, 468, 1, 61, 86, 129, 629, 93,
1726 55, 67, 633, 72, 479, 97, 61, 86, 1, 484,
1727 1, 65, 67, 67, 0, 1, 1, 86, 72, 286,
1728 75, 1, 76, 654, 94, 402, 293, 0, 1, 100,
1729 162, 662, 86, 99, 301, 673, 303, 551, 175, 306,
1730 554, 91, 92, 86, 99, 683, 86, 0, 1, 664,
1731 95, 86, 1, 430, 86, 93, 433, 65, 44, 129,
1732 0, 1, 98, 694, 72, 629, 697, 638, 47, 55,
1733 83, 44, 1, 1, 638, 61, 1, 1, 1, 86,
1734 1, 67, 55, 62, 715, 1, 717, 96, 61, 720,
1735 654, 44, 162, 86, 67, 86, 610, 611, 175, 107,
1736 15, 86, 733, 95, 44, 1, 86, 633, 61, 122,
1737 123, 93, 626, 99, 67, 629, 747, 96, 64, 633,
1738 95, 61, 753, 69, 638, 50, 99, 67, 9, 760,
1739 11, 762, 0, 1, 765, 402, 767, 86, 769, 94,
1740 654, 95, 617, 97, 638, 100, 99, 1, 44, 286,
1741 44, 715, 33, 717, 50, 175, 293, 82, 86, 99,
1742 85, 86, 86, 86, 301, 86, 303, 61, 694, 306,
1743 86, 697, 87, 67, 551, 650, 44, 554, 1, 175,
1744 694, 656, 128, 697, 129, 94, 82, 1, 93, 85,
1745 86, 100, 97, 61, 720, 1, 101, 94, 94, 67,
1746 97, 715, 94, 717, 1, 47, 720, 733, 100, 286,
1747 96, 65, 53, 67, 100, 160, 293, 162, 72, 733,
1748 62, 747, 76, 100, 301, 94, 303, 50, 97, 306,
1749 44, 99, 86, 747, 760, 101, 50, 469, 44, 765,
1750 472, 767, 101, 769, 50, 101, 760, 97, 45, 46,
1751 627, 765, 629, 767, 96, 769, 633, 732, 10, 82,
1752 60, 736, 85, 86, 64, 402, 286, 11, 82, 1,
1753 1, 85, 86, 293, 91, 92, 82, 654, 30, 85,
1754 86, 301, 34, 303, 551, 12, 306, 554, 13, 86,
1755 286, 88, 45, 46, 91, 92, 93, 293, 694, 51,
1756 97, 697, 14, 92, 101, 301, 99, 303, 97, 98,
1757 306, 95, 44, 18, 19, 20, 21, 694, 50, 586,
1758 697, 588, 45, 46, 93, 402, 94, 59, 93, 61,
1759 94, 97, 100, 97, 95, 67, 67, 101, 715, 99,
1760 717, 72, 99, 720, 97, 76, 100, 175, 101, 99,
1761 82, 99, 57, 85, 86, 86, 733, 95, 96, 44,
1762 66, 99, 629, 93, 760, 50, 633, 45, 46, 765,
1763 747, 767, 93, 769, 97, 91, 92, 93, 101, 3,
1764 4, 97, 402, 760, 1, 101, 88, 654, 765, 93,
1765 767, 94, 769, 44, 1, 662, 93, 82, 99, 50,
1766 85, 86, 16, 17, 175, 44, 402, 94, 59, 94,
1767 61, 50, 91, 92, 551, 97, 67, 554, 86, 94,
1768 59, 1, 61, 91, 92, 93, 44, 694, 67, 97,
1769 697, 82, 50, 101, 85, 86, 377, 378, 379, 380,
1770 5, 6, 7, 82, 95, 96, 85, 86, 715, 586,
1771 717, 588, 94, 720, 45, 46, 95, 96, 286, 8,
1772 9, 10, 45, 46, 82, 293, 733, 85, 86, 97,
1773 98, 99, 56, 301, 551, 303, 86, 554, 306, 100,
1774 747, 91, 92, 93, 97, 98, 753, 97, 372, 373,
1775 56, 101, 629, 760, 99, 762, 633, 94, 765, 86,
1776 767, 44, 769, 1, 91, 92, 93, 50, 94, 586,
1777 97, 588, 382, 383, 101, 286, 59, 654, 61, 94,
1778 94, 44, 293, 44, 67, 662, 1, 50, 99, 50,
1779 301, 551, 303, 94, 554, 306, 59, 99, 61, 82,
1780 56, 94, 85, 86, 67, 0, 67, 374, 375, 376,
1781 0, 381, 629, 96, 11, 551, 633, 694, 554, 82,
1782 697, 82, 85, 86, 85, 86, 586, 54, 588, 91,
1783 92, 93, 75, 96, 402, 97, 139, 654, 715, 101,
1784 717, 162, 253, 720, 160, 662, 402, 91, 92, 93,
1785 586, 52, 588, 97, 94, 260, 733, 101, 306, 652,
1786 652, 569, 569, 345, 384, 386, 306, 385, 387, 629,
1787 747, 388, 626, 633, -1, -1, 753, 694, 392, -1,
1788 697, -1, -1, 760, -1, 762, -1, -1, 765, -1,
1789 767, 402, 769, 629, 654, -1, -1, 633, 715, -1,
1790 717, -1, 662, 720, -1, -1, -1, -1, -1, -1,
1791 -1, -1, -1, -1, -1, -1, 733, -1, 654, -1,
1792 -1, -1, -1, -1, -1, -1, 662, -1, -1, -1,
1793 747, -1, -1, -1, 694, -1, 753, 697, -1, -1,
1794 -1, -1, -1, 760, -1, 762, -1, -1, 765, -1,
1795 767, -1, 769, -1, -1, 715, -1, 717, 694, -1,
1796 720, 697, -1, -1, -1, -1, -1, -1, -1, -1,
1797 -1, -1, -1, 733, -1, -1, -1, -1, -1, 715,
1798 -1, 717, -1, 551, 720, -1, 554, 747, -1, -1,
1799 -1, -1, -1, 753, -1, -1, -1, 733, -1, -1,
1800 760, -1, 762, -1, -1, 765, -1, 767, -1, 769,
1801 -1, 747, -1, -1, -1, -1, -1, 753, 586, -1,
1802 588, -1, -1, -1, 760, -1, 762, -1, -1, 765,
1803 -1, 767, -1, 769, -1, -1, -1, -1, -1, -1,
1804 551, -1, -1, 554, -1, -1, -1, -1, -1, -1,
1805 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1806 -1, 629, -1, -1, -1, 633, -1, -1, -1, -1,
1807 -1, -1, -1, -1, -1, 586, -1, 588, -1, -1,
1808 -1, -1, 192, 193, 194, 195, 654, -1, -1, -1,
1809 200, 201, -1, -1, 662, -1, -1, -1, -1, -1,
1810 -1, -1, 192, 193, 194, 195, -1, -1, -1, -1,
1811 200, 201, -1, -1, -1, -1, -1, -1, 629, -1,
1812 -1, -1, 633, -1, -1, -1, 694, -1, -1, 697,
1813 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1814 -1, -1, -1, 654, -1, -1, -1, 715, -1, 717,
1815 -1, 662, 720, -1, -1, -1, -1, -1, -1, -1,
1816 -1, -1, -1, -1, -1, 733, -1, -1, -1, -1,
1817 -1, -1, -1, -1, -1, -1, -1, -1, -1, 747,
1818 -1, -1, -1, 694, -1, 753, 697, -1, -1, -1,
1819 -1, -1, 760, -1, 762, -1, -1, 765, -1, 767,
1820 -1, 769, -1, -1, 715, -1, 717, -1, -1, 720,
1821 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1822 -1, -1, 733, -1, -1, -1, -1, -1, -1, -1,
1823 -1, -1, -1, -1, -1, -1, 747, -1, -1, -1,
1824 -1, -1, 753, -1, -1, -1, -1, -1, -1, 760,
1825 -1, 762, -1, -1, 765, -1, 767, 1, 769, 369,
1826 370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
1827 380, -1, 382, 383, 384, 385, 386, 387, 388, 369,
1828 370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
1829 380, -1, 382, 383, 384, 385, 386, 387, 388, -1,
1830 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1831 54, -1, -1, -1, 58, 59, -1, -1, 62, -1,
1832 -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
1833 1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1834 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1835 -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
1836 104, 105, -1, -1, 108, 109, 476, -1, -1, -1,
1837 -1, -1, 482, 44, 45, 46, 47, 48, 49, 50,
1838 51, -1, -1, 54, -1, -1, 476, 58, 59, -1,
1839 -1, 62, 482, -1, 65, 66, 67, 68, -1, 70,
1840 71, 72, 73, -1, 1, 76, -1, -1, -1, -1,
1841 -1, 82, -1, -1, 85, 86, -1, -1, -1, -1,
1842 -1, -1, 93, -1, 95, 96, -1, -1, 99, -1,
1843 -1, 102, 103, 104, 105, -1, -1, 108, 109, -1,
1844 -1, -1, -1, -1, -1, -1, -1, 44, 45, 46,
1845 47, 48, 49, 50, 51, -1, -1, 54, -1, -1,
1846 -1, 58, 59, -1, -1, 62, -1, -1, 65, 66,
1847 67, 68, -1, 70, 71, 72, 73, -1, -1, 76,
1848 1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1849 -1, -1, -1, -1, -1, -1, 93, -1, 95, 96,
1850 610, 611, 99, -1, -1, 102, 103, 104, 105, -1,
1851 -1, 108, 109, -1, -1, -1, 626, -1, -1, -1,
1852 610, 611, -1, 44, 45, 46, -1, 48, 49, 50,
1853 51, -1, -1, 54, -1, -1, 626, 58, 59, -1,
1854 -1, -1, -1, -1, 65, 66, 67, 68, 1, 70,
1855 71, 72, 73, -1, -1, 76, -1, -1, -1, -1,
1856 -1, 82, -1, -1, 85, 86, -1, -1, -1, -1,
1857 -1, -1, 93, -1, 95, 96, -1, -1, 99, -1,
1858 -1, 102, 103, 104, 105, -1, -1, 108, 109, -1,
1859 -1, 44, 45, 46, -1, 48, 49, 50, 51, -1,
1860 -1, 54, -1, -1, -1, 58, 59, -1, -1, -1,
1861 -1, -1, 65, 66, 67, 68, 1, 70, 71, 72,
1862 73, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1863 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1864 93, -1, 95, -1, -1, -1, 99, -1, -1, 102,
1865 103, 104, 105, -1, -1, 108, 109, -1, -1, 44,
1866 45, 46, -1, 48, 49, 50, 51, -1, -1, 54,
1867 -1, -1, -1, 58, 59, -1, -1, -1, -1, -1,
1868 65, 66, 1, 68, -1, 70, 71, 72, 73, -1,
1869 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1870 85, 86, -1, -1, -1, -1, -1, -1, 93, -1,
1871 95, -1, -1, -1, 99, -1, -1, 102, 103, 104,
1872 105, -1, -1, 108, 109, 44, 45, 46, -1, 48,
1873 49, 50, 51, -1, -1, 54, -1, -1, -1, 58,
1874 59, -1, -1, -1, -1, -1, 65, 66, -1, 68,
1875 -1, 70, 71, 72, 73, -1, 1, 76, 3, 4,
1876 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1877 -1, -1, -1, -1, 93, -1, 95, -1, -1, -1,
1878 99, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1879 109, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1880 45, 46, -1, -1, -1, 50, -1, -1, -1, -1,
1881 -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
1882 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1883 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1884 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1885 95, 96, -1, -1, -1, -1, -1, 102, 103, 104,
1886 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1887 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1888 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1889 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1890 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1891 90, -1, -1, 93, -1, 95, 45, 46, -1, -1,
1892 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1893 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1894 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1895 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1896 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
1897 99, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1898 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1899 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1900 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1901 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1902 -1, 85, 86, -1, 88, 89, 90, -1, -1, 93,
1903 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
1904 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1905 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1906 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1907 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1908 93, -1, -1, -1, -1, 98, -1, -1, -1, 102,
1909 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1910 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1911 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1912 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1913 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1914 -1, 89, 90, -1, -1, 93, 94, -1, 45, 46,
1915 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1916 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1917 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1918 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1919 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
1920 -1, -1, 99, -1, -1, 102, 103, 104, 105, -1,
1921 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1922 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1923 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1924 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1925 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1926 -1, 93, -1, -1, 45, 46, 98, -1, -1, 50,
1927 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1928 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1929 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1930 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1931 -1, -1, 93, 94, -1, -1, -1, -1, -1, -1,
1932 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1933 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1934 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1935 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1936 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1937 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1938 45, 46, 98, -1, -1, 50, 102, 103, 104, 105,
1939 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1940 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1941 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1942 85, 86, -1, -1, 89, 90, -1, -1, 93, 94,
1943 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
1944 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1945 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1946 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1947 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1948 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1949 90, -1, -1, 93, 94, -1, 45, 46, -1, -1,
1950 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1951 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1952 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1953 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1954 89, 90, -1, -1, 93, 94, -1, -1, -1, -1,
1955 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1956 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1957 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1958 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1959 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1960 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1961 -1, -1, 45, 46, -1, 99, -1, 50, 102, 103,
1962 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1963 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1964 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1965 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1966 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
1967 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1968 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1969 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1970 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1971 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1972 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
1973 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1974 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1975 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1976 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1977 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
1978 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
1979 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1980 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1981 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1982 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1983 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1984 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
1985 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1986 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1987 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1988 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1989 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
1990 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1991 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1992 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1993 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1994 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1995 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1996 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
1997 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1998 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1999 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2000 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2001 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2002 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2003 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2004 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2005 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2006 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2007 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2008 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2009 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2010 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2011 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2012 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2013 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2014 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2015 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2016 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2017 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2018 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2019 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2020 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2021 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2022 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2023 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2024 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2025 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2026 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2027 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2028 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2029 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2030 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2031 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2032 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2033 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2034 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2035 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2036 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2037 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2038 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2039 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2040 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2041 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2042 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2043 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2044 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2045 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2046 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2047 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2048 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2049 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
2050 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2051 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2052 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2053 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2054 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2055 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2056 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
2057 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2058 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2059 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2060 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2061 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2062 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2063 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2064 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2065 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2066 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2067 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2068 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2069 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2070 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2071 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2072 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2073 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2074 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2075 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2076 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2077 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2078 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2079 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2080 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2081 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2082 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2083 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2084 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2085 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2086 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2087 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2088 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2089 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2090 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2091 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2092 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2093 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2094 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2095 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2096 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2097 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2098 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2099 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2100 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2101 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2102 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2103 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2104 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2105 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2106 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2107 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
2108 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2109 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2110 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2111 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2112 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2113 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2114 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
2115 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2116 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2117 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2118 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2119 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2120 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2121 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2122 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2123 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2124 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2125 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2126 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2127 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2128 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2129 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2130 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2131 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2132 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2133 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2134 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2135 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2136 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2137 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2138 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2139 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2140 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2141 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2142 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2143 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2144 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2145 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2146 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2147 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2148 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2149 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2150 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2151 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2152 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2153 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2154 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2155 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2156 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2157 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2158 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2159 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2160 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2161 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2162 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2163 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2164 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2165 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
2166 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2167 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2168 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2169 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2170 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2171 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2172 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
2173 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2174 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2175 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2176 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2177 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2178 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2179 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2180 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2181 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2182 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2183 59, -1, -1, -1, -1, -1, 65, -1, 1, -1,
2184 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2185 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2186 89, 90, -1, 1, 93, -1, -1, -1, -1, -1,
2187 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2188 109, 44, 45, 46, -1, -1, -1, 50, -1, -1,
2189 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
2190 -1, -1, 65, -1, -1, 1, -1, 45, 46, 72,
2191 -1, -1, 50, 76, -1, -1, -1, -1, -1, 82,
2192 -1, 59, 85, 86, -1, -1, -1, 65, -1, -1,
2193 93, -1, -1, -1, 72, -1, 99, -1, 76, 102,
2194 103, 104, 105, -1, 82, 108, 109, 85, 86, 45,
2195 46, -1, -1, -1, 50, 93, 94, -1, -1, -1,
2196 -1, -1, -1, 59, 102, 103, 104, 105, -1, 65,
2197 108, 109, 1, -1, -1, -1, 72, -1, -1, -1,
2198 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2199 86, -1, -1, -1, -1, -1, -1, 93, 94, -1,
2200 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2201 -1, -1, 108, 109, 1, -1, 45, 46, -1, -1,
2202 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
2203 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2204 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2205 -1, -1, -1, 82, -1, -1, 85, 86, 3, 4,
2206 -1, -1, -1, 50, 93, -1, -1, -1, -1, -1,
2207 -1, -1, 59, 102, 103, 104, 105, -1, 65, 108,
2208 109, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2209 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2210 45, 46, 89, 90, -1, 50, 93, -1, -1, -1,
2211 -1, -1, -1, -1, 59, 102, 103, 104, 105, -1,
2212 65, 108, 109, 3, 4, -1, -1, 72, -1, -1,
2213 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2214 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2215 95, 96, -1, -1, -1, -1, -1, 102, 103, 104,
2216 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2217 50, -1, -1, -1, 3, 4, -1, -1, -1, 59,
2218 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2219 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2220 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2221 90, -1, -1, 93, 94, -1, 45, 46, -1, -1,
2222 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2223 59, -1, -1, -1, -1, -1, 65, -1, -1, 3,
2224 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2225 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2226 89, 90, -1, -1, 93, 94, -1, -1, -1, -1,
2227 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2228 109, 45, 46, -1, -1, -1, 50, -1, -1, -1,
2229 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2230 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2231 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2232 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2233 94, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2234 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2235 -1, -1, 65, -1, -1, 3, 4, -1, -1, 72,
2236 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2237 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2238 93, 94, -1, -1, -1, -1, -1, -1, -1, 102,
2239 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2240 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2241 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2242 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2243 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2244 -1, 89, 90, -1, -1, 93, -1, 44, 45, 46,
2245 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2246 108, 109, 59, -1, -1, -1, -1, -1, 65, -1,
2247 -1, -1, -1, -1, -1, 72, -1, -1, 50, 76,
2248 -1, -1, -1, -1, -1, 82, -1, 59, 85, 86,
2249 -1, -1, -1, 65, -1, -1, 93, -1, -1, -1,
2250 72, -1, -1, -1, 76, 102, 103, 104, 105, -1,
2251 82, 108, 109, 85, 86, -1, -1, 89, 90, -1,
2252 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2253 102, 103, 104, 105, -1, -1, 108, 109
2257 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2258 #line 3 "/usr/share/misc/bison.simple"
2260 /* Skeleton output parser for bison,
2261 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2263 This program is free software; you can redistribute it and/or modify
2264 it under the terms of the GNU General Public License as published by
2265 the Free Software Foundation; either version 2, or (at your option)
2268 This program is distributed in the hope that it will be useful,
2269 but WITHOUT ANY WARRANTY; without even the implied warranty of
2270 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2271 GNU General Public License for more details.
2273 You should have received a copy of the GNU General Public License
2274 along with this program; if not, write to the Free Software
2275 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2277 /* As a special exception, when this file is copied by Bison into a
2278 Bison output file, you may use that output file without restriction.
2279 This special exception was added by the Free Software Foundation
2280 in version 1.24 of Bison. */
2284 #define alloca __builtin_alloca
2285 #else /* not GNU C. */
2286 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
2288 #else /* not sparc */
2289 #if defined (MSDOS) && !defined (__TURBOC__)
2291 #else /* not MSDOS, or __TURBOC__ */
2295 #else /* not MSDOS, __TURBOC__, or _AIX */
2299 void *alloca (unsigned int);
2301 #else /* not __cplusplus */
2303 #endif /* not __cplusplus */
2305 #endif /* not _AIX */
2306 #endif /* not MSDOS, or __TURBOC__ */
2307 #endif /* not sparc. */
2308 #endif /* not GNU C. */
2309 #endif /* alloca not defined. */
2311 /* This is the parser code that is written into each bison parser
2312 when the %semantic_parser declaration is not specified in the grammar.
2313 It was written by Richard Stallman by simplifying the hairy parser
2314 used when %semantic_parser is specified. */
2316 /* Note: there must be only one dollar sign in this file.
2317 It is replaced by the list of actions, each action
2318 as one case of the switch. */
2320 #define yyerrok (yyerrstatus = 0)
2321 #define yyclearin (yychar = YYEMPTY)
2324 #define YYACCEPT return(0)
2325 #define YYABORT return(1)
2326 #define YYERROR goto yyerrlab1
2327 /* Like YYERROR except do call yyerror.
2328 This remains here temporarily to ease the
2329 transition to the new meaning of YYERROR, for GCC.
2330 Once GCC version 2 has supplanted version 1, this can go. */
2331 #define YYFAIL goto yyerrlab
2332 #define YYRECOVERING() (!!yyerrstatus)
2333 #define YYBACKUP(token, value) \
2335 if (yychar == YYEMPTY && yylen == 1) \
2336 { yychar = (token), yylval = (value); \
2337 yychar1 = YYTRANSLATE (yychar); \
2342 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2346 #define YYERRCODE 256
2349 #define YYLEX yylex()
2355 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2357 #define YYLEX yylex(&yylval, &yylloc)
2359 #else /* not YYLSP_NEEDED */
2361 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2363 #define YYLEX yylex(&yylval)
2365 #endif /* not YYLSP_NEEDED */
2368 /* If nonreentrant, generate the variables here */
2372 int yychar
; /* the lookahead symbol */
2373 YYSTYPE yylval
; /* the semantic value of the */
2374 /* lookahead symbol */
2377 YYLTYPE yylloc
; /* location data for the lookahead */
2381 int yynerrs
; /* number of parse errors so far */
2382 #endif /* not YYPURE */
2385 int yydebug
; /* nonzero means print parse trace */
2386 /* Since this is uninitialized, it does not stop multiple parsers
2390 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2393 #define YYINITDEPTH 200
2396 /* YYMAXDEPTH is the maximum size the stacks can grow to
2397 (effective only if the built-in stack extension method is used). */
2404 #define YYMAXDEPTH 10000
2407 /* Prevent warning if -Wstrict-prototypes. */
2412 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2413 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2414 #else /* not GNU C or C++ */
2417 /* This is the most reliable way to avoid incompatibilities
2418 in available built-in functions on various systems. */
2420 __yy_memcpy (to
, from
, count
)
2425 register char *f
= from
;
2426 register char *t
= to
;
2427 register int i
= count
;
2433 #else /* __cplusplus */
2435 /* This is the most reliable way to avoid incompatibilities
2436 in available built-in functions on various systems. */
2438 __yy_memcpy (char *to
, char *from
, int count
)
2440 register char *f
= from
;
2441 register char *t
= to
;
2442 register int i
= count
;
2451 #line 196 "/usr/share/misc/bison.simple"
2453 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2454 into yyparse. The argument should have type void *.
2455 It should actually point to an object.
2456 Grammar actions can access the variable by casting it
2457 to the proper pointer type. */
2459 #ifdef YYPARSE_PARAM
2461 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2462 #define YYPARSE_PARAM_DECL
2463 #else /* not __cplusplus */
2464 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2465 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2466 #endif /* not __cplusplus */
2467 #else /* not YYPARSE_PARAM */
2468 #define YYPARSE_PARAM_ARG
2469 #define YYPARSE_PARAM_DECL
2470 #endif /* not YYPARSE_PARAM */
2473 yyparse(YYPARSE_PARAM_ARG
)
2476 register int yystate
;
2478 register short *yyssp
;
2479 register YYSTYPE
*yyvsp
;
2480 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
2481 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
2483 short yyssa
[YYINITDEPTH
]; /* the state stack */
2484 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
2486 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
2487 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
2490 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
2491 YYLTYPE
*yyls
= yylsa
;
2494 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2496 #define YYPOPSTACK (yyvsp--, yyssp--)
2499 int yystacksize
= YYINITDEPTH
;
2510 YYSTYPE yyval
; /* the variable used to return */
2511 /* semantic values from the action */
2518 fprintf(stderr
, "Starting parse\n");
2524 yychar
= YYEMPTY
; /* Cause a token to be read. */
2526 /* Initialize stack pointers.
2527 Waste one element of value and location stack
2528 so that they stay on the same level as the state stack.
2529 The wasted elements are never initialized. */
2537 /* Push a new state, which is found in yystate . */
2538 /* In all cases, when you get here, the value and location stacks
2539 have just been pushed. so pushing a state here evens the stacks. */
2544 if (yyssp
>= yyss
+ yystacksize
- 1)
2546 /* Give user a chance to reallocate the stack */
2547 /* Use copies of these so that the &'s don't force the real ones into memory. */
2548 YYSTYPE
*yyvs1
= yyvs
;
2549 short *yyss1
= yyss
;
2551 YYLTYPE
*yyls1
= yyls
;
2554 /* Get the current used size of the three stacks, in elements. */
2555 int size
= yyssp
- yyss
+ 1;
2558 /* Each stack pointer address is followed by the size of
2559 the data in use in that stack, in bytes. */
2561 /* This used to be a conditional around just the two extra args,
2562 but that might be undefined if yyoverflow is a macro. */
2563 yyoverflow("parser stack overflow",
2564 &yyss1
, size
* sizeof (*yyssp
),
2565 &yyvs1
, size
* sizeof (*yyvsp
),
2566 &yyls1
, size
* sizeof (*yylsp
),
2569 yyoverflow("parser stack overflow",
2570 &yyss1
, size
* sizeof (*yyssp
),
2571 &yyvs1
, size
* sizeof (*yyvsp
),
2575 yyss
= yyss1
; yyvs
= yyvs1
;
2579 #else /* no yyoverflow */
2580 /* Extend the stack our own way. */
2581 if (yystacksize
>= YYMAXDEPTH
)
2583 yyerror("parser stack overflow");
2587 if (yystacksize
> YYMAXDEPTH
)
2588 yystacksize
= YYMAXDEPTH
;
2589 yyss
= (short *) alloca (yystacksize
* sizeof (*yyssp
));
2590 __yy_memcpy ((char *)yyss
, (char *)yyss1
, size
* sizeof (*yyssp
));
2591 yyvs
= (YYSTYPE
*) alloca (yystacksize
* sizeof (*yyvsp
));
2592 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
, size
* sizeof (*yyvsp
));
2594 yyls
= (YYLTYPE
*) alloca (yystacksize
* sizeof (*yylsp
));
2595 __yy_memcpy ((char *)yyls
, (char *)yyls1
, size
* sizeof (*yylsp
));
2597 #endif /* no yyoverflow */
2599 yyssp
= yyss
+ size
- 1;
2600 yyvsp
= yyvs
+ size
- 1;
2602 yylsp
= yyls
+ size
- 1;
2607 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
2610 if (yyssp
>= yyss
+ yystacksize
- 1)
2616 fprintf(stderr
, "Entering state %d\n", yystate
);
2622 /* Do appropriate processing given the current state. */
2623 /* Read a lookahead token if we need one and don't already have one. */
2626 /* First try to decide what to do without reference to lookahead token. */
2628 yyn
= yypact
[yystate
];
2632 /* Not known => get a lookahead token if don't already have one. */
2634 /* yychar is either YYEMPTY or YYEOF
2635 or a valid token in external form. */
2637 if (yychar
== YYEMPTY
)
2641 fprintf(stderr
, "Reading a token: ");
2646 /* Convert token to internal form (in yychar1) for indexing tables with */
2648 if (yychar
<= 0) /* This means end of input. */
2651 yychar
= YYEOF
; /* Don't call YYLEX any more */
2655 fprintf(stderr
, "Now at end of input.\n");
2660 yychar1
= YYTRANSLATE(yychar
);
2665 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
2666 /* Give the individual parser a way to print the precise meaning
2667 of a token, for further debugging info. */
2669 YYPRINT (stderr
, yychar
, yylval
);
2671 fprintf (stderr
, ")\n");
2677 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
2682 /* yyn is what to do for this token type in this state.
2683 Negative => reduce, -yyn is rule number.
2684 Positive => shift, yyn is new state.
2685 New state is final state => don't bother to shift,
2686 just return success.
2687 0, or most negative number => error. */
2702 /* Shift the lookahead token. */
2706 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
2709 /* Discard the token being shifted unless it is eof. */
2710 if (yychar
!= YYEOF
)
2718 /* count tokens shifted since error; after three, turn off error status. */
2719 if (yyerrstatus
) yyerrstatus
--;
2724 /* Do the default action for the current state. */
2727 yyn
= yydefact
[yystate
];
2731 /* Do a reduction. yyn is the number of a rule to reduce with. */
2735 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
2742 fprintf (stderr
, "Reducing via rule %d (line %d), ",
2745 /* Print the symbols being reduced, and their result. */
2746 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
2747 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
2748 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
2756 #line 446 "./parse.y"
2760 #line 490 "./parse.y"
2762 yyval
.node
= build_java_array_type (yyvsp
[-2].node
, -1);
2763 CLASS_LOADED_P (yyval
.node
) = 1;
2767 #line 495 "./parse.y"
2768 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
2771 #line 497 "./parse.y"
2772 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
2775 #line 499 "./parse.y"
2776 {RULE ("']' expected"); RECOVER
;;
2779 #line 501 "./parse.y"
2780 {RULE ("']' expected"); RECOVER
;;
2783 #line 516 "./parse.y"
2784 { yyval
.node
= make_qualified_name (yyvsp
[-2].node
, yyvsp
[0].node
, yyvsp
[-1].operator.location
); ;
2787 #line 525 "./parse.y"
2788 {yyval
.node
= NULL
;;
2791 #line 537 "./parse.y"
2797 #line 541 "./parse.y"
2803 #line 553 "./parse.y"
2804 { ctxp
->package
= EXPR_WFL_NODE (yyvsp
[-1].node
); ;
2807 #line 555 "./parse.y"
2808 {yyerror ("Missing name"); RECOVER
;;
2811 #line 557 "./parse.y"
2812 {yyerror ("';' expected"); RECOVER
;;
2815 #line 567 "./parse.y"
2817 tree name
= EXPR_WFL_NODE (yyvsp
[-1].node
), node
, last_name
;
2818 int i
= IDENTIFIER_LENGTH (name
)-1;
2819 char *last
= &IDENTIFIER_POINTER (name
)[i
];
2820 while (last
!= IDENTIFIER_POINTER (name
))
2822 if (last
[0] == '.')
2826 last_name
= get_identifier (++last
);
2827 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name
))
2829 tree err
= find_name_in_single_imports (last_name
);
2830 if (err
&& err
!= name
)
2832 (yyvsp
[-1].node
, "Ambiguous class: `%s' and `%s'",
2833 IDENTIFIER_POINTER (name
),
2834 IDENTIFIER_POINTER (err
));
2836 REGISTER_IMPORT (yyvsp
[-1].node
, last_name
)
2839 REGISTER_IMPORT (yyvsp
[-1].node
, last_name
);
2843 #line 593 "./parse.y"
2844 {yyerror ("Missing name"); RECOVER
;;
2847 #line 595 "./parse.y"
2848 {yyerror ("';' expected"); RECOVER
;;
2851 #line 600 "./parse.y"
2853 tree name
= EXPR_WFL_NODE (yyvsp
[-3].node
);
2854 tree node
= build_tree_list (yyvsp
[-3].node
, NULL_TREE
);
2855 read_import_dir (yyvsp
[-3].node
);
2856 TREE_CHAIN (node
) = ctxp
->import_demand_list
;
2857 ctxp
->import_demand_list
= node
;
2861 #line 608 "./parse.y"
2862 {yyerror ("'*' expected"); RECOVER
;;
2865 #line 610 "./parse.y"
2866 {yyerror ("';' expected"); RECOVER
;;
2869 #line 615 "./parse.y"
2871 maybe_generate_finit ();
2872 maybe_generate_clinit ();
2873 yyval
.node
= yyvsp
[0].node
;
2877 #line 622 "./parse.y"
2878 { yyval
.node
= NULL
; ;
2881 #line 624 "./parse.y"
2884 yyerror ("Class or interface declaration expected");
2888 #line 635 "./parse.y"
2890 yyval
.value
= (1 << yyvsp
[0].value
);
2894 #line 639 "./parse.y"
2896 int acc
= (1 << yyvsp
[0].value
);
2897 if (yyval
.value
& acc
)
2899 (ctxp
->modifier_ctx
[yyvsp
[0].value
], "Modifier `%s' declared twice",
2900 java_accstring_lookup (acc
));
2908 #line 655 "./parse.y"
2909 { create_class (yyvsp
[-4].value
, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
2912 #line 657 "./parse.y"
2914 yyval
.node
= yyvsp
[0].node
;
2918 #line 661 "./parse.y"
2919 { create_class (0, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
2922 #line 663 "./parse.y"
2924 yyval
.node
= yyvsp
[0].node
;
2928 #line 667 "./parse.y"
2929 {yyerror ("Missing class name"); RECOVER
;;
2932 #line 669 "./parse.y"
2933 {yyerror ("Missing class name"); RECOVER
;;
2936 #line 671 "./parse.y"
2937 {if (!ctxp
->class_err
) yyerror ("'{' expected"); DRECOVER(class1
);;
2940 #line 673 "./parse.y"
2941 {if (!ctxp
->class_err
) yyerror ("'{' expected"); RECOVER
;;
2944 #line 677 "./parse.y"
2945 { yyval
.node
= NULL
; ;
2948 #line 679 "./parse.y"
2949 { yyval
.node
= yyvsp
[0].node
; ;
2952 #line 681 "./parse.y"
2953 {yyerror ("'{' expected"); ctxp
->class_err
=1;;
2956 #line 683 "./parse.y"
2957 {yyerror ("Missing super class name"); ctxp
->class_err
=1;;
2960 #line 687 "./parse.y"
2961 { yyval
.node
= NULL_TREE
; ;
2964 #line 689 "./parse.y"
2965 { yyval
.node
= yyvsp
[0].node
; ;
2968 #line 691 "./parse.y"
2971 yyerror ("Missing interface name");
2975 #line 699 "./parse.y"
2977 ctxp
->interface_number
= 1;
2978 yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
);
2982 #line 704 "./parse.y"
2984 ctxp
->interface_number
++;
2985 yyval
.node
= chainon (yyvsp
[-2].node
, build_tree_list (yyvsp
[0].node
, NULL_TREE
));
2989 #line 709 "./parse.y"
2990 {yyerror ("Missing interface name"); RECOVER
;;
2993 #line 714 "./parse.y"
2994 { yyval
.node
= ctxp
->current_parsed_class
; ;
2997 #line 716 "./parse.y"
2998 { yyval
.node
= ctxp
->current_parsed_class
; ;
3001 #line 729 "./parse.y"
3002 { yyval
.node
= parse_jdk1_1_error ("instance initializer"); ;
3005 #line 736 "./parse.y"
3006 { yyval
.node
= parse_jdk1_1_error ("inner classe declaration"); ;
3009 #line 738 "./parse.y"
3010 { yyval
.node
= parse_jdk1_1_error ("inner interface declaration"); ;
3013 #line 744 "./parse.y"
3014 { register_fields (0, yyvsp
[-2].node
, yyvsp
[-1].node
); ;
3017 #line 746 "./parse.y"
3020 ("Illegal modifier `%s' for field declaration",
3021 yyvsp
[-3].value
, FIELD_MODIFIERS
);
3022 check_modifiers_consistency (yyvsp
[-3].value
);
3023 register_fields (yyvsp
[-3].value
, yyvsp
[-2].node
, yyvsp
[-1].node
);
3027 #line 759 "./parse.y"
3028 { yyval
.node
= chainon (yyvsp
[-2].node
, yyvsp
[0].node
); ;
3031 #line 761 "./parse.y"
3032 {yyerror ("Missing term"); RECOVER
;;
3035 #line 766 "./parse.y"
3036 { yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
); ;
3039 #line 768 "./parse.y"
3041 if (java_error_count
)
3042 yyvsp
[0].node
= NULL_TREE
;
3043 yyval
.node
= build_tree_list
3044 (yyvsp
[-2].node
, build_assignment (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
));
3048 #line 775 "./parse.y"
3050 yyerror ("Missing variable initializer");
3051 yyval
.node
= build_tree_list (yyvsp
[-2].node
, NULL_TREE
);
3056 #line 781 "./parse.y"
3058 yyerror ("';' expected");
3059 yyval
.node
= build_tree_list (yyvsp
[-3].node
, NULL_TREE
);
3064 #line 791 "./parse.y"
3065 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
3068 #line 793 "./parse.y"
3069 {yyerror ("Invalid declaration"); DRECOVER(vdi
);;
3072 #line 795 "./parse.y"
3073 {yyerror ("']' expected"); DRECOVER(vdi
);;
3076 #line 797 "./parse.y"
3077 {yyerror ("Unbalanced ']'"); DRECOVER(vdi
);;
3080 #line 808 "./parse.y"
3082 current_function_decl
= yyvsp
[0].node
;
3083 source_start_java_method (current_function_decl
);
3087 #line 813 "./parse.y"
3088 { complete_method_declaration (yyvsp
[0].node
); ;
3091 #line 815 "./parse.y"
3092 {YYNOT_TWICE
yyerror ("'{' expected"); RECOVER
;;
3095 #line 820 "./parse.y"
3096 { yyval
.node
= method_header (0, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3099 #line 822 "./parse.y"
3100 { yyval
.node
= method_header (0, void_type_node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3103 #line 824 "./parse.y"
3104 { yyval
.node
= method_header (yyvsp
[-3].value
, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3107 #line 826 "./parse.y"
3108 { yyval
.node
= method_header (yyvsp
[-3].value
, void_type_node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3111 #line 828 "./parse.y"
3115 #line 830 "./parse.y"
3119 #line 832 "./parse.y"
3120 {yyerror ("Identifier expected"); RECOVER
;;
3123 #line 834 "./parse.y"
3124 {yyerror ("Identifier expected"); RECOVER
;;
3127 #line 836 "./parse.y"
3129 yyerror ("Invalid method declaration, return type required");
3134 #line 844 "./parse.y"
3135 { yyval
.node
= method_declarator (yyvsp
[-2].node
, NULL_TREE
); ;
3138 #line 846 "./parse.y"
3139 { yyval
.node
= method_declarator (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
3142 #line 848 "./parse.y"
3144 EXPR_WFL_LINECOL (wfl_operator
) = yyvsp
[-1].operator.location
;
3145 TREE_PURPOSE (yyvsp
[-2].node
) =
3146 build_unresolved_array_type (TREE_PURPOSE (yyvsp
[-2].node
));
3147 parse_warning_context
3149 "Discouraged form of returned type specification");
3153 #line 857 "./parse.y"
3154 {yyerror ("')' expected"); DRECOVER(method_declarator
);;
3157 #line 859 "./parse.y"
3158 {yyerror ("']' expected"); RECOVER
;;
3161 #line 864 "./parse.y"
3163 ctxp
->formal_parameter_number
= 1;
3167 #line 868 "./parse.y"
3169 ctxp
->formal_parameter_number
+= 1;
3170 yyval
.node
= chainon (yyvsp
[-2].node
, yyvsp
[0].node
);
3174 #line 873 "./parse.y"
3175 {yyerror ("Missing formal parameter term"); RECOVER
;;
3178 #line 878 "./parse.y"
3180 yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[-1].node
);
3184 #line 882 "./parse.y"
3185 { yyval
.node
= parse_jdk1_1_error ("final parameters"); ;
3188 #line 884 "./parse.y"
3189 {yyerror ("Missing identifier"); RECOVER
;;
3192 #line 886 "./parse.y"
3194 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp
[-2].value
));
3195 yyerror ("Missing identifier"); RECOVER
;
3199 #line 893 "./parse.y"
3200 { yyval
.node
= NULL_TREE
; ;
3203 #line 895 "./parse.y"
3204 { yyval
.node
= yyvsp
[0].node
; ;
3207 #line 897 "./parse.y"
3208 {yyerror ("Missing class type term"); RECOVER
;;
3211 #line 902 "./parse.y"
3212 { yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[0].node
); ;
3215 #line 904 "./parse.y"
3216 { yyval
.node
= tree_cons (yyvsp
[0].node
, yyvsp
[0].node
, yyvsp
[-2].node
); ;
3219 #line 906 "./parse.y"
3220 {yyerror ("Missing class type term"); RECOVER
;;
3223 #line 913 "./parse.y"
3224 { yyval
.node
= NULL_TREE
; ;
3227 #line 919 "./parse.y"
3229 RULE ("STATIC_INITIALIZER");
3233 #line 923 "./parse.y"
3235 RULE ("STATIC_INITIALIZER");
3239 #line 930 "./parse.y"
3241 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp
[0].value
));
3245 #line 938 "./parse.y"
3247 current_function_decl
= yyvsp
[0].node
;
3248 source_start_java_method (current_function_decl
);
3252 #line 943 "./parse.y"
3253 { complete_method_declaration (yyvsp
[0].node
); ;
3256 #line 948 "./parse.y"
3257 { yyval
.node
= method_header (0, NULL_TREE
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3260 #line 950 "./parse.y"
3261 { yyval
.node
= method_header (yyvsp
[-2].value
, NULL_TREE
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3264 #line 955 "./parse.y"
3265 { yyval
.node
= method_declarator (yyvsp
[-2].node
, NULL_TREE
); ;
3268 #line 957 "./parse.y"
3269 { yyval
.node
= method_declarator (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
3272 #line 965 "./parse.y"
3274 BLOCK_EXPR_BODY (yyvsp
[0].node
) = empty_stmt_node
;
3275 yyval
.node
= yyvsp
[0].node
;
3279 #line 970 "./parse.y"
3280 { yyval
.node
= yyvsp
[0].node
; ;
3283 #line 972 "./parse.y"
3284 { yyval
.node
= yyvsp
[0].node
; ;
3287 #line 974 "./parse.y"
3288 { yyval
.node
= yyvsp
[0].node
; ;
3291 #line 980 "./parse.y"
3293 yyval
.node
= build_method_invocation (yyvsp
[-3].node
, NULL_TREE
);
3294 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-3].node
), yyval
.node
);
3295 yyval
.node
= java_method_add_stmt (current_function_decl
, yyval
.node
);
3299 #line 986 "./parse.y"
3301 yyval
.node
= build_method_invocation (yyvsp
[-4].node
, yyvsp
[-2].node
);
3302 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyval
.node
);
3303 yyval
.node
= java_method_add_stmt (current_function_decl
, yyval
.node
);
3307 #line 994 "./parse.y"
3308 {yyval
.node
= parse_jdk1_1_error ("explicit constructor invocation"); ;
3311 #line 996 "./parse.y"
3312 {yyval
.node
= parse_jdk1_1_error ("explicit constructor invocation"); ;
3315 #line 1001 "./parse.y"
3317 tree wfl
= build_wfl_node (this_identifier_node
,
3318 input_filename
, 0, 0);
3319 EXPR_WFL_LINECOL (wfl
) = yyvsp
[0].operator.location
;
3324 #line 1008 "./parse.y"
3326 tree wfl
= build_wfl_node (super_identifier_node
,
3327 input_filename
, 0, 0);
3328 EXPR_WFL_LINECOL (wfl
) = yyvsp
[0].operator.location
;
3333 #line 1020 "./parse.y"
3334 { create_interface (0, yyvsp
[0].node
, NULL_TREE
); ;
3337 #line 1022 "./parse.y"
3339 yyval
.node
= yyvsp
[0].node
;
3343 #line 1026 "./parse.y"
3344 { create_interface (yyvsp
[-2].value
, yyvsp
[0].node
, NULL_TREE
); ;
3347 #line 1028 "./parse.y"
3349 yyval
.node
= yyvsp
[0].node
;
3353 #line 1032 "./parse.y"
3354 { create_interface (0, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3357 #line 1034 "./parse.y"
3359 yyval
.node
= yyvsp
[0].node
;
3363 #line 1038 "./parse.y"
3364 { create_interface (yyvsp
[-3].value
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3367 #line 1040 "./parse.y"
3369 yyval
.node
= yyvsp
[0].node
;
3373 #line 1044 "./parse.y"
3374 {yyerror ("(here)'{' expected"); RECOVER
;;
3377 #line 1046 "./parse.y"
3378 {yyerror ("(there)'{' expected"); RECOVER
;;
3381 #line 1051 "./parse.y"
3383 ctxp
->interface_number
= 1;
3384 yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
);
3388 #line 1056 "./parse.y"
3390 ctxp
->interface_number
++;
3391 yyval
.node
= chainon (yyvsp
[-2].node
, build_tree_list (yyvsp
[0].node
, NULL_TREE
));
3395 #line 1061 "./parse.y"
3396 {yyerror ("Invalid interface type"); RECOVER
;;
3399 #line 1063 "./parse.y"
3400 {yyerror ("Missing term"); RECOVER
;;
3403 #line 1068 "./parse.y"
3404 { yyval
.node
= NULL_TREE
; ;
3407 #line 1070 "./parse.y"
3408 { yyval
.node
= NULL_TREE
; ;
3411 #line 1082 "./parse.y"
3412 { yyval
.node
= parse_jdk1_1_error ("inner class declaration"); ;
3415 #line 1084 "./parse.y"
3416 { yyval
.node
= parse_jdk1_1_error ("inner interface declaration"); ;
3419 #line 1093 "./parse.y"
3421 check_abstract_method_header (yyvsp
[-1].node
);
3422 current_function_decl
= NULL_TREE
; /* FIXME ? */
3426 #line 1098 "./parse.y"
3427 {yyerror ("';' expected"); RECOVER
;;
3430 #line 1104 "./parse.y"
3431 { yyval
.node
= build_new_array_init (yyvsp
[-1].operator.location
, NULL_TREE
); ;
3434 #line 1106 "./parse.y"
3435 { yyval
.node
= build_new_array_init (yyvsp
[-2].operator.location
, yyvsp
[-1].node
); ;
3438 #line 1108 "./parse.y"
3439 { yyval
.node
= build_new_array_init (yyvsp
[-3].operator.location
, yyvsp
[-2].node
); ;
3442 #line 1113 "./parse.y"
3444 yyval
.node
= tree_cons (maybe_build_array_element_wfl (yyvsp
[0].node
),
3445 yyvsp
[0].node
, NULL_TREE
);
3449 #line 1118 "./parse.y"
3451 yyval
.node
= tree_cons (maybe_build_array_element_wfl (yyvsp
[0].node
), yyvsp
[0].node
, yyvsp
[-2].node
);
3455 #line 1122 "./parse.y"
3456 {yyerror ("Missing term"); RECOVER
;;
3459 #line 1128 "./parse.y"
3460 { yyval
.node
= empty_stmt_node
; ;
3463 #line 1130 "./parse.y"
3464 { yyval
.node
= yyvsp
[0].node
; ;
3467 #line 1135 "./parse.y"
3471 #line 1140 "./parse.y"
3473 maybe_absorb_scoping_blocks ();
3474 yyval
.node
= exit_block ();
3478 #line 1154 "./parse.y"
3479 { java_method_add_stmt (current_function_decl
, yyvsp
[0].node
); ;
3482 #line 1156 "./parse.y"
3483 { parse_jdk1_1_error ("inner class declaration"); ;
3486 #line 1165 "./parse.y"
3487 { declare_local_variables (0, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3490 #line 1167 "./parse.y"
3491 { declare_local_variables (yyvsp
[-2].value
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3494 #line 1177 "./parse.y"
3496 /* If the for loop is unlabeled, we must return the
3497 block it was defined it. It our last chance to
3498 get a hold on it. */
3499 if (!LOOP_HAS_LABEL_P (yyval
.node
))
3500 yyval
.node
= exit_block ();
3504 #line 1210 "./parse.y"
3505 { yyval
.node
= empty_stmt_node
; ;
3508 #line 1215 "./parse.y"
3510 yyval
.node
= build_labeled_block (EXPR_WFL_LINECOL (yyvsp
[-1].node
),
3511 EXPR_WFL_NODE (yyvsp
[-1].node
));
3513 push_labeled_block (yyval
.node
);
3514 PUSH_LABELED_BLOCK (yyval
.node
);
3518 #line 1226 "./parse.y"
3520 yyval
.node
= complete_labeled_statement (yyvsp
[-1].node
, yyvsp
[0].node
);
3521 pop_labeled_block ();
3522 POP_LABELED_BLOCK ();
3526 #line 1232 "./parse.y"
3527 {yyerror ("':' expected"); RECOVER
;;
3530 #line 1237 "./parse.y"
3532 yyval
.node
= complete_labeled_statement (yyvsp
[-1].node
, yyvsp
[0].node
);
3533 pop_labeled_block ();
3534 POP_LABELED_BLOCK ();
3538 #line 1248 "./parse.y"
3540 /* We have a statement. Generate a WFL around it so
3542 yyval
.node
= build_expr_wfl (yyvsp
[-1].node
, input_filename
, lineno
, 0);
3543 /* We know we have a statement, so set the debug
3544 info to be eventually generate here. */
3545 yyval
.node
= JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval
.node
);
3549 #line 1257 "./parse.y"
3551 if (ctxp
->prevent_ese
!= lineno
)
3552 yyerror ("Invalid expression statement");
3553 DRECOVER (expr_stmt
);
3557 #line 1263 "./parse.y"
3559 if (ctxp
->prevent_ese
!= lineno
)
3560 yyerror ("Invalid expression statement");
3561 DRECOVER (expr_stmt
);
3565 #line 1269 "./parse.y"
3567 if (ctxp
->prevent_ese
!= lineno
)
3568 yyerror ("Invalid expression statement");
3569 DRECOVER (expr_stmt
);
3573 #line 1275 "./parse.y"
3574 {yyerror ("')' expected"); RECOVER
;;
3577 #line 1277 "./parse.y"
3579 yyerror ("Constructor invocation must be first "
3580 "thing in a constructor");
3585 #line 1283 "./parse.y"
3586 {yyerror ("')' expected"); RECOVER
;;
3589 #line 1285 "./parse.y"
3591 yyerror ("Constructor invocation must be first "
3592 "thing in a constructor");
3597 #line 1291 "./parse.y"
3598 {yyerror ("'(' expected"); RECOVER
;;
3601 #line 1293 "./parse.y"
3602 {yyerror ("')' expected"); RECOVER
;;
3605 #line 1295 "./parse.y"
3606 {yyerror ("')' expected"); RECOVER
;;
3609 #line 1297 "./parse.y"
3610 {yyerror ("';' expected"); RECOVER
;;
3613 #line 1299 "./parse.y"
3614 {yyerror ("';' expected"); RECOVER
;;
3617 #line 1314 "./parse.y"
3618 { yyval
.node
= build_if_else_statement (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
, NULL_TREE
); ;
3621 #line 1316 "./parse.y"
3622 {yyerror ("'(' expected"); RECOVER
;;
3625 #line 1318 "./parse.y"
3626 {yyerror ("Missing term"); RECOVER
;;
3629 #line 1320 "./parse.y"
3630 {yyerror ("')' expected"); RECOVER
;;
3633 #line 1325 "./parse.y"
3634 { yyval
.node
= build_if_else_statement (yyvsp
[-5].operator.location
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3637 #line 1330 "./parse.y"
3638 { yyval
.node
= build_if_else_statement (yyvsp
[-5].operator.location
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3641 #line 1335 "./parse.y"
3647 #line 1339 "./parse.y"
3649 /* Make into "proper list" of COMPOUND_EXPRs.
3650 I.e. make the last statment also have its own
3652 maybe_absorb_scoping_blocks ();
3653 TREE_OPERAND (yyvsp
[-2].node
, 1) = exit_block ();
3654 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-2].node
), yyvsp
[-2].node
);
3658 #line 1351 "./parse.y"
3660 yyval
.node
= build (SWITCH_EXPR
, NULL_TREE
, yyvsp
[-1].node
, NULL_TREE
);
3661 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-2].operator.location
;
3665 #line 1356 "./parse.y"
3666 {yyerror ("'(' expected"); RECOVER
;;
3669 #line 1358 "./parse.y"
3670 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement
);;
3673 #line 1360 "./parse.y"
3674 {yyerror ("'{' expected"); RECOVER
;;
3677 #line 1368 "./parse.y"
3678 { yyval
.node
= NULL_TREE
; ;
3681 #line 1370 "./parse.y"
3682 { yyval
.node
= NULL_TREE
; ;
3685 #line 1372 "./parse.y"
3686 { yyval
.node
= NULL_TREE
; ;
3689 #line 1374 "./parse.y"
3690 { yyval
.node
= NULL_TREE
; ;
3693 #line 1393 "./parse.y"
3695 tree lab
= build1 (CASE_EXPR
, NULL_TREE
, yyvsp
[-1].node
);
3696 EXPR_WFL_LINECOL (lab
) = yyvsp
[-2].operator.location
;
3697 java_method_add_stmt (current_function_decl
, lab
);
3701 #line 1399 "./parse.y"
3703 tree lab
= build1 (DEFAULT_EXPR
, NULL_TREE
, NULL_TREE
);
3704 EXPR_WFL_LINECOL (lab
) = yyvsp
[-1].operator.location
;
3705 java_method_add_stmt (current_function_decl
, lab
);
3709 #line 1405 "./parse.y"
3710 {yyerror ("Missing or invalid constant expression"); RECOVER
;;
3713 #line 1407 "./parse.y"
3714 {yyerror ("':' expected"); RECOVER
;;
3717 #line 1409 "./parse.y"
3718 {yyerror ("':' expected"); RECOVER
;;
3721 #line 1414 "./parse.y"
3723 tree body
= build_loop_body (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, 0);
3724 yyval
.node
= build_new_loop (body
);
3728 #line 1422 "./parse.y"
3729 { yyval
.node
= complete_loop_body (0, NULL_TREE
, yyvsp
[0].node
, 0); ;
3732 #line 1424 "./parse.y"
3733 {YYERROR_NOW
; yyerror ("'(' expected"); RECOVER
;;
3736 #line 1426 "./parse.y"
3737 {yyerror ("Missing term and ')' expected"); RECOVER
;;
3740 #line 1428 "./parse.y"
3741 {yyerror ("')' expected"); RECOVER
;;
3744 #line 1433 "./parse.y"
3745 { yyval
.node
= complete_loop_body (0, NULL_TREE
, yyvsp
[0].node
, 0); ;
3748 #line 1438 "./parse.y"
3750 tree body
= build_loop_body (0, NULL_TREE
, 1);
3751 yyval
.node
= build_new_loop (body
);
3755 #line 1447 "./parse.y"
3756 { yyval
.node
= complete_loop_body (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[-5].node
, 1); ;
3759 #line 1452 "./parse.y"
3760 { yyval
.node
= complete_for_loop (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
);;
3763 #line 1454 "./parse.y"
3765 yyval
.node
= complete_for_loop (0, NULL_TREE
, yyvsp
[-2].node
, yyvsp
[0].node
);
3766 /* We have not condition, so we get rid of the EXIT_EXPR */
3767 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval
.node
), 0) =
3772 #line 1461 "./parse.y"
3773 {yyerror ("Invalid control expression"); RECOVER
;;
3776 #line 1463 "./parse.y"
3777 {yyerror ("Invalid update expression"); RECOVER
;;
3780 #line 1465 "./parse.y"
3781 {yyerror ("Invalid update expression"); RECOVER
;;
3784 #line 1470 "./parse.y"
3785 { yyval
.node
= complete_for_loop (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
);;
3788 #line 1472 "./parse.y"
3790 yyval
.node
= complete_for_loop (0, NULL_TREE
, yyvsp
[-2].node
, yyvsp
[0].node
);
3791 /* We have not condition, so we get rid of the EXIT_EXPR */
3792 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval
.node
), 0) =
3797 #line 1482 "./parse.y"
3799 /* This scope defined for local variable that may be
3800 defined within the scope of the for loop */
3805 #line 1488 "./parse.y"
3806 {yyerror ("'(' expected"); DRECOVER(for_1
);;
3809 #line 1490 "./parse.y"
3810 {yyerror ("Invalid init statement"); RECOVER
;;
3813 #line 1495 "./parse.y"
3815 /* We now declare the loop body. The loop is
3816 declared as a for loop. */
3817 tree body
= build_loop_body (0, NULL_TREE
, 0);
3818 yyval
.node
= build_new_loop (body
);
3819 IS_FOR_LOOP_P (yyval
.node
) = 1;
3820 /* The loop is added to the current block the for
3821 statement is defined within */
3822 java_method_add_stmt (current_function_decl
, yyval
.node
);
3826 #line 1507 "./parse.y"
3827 { yyval
.node
= empty_stmt_node
; ;
3830 #line 1509 "./parse.y"
3832 /* Init statement recorded within the previously
3833 defined block scope */
3834 yyval
.node
= java_method_add_stmt (current_function_decl
, yyvsp
[0].node
);
3838 #line 1515 "./parse.y"
3840 /* Local variable are recorded within the previously
3841 defined block scope */
3842 yyval
.node
= NULL_TREE
;
3846 #line 1521 "./parse.y"
3847 {yyerror ("';' expected"); DRECOVER(for_init_1
);;
3850 #line 1525 "./parse.y"
3851 {yyval
.node
= empty_stmt_node
;;
3854 #line 1527 "./parse.y"
3855 { yyval
.node
= build_debugable_stmt (BUILD_LOCATION (), yyvsp
[0].node
); ;
3858 #line 1532 "./parse.y"
3859 { yyval
.node
= add_stmt_to_compound (NULL_TREE
, NULL_TREE
, yyvsp
[0].node
); ;
3862 #line 1534 "./parse.y"
3863 { yyval
.node
= add_stmt_to_compound (yyvsp
[-2].node
, NULL_TREE
, yyvsp
[0].node
); ;
3866 #line 1536 "./parse.y"
3867 {yyerror ("Missing term"); RECOVER
;;
3870 #line 1541 "./parse.y"
3871 { yyval
.node
= build_bc_statement (yyvsp
[-1].operator.location
, 1, NULL_TREE
); ;
3874 #line 1543 "./parse.y"
3875 { yyval
.node
= build_bc_statement (yyvsp
[-2].operator.location
, 1, yyvsp
[-1].node
); ;
3878 #line 1545 "./parse.y"
3879 {yyerror ("Missing term"); RECOVER
;;
3882 #line 1547 "./parse.y"
3883 {yyerror ("';' expected"); RECOVER
;;
3886 #line 1552 "./parse.y"
3887 { yyval
.node
= build_bc_statement (yyvsp
[-1].operator.location
, 0, NULL_TREE
); ;
3890 #line 1554 "./parse.y"
3891 { yyval
.node
= build_bc_statement (yyvsp
[-2].operator.location
, 0, yyvsp
[-1].node
); ;
3894 #line 1556 "./parse.y"
3895 {yyerror ("Missing term"); RECOVER
;;
3898 #line 1558 "./parse.y"
3899 {yyerror ("';' expected"); RECOVER
;;
3902 #line 1563 "./parse.y"
3903 { yyval
.node
= build_return (yyvsp
[-1].operator.location
, NULL_TREE
); ;
3906 #line 1565 "./parse.y"
3907 { yyval
.node
= build_return (yyvsp
[-2].operator.location
, yyvsp
[-1].node
); ;
3910 #line 1567 "./parse.y"
3911 {yyerror ("Missing term"); RECOVER
;;
3914 #line 1569 "./parse.y"
3915 {yyerror ("';' expected"); RECOVER
;;
3918 #line 1574 "./parse.y"
3920 yyval
.node
= build1 (THROW_EXPR
, NULL_TREE
, yyvsp
[-1].node
);
3921 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-2].operator.location
;
3925 #line 1579 "./parse.y"
3926 {yyerror ("Missing term"); RECOVER
;;
3929 #line 1581 "./parse.y"
3930 {yyerror ("';' expected"); RECOVER
;;
3933 #line 1586 "./parse.y"
3935 yyval
.node
= build (SYNCHRONIZED_EXPR
, NULL_TREE
, yyvsp
[-2].node
, yyvsp
[0].node
);
3936 EXPR_WFL_LINECOL (yyval
.node
) =
3937 EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK
));
3941 #line 1592 "./parse.y"
3942 {yyerror ("'{' expected"); RECOVER
;;
3945 #line 1594 "./parse.y"
3946 {yyerror ("'(' expected"); RECOVER
;;
3949 #line 1596 "./parse.y"
3950 {yyerror ("Missing term"); RECOVER
;;
3953 #line 1598 "./parse.y"
3954 {yyerror ("Missing term"); RECOVER
;;
3957 #line 1603 "./parse.y"
3959 if ((1 << yyvsp
[0].value
) != ACC_SYNCHRONIZED
)
3960 fatal ("synchronized was '%d' - yyparse", (1 << yyvsp
[0].value
));
3964 #line 1611 "./parse.y"
3965 { yyval
.node
= build_try_statement (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, yyvsp
[0].node
, NULL_TREE
); ;
3968 #line 1613 "./parse.y"
3969 { yyval
.node
= build_try_statement (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, NULL_TREE
, yyvsp
[0].node
); ;
3972 #line 1615 "./parse.y"
3973 { yyval
.node
= build_try_statement (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3976 #line 1617 "./parse.y"
3977 {yyerror ("'{' expected"); DRECOVER (try_statement
);;
3980 #line 1623 "./parse.y"
3982 TREE_CHAIN (yyvsp
[0].node
) = yyvsp
[-1].node
;
3983 yyval
.node
= yyvsp
[0].node
;
3987 #line 1631 "./parse.y"
3989 java_method_add_stmt (current_function_decl
, yyvsp
[0].node
);
3991 yyval
.node
= yyvsp
[-1].node
;
3995 #line 1639 "./parse.y"
3997 /* We add a block to define a scope for
3998 formal_parameter (CCBP). The formal parameter is
3999 declared initialized by the appropriate function
4001 tree ccpb
= enter_block ();
4002 tree init
= build_assignment (ASSIGN_TK
, yyvsp
[-2].operator.location
,
4003 TREE_PURPOSE (yyvsp
[-1].node
),
4004 soft_exceptioninfo_call_node
);
4005 declare_local_variables (0, TREE_VALUE (yyvsp
[-1].node
),
4006 build_tree_list (TREE_PURPOSE (yyvsp
[-1].node
),
4008 yyval
.node
= build1 (CATCH_EXPR
, NULL_TREE
, ccpb
);
4009 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-3].operator.location
;
4013 #line 1655 "./parse.y"
4014 {yyerror ("'(' expected"); RECOVER
;;
4017 #line 1657 "./parse.y"
4018 {yyerror ("Missing term or ')' expected"); DRECOVER (2);;
4021 #line 1659 "./parse.y"
4022 {yyerror ("')' expected"); DRECOVER (1);;
4025 #line 1664 "./parse.y"
4027 yyval
.node
= build (FINALLY_EXPR
, NULL_TREE
,
4028 create_label_decl (generate_name ()), yyvsp
[0].node
);
4032 #line 1669 "./parse.y"
4033 {yyerror ("'{' expected"); RECOVER
; ;
4036 #line 1681 "./parse.y"
4037 { yyval
.node
= build_this (yyvsp
[0].operator.location
); ;
4040 #line 1683 "./parse.y"
4041 {yyval
.node
= yyvsp
[-1].node
;;
4044 #line 1692 "./parse.y"
4045 { yyval
.node
= parse_jdk1_1_error ("named class literals"); ;
4048 #line 1694 "./parse.y"
4049 { yyval
.node
= build_class_ref (yyvsp
[-2].node
); ;
4052 #line 1696 "./parse.y"
4053 { yyval
.node
= build_class_ref (void_type_node
); ;
4056 #line 1701 "./parse.y"
4057 { yyval
.node
= parse_jdk1_1_error ("class literals"); ;
4060 #line 1703 "./parse.y"
4061 {yyerror ("')' expected"); RECOVER
;;
4064 #line 1705 "./parse.y"
4065 {yyerror ("'class' or 'this' expected" ); RECOVER
;;
4068 #line 1707 "./parse.y"
4069 {yyerror ("'class' expected" ); RECOVER
;;
4072 #line 1709 "./parse.y"
4073 {yyerror ("'class' expected" ); RECOVER
;;
4076 #line 1714 "./parse.y"
4077 { yyval
.node
= build_new_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4080 #line 1716 "./parse.y"
4081 { yyval
.node
= build_new_invocation (yyvsp
[-2].node
, NULL_TREE
); ;
4084 #line 1721 "./parse.y"
4085 { yyval
.node
= parse_jdk1_1_error ("inner class instance creation"); ;
4088 #line 1723 "./parse.y"
4089 { yyval
.node
= parse_jdk1_1_error ("inner class instance creation"); ;
4092 #line 1732 "./parse.y"
4093 {yyerror ("'(' expected"); DRECOVER(new_1
);;
4096 #line 1734 "./parse.y"
4097 {yyerror ("'(' expected"); RECOVER
;;
4100 #line 1736 "./parse.y"
4101 {yyerror ("')' or term expected"); RECOVER
;;
4104 #line 1738 "./parse.y"
4105 {yyerror ("')' expected"); RECOVER
;;
4108 #line 1740 "./parse.y"
4109 {YYERROR_NOW
; yyerror ("Identifier expected"); RECOVER
;;
4112 #line 1742 "./parse.y"
4113 {yyerror ("'(' expected"); RECOVER
;;
4116 #line 1752 "./parse.y"
4118 yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, NULL_TREE
);
4119 ctxp
->formal_parameter_number
= 1;
4123 #line 1757 "./parse.y"
4125 ctxp
->formal_parameter_number
+= 1;
4126 yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, yyvsp
[-2].node
);
4130 #line 1762 "./parse.y"
4131 {yyerror ("Missing term"); RECOVER
;;
4134 #line 1767 "./parse.y"
4135 { yyval
.node
= build_newarray_node (yyvsp
[-1].node
, yyvsp
[0].node
, 0); ;
4138 #line 1769 "./parse.y"
4139 { yyval
.node
= build_newarray_node (yyvsp
[-1].node
, yyvsp
[0].node
, 0); ;
4142 #line 1771 "./parse.y"
4143 { yyval
.node
= build_newarray_node (yyvsp
[-2].node
, yyvsp
[-1].node
, ctxp
->osb_number
); ;
4146 #line 1773 "./parse.y"
4147 { yyval
.node
= build_newarray_node (yyvsp
[-2].node
, yyvsp
[-1].node
, ctxp
->osb_number
); ;
4150 #line 1777 "./parse.y"
4151 { yyval
.node
= parse_jdk1_1_error ("anonymous array"); ;
4154 #line 1779 "./parse.y"
4155 { yyval
.node
= parse_jdk1_1_error ("anonymous array"); ;
4158 #line 1781 "./parse.y"
4159 {yyerror ("'[' expected"); DRECOVER ("]");;
4162 #line 1783 "./parse.y"
4163 {yyerror ("']' expected"); RECOVER
;;
4166 #line 1788 "./parse.y"
4167 { yyval
.node
= build_tree_list (NULL_TREE
, yyvsp
[0].node
); ;
4170 #line 1790 "./parse.y"
4171 { yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, yyval
.node
); ;
4174 #line 1795 "./parse.y"
4176 EXPR_WFL_LINECOL (yyvsp
[-1].node
) = yyvsp
[-2].operator.location
;
4177 yyval
.node
= yyvsp
[-1].node
;
4181 #line 1800 "./parse.y"
4182 {yyerror ("']' expected"); RECOVER
;;
4185 #line 1802 "./parse.y"
4187 yyerror ("Missing term");
4188 yyerror ("']' expected");
4193 #line 1811 "./parse.y"
4194 { ctxp
->osb_number
= 1; ;
4197 #line 1813 "./parse.y"
4198 { ctxp
->osb_number
++; ;
4201 #line 1815 "./parse.y"
4202 { yyerror ("']' expected"); RECOVER
;;
4205 #line 1820 "./parse.y"
4206 { yyval
.node
= make_qualified_primary (yyvsp
[-2].node
, yyvsp
[0].node
, yyvsp
[-1].operator.location
); ;
4209 #line 1824 "./parse.y"
4212 build_wfl_node (super_identifier_node
,
4213 input_filename
, 0, 0);
4214 EXPR_WFL_LINECOL (super_wfl
) = yyvsp
[-2].operator.location
;
4215 yyval
.node
= make_qualified_name (super_wfl
, yyvsp
[0].node
, yyvsp
[-1].operator.location
);
4219 #line 1832 "./parse.y"
4220 {yyerror ("Field expected"); DRECOVER (super_field_acces
);;
4223 #line 1837 "./parse.y"
4224 { yyval
.node
= build_method_invocation (yyvsp
[-2].node
, NULL_TREE
); ;
4227 #line 1839 "./parse.y"
4228 { yyval
.node
= build_method_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4231 #line 1841 "./parse.y"
4233 if (TREE_CODE (yyvsp
[-4].node
) == THIS_EXPR
)
4234 yyval
.node
= build_this_super_qualified_invocation
4235 (1, yyvsp
[-2].node
, NULL_TREE
, 0, yyvsp
[-3].operator.location
);
4238 tree invok
= build_method_invocation (yyvsp
[-2].node
, NULL_TREE
);
4239 yyval
.node
= make_qualified_primary (yyvsp
[-4].node
, invok
, yyvsp
[-3].operator.location
);
4244 #line 1852 "./parse.y"
4246 if (TREE_CODE (yyvsp
[-5].node
) == THIS_EXPR
)
4247 yyval
.node
= build_this_super_qualified_invocation
4248 (1, yyvsp
[-3].node
, yyvsp
[-1].node
, 0, yyvsp
[-4].operator.location
);
4251 tree invok
= build_method_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
);
4252 yyval
.node
= make_qualified_primary (yyvsp
[-5].node
, invok
, yyvsp
[-4].operator.location
);
4257 #line 1863 "./parse.y"
4259 yyval
.node
= build_this_super_qualified_invocation
4260 (0, yyvsp
[-2].node
, NULL_TREE
, yyvsp
[-4].operator.location
, yyvsp
[-3].operator.location
);
4264 #line 1868 "./parse.y"
4266 yyval
.node
= build_this_super_qualified_invocation
4267 (0, yyvsp
[-3].node
, yyvsp
[-1].node
, yyvsp
[-5].operator.location
, yyvsp
[-4].operator.location
);
4271 #line 1877 "./parse.y"
4272 { yyerror ("'(' expected"); DRECOVER (method_invocation
); ;
4275 #line 1879 "./parse.y"
4276 { yyerror ("'(' expected"); DRECOVER (method_invocation
); ;
4279 #line 1884 "./parse.y"
4280 { yyval
.node
= build_array_ref (yyvsp
[-2].operator.location
, yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4283 #line 1886 "./parse.y"
4284 { yyval
.node
= build_array_ref (yyvsp
[-2].operator.location
, yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4287 #line 1888 "./parse.y"
4289 yyerror ("Missing term and ']' expected");
4290 DRECOVER(array_access
);
4294 #line 1893 "./parse.y"
4296 yyerror ("']' expected");
4297 DRECOVER(array_access
);
4301 #line 1898 "./parse.y"
4303 yyerror ("Missing term and ']' expected");
4304 DRECOVER(array_access
);
4308 #line 1903 "./parse.y"
4310 yyerror ("']' expected");
4311 DRECOVER(array_access
);
4315 #line 1918 "./parse.y"
4316 { yyval
.node
= build_incdec (yyvsp
[0].operator.token
, yyvsp
[0].operator.location
, yyvsp
[-1].node
, 1); ;
4319 #line 1923 "./parse.y"
4320 { yyval
.node
= build_incdec (yyvsp
[0].operator.token
, yyvsp
[0].operator.location
, yyvsp
[-1].node
, 1); ;
4323 #line 1930 "./parse.y"
4324 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4327 #line 1932 "./parse.y"
4328 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4331 #line 1935 "./parse.y"
4332 {yyerror ("Missing term"); RECOVER
;
4335 #line 1937 "./parse.y"
4336 {yyerror ("Missing term"); RECOVER
;
4339 #line 1942 "./parse.y"
4340 {yyval
.node
= build_incdec (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
, 0); ;
4343 #line 1944 "./parse.y"
4344 {yyerror ("Missing term"); RECOVER
;
4347 #line 1949 "./parse.y"
4348 {yyval
.node
= build_incdec (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
, 0); ;
4351 #line 1951 "./parse.y"
4352 {yyerror ("Missing term"); RECOVER
;
4355 #line 1957 "./parse.y"
4356 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4359 #line 1959 "./parse.y"
4360 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4363 #line 1962 "./parse.y"
4364 {yyerror ("Missing term"); RECOVER
;
4367 #line 1964 "./parse.y"
4368 {yyerror ("Missing term"); RECOVER
;
4371 #line 1969 "./parse.y"
4373 tree type
= yyvsp
[-3].node
;
4374 while (ctxp
->osb_number
--)
4375 type
= build_java_array_type (type
, -1);
4376 yyval
.node
= build_cast (yyvsp
[-4].operator.location
, type
, yyvsp
[0].node
);
4380 #line 1976 "./parse.y"
4381 { yyval
.node
= build_cast (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4384 #line 1978 "./parse.y"
4385 { yyval
.node
= build_cast (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4388 #line 1980 "./parse.y"
4391 while (ctxp
->osb_number
--)
4392 obstack_1grow (&temporary_obstack
, '[');
4393 obstack_grow0 (&temporary_obstack
,
4394 IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp
[-3].node
)),
4395 IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp
[-3].node
)));
4396 ptr
= obstack_finish (&temporary_obstack
);
4397 EXPR_WFL_NODE (yyvsp
[-3].node
) = get_identifier (ptr
);
4398 yyval
.node
= build_cast (yyvsp
[-4].operator.location
, yyvsp
[-3].node
, yyvsp
[0].node
);
4402 #line 1992 "./parse.y"
4403 {yyerror ("']' expected, invalid type expression");;
4406 #line 1994 "./parse.y"
4408 if (ctxp
->prevent_ese
!= lineno
)
4409 yyerror ("Invalid type expression"); RECOVER
;
4414 #line 2000 "./parse.y"
4415 {yyerror ("Missing term"); RECOVER
;;
4418 #line 2002 "./parse.y"
4419 {yyerror ("Missing term"); RECOVER
;;
4422 #line 2004 "./parse.y"
4423 {yyerror ("Missing term"); RECOVER
;;
4426 #line 2010 "./parse.y"
4428 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
),
4429 yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
);
4433 #line 2015 "./parse.y"
4435 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4436 yyvsp
[-2].node
, yyvsp
[0].node
);
4440 #line 2020 "./parse.y"
4442 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4443 yyvsp
[-2].node
, yyvsp
[0].node
);
4447 #line 2025 "./parse.y"
4448 {yyerror ("Missing term"); RECOVER
;;
4451 #line 2027 "./parse.y"
4452 {yyerror ("Missing term"); RECOVER
;;
4455 #line 2029 "./parse.y"
4456 {yyerror ("Missing term"); RECOVER
;;
4459 #line 2035 "./parse.y"
4461 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4462 yyvsp
[-2].node
, yyvsp
[0].node
);
4466 #line 2040 "./parse.y"
4468 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4469 yyvsp
[-2].node
, yyvsp
[0].node
);
4473 #line 2045 "./parse.y"
4474 {yyerror ("Missing term"); RECOVER
;;
4477 #line 2047 "./parse.y"
4478 {yyerror ("Missing term"); RECOVER
;;
4481 #line 2053 "./parse.y"
4483 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4484 yyvsp
[-2].node
, yyvsp
[0].node
);
4488 #line 2058 "./parse.y"
4490 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4491 yyvsp
[-2].node
, yyvsp
[0].node
);
4495 #line 2063 "./parse.y"
4497 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4498 yyvsp
[-2].node
, yyvsp
[0].node
);
4502 #line 2068 "./parse.y"
4503 {yyerror ("Missing term"); RECOVER
;;
4506 #line 2070 "./parse.y"
4507 {yyerror ("Missing term"); RECOVER
;;
4510 #line 2072 "./parse.y"
4511 {yyerror ("Missing term"); RECOVER
;;
4514 #line 2078 "./parse.y"
4516 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4517 yyvsp
[-2].node
, yyvsp
[0].node
);
4521 #line 2083 "./parse.y"
4523 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4524 yyvsp
[-2].node
, yyvsp
[0].node
);
4528 #line 2088 "./parse.y"
4530 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4531 yyvsp
[-2].node
, yyvsp
[0].node
);
4535 #line 2093 "./parse.y"
4537 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4538 yyvsp
[-2].node
, yyvsp
[0].node
);
4542 #line 2098 "./parse.y"
4543 { yyval
.node
= build_binop (INSTANCEOF_EXPR
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4546 #line 2100 "./parse.y"
4547 {yyerror ("Missing term"); RECOVER
;;
4550 #line 2102 "./parse.y"
4551 {yyerror ("Missing term"); RECOVER
;;
4554 #line 2104 "./parse.y"
4555 {yyerror ("Missing term"); RECOVER
;;
4558 #line 2106 "./parse.y"
4559 {yyerror ("Missing term"); RECOVER
;;
4562 #line 2108 "./parse.y"
4563 {yyerror ("Invalid reference type"); RECOVER
;;
4566 #line 2114 "./parse.y"
4568 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4569 yyvsp
[-2].node
, yyvsp
[0].node
);
4573 #line 2119 "./parse.y"
4575 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4576 yyvsp
[-2].node
, yyvsp
[0].node
);
4580 #line 2124 "./parse.y"
4581 {yyerror ("Missing term"); RECOVER
;;
4584 #line 2126 "./parse.y"
4585 {yyerror ("Missing term"); RECOVER
;;
4588 #line 2132 "./parse.y"
4590 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4591 yyvsp
[-2].node
, yyvsp
[0].node
);
4595 #line 2137 "./parse.y"
4596 {yyerror ("Missing term"); RECOVER
;;
4599 #line 2143 "./parse.y"
4601 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4602 yyvsp
[-2].node
, yyvsp
[0].node
);
4606 #line 2148 "./parse.y"
4607 {yyerror ("Missing term"); RECOVER
;;
4610 #line 2154 "./parse.y"
4612 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4613 yyvsp
[-2].node
, yyvsp
[0].node
);
4617 #line 2159 "./parse.y"
4618 {yyerror ("Missing term"); RECOVER
;;
4621 #line 2165 "./parse.y"
4623 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4624 yyvsp
[-2].node
, yyvsp
[0].node
);
4628 #line 2170 "./parse.y"
4629 {yyerror ("Missing term"); RECOVER
;;
4632 #line 2176 "./parse.y"
4634 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4635 yyvsp
[-2].node
, yyvsp
[0].node
);
4639 #line 2181 "./parse.y"
4640 {yyerror ("Missing term"); RECOVER
;;
4643 #line 2187 "./parse.y"
4645 yyval
.node
= build (CONDITIONAL_EXPR
, NULL_TREE
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
);
4646 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-3].operator.location
;
4650 #line 2192 "./parse.y"
4653 yyerror ("Missing term");
4658 #line 2198 "./parse.y"
4659 {yyerror ("Missing term"); DRECOVER (2);;
4662 #line 2200 "./parse.y"
4663 {yyerror ("Missing term"); DRECOVER (3);;
4666 #line 2210 "./parse.y"
4667 { yyval
.node
= build_assignment (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4670 #line 2212 "./parse.y"
4672 if (ctxp
->prevent_ese
!= lineno
)
4673 yyerror ("Missing term");
4678 /* the action file gets copied in in place of this dollarsign */
4679 #line 498 "/usr/share/misc/bison.simple"
4690 short *ssp1
= yyss
- 1;
4691 fprintf (stderr
, "state stack now");
4692 while (ssp1
!= yyssp
)
4693 fprintf (stderr
, " %d", *++ssp1
);
4694 fprintf (stderr
, "\n");
4704 yylsp
->first_line
= yylloc
.first_line
;
4705 yylsp
->first_column
= yylloc
.first_column
;
4706 yylsp
->last_line
= (yylsp
-1)->last_line
;
4707 yylsp
->last_column
= (yylsp
-1)->last_column
;
4712 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
4713 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
4717 /* Now "shift" the result of the reduction.
4718 Determine what state that goes to,
4719 based on the state we popped back to
4720 and the rule number reduced by. */
4724 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
4725 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
4726 yystate
= yytable
[yystate
];
4728 yystate
= yydefgoto
[yyn
- YYNTBASE
];
4732 yyerrlab
: /* here on detecting error */
4735 /* If not already recovering from an error, report this error. */
4739 #ifdef YYERROR_VERBOSE
4740 yyn
= yypact
[yystate
];
4742 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
4749 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
4750 for (x
= (yyn
< 0 ? -yyn
: 0);
4751 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
4752 if (yycheck
[x
+ yyn
] == x
)
4753 size
+= strlen(yytname
[x
]) + 15, count
++;
4754 msg
= (char *) malloc(size
+ 15);
4757 strcpy(msg
, "parse error");
4762 for (x
= (yyn
< 0 ? -yyn
: 0);
4763 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
4764 if (yycheck
[x
+ yyn
] == x
)
4766 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
4767 strcat(msg
, yytname
[x
]);
4776 yyerror ("parse error; also virtual memory exceeded");
4779 #endif /* YYERROR_VERBOSE */
4780 yyerror("parse error");
4784 yyerrlab1
: /* here on error raised explicitly by an action */
4786 if (yyerrstatus
== 3)
4788 /* if just tried and failed to reuse lookahead token after an error, discard it. */
4790 /* return failure if at end of input */
4791 if (yychar
== YYEOF
)
4796 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
4802 /* Else will try to reuse lookahead token
4803 after shifting the error token. */
4805 yyerrstatus
= 3; /* Each real token shifted decrements this */
4809 yyerrdefault
: /* current state does not do anything special for the error token. */
4812 /* This is wrong; only states that explicitly want error tokens
4813 should shift them. */
4814 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4815 if (yyn
) goto yydefault
;
4818 yyerrpop
: /* pop the current state because it cannot handle the error token */
4820 if (yyssp
== yyss
) YYABORT
;
4830 short *ssp1
= yyss
- 1;
4831 fprintf (stderr
, "Error: state stack now");
4832 while (ssp1
!= yyssp
)
4833 fprintf (stderr
, " %d", *++ssp1
);
4834 fprintf (stderr
, "\n");
4840 yyn
= yypact
[yystate
];
4845 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
4864 fprintf(stderr
, "Shifting error token, ");
4875 #line 2238 "./parse.y"
4881 /* Flag for the error report routine to issue the error the first time
4882 it's called (overriding the default behavior which is to drop the
4883 first invocation and honor the second one, taking advantage of a
4885 static int force_error
= 0;
4887 /* Create a new parser context and make it the current one. */
4890 java_push_parser_context ()
4892 struct parser_ctxt
*new =
4893 (struct parser_ctxt
*)xmalloc(sizeof (struct parser_ctxt
));
4895 bzero (new, sizeof (struct parser_ctxt
));
4900 ctxp
->incomplete_class
= ctxp
->next
->incomplete_class
;
4901 ctxp
->gclass_list
= ctxp
->next
->gclass_list
;
4905 /* If the first file of a file list was a class file, no context
4906 exists for a source file to be parsed. This boolean remembers that
4907 java_parser_context_save_global might have created a dummy one, so
4908 that java_parser_context_restore_global can pop it. */
4909 static int extra_ctxp_pushed_p
= 0;
4912 java_parser_context_save_global ()
4916 java_push_parser_context ();
4917 extra_ctxp_pushed_p
= 1;
4919 ctxp
->finput
= finput
;
4920 ctxp
->lineno
= lineno
;
4921 ctxp
->current_class
= current_class
;
4922 ctxp
->filename
= input_filename
;
4923 ctxp
->current_function_decl
= current_function_decl
;
4927 java_parser_context_restore_global ()
4929 finput
= ctxp
->finput
;
4930 lineno
= ctxp
->lineno
;
4931 current_class
= ctxp
->current_class
;
4932 input_filename
= ctxp
->filename
;
4933 current_function_decl
= ctxp
->current_function_decl
;
4934 if (!ctxp
->next
&& extra_ctxp_pushed_p
)
4936 java_pop_parser_context (0);
4937 extra_ctxp_pushed_p
= 0;
4942 java_pop_parser_context (generate
)
4946 struct parser_ctxt
*toFree
, *next
;
4955 next
->incomplete_class
= ctxp
->incomplete_class
;
4956 next
->gclass_list
= ctxp
->gclass_list
;
4957 lineno
= ctxp
->lineno
;
4958 finput
= ctxp
->finput
;
4959 current_class
= ctxp
->current_class
;
4962 /* Set the single import class file flag to 0 for the current list
4963 of imported things */
4964 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
4965 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current
)) = 0;
4967 /* And restore those of the previous context */
4968 if ((ctxp
= next
)) /* Assignment is really meant here */
4969 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
4970 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current
)) = 1;
4974 toFree
->next
= ctxp_for_generation
;
4975 ctxp_for_generation
= toFree
;
4981 /* Reporting JDK1.1 features not implemented */
4984 parse_jdk1_1_error (msg
)
4987 sorry (": `%s' JDK1.1(TM) feature", msg
);
4989 return empty_stmt_node
;
4992 static int do_warning
= 0;
4999 static int prev_lineno
;
5000 static char *prev_msg
;
5003 char *remainder
, *code_from_source
;
5004 extern struct obstack temporary_obstack
;
5006 if (!force_error
&& prev_lineno
== lineno
)
5009 /* Save current error location but report latter, when the context is
5011 if (ctxp
->java_error_flag
== 0)
5013 ctxp
->java_error_flag
= 1;
5015 /* Do something to use the previous line if we're reaching the
5016 end of the file... */
5017 #ifdef VERBOSE_SKELETON
5018 printf ("* Error detected (%s)\n", (msg
? msg
: "(null)"));
5023 /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
5024 if (!force_error
&& msg
== prev_msg
&& prev_lineno
== elc
.line
)
5027 ctxp
->java_error_flag
= 0;
5029 java_warning_count
++;
5033 if (elc
.col
== 0 && msg
[1] == ';')
5035 elc
.col
= ctxp
->p_line
->char_col
-1;
5036 elc
.line
= ctxp
->p_line
->lineno
;
5039 save_lineno
= lineno
;
5040 prev_lineno
= lineno
= elc
.line
;
5043 code_from_source
= java_get_line_col (ctxp
->filename
, elc
.line
, elc
.col
);
5044 obstack_grow0 (&temporary_obstack
,
5045 code_from_source
, strlen (code_from_source
));
5046 remainder
= obstack_finish (&temporary_obstack
);
5048 warning ("%s.\n%s", msg
, remainder
);
5050 error ("%s.\n%s", msg
, remainder
);
5052 /* This allow us to cheaply avoid an extra 'Invalid expression
5053 statement' error report when errors have been already reported on
5054 the same line. This occurs when we report an error but don't have
5055 a synchronization point other than ';', which
5056 expression_statement is the only one to take care of. */
5057 ctxp
->prevent_ese
= lineno
= save_lineno
;
5061 issue_warning_error_from_context (cl
, msg
, ap
)
5066 char *saved
, *saved_input_filename
;
5068 vsprintf (buffer
, msg
, ap
);
5071 ctxp
->elc
.line
= EXPR_WFL_LINENO (cl
);
5072 ctxp
->elc
.col
= (EXPR_WFL_COLNO (cl
) == 0xfff ? -1 :
5073 (EXPR_WFL_COLNO (cl
) == 0xffe ? -2 : EXPR_WFL_COLNO (cl
)));
5075 /* We have a CL, that's a good reason for using it if it contains data */
5076 saved
= ctxp
->filename
;
5077 if (TREE_CODE (cl
) == EXPR_WITH_FILE_LOCATION
&& EXPR_WFL_FILENAME_NODE (cl
))
5078 ctxp
->filename
= EXPR_WFL_FILENAME (cl
);
5079 saved_input_filename
= input_filename
;
5080 input_filename
= ctxp
->filename
;
5082 java_error (buffer
);
5083 ctxp
->filename
= saved
;
5084 input_filename
= saved_input_filename
;
5088 /* Issue an error message at a current source line CL */
5091 parse_error_context
VPROTO ((tree cl
, char *msg
, ...))
5101 cl
= va_arg (ap
, tree
);
5102 msg
= va_arg (ap
, char *);
5104 issue_warning_error_from_context (cl
, msg
, ap
);
5108 /* Issue a warning at a current source line CL */
5111 parse_warning_context
VPROTO ((tree cl
, char *msg
, ...))
5121 cl
= va_arg (ap
, tree
);
5122 msg
= va_arg (ap
, char *);
5125 force_error
= do_warning
= 1;
5126 issue_warning_error_from_context (cl
, msg
, ap
);
5127 do_warning
= force_error
= 0;
5132 find_expr_with_wfl (node
)
5140 switch (TREE_CODE (node
))
5143 return find_expr_with_wfl (BLOCK_EXPR_BODY (node
));
5146 to_return
= find_expr_with_wfl (TREE_OPERAND (node
, 0));
5149 to_return
= find_expr_with_wfl (TREE_OPERAND (node
, 1));
5153 return find_expr_with_wfl (TREE_OPERAND (node
, 0));
5155 case LABELED_BLOCK_EXPR
:
5156 return find_expr_with_wfl (TREE_OPERAND (node
, 1));
5158 code
= TREE_CODE_CLASS (TREE_CODE (node
));
5159 if (((code
== '1') || (code
== '2') || (code
== 'e'))
5160 && EXPR_WFL_LINECOL (node
))
5167 /* Issue a missing return statement error. Uses METHOD to figure the
5168 last line of the method the error occurs in. */
5171 missing_return_error (method
)
5174 EXPR_WFL_SET_LINECOL (wfl_operator
, DECL_SOURCE_LINE_LAST (method
), -2);
5175 parse_error_context (wfl_operator
, "Missing return statement");
5178 /* Issue an unreachable statement error. From NODE, find the next
5179 statement to report appropriately. */
5181 unreachable_stmt_error (node
)
5184 /* Browse node to find the next expression node that has a WFL. Use
5185 the location to report the error */
5186 if (TREE_CODE (node
) == COMPOUND_EXPR
)
5187 node
= find_expr_with_wfl (TREE_OPERAND (node
, 1));
5189 node
= find_expr_with_wfl (node
);
5193 EXPR_WFL_SET_LINECOL (wfl_operator
, EXPR_WFL_LINENO (node
), -2);
5194 parse_error_context (wfl_operator
, "Unreachable statement");
5197 fatal ("Can't get valid statement - unreachable_stmt_error");
5201 java_report_errors ()
5203 if (java_error_count
)
5204 fprintf (stderr
, "%d error%s",
5205 java_error_count
, (java_error_count
== 1 ? "" : "s"));
5206 if (java_warning_count
)
5207 fprintf (stderr
, "%s%d warning%s", (java_error_count
? ", " : ""),
5208 java_warning_count
, (java_warning_count
== 1 ? "" : "s"));
5209 if (java_error_count
|| java_warning_count
)
5210 putc ('\n', stderr
);
5211 return java_error_count
;
5215 java_accstring_lookup (flags
)
5218 static char buffer
[80];
5219 #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
5221 /* Access modifier looked-up first for easier report on forbidden
5223 if (flags
& ACC_PUBLIC
) COPY_RETURN ("public");
5224 if (flags
& ACC_PRIVATE
) COPY_RETURN ("private");
5225 if (flags
& ACC_PROTECTED
) COPY_RETURN ("protected");
5226 if (flags
& ACC_STATIC
) COPY_RETURN ("static");
5227 if (flags
& ACC_FINAL
) COPY_RETURN ("final");
5228 if (flags
& ACC_SYNCHRONIZED
) COPY_RETURN ("synchronized");
5229 if (flags
& ACC_VOLATILE
) COPY_RETURN ("volatile");
5230 if (flags
& ACC_TRANSIENT
) COPY_RETURN ("transient");
5231 if (flags
& ACC_NATIVE
) COPY_RETURN ("native");
5232 if (flags
& ACC_INTERFACE
) COPY_RETURN ("interface");
5233 if (flags
& ACC_ABSTRACT
) COPY_RETURN ("abstract");
5240 /* Issuing error messages upon redefinition of classes, interfaces or
5244 classitf_redefinition_error (context
, id
, decl
, cl
)
5248 parse_error_context (cl
, "%s `%s' already defined in %s:%d",
5249 context
, IDENTIFIER_POINTER (id
),
5250 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
5251 /* Here we should point out where its redefined. It's a unicode. FIXME */
5255 variable_redefinition_error (context
, name
, type
, line
)
5256 tree context
, name
, type
;
5261 /* Figure a proper name for type. We might haven't resolved it */
5262 if (TREE_CODE (type
) == POINTER_TYPE
&& !TREE_TYPE (type
))
5263 type_name
= IDENTIFIER_POINTER (TYPE_NAME (type
));
5265 type_name
= lang_printable_name (type
, 0);
5267 parse_error_context (context
,
5268 "Variable `%s' is already defined in this method and "
5269 "was declared `%s %s' at line %d",
5270 IDENTIFIER_POINTER (name
),
5271 type_name
, IDENTIFIER_POINTER (name
), line
);
5275 build_array_from_name (type
, type_wfl
, name
, ret_name
)
5276 tree type
, type_wfl
, name
, *ret_name
;
5281 /* Eventually get more dims */
5282 string
= IDENTIFIER_POINTER (name
);
5283 while (string
[more_dims
] == '[')
5286 /* If we have, then craft a new type for this variable */
5289 name
= get_identifier (&more_dims
[string
]);
5291 /* If type already is a reference on an array, get the base type */
5292 if ((TREE_CODE (type
) == POINTER_TYPE
) &&
5293 TYPE_ARRAY_P (TREE_TYPE (type
)))
5294 type
= TREE_TYPE (type
);
5296 /* Building the first dimension of a primitive type uses this
5298 if (JPRIMITIVE_TYPE_P (type
))
5300 type
= build_java_array_type (type
, -1);
5301 CLASS_LOADED_P (type
) = 1;
5304 /* Otherwise, if we have a WFL for this type, use it (the type
5305 is already an array on an unresolved type, and we just keep
5306 on adding dimensions) */
5310 /* Add all the dimensions */
5312 type
= build_unresolved_array_type (type
);
5314 /* The type may have been incomplete in the first place */
5316 type
= obtain_incomplete_type (type
);
5323 /* Build something that the type identifier resolver will identify as
5324 being an array to an unresolved type. TYPE_WFL is a WFL on a
5328 build_unresolved_array_type (type_or_wfl
)
5333 /* TYPE_OR_WFL might be an array on a resolved type. In this case,
5334 just create a array type */
5335 if (TREE_CODE (type_or_wfl
) == RECORD_TYPE
)
5337 tree type
= build_java_array_type (type_or_wfl
, -1);
5338 CLASS_LOADED_P (type
) = CLASS_LOADED_P (type_or_wfl
);
5342 obstack_1grow (&temporary_obstack
, '[');
5343 obstack_grow0 (&temporary_obstack
,
5344 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl
)),
5345 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl
)));
5346 ptr
= obstack_finish (&temporary_obstack
);
5347 return build_expr_wfl (get_identifier (ptr
),
5348 EXPR_WFL_FILENAME (type_or_wfl
),
5349 EXPR_WFL_LINENO (type_or_wfl
),
5350 EXPR_WFL_COLNO (type_or_wfl
));
5353 /* Check modifiers. If one doesn't fit, retrieve it in its declaration line
5354 and point it out. */
5357 check_modifiers (message
, value
, mask
)
5362 /* Should point out the one that don't fit. ASCII/unicode,
5363 going backward. FIXME */
5366 int i
, remainder
= value
& ~mask
;
5367 for (i
= 0; i
<= 10; i
++)
5368 if ((1 << i
) & remainder
)
5369 parse_error_context (ctxp
->modifier_ctx
[i
], message
,
5370 java_accstring_lookup (1 << i
));
5375 parser_add_interface (class_decl
, interface_decl
, wfl
)
5376 tree class_decl
, interface_decl
, wfl
;
5378 if (maybe_add_interface (TREE_TYPE (class_decl
), TREE_TYPE (interface_decl
)))
5379 parse_error_context (wfl
, "Interface `%s' repeated",
5380 IDENTIFIER_POINTER (DECL_NAME (interface_decl
)));
5383 /* Bulk of common class/interface checks. Return 1 if an error was
5384 encountered. TAG is 0 for a class, 1 for an interface. */
5387 check_class_interface_creation (is_interface
, flags
, raw_name
, qualified_name
, decl
, cl
)
5388 int is_interface
, flags
;
5389 tree raw_name
, qualified_name
, decl
, cl
;
5394 fprintf (stderr
, " %s %s", (is_interface
? "interface" : "class"),
5395 IDENTIFIER_POINTER (qualified_name
));
5397 /* Scope of an interface/class type name:
5398 - Can't be imported by a single type import
5399 - Can't already exists in the package */
5400 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name
)
5401 && (node
= find_name_in_single_imports (raw_name
)))
5404 (cl
, "%s name `%s' clashes with imported type `%s'",
5405 (is_interface
? "Interface" : "Class"),
5406 IDENTIFIER_POINTER (raw_name
), IDENTIFIER_POINTER (node
));
5409 if (decl
&& CLASS_COMPLETE_P (decl
))
5411 classitf_redefinition_error ((is_interface
? "Interface" : "Class"),
5412 qualified_name
, decl
, cl
);
5416 /* If public, file name should match class/interface name */
5417 if (flags
& ACC_PUBLIC
)
5421 /* Contains OS dependent assumption on path separator. FIXME */
5422 for (f
= &input_filename
[strlen (input_filename
)];
5423 f
!= input_filename
&& f
[0] != '/' && f
[0] != DIR_SEPARATOR
;
5426 if (f
[0] == '/' || f
[0] == DIR_SEPARATOR
)
5428 if (strncmp (IDENTIFIER_POINTER (raw_name
),
5429 f
, IDENTIFIER_LENGTH (raw_name
)) ||
5430 f
[IDENTIFIER_LENGTH (raw_name
)] != '.')
5431 parse_error_context (cl
, "Public %s `%s' must be defined in a file "
5433 (is_interface
? "interface" : "class"),
5434 IDENTIFIER_POINTER (qualified_name
),
5435 IDENTIFIER_POINTER (raw_name
));
5438 check_modifiers ((is_interface
?
5439 "Illegal modifier `%s' for interface declaration" :
5440 "Illegal modifier `%s' for class declaration"), flags
,
5441 (is_interface
? INTERFACE_MODIFIERS
: CLASS_MODIFIERS
));
5445 /* If DECL is NULL, create and push a new DECL, record the current
5446 line CL and do other maintenance things. */
5449 maybe_create_class_interface_decl (decl
, qualified_name
, cl
)
5450 tree decl
, qualified_name
, cl
;
5453 decl
= push_class (make_class (), qualified_name
);
5455 /* Take care of the file and line business */
5456 DECL_SOURCE_FILE (decl
) = EXPR_WFL_FILENAME (cl
);
5457 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINENO (cl
);
5458 CLASS_FROM_SOURCE_P (TREE_TYPE (decl
)) = 1;
5459 CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl
)) =
5460 IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl
));
5462 ctxp
->current_parsed_class
= decl
;
5464 /* Link the declaration to the already seen ones */
5465 TREE_CHAIN (decl
) = ctxp
->class_list
;
5466 ctxp
->class_list
= decl
;
5468 /* Create a new nodes in the global lists */
5469 ctxp
->gclass_list
= tree_cons (NULL_TREE
, decl
, ctxp
->gclass_list
);
5470 all_class_list
= tree_cons (NULL_TREE
, decl
, all_class_list
);
5472 /* Install a new dependency list element */
5473 create_jdep_list (ctxp
);
5475 SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
5476 IDENTIFIER_POINTER (qualified_name
)));
5481 add_superinterfaces (decl
, interface_list
)
5482 tree decl
, interface_list
;
5485 /* Superinterface(s): if present and defined, parser_check_super_interface ()
5486 takes care of ensuring that:
5487 - This is an accessible interface type,
5488 - Circularity detection.
5489 parser_add_interface is then called. If present but not defined,
5490 the check operation is delayed until the super interface gets
5492 for (node
= interface_list
; node
; node
= TREE_CHAIN (node
))
5494 tree current
= TREE_PURPOSE (node
);
5495 tree idecl
= IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current
));
5496 if (idecl
&& CLASS_LOADED_P (TREE_TYPE (idecl
)))
5498 if (!parser_check_super_interface (idecl
, decl
, current
))
5499 parser_add_interface (decl
, idecl
, current
);
5502 register_incomplete_type (JDEP_INTERFACE
,
5503 current
, decl
, NULL_TREE
);
5507 /* Create an interface in pass1 and return its decl. Return the
5508 interface's decl in pass 2. */
5511 create_interface (flags
, id
, super
)
5515 tree raw_name
= EXPR_WFL_NODE (id
);
5516 tree q_name
= parser_qualified_classname (id
);
5517 tree decl
= IDENTIFIER_CLASS_VALUE (q_name
);
5519 EXPR_WFL_NODE (id
) = q_name
; /* Keep source location, even if refined. */
5521 /* Basic checks: scope, redefinition, modifiers */
5522 if (check_class_interface_creation (1, flags
, raw_name
, q_name
, decl
, id
))
5525 /* Interface modifiers check
5526 - public/abstract allowed (already done at that point)
5527 - abstract is obsolete (comes first, it's a warning, or should be)
5528 - Can't use twice the same (checked in the modifier rule) */
5529 if ((flags
& ACC_ABSTRACT
) && flag_redundant
)
5530 parse_warning_context
5531 (MODIFIER_WFL (ABSTRACT_TK
),
5532 "Redundant use of `abstract' modifier. Interface `%s' is implicitely "
5533 "abstract", IDENTIFIER_POINTER (raw_name
));
5535 /* Create a new decl if DECL is NULL, otherwise fix it */
5536 decl
= maybe_create_class_interface_decl (decl
, q_name
, id
);
5538 /* Set super info and mark the class a complete */
5539 set_super_info (ACC_ABSTRACT
| ACC_INTERFACE
| flags
, TREE_TYPE (decl
),
5540 object_type_node
, ctxp
->interface_number
);
5541 ctxp
->interface_number
= 0;
5542 CLASS_COMPLETE_P (decl
) = 1;
5543 add_superinterfaces (decl
, super
);
5548 /* Create an class in pass1 and return its decl. Return class
5549 interface's decl in pass 2. */
5552 create_class (flags
, id
, super
, interfaces
)
5554 tree id
, super
, interfaces
;
5556 tree raw_name
= EXPR_WFL_NODE (id
);
5557 tree class_id
, decl
;
5558 tree super_decl
= NULL
, super_decl_type
;
5560 class_id
= parser_qualified_classname (id
);
5561 decl
= IDENTIFIER_CLASS_VALUE (class_id
);
5562 ctxp
->current_parsed_class_un
= EXPR_WFL_NODE (id
);
5563 EXPR_WFL_NODE (id
) = class_id
;
5565 /* Basic check: scope, redefinition, modifiers */
5566 if (check_class_interface_creation (0, flags
, raw_name
, class_id
, decl
, id
))
5569 /* Class modifier check:
5570 - Allowed modifier (already done at that point)
5571 - abstract AND final forbidden
5572 - Public classes defined in the correct file */
5573 if ((flags
& ACC_ABSTRACT
) && (flags
& ACC_FINAL
))
5574 parse_error_context (id
, "Class `%s' can't be declared both abstract "
5575 "and final", IDENTIFIER_POINTER (raw_name
));
5577 /* Create a new decl if DECL is NULL, otherwise fix it */
5578 decl
= maybe_create_class_interface_decl (decl
, class_id
, id
);
5580 /* If SUPER exists, use it, otherwise use Object */
5583 /* Can't extend java.lang.Object */
5584 if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id
)) == object_type_node
)
5586 parse_error_context (id
, "Can't extend `java.lang.Object'");
5590 /* The class is known and exists if there is a decl. Otherwise,
5591 postpone the operation and do it later. */
5592 super_decl
= IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (super
));
5595 parser_check_super (super_decl
, decl
, id
);
5596 super_decl_type
= TREE_TYPE (super_decl
);
5600 register_incomplete_type (JDEP_SUPER
, super
, decl
, NULL_TREE
);
5602 else if (TREE_TYPE (decl
) != object_type_node
)
5603 super_decl_type
= object_type_node
;
5604 /* We're defining java.lang.Object */
5606 super_decl_type
= NULL_TREE
;
5608 /* Set super info and mark the class a complete */
5609 set_super_info (flags
, TREE_TYPE (decl
), super_decl_type
,
5610 ctxp
->interface_number
);
5611 ctxp
->interface_number
= 0;
5612 CLASS_COMPLETE_P (decl
) = 1;
5613 add_superinterfaces (decl
, interfaces
);
5615 /* Eventually sets the @deprecated tag flag */
5616 CHECK_DEPRECATED (decl
);
5621 /* Can't use lookup_field () since we don't want to load the class and
5622 can't set the CLASS_LOADED_P flag */
5625 find_field (class, name
)
5630 for (decl
= TYPE_FIELDS (class); decl
; decl
= TREE_CHAIN (decl
))
5632 if (DECL_NAME (decl
) == name
)
5638 /* Wrap around lookup_field that doesn't potentially upset the value
5642 lookup_field_wrapper (class, name
)
5647 java_parser_context_save_global ();
5648 decl
= lookup_field (&type
, name
);
5649 java_parser_context_restore_global ();
5653 /* Find duplicate field within the same class declarations and report
5654 the error. Returns 1 if a duplicated field was found, 0
5658 duplicate_declaration_error_p (new_field_name
, new_type
, cl
)
5659 tree new_field_name
, new_type
, cl
;
5661 /* This might be modified to work with method decl as well */
5662 tree decl
= find_field (TREE_TYPE (ctxp
->current_parsed_class
),
5666 char *t1
= strdup (purify_type_name
5667 ((TREE_CODE (new_type
) == POINTER_TYPE
5668 && TREE_TYPE (new_type
) == NULL_TREE
) ?
5669 IDENTIFIER_POINTER (TYPE_NAME (new_type
)) :
5670 lang_printable_name (new_type
, 1)));
5671 /* The type may not have been completed by the time we report
5673 char *t2
= strdup (purify_type_name
5674 ((TREE_CODE (TREE_TYPE (decl
)) == POINTER_TYPE
5675 && TREE_TYPE (TREE_TYPE (decl
)) == NULL_TREE
) ?
5676 IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl
))) :
5677 lang_printable_name (TREE_TYPE (decl
), 1)));
5679 (cl
, "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
5680 t1
, IDENTIFIER_POINTER (new_field_name
),
5681 t2
, IDENTIFIER_POINTER (DECL_NAME (decl
)),
5682 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
5690 /* Field registration routine. If TYPE doesn't exist, field
5691 declarations are linked to the undefined TYPE dependency list, to
5692 be later resolved in java_complete_class () */
5695 register_fields (flags
, type
, variable_list
)
5697 tree type
, variable_list
;
5699 tree current
, saved_type
;
5700 tree class_type
= TREE_TYPE (ctxp
->current_parsed_class
);
5701 int saved_lineno
= lineno
;
5703 tree wfl
= NULL_TREE
;
5705 /* If we're adding fields to interfaces, those fields are public,
5707 if (CLASS_INTERFACE (TYPE_NAME (class_type
)))
5709 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK
),
5711 "%s", "interface field(s)");
5712 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK
),
5714 "%s", "interface field(s)");
5715 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK
),
5716 flags
, ACC_FINAL
, "%s", "interface field(s)");
5717 check_modifiers ("Illegal interface member modifier `%s'", flags
,
5718 INTERFACE_FIELD_MODIFIERS
);
5719 flags
|= (ACC_PUBLIC
| ACC_STATIC
| ACC_FINAL
);
5722 /* Obtain a suitable type for resolution, if necessary */
5723 SET_TYPE_FOR_RESOLUTION (type
, wfl
, must_chain
);
5725 /* If TYPE is fully resolved and we don't have a reference, make one */
5726 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
5728 for (current
= variable_list
, saved_type
= type
; current
;
5729 current
= TREE_CHAIN (current
), type
= saved_type
)
5733 tree cl
= TREE_PURPOSE (current
);
5734 tree init
= TREE_VALUE (current
);
5735 tree current_name
= EXPR_WFL_NODE (cl
);
5737 /* Process NAME, as it may specify extra dimension(s) for it */
5738 type
= build_array_from_name (type
, wfl
, current_name
, ¤t_name
);
5740 /* Type adjustment. We may have just readjusted TYPE because
5741 the variable specified more dimensions. Make sure we have
5742 a reference if we can and don't have one already. Also
5743 change the name if we have an init. */
5744 if (type
!= saved_type
)
5746 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
5748 EXPR_WFL_NODE (TREE_OPERAND (init
, 0)) = current_name
;
5751 real_type
= GET_REAL_TYPE (type
);
5752 /* Check for redeclarations */
5753 if (duplicate_declaration_error_p (current_name
, real_type
, cl
))
5756 /* Set lineno to the line the field was found and create a
5757 declaration for it. Eventually sets the @deprecated tag flag. */
5758 lineno
= EXPR_WFL_LINENO (cl
);
5759 field_decl
= add_field (class_type
, current_name
, real_type
, flags
);
5760 CHECK_DEPRECATED (field_decl
);
5762 /* Check if we must chain. */
5764 register_incomplete_type (JDEP_FIELD
, wfl
, field_decl
, type
);
5766 /* Default value of a static field is 0 and it is considered
5768 if (flags
& ACC_STATIC
)
5769 INITIALIZED_P (field_decl
) = 1;
5771 /* If we have an initialization value tied to the field */
5774 /* The field is declared static */
5775 if (flags
& ACC_STATIC
)
5777 /* We include the field and its initialization part into
5778 a list used to generate <clinit>. After <clinit> is
5779 walked, fields initialization will be processed and
5780 fields initialized with know constants will be taken
5781 out of <clinit> and have ther DECL_INITIAL set
5783 TREE_CHAIN (init
) = ctxp
->static_initialized
;
5784 ctxp
->static_initialized
= init
;
5785 DECL_INITIAL (field_decl
) = TREE_OPERAND (init
, 1);
5787 /* A non-static field declared with an immediate initialization is
5788 to be initialized in <init>, if any. This field is remembered
5789 to be processed at the time of the generation of <init>. */
5792 TREE_CHAIN (init
) = ctxp
->non_static_initialized
;
5793 ctxp
->non_static_initialized
= init
;
5795 INITIALIZED_P (field_decl
) = 1;
5796 MODIFY_EXPR_FROM_INITIALIZATION_P (init
) = 1;
5799 lineno
= saved_lineno
;
5802 /* Generate the method $finit$ that initializes fields initialized
5803 upon declaration. */
5806 maybe_generate_finit ()
5808 tree mdecl
, current
;
5810 if (!ctxp
->non_static_initialized
|| java_error_count
)
5813 mdecl
= create_artificial_method (TREE_TYPE (ctxp
->current_parsed_class
),
5814 ACC_PRIVATE
, void_type_node
,
5815 finit_identifier_node
, end_params_node
);
5816 start_artificial_method_body (mdecl
);
5818 ctxp
->non_static_initialized
= nreverse (ctxp
->non_static_initialized
);
5819 for (current
= ctxp
->non_static_initialized
; current
;
5820 current
= TREE_CHAIN (current
))
5821 java_method_add_stmt (mdecl
,
5822 build_debugable_stmt (EXPR_WFL_LINECOL (current
),
5825 end_artificial_method_body (mdecl
);
5826 CLASS_HAS_FINIT_P (TREE_TYPE (ctxp
->current_parsed_class
)) = 1;
5827 ctxp
->non_static_initialized
= NULL_TREE
;
5830 /* Check whether it is necessary to generate a <clinit> for the class
5834 maybe_generate_clinit ()
5838 if (!ctxp
->static_initialized
|| java_error_count
)
5841 mdecl
= create_artificial_method (TREE_TYPE (ctxp
->current_parsed_class
),
5842 ACC_STATIC
, void_type_node
,
5843 clinit_identifier_node
, end_params_node
);
5844 start_artificial_method_body (mdecl
);
5846 /* Keep initialization in order to enforce 8.5 */
5847 ctxp
->static_initialized
= nreverse (ctxp
->static_initialized
);
5849 /* We process the list of assignment we produced as the result of
5850 the declaration of initialized static field and add them as
5851 statement to the <clinit> method. */
5852 for (c
= ctxp
->static_initialized
; c
; c
= TREE_CHAIN (c
))
5854 /* We build the assignment expression that will initialize the
5855 field to its value. There are strict rules on static
5856 initializers (8.5). FIXME */
5857 java_method_add_stmt (mdecl
,
5858 build_debugable_stmt (EXPR_WFL_LINECOL (c
), c
));
5861 end_artificial_method_body (mdecl
);
5862 ctxp
->static_initialized
= NULL_TREE
;
5865 /* Shared accros method_declarator and method_header to remember the
5866 patch stage that was reached during the declaration of the method.
5867 A method DECL is built differently is there is no patch
5868 (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
5869 pending on the currently defined method. */
5871 static int patch_stage
;
5873 /* Check the method declaration and add the method to its current
5874 class. If the argument list is known to contain incomplete types,
5875 the method is partially added and the registration will be resume
5876 once the method arguments resolved. If TYPE is NULL, we're dealing
5877 with a constructor. */
5880 method_header (flags
, type
, mdecl
, throws
)
5882 tree type
, mdecl
, throws
;
5884 tree meth
= TREE_VALUE (mdecl
);
5885 tree id
= TREE_PURPOSE (mdecl
);
5886 tree this_class
= TREE_TYPE (ctxp
->current_parsed_class
);
5887 tree type_wfl
= NULL_TREE
;
5888 tree meth_name
= NULL_TREE
, current
, orig_arg
;
5890 int constructor_ok
= 0, must_chain
;
5892 check_modifiers_consistency (flags
);
5894 /* There are some forbidden modifiers for an abstract method and its
5895 class must be abstract as well. */
5896 if (type
&& (flags
& ACC_ABSTRACT
))
5898 ABSTRACT_CHECK (flags
, ACC_PRIVATE
, id
, "Private");
5899 ABSTRACT_CHECK (flags
, ACC_STATIC
, id
, "Static");
5900 ABSTRACT_CHECK (flags
, ACC_FINAL
, id
, "Final");
5901 ABSTRACT_CHECK (flags
, ACC_NATIVE
, id
, "Native");
5902 ABSTRACT_CHECK (flags
, ACC_SYNCHRONIZED
,id
, "Synchronized");
5903 if (!CLASS_ABSTRACT (TYPE_NAME (this_class
)))
5905 (id
, "Class `%s' must be declared abstract to define abstract "
5907 IDENTIFIER_POINTER (DECL_NAME (ctxp
->current_parsed_class
)),
5908 IDENTIFIER_POINTER (EXPR_WFL_NODE (id
)));
5910 /* Things to be checked when declaring a constructor */
5913 int ec
= java_error_count
;
5914 /* 8.6: Constructor declarations: we might be trying to define a
5915 method without specifying a return type. */
5916 if (EXPR_WFL_NODE (id
) != ctxp
->current_parsed_class_un
)
5918 (id
, "Invalid method declaration, return type required");
5919 /* 8.6.3: Constructor modifiers */
5922 JCONSTRUCTOR_CHECK (flags
, ACC_ABSTRACT
, id
, "abstract");
5923 JCONSTRUCTOR_CHECK (flags
, ACC_STATIC
, id
, "static");
5924 JCONSTRUCTOR_CHECK (flags
, ACC_FINAL
, id
, "final");
5925 JCONSTRUCTOR_CHECK (flags
, ACC_NATIVE
, id
, "native");
5926 JCONSTRUCTOR_CHECK (flags
, ACC_SYNCHRONIZED
, id
, "synchronized");
5928 /* If we found error here, we don't consider it's OK to tread
5929 the method definition as a constructor, for the rest of this
5931 if (ec
== java_error_count
)
5935 /* Method declared within the scope of an interface are implicitly
5936 abstract and public. Conflicts with other erroneously provided
5937 modifiers are check right after. */
5939 if (CLASS_INTERFACE (TYPE_NAME (this_class
)))
5941 /* If FLAGS isn't set because of a modifier, turn the
5942 corresponding modifier WFL to NULL so we issue a warning on
5943 the obsolete use of the modifier */
5944 if (!(flags
& ACC_PUBLIC
))
5945 MODIFIER_WFL (PUBLIC_TK
) = NULL
;
5946 if (!(flags
& ACC_ABSTRACT
))
5947 MODIFIER_WFL (ABSTRACT_TK
) = NULL
;
5948 flags
|= ACC_PUBLIC
;
5949 flags
|= ACC_ABSTRACT
;
5952 /* Modifiers context reset moved up, so abstract method declaration
5953 modifiers can be later checked. */
5955 /* Set constructor returned type to void and method name to <init>,
5956 unless we found an error identifier the constructor (in which
5957 case we retain the original name) */
5960 type
= void_type_node
;
5962 meth_name
= init_identifier_node
;
5965 meth_name
= EXPR_WFL_NODE (id
);
5967 /* Do the returned type resolution and registration if necessary */
5968 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
5971 type
= build_array_from_name (type
, type_wfl
, meth_name
, &meth_name
);
5972 EXPR_WFL_NODE (id
) = meth_name
;
5973 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
5977 patch_stage
= JDEP_METHOD_RETURN
;
5978 register_incomplete_type (patch_stage
, type_wfl
, id
, type
);
5979 TREE_TYPE (meth
) = GET_REAL_TYPE (type
);
5982 TREE_TYPE (meth
) = type
;
5984 saved_lineno
= lineno
;
5985 /* When defining an abstract or interface method, the curly
5986 bracket at level 1 doesn't exist because there is no function
5988 lineno
= (ctxp
->first_ccb_indent1
? ctxp
->first_ccb_indent1
:
5989 EXPR_WFL_LINENO (id
));
5991 /* Remember the original argument list */
5992 orig_arg
= TYPE_ARG_TYPES (meth
);
5994 if (patch_stage
) /* includes ret type and/or all args */
5997 meth
= add_method_1 (this_class
, flags
, meth_name
, meth
);
5998 /* Patch for the return type */
5999 if (patch_stage
== JDEP_METHOD_RETURN
)
6001 jdep
= CLASSD_LAST (ctxp
->classd_list
);
6002 JDEP_GET_PATCH (jdep
) = &TREE_TYPE (TREE_TYPE (meth
));
6004 /* This is the stop JDEP. METH allows the function's signature
6006 register_incomplete_type (JDEP_METHOD_END
, NULL_TREE
, meth
, NULL_TREE
);
6009 meth
= add_method (this_class
, flags
, meth_name
,
6010 build_java_signature (meth
));
6012 /* Fix the method argument list so we have the argument name
6014 fix_method_argument_names (orig_arg
, meth
);
6016 /* Register the parameter number and re-install the current line
6018 DECL_MAX_LOCALS (meth
) = ctxp
->formal_parameter_number
+1;
6019 lineno
= saved_lineno
;
6021 /* Register exception specified by the `throws' keyword for
6022 resolution and set the method decl appropriate field to the list.
6023 Note: the grammar ensures that what we get here are class
6027 throws
= nreverse (throws
);
6028 for (current
= throws
; current
; current
= TREE_CHAIN (current
))
6030 register_incomplete_type (JDEP_EXCEPTION
, TREE_VALUE (current
),
6031 NULL_TREE
, NULL_TREE
);
6032 JDEP_GET_PATCH (CLASSD_LAST (ctxp
->classd_list
)) =
6033 &TREE_VALUE (current
);
6035 DECL_FUNCTION_THROWS (meth
) = throws
;
6038 /* We set the DECL_NAME to ID so we can track the location where
6039 the function was declared. This allow us to report
6040 redefinition error accurately. When method are verified,
6041 DECL_NAME is reinstalled properly (using the content of the
6042 WFL node ID) (see check_method_redefinition). We don't do that
6043 when Object is being defined. Constructor <init> names will be
6044 reinstalled the same way. */
6045 if (TREE_TYPE (ctxp
->current_parsed_class
) != object_type_node
)
6046 DECL_NAME (meth
) = id
;
6048 /* Set the flag if we correctly processed a constructor */
6050 DECL_CONSTRUCTOR_P (meth
) = 1;
6052 /* Eventually set the @deprecated tag flag */
6053 CHECK_DEPRECATED (meth
);
6059 fix_method_argument_names (orig_arg
, meth
)
6060 tree orig_arg
, meth
;
6062 tree arg
= TYPE_ARG_TYPES (TREE_TYPE (meth
));
6063 if (TREE_CODE (TREE_TYPE (meth
)) == METHOD_TYPE
)
6065 TREE_PURPOSE (arg
) = this_identifier_node
;
6066 arg
= TREE_CHAIN (arg
);
6068 while (orig_arg
!= end_params_node
)
6070 TREE_PURPOSE (arg
) = TREE_PURPOSE (orig_arg
);
6071 orig_arg
= TREE_CHAIN (orig_arg
);
6072 arg
= TREE_CHAIN (arg
);
6076 /* Complete the method declaration with METHOD_BODY. */
6079 complete_method_declaration (method_body
)
6082 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl
)) = method_body
;
6083 maybe_absorb_scoping_blocks ();
6084 /* Exit function's body */
6086 /* Merge last line of the function with first line, directly in the
6087 function decl. It will be used to emit correct debug info. */
6088 DECL_SOURCE_LINE_MERGE (current_function_decl
, ctxp
->last_ccb_indent1
);
6091 /* Build a an error message for constructor circularity errors. */
6094 constructor_circularity_msg (from
, to
)
6097 static char string
[4096];
6098 char *t
= strdup (lang_printable_name (from
, 0));
6099 sprintf (string
, "`%s' invokes `%s'", t
, lang_printable_name (to
, 0));
6104 /* Verify a circular call to METH. Return 1 if an error is found, 0
6108 verify_constructor_circularity (meth
, current
)
6111 static tree list
= NULL_TREE
;
6113 for (c
= DECL_CONSTRUCTOR_CALLS (current
); c
; c
= TREE_CHAIN (c
))
6115 if (TREE_VALUE (c
) == meth
)
6121 list
= nreverse (list
);
6122 for (liste
= list
; liste
; liste
= TREE_CHAIN (liste
))
6125 (TREE_PURPOSE (TREE_PURPOSE (liste
)),
6126 constructor_circularity_msg
6127 (TREE_VALUE (liste
), TREE_VALUE (TREE_PURPOSE (liste
))));
6131 t
= strdup (lang_printable_name (meth
, 0));
6132 parse_error_context (TREE_PURPOSE (c
),
6133 "%s: recursive invocation of constructor `%s'",
6134 constructor_circularity_msg (current
, meth
), t
);
6140 for (c
= DECL_CONSTRUCTOR_CALLS (current
); c
; c
= TREE_CHAIN (c
))
6142 list
= tree_cons (c
, current
, list
);
6143 if (verify_constructor_circularity (meth
, TREE_VALUE (c
)))
6145 list
= TREE_CHAIN (list
);
6150 /* Check modifiers that can be declared but exclusively */
6153 check_modifiers_consistency (flags
)
6157 tree cl
= NULL_TREE
;
6159 THIS_MODIFIER_ONLY (flags
, ACC_PUBLIC
, 0, acc_count
, cl
);
6160 THIS_MODIFIER_ONLY (flags
, ACC_PRIVATE
, 1, acc_count
, cl
);
6161 THIS_MODIFIER_ONLY (flags
, ACC_PROTECTED
, 2, acc_count
, cl
);
6164 (cl
, "Inconsistent member declaration. At most one of `public', "
6165 "`private', or `protected' may be specified");
6168 /* Check the methode header METH for abstract specifics features */
6171 check_abstract_method_header (meth
)
6174 int flags
= get_access_flags_from_decl (meth
);
6175 /* DECL_NAME might still be a WFL node */
6176 tree name
= GET_METHOD_NAME (meth
);
6178 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK
), flags
,
6179 ACC_ABSTRACT
, "abstract method `%s'",
6180 IDENTIFIER_POINTER (name
));
6181 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK
), flags
,
6182 ACC_PUBLIC
, "abstract method `%s'",
6183 IDENTIFIER_POINTER (name
));
6185 check_modifiers ("Illegal modifier `%s' for interface method",
6186 flags
, INTERFACE_METHOD_MODIFIERS
);
6189 /* Create a FUNCTION_TYPE node and start augmenting it with the
6190 declared function arguments. Arguments type that can't be resolved
6191 are left as they are, but the returned node is marked as containing
6192 incomplete types. */
6195 method_declarator (id
, list
)
6198 tree arg_types
= NULL_TREE
, current
, node
;
6199 tree meth
= make_node (FUNCTION_TYPE
);
6202 patch_stage
= JDEP_NO_PATCH
;
6204 for (current
= list
; current
; current
= TREE_CHAIN (current
))
6207 tree wfl_name
= TREE_PURPOSE (current
);
6208 tree type
= TREE_VALUE (current
);
6209 tree name
= EXPR_WFL_NODE (wfl_name
);
6210 tree already
, arg_node
;
6211 tree type_wfl
= NULL_TREE
;
6214 /* Obtain a suitable type for resolution, if necessary */
6215 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
6217 /* Process NAME, as it may specify extra dimension(s) for it */
6218 type
= build_array_from_name (type
, type_wfl
, name
, &name
);
6219 EXPR_WFL_NODE (wfl_name
) = name
;
6221 real_type
= GET_REAL_TYPE (type
);
6222 if (TREE_CODE (real_type
) == RECORD_TYPE
)
6224 real_type
= promote_type (real_type
);
6225 if (TREE_CODE (type
) == TREE_LIST
)
6226 TREE_PURPOSE (type
) = real_type
;
6229 /* Check redefinition */
6230 for (already
= arg_types
; already
; already
= TREE_CHAIN (already
))
6231 if (TREE_PURPOSE (already
) == name
)
6234 (wfl_name
, "Variable `%s' is used more than once in the "
6235 "argument list of method `%s'", IDENTIFIER_POINTER (name
),
6236 IDENTIFIER_POINTER (EXPR_WFL_NODE (id
)));
6240 /* If we've an incomplete argument type, we know there is a location
6241 to patch when the type get resolved, later. */
6245 patch_stage
= JDEP_METHOD
;
6246 type
= register_incomplete_type (patch_stage
,
6247 type_wfl
, wfl_name
, type
);
6248 jdep
= CLASSD_LAST (ctxp
->classd_list
);
6249 JDEP_MISC (jdep
) = id
;
6252 /* The argument node: a name and a (possibly) incomplete type */
6253 arg_node
= build_tree_list (name
, real_type
);
6255 JDEP_GET_PATCH (jdep
) = &TREE_VALUE (arg_node
);
6256 TREE_CHAIN (arg_node
) = arg_types
;
6257 arg_types
= arg_node
;
6259 TYPE_ARG_TYPES (meth
) = chainon (nreverse (arg_types
), end_params_node
);
6260 node
= build_tree_list (id
, meth
);
6265 unresolved_type_p (wfl
, returned
)
6270 if (TREE_CODE (wfl
) == EXPR_WITH_FILE_LOCATION
)
6272 tree decl
= IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl
));
6274 *returned
= (decl
? TREE_TYPE (decl
) : NULL_TREE
);
6282 /* From NAME, build a qualified identifier node using the
6283 qualification from the current package definition. */
6286 parser_qualified_classname (name
)
6290 return merge_qualified_name (ctxp
->package
, EXPR_WFL_NODE (name
));
6292 return EXPR_WFL_NODE (name
);
6295 /* Called once the type a interface extends is resolved. Returns 0 if
6296 everything is OK. */
6299 parser_check_super_interface (super_decl
, this_decl
, this_wfl
)
6300 tree super_decl
, this_decl
, this_wfl
;
6302 tree super_type
= TREE_TYPE (super_decl
);
6304 /* Has to be an interface */
6305 if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl
))))
6308 (this_wfl
, "Can't use %s `%s' to implement/extend %s `%s'",
6309 (TYPE_ARRAY_P (super_type
) ? "array" : "class"),
6310 IDENTIFIER_POINTER (DECL_NAME (super_decl
)),
6311 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl
))) ?
6312 "interface" : "class"),
6313 IDENTIFIER_POINTER (DECL_NAME (this_decl
)));
6317 /* Check scope: same package OK, other package: OK if public */
6318 if (check_pkg_class_access (DECL_NAME (super_decl
), lookup_cl (this_decl
)))
6321 SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
6322 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6323 IDENTIFIER_POINTER (DECL_NAME (super_decl
))));
6327 /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
6328 0 if everthing is OK. */
6331 parser_check_super (super_decl
, this_decl
, wfl
)
6332 tree super_decl
, this_decl
, wfl
;
6334 tree super_type
= TREE_TYPE (super_decl
);
6336 /* SUPER should be a CLASS (neither an array nor an interface) */
6337 if (TYPE_ARRAY_P (super_type
) || CLASS_INTERFACE (TYPE_NAME (super_type
)))
6340 (wfl
, "Class `%s' can't subclass %s `%s'",
6341 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6342 (CLASS_INTERFACE (TYPE_NAME (super_type
)) ? "interface" : "array"),
6343 IDENTIFIER_POINTER (DECL_NAME (super_decl
)));
6347 if (CLASS_FINAL (TYPE_NAME (super_type
)))
6349 parse_error_context (wfl
, "Can't subclass final classes: %s",
6350 IDENTIFIER_POINTER (DECL_NAME (super_decl
)));
6354 /* Check scope: same package OK, other package: OK if public */
6355 if (check_pkg_class_access (DECL_NAME (super_decl
), wfl
))
6358 SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
6359 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6360 IDENTIFIER_POINTER (DECL_NAME (super_decl
))));
6364 /* Create a new dependency list and link it (in a LIFO manner) to the
6365 CTXP list of type dependency list. */
6368 create_jdep_list (ctxp
)
6369 struct parser_ctxt
*ctxp
;
6371 jdeplist
*new = (jdeplist
*)xmalloc (sizeof (jdeplist
));
6372 new->first
= new->last
= NULL
;
6373 new->next
= ctxp
->classd_list
;
6374 ctxp
->classd_list
= new;
6378 reverse_jdep_list (ctxp
)
6379 struct parser_ctxt
*ctxp
;
6381 register jdeplist
*prev
= NULL
, *current
, *next
;
6382 for (current
= ctxp
->classd_list
; current
; current
= next
)
6384 next
= current
->next
;
6385 current
->next
= prev
;
6391 /* Create a fake pointer based on the ID stored in
6392 TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
6393 registered again. */
6396 obtain_incomplete_type (type_name
)
6401 if (TREE_CODE (type_name
) == EXPR_WITH_FILE_LOCATION
)
6402 name
= EXPR_WFL_NODE (type_name
);
6403 else if (INCOMPLETE_TYPE_P (type_name
))
6404 name
= TYPE_NAME (type_name
);
6406 fatal ("invalid type name - obtain_incomplete_type");
6408 for (ptr
= ctxp
->incomplete_class
; ptr
; ptr
= TREE_CHAIN (ptr
))
6409 if (TYPE_NAME (TREE_PURPOSE (ptr
)) == name
)
6415 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6416 BUILD_PTR_FROM_NAME (core
, name
);
6418 ptr
= build_tree_list (core
, NULL_TREE
);
6420 TREE_CHAIN (ptr
) = ctxp
->incomplete_class
;
6421 ctxp
->incomplete_class
= ptr
;
6427 /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
6428 non NULL instead of computing a new fake type based on WFL. The new
6429 dependency is inserted in the current type dependency list, in FIFO
6433 register_incomplete_type (kind
, wfl
, decl
, ptr
)
6435 tree wfl
, decl
, ptr
;
6437 jdep
*new = (jdep
*)xmalloc (sizeof (jdep
));
6439 if (!ptr
&& kind
!= JDEP_METHOD_END
) /* JDEP_METHOD_END is a mere marker */
6440 ptr
= obtain_incomplete_type (wfl
);
6442 JDEP_KIND (new) = kind
;
6443 JDEP_DECL (new) = decl
;
6444 JDEP_SOLV (new) = ptr
;
6445 JDEP_WFL (new) = wfl
;
6446 JDEP_CHAIN (new) = NULL
;
6447 JDEP_MISC (new) = NULL_TREE
;
6448 JDEP_GET_PATCH (new) = (tree
*)NULL
;
6450 JDEP_INSERT (ctxp
->classd_list
, new);
6456 java_check_circular_reference ()
6459 for (current
= ctxp
->class_list
; current
; current
= TREE_CHAIN (current
))
6461 tree type
= TREE_TYPE (current
);
6462 if (CLASS_INTERFACE (TYPE_NAME (type
)))
6464 /* Check all interfaces this class extends */
6465 tree basetype_vec
= TYPE_BINFO_BASETYPES (type
);
6470 n
= TREE_VEC_LENGTH (basetype_vec
);
6471 for (i
= 0; i
< n
; i
++)
6473 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
);
6474 if (vec_elt
&& BINFO_TYPE (vec_elt
) != object_type_node
6475 && interface_of_p (type
, BINFO_TYPE (vec_elt
)))
6476 parse_error_context (lookup_cl (current
),
6477 "Cyclic interface inheritance");
6481 if (inherits_from_p (CLASSTYPE_SUPER (type
), type
))
6482 parse_error_context (lookup_cl (current
),
6483 "Cyclic class inheritance");
6487 /* safe_layout_class just makes sure that we can load a class without
6488 disrupting the current_class, input_file, lineno, etc, information
6489 about the class processed currently. */
6492 safe_layout_class (class)
6495 tree save_current_class
= current_class
;
6496 char *save_input_filename
= input_filename
;
6497 int save_lineno
= lineno
;
6499 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6501 layout_class (class);
6504 current_class
= save_current_class
;
6505 input_filename
= save_input_filename
;
6506 lineno
= save_lineno
;
6507 CLASS_LOADED_P (class) = 1;
6511 jdep_resolve_class (dep
)
6516 if (JDEP_RESOLVED_P (dep
))
6517 decl
= JDEP_RESOLVED_DECL (dep
);
6520 decl
= resolve_class (JDEP_TO_RESOLVE (dep
),
6521 JDEP_DECL (dep
), JDEP_WFL (dep
));
6522 JDEP_RESOLVED (dep
, decl
);
6526 complete_class_report_errors (dep
);
6531 /* Complete unsatisfied class declaration and their dependencies */
6534 java_complete_class ()
6541 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6543 /* Process imports and reverse the import on demand list */
6545 if (ctxp
->import_demand_list
)
6546 ctxp
->import_demand_list
= nreverse (ctxp
->import_demand_list
);
6548 /* Rever things so we have the right order */
6549 ctxp
->class_list
= nreverse (ctxp
->class_list
);
6550 ctxp
->classd_list
= reverse_jdep_list (ctxp
);
6552 for (cclassd
= ctxp
->classd_list
, cclass
= ctxp
->class_list
;
6554 cclass
= TREE_CHAIN (cclass
), cclassd
= CLASSD_CHAIN (cclassd
))
6557 for (dep
= CLASSD_FIRST (cclassd
); dep
; dep
= JDEP_CHAIN (dep
))
6560 if (!(decl
= jdep_resolve_class (dep
)))
6563 /* Now it's time to patch */
6564 switch (JDEP_KIND (dep
))
6567 /* Simply patch super */
6568 if (parser_check_super (decl
, JDEP_DECL (dep
), JDEP_WFL (dep
)))
6570 BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
6571 (TREE_TYPE (JDEP_DECL (dep
)))), 0)) = TREE_TYPE (decl
);
6576 /* We do part of the job done in add_field */
6577 tree field_decl
= JDEP_DECL (dep
);
6578 tree field_type
= TREE_TYPE (decl
);
6579 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6580 if (TREE_CODE (field_type
) == RECORD_TYPE
)
6581 field_type
= promote_type (field_type
);
6583 TREE_TYPE (field_decl
) = field_type
;
6584 DECL_ALIGN (field_decl
) = 0;
6585 layout_decl (field_decl
, 0);
6586 SOURCE_FRONTEND_DEBUG
6587 (("Completed field/var decl `%s' with `%s'",
6588 IDENTIFIER_POINTER (DECL_NAME (field_decl
)),
6589 IDENTIFIER_POINTER (DECL_NAME (decl
))));
6592 case JDEP_METHOD
: /* We start patching a method */
6593 case JDEP_METHOD_RETURN
:
6599 type
= TREE_TYPE(decl
);
6600 if (TREE_CODE (type
) == RECORD_TYPE
)
6601 type
= promote_type (type
);
6602 JDEP_APPLY_PATCH (dep
, type
);
6603 SOURCE_FRONTEND_DEBUG
6604 (((JDEP_KIND (dep
) == JDEP_METHOD_RETURN
?
6605 "Completing fct `%s' with ret type `%s'":
6606 "Completing arg `%s' with type `%s'"),
6607 IDENTIFIER_POINTER (EXPR_WFL_NODE
6608 (JDEP_DECL_WFL (dep
))),
6609 IDENTIFIER_POINTER (DECL_NAME (decl
))));
6613 dep
= JDEP_CHAIN (dep
);
6614 if (JDEP_KIND (dep
) == JDEP_METHOD_END
)
6617 decl
= jdep_resolve_class (dep
);
6621 tree mdecl
= JDEP_DECL (dep
), signature
;
6622 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6623 /* Recompute and reset the signature */
6624 signature
= build_java_signature (TREE_TYPE (mdecl
));
6625 set_java_signature (TREE_TYPE (mdecl
), signature
);
6632 case JDEP_INTERFACE
:
6633 if (parser_check_super_interface (decl
, JDEP_DECL (dep
),
6636 parser_add_interface (JDEP_DECL (dep
), decl
, JDEP_WFL (dep
));
6641 type
= TREE_TYPE(decl
);
6642 if (TREE_CODE (type
) == RECORD_TYPE
)
6643 type
= promote_type (type
);
6644 JDEP_APPLY_PATCH (dep
, type
);
6648 JDEP_APPLY_PATCH (dep
, TREE_TYPE (decl
));
6649 SOURCE_FRONTEND_DEBUG
6650 (("Completing a random type dependency on a '%s' node",
6651 tree_code_name
[TREE_CODE (JDEP_DECL (dep
))]));
6654 case JDEP_EXCEPTION
:
6655 JDEP_APPLY_PATCH (dep
, TREE_TYPE (decl
));
6656 SOURCE_FRONTEND_DEBUG
6657 (("Completing `%s' `throws' argument node",
6658 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
)))));
6662 fatal ("Can't handle patch code %d - java_complete_class",
6671 /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
6675 resolve_class (class_type
, decl
, cl
)
6676 tree class_type
, decl
, cl
;
6678 char *name
= IDENTIFIER_POINTER (TYPE_NAME (class_type
));
6680 tree resolved_type
, resolved_type_decl
;
6682 /* 1- Check to see if we have an array. If true, find what we really
6684 while (name
[0] == '[')
6687 TYPE_NAME (class_type
) = get_identifier (name
);
6689 /* 2- Resolve the bare type */
6690 if (!(resolved_type_decl
= do_resolve_class (class_type
, decl
, cl
)))
6692 resolved_type
= TREE_TYPE (resolved_type_decl
);
6694 /* 3- If we have and array, reconstruct the array down to its nesting */
6697 while (base
!= name
)
6699 if (TREE_CODE (resolved_type
) == RECORD_TYPE
)
6700 resolved_type
= promote_type (resolved_type
);
6701 resolved_type
= build_java_array_type (resolved_type
, -1);
6702 CLASS_LOADED_P (resolved_type
) = 1;
6705 /* Build a fake decl for this, since this is what is expected to
6707 resolved_type_decl
=
6708 build_decl (TYPE_DECL
, TYPE_NAME (resolved_type
), resolved_type
);
6709 /* Figure how those two things are important for error report. FIXME */
6710 DECL_SOURCE_LINE (resolved_type_decl
) = 0;
6711 DECL_SOURCE_FILE (resolved_type_decl
) = input_filename
;
6713 return resolved_type_decl
;
6716 /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
6717 are used to report error messages. */
6720 do_resolve_class (class_type
, decl
, cl
)
6725 tree new_class_decl
;
6726 tree original_name
= NULL_TREE
;
6728 /* Do not try to replace TYPE_NAME (class_type) by a variable, since
6729 its is changed by find_in_imports{_on_demand} */
6731 /* 1- Check for the type in single imports */
6732 if (find_in_imports (class_type
))
6735 /* 2- And check for the type in the current compilation unit. If it fails,
6736 try with a name qualified with the package name if appropriate. */
6737 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6739 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6740 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6741 load_class (TYPE_NAME (class_type
), 0);
6742 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6745 original_name
= TYPE_NAME (class_type
);
6746 if (!QUALIFIED_P (TYPE_NAME (class_type
)) && ctxp
->package
)
6747 TYPE_NAME (class_type
) = merge_qualified_name (ctxp
->package
,
6748 TYPE_NAME (class_type
));
6749 if (!(new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6750 load_class (TYPE_NAME (class_type
), 0);
6751 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6753 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6754 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6755 load_class (TYPE_NAME (class_type
), 0);
6756 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6758 TYPE_NAME (class_type
) = original_name
;
6760 /* 3- Check an other compilation unit that bears the name of type */
6761 load_class (TYPE_NAME (class_type
), 0);
6762 if (check_pkg_class_access (TYPE_NAME (class_type
),
6763 (cl
? cl
: lookup_cl (decl
))))
6766 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6767 return new_class_decl
;
6769 /* 4- Check the import on demands. Don't allow bar.baz to be
6770 imported from foo.* */
6771 if (!QUALIFIED_P (TYPE_NAME (class_type
)))
6772 if (find_in_imports_on_demand (class_type
))
6775 /* 5- Last call for a resolution */
6776 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6779 /* Resolve NAME and lay it out (if not done and if not the current
6780 parsed class). Return a decl node. This function is meant to be
6781 called when type resolution is necessary during the walk pass. */
6784 resolve_and_layout (something
, cl
)
6790 /* Don't do that on the current class */
6791 if (something
== current_class
)
6792 return TYPE_NAME (current_class
);
6794 /* Don't do anything for void and other primitive types */
6795 if (JPRIMITIVE_TYPE_P (something
) || something
== void_type_node
)
6798 /* Pointer types can be reall pointer types or fake pointers. When
6799 finding a real pointer, recheck for primitive types */
6800 if (TREE_CODE (something
) == POINTER_TYPE
)
6802 if (TREE_TYPE (something
))
6804 something
= TREE_TYPE (something
);
6805 if (JPRIMITIVE_TYPE_P (something
) || something
== void_type_node
)
6809 something
= TYPE_NAME (something
);
6812 /* Don't do anything for arrays of primitive types */
6813 if (TREE_CODE (something
) == RECORD_TYPE
&& TYPE_ARRAY_P (something
)
6814 && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something
)))
6817 /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
6819 if (TREE_CODE (something
) != IDENTIFIER_NODE
)
6820 something
= (TREE_CODE (TYPE_NAME (something
)) == TYPE_DECL
?
6821 DECL_NAME (TYPE_NAME (something
)) : TYPE_NAME (something
));
6823 if (!(decl
= resolve_no_layout (something
, cl
)))
6826 /* Resolve and layout if necessary */
6827 layout_class_methods (TREE_TYPE (decl
));
6828 if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl
)))
6829 CHECK_METHODS (decl
);
6830 if (TREE_TYPE (decl
) != current_class
&& !CLASS_LOADED_P (TREE_TYPE (decl
)))
6831 safe_layout_class (TREE_TYPE (decl
));
6836 /* Resolve a class, returns its decl but doesn't perform any
6837 layout. The current parsing context is saved and restored */
6840 resolve_no_layout (name
, cl
)
6844 BUILD_PTR_FROM_NAME (ptr
, name
);
6845 java_parser_context_save_global ();
6846 decl
= resolve_class (ptr
, NULL_TREE
, cl
);
6847 java_parser_context_restore_global ();
6852 /* Called when reporting errors. Skip leader '[' in a complex array
6853 type description that failed to be resolved. */
6856 purify_type_name (name
)
6859 while (*name
&& *name
== '[')
6864 /* The type CURRENT refers to can't be found. We print error messages. */
6867 complete_class_report_errors (dep
)
6872 if (!JDEP_WFL (dep
))
6875 name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
)));
6876 switch (JDEP_KIND (dep
))
6880 (JDEP_WFL (dep
), "Superclass `%s' of class `%s' not found",
6881 purify_type_name (name
),
6882 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
6886 (JDEP_WFL (dep
), "Type `%s' not found in declaration of field `%s'",
6887 purify_type_name (name
),
6888 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
6890 case JDEP_METHOD
: /* Covers arguments */
6892 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
6893 "argument `%s' of method `%s'",
6894 purify_type_name (name
),
6895 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep
))),
6896 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep
))));
6898 case JDEP_METHOD_RETURN
: /* Covers return type */
6900 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
6901 "return type of method `%s'",
6902 purify_type_name (name
),
6903 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep
))));
6905 case JDEP_INTERFACE
:
6907 (JDEP_WFL (dep
), "Superinterface `%s' of %s `%s' not found",
6908 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
))),
6909 (CLASS_OR_INTERFACE (JDEP_DECL (dep
), "class", "interface")),
6910 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
6914 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
6915 "local variable `%s'",
6916 purify_type_name (IDENTIFIER_POINTER
6917 (EXPR_WFL_NODE (JDEP_WFL (dep
)))),
6918 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
6920 case JDEP_EXCEPTION
: /* As specified by `throws' */
6922 (JDEP_WFL (dep
), "Class `%s' not found in `throws'",
6923 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
))));
6926 /* Fix for -Wall. Just break doing nothing. The error will be
6932 /* Check uninitialized final. */
6939 /* Return a static string containing the DECL prototype string. If
6940 DECL is a constructor, use the class name instead of the form
6944 get_printable_method_name (decl
)
6950 if (DECL_CONSTRUCTOR_P (decl
))
6952 name
= DECL_NAME (decl
);
6953 DECL_NAME (decl
) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl
)));
6956 to_return
= lang_printable_name (decl
, 0);
6957 if (DECL_CONSTRUCTOR_P (decl
))
6958 DECL_NAME (decl
) = name
;
6963 /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
6964 nevertheless needs to be verfied, 1 otherwise. */
6967 reset_method_name (method
)
6970 if (DECL_NAME (method
) != clinit_identifier_node
6971 && DECL_NAME (method
) != finit_identifier_node
)
6973 /* NAME is just the plain name when Object is being defined */
6974 if (DECL_CONTEXT (method
) != object_type_node
)
6975 DECL_NAME (method
) = (DECL_CONSTRUCTOR_P (method
) ?
6976 init_identifier_node
: GET_METHOD_NAME (method
));
6983 /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
6986 java_get_real_method_name (method_decl
)
6989 tree method_name
= DECL_NAME (method_decl
);
6990 if (DECL_CONSTRUCTOR_P (method_decl
))
6991 return init_identifier_node
;
6993 /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
6994 and still can be a constructor. FIXME */
6996 /* Don't confuse method only bearing the name of their class as
6998 else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl
))
7000 && ctxp
->current_parsed_class_un
== EXPR_WFL_NODE (method_name
)
7001 && get_access_flags_from_decl (method_decl
) <= ACC_PROTECTED
7002 && TREE_TYPE (TREE_TYPE (method_decl
)) == void_type_node
)
7003 return init_identifier_node
;
7005 return EXPR_WFL_NODE (method_name
);
7008 /* Track method being redefined inside the same class. As a side
7009 effect, set DECL_NAME to an IDENTIFIER (prior entering this
7010 function it's a FWL, so we can track errors more accurately */
7013 check_method_redefinition (class, method
)
7017 tree cl
= DECL_NAME (method
);
7018 tree sig
= TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method
));
7019 /* decl name of artificial <clinit> and $finit$ doesn't need to be fixed and
7022 /* Reset the method name before running the check. If it returns 1,
7023 the method doesn't need to be verified with respect to method
7024 redeclaration and we return 0 */
7025 if (reset_method_name (method
))
7028 name
= DECL_NAME (method
);
7029 for (redef
= TYPE_METHODS (class); redef
; redef
= TREE_CHAIN (redef
))
7031 if (redef
== method
)
7033 if (DECL_NAME (redef
) == name
7034 && sig
== TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef
)))
7037 (cl
, "Duplicate %s declaration `%s'",
7038 (DECL_CONSTRUCTOR_P (redef
) ? "constructor" : "method"),
7039 get_printable_method_name (redef
));
7046 /* Check all the methods of CLASS. Methods are first completed then
7047 checked according to regular method existance rules.
7048 If no constructor were encountered, then build its declaration. */
7051 java_check_regular_methods (class_decl
)
7054 int saw_constructor
= 0;
7056 tree
class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl
));
7057 tree super_class
= CLASSTYPE_SUPER (class);
7058 tree saved_found_wfl
= NULL_TREE
, found
= NULL_TREE
;
7061 /* It is not necessary to check methods defined in java.lang.Object */
7062 if (class == object_type_node
)
7065 if (!TYPE_NVIRTUALS (class))
7066 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7068 /* Should take interfaces into account. FIXME */
7069 for (method
= TYPE_METHODS (class); method
; method
= TREE_CHAIN (method
))
7072 tree method_wfl
= DECL_NAME (method
);
7075 /* If we previously found something and its name was saved,
7077 if (found
&& saved_found_wfl
)
7078 DECL_NAME (found
) = saved_found_wfl
;
7080 /* Check for redefinitions */
7081 if (check_method_redefinition (class, method
))
7084 /* If we see one constructor a mark so we don't generate the
7085 default one. Also skip other verifications: constructors
7086 can't be inherited hence hiden or overriden */
7087 if (DECL_CONSTRUCTOR_P (method
))
7089 saw_constructor
= 1;
7093 /* We verify things thrown by the method. They must inherits from
7094 java.lang.Throwable */
7095 for (mthrows
= DECL_FUNCTION_THROWS (method
);
7096 mthrows
; mthrows
= TREE_CHAIN (mthrows
))
7098 if (!inherits_from_p (TREE_VALUE (mthrows
), throwable_type_node
))
7100 (TREE_PURPOSE (mthrows
), "Class `%s' in `throws' clause must be "
7101 "a subclass of class `java.lang.Throwable'",
7103 (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows
)))));
7106 sig
= build_java_argument_signature (TREE_TYPE (method
));
7107 found
= lookup_argument_method (super_class
, DECL_NAME (method
), sig
);
7109 /* Nothing overrides or it's a private method. */
7110 if (!found
|| (found
&& METHOD_PRIVATE (found
)))
7113 /* If found wasn't verified, it's DECL_NAME won't be set properly.
7114 We set it temporarily for the sake of the error report. */
7115 saved_found_wfl
= DECL_NAME (found
);
7116 reset_method_name (found
);
7118 /* Can't override a method with the same name and different return
7120 if (TREE_TYPE (TREE_TYPE (found
)) != TREE_TYPE (TREE_TYPE (method
)))
7122 char *t
= strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found
)),
7126 "Method `%s' was defined with return type `%s' in class `%s'",
7127 lang_printable_name (found
, 0), t
,
7129 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7133 /* Can't override final. Can't override static. */
7134 if (METHOD_FINAL (found
) || METHOD_STATIC (found
))
7136 /* Static *can* override static */
7137 if (METHOD_STATIC (found
) && METHOD_STATIC (method
))
7141 "%s methods can't be overriden. Method `%s' is %s in class `%s'",
7142 (METHOD_FINAL (found
) ? "Final" : "Static"),
7143 lang_printable_name (found
, 0),
7144 (METHOD_FINAL (found
) ? "final" : "static"),
7146 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7149 /* Static method can't override instance method. */
7150 if (METHOD_STATIC (method
))
7154 "Instance methods can't be overriden by a static method. Method "
7155 "`%s' is an instance method in class `%s'",
7156 lang_printable_name (found
, 0),
7158 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7162 aflags
= get_access_flags_from_decl (found
);
7163 /* - Overriding/hiding public must be public
7164 - Overriding/hiding protected must be protected or public
7165 - If the overriden or hidden method has default (package)
7166 access, then the overriding or hiding method must not be
7167 private; otherwise, a compile-time error occurs */
7168 if ((METHOD_PUBLIC (found
) && !METHOD_PUBLIC (method
))
7169 || (METHOD_PROTECTED (found
)
7170 && !(METHOD_PUBLIC (method
) || METHOD_PROTECTED (method
)))
7171 || (!(aflags
& (ACC_PUBLIC
| ACC_PRIVATE
| ACC_STATIC
))
7172 && METHOD_PRIVATE (method
)))
7176 "Methods can't be overridden to be more private. Method `%s' is "
7177 "not %s in class `%s'", lang_printable_name (method
, 0),
7178 (METHOD_PUBLIC (method
) ? "public" :
7179 (METHOD_PRIVATE (method
) ? "private" : "protected")),
7180 IDENTIFIER_POINTER (DECL_NAME
7181 (TYPE_NAME (DECL_CONTEXT (found
)))));
7185 /* Overriding methods must have compatible `throws' clauses on checked
7186 exceptions, if any */
7187 check_throws_clauses (method
, method_wfl
, found
);
7189 /* If the method has default access in an other package, then
7190 issue a warning that the current method doesn't override the
7191 one that was found elsewhere. Do not issue this warning when
7192 the match was found in java.lang.Object. */
7193 if (DECL_CONTEXT (found
) != object_type_node
7194 && (!aflags
|| (aflags
> ACC_PROTECTED
))
7195 && !class_in_current_package (DECL_CONTEXT (found
))
7196 && flag_not_overriding
)
7197 parse_warning_context
7198 (method_wfl
, "Method `%s' in class `%s' does not "
7199 "override the corresponding method in class `%s', which is "
7200 "private to a different package",
7201 lang_printable_name (found
, 0),
7202 IDENTIFIER_POINTER (DECL_NAME (class_decl
)),
7203 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7205 /* Inheriting multiple methods with the same signature. FIXME */
7208 /* Don't forget eventual pending found and saved_found_wfl. Take
7209 into account that we might have exited because we saw an
7210 aritifical method as the last entry. */
7212 if (found
&& !DECL_ARTIFICIAL (found
) && saved_found_wfl
)
7213 DECL_NAME (found
) = saved_found_wfl
;
7215 if (!TYPE_NVIRTUALS (class))
7216 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7218 if (!saw_constructor
)
7220 /* No constructor seen, we craft one, at line 0. Since this
7221 operation takes place after we laid methods out
7222 (layout_class_methods), we prepare the its DECL
7227 /* If the class is declared PUBLIC, the default constructor is
7228 PUBLIC otherwise it has default access implied by no access
7230 flags
= (get_access_flags_from_decl (class_decl
) & ACC_PUBLIC
?
7232 decl
= create_artificial_method (class, flags
, void_type_node
,
7233 init_identifier_node
, end_params_node
);
7234 DECL_CONSTRUCTOR_P (decl
) = 1;
7235 layout_class_method (TREE_TYPE (class_decl
), NULL_TREE
, decl
, NULL_TREE
);
7239 /* Return a non zero value if the `throws' clause of METHOD (if any)
7240 is incompatible with the `throws' clause of FOUND (if any). */
7243 check_throws_clauses (method
, method_wfl
, found
)
7244 tree method
, method_wfl
, found
;
7246 tree mthrows
, fthrows
;
7248 /* Can't check these things with class loaded from bytecode. FIXME */
7249 if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found
)))
7252 for (mthrows
= DECL_FUNCTION_THROWS (method
);
7253 mthrows
; mthrows
= TREE_CHAIN (mthrows
))
7255 /* We don't verify unchecked expressions */
7256 if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows
)))
7258 /* Checked expression must be compatible */
7259 for (fthrows
= DECL_FUNCTION_THROWS (found
);
7260 fthrows
; fthrows
= TREE_CHAIN (fthrows
))
7261 if (inherits_from_p (TREE_VALUE (mthrows
), TREE_VALUE (fthrows
)))
7266 (method_wfl
, "Invalid checked exception class `%s' in "
7267 "`throws' clause. The exception must be a subclass of an "
7268 "exception thrown by `%s' from class `%s'",
7269 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows
)))),
7270 lang_printable_name (found
, 0),
7272 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7277 /* Check abstract method of interface INTERFACE */
7280 java_check_abstract_methods (interface_decl
)
7281 tree interface_decl
;
7284 tree method
, basetype_vec
, found
;
7285 tree interface
= TREE_TYPE (interface_decl
);
7287 for (method
= TYPE_METHODS (interface
); method
; method
= TREE_CHAIN (method
))
7289 tree method_wfl
= DECL_NAME (method
);
7291 /* 2- Check for double definition inside the defining interface */
7292 if (check_method_redefinition (interface
, method
))
7295 /* 3- Overriding is OK as far as we preserve the return type and
7296 the thrown exceptions (FIXME) */
7297 found
= lookup_java_interface_method2 (interface
, method
);
7301 tree saved_found_wfl
= DECL_NAME (found
);
7302 reset_method_name (found
);
7303 t
= strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found
)), 0));
7306 "Method `%s' was defined with return type `%s' in class `%s'",
7307 lang_printable_name (found
, 0), t
,
7309 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7313 DECL_NAME (found
) = saved_found_wfl
;
7317 /* 4- Inherited methods can't differ by their returned types */
7318 if (!(basetype_vec
= TYPE_BINFO_BASETYPES (interface
)))
7320 n
= TREE_VEC_LENGTH (basetype_vec
);
7321 for (i
= 0; i
< n
; i
++)
7323 tree sub_interface_method
, sub_interface
;
7324 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
);
7327 sub_interface
= BINFO_TYPE (vec_elt
);
7328 for (sub_interface_method
= TYPE_METHODS (sub_interface
);
7329 sub_interface_method
;
7330 sub_interface_method
= TREE_CHAIN (sub_interface_method
))
7332 found
= lookup_java_interface_method2 (interface
,
7333 sub_interface_method
);
7334 if (found
&& (found
!= sub_interface_method
))
7336 tree saved_found_wfl
= DECL_NAME (found
);
7337 reset_method_name (found
);
7339 (lookup_cl (sub_interface_method
),
7340 "Interface `%s' inherits method `%s' from interface `%s'. "
7341 "This method is redefined with a different return type in "
7343 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface
))),
7344 lang_printable_name (found
, 0),
7346 (DECL_NAME (TYPE_NAME
7347 (DECL_CONTEXT (sub_interface_method
)))),
7349 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7350 DECL_NAME (found
) = saved_found_wfl
;
7356 /* Lookup methods in interfaces using their name and partial
7357 signature. Return a matching method only if their types differ. */
7360 lookup_java_interface_method2 (class, method_decl
)
7361 tree
class, method_decl
;
7364 tree basetype_vec
= TYPE_BINFO_BASETYPES (class), to_return
;
7369 n
= TREE_VEC_LENGTH (basetype_vec
);
7370 for (i
= 0; i
< n
; i
++)
7372 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
), to_return
;
7373 if ((BINFO_TYPE (vec_elt
) != object_type_node
)
7375 lookup_java_method2 (BINFO_TYPE (vec_elt
), method_decl
, 1)))
7378 for (i
= 0; i
< n
; i
++)
7380 to_return
= lookup_java_interface_method2
7381 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec
, i
)), method_decl
);
7389 /* Lookup method using their name and partial signature. Return a
7390 matching method only if their types differ. */
7393 lookup_java_method2 (clas
, method_decl
, do_interface
)
7394 tree clas
, method_decl
;
7397 tree method
, method_signature
, method_name
, method_type
, name
;
7399 method_signature
= build_java_argument_signature (TREE_TYPE (method_decl
));
7400 name
= DECL_NAME (method_decl
);
7401 method_name
= (TREE_CODE (name
) == EXPR_WITH_FILE_LOCATION
?
7402 EXPR_WFL_NODE (name
) : name
);
7403 method_type
= TREE_TYPE (TREE_TYPE (method_decl
));
7405 while (clas
!= NULL_TREE
)
7407 for (method
= TYPE_METHODS (clas
);
7408 method
!= NULL_TREE
; method
= TREE_CHAIN (method
))
7410 tree method_sig
= build_java_argument_signature (TREE_TYPE (method
));
7411 tree name
= DECL_NAME (method
);
7412 if ((TREE_CODE (name
) == EXPR_WITH_FILE_LOCATION
?
7413 EXPR_WFL_NODE (name
) : name
) == method_name
7414 && method_sig
== method_signature
7415 && TREE_TYPE (TREE_TYPE (method
)) != method_type
)
7418 clas
= (do_interface
? NULL_TREE
: CLASSTYPE_SUPER (clas
));
7423 /* Return the line that matches DECL line number. Used during error
7430 static tree cl
= NULL_TREE
;
7435 if (cl
== NULL_TREE
)
7436 cl
= build_expr_wfl (NULL_TREE
, NULL
, 0, 0);
7438 EXPR_WFL_FILENAME_NODE (cl
) = get_identifier (DECL_SOURCE_FILE (decl
));
7439 EXPR_WFL_SET_LINECOL (cl
, DECL_SOURCE_LINE_FIRST (decl
), -1);
7444 /* Look for a simple name in the single-type import list */
7447 find_name_in_single_imports (name
)
7452 for (node
= ctxp
->import_list
; node
; node
= TREE_CHAIN (node
))
7453 if (TREE_VALUE (node
) == name
)
7454 return (EXPR_WFL_NODE (TREE_PURPOSE (node
)));
7459 /* Process all single-type import. */
7467 for (import
= ctxp
->import_list
; import
; import
= TREE_CHAIN (import
))
7469 tree to_be_found
= EXPR_WFL_NODE (TREE_PURPOSE (import
));
7471 /* Don't load twice something already defined. */
7472 if (IDENTIFIER_CLASS_VALUE (to_be_found
))
7474 QUALIFIED_P (to_be_found
) = 1;
7475 load_class (to_be_found
, 0);
7477 check_pkg_class_access (to_be_found
, TREE_PURPOSE (import
));
7478 if (!IDENTIFIER_CLASS_VALUE (to_be_found
))
7480 parse_error_context (TREE_PURPOSE (import
),
7481 "Class or interface `%s' not found in import",
7482 IDENTIFIER_POINTER (to_be_found
));
7491 /* Possibly find a class imported by a single-type import statement. Return
7492 1 if an error occured, 0 otherwise. */
7495 find_in_imports (class_type
)
7500 for (import
= ctxp
->import_list
; import
; import
= TREE_CHAIN (import
))
7501 if (TREE_VALUE (import
) == TYPE_NAME (class_type
))
7503 TYPE_NAME (class_type
) = EXPR_WFL_NODE (TREE_PURPOSE (import
));
7504 QUALIFIED_P (TYPE_NAME (class_type
)) = 1;
7510 note_possible_classname (name
, len
)
7515 if (len
> 5 && strncmp (&name
[len
-5], ".java", 5) == 0)
7517 else if (len
> 6 && strncmp (&name
[len
-6], ".class", 6) == 0)
7521 node
= ident_subst (name
, len
, "", '/', '.', "");
7522 IS_A_CLASSFILE_NAME (node
) = 1; /* Or soon to be */
7523 QUALIFIED_P (node
) = 1; /* As soon as we turn / into . */
7527 /* Read a import directory, gathering potential match for further type
7528 references. Indifferently reads a filesystem or a ZIP archive
7532 read_import_dir (wfl
)
7535 tree package_id
= EXPR_WFL_NODE (wfl
);
7536 char *package_name
= IDENTIFIER_POINTER (package_id
);
7537 int package_length
= IDENTIFIER_LENGTH (package_id
);
7539 JCF jcfr
, *jcf
, *saved_jcf
= current_jcf
;
7544 struct buffer filename
[1];
7547 if (IS_AN_IMPORT_ON_DEMAND_P (package_id
))
7549 IS_AN_IMPORT_ON_DEMAND_P (package_id
) = 1;
7551 BUFFER_INIT (filename
);
7552 buffer_grow (filename
, package_length
+ 100);
7554 for (entry
= jcf_path_start (); entry
!= NULL
; entry
= jcf_path_next (entry
))
7556 char *entry_name
= jcf_path_name (entry
);
7557 int entry_length
= strlen (entry_name
);
7558 if (jcf_path_is_zipfile (entry
))
7561 buffer_grow (filename
, entry_length
);
7562 memcpy (filename
->data
, entry_name
, entry_length
- 1);
7563 filename
->data
[entry_length
-1] = '\0';
7564 zipf
= opendir_in_zip (filename
->data
, jcf_path_is_system (entry
));
7566 error ("malformed .zip archive in CLASSPATH: %s", entry_name
);
7569 ZipDirectory
*zipd
= (ZipDirectory
*) zipf
->central_directory
;
7570 BUFFER_RESET (filename
);
7571 for (k
= 0; k
< package_length
; k
++)
7573 char ch
= package_name
[k
];
7574 *filename
->ptr
++ = ch
== '.' ? '/' : ch
;
7576 *filename
->ptr
++ = '/';
7578 for (; k
< zipf
->count
; k
++, zipd
= ZIPDIR_NEXT (zipd
))
7580 char *current_entry
= ZIPDIR_FILENAME (zipd
);
7581 int current_entry_len
= zipd
->filename_length
;
7583 if (strncmp (filename
->data
, current_entry
,
7584 BUFFER_LENGTH (filename
)) != 0)
7586 found
+= note_possible_classname (current_entry
,
7593 BUFFER_RESET (filename
);
7594 buffer_grow (filename
, entry_length
+ package_length
+ 4);
7595 strcpy (filename
->data
, entry_name
);
7596 filename
->ptr
= filename
->data
+ entry_length
;
7597 for (k
= 0; k
< package_length
; k
++)
7599 char ch
= package_name
[k
];
7600 *filename
->ptr
++ = ch
== '.' ? '/' : ch
;
7602 *filename
->ptr
= '\0';
7604 dirp
= opendir (filename
->data
);
7607 *filename
->ptr
++ = '/';
7610 int java_or_class
= 0;
7613 struct dirent
*direntp
= readdir (dirp
);
7616 d_name
= direntp
->d_name
;
7617 len
= strlen (direntp
->d_name
);
7618 buffer_grow (filename
, len
+1);
7619 strcpy (filename
->ptr
, d_name
);
7620 found
+= note_possible_classname (filename
->data
+ entry_length
,
7621 package_length
+len
+1);
7628 free (filename
->data
);
7630 /* Here we should have a unified way of retrieving an entry, to be
7634 static int first
= 1;
7638 sprintf (buffer
, "Can't find default package `%s'. Check "
7639 "the CLASSPATH environment variable and the access to the "
7640 "archives.", package_name
);
7646 parse_error_context (wfl
, "Package `%s' not found in import",
7648 current_jcf
= saved_jcf
;
7651 current_jcf
= saved_jcf
;
7654 /* Possibly find a type in the import on demands specified
7655 types. Returns 1 if an error occured, 0 otherwise. Run throught the
7656 entire list, to detected potential double definitions. */
7659 find_in_imports_on_demand (class_type
)
7662 tree node
, import
, node_to_use
;
7666 for (import
= ctxp
->import_demand_list
; import
; import
= TREE_CHAIN (import
))
7669 obstack_grow (&temporary_obstack
,
7670 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import
))),
7671 IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import
))));
7672 obstack_1grow (&temporary_obstack
, '.');
7673 obstack_grow0 (&temporary_obstack
,
7674 IDENTIFIER_POINTER (TYPE_NAME (class_type
)),
7675 IDENTIFIER_LENGTH (TYPE_NAME (class_type
)));
7676 id_name
= obstack_finish (&temporary_obstack
);
7678 node
= maybe_get_identifier (id_name
);
7679 if (node
&& IS_A_CLASSFILE_NAME (node
))
7683 cl
= TREE_PURPOSE (import
);
7691 (import
, "Type `%s' also potentially defined in package `%s'",
7692 IDENTIFIER_POINTER (TYPE_NAME (class_type
)),
7693 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import
))));
7700 /* Setup lineno so that it refers to the line of the import (in
7701 case we parse a class file and encounter errors */
7703 int saved_lineno
= lineno
;
7704 lineno
= EXPR_WFL_LINENO (cl
);
7705 TYPE_NAME (class_type
) = node_to_use
;
7706 QUALIFIED_P (TYPE_NAME (class_type
)) = 1;
7707 decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
7708 /* If there is no DECL set for the class or if the class isn't
7709 loaded and not seen in source yet, the load */
7710 if (!decl
|| (!CLASS_LOADED_P (TREE_TYPE (decl
))
7711 && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl
))))
7712 load_class (node_to_use
, 0);
7713 lineno
= saved_lineno
;
7714 return check_pkg_class_access (TYPE_NAME (class_type
), cl
);
7717 return (seen_once
< 0 ? 0 : seen_once
); /* It's ok not to have found */
7721 resolve_package (pkg
, next
)
7724 tree type_name
= NULL_TREE
;
7725 char *name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg
));
7727 /* The trick is to determine when the package name stops and were
7728 the name of something contained in the package starts. Then we
7729 return a fully qualified name of what we want to get. */
7731 /* Do a quick search on well known package names */
7732 if (!strncmp (name
, "java.lang.reflect", 17))
7735 TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg
))));
7736 type_name
= lookup_package_type (name
, 17);
7738 else if (!strncmp (name
, "java.lang", 9))
7740 *next
= TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg
)));
7741 type_name
= lookup_package_type (name
, 9);
7744 return NULL_TREE
; /* FIXME, search all imported packages. */
7750 lookup_package_type (name
, from
)
7755 char *sub
= &name
[from
+1];
7756 while (*sub
!= '.' && *sub
)
7758 strncpy (subname
, name
, sub
-name
);
7759 subname
[sub
-name
] = '\0';
7760 return get_identifier (subname
);
7763 /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
7764 access violations were found, 1 otherwise. */
7767 check_pkg_class_access (class_name
, cl
)
7773 if (!QUALIFIED_P (class_name
) || !IDENTIFIER_CLASS_VALUE (class_name
))
7776 if (!(type
= TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name
))))
7779 if (!CLASS_PUBLIC (TYPE_NAME (type
)))
7782 (cl
, "Can't access %s `%s'. Only public classes and interfaces in "
7783 "other packages can be accessed",
7784 (CLASS_INTERFACE (TYPE_NAME (type
)) ? "interface" : "class"),
7785 IDENTIFIER_POINTER (class_name
));
7791 /* Local variable declaration. */
7794 declare_local_variables (modifier
, type
, vlist
)
7799 tree decl
, current
, saved_type
;
7800 tree type_wfl
= NULL_TREE
;
7803 /* Push a new block if statement were seen between the last time we
7804 pushed a block and now. Keep a cound of block to close */
7805 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl
)))
7807 tree body
= DECL_FUNCTION_BODY (current_function_decl
);
7808 tree b
= enter_block ();
7809 BLOCK_EXPR_ORIGIN(b
) = body
;
7815 for (i
= 0; i
<= 10; i
++) if (1 << i
& modifier
) break;
7816 if (modifier
== ACC_FINAL
)
7818 if (flag_static_local_jdk1_1
)
7819 parse_warning_context (ctxp
->modifier_ctx
[i
],
7820 "Unsupported JDK1.1 `final' local variable "
7821 "(treated as non final)");
7826 (ctxp
->modifier_ctx
[i
],
7827 "Only `final' is allowed as a local variables modifier");
7832 /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
7833 hold the TYPE value if a new incomplete has to be created (as
7834 opposed to being found already existing and reused). */
7835 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
7837 /* If TYPE is fully resolved and we don't have a reference, make one */
7838 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
7840 /* Go through all the declared variables */
7841 for (current
= vlist
, saved_type
= type
; current
;
7842 current
= TREE_CHAIN (current
), type
= saved_type
)
7844 tree other
, real_type
;
7845 tree wfl
= TREE_PURPOSE (current
);
7846 tree name
= EXPR_WFL_NODE (wfl
);
7847 tree init
= TREE_VALUE (current
);
7849 /* Process NAME, as it may specify extra dimension(s) for it */
7850 type
= build_array_from_name (type
, type_wfl
, name
, &name
);
7852 /* Variable redefinition check */
7853 if ((other
= lookup_name_in_blocks (name
)))
7855 variable_redefinition_error (wfl
, name
, TREE_TYPE (other
),
7856 DECL_SOURCE_LINE (other
));
7860 /* Type adjustment. We may have just readjusted TYPE because
7861 the variable specified more dimensions. Make sure we have
7862 a reference if we can and don't have one already. */
7863 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
7865 real_type
= GET_REAL_TYPE (type
);
7866 /* Never layout this decl. This will be done when its scope
7868 decl
= build_decl (VAR_DECL
, name
, real_type
);
7869 BLOCK_CHAIN_DECL (decl
);
7871 /* Don't try to use an INIT statement when an error was found */
7872 if (init
&& java_error_count
)
7875 /* Add the initialization function to the current function's code */
7878 /* Name might have been readjusted */
7879 EXPR_WFL_NODE (TREE_OPERAND (init
, 0)) = name
;
7880 MODIFY_EXPR_FROM_INITIALIZATION_P (init
) = 1;
7881 java_method_add_stmt (current_function_decl
,
7882 build_debugable_stmt (EXPR_WFL_LINECOL (init
),
7886 /* Setup dependency the type of the decl */
7890 register_incomplete_type (JDEP_VARIABLE
, type_wfl
, decl
, type
);
7891 dep
= CLASSD_LAST (ctxp
->classd_list
);
7892 JDEP_GET_PATCH (dep
) = &TREE_TYPE (decl
);
7895 SOURCE_FRONTEND_DEBUG (("Defined locals"));
7898 /* Called during parsing. Build decls from argument list. */
7901 source_start_java_method (fndecl
)
7908 current_function_decl
= fndecl
;
7910 /* New scope for the function */
7912 for (tem
= TYPE_ARG_TYPES (TREE_TYPE (fndecl
)), i
= 0;
7913 tem
!= end_params_node
; tem
= TREE_CHAIN (tem
), i
++)
7915 tree type
= TREE_VALUE (tem
);
7916 tree name
= TREE_PURPOSE (tem
);
7918 /* If type is incomplete. Create an incomplete decl and ask for
7919 the decl to be patched later */
7920 if (INCOMPLETE_TYPE_P (type
))
7923 tree real_type
= GET_REAL_TYPE (type
);
7924 parm_decl
= build_decl (PARM_DECL
, name
, real_type
);
7925 type
= obtain_incomplete_type (type
);
7926 register_incomplete_type (JDEP_PARM
, NULL_TREE
, NULL_TREE
, type
);
7927 jdep
= CLASSD_LAST (ctxp
->classd_list
);
7928 JDEP_MISC (jdep
) = name
;
7929 JDEP_GET_PATCH (jdep
) = &TREE_TYPE (parm_decl
);
7932 parm_decl
= build_decl (PARM_DECL
, name
, type
);
7934 BLOCK_CHAIN_DECL (parm_decl
);
7936 tem
= BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
));
7937 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
)) =
7939 DECL_ARG_SLOT_COUNT (current_function_decl
) = i
;
7942 /* Called during parsing. Creates an artificial method declaration. */
7945 create_artificial_method (class, flags
, type
, name
, args
)
7948 tree type
, name
, args
;
7950 int saved_lineno
= lineno
;
7954 mdecl
= make_node (FUNCTION_TYPE
);
7955 TREE_TYPE (mdecl
) = type
;
7956 TYPE_ARG_TYPES (mdecl
) = args
;
7957 mdecl
= add_method (class, flags
, name
, build_java_signature (mdecl
));
7958 lineno
= saved_lineno
;
7959 DECL_ARTIFICIAL (mdecl
) = 1;
7963 /* Starts the body if an artifical method. */
7966 start_artificial_method_body (mdecl
)
7969 DECL_SOURCE_LINE (mdecl
) = 1;
7970 DECL_SOURCE_LINE_MERGE (mdecl
, 1);
7971 source_start_java_method (mdecl
);
7976 end_artificial_method_body (mdecl
)
7979 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl
)) = exit_block ();
7983 /* Called during expansion. Push decls formerly built from argument
7984 list so they're usable during expansion. */
7987 expand_start_java_method (fndecl
)
7992 current_function_decl
= fndecl
;
7994 announce_function (fndecl
);
7995 pushlevel (1); /* Push parameters */
7996 ptr
= &DECL_ARGUMENTS (fndecl
);
7997 tem
= BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
));
8000 tree next
= TREE_CHAIN (tem
);
8001 tree type
= TREE_TYPE (tem
);
8002 #ifdef PROMOTE_PROTOTYPES
8003 if (TYPE_PRECISION (type
) < TYPE_PRECISION (integer_type_node
)
8004 && INTEGRAL_TYPE_P (type
))
8005 type
= integer_type_node
;
8007 DECL_ARG_TYPE (tem
) = type
;
8008 layout_decl (tem
, 0);
8010 INITIALIZED_P (tem
) = 1; /* Parms are initialized */
8012 ptr
= &TREE_CHAIN (tem
);
8016 pushdecl_force_head (DECL_ARGUMENTS (fndecl
));
8017 lineno
= DECL_SOURCE_LINE_FIRST (fndecl
);
8018 complete_start_java_method (fndecl
);
8021 /* Terminate a function and expand its body. */
8024 source_end_java_method ()
8026 tree fndecl
= current_function_decl
;
8028 java_parser_context_save_global ();
8029 lineno
= ctxp
->last_ccb_indent1
;
8031 /* Set EH language codes */
8032 java_set_exception_lang_code ();
8034 /* Generate function's code */
8035 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
))
8036 && ! flag_emit_class_files
)
8037 expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)));
8039 /* pop out of its parameters */
8040 pushdecl_force_head (DECL_ARGUMENTS (fndecl
));
8042 BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl
)) = fndecl
;
8044 /* Generate rtl for function exit. */
8045 if (! flag_emit_class_files
)
8047 lineno
= DECL_SOURCE_LINE_LAST (fndecl
);
8048 /* Emit catch-finally clauses */
8050 expand_function_end (input_filename
, lineno
, 0);
8052 /* Run the optimizers and output assembler code for this function. */
8053 rest_of_compilation (fndecl
);
8056 current_function_decl
= NULL_TREE
;
8057 /* permanent_allocation (1); */
8058 java_parser_context_restore_global ();
8061 /* Record EXPR in the current function block. Complements compound
8062 expression second operand if necessary. */
8065 java_method_add_stmt (fndecl
, expr
)
8068 return add_stmt_to_block (DECL_FUNCTION_BODY (fndecl
), NULL_TREE
, expr
);
8072 add_stmt_to_block (b
, type
, stmt
)
8075 tree body
= BLOCK_EXPR_BODY (b
), c
;
8077 if (java_error_count
)
8080 if ((c
= add_stmt_to_compound (body
, type
, stmt
)) == body
)
8083 BLOCK_EXPR_BODY (b
) = c
;
8084 TREE_SIDE_EFFECTS (c
) = 1;
8088 /* Add STMT to EXISTING if possible, otherwise create a new
8089 COMPOUND_EXPR and add STMT to it. */
8092 add_stmt_to_compound (existing
, type
, stmt
)
8093 tree existing
, type
, stmt
;
8096 return build (COMPOUND_EXPR
, type
, existing
, stmt
);
8101 /* Hold THIS for the scope of the current public method decl. */
8102 static tree current_this
;
8104 void java_layout_seen_class_methods ()
8106 tree previous_list
= all_class_list
;
8107 tree end
= NULL_TREE
;
8112 for (current
= previous_list
;
8113 current
!= end
; current
= TREE_CHAIN (current
))
8114 layout_class_methods (TREE_TYPE (TREE_VALUE (current
)));
8116 if (previous_list
!= all_class_list
)
8118 end
= previous_list
;
8119 previous_list
= all_class_list
;
8126 /* Layout the methods of all classes loaded in one way on an
8127 other. Check methods of source parsed classes. Then reorder the
8128 fields and layout the classes or the type of all source parsed
8132 java_layout_classes ()
8136 /* Layout the methods of all classes seen so far */
8137 java_layout_seen_class_methods ();
8138 java_parse_abort_on_error ();
8139 all_class_list
= NULL_TREE
;
8141 /* Then check the methods of all parsed classes */
8142 for (current
= ctxp
->gclass_list
; current
; current
= TREE_CHAIN (current
))
8143 if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current
))))
8144 CHECK_METHODS (TREE_VALUE (current
));
8145 java_parse_abort_on_error ();
8147 for (current
= ctxp
->gclass_list
; current
; current
= TREE_CHAIN (current
))
8149 current_class
= TREE_TYPE (TREE_VALUE (current
));
8151 /* Reverse the fields, but leave the dummy field in front.
8152 Fields are already ordered for Object and Class */
8153 if (TYPE_FIELDS (current_class
) && current_class
!= object_type_node
8154 && current_class
!= class_type_node
)
8156 /* If the dummy field is there, reverse the right fields and
8157 just layout the type for proper fields offset */
8158 if (!DECL_NAME (TYPE_FIELDS (current_class
)))
8160 tree fields
= TYPE_FIELDS (current_class
);
8161 TREE_CHAIN (fields
) = nreverse (TREE_CHAIN (fields
));
8162 TYPE_SIZE (current_class
) = NULL_TREE
;
8163 layout_type (current_class
);
8165 /* We don't have a dummy field, we need to layout the class,
8166 after having reversed the fields */
8169 TYPE_FIELDS (current_class
) =
8170 nreverse (TYPE_FIELDS (current_class
));
8171 TYPE_SIZE (current_class
) = NULL_TREE
;
8172 layout_class (current_class
);
8176 layout_class (current_class
);
8178 /* From now on, the class is considered completely loaded */
8179 CLASS_LOADED_P (current_class
) = 1;
8181 /* Error reported by the caller */
8182 if (java_error_count
)
8186 /* We might have reloaded classes durign the process of laying out
8187 classes for code generation. We must layout the methods of those
8188 late additions, as constructor checks might use them */
8189 java_layout_seen_class_methods ();
8190 java_parse_abort_on_error ();
8193 /* Expand all methods in all registered classes. */
8196 java_complete_expand_methods ()
8200 for (current
= ctxp
->class_list
; current
; current
= TREE_CHAIN (current
))
8202 tree class_type
= CLASS_TO_HANDLE_TYPE (TREE_TYPE (current
));
8205 current_class
= TREE_TYPE (current
);
8207 /* Initialize a new constant pool */
8208 init_outgoing_cpool ();
8210 /* We want <clinit> (if any) to be processed first. */
8211 decl
= tree_last (TYPE_METHODS (class_type
));
8212 if (decl
&& DECL_NAME (decl
) == clinit_identifier_node
)
8214 tree list
= nreverse (TYPE_METHODS (class_type
));
8215 list
= TREE_CHAIN (list
);
8216 TREE_CHAIN (decl
) = NULL_TREE
;
8217 TYPE_METHODS (class_type
) = chainon (decl
, nreverse (list
));
8220 /* Don't process function bodies in interfaces */
8221 if (!CLASS_INTERFACE (TYPE_NAME (current_class
)))
8222 for (decl
= TYPE_METHODS (class_type
); decl
; decl
= TREE_CHAIN (decl
))
8224 current_function_decl
= decl
;
8225 /* Don't generate debug info on line zero when expanding a
8226 generated constructor. */
8227 if (DECL_CONSTRUCTOR_P (decl
) && !DECL_FUNCTION_BODY (decl
))
8229 /* If we found errors, it's too dangerous to try to generate
8230 and expand a constructor */
8231 if (!java_error_count
)
8233 restore_line_number_status (1);
8234 java_complete_expand_method (decl
);
8235 restore_line_number_status (0);
8238 else if (METHOD_ABSTRACT (decl
) || METHOD_NATIVE (decl
))
8241 java_complete_expand_method (decl
);
8244 /* Now verify constructor circularity (stop after the first one
8246 if (!CLASS_INTERFACE (TYPE_NAME (current_class
)))
8247 for (decl
= TYPE_METHODS (class_type
); decl
; decl
= TREE_CHAIN (decl
))
8248 if (DECL_CONSTRUCTOR_P (decl
) &&
8249 verify_constructor_circularity (decl
, decl
))
8252 /* Make the class data, register it and run the rest of decl
8253 compilation on it */
8254 if (!java_error_count
)
8256 if (flag_emit_class_files
)
8257 write_classfile (current_class
);
8259 finish_class (current_class
);
8264 /* Hold a list of catch clauses list. The first element of this list is
8265 the list of the catch clauses of the currently analysed try block. */
8266 static tree currently_caught_type_list
;
8268 /* Complete and expand a method. */
8271 java_complete_expand_method (mdecl
)
8274 /* Fix constructors before expanding them */
8275 if (DECL_CONSTRUCTOR_P (mdecl
))
8276 fix_constructors (mdecl
);
8278 /* Expand functions that have a body */
8279 if (DECL_FUNCTION_BODY (mdecl
))
8281 tree fbody
= DECL_FUNCTION_BODY (mdecl
);
8282 tree block_body
= BLOCK_EXPR_BODY (fbody
);
8283 expand_start_java_method (mdecl
);
8286 = (!METHOD_STATIC (mdecl
) ?
8287 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl
)) : NULL_TREE
);
8289 /* Purge the `throws' list of unchecked exceptions */
8290 purge_unchecked_exceptions (mdecl
);
8292 /* Install exceptions thrown with `throws' */
8293 PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl
));
8295 if (block_body
!= NULL_TREE
)
8296 block_body
= java_complete_tree (block_body
);
8297 BLOCK_EXPR_BODY (fbody
) = block_body
;
8299 if ((block_body
== NULL_TREE
|| CAN_COMPLETE_NORMALLY (block_body
))
8300 && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl
))) != VOID_TYPE
)
8301 missing_return_error (current_function_decl
);
8303 /* Don't go any further if we've found error(s) during the
8305 if (!java_error_count
)
8306 source_end_java_method ();
8309 pushdecl_force_head (DECL_ARGUMENTS (mdecl
));
8313 /* Pop the exceptions and sanity check */
8315 if (currently_caught_type_list
)
8316 fatal ("Exception list non empty - java_complete_expand_method");
8320 /* Craft a body for default constructor. Patch existing constructor
8321 bodies with call to super() and field initialization statements if
8325 fix_constructors (mdecl
)
8328 tree body
= DECL_FUNCTION_BODY (mdecl
);
8332 /* The constructor body must be crafted by hand. It's the
8333 constructor we defined when we realize we didn't have the
8334 CLASSNAME() constructor */
8338 /* It is an error for the compiler to generate a default
8339 constructor if the superclass doesn't have a constructor that
8340 takes no argument */
8341 if (verify_constructor_super ())
8343 tree sclass_decl
= TYPE_NAME (CLASSTYPE_SUPER (current_class
));
8344 char *n
= IDENTIFIER_POINTER (DECL_NAME (sclass_decl
));
8345 parse_error_context (lookup_cl (TYPE_NAME (current_class
)),
8346 "No constructor matching `%s()' found in "
8347 "class `%s'", n
, n
);
8350 start_artificial_method_body (mdecl
);
8352 /* We don't generate a super constructor invocation if we're
8353 compiling java.lang.Object. build_super_invocation takes care
8355 compound
= java_method_add_stmt (mdecl
, build_super_invocation ());
8357 end_artificial_method_body (mdecl
);
8359 /* Search for an explicit constructor invocation */
8363 tree main_block
= BLOCK_EXPR_BODY (body
);
8364 tree compound
= NULL_TREE
;
8367 switch (TREE_CODE (body
))
8370 found
= CALL_EXPLICIT_CONSTRUCTOR_P (body
);
8374 case EXPR_WITH_FILE_LOCATION
:
8375 body
= TREE_OPERAND (body
, 0);
8378 body
= BLOCK_EXPR_BODY (body
);
8384 /* The constructor is missing an invocation of super() */
8386 compound
= add_stmt_to_compound (compound
, NULL_TREE
,
8387 build_super_invocation ());
8389 /* Fix the constructor main block if we're adding extra stmts */
8392 compound
= add_stmt_to_compound (compound
, NULL_TREE
,
8393 BLOCK_EXPR_BODY (main_block
));
8394 BLOCK_EXPR_BODY (main_block
) = compound
;
8399 /* Browse constructors in the super class, searching for a constructor
8400 that doesn't take any argument. Return 0 if one is found, 1
8404 verify_constructor_super ()
8406 tree
class = CLASSTYPE_SUPER (current_class
);
8413 for (mdecl
= TYPE_METHODS (class); mdecl
; mdecl
= TREE_CHAIN (mdecl
))
8415 if (DECL_CONSTRUCTOR_P (mdecl
)
8416 && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl
))) == end_params_node
)
8423 /* Expand finals. */
8426 java_expand_finals ()
8430 /* Generate code for all context remembered for code generation. */
8433 java_expand_classes ()
8435 java_parse_abort_on_error ();
8436 if (!(ctxp
= ctxp_for_generation
))
8438 java_layout_classes ();
8439 java_parse_abort_on_error ();
8441 for (; ctxp_for_generation
; ctxp_for_generation
= ctxp_for_generation
->next
)
8443 ctxp
= ctxp_for_generation
;
8444 lang_init_source (2); /* Error msgs have method prototypes */
8445 java_complete_expand_methods (); /* Complete and expand method bodies */
8446 java_parse_abort_on_error ();
8447 java_expand_finals (); /* Expand and check the finals */
8448 java_parse_abort_on_error ();
8449 java_check_final (); /* Check unitialized final */
8450 java_parse_abort_on_error ();
8454 /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
8455 a tree list node containing RIGHT. Fore coming RIGHTs will be
8456 chained to this hook. LOCATION contains the location of the
8457 separating `.' operator. */
8460 make_qualified_primary (primary
, right
, location
)
8461 tree primary
, right
;
8466 /* We want to process THIS . xxx symbolicaly, to keep it consistent
8467 with the way we're processing SUPER. A THIS from a primary as a
8468 different form than a SUPER. Turn THIS into something symbolic */
8469 if (TREE_CODE (primary
) == THIS_EXPR
)
8471 wfl
= build_wfl_node (this_identifier_node
, input_filename
, 0, 0);
8472 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (primary
);
8473 wfl
= make_qualified_name (wfl
, right
, location
);
8474 PRIMARY_P (wfl
) = 1;
8477 /* Other non WFL node are wrapped around a WFL */
8478 else if (TREE_CODE (primary
) != EXPR_WITH_FILE_LOCATION
)
8480 wfl
= build_expr_wfl (NULL_TREE
, ctxp
->filename
, 0, 0);
8481 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (primary
);
8482 EXPR_WFL_QUALIFICATION (wfl
) = build_tree_list (primary
, NULL_TREE
);
8487 if (!EXPR_WFL_QUALIFICATION (primary
))
8488 EXPR_WFL_QUALIFICATION (primary
) =
8489 build_tree_list (primary
, NULL_TREE
);
8492 EXPR_WFL_LINECOL (right
) = location
;
8493 chainon (EXPR_WFL_QUALIFICATION (wfl
), build_tree_list (right
, NULL_TREE
));
8494 PRIMARY_P (wfl
) = 1;
8498 /* Simple merge of two name separated by a `.' */
8501 merge_qualified_name (left
, right
)
8505 obstack_grow (&temporary_obstack
, IDENTIFIER_POINTER (left
),
8506 IDENTIFIER_LENGTH (left
));
8507 obstack_1grow (&temporary_obstack
, '.');
8508 obstack_grow0 (&temporary_obstack
, IDENTIFIER_POINTER (right
),
8509 IDENTIFIER_LENGTH (right
));
8510 node
= get_identifier (obstack_base (&temporary_obstack
));
8511 obstack_free (&temporary_obstack
, obstack_base (&temporary_obstack
));
8512 QUALIFIED_P (node
) = 1;
8516 /* Merge the two parts of a qualified name into LEFT. Set the
8517 location information of the resulting node to LOCATION, usually
8518 inherited from the location information of the `.' operator. */
8521 make_qualified_name (left
, right
, location
)
8525 tree left_id
= EXPR_WFL_NODE (left
);
8526 tree right_id
= EXPR_WFL_NODE (right
);
8529 merge
= merge_qualified_name (left_id
, right_id
);
8531 /* Left wasn't qualified and is now qualified */
8532 if (!QUALIFIED_P (left_id
))
8534 tree wfl
= build_expr_wfl (left_id
, ctxp
->filename
, 0, 0);
8535 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (left
);
8536 EXPR_WFL_QUALIFICATION (left
) = build_tree_list (wfl
, NULL_TREE
);
8539 wfl
= build_expr_wfl (right_id
, ctxp
->filename
, 0, 0);
8540 EXPR_WFL_LINECOL (wfl
) = location
;
8541 chainon (EXPR_WFL_QUALIFICATION (left
), build_tree_list (wfl
, NULL_TREE
));
8543 EXPR_WFL_NODE (left
) = merge
;
8547 /* Extract the last identifier component of the qualified in WFL. The
8548 last identifier is removed from the linked list */
8551 cut_identifier_in_qualified (wfl
)
8555 tree previous
= NULL_TREE
;
8556 for (q
= EXPR_WFL_QUALIFICATION (wfl
); ; previous
= q
, q
= TREE_CHAIN (q
))
8557 if (!TREE_CHAIN (q
))
8560 fatal ("Operating on a non qualified qualified WFL - "
8561 "cut_identifier_in_qualified");
8562 TREE_CHAIN (previous
) = NULL_TREE
;
8563 return TREE_PURPOSE (q
);
8567 /* Resolve the expression name NAME. Return its decl. */
8570 resolve_expression_name (id
, orig
)
8574 tree name
= EXPR_WFL_NODE (id
);
8577 /* 6.5.5.1: Simple expression names */
8578 if (!PRIMARY_P (id
) && !QUALIFIED_P (name
))
8580 /* 15.13.1: NAME can appear within the scope of a local variable
8582 if ((decl
= IDENTIFIER_LOCAL_VALUE (name
)))
8585 /* 15.13.1: NAME can appear within a class declaration */
8588 decl
= lookup_field_wrapper (current_class
, name
);
8591 int fs
= FIELD_STATIC (decl
);
8592 /* Instance variable (8.3.1.1) can't appear within
8593 static method, static initializer or initializer for
8594 a static variable. */
8595 if (!fs
&& METHOD_STATIC (current_function_decl
))
8598 (id
, "Can't make a static reference to nonstatic variable "
8599 "`%s' in class `%s'",
8600 IDENTIFIER_POINTER (name
),
8601 IDENTIFIER_POINTER (DECL_NAME
8602 (TYPE_NAME (current_class
))));
8603 return error_mark_node
;
8605 /* Instance variables can't appear as an argument of
8606 an explicit constructor invocation */
8607 if (!fs
&& ctxp
->explicit_constructor_p
)
8610 (id
, "Can't reference `%s' before the superclass "
8611 "constructor has been called", IDENTIFIER_POINTER (name
));
8612 return error_mark_node
;
8615 /* Otherwise build what it takes to access the field */
8616 decl
= build_field_ref ((fs
? NULL_TREE
: current_this
),
8617 current_class
, name
);
8618 if (fs
&& !flag_emit_class_files
)
8619 decl
= build_class_init (current_class
, decl
);
8620 /* We may be asked to save the real field access node */
8623 /* And we return what we got */
8626 /* Fall down to error report on undefined variable */
8629 /* 6.5.5.2 Qualified Expression Names */
8634 qualify_ambiguous_name (id
);
8635 /* 15.10.1 Field Access Using a Primary and/or Expression Name */
8636 /* 15.10.2: Accessing Superclass Members using super */
8637 return resolve_field_access (id
, NULL
, NULL
);
8640 /* We've got an error here */
8641 parse_error_context (id
, "Undefined variable `%s'",
8642 IDENTIFIER_POINTER (name
));
8644 return error_mark_node
;
8647 /* 15.10.1 Field Acess Using a Primary and/or Expression Name.
8648 We return something suitable to generate the field access. We also
8649 return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
8650 recipient's address can be null. */
8653 resolve_field_access (qual_wfl
, field_decl
, field_type
)
8655 tree
*field_decl
, *field_type
;
8659 tree decl
, where_found
, type_found
;
8661 if (resolve_qualified_expression_name (qual_wfl
, &decl
,
8662 &where_found
, &type_found
))
8663 return error_mark_node
;
8665 /* Resolve the LENGTH field of an array here */
8666 if (DECL_NAME (decl
) == length_identifier_node
&& TYPE_ARRAY_P (type_found
)
8667 && ! flag_emit_class_files
)
8669 tree length
= build_java_array_length_access (where_found
);
8671 build_java_arraynull_check (type_found
, length
, int_type_node
);
8673 /* We might have been trying to resolve field.method(). In which
8674 case, the resolution is over and decl is the answer */
8675 else if (DECL_P (decl
) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl
)) == decl
)
8677 else if (DECL_P (decl
))
8679 int static_final_found
= 0;
8681 type_found
= DECL_CONTEXT (decl
);
8682 is_static
= DECL_P (decl
) && FIELD_STATIC (decl
);
8683 if (FIELD_FINAL (decl
)
8684 && JPRIMITIVE_TYPE_P (TREE_TYPE (decl
))
8685 && DECL_LANG_SPECIFIC (decl
)
8686 && DECL_INITIAL (decl
))
8688 field_ref
= DECL_INITIAL (decl
);
8689 static_final_found
= 1;
8692 field_ref
= build_field_ref ((is_static
? NULL_TREE
: where_found
),
8693 type_found
, DECL_NAME (decl
));
8694 if (field_ref
== error_mark_node
)
8695 return error_mark_node
;
8696 if (is_static
&& !static_final_found
&& !flag_emit_class_files
)
8698 field_ref
= build_class_init (type_found
, field_ref
);
8699 /* If the static field was identified by an expression that
8700 needs to be generated, make the field access a compound
8701 expression whose first part of the evaluation of the
8702 field selector part. */
8703 if (where_found
&& TREE_CODE (where_found
) != TYPE_DECL
8704 && TREE_CODE (where_found
) != RECORD_TYPE
)
8706 tree type
= QUAL_DECL_TYPE (field_ref
);
8707 field_ref
= build (COMPOUND_EXPR
, type
, where_found
, field_ref
);
8717 *field_type
= (QUAL_DECL_TYPE (decl
) ?
8718 QUAL_DECL_TYPE (decl
) : TREE_TYPE (decl
));
8722 /* 6.5.5.2: Qualified Expression Names */
8725 resolve_qualified_expression_name (wfl
, found_decl
, where_found
, type_found
)
8727 tree
*found_decl
, *type_found
, *where_found
;
8729 int from_type
= 0; /* Field search initiated from a type */
8730 int from_super
= 0, from_cast
= 0;
8731 int previous_call_static
= 0;
8733 tree decl
= NULL_TREE
, type
= NULL_TREE
, q
;
8734 *type_found
= *where_found
= NULL_TREE
;
8736 for (q
= EXPR_WFL_QUALIFICATION (wfl
); q
; q
= TREE_CHAIN (q
))
8738 tree qual_wfl
= QUAL_WFL (q
);
8740 /* 15.10.1 Field Access Using a Primary */
8741 switch (TREE_CODE (qual_wfl
))
8744 case NEW_CLASS_EXPR
:
8745 /* If the access to the function call is a non static field,
8746 build the code to access it. */
8747 if (DECL_P (decl
) && !FIELD_STATIC (decl
))
8749 decl
= maybe_access_field (decl
, *where_found
,
8750 DECL_CONTEXT (decl
));
8751 if (decl
== error_mark_node
)
8754 /* And code for the function call */
8755 if (complete_function_arguments (qual_wfl
))
8757 if (from_super
&& TREE_CODE (qual_wfl
) == CALL_EXPR
)
8758 CALL_USING_SUPER (qual_wfl
) = 1;
8760 patch_method_invocation (qual_wfl
, decl
, type
, &is_static
, NULL
);
8761 if (*where_found
== error_mark_node
)
8763 *type_found
= type
= QUAL_DECL_TYPE (*where_found
);
8765 /* If the previous call was static and this one is too,
8766 build a compound expression to hold the two (because in
8767 that case, previous function calls aren't transported as
8768 forcoming function's argument. */
8769 if (previous_call_static
&& is_static
)
8771 decl
= build (COMPOUND_EXPR
, type
, decl
, *where_found
);
8772 TREE_SIDE_EFFECTS (decl
) = 1;
8776 previous_call_static
= is_static
;
8777 decl
= *where_found
;
8782 *where_found
= decl
= java_complete_tree (qual_wfl
);
8783 if (decl
== error_mark_node
)
8785 *type_found
= type
= QUAL_DECL_TYPE (decl
);
8789 case CONDITIONAL_EXPR
:
8791 *where_found
= decl
= java_complete_tree (qual_wfl
);
8792 if (decl
== error_mark_node
)
8794 *type_found
= type
= QUAL_DECL_TYPE (decl
);
8798 /* If the access to the function call is a non static field,
8799 build the code to access it. */
8800 if (DECL_P (decl
) && !FIELD_STATIC (decl
))
8802 decl
= maybe_access_field (decl
, *where_found
, type
);
8803 if (decl
== error_mark_node
)
8806 /* And code for the array reference expression */
8807 decl
= java_complete_tree (qual_wfl
);
8808 if (decl
== error_mark_node
)
8810 type
= QUAL_DECL_TYPE (decl
);
8814 /* Fix for -Wall Just go to the next statement. Don't
8818 /* If we fall here, we weren't processing a (static) function call. */
8819 previous_call_static
= 0;
8821 /* It can be the keyword THIS */
8822 if (EXPR_WFL_NODE (qual_wfl
) == this_identifier_node
)
8827 (wfl
, "Keyword `this' used outside allowed context");
8830 /* We have to generate code for intermediate acess */
8831 *where_found
= decl
= current_this
;
8832 *type_found
= type
= QUAL_DECL_TYPE (decl
);
8836 /* 15.10.2 Accessing Superclass Members using SUPER */
8837 if (EXPR_WFL_NODE (qual_wfl
) == super_identifier_node
)
8840 /* Check on the restricted use of SUPER */
8841 if (METHOD_STATIC (current_function_decl
)
8842 || current_class
== object_type_node
)
8845 (wfl
, "Keyword `super' used outside allowed context");
8848 /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
8849 node
= build_cast (EXPR_WFL_LINECOL (qual_wfl
),
8850 CLASSTYPE_SUPER (current_class
),
8851 build_this (EXPR_WFL_LINECOL (qual_wfl
)));
8852 *where_found
= decl
= java_complete_tree (node
);
8853 if (decl
== error_mark_node
)
8855 *type_found
= type
= QUAL_DECL_TYPE (decl
);
8856 from_super
= from_type
= 1;
8860 /* 15.13.1: Can't search for field name in packages, so we
8861 assume a variable/class name was meant. */
8862 if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
8864 tree name
= resolve_package (wfl
, &q
);
8867 *where_found
= decl
= resolve_no_layout (name
, qual_wfl
);
8868 /* We wan't to be absolutely that the class is laid
8869 out. We're going to search something inside it. */
8870 *type_found
= type
= TREE_TYPE (decl
);
8871 layout_class (type
);
8873 /* Should be a list, really. FIXME */
8874 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q
))) = 1;
8875 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q
))) = 0;
8879 if (from_super
|| from_cast
)
8881 ((from_cast
? qual_wfl
: wfl
),
8882 "No variable `%s' defined in class `%s'",
8883 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
8884 lang_printable_name (type
, 0));
8887 (qual_wfl
, "Undefined variable or class name: `%s'",
8888 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)));
8893 /* We have a type name. It's been already resolved when the
8894 expression was qualified. */
8895 else if (RESOLVE_TYPE_NAME_P (qual_wfl
))
8897 if (!(decl
= QUAL_RESOLUTION (q
)))
8898 return 1; /* Error reported already */
8900 if (not_accessible_p (TREE_TYPE (decl
), decl
, 0))
8903 (qual_wfl
, "Can't access %s field `%s.%s' from `%s'",
8904 java_accstring_lookup (get_access_flags_from_decl (decl
)),
8905 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type
))),
8906 IDENTIFIER_POINTER (DECL_NAME (decl
)),
8907 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))));
8910 check_deprecation (qual_wfl
, decl
);
8912 type
= TREE_TYPE (decl
);
8915 /* We resolve and expression name */
8920 /* If there exists an early resolution, use it. That occurs
8921 only once and we know that there are more things to
8922 come. Don't do that when processing something after SUPER
8923 (we need more thing to be put in place below */
8924 if (!from_super
&& QUAL_RESOLUTION (q
))
8926 decl
= QUAL_RESOLUTION (q
);
8929 if (!FIELD_STATIC (decl
))
8930 *where_found
= current_this
;
8933 *where_found
= TREE_TYPE (decl
);
8934 if (TREE_CODE (*where_found
) == POINTER_TYPE
)
8935 *where_found
= TREE_TYPE (*where_found
);
8940 /* We have to search for a field, knowing the type of its
8941 container. The flag FROM_TYPE indicates that we resolved
8942 the last member of the expression as a type name, which
8943 means that for the resolution of this field, we'll look
8944 for other errors than if it was resolved as a member of
8949 tree field_decl_type
; /* For layout */
8951 if (!from_type
&& !JREFERENCE_TYPE_P (type
))
8954 (qual_wfl
, "Attempt to reference field `%s' in `%s %s'",
8955 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
8956 lang_printable_name (type
, 0),
8957 IDENTIFIER_POINTER (DECL_NAME (field_decl
)));
8962 lookup_field_wrapper (type
, EXPR_WFL_NODE (qual_wfl
))))
8965 (qual_wfl
, "No variable `%s' defined in class `%s'",
8966 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
8967 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type
))));
8971 /* Layout the type of field_decl, since we may need
8972 it. Don't do primitive types or loaded classes. The
8973 situation of non primitive arrays may not handled
8974 properly here. FIXME */
8975 if (TREE_CODE (TREE_TYPE (field_decl
)) == POINTER_TYPE
)
8976 field_decl_type
= TREE_TYPE (TREE_TYPE (field_decl
));
8978 field_decl_type
= TREE_TYPE (field_decl
);
8979 if (!JPRIMITIVE_TYPE_P (field_decl_type
)
8980 && !CLASS_LOADED_P (field_decl_type
)
8981 && !TYPE_ARRAY_P (field_decl_type
))
8982 resolve_and_layout (field_decl_type
, NULL_TREE
);
8983 if (TYPE_ARRAY_P (field_decl_type
))
8984 CLASS_LOADED_P (field_decl_type
) = 1;
8986 /* Check on accessibility here */
8987 if (not_accessible_p (type
, field_decl
, from_super
))
8991 "Can't access %s field `%s.%s' from `%s'",
8992 java_accstring_lookup
8993 (get_access_flags_from_decl (field_decl
)),
8994 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type
))),
8995 IDENTIFIER_POINTER (DECL_NAME (field_decl
)),
8997 (DECL_NAME (TYPE_NAME (current_class
))));
9000 check_deprecation (qual_wfl
, field_decl
);
9002 /* There are things to check when fields are accessed
9003 from type. There are no restrictions on a static
9004 declaration of the field when it is accessed from an
9006 is_static
= FIELD_STATIC (field_decl
);
9007 if (!from_super
&& from_type
9008 && !TYPE_INTERFACE_P (type
) && !is_static
)
9011 (qual_wfl
, "Can't make a static reference to nonstatic "
9012 "variable `%s' in class `%s'",
9013 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9014 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type
))));
9017 from_cast
= from_super
= 0;
9019 /* If we need to generate something to get a proper
9020 handle on what this field is accessed from, do it
9024 decl
= maybe_access_field (decl
, *where_found
, *type_found
);
9025 if (decl
== error_mark_node
)
9029 /* We want to keep the location were found it, and the type
9031 *where_found
= decl
;
9034 /* This is the decl found and eventually the next one to
9039 type
= QUAL_DECL_TYPE (decl
);
9046 /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
9047 can't be accessed from REFERENCE (a record type). */
9049 int not_accessible_p (reference
, member
, from_super
)
9050 tree reference
, member
;
9053 int access_flag
= get_access_flags_from_decl (member
);
9055 /* Access always granted for members declared public */
9056 if (access_flag
& ACC_PUBLIC
)
9059 /* Check access on protected members */
9060 if (access_flag
& ACC_PROTECTED
)
9062 /* Access granted if it occurs from within the package
9063 containing the class in which the protected member is
9065 if (class_in_current_package (DECL_CONTEXT (member
)))
9068 /* If accessed with the form `super.member', then access is granted */
9072 /* Otherwise, access is granted if occuring from the class where
9073 member is declared or a subclass of it */
9074 if (inherits_from_p (reference
, current_class
))
9079 /* Check access on private members. Access is granted only if it
9080 occurs from within the class in witch it is declared */
9081 if (access_flag
& ACC_PRIVATE
)
9082 return (current_class
== DECL_CONTEXT (member
) ? 0 : 1);
9084 /* Default access are permitted only when occuring within the
9085 package in which the type (REFERENCE) is declared. In other words,
9086 REFERENCE is defined in the current package */
9088 return !class_in_current_package (reference
);
9090 /* Otherwise, access is granted */
9094 /* Test deprecated decl access. */
9096 check_deprecation (wfl
, decl
)
9099 char *file
= DECL_SOURCE_FILE (decl
);
9100 /* Complain if the field is deprecated and the file it was defined
9101 in isn't compiled at the same time the file which contains its
9103 if (DECL_DEPRECATED (decl
)
9104 && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file
)))
9107 switch (TREE_CODE (decl
))
9110 strcpy (the
, "method");
9113 strcpy (the
, "field");
9116 strcpy (the
, "class");
9119 fatal ("unexpected DECL code - check_deprecation");
9121 parse_warning_context
9122 (wfl
, "The %s `%s' in class `%s' has been deprecated",
9123 the
, lang_printable_name (decl
, 0),
9124 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl
)))));
9128 /* Returns 1 if class was declared in the current package, 0 otherwise */
9131 class_in_current_package (class)
9134 static tree cache
= NULL_TREE
;
9141 qualified_flag
= QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
9143 /* If the current package is empty and the name of CLASS is
9144 qualified, class isn't in the current package. If there is a
9145 current package and the name of the CLASS is not qualified, class
9146 isn't in the current package */
9147 if ((!ctxp
->package
&& qualified_flag
) || (ctxp
->package
&& !qualified_flag
))
9150 /* If there is not package and the name of CLASS isn't qualified,
9151 they belong to the same unnamed package */
9152 if (!ctxp
->package
&& !qualified_flag
)
9155 /* Compare the left part of the name of CLASS with the package name */
9156 breakdown_qualified (&left
, NULL
, DECL_NAME (TYPE_NAME (class)));
9157 if (ctxp
->package
== left
)
9165 /* This function may generate code to access DECL from WHERE. This is
9166 done only if certain conditions meet. */
9169 maybe_access_field (decl
, where
, type
)
9170 tree decl
, where
, type
;
9172 if (TREE_CODE (decl
) == FIELD_DECL
&& decl
!= current_this
9173 && !FIELD_STATIC (decl
))
9174 decl
= build_field_ref (where
? where
: current_this
,
9175 (type
? type
: DECL_CONTEXT (decl
)),
9180 /* Build a method invocation, by patching PATCH. If non NULL
9181 and according to the situation, PRIMARY and WHERE may be
9182 used. IS_STATIC is set to 1 if the invoked function is static. */
9185 patch_method_invocation (patch
, primary
, where
, is_static
, ret_decl
)
9186 tree patch
, primary
, where
;
9190 tree wfl
= TREE_OPERAND (patch
, 0);
9191 tree args
= TREE_OPERAND (patch
, 1);
9192 tree name
= EXPR_WFL_NODE (wfl
);
9194 int is_static_flag
= 0;
9195 int is_super_init
= 0;
9197 /* Should be overriden if everything goes well. Otherwise, if
9198 something fails, it should keep this value. It stop the
9199 evaluation of a bogus assignment. See java_complete_tree,
9200 MODIFY_EXPR: for the reasons why we sometimes want to keep on
9201 evaluating an assignment */
9202 TREE_TYPE (patch
) = error_mark_node
;
9204 /* Since lookup functions are messing with line numbers, save the
9206 java_parser_context_save_global ();
9208 /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
9210 /* Resolution of qualified name, excluding constructors */
9211 if (QUALIFIED_P (name
) && !CALL_CONSTRUCTOR_P (patch
))
9213 tree class_decl
, identifier
, identifier_wfl
;
9214 /* Extract the last IDENTIFIER of the qualified
9215 expression. This is a wfl and we will use it's location
9216 data during error report. */
9217 identifier_wfl
= cut_identifier_in_qualified (wfl
);
9218 identifier
= EXPR_WFL_NODE (identifier_wfl
);
9220 /* Given the context, IDENTIFIER is syntactically qualified
9221 as a MethodName. We need to qualify what's before */
9222 qualify_ambiguous_name (wfl
);
9224 /* Package resolution are erroneous */
9225 if (RESOLVE_PACKAGE_NAME_P (wfl
))
9228 breakdown_qualified (&remainder
, NULL
, EXPR_WFL_NODE (wfl
));
9229 parse_error_context (wfl
, "Can't search method `%s' in package "
9230 "`%s'",IDENTIFIER_POINTER (identifier
),
9231 IDENTIFIER_POINTER (remainder
));
9232 PATCH_METHOD_RETURN_ERROR ();
9234 /* We're resolving a call from a type */
9235 else if (RESOLVE_TYPE_NAME_P (wfl
))
9237 tree decl
= QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl
));
9238 tree name
= DECL_NAME (decl
);
9241 class_decl
= resolve_and_layout (name
, wfl
);
9242 if (CLASS_INTERFACE (decl
))
9245 (identifier_wfl
, "Can't make static reference to method "
9246 "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier
),
9247 IDENTIFIER_POINTER (name
));
9248 PATCH_METHOD_RETURN_ERROR ();
9250 /* Look the method up in the type selector. The method ought
9252 type
= TREE_TYPE (class_decl
);
9253 list
= lookup_method_invoke (0, wfl
, type
, identifier
, args
);
9254 if (list
&& !METHOD_STATIC (list
))
9256 char *fct_name
= strdup (lang_printable_name (list
, 0));
9259 "Can't make static reference to method `%s %s' in class `%s'",
9260 lang_printable_name (TREE_TYPE (TREE_TYPE (list
)), 0),
9261 fct_name
, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type
))));
9263 PATCH_METHOD_RETURN_ERROR ();
9265 args
= nreverse (args
);
9267 /* We're resolving an expression name */
9272 /* 1- Find the field to which the call applies */
9273 field
= resolve_field_access (wfl
, NULL
, &type
);
9274 if (field
== error_mark_node
)
9275 PATCH_METHOD_RETURN_ERROR ();
9276 /* field is used in lieu of a primary. It alows us not to
9277 report errors on erroneous use of `this' in
9281 /* 2- Do the layout of the class where the last field
9282 was found, so we can search it. */
9283 class_decl
= resolve_and_layout (type
, NULL_TREE
);
9284 if (class_decl
!= NULL_TREE
)
9285 type
= TREE_TYPE (class_decl
);
9287 /* 3- Retrieve a filtered list of method matches, Refine
9288 if necessary. In any cases, point out errors. */
9289 list
= lookup_method_invoke (0, identifier_wfl
, type
,
9292 /* 4- Add the field as an argument */
9293 args
= tree_cons (NULL_TREE
, field
, nreverse (args
));
9296 /* IDENTIFIER_WFL will be used to report any problem further */
9297 wfl
= identifier_wfl
;
9299 /* Resolution of simple names, names generated after a primary: or
9303 tree class_to_search
;
9304 int lc
; /* Looking for Constructor */
9306 /* We search constructor in their target class */
9307 if (CALL_CONSTRUCTOR_P (patch
))
9309 if (TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9310 class_to_search
= EXPR_WFL_NODE (wfl
);
9311 else if (EXPR_WFL_NODE (TREE_OPERAND (patch
, 0)) ==
9312 this_identifier_node
)
9313 class_to_search
= NULL_TREE
;
9314 else if (EXPR_WFL_NODE (TREE_OPERAND (patch
, 0)) ==
9315 super_identifier_node
)
9318 if (CLASSTYPE_SUPER (current_class
))
9320 DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class
)));
9323 parse_error_context (wfl
, "Can't invoke super constructor "
9324 "on java.lang.Object");
9325 PATCH_METHOD_RETURN_ERROR ();
9329 /* Class to search is NULL if we're searching the current one */
9330 if (class_to_search
)
9332 class_to_search
= resolve_and_layout (class_to_search
,
9334 if (!class_to_search
)
9337 (wfl
, "Class `%s' not found in type declaration",
9338 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
9339 PATCH_METHOD_RETURN_ERROR ();
9342 /* Can't instantiate an abstract class, but we can
9343 invoke it's constructor. It's use within the `new'
9344 context is denied here. */
9345 if (CLASS_ABSTRACT (class_to_search
)
9346 && TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9349 (wfl
, "Class `%s' is an abstract class. It can't be "
9350 "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
9351 PATCH_METHOD_RETURN_ERROR ();
9353 class_to_search
= TREE_TYPE (class_to_search
);
9356 class_to_search
= current_class
;
9359 /* This is a regular search in the local class, unless an
9360 alternate class is specified. */
9363 class_to_search
= (where
? where
: current_class
);
9367 /* NAME is a simple identifier or comes from a primary. Search
9368 in the class whose declaration contain the method being
9370 resolve_and_layout (class_to_search
, NULL_TREE
);
9371 list
= lookup_method_invoke (lc
, wfl
, class_to_search
, name
, args
);
9373 /* Don't continue if no method were found, as the next statement
9374 can't be executed then. */
9376 PATCH_METHOD_RETURN_ERROR ();
9378 /* Check for static reference if non static methods */
9379 if (check_for_static_method_reference (wfl
, patch
, list
,
9380 class_to_search
, primary
))
9381 PATCH_METHOD_RETURN_ERROR ();
9383 /* Non static methods are called with the current object extra
9384 argument. If patch a `new TYPE()', the argument is the value
9385 returned by the object allocator. If method is resolved as a
9386 primary, use the primary otherwise use the current THIS. */
9387 args
= nreverse (args
);
9388 if (!METHOD_STATIC (list
) && TREE_CODE (patch
) != NEW_CLASS_EXPR
)
9389 args
= tree_cons (NULL_TREE
, primary
? primary
: current_this
, args
);
9392 /* Merge point of all resolution schemes. If we have nothing, this
9393 is an error, already signaled */
9395 PATCH_METHOD_RETURN_ERROR ();
9397 /* Check accessibility, position the is_static flag, build and
9399 if (not_accessible_p (DECL_CONTEXT (current_function_decl
), list
, 0))
9401 char *fct_name
= strdup (lang_printable_name (list
, 0));
9403 (wfl
, "Can't access %s method `%s %s.%s' from `%s'",
9404 java_accstring_lookup (get_access_flags_from_decl (list
)),
9405 lang_printable_name (TREE_TYPE (TREE_TYPE (list
)), 0),
9406 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list
)))),
9407 fct_name
, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))));
9409 PATCH_METHOD_RETURN_ERROR ();
9411 check_deprecation (wfl
, list
);
9413 is_static_flag
= METHOD_STATIC (list
);
9415 /* In the context of an explicit constructor invocation, we can't
9416 invoke any method relying on `this'. Exceptions are: we're
9417 invoking a static function, primary exists and is not the current
9418 this, we're creating a new object. */
9419 if (ctxp
->explicit_constructor_p
9421 && (!primary
|| primary
== current_this
)
9422 && (TREE_CODE (patch
) != NEW_CLASS_EXPR
))
9425 (wfl
, "Can't reference `this' before the superclass constructor has "
9427 PATCH_METHOD_RETURN_ERROR ();
9429 java_parser_context_restore_global ();
9431 *is_static
= is_static_flag
;
9432 /* Sometimes, we want the decl of the selected method. Such as for
9436 patch
= patch_invoke (patch
, list
, args
);
9437 if (is_super_init
&& CLASS_HAS_FINIT_P (current_class
))
9439 /* Generate the code used to initialize fields declared with an
9440 initialization statement. For now, it returns a call the the
9441 artificial function $finit$, if required. */
9444 build_method_invocation (build_expr_wfl (finit_identifier_node
,
9445 input_filename
, 0, 0),
9447 patch
= build (COMPOUND_EXPR
, void_type_node
, patch
,
9448 java_complete_tree (finit_call
));
9449 CAN_COMPLETE_NORMALLY (patch
) = 1;
9454 /* Check that we're not trying to do a static reference to a method in
9455 non static method. Return 1 if it's the case, 0 otherwise. */
9458 check_for_static_method_reference (wfl
, node
, method
, where
, primary
)
9459 tree wfl
, node
, method
, where
, primary
;
9461 if (METHOD_STATIC (current_function_decl
)
9462 && !METHOD_STATIC (method
) && !primary
&& !CALL_CONSTRUCTOR_P (node
))
9464 char *fct_name
= strdup (lang_printable_name (method
, 0));
9466 (wfl
, "Can't make static reference to method `%s %s' in class `%s'",
9467 lang_printable_name (TREE_TYPE (TREE_TYPE (method
)), 0), fct_name
,
9468 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where
))));
9475 /* Patch an invoke expression METHOD and ARGS, based on its invocation
9479 patch_invoke (patch
, method
, args
)
9480 tree patch
, method
, args
;
9483 tree original_call
, t
, ta
;
9485 /* Last step for args: convert build-in types. If we're dealing with
9486 a new TYPE() type call, the first argument to the constructor
9487 isn't found in the incomming argument list, but delivered by
9489 t
= TYPE_ARG_TYPES (TREE_TYPE (method
));
9490 if (TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9492 for (ta
= args
; t
!= end_params_node
&& ta
;
9493 t
= TREE_CHAIN (t
), ta
= TREE_CHAIN (ta
))
9494 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta
))) &&
9495 TREE_TYPE (TREE_VALUE (ta
)) != TREE_VALUE (t
))
9496 TREE_VALUE (ta
) = convert (TREE_VALUE (t
), TREE_VALUE (ta
));
9498 if (flag_emit_class_files
)
9502 tree signature
= build_java_signature (TREE_TYPE (method
));
9503 switch (invocation_mode (method
, CALL_USING_SUPER (patch
)))
9505 case INVOKE_VIRTUAL
:
9506 dtable
= invoke_build_dtable (0, args
);
9507 func
= build_invokevirtual (dtable
, method
);
9512 func
= build_known_method_ref (method
, TREE_TYPE (method
),
9513 DECL_CONTEXT (method
),
9517 case INVOKE_INTERFACE
:
9518 dtable
= invoke_build_dtable (1, args
);
9519 func
= build_invokeinterface (dtable
, DECL_NAME (method
), signature
);
9523 fatal ("internal error - unknown invocation_mode result");
9526 /* Ensure self_type is initialized, (invokestatic). FIXME */
9527 func
= build1 (NOP_EXPR
, build_pointer_type (TREE_TYPE (method
)), func
);
9530 TREE_TYPE (patch
) = TREE_TYPE (TREE_TYPE (method
));
9531 TREE_OPERAND (patch
, 0) = func
;
9532 TREE_OPERAND (patch
, 1) = args
;
9533 original_call
= patch
;
9535 /* We're processing a `new TYPE ()' form. New is called an its
9536 returned value is the first argument to the constructor. We build
9537 a COMPOUND_EXPR and use saved expression so that the overall NEW
9538 expression value is a pointer to a newly created and initialized
9540 if (TREE_CODE (original_call
) == NEW_CLASS_EXPR
)
9542 tree
class = DECL_CONTEXT (method
);
9543 tree c1
, saved_new
, size
, new;
9544 if (flag_emit_class_files
)
9546 TREE_TYPE (patch
) = build_pointer_type (class);
9549 if (!TYPE_SIZE (class))
9550 safe_layout_class (class);
9551 size
= size_in_bytes (class);
9552 new = build (CALL_EXPR
, promote_type (class),
9553 build_address_of (alloc_object_node
),
9554 tree_cons (NULL_TREE
, build_class_ref (class),
9555 build_tree_list (NULL_TREE
,
9556 size_in_bytes (class))),
9558 saved_new
= save_expr (new);
9559 c1
= build_tree_list (NULL_TREE
, saved_new
);
9560 TREE_CHAIN (c1
) = TREE_OPERAND (original_call
, 1);
9561 TREE_OPERAND (original_call
, 1) = c1
;
9562 TREE_SET_CODE (original_call
, CALL_EXPR
);
9563 patch
= build (COMPOUND_EXPR
, TREE_TYPE (new), patch
, saved_new
);
9569 invocation_mode (method
, super
)
9573 int access
= get_access_flags_from_decl (method
);
9576 return INVOKE_SUPER
;
9578 if (access
& ACC_STATIC
|| access
& ACC_FINAL
|| access
& ACC_PRIVATE
)
9579 return INVOKE_STATIC
;
9581 if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method
))))
9582 return INVOKE_STATIC
;
9584 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method
))))
9585 return INVOKE_INTERFACE
;
9587 if (DECL_CONSTRUCTOR_P (method
))
9588 return INVOKE_STATIC
;
9590 return INVOKE_VIRTUAL
;
9593 /* Retrieve a refined list of matching methods. It covers the step
9594 15.11.2 (Compile-Time Step 2) */
9597 lookup_method_invoke (lc
, cl
, class, name
, arg_list
)
9600 tree
class, name
, arg_list
;
9602 tree atl
= end_params_node
; /* Arg Type List */
9603 tree method
, signature
, list
, node
;
9604 char *candidates
; /* Used for error report */
9606 /* Fix the arguments */
9607 for (node
= arg_list
; node
; node
= TREE_CHAIN (node
))
9609 tree current_arg
= TREE_VALUE (node
);
9610 /* Integer constant 0 passed as itself, not as a type */
9611 if (current_arg
!= integer_zero_node
)
9612 current_arg
= TREE_TYPE (TREE_VALUE (node
));
9613 /* Non primitive type may have to be resolved */
9614 if (current_arg
!= integer_zero_node
9615 && !JPRIMITIVE_TYPE_P (current_arg
))
9616 resolve_and_layout (current_arg
, NULL_TREE
);
9618 if (TREE_CODE (current_arg
) == RECORD_TYPE
)
9619 current_arg
= promote_type (current_arg
);
9620 atl
= tree_cons (NULL_TREE
, current_arg
, atl
);
9623 /* Find all candidates and then refine the list, searching for the
9624 most specific method. */
9625 list
= find_applicable_accessible_methods_list (lc
, class, name
, atl
);
9626 list
= find_most_specific_methods_list (list
);
9627 if (list
&& !TREE_CHAIN (list
))
9628 return TREE_VALUE (list
);
9630 /* Issue an error. List candidates if any. Candidates are listed
9631 only if accessible (non accessible methods may end-up here for
9632 the sake of a better error report). */
9637 obstack_grow (&temporary_obstack
, ". Candidates are:\n", 18);
9638 for (current
= list
; current
; current
= TREE_CHAIN (current
))
9640 tree cm
= TREE_VALUE (current
);
9642 if (!cm
|| not_accessible_p (class, cm
, 0))
9645 (string
, " `%s' in `%s'%s",
9646 get_printable_method_name (cm
),
9647 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm
)))),
9648 (TREE_CHAIN (current
) ? "\n" : ""));
9649 obstack_grow (&temporary_obstack
, string
, strlen (string
));
9651 obstack_1grow (&temporary_obstack
, '\0');
9652 candidates
= obstack_finish (&temporary_obstack
);
9654 /* Issue the error message */
9655 for (node
= atl
; node
; node
= TREE_CHAIN (node
))
9656 if (TREE_VALUE (node
) == integer_zero_node
)
9657 TREE_VALUE (node
) = long_type_node
;
9658 method
= make_node (FUNCTION_TYPE
);
9659 TYPE_ARG_TYPES (method
) = atl
;
9660 signature
= build_java_argument_signature (method
);
9661 parse_error_context (cl
, "Can't find %s `%s(%s)' in class `%s'%s",
9662 (lc
? "constructor" : "method"),
9664 IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) :
9665 IDENTIFIER_POINTER (name
)),
9666 IDENTIFIER_POINTER (signature
),
9667 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
9668 (candidates
? candidates
: ""));
9672 /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
9673 when we're looking for a constructor. */
9676 find_applicable_accessible_methods_list (lc
, class, name
, arglist
)
9678 tree
class, name
, arglist
;
9681 tree list
= NULL_TREE
, all_list
= NULL_TREE
;
9683 while (class != NULL_TREE
)
9685 for (method
= TYPE_METHODS (class);
9686 method
!= NULL_TREE
; method
= TREE_CHAIN (method
))
9688 if (lc
&& !DECL_CONSTRUCTOR_P (method
))
9690 else if (!lc
&& (DECL_CONSTRUCTOR_P (method
)
9691 || (GET_METHOD_NAME (method
) != name
)))
9694 if (argument_types_convertible (method
, arglist
))
9696 /* Retain accessible methods only */
9697 if (!not_accessible_p (DECL_CONTEXT (current_function_decl
),
9699 list
= tree_cons (NULL_TREE
, method
, list
);
9701 /* Also retain all selected method here */
9702 all_list
= tree_cons (NULL_TREE
, method
, list
);
9705 /* When dealing with constructor, stop here, otherwise search
9707 class = (lc
? NULL_TREE
: CLASSTYPE_SUPER (class));
9709 /* Either return the list obtained or all selected (but
9710 inaccessible) methods for better error report. */
9711 return (!list
? all_list
: list
);
9714 /* 15.11.2.2 Choose the Most Specific Method */
9717 find_most_specific_methods_list (list
)
9721 tree current
, new_list
= NULL_TREE
;
9722 for (current
= list
; current
; current
= TREE_CHAIN (current
))
9725 DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) = 0;
9727 for (method
= list
; method
; method
= TREE_CHAIN (method
))
9729 /* Don't test a method against itself */
9730 if (method
== current
)
9733 /* Compare arguments and location where method where declared */
9734 if (argument_types_convertible (TREE_VALUE (method
),
9735 TREE_VALUE (current
))
9736 && valid_method_invocation_conversion_p
9737 (DECL_CONTEXT (TREE_VALUE (method
)),
9738 DECL_CONTEXT (TREE_VALUE (current
))))
9740 int v
= ++DECL_SPECIFIC_COUNT (TREE_VALUE (current
));
9741 max
= (v
> max
? v
: max
);
9746 /* Review the list and select the maximally specific methods */
9747 for (current
= list
; current
; current
= TREE_CHAIN (current
))
9748 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) == max
)
9749 new_list
= tree_cons (NULL_TREE
, TREE_VALUE (current
), new_list
);
9751 /* If we can't find one, lower expectations and try to gather multiple
9752 maximally specific methods */
9757 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) == max
)
9758 new_list
= tree_cons (NULL_TREE
, TREE_VALUE (current
), new_list
);
9766 /* Make sure that the type of each M2_OR_ARGLIST arguments can be
9767 converted by method invocation conversion (5.3) to the type of the
9768 corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
9769 to change less often than M1. */
9772 argument_types_convertible (m1
, m2_or_arglist
)
9773 tree m1
, m2_or_arglist
;
9775 static tree m2_arg_value
= NULL_TREE
;
9776 static tree m2_arg_cache
= NULL_TREE
;
9778 register tree m1_arg
, m2_arg
;
9780 m1_arg
= TYPE_ARG_TYPES (TREE_TYPE (m1
));
9781 if (!METHOD_STATIC (m1
))
9782 m1_arg
= TREE_CHAIN (m1_arg
);
9784 if (m2_arg_value
== m2_or_arglist
)
9785 m2_arg
= m2_arg_cache
;
9788 /* M2_OR_ARGLIST can be a function DECL or a raw list of
9790 if (m2_or_arglist
&& TREE_CODE (m2_or_arglist
) == FUNCTION_DECL
)
9792 m2_arg
= TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist
));
9793 if (!METHOD_STATIC (m2_or_arglist
))
9794 m2_arg
= TREE_CHAIN (m2_arg
);
9797 m2_arg
= m2_or_arglist
;
9799 m2_arg_value
= m2_or_arglist
;
9800 m2_arg_cache
= m2_arg
;
9803 while (m1_arg
!= end_params_node
&& m2_arg
!= end_params_node
)
9805 resolve_and_layout (TREE_VALUE (m1_arg
), NULL_TREE
);
9806 if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg
),
9807 TREE_VALUE (m2_arg
)))
9809 m1_arg
= TREE_CHAIN (m1_arg
);
9810 m2_arg
= TREE_CHAIN (m2_arg
);
9812 return m1_arg
== end_params_node
&& m2_arg
== end_params_node
;
9815 /* Qualification routines */
9818 qualify_ambiguous_name (id
)
9821 tree qual
, qual_wfl
, name
, decl
, ptr_type
, saved_current_class
;
9822 int again
, super_found
= 0, this_found
= 0;
9824 /* We first qualify the first element, then derive qualification of
9825 others based on the first one. If the first element is qualified
9826 by a resolution (field or type), this resolution is stored in the
9827 QUAL_RESOLUTION of the qual element being examined. We need to
9828 save the current_class since the use of SUPER might change the
9830 saved_current_class
= current_class
;
9831 qual
= EXPR_WFL_QUALIFICATION (id
);
9834 /* Simple qualified expression feature a qual_wfl that is a
9835 WFL. Expression derived from a primary feature more complicated
9836 things like a CALL_EXPR. Expression from primary need to be
9837 worked out to extract the part on which the qualification will
9839 qual_wfl
= QUAL_WFL (qual
);
9840 switch (TREE_CODE (qual_wfl
))
9843 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
9844 if (TREE_CODE (qual_wfl
) != EXPR_WITH_FILE_LOCATION
)
9846 qual
= EXPR_WFL_QUALIFICATION (qual_wfl
);
9847 qual_wfl
= QUAL_WFL (qual
);
9850 case NEW_CLASS_EXPR
:
9852 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
9855 while (TREE_CODE (qual_wfl
) == ARRAY_REF
)
9856 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
9859 /* Fix for -Wall. Just break doing nothing */
9862 name
= EXPR_WFL_NODE (qual_wfl
);
9863 ptr_type
= current_class
;
9865 /* If we have a THIS (from a primary), we set the context accordingly */
9866 if (name
== this_identifier_node
)
9868 qual
= TREE_CHAIN (qual
);
9869 qual_wfl
= QUAL_WFL (qual
);
9870 if (TREE_CODE (qual_wfl
) == CALL_EXPR
)
9873 name
= EXPR_WFL_NODE (qual_wfl
);
9876 /* If we have a SUPER, we set the context accordingly */
9877 if (name
== super_identifier_node
)
9879 current_class
= CLASSTYPE_SUPER (ptr_type
);
9880 /* Check that there is such a thing as a super class. If not,
9881 return. The error will be caught later on, during the
9885 current_class
= saved_current_class
;
9888 qual
= TREE_CHAIN (qual
);
9889 /* Do one more interation to set things up */
9890 super_found
= again
= 1;
9892 /* Loop one more time if we're dealing with ?: or a string constant */
9893 if (TREE_CODE (qual_wfl
) == CONDITIONAL_EXPR
9894 || TREE_CODE (qual_wfl
) == STRING_CST
)
9896 qual
= TREE_CHAIN (qual
);
9897 qual_wfl
= QUAL_WFL (qual
);
9902 /* If name appears within the scope of a location variable
9903 declaration or parameter declaration, then it is an expression
9904 name. We don't carry this test out if we're in the context of the
9905 use of SUPER or THIS */
9907 if (!this_found
&& !super_found
&& (decl
= IDENTIFIER_LOCAL_VALUE (name
)))
9909 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
9910 QUAL_RESOLUTION (qual
) = decl
;
9913 /* If within the class/interface NAME was found to be used there
9914 exists a (possibly inherited) field named NAME, then this is an
9916 else if ((decl
= lookup_field_wrapper (ptr_type
, name
)))
9918 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
9919 QUAL_RESOLUTION (qual
) = decl
;
9922 /* We reclassify NAME as a type name if:
9923 - NAME is a class/interface declared within the compilation
9924 unit containing NAME,
9925 - NAME is imported via a single-type-import declaration,
9926 - NAME is declared in an another compilation unit of the package
9927 of the compilation unit containing NAME,
9928 - NAME is declared by exactly on type-import-on-demand declaration
9929 of the compilation unit containing NAME. */
9930 else if ((decl
= resolve_and_layout (name
, NULL_TREE
)))
9932 RESOLVE_TYPE_NAME_P (qual_wfl
) = 1;
9933 QUAL_RESOLUTION (qual
) = decl
;
9936 /* Method call are expression name */
9937 else if (TREE_CODE (QUAL_WFL (qual
)) == CALL_EXPR
9938 || TREE_CODE (QUAL_WFL (qual
)) == ARRAY_REF
)
9939 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
9941 /* Check here that NAME isn't declared by more than one
9942 type-import-on-demand declaration of the compilation unit
9943 containing NAME. FIXME */
9945 /* Otherwise, NAME is reclassified as a package name */
9947 RESOLVE_PACKAGE_NAME_P (qual_wfl
) = 1;
9949 /* Propagate the qualification accross other components of the
9951 for (qual
= TREE_CHAIN (qual
); qual
;
9952 qual_wfl
= QUAL_WFL (qual
), qual
= TREE_CHAIN (qual
))
9954 if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
9955 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual
)) = 1;
9957 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual
)) = 1;
9960 /* Store the global qualification for the ambiguous part of ID back
9962 if (RESOLVE_EXPRESSION_NAME_P (qual_wfl
))
9963 RESOLVE_EXPRESSION_NAME_P (id
) = 1;
9964 else if (RESOLVE_TYPE_NAME_P (qual_wfl
))
9965 RESOLVE_TYPE_NAME_P (id
) = 1;
9966 else if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
9967 RESOLVE_PACKAGE_NAME_P (id
) = 1;
9969 /* Restore the current class */
9970 current_class
= saved_current_class
;
9974 breakdown_qualified (left
, right
, source
)
9975 tree
*left
, *right
, source
;
9977 char *p
= IDENTIFIER_POINTER (source
), *base
;
9978 int l
= IDENTIFIER_LENGTH (source
);
9980 /* Breakdown NAME into REMAINDER . IDENTIFIER */
9983 while (*p
!= '.' && p
!= base
)
9986 /* We didn't find a '.'. Return an error */
9992 *right
= get_identifier (p
+1);
9993 *left
= get_identifier (IDENTIFIER_POINTER (source
));
9999 /* Patch tree nodes in a function body. When a BLOCK is found, push
10000 local variable decls if present.
10001 Same as java_complete_lhs, but does resolve static finals to values. */
10004 java_complete_tree (node
)
10007 node
= java_complete_lhs (node
);
10008 if (TREE_CODE (node
) == VAR_DECL
&& FIELD_STATIC (node
)
10009 && FIELD_FINAL (node
) && DECL_INITIAL (node
) != NULL_TREE
)
10011 tree value
= DECL_INITIAL (node
);
10012 DECL_INITIAL (node
) = NULL_TREE
;
10013 value
= fold_constant_for_init (value
, node
);
10014 DECL_INITIAL (node
) = value
;
10015 if (value
!= NULL_TREE
)
10021 /* Patch tree nodes in a function body. When a BLOCK is found, push
10022 local variable decls if present.
10023 Same as java_complete_tree, but does not resolve static finals to values. */
10026 java_complete_lhs (node
)
10029 tree nn
, cn
, wfl_op1
, wfl_op2
, wfl_op3
;
10032 /* CONVERT_EXPR always has its type set, even though it needs to be
10034 if (TREE_TYPE (node
) && TREE_CODE (node
) != CONVERT_EXPR
)
10037 /* The switch block implements cases processing container nodes
10038 first. Contained nodes are always written back. Leaves come
10039 next and return a value. */
10040 switch (TREE_CODE (node
))
10044 /* 1- Block section.
10045 Set the local values on decl names so we can identify them
10046 faster when they're referenced. At that stage, identifiers
10047 are legal so we don't check for declaration errors. */
10048 for (cn
= BLOCK_EXPR_DECLS (node
); cn
; cn
= TREE_CHAIN (cn
))
10050 DECL_CONTEXT (cn
) = current_function_decl
;
10051 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn
)) = cn
;
10052 INITIALIZED_P (cn
) = 0;
10054 if (BLOCK_EXPR_BODY (node
) == NULL_TREE
)
10055 CAN_COMPLETE_NORMALLY (node
) = 1;
10058 tree stmt
= BLOCK_EXPR_BODY (node
);
10060 int error_seen
= 0;
10061 if (TREE_CODE (stmt
) == COMPOUND_EXPR
)
10063 /* Re-order from (((A; B); C); ...; Z) to
10064 (A; (B; (C ; (...; Z)))).
10065 This makes it easier to scan the statements left-to-right
10066 without using recursion (which might overflow the stack
10067 if the block has many statements. */
10070 tree left
= TREE_OPERAND (stmt
, 0);
10071 if (TREE_CODE (left
) != COMPOUND_EXPR
)
10073 TREE_OPERAND (stmt
, 0) = TREE_OPERAND (left
, 1);
10074 TREE_OPERAND (left
, 1) = stmt
;
10077 BLOCK_EXPR_BODY (node
) = stmt
;
10080 /* Now do the actual complete, without deep recursion for
10082 ptr
= &BLOCK_EXPR_BODY (node
);
10083 while (TREE_CODE (*ptr
) == COMPOUND_EXPR
)
10085 tree cur
= java_complete_tree (TREE_OPERAND (*ptr
, 0));
10086 tree
*next
= &TREE_OPERAND (*ptr
, 1);
10087 TREE_OPERAND (*ptr
, 0) = cur
;
10088 if (TREE_CODE (cur
) == ERROR_MARK
)
10090 else if (! CAN_COMPLETE_NORMALLY (cur
))
10095 if (TREE_CODE (wfl_op2
) == BLOCK
)
10096 wfl_op2
= BLOCK_EXPR_BODY (wfl_op2
);
10097 else if (TREE_CODE (wfl_op2
) == COMPOUND_EXPR
)
10098 wfl_op2
= TREE_OPERAND (wfl_op2
, 0);
10102 if (TREE_CODE (wfl_op2
) != CASE_EXPR
10103 && TREE_CODE (wfl_op2
) != DEFAULT_EXPR
10104 && wfl_op2
!= empty_stmt_node
)
10105 unreachable_stmt_error (*ptr
);
10109 *ptr
= java_complete_tree (*ptr
);
10111 if (TREE_CODE (*ptr
) == ERROR_MARK
|| error_seen
> 0)
10112 return error_mark_node
;
10113 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (*ptr
);
10115 /* Turn local bindings to null */
10116 for (cn
= BLOCK_EXPR_DECLS (node
); cn
; cn
= TREE_CHAIN (cn
))
10117 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn
)) = NULL_TREE
;
10119 TREE_TYPE (node
) = void_type_node
;
10122 /* 2- They are expressions but ultimately deal with statements */
10125 wfl_op1
= TREE_OPERAND (node
, 0);
10126 COMPLETE_CHECK_OP_0 (node
);
10127 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10128 return patch_throw_statement (node
, wfl_op1
);
10130 case SYNCHRONIZED_EXPR
:
10131 wfl_op1
= TREE_OPERAND (node
, 0);
10132 COMPLETE_CHECK_OP_0 (node
);
10133 COMPLETE_CHECK_OP_1 (node
);
10134 return patch_synchronized_statement (node
, wfl_op1
);
10137 return patch_try_statement (node
);
10139 case LABELED_BLOCK_EXPR
:
10140 PUSH_LABELED_BLOCK (node
);
10141 if (LABELED_BLOCK_BODY (node
))
10142 COMPLETE_CHECK_OP_1 (node
);
10143 TREE_TYPE (node
) = void_type_node
;
10144 POP_LABELED_BLOCK ();
10145 if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node
)))
10146 CAN_COMPLETE_NORMALLY (node
) = 1;
10149 case EXIT_BLOCK_EXPR
:
10150 /* We don't complete operand 1, because it's the return value of
10151 the EXIT_BLOCK_EXPR which doesn't exist it Java */
10152 return patch_bc_statement (node
);
10155 cn
= java_complete_tree (TREE_OPERAND (node
, 0));
10156 if (cn
== error_mark_node
)
10159 /* First, the case expression must be constant */
10162 if (!TREE_CONSTANT (cn
))
10164 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10165 parse_error_context (node
, "Constant expression required");
10166 return error_mark_node
;
10169 nn
= ctxp
->current_loop
;
10171 /* It must be assignable to the type of the switch expression. */
10172 if (!try_builtin_assignconv (NULL_TREE
,
10173 TREE_TYPE (TREE_OPERAND (nn
, 0)), cn
))
10175 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10176 parse_error_context
10178 "Incompatible type for case. Can't convert `%s' to `int'",
10179 lang_printable_name (TREE_TYPE (cn
), 0));
10180 return error_mark_node
;
10183 cn
= fold (convert (int_type_node
, cn
));
10185 /* Multiple instance of a case label bearing the same
10186 value is checked during code generation. The case
10187 expression is allright so far. */
10188 TREE_OPERAND (node
, 0) = cn
;
10189 TREE_TYPE (node
) = void_type_node
;
10190 CAN_COMPLETE_NORMALLY (node
) = 1;
10191 TREE_SIDE_EFFECTS (node
) = 1;
10195 nn
= ctxp
->current_loop
;
10196 /* Only one default label is allowed per switch statement */
10197 if (SWITCH_HAS_DEFAULT (nn
))
10199 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10200 parse_error_context (wfl_operator
,
10201 "Duplicate case label: `default'");
10202 return error_mark_node
;
10205 SWITCH_HAS_DEFAULT (nn
) = 1;
10206 TREE_TYPE (node
) = void_type_node
;
10207 TREE_SIDE_EFFECTS (node
) = 1;
10208 CAN_COMPLETE_NORMALLY (node
) = 1;
10214 /* Check whether the loop was enclosed in a labeled
10215 statement. If not, create one, insert the loop in it and
10217 nn
= patch_loop_statement (node
);
10219 /* Anyways, walk the body of the loop */
10220 if (TREE_CODE (node
) == LOOP_EXPR
)
10221 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10222 /* Switch statement: walk the switch expression and the cases */
10224 node
= patch_switch_statement (node
);
10226 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10227 return error_mark_node
;
10228 TREE_TYPE (nn
) = TREE_TYPE (node
) = void_type_node
;
10229 /* If we returned something different, that's because we
10230 inserted a label. Pop the label too. */
10233 if (CAN_COMPLETE_NORMALLY (node
))
10234 CAN_COMPLETE_NORMALLY (nn
) = 1;
10235 POP_LABELED_BLOCK ();
10241 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10242 return patch_exit_expr (node
);
10246 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10247 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10248 return error_mark_node
;
10249 /* then-else branches */
10250 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
10251 if (TREE_OPERAND (node
, 1) == error_mark_node
)
10252 return error_mark_node
;
10253 TREE_OPERAND (node
, 2) = java_complete_tree (TREE_OPERAND (node
, 2));
10254 if (TREE_OPERAND (node
, 2) == error_mark_node
)
10255 return error_mark_node
;
10256 return patch_if_else_statement (node
);
10259 case CONDITIONAL_EXPR
:
10261 wfl_op1
= TREE_OPERAND (node
, 0);
10262 COMPLETE_CHECK_OP_0 (node
);
10263 wfl_op2
= TREE_OPERAND (node
, 1);
10264 COMPLETE_CHECK_OP_1 (node
);
10265 wfl_op3
= TREE_OPERAND (node
, 2);
10266 COMPLETE_CHECK_OP_2 (node
);
10267 return patch_conditional_expr (node
, wfl_op1
, wfl_op2
);
10269 /* 3- Expression section */
10270 case COMPOUND_EXPR
:
10271 wfl_op2
= TREE_OPERAND (node
, 1);
10272 TREE_OPERAND (node
, 0) = nn
=
10273 java_complete_tree (TREE_OPERAND (node
, 0));
10274 if (! CAN_COMPLETE_NORMALLY (nn
) && TREE_CODE (nn
) != ERROR_MARK
10275 && TREE_OPERAND (node
, 1) != empty_stmt_node
)
10277 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op2
);
10278 parse_error_context (wfl_operator
, "Unreachable statement");
10280 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
10281 if (TREE_OPERAND (node
, 1) == error_mark_node
)
10282 return error_mark_node
;
10283 TREE_TYPE (node
) = TREE_TYPE (TREE_OPERAND (node
, 1));
10284 CAN_COMPLETE_NORMALLY (node
)
10285 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1));
10289 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10290 return patch_return (node
);
10292 case EXPR_WITH_FILE_LOCATION
:
10293 if (!EXPR_WFL_NODE (node
) /* Or a PRIMARY flag ? */
10294 || TREE_CODE (EXPR_WFL_NODE (node
)) == IDENTIFIER_NODE
)
10296 node
= resolve_expression_name (node
, NULL
);
10297 CAN_COMPLETE_NORMALLY (node
) = 1;
10302 int save_lineno
= lineno
;
10303 lineno
= EXPR_WFL_LINENO (node
);
10304 body
= java_complete_tree (EXPR_WFL_NODE (node
));
10305 lineno
= save_lineno
;
10306 EXPR_WFL_NODE (node
) = body
;
10307 TREE_SIDE_EFFECTS (node
) = 1;
10308 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (body
);
10309 if (EXPR_WFL_NODE (node
) == error_mark_node
)
10311 /* Its important for the evaluation of assignment that
10312 this mark on the TREE_TYPE is propagated. */
10313 TREE_TYPE (node
) = error_mark_node
;
10314 return error_mark_node
;
10317 TREE_TYPE (node
) = TREE_TYPE (EXPR_WFL_NODE (node
));
10322 case NEW_ARRAY_EXPR
:
10323 /* Patch all the dimensions */
10325 for (cn
= TREE_OPERAND (node
, 1); cn
; cn
= TREE_CHAIN (cn
))
10327 int location
= EXPR_WFL_LINECOL (TREE_VALUE (cn
));
10328 tree dim
= java_complete_tree (TREE_VALUE (cn
));
10329 if (dim
== error_mark_node
)
10336 TREE_VALUE (cn
) = dim
;
10337 /* Setup the location of the current dimension, for
10338 later error report. */
10339 TREE_PURPOSE (cn
) =
10340 build_expr_wfl (NULL_TREE
, input_filename
, 0, 0);
10341 EXPR_WFL_LINECOL (TREE_PURPOSE (cn
)) = location
;
10344 /* They complete the array creation expression, if no errors
10346 CAN_COMPLETE_NORMALLY (node
) = 1;
10347 return (flag
? error_mark_node
: patch_newarray (node
));
10349 case NEW_CLASS_EXPR
:
10351 /* Complete function's argument(s) first */
10352 if (complete_function_arguments (node
))
10353 return error_mark_node
;
10356 tree decl
, wfl
= TREE_OPERAND (node
, 0);
10357 int in_this
= CALL_THIS_CONSTRUCTOR_P (node
);
10359 node
= patch_method_invocation (node
, NULL_TREE
,
10360 NULL_TREE
, 0, &decl
);
10361 if (node
== error_mark_node
)
10362 return error_mark_node
;
10364 check_thrown_exceptions (EXPR_WFL_LINECOL (node
), decl
);
10365 /* If we call this(...), register signature and positions */
10367 DECL_CONSTRUCTOR_CALLS (current_function_decl
) =
10368 tree_cons (wfl
, decl
,
10369 DECL_CONSTRUCTOR_CALLS (current_function_decl
));
10370 CAN_COMPLETE_NORMALLY (node
) = 1;
10375 /* Save potential wfls */
10376 wfl_op1
= TREE_OPERAND (node
, 0);
10377 wfl_op2
= TREE_OPERAND (node
, 1);
10378 TREE_OPERAND (node
, 0) = java_complete_lhs (wfl_op1
);
10379 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10380 return error_mark_node
;
10382 if (COMPOUND_ASSIGN_P (wfl_op2
))
10386 java_complete_tree (TREE_OPERAND (wfl_op2
, 0));
10388 /* Hand stablize the lhs on both places */
10389 lvalue
= stabilize_reference (other
);
10390 TREE_OPERAND (node
, 0) = lvalue
;
10391 TREE_OPERAND (TREE_OPERAND (node
, 1), 0) = lvalue
;
10394 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
10395 function to complete this RHS */
10396 if (TREE_CODE (wfl_op2
) == NEW_ARRAY_INIT
)
10397 nn
= patch_new_array_init (TREE_TYPE (TREE_OPERAND (node
, 0)),
10398 TREE_OPERAND (node
, 1));
10400 nn
= java_complete_tree (TREE_OPERAND (node
, 1));
10402 /* There are cases where the type of RHS is fixed. In those
10403 cases, if the evaluation of the RHS fails, we further the
10404 evaluation of the assignment to detect more errors. */
10405 if (nn
== error_mark_node
)
10407 /* It's hopeless, but we can further things on to discover
10408 an error during the assignment. In any cases, the
10409 assignment operation fails. */
10410 if (TREE_CODE (TREE_OPERAND (node
, 1)) != EXPR_WITH_FILE_LOCATION
10411 && TREE_CODE (TREE_OPERAND (node
, 1)) != NEW_ARRAY_INIT
10412 && TREE_TYPE (TREE_OPERAND (node
, 1)) != error_mark_node
)
10413 patch_assignment (node
, wfl_op1
, wfl_op2
);
10415 /* Now, we still mark the lhs as initialized */
10416 if (DECL_P (TREE_OPERAND (node
, 0)))
10417 INITIALIZED_P (TREE_OPERAND (node
, 0)) = 1;
10419 return error_mark_node
;
10421 TREE_OPERAND (node
, 1) = nn
;
10423 /* In case we're handling = with a String as a RHS, we need to
10424 produce a String out of the RHS (it might still be a
10425 STRING_CST or a StringBuffer at this stage */
10426 if ((nn
= patch_string (TREE_OPERAND (node
, 1))))
10427 TREE_OPERAND (node
, 1) = nn
;
10428 node
= patch_assignment (node
, wfl_op1
, wfl_op2
);
10429 CAN_COMPLETE_NORMALLY (node
) = 1;
10431 /* Before returning the node, in the context of a static field
10432 assignment in <clinit>, we may want to carray further
10433 optimizations. (VAR_DECL means it's a static field. See
10435 if (DECL_NAME (current_function_decl
) == clinit_identifier_node
10436 && MODIFY_EXPR_FROM_INITIALIZATION_P (node
)
10437 && TREE_CODE (TREE_OPERAND (node
, 0)) == VAR_DECL
)
10438 node
= patch_initialized_static_field (node
);
10451 case TRUNC_MOD_EXPR
:
10453 case TRUTH_ANDIF_EXPR
:
10454 case TRUTH_ORIF_EXPR
:
10461 /* Operands 0 and 1 are WFL in certain cases only. patch_binop
10462 knows how to handle those cases. */
10463 wfl_op1
= TREE_OPERAND (node
, 0);
10464 wfl_op2
= TREE_OPERAND (node
, 1);
10466 CAN_COMPLETE_NORMALLY (node
) = 1;
10467 /* Don't complete string nodes if dealing with the PLUS operand. */
10468 if (TREE_CODE (node
) != PLUS_EXPR
|| !JSTRING_P (wfl_op1
))
10470 TREE_OPERAND (node
, 0) = java_complete_tree (wfl_op1
);
10471 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10472 return error_mark_node
;
10474 if (TREE_CODE (node
) != PLUS_EXPR
|| !JSTRING_P (wfl_op2
))
10476 TREE_OPERAND (node
, 1) = java_complete_tree (wfl_op2
);
10477 if (TREE_OPERAND (node
, 1) == error_mark_node
)
10478 return error_mark_node
;
10480 return patch_binop (node
, wfl_op1
, wfl_op2
);
10482 case INSTANCEOF_EXPR
:
10483 wfl_op1
= TREE_OPERAND (node
, 0);
10484 COMPLETE_CHECK_OP_0 (node
);
10485 return patch_binop (node
, wfl_op1
, TREE_OPERAND (node
, 1));
10487 case UNARY_PLUS_EXPR
:
10489 case TRUTH_NOT_EXPR
:
10491 case PREDECREMENT_EXPR
:
10492 case PREINCREMENT_EXPR
:
10493 case POSTDECREMENT_EXPR
:
10494 case POSTINCREMENT_EXPR
:
10496 /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
10497 how to handle those cases. */
10498 wfl_op1
= TREE_OPERAND (node
, 0);
10499 CAN_COMPLETE_NORMALLY (node
) = 1;
10500 TREE_OPERAND (node
, 0) = java_complete_tree (wfl_op1
);
10501 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10502 return error_mark_node
;
10503 node
= patch_unaryop (node
, wfl_op1
);
10504 CAN_COMPLETE_NORMALLY (node
) = 1;
10508 /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
10509 how to handle those cases. */
10510 wfl_op1
= TREE_OPERAND (node
, 0);
10511 TREE_OPERAND (node
, 0) = java_complete_tree (wfl_op1
);
10512 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10513 return error_mark_node
;
10514 if (!flag_emit_class_files
)
10515 TREE_OPERAND (node
, 0) = save_expr (TREE_OPERAND (node
, 0));
10516 /* The same applies to wfl_op2 */
10517 wfl_op2
= TREE_OPERAND (node
, 1);
10518 TREE_OPERAND (node
, 1) = java_complete_tree (wfl_op2
);
10519 if (TREE_OPERAND (node
, 1) == error_mark_node
)
10520 return error_mark_node
;
10521 if (!flag_emit_class_files
)
10522 TREE_OPERAND (node
, 1) = save_expr (TREE_OPERAND (node
, 1));
10523 return patch_array_ref (node
);
10528 case COMPONENT_REF
:
10529 /* The first step in the re-write of qualified name handling. FIXME.
10530 So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
10531 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10532 if (TREE_CODE (TREE_OPERAND (node
, 0)) == RECORD_TYPE
)
10534 tree name
= TREE_OPERAND (node
, 1);
10535 tree field
= lookup_field_wrapper (TREE_OPERAND (node
, 0), name
);
10536 if (field
== NULL_TREE
)
10538 error ("missing static field `%s'", IDENTIFIER_POINTER (name
));
10539 return error_mark_node
;
10541 if (! FIELD_STATIC (field
))
10543 error ("not a static field `%s'", IDENTIFIER_POINTER (name
));
10544 return error_mark_node
;
10549 fatal ("unimplemented java_complete_tree for COMPONENT_REF");
10553 /* Can't use THIS in a static environment */
10556 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10557 parse_error_context (wfl_operator
, "Keyword `this' used outside "
10558 "allowed context");
10559 TREE_TYPE (node
) = error_mark_node
;
10560 return error_mark_node
;
10562 if (ctxp
->explicit_constructor_p
)
10564 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10565 parse_error_context
10566 (wfl_operator
, "Can't reference `this' or `super' before the "
10567 "superclass constructor has been called");
10568 TREE_TYPE (node
) = error_mark_node
;
10569 return error_mark_node
;
10571 return current_this
;
10574 CAN_COMPLETE_NORMALLY (node
) = 1;
10575 /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
10576 and it's time to turn it into the appropriate String object
10578 if ((node
= patch_string (node
)))
10580 fatal ("No case for tree code `%s' - java_complete_tree\n",
10581 tree_code_name
[TREE_CODE (node
)]);
10586 /* Complete function call's argument. Return a non zero value is an
10587 error was found. */
10590 complete_function_arguments (node
)
10596 ctxp
->explicit_constructor_p
+= (CALL_THIS_CONSTRUCTOR_P (node
) ? 1 : 0);
10597 for (cn
= TREE_OPERAND (node
, 1); cn
; cn
= TREE_CHAIN (cn
))
10599 tree wfl
= TREE_VALUE (cn
), parm
, temp
;
10600 parm
= java_complete_tree (wfl
);
10601 if (parm
== error_mark_node
)
10606 /* If have a string literal that we haven't transformed yet or a
10607 crafted string buffer, as a result of use of the the String
10608 `+' operator. Build `parm.toString()' and expand it. */
10609 if ((temp
= patch_string (parm
)))
10611 /* Inline PRIMTYPE.TYPE read access */
10612 parm
= maybe_build_primttype_type_ref (parm
, wfl
);
10614 TREE_VALUE (cn
) = parm
;
10616 ctxp
->explicit_constructor_p
-= (CALL_THIS_CONSTRUCTOR_P (node
) ? 1 : 0);
10620 /* Sometimes (for loops and variable initialized during their
10621 declaration), we want to wrap a statement around a WFL and turn it
10625 build_debugable_stmt (location
, stmt
)
10629 if (TREE_CODE (stmt
) != EXPR_WITH_FILE_LOCATION
)
10631 stmt
= build_expr_wfl (stmt
, input_filename
, 0, 0);
10632 EXPR_WFL_LINECOL (stmt
) = location
;
10634 JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt
);
10639 build_expr_block (body
, decls
)
10642 tree node
= make_node (BLOCK
);
10643 BLOCK_EXPR_DECLS (node
) = decls
;
10644 BLOCK_EXPR_BODY (node
) = body
;
10646 TREE_TYPE (node
) = TREE_TYPE (body
);
10647 TREE_SIDE_EFFECTS (node
) = 1;
10651 /* Create a new function block and link it approriately to current
10652 function block chain */
10657 return (enter_a_block (build_expr_block (NULL_TREE
, NULL_TREE
)));
10660 /* Link block B supercontext to the previous block. The current
10661 function DECL is used as supercontext when enter_a_block is called
10662 for the first time for a given function. The current function body
10663 (DECL_FUNCTION_BODY) is set to be block B. */
10669 tree fndecl
= current_function_decl
;
10671 if (!DECL_FUNCTION_BODY (fndecl
))
10673 BLOCK_SUPERCONTEXT (b
) = fndecl
;
10674 DECL_FUNCTION_BODY (fndecl
) = b
;
10678 BLOCK_SUPERCONTEXT (b
) = DECL_FUNCTION_BODY (fndecl
);
10679 DECL_FUNCTION_BODY (fndecl
) = b
;
10684 /* Exit a block by changing the current function body
10685 (DECL_FUNCTION_BODY) to the current block super context, only if
10686 the block being exited isn't the method's top level one. */
10691 tree b
= DECL_FUNCTION_BODY (current_function_decl
);
10693 if (BLOCK_SUPERCONTEXT (b
) != current_function_decl
)
10694 DECL_FUNCTION_BODY (current_function_decl
) = BLOCK_SUPERCONTEXT (b
);
10699 /* Lookup for NAME in the nested function's blocks, all the way up to
10700 the current toplevel one. It complies with Java's local variable
10704 lookup_name_in_blocks (name
)
10707 tree b
= DECL_FUNCTION_BODY (current_function_decl
);
10709 while (b
!= current_function_decl
)
10713 /* Paranoid sanity check. To be removed */
10714 if (TREE_CODE (b
) != BLOCK
)
10715 fatal ("non block expr function body - lookup_name_in_blocks");
10717 for (current
= BLOCK_EXPR_DECLS (b
); current
;
10718 current
= TREE_CHAIN (current
))
10719 if (DECL_NAME (current
) == name
)
10721 b
= BLOCK_SUPERCONTEXT (b
);
10727 maybe_absorb_scoping_blocks ()
10729 while (BLOCK_EXPR_ORIGIN (DECL_FUNCTION_BODY (current_function_decl
)))
10731 tree b
= exit_block ();
10732 java_method_add_stmt (current_function_decl
, b
);
10733 SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno
));
10738 /* This section of the source is reserved to build_* functions that
10739 are building incomplete tree nodes and the patch_* functions that
10740 are completing them. */
10742 /* Build a super() constructor invocation. Returns empty_stmt_node if
10743 we're currently dealing with the class java.lang.Object. */
10746 build_super_invocation ()
10748 if (current_class
== object_type_node
)
10749 return empty_stmt_node
;
10752 tree super_wfl
= build_wfl_node (super_identifier_node
,
10753 input_filename
, 0, 0);
10754 return build_method_invocation (super_wfl
, NULL_TREE
);
10758 /* Build a SUPER/THIS qualified method invocation. */
10761 build_this_super_qualified_invocation (use_this
, name
, args
, lloc
, rloc
)
10769 build_wfl_node ((use_this
? this_identifier_node
: super_identifier_node
),
10770 input_filename
, 0, 0);
10771 EXPR_WFL_LINECOL (wfl
) = lloc
;
10772 invok
= build_method_invocation (name
, args
);
10773 return make_qualified_primary (wfl
, invok
, rloc
);
10776 /* Build an incomplete CALL_EXPR node. */
10779 build_method_invocation (name
, args
)
10783 tree call
= build (CALL_EXPR
, NULL_TREE
, name
, args
, NULL_TREE
);
10784 TREE_SIDE_EFFECTS (call
) = 1;
10785 EXPR_WFL_LINECOL (call
) = EXPR_WFL_LINECOL (name
);
10789 /* Build an incomplete new xxx(...) node. */
10792 build_new_invocation (name
, args
)
10795 tree call
= build (NEW_CLASS_EXPR
, NULL_TREE
, name
, args
, NULL_TREE
);
10796 TREE_SIDE_EFFECTS (call
) = 1;
10797 EXPR_WFL_LINECOL (call
) = EXPR_WFL_LINECOL (name
);
10801 /* Build an incomplete assignment expression. */
10804 build_assignment (op
, op_location
, lhs
, rhs
)
10805 int op
, op_location
;
10809 /* Build the corresponding binop if we deal with a Compound
10810 Assignment operator. Mark the binop sub-tree as part of a
10811 Compound Assignment expression */
10812 if (op
!= ASSIGN_TK
)
10814 rhs
= build_binop (BINOP_LOOKUP (op
), op_location
, lhs
, rhs
);
10815 COMPOUND_ASSIGN_P (rhs
) = 1;
10817 assignment
= build (MODIFY_EXPR
, NULL_TREE
, lhs
, rhs
);
10818 TREE_SIDE_EFFECTS (assignment
) = 1;
10819 EXPR_WFL_LINECOL (assignment
) = op_location
;
10823 /* Print an INTEGER_CST node in a static buffer, and return the buffer. */
10826 print_int_node (node
)
10829 static char buffer
[80];
10830 if (TREE_CONSTANT_OVERFLOW (node
))
10831 sprintf (buffer
, "<overflow>");
10833 if (TREE_INT_CST_HIGH (node
) == 0)
10834 sprintf (buffer
, HOST_WIDE_INT_PRINT_UNSIGNED
,
10835 TREE_INT_CST_LOW (node
));
10836 else if (TREE_INT_CST_HIGH (node
) == -1
10837 && TREE_INT_CST_LOW (node
) != 0)
10840 sprintf (&buffer
[1], HOST_WIDE_INT_PRINT_UNSIGNED
,
10841 -TREE_INT_CST_LOW (node
));
10844 sprintf (buffer
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
10845 TREE_INT_CST_HIGH (node
), TREE_INT_CST_LOW (node
));
10850 /* Return 1 if you an assignment of a FINAL is attempted */
10853 check_final_assignment (lvalue
, wfl
)
10856 if (DECL_P (lvalue
) && FIELD_FINAL (lvalue
) &&
10857 DECL_NAME (current_function_decl
) != clinit_identifier_node
)
10859 parse_error_context
10860 (wfl
, "Can't assign a value to the final variable `%s'",
10861 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
10867 /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
10868 read. This is needed to avoid circularities in the implementation
10869 of these fields in libjava. */
10872 maybe_build_primttype_type_ref (rhs
, wfl
)
10875 tree to_return
= NULL_TREE
;
10876 tree rhs_type
= TREE_TYPE (rhs
);
10877 if (TREE_CODE (rhs
) == COMPOUND_EXPR
)
10879 tree n
= TREE_OPERAND (rhs
, 1);
10880 if (TREE_CODE (n
) == VAR_DECL
10881 && DECL_NAME (n
) == TYPE_identifier_node
10882 && rhs_type
== class_ptr_type
)
10884 char *self_name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
));
10885 if (!strncmp (self_name
, "java.lang.", 10))
10886 to_return
= build_primtype_type_ref (self_name
);
10889 return (to_return
? to_return
: rhs
);
10892 /* 15.25 Assignment operators. */
10895 patch_assignment (node
, wfl_op1
, wfl_op2
)
10900 tree rhs
= TREE_OPERAND (node
, 1);
10901 tree lvalue
= TREE_OPERAND (node
, 0), llvalue
;
10902 tree lhs_type
, rhs_type
, new_rhs
= NULL_TREE
;
10903 int error_found
= 0;
10904 int lvalue_from_array
= 0;
10906 /* Can't assign to a final. */
10907 if (check_final_assignment (lvalue
, wfl_op1
))
10910 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10912 /* Lhs can be a named variable */
10913 if (DECL_P (lvalue
))
10915 INITIALIZED_P (lvalue
) = 1;
10916 lhs_type
= TREE_TYPE (lvalue
);
10918 /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
10919 comment on reason why */
10920 else if (TREE_CODE (wfl_op1
) == ARRAY_REF
)
10922 lhs_type
= TREE_TYPE (lvalue
);
10923 lvalue_from_array
= 1;
10925 /* Or a field access */
10926 else if (TREE_CODE (lvalue
) == COMPONENT_REF
)
10927 lhs_type
= TREE_TYPE (lvalue
);
10928 /* Or a function return slot */
10929 else if (TREE_CODE (lvalue
) == RESULT_DECL
)
10930 lhs_type
= TREE_TYPE (lvalue
);
10931 /* Otherwise, we might want to try to write into an optimized static
10932 final, this is an of a different nature, reported further on. */
10933 else if (TREE_CODE (wfl_op1
) == EXPR_WITH_FILE_LOCATION
10934 && resolve_expression_name (wfl_op1
, &llvalue
)
10935 && check_final_assignment (llvalue
, wfl_op1
))
10938 /* What we should do instead is resetting the all the flags
10939 previously set, exchange lvalue for llvalue and continue. */
10940 return error_mark_node
;
10944 parse_error_context (wfl_op1
, "Invalid left hand side of assignment");
10948 rhs_type
= TREE_TYPE (rhs
);
10949 /* 5.1 Try the assignment conversion for builtin type. */
10950 new_rhs
= try_builtin_assignconv (wfl_op1
, lhs_type
, rhs
);
10952 /* 5.2 If it failed, try a reference conversion */
10953 if (!new_rhs
&& (new_rhs
= try_reference_assignconv (lhs_type
, rhs
)))
10954 lhs_type
= promote_type (rhs_type
);
10956 /* 15.25.2 If we have a compound assignment, convert RHS into the
10958 else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node
, 1)))
10959 new_rhs
= convert (lhs_type
, rhs
);
10961 /* Explicit cast required. This is an error */
10964 char *t1
= strdup (lang_printable_name (TREE_TYPE (rhs
), 0));
10965 char *t2
= strdup (lang_printable_name (lhs_type
, 0));
10967 char operation
[32]; /* Max size known */
10969 /* If the assignment is part of a declaration, we use the WFL of
10970 the declared variable to point out the error and call it a
10971 declaration problem. If the assignment is a genuine =
10972 operator, we call is a operator `=' problem, otherwise we
10973 call it an assignment problem. In both of these last cases,
10974 we use the WFL of the operator to indicate the error. */
10976 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node
))
10979 strcpy (operation
, "declaration");
10983 wfl
= wfl_operator
;
10984 if (COMPOUND_ASSIGN_P (TREE_OPERAND (node
, 1)))
10985 strcpy (operation
, "assignment");
10986 else if (TREE_CODE (TREE_OPERAND (node
, 0)) == RESULT_DECL
)
10987 strcpy (operation
, "`return'");
10989 strcpy (operation
, "`='");
10992 parse_error_context
10993 (wfl
, (!valid_cast_to_p (rhs_type
, lhs_type
) ?
10994 "Incompatible type for %s. Can't convert `%s' to `%s'" :
10995 "Incompatible type for %s. Explicit cast "
10996 "needed to convert `%s' to `%s'"), operation
, t1
, t2
);
10997 free (t1
); free (t2
);
11001 /* Inline read access to java.lang.PRIMTYPE.TYPE */
11003 new_rhs
= maybe_build_primttype_type_ref (new_rhs
, wfl_op2
);
11006 return error_mark_node
;
11008 /* If we built a compound expression as the result of a reference
11009 assignment into an array element, return it here. */
11010 if (TREE_CODE (node
) == COMPOUND_EXPR
)
11013 TREE_OPERAND (node
, 0) = lvalue
;
11014 TREE_OPERAND (node
, 1) = new_rhs
;
11015 TREE_TYPE (node
) = lhs_type
;
11019 /* Optimize static (final) field initialized upon declaration.
11020 - If the field is static final and is assigned to a primitive
11021 constant type, then set its DECL_INITIAL to the value.
11025 patch_initialized_static_field (node
)
11028 tree field
= TREE_OPERAND (node
, 0);
11029 tree value
= TREE_OPERAND (node
, 1);
11031 if (DECL_INITIAL (field
) != NULL_TREE
)
11033 tree type
= TREE_TYPE (value
);
11034 if (FIELD_FINAL (field
) && TREE_CONSTANT (value
)
11035 && (JPRIMITIVE_TYPE_P (type
)
11036 || (flag_emit_class_files
11037 && TREE_CODE (type
) == POINTER_TYPE
11038 && TREE_TYPE (type
) == string_type_node
)))
11040 DECL_INITIAL (field
) = value
;
11041 return empty_stmt_node
;
11043 DECL_INITIAL (field
) = NULL_TREE
;
11048 /* Check that type SOURCE can be cast into type DEST. If the cast
11049 can't occur at all, return 0 otherwise 1. This function is used to
11050 produce accurate error messages on the reasons why an assignment
11054 try_reference_assignconv (lhs_type
, rhs
)
11055 tree lhs_type
, rhs
;
11057 tree new_rhs
= NULL_TREE
;
11058 tree rhs_type
= TREE_TYPE (rhs
);
11060 if (!JPRIMITIVE_TYPE_P (rhs_type
) && JREFERENCE_TYPE_P (lhs_type
))
11062 /* `null' may be assigned to any reference type */
11063 if (rhs
== null_pointer_node
)
11064 new_rhs
= null_pointer_node
;
11065 /* Try the reference assignment conversion */
11066 else if (valid_ref_assignconv_cast_p (rhs_type
, lhs_type
, 0))
11068 /* This is a magic assignment that we process differently */
11069 else if (rhs
== soft_exceptioninfo_call_node
)
11075 /* Check that RHS can be converted into LHS_TYPE by the assignment
11076 conversion (5.2), for the cases of RHS being a builtin type. Return
11077 NULL_TREE if the conversion fails or if because RHS isn't of a
11078 builtin type. Return a converted RHS if the conversion is possible. */
11081 try_builtin_assignconv (wfl_op1
, lhs_type
, rhs
)
11082 tree wfl_op1
, lhs_type
, rhs
;
11084 tree new_rhs
= NULL_TREE
;
11085 tree rhs_type
= TREE_TYPE (rhs
);
11087 /* Zero accepted everywhere */
11088 if (TREE_CODE (rhs
) == INTEGER_CST
11089 && TREE_INT_CST_HIGH (rhs
) == 0 && TREE_INT_CST_LOW (rhs
) == 0
11090 && JPRIMITIVE_TYPE_P (rhs_type
))
11091 new_rhs
= convert (lhs_type
, rhs
);
11093 /* 5.1.1 Try Identity Conversion,
11094 5.1.2 Try Widening Primitive Conversion */
11095 else if (valid_builtin_assignconv_identity_widening_p (lhs_type
, rhs_type
))
11096 new_rhs
= convert (lhs_type
, rhs
);
11098 /* Try a narrowing primitive conversion (5.1.3):
11099 - expression is a constant expression of type int AND
11100 - variable is byte, short or char AND
11101 - The value of the expression is representable in the type of the
11103 else if (rhs_type
== int_type_node
&& TREE_CONSTANT (rhs
)
11104 && (lhs_type
== byte_type_node
|| lhs_type
== char_type_node
11105 || lhs_type
== short_type_node
))
11107 if (int_fits_type_p (rhs
, lhs_type
))
11108 new_rhs
= convert (lhs_type
, rhs
);
11109 else if (wfl_op1
) /* Might be called with a NULL */
11110 parse_warning_context
11111 (wfl_op1
, "Constant expression `%s' to wide for narrowing "
11112 "primitive conversion to `%s'",
11113 print_int_node (rhs
), lang_printable_name (lhs_type
, 0));
11114 /* Reported a warning that will turn into an error further
11115 down, so we don't return */
11121 /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
11122 conversion (5.1.1) or widening primitve conversion (5.1.2). Return
11123 0 is the conversion test fails. This implements parts the method
11124 invocation convertion (5.3). */
11127 valid_builtin_assignconv_identity_widening_p (lhs_type
, rhs_type
)
11128 tree lhs_type
, rhs_type
;
11132 if (lhs_type
== rhs_type
)
11135 /* Sometimes, instead of passing a type, we pass integer_zero_node
11136 so we know that an integral type can accomodate it */
11137 if (JINTEGRAL_TYPE_P (lhs_type
) && (rhs_type
== integer_zero_node
))
11141 JPRIMITIVE_TYPE_P (lhs_type
) && JPRIMITIVE_TYPE_P (rhs_type
);
11143 if (!all_primitive
)
11146 /* byte, even if it's smaller than a char can't be converted into a
11147 char. Short can't too, but the < test below takes care of that */
11148 if (lhs_type
== char_type_node
&& rhs_type
== byte_type_node
)
11151 /* Accept all promoted type here. Note, we can't use <= in the test
11152 below, because we still need to bounce out assignments of short
11153 to char and the likes */
11154 if (lhs_type
== int_type_node
11155 && (rhs_type
== promoted_byte_type_node
11156 || rhs_type
== promoted_short_type_node
11157 || rhs_type
== promoted_char_type_node
11158 || rhs_type
== promoted_boolean_type_node
))
11161 if (JINTEGRAL_TYPE_P (rhs_type
)
11162 && ((TYPE_PRECISION (rhs_type
) < TYPE_PRECISION (lhs_type
))
11163 || (JFLOAT_TYPE_P (lhs_type
) &&
11164 TYPE_PRECISION (rhs_type
) == TYPE_PRECISION (lhs_type
))))
11166 else if (JFLOAT_TYPE_P (rhs_type
)
11167 && (TYPE_PRECISION (rhs_type
) < TYPE_PRECISION (lhs_type
)))
11173 /* Check that something of SOURCE type can be assigned or cast to
11174 something of DEST type at runtime. Return 1 if the operation is
11175 valid, 0 otherwise. If CAST is set to 1, we're treating the case
11176 were SOURCE is cast into DEST, which borrows a lot of the
11177 assignment check. */
11180 valid_ref_assignconv_cast_p (source
, dest
, cast
)
11185 if (JNULLP_TYPE_P (source
))
11187 if (TREE_CODE (source
) == POINTER_TYPE
)
11188 source
= TREE_TYPE (source
);
11189 if (TREE_CODE (dest
) == POINTER_TYPE
)
11190 dest
= TREE_TYPE (dest
);
11191 /* Case where SOURCE is a class type */
11192 if (TYPE_CLASS_P (source
))
11194 if (TYPE_CLASS_P (dest
))
11195 return source
== dest
|| inherits_from_p (source
, dest
)
11196 || (cast
&& inherits_from_p (dest
, source
));
11197 if (TYPE_INTERFACE_P (dest
))
11199 /* If doing a cast and SOURCE is final, the operation is
11200 always correct a compile time (because even if SOURCE
11201 does not implement DEST, a subclass of SOURCE might). */
11202 if (cast
&& !CLASS_FINAL (TYPE_NAME (source
)))
11204 /* Otherwise, SOURCE must implement DEST */
11205 return interface_of_p (dest
, source
);
11207 /* DEST is an array, cast permited if SOURCE is of Object type */
11208 return (cast
&& source
== object_type_node
? 1 : 0);
11210 if (TYPE_INTERFACE_P (source
))
11212 if (TYPE_CLASS_P (dest
))
11214 /* If not casting, DEST must be the Object type */
11216 return dest
== object_type_node
;
11217 /* We're doing a cast. The cast is always valid is class
11218 DEST is not final, otherwise, DEST must implement SOURCE */
11219 else if (!CLASS_FINAL (TYPE_NAME (dest
)))
11222 return interface_of_p (source
, dest
);
11224 if (TYPE_INTERFACE_P (dest
))
11226 /* If doing a cast, then if SOURCE and DEST contain method
11227 with the same signature but different return type, then
11228 this is a (compile time) error */
11231 tree method_source
, method_dest
;
11235 for (method_source
= TYPE_METHODS (source
); method_source
;
11236 method_source
= TREE_CHAIN (method_source
))
11239 build_java_argument_signature (TREE_TYPE (method_source
));
11240 source_type
= TREE_TYPE (TREE_TYPE (method_source
));
11241 source_name
= DECL_NAME (method_source
);
11242 for (method_dest
= TYPE_METHODS (dest
);
11243 method_dest
; method_dest
= TREE_CHAIN (method_dest
))
11245 build_java_argument_signature (TREE_TYPE (method_dest
))
11246 && source_name
== DECL_NAME (method_dest
)
11247 && source_type
!= TREE_TYPE (TREE_TYPE (method_dest
)))
11253 return source
== dest
|| interface_of_p (dest
, source
);
11258 if (TYPE_ARRAY_P (source
))
11260 if (TYPE_CLASS_P (dest
))
11261 return dest
== object_type_node
;
11262 if (TYPE_INTERFACE_P (dest
))
11263 return 0; /* Install test on Clonable. FIXME */
11266 tree source_element_type
= TYPE_ARRAY_ELEMENT (source
);
11267 tree dest_element_type
= TYPE_ARRAY_ELEMENT (dest
);
11269 /* In case of severe errors, they turn out null */
11270 if (!dest_element_type
|| !source_element_type
)
11272 if (source_element_type
== dest_element_type
)
11274 return valid_ref_assignconv_cast_p (source_element_type
,
11275 dest_element_type
, cast
);
11283 valid_cast_to_p (source
, dest
)
11287 if (TREE_CODE (source
) == POINTER_TYPE
)
11288 source
= TREE_TYPE (source
);
11289 if (TREE_CODE (dest
) == POINTER_TYPE
)
11290 dest
= TREE_TYPE (dest
);
11292 if (TREE_CODE (source
) == RECORD_TYPE
&& TREE_CODE (dest
) == RECORD_TYPE
)
11293 return valid_ref_assignconv_cast_p (source
, dest
, 1);
11295 else if (JNUMERIC_TYPE_P (source
) && JNUMERIC_TYPE_P (dest
))
11301 /* Method invocation conversion test. Return 1 if type SOURCE can be
11302 converted to type DEST through the methond invocation conversion
11306 do_unary_numeric_promotion (arg
)
11309 tree type
= TREE_TYPE (arg
);
11310 if (TREE_CODE (type
) == INTEGER_TYPE
? TYPE_PRECISION (type
) < 32
11311 : TREE_CODE (type
) == CHAR_TYPE
)
11312 arg
= convert (int_type_node
, arg
);
11317 valid_method_invocation_conversion_p (dest
, source
)
11320 return (((JPRIMITIVE_TYPE_P (source
) || (source
== integer_zero_node
))
11321 && JPRIMITIVE_TYPE_P (dest
)
11322 && valid_builtin_assignconv_identity_widening_p (dest
, source
))
11323 || ((JREFERENCE_TYPE_P (source
) || JNULLP_TYPE_P (source
))
11324 && (JREFERENCE_TYPE_P (dest
) || JNULLP_TYPE_P (dest
))
11325 && valid_ref_assignconv_cast_p (source
, dest
, 0)));
11328 /* Build an incomplete binop expression. */
11331 build_binop (op
, op_location
, op1
, op2
)
11336 tree binop
= build (op
, NULL_TREE
, op1
, op2
);
11337 TREE_SIDE_EFFECTS (binop
) = 1;
11338 /* Store the location of the operator, for better error report. The
11339 string of the operator will be rebuild based on the OP value. */
11340 EXPR_WFL_LINECOL (binop
) = op_location
;
11344 /* Build the string of the operator retained by NODE. If NODE is part
11345 of a compound expression, add an '=' at the end of the string. This
11346 function is called when an error needs to be reported on an
11347 operator. The string is returned as a pointer to a static character
11351 operator_string (node
)
11354 #define BUILD_OPERATOR_STRING(S) \
11356 sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
11360 static char buffer
[10];
11361 switch (TREE_CODE (node
))
11363 case MULT_EXPR
: BUILD_OPERATOR_STRING ("*");
11364 case RDIV_EXPR
: BUILD_OPERATOR_STRING ("/");
11365 case TRUNC_MOD_EXPR
: BUILD_OPERATOR_STRING ("%");
11366 case PLUS_EXPR
: BUILD_OPERATOR_STRING ("+");
11367 case MINUS_EXPR
: BUILD_OPERATOR_STRING ("-");
11368 case LSHIFT_EXPR
: BUILD_OPERATOR_STRING ("<<");
11369 case RSHIFT_EXPR
: BUILD_OPERATOR_STRING (">>");
11370 case URSHIFT_EXPR
: BUILD_OPERATOR_STRING (">>>");
11371 case BIT_AND_EXPR
: BUILD_OPERATOR_STRING ("&");
11372 case BIT_XOR_EXPR
: BUILD_OPERATOR_STRING ("^");
11373 case BIT_IOR_EXPR
: BUILD_OPERATOR_STRING ("|");
11374 case TRUTH_ANDIF_EXPR
: BUILD_OPERATOR_STRING ("&&");
11375 case TRUTH_ORIF_EXPR
: BUILD_OPERATOR_STRING ("||");
11376 case EQ_EXPR
: BUILD_OPERATOR_STRING ("==");
11377 case NE_EXPR
: BUILD_OPERATOR_STRING ("!=");
11378 case GT_EXPR
: BUILD_OPERATOR_STRING (">");
11379 case GE_EXPR
: BUILD_OPERATOR_STRING (">=");
11380 case LT_EXPR
: BUILD_OPERATOR_STRING ("<");
11381 case LE_EXPR
: BUILD_OPERATOR_STRING ("<=");
11382 case UNARY_PLUS_EXPR
: BUILD_OPERATOR_STRING ("+");
11383 case NEGATE_EXPR
: BUILD_OPERATOR_STRING ("-");
11384 case TRUTH_NOT_EXPR
: BUILD_OPERATOR_STRING ("!");
11385 case BIT_NOT_EXPR
: BUILD_OPERATOR_STRING ("~");
11386 case PREINCREMENT_EXPR
: /* Fall through */
11387 case POSTINCREMENT_EXPR
: BUILD_OPERATOR_STRING ("++");
11388 case PREDECREMENT_EXPR
: /* Fall through */
11389 case POSTDECREMENT_EXPR
: BUILD_OPERATOR_STRING ("--");
11391 fatal ("unregistered operator %s - operator_string",
11392 tree_code_name
[TREE_CODE (node
)]);
11395 #undef BUILD_OPERATOR_STRING
11398 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
11399 errors but we modify NODE so that it contains the type computed
11400 according to the expression, when it's fixed. Otherwise, we write
11401 error_mark_node as the type. It allows us to further the analysis
11402 of remaining nodes and detects more errors in certain cases. */
11405 patch_binop (node
, wfl_op1
, wfl_op2
)
11410 tree op1
= TREE_OPERAND (node
, 0);
11411 tree op2
= TREE_OPERAND (node
, 1);
11412 tree op1_type
= TREE_TYPE (op1
);
11413 tree op2_type
= TREE_TYPE (op2
);
11415 int code
= TREE_CODE (node
);
11417 /* If 1, tell the routine that we have to return error_mark_node
11418 after checking for the initialization of the RHS */
11419 int error_found
= 0;
11421 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11425 /* 15.16 Multiplicative operators */
11426 case MULT_EXPR
: /* 15.16.1 Multiplication Operator * */
11427 case RDIV_EXPR
: /* 15.16.2 Division Operator / */
11428 case TRUNC_MOD_EXPR
: /* 15.16.3 Remainder operator % */
11429 if (!JPRIMITIVE_TYPE_P (op1_type
) || !JPRIMITIVE_TYPE_P (op2_type
))
11431 if (!JPRIMITIVE_TYPE_P (op1_type
))
11432 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
11433 if (!JPRIMITIVE_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
11434 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
11435 TREE_TYPE (node
) = error_mark_node
;
11439 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
11440 /* Change the division operator if necessary */
11441 if (code
== RDIV_EXPR
&& TREE_CODE (prom_type
) == INTEGER_TYPE
)
11442 TREE_SET_CODE (node
, TRUNC_DIV_EXPR
);
11443 /* This one is more complicated. FLOATs are processed by a function
11444 call to soft_fmod. */
11445 if (code
== TRUNC_MOD_EXPR
)
11446 return build_java_binop (TRUNC_MOD_EXPR
, prom_type
, op1
, op2
);
11449 /* 15.17 Additive Operators */
11450 case PLUS_EXPR
: /* 15.17.1 String Concatenation Operator + */
11452 /* Operation is valid if either one argument is a string
11453 constant, a String object or a StringBuffer crafted for the
11454 purpose of the a previous usage of the String concatenation
11457 if (TREE_CODE (op1
) == STRING_CST
11458 || TREE_CODE (op2
) == STRING_CST
11459 || JSTRING_TYPE_P (op1_type
)
11460 || JSTRING_TYPE_P (op2_type
)
11461 || IS_CRAFTED_STRING_BUFFER_P (op1
)
11462 || IS_CRAFTED_STRING_BUFFER_P (op2
))
11463 return build_string_concatenation (op1
, op2
);
11465 case MINUS_EXPR
: /* 15.17.2 Additive Operators (+ and -) for
11467 if (!JPRIMITIVE_TYPE_P (op1_type
) || !JPRIMITIVE_TYPE_P (op2_type
))
11469 if (!JPRIMITIVE_TYPE_P (op1_type
))
11470 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
11471 if (!JPRIMITIVE_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
11472 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
11473 TREE_TYPE (node
) = error_mark_node
;
11477 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
11480 /* 15.18 Shift Operators */
11484 if (!JINTEGRAL_TYPE_P (op1_type
) || !JINTEGRAL_TYPE_P (op2_type
))
11486 if (!JINTEGRAL_TYPE_P (op1_type
))
11487 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op1_type
);
11489 parse_error_context
11490 (wfl_operator
, (JPRIMITIVE_TYPE_P (op2_type
) ?
11491 "Incompatible type for `%s'. Explicit cast needed to convert "
11492 "shift distance from `%s' to integral" :
11493 "Incompatible type for `%s'. Can't convert shift distance from "
11494 "`%s' to integral"),
11495 operator_string (node
), lang_printable_name (op2_type
, 0));
11496 TREE_TYPE (node
) = error_mark_node
;
11501 /* Unary numeric promotion (5.6.1) is performed on each operand
11503 op1
= do_unary_numeric_promotion (op1
);
11504 op2
= do_unary_numeric_promotion (op2
);
11506 /* The type of the shift expression is the type of the promoted
11507 type of the left-hand operand */
11508 prom_type
= TREE_TYPE (op1
);
11510 /* Shift int only up to 0x1f and long up to 0x3f */
11511 if (prom_type
== int_type_node
)
11512 op2
= fold (build (BIT_AND_EXPR
, int_type_node
, op2
,
11513 build_int_2 (0x1f, 0)));
11515 op2
= fold (build (BIT_AND_EXPR
, int_type_node
, op2
,
11516 build_int_2 (0x3f, 0)));
11518 /* The >>> operator is a >> operating on unsigned quantities */
11519 if (code
== URSHIFT_EXPR
&& ! flag_emit_class_files
)
11521 op1
= convert (unsigned_type (prom_type
), op1
);
11522 TREE_SET_CODE (node
, RSHIFT_EXPR
);
11526 /* 15.19.1 Type Comparison Operator instaceof */
11527 case INSTANCEOF_EXPR
:
11529 TREE_TYPE (node
) = boolean_type_node
;
11531 if (!(op2_type
= resolve_type_during_patch (op2
)))
11532 return error_mark_node
;
11534 /* The first operand must be a reference type or the null type */
11535 if (!JREFERENCE_TYPE_P (op1_type
) && op1
!= null_pointer_node
)
11536 error_found
= 1; /* Error reported further below */
11538 /* The second operand must be a reference type */
11539 if (!JREFERENCE_TYPE_P (op2_type
))
11541 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op2
);
11542 parse_error_context
11543 (wfl_operator
, "Invalid argument `%s' for `instanceof'",
11544 lang_printable_name (op2_type
, 0));
11548 if (!error_found
&& valid_ref_assignconv_cast_p (op1_type
, op2_type
, 1))
11550 /* If the first operand is null, the result is always false */
11551 if (op1
== null_pointer_node
)
11552 return boolean_false_node
;
11553 else if (flag_emit_class_files
)
11555 TREE_OPERAND (node
, 1) = op2_type
;
11558 /* Otherwise we have to invoke instance of to figure it out */
11562 build (CALL_EXPR
, boolean_type_node
,
11563 build_address_of (soft_instanceof_node
),
11566 build_tree_list (NULL_TREE
,
11567 build_class_ref (op2_type
))),
11569 TREE_SIDE_EFFECTS (call
) = 1;
11573 /* There is no way the expression operand can be an instance of
11574 the type operand. This is a compile time error. */
11577 char *t1
= strdup (lang_printable_name (op1_type
, 0));
11578 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
11579 parse_error_context
11580 (wfl_operator
, "Impossible for `%s' to be instance of `%s'",
11581 t1
, lang_printable_name (op2_type
, 0));
11588 /* 15.21 Bitwise and Logical Operators */
11592 if (JINTEGRAL_TYPE_P (op1_type
) && JINTEGRAL_TYPE_P (op2_type
))
11593 /* Binary numeric promotion is performed on both operand and the
11594 expression retain that type */
11595 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
11597 else if (TREE_CODE (op1_type
) == BOOLEAN_TYPE
11598 && TREE_CODE (op1_type
) == BOOLEAN_TYPE
)
11599 /* The type of the bitwise operator expression is BOOLEAN */
11600 prom_type
= boolean_type_node
;
11603 if (!JINTEGRAL_TYPE_P (op1_type
))
11604 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op1_type
);
11605 if (!JINTEGRAL_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
11606 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op2_type
);
11607 TREE_TYPE (node
) = error_mark_node
;
11609 /* Insert a break here if adding thing before the switch's
11610 break for this case */
11614 /* 15.22 Conditional-And Operator */
11615 case TRUTH_ANDIF_EXPR
:
11616 /* 15.23 Conditional-Or Operator */
11617 case TRUTH_ORIF_EXPR
:
11618 /* Operands must be of BOOLEAN type */
11619 if (TREE_CODE (op1_type
) != BOOLEAN_TYPE
||
11620 TREE_CODE (op2_type
) != BOOLEAN_TYPE
)
11622 if (TREE_CODE (op1_type
) != BOOLEAN_TYPE
)
11623 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op1_type
);
11624 if (TREE_CODE (op2_type
) != BOOLEAN_TYPE
&& (op1_type
!= op2_type
))
11625 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op2_type
);
11626 TREE_TYPE (node
) = boolean_type_node
;
11630 /* The type of the conditional operators is BOOLEAN */
11631 prom_type
= boolean_type_node
;
11634 /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
11639 /* The type of each of the operands must be a primitive numeric
11641 if (!JNUMERIC_TYPE_P (op1_type
) || ! JNUMERIC_TYPE_P (op2_type
))
11643 if (!JNUMERIC_TYPE_P (op1_type
))
11644 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
11645 if (!JNUMERIC_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
11646 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
11647 TREE_TYPE (node
) = boolean_type_node
;
11651 /* Binary numeric promotion is performed on the operands */
11652 binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
11653 /* The type of the relation expression is always BOOLEAN */
11654 prom_type
= boolean_type_node
;
11657 /* 15.20 Equality Operator */
11660 /* 15.20.1 Numerical Equality Operators == and != */
11661 /* Binary numeric promotion is performed on the operands */
11662 if (JNUMERIC_TYPE_P (op1_type
) && JNUMERIC_TYPE_P (op2_type
))
11663 binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
11665 /* 15.20.2 Boolean Equality Operators == and != */
11666 else if (TREE_CODE (op1_type
) == BOOLEAN_TYPE
&&
11667 TREE_CODE (op2_type
) == BOOLEAN_TYPE
)
11668 ; /* Nothing to do here */
11670 /* 15.20.3 Reference Equality Operators == and != */
11671 /* Types have to be either references or the null type. If
11672 they're references, it must be possible to convert either
11673 type to the other by casting conversion. */
11674 else if (op1
== null_pointer_node
|| op2
== null_pointer_node
11675 || (JREFERENCE_TYPE_P (op1_type
) && JREFERENCE_TYPE_P (op2_type
)
11676 && (valid_ref_assignconv_cast_p (op1_type
, op2_type
, 1)
11677 || valid_ref_assignconv_cast_p (op2_type
,
11679 ; /* Nothing to do here */
11681 /* Else we have an error figure what can't be converted into
11682 what and report the error */
11686 t1
= strdup (lang_printable_name (op1_type
, 0));
11687 parse_error_context
11688 (wfl_operator
, "Incompatible type for `%s'. Can't convert `%s' "
11689 "to `%s'", operator_string (node
), t1
,
11690 lang_printable_name (op2_type
, 0));
11692 TREE_TYPE (node
) = boolean_type_node
;
11696 prom_type
= boolean_type_node
;
11701 return error_mark_node
;
11703 TREE_OPERAND (node
, 0) = op1
;
11704 TREE_OPERAND (node
, 1) = op2
;
11705 TREE_TYPE (node
) = prom_type
;
11706 return fold (node
);
11709 /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
11710 zero value, the value of CSTE comes after the valude of STRING */
11713 do_merge_string_cste (cste
, string
, string_len
, after
)
11716 int string_len
, after
;
11718 int len
= TREE_STRING_LENGTH (cste
) + string_len
;
11719 char *old
= TREE_STRING_POINTER (cste
);
11720 TREE_STRING_LENGTH (cste
) = len
;
11721 TREE_STRING_POINTER (cste
) = obstack_alloc (expression_obstack
, len
+1);
11724 strcpy (TREE_STRING_POINTER (cste
), string
);
11725 strcat (TREE_STRING_POINTER (cste
), old
);
11729 strcpy (TREE_STRING_POINTER (cste
), old
);
11730 strcat (TREE_STRING_POINTER (cste
), string
);
11735 /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
11736 new STRING_CST on success, NULL_TREE on failure */
11739 merge_string_cste (op1
, op2
, after
)
11743 /* Handle two string constants right away */
11744 if (TREE_CODE (op2
) == STRING_CST
)
11745 return do_merge_string_cste (op1
, TREE_STRING_POINTER (op2
),
11746 TREE_STRING_LENGTH (op2
), after
);
11748 /* Reasonable integer constant can be treated right away */
11749 if (TREE_CODE (op2
) == INTEGER_CST
&& !TREE_CONSTANT_OVERFLOW (op2
))
11751 static char *boolean_true
= "true";
11752 static char *boolean_false
= "false";
11753 static char *null_pointer
= "null";
11757 if (op2
== boolean_true_node
)
11758 string
= boolean_true
;
11759 else if (op2
== boolean_false_node
)
11760 string
= boolean_false
;
11761 else if (op2
== null_pointer_node
)
11762 string
= null_pointer
;
11763 else if (TREE_TYPE (op2
) == char_type_node
)
11765 ch
[0] = (char )TREE_INT_CST_LOW (op2
);
11770 string
= print_int_node (op2
);
11772 return do_merge_string_cste (op1
, string
, strlen (string
), after
);
11777 /* Tries to statically concatenate OP1 and OP2 if possible. Either one
11778 has to be a STRING_CST and the other part must be a STRING_CST or a
11779 INTEGRAL constant. Return a new STRING_CST if the operation
11780 succeed, NULL_TREE otherwise.
11782 If the case we want to optimize for space, we might want to return
11783 NULL_TREE for each invocation of this routine. FIXME */
11786 string_constant_concatenation (op1
, op2
)
11789 if (TREE_CODE (op1
) == STRING_CST
|| (TREE_CODE (op2
) == STRING_CST
))
11794 string
= (TREE_CODE (op1
) == STRING_CST
? op1
: op2
);
11795 rest
= (string
== op1
? op2
: op1
);
11796 invert
= (string
== op1
? 0 : 1 );
11798 /* Walk REST, only if it looks reasonable */
11799 if (TREE_CODE (rest
) != STRING_CST
11800 && !IS_CRAFTED_STRING_BUFFER_P (rest
)
11801 && !JSTRING_TYPE_P (TREE_TYPE (rest
))
11802 && TREE_CODE (rest
) == EXPR_WITH_FILE_LOCATION
)
11804 rest
= java_complete_tree (rest
);
11805 if (rest
== error_mark_node
)
11806 return error_mark_node
;
11807 rest
= fold (rest
);
11809 return merge_string_cste (string
, rest
, invert
);
11814 /* Implement the `+' operator. Does static optimization if possible,
11815 otherwise create (if necessary) and append elements to a
11816 StringBuffer. The StringBuffer will be carried around until it is
11817 used for a function call or an assignment. Then toString() will be
11818 called on it to turn it into a String object. */
11821 build_string_concatenation (op1
, op2
)
11826 /* Try to do some static optimization */
11827 if ((result
= string_constant_concatenation (op1
, op2
)))
11830 /* If operands are string constant, turn then into object references */
11832 if (TREE_CODE (op1
) == STRING_CST
)
11833 op1
= patch_string_cst (op1
);
11834 if (TREE_CODE (op2
) == STRING_CST
)
11835 op2
= patch_string_cst (op2
);
11837 /* If OP1 isn't already a StringBuffer, create and
11838 initialize a new one */
11839 if (!IS_CRAFTED_STRING_BUFFER_P (op1
))
11841 /* Two solutions here:
11842 1) OP1 is a string reference, we call new StringBuffer(OP1)
11843 2) Op2 is something else, we call new StringBuffer().append(OP1). */
11844 if (JSTRING_TYPE_P (TREE_TYPE (op1
)))
11845 op1
= BUILD_STRING_BUFFER (op1
);
11848 tree aNew
= BUILD_STRING_BUFFER (NULL_TREE
);
11849 op1
= make_qualified_primary (aNew
, BUILD_APPEND (op1
), 0);
11853 /* No longer the last node holding a crafted StringBuffer */
11854 IS_CRAFTED_STRING_BUFFER_P (op1
) = 0;
11855 /* Create a node for `{new...,xxx}.append (op2)' */
11856 op1
= make_qualified_primary (op1
, BUILD_APPEND (op2
), 0);
11857 /* Mark the last node holding a crafted StringBuffer */
11858 IS_CRAFTED_STRING_BUFFER_P (op1
) = 1;
11863 /* Patch the string node NODE. NODE can be a STRING_CST of a crafted
11864 StringBuffer. If no string were found to be patched, return
11868 patch_string (node
)
11871 if (node
== error_mark_node
)
11872 return error_mark_node
;
11873 if (TREE_CODE (node
) == STRING_CST
)
11874 return patch_string_cst (node
);
11875 else if (IS_CRAFTED_STRING_BUFFER_P (node
))
11877 int saved
= ctxp
->explicit_constructor_p
;
11878 tree invoke
= build_method_invocation (wfl_to_string
, NULL_TREE
);
11880 /* Temporary disable forbid the use of `this'. */
11881 ctxp
->explicit_constructor_p
= 0;
11882 ret
= java_complete_tree (make_qualified_primary (node
, invoke
, 0));
11883 /* Restore it at its previous value */
11884 ctxp
->explicit_constructor_p
= saved
;
11890 /* Build the internal representation of a string constant. */
11893 patch_string_cst (node
)
11897 if (! flag_emit_class_files
)
11899 push_obstacks (&permanent_obstack
, &permanent_obstack
);
11900 node
= get_identifier (TREE_STRING_POINTER (node
));
11901 location
= alloc_name_constant (CONSTANT_String
, node
);
11902 node
= build_ref_from_constant_pool (location
);
11904 TREE_TYPE (node
) = promote_type (string_type_node
);
11905 TREE_CONSTANT (node
) = 1;
11909 /* Build an incomplete unary operator expression. */
11912 build_unaryop (op_token
, op_location
, op1
)
11913 int op_token
, op_location
;
11920 case PLUS_TK
: op
= UNARY_PLUS_EXPR
; break;
11921 case MINUS_TK
: op
= NEGATE_EXPR
; break;
11922 case NEG_TK
: op
= TRUTH_NOT_EXPR
; break;
11923 case NOT_TK
: op
= BIT_NOT_EXPR
; break;
11924 default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
11928 unaryop
= build1 (op
, NULL_TREE
, op1
);
11929 TREE_SIDE_EFFECTS (unaryop
) = 1;
11930 /* Store the location of the operator, for better error report. The
11931 string of the operator will be rebuild based on the OP value. */
11932 EXPR_WFL_LINECOL (unaryop
) = op_location
;
11936 /* Special case for the ++/-- operators, since they require an extra
11937 argument to build, which is set to NULL and patched
11938 later. IS_POST_P is 1 if the operator, 0 otherwise. */
11941 build_incdec (op_token
, op_location
, op1
, is_post_p
)
11942 int op_token
, op_location
;
11946 static enum tree_code lookup
[2][2] =
11948 { PREDECREMENT_EXPR
, PREINCREMENT_EXPR
, },
11949 { POSTDECREMENT_EXPR
, POSTINCREMENT_EXPR
, },
11951 tree node
= build (lookup
[is_post_p
][(op_token
- DECR_TK
)],
11952 NULL_TREE
, op1
, NULL_TREE
);
11953 TREE_SIDE_EFFECTS (node
) = 1;
11954 /* Store the location of the operator, for better error report. The
11955 string of the operator will be rebuild based on the OP value. */
11956 EXPR_WFL_LINECOL (node
) = op_location
;
11960 /* Build an incomplete cast operator, based on the use of the
11961 CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
11962 set. java_complete_tree is trained to walk a CONVERT_EXPR even
11963 though its type is already set. */
11966 build_cast (location
, type
, exp
)
11970 tree node
= build1 (CONVERT_EXPR
, type
, exp
);
11971 EXPR_WFL_LINECOL (node
) = location
;
11975 /* 15.14 Unary operators. We return error_mark_node in case of error,
11976 but preserve the type of NODE if the type is fixed. */
11979 patch_unaryop (node
, wfl_op
)
11983 tree op
= TREE_OPERAND (node
, 0);
11984 tree op_type
= TREE_TYPE (op
);
11985 tree prom_type
, value
;
11986 int code
= TREE_CODE (node
);
11987 int error_found
= 0;
11989 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11993 /* 15.13.2 Postfix Increment Operator ++ */
11994 case POSTINCREMENT_EXPR
:
11995 /* 15.13.3 Postfix Increment Operator -- */
11996 case POSTDECREMENT_EXPR
:
11997 /* 15.14.1 Prefix Increment Operator ++ */
11998 case PREINCREMENT_EXPR
:
11999 /* 15.14.2 Prefix Decrement Operator -- */
12000 case PREDECREMENT_EXPR
:
12001 if (!DECL_P (op
) && !((TREE_CODE (op
) == INDIRECT_REF
12002 || TREE_CODE (op
) == COMPONENT_REF
)
12003 && JPRIMITIVE_TYPE_P (TREE_TYPE (op
))))
12006 /* Before screaming, check that we're not in fact trying to
12007 increment a optimized static final access, in which case
12008 we issue an different error message. */
12009 if (!(TREE_CODE (wfl_op
) == EXPR_WITH_FILE_LOCATION
12010 && resolve_expression_name (wfl_op
, &lvalue
)
12011 && check_final_assignment (lvalue
, wfl_op
)))
12012 parse_error_context (wfl_operator
, "Invalid argument to `%s'",
12013 operator_string (node
));
12014 TREE_TYPE (node
) = error_mark_node
;
12017 else if (check_final_assignment (op
, wfl_op
))
12020 /* From now on, we know that op if a variable and that it has a
12021 valid wfl. We use wfl_op to locate errors related to the
12023 else if (!JNUMERIC_TYPE_P (op_type
))
12025 parse_error_context
12026 (wfl_op
, "Invalid argument type `%s' to `%s'",
12027 lang_printable_name (op_type
, 0), operator_string (node
));
12028 TREE_TYPE (node
) = error_mark_node
;
12033 /* Before the addition, binary numeric promotion is performed on
12035 value
= build_int_2 (1, 0);
12037 binary_numeric_promotion (op_type
, TREE_TYPE (value
), &op
, &value
);
12038 /* And write the promoted incremented and increment */
12039 TREE_OPERAND (node
, 0) = op
;
12040 TREE_OPERAND (node
, 1) = value
;
12041 /* Convert the overall back into its original type. */
12042 return fold (convert (op_type
, node
));
12046 /* 15.14.3 Unary Plus Operator + */
12047 case UNARY_PLUS_EXPR
:
12048 /* 15.14.4 Unary Minus Operator - */
12050 if (!JNUMERIC_TYPE_P (op_type
))
12052 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op_type
);
12053 TREE_TYPE (node
) = error_mark_node
;
12056 /* Unary numeric promotion is performed on operand */
12059 op
= do_unary_numeric_promotion (op
);
12060 prom_type
= TREE_TYPE (op
);
12061 if (code
== UNARY_PLUS_EXPR
)
12066 /* 15.14.5 Bitwise Complement Operator ~ */
12068 if (!JINTEGRAL_TYPE_P (op_type
))
12070 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op_type
);
12071 TREE_TYPE (node
) = error_mark_node
;
12076 op
= do_unary_numeric_promotion (op
);
12077 prom_type
= TREE_TYPE (op
);
12081 /* 15.14.6 Logical Complement Operator ! */
12082 case TRUTH_NOT_EXPR
:
12083 if (TREE_CODE (op_type
) != BOOLEAN_TYPE
)
12085 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op_type
);
12086 /* But the type is known. We will report an error if further
12087 attempt of a assignment is made with this rhs */
12088 TREE_TYPE (node
) = boolean_type_node
;
12092 prom_type
= boolean_type_node
;
12095 /* 15.15 Cast Expression */
12097 value
= patch_cast (node
, wfl_operator
);
12098 if (value
== error_mark_node
)
12100 /* If this cast is part of an assignment, we tell the code
12101 that deals with it not to complain about a mismatch,
12102 because things have been cast, anyways */
12103 TREE_TYPE (node
) = error_mark_node
;
12107 return fold (value
);
12112 return error_mark_node
;
12114 /* There are cases where node has been replaced by something else
12115 and we don't end up returning here: UNARY_PLUS_EXPR,
12116 CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
12117 TREE_OPERAND (node
, 0) = fold (op
);
12118 TREE_TYPE (node
) = prom_type
;
12119 return fold (node
);
12122 /* Generic type resolution that sometimes takes place during node
12123 patching. Returned the resolved type or generate an error
12124 message. Return the resolved type or NULL_TREE. */
12127 resolve_type_during_patch (type
)
12130 if (unresolved_type_p (type
, NULL
))
12132 tree type_decl
= resolve_no_layout (EXPR_WFL_NODE (type
), NULL_TREE
);
12135 parse_error_context (type
,
12136 "Class `%s' not found in type declaration",
12137 IDENTIFIER_POINTER (EXPR_WFL_NODE (type
)));
12142 CLASS_LOADED_P (TREE_TYPE (type_decl
)) = 1;
12143 return TREE_TYPE (type_decl
);
12148 /* 5.5 Casting Conversion. error_mark_node is returned if an error is
12149 found. Otherwise NODE or something meant to replace it is returned. */
12152 patch_cast (node
, wfl_operator
)
12156 tree op
= TREE_OPERAND (node
, 0);
12157 tree op_type
= TREE_TYPE (op
);
12158 tree cast_type
= TREE_TYPE (node
);
12161 /* First resolve OP_TYPE if unresolved */
12162 if (!(cast_type
= resolve_type_during_patch (cast_type
)))
12163 return error_mark_node
;
12165 /* Check on cast that are proven correct at compile time */
12166 if (JNUMERIC_TYPE_P (cast_type
) && JNUMERIC_TYPE_P (op_type
))
12168 static tree
convert_narrow ();
12170 if (cast_type
== op_type
)
12173 /* Try widening/narowwing convertion. Potentially, things need
12174 to be worked out in gcc so we implement the extreme cases
12175 correctly. fold_convert() needs to be fixed. */
12176 return convert (cast_type
, op
);
12179 /* null can be casted to references */
12180 if (op
== null_pointer_node
&& JREFERENCE_TYPE_P (cast_type
))
12181 return build_null_of_type (cast_type
);
12183 /* The remaining legal casts involve conversion between reference
12184 types. Check for their compile time correctness. */
12185 if (JREFERENCE_TYPE_P (op_type
) && JREFERENCE_TYPE_P (cast_type
)
12186 && valid_ref_assignconv_cast_p (cast_type
, op_type
, 1))
12188 TREE_TYPE (node
) = promote_type (cast_type
);
12189 /* Now, the case can be determined correct at compile time if
12190 OP_TYPE can be converted into CAST_TYPE by assignment
12191 conversion (5.2) */
12193 if (valid_ref_assignconv_cast_p (op_type
, cast_type
, 0))
12195 TREE_SET_CODE (node
, NOP_EXPR
);
12199 if (flag_emit_class_files
)
12201 TREE_SET_CODE (node
, CONVERT_EXPR
);
12205 /* The cast requires a run-time check */
12206 return build (CALL_EXPR
, promote_type (cast_type
),
12207 build_address_of (soft_checkcast_node
),
12208 tree_cons (NULL_TREE
, build_class_ref (cast_type
),
12209 build_tree_list (NULL_TREE
, op
)),
12213 /* Any other casts are proven incorrect at compile time */
12214 t1
= strdup (lang_printable_name (op_type
, 0));
12215 parse_error_context (wfl_operator
, "Invalid cast from `%s' to `%s'",
12216 t1
, lang_printable_name (cast_type
, 0));
12218 return error_mark_node
;
12221 /* Build a null constant and give it the type TYPE. */
12224 build_null_of_type (type
)
12227 tree node
= build_int_2 (0, 0);
12228 TREE_TYPE (node
) = promote_type (type
);
12232 /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
12233 a list of indices. */
12235 build_array_ref (location
, array
, index
)
12239 tree node
= build (ARRAY_REF
, NULL_TREE
, array
, index
);
12240 EXPR_WFL_LINECOL (node
) = location
;
12244 /* 15.12 Array Access Expression */
12247 patch_array_ref (node
)
12250 tree array
= TREE_OPERAND (node
, 0);
12251 tree array_type
= TREE_TYPE (array
);
12252 tree index
= TREE_OPERAND (node
, 1);
12253 tree index_type
= TREE_TYPE (index
);
12254 int error_found
= 0;
12256 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12258 if (TREE_CODE (array_type
) == POINTER_TYPE
)
12259 array_type
= TREE_TYPE (array_type
);
12261 /* The array reference must be an array */
12262 if (!TYPE_ARRAY_P (array_type
))
12264 parse_error_context
12265 (wfl_operator
, "`[]' can only be applied to arrays. It can't be "
12266 "applied to `%s'", lang_printable_name (array_type
, 0));
12267 TREE_TYPE (node
) = error_mark_node
;
12271 /* The array index underdoes unary numeric promotion. The promoted
12272 type must be int */
12273 index
= do_unary_numeric_promotion (index
);
12274 if (TREE_TYPE (index
) != int_type_node
)
12276 int could_cast
= valid_cast_to_p (index_type
, int_type_node
);
12277 parse_error_context
12279 (could_cast
? "Incompatible type for `[]'. Explicit cast needed to "
12280 "convert `%s' to `int'" : "Incompatible type for `[]'. "
12281 "Can't convert `%s' to `int'"),
12282 lang_printable_name (index_type
, 0));
12283 TREE_TYPE (node
) = error_mark_node
;
12288 return error_mark_node
;
12290 array_type
= TYPE_ARRAY_ELEMENT (array_type
);
12292 if (flag_emit_class_files
)
12294 TREE_OPERAND (node
, 0) = array
;
12295 TREE_OPERAND (node
, 1) = index
;
12298 node
= build_java_arrayaccess (array
, array_type
, index
);
12299 TREE_TYPE (node
) = array_type
;
12303 /* 15.9 Array Creation Expressions */
12306 build_newarray_node (type
, dims
, extra_dims
)
12312 build (NEW_ARRAY_EXPR
, NULL_TREE
, type
, nreverse (dims
),
12313 build_int_2 (extra_dims
, 0));
12318 patch_newarray (node
)
12321 tree type
= TREE_OPERAND (node
, 0);
12322 tree dims
= TREE_OPERAND (node
, 1);
12323 tree cdim
, array_type
;
12324 int error_found
= 0;
12326 int xdims
= TREE_INT_CST_LOW (TREE_OPERAND (node
, 2));
12328 /* Dimension types are verified. It's better for the types to be
12329 verified in order. */
12330 for (cdim
= dims
, ndims
= 0; cdim
; cdim
= TREE_CHAIN (cdim
), ndims
++ )
12333 tree dim
= TREE_VALUE (cdim
);
12335 /* Dim might have been saved during its evaluation */
12336 dim
= (TREE_CODE (dim
) == SAVE_EXPR
? dim
= TREE_OPERAND (dim
, 0) : dim
);
12338 /* The type of each specified dimension must be an integral type. */
12339 if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim
)))
12342 /* Each expression undergoes an unary numeric promotion (5.6.1) and the
12343 promoted type must be int. */
12346 dim
= do_unary_numeric_promotion (dim
);
12347 if (TREE_TYPE (dim
) != int_type_node
)
12351 /* Report errors on types here */
12354 parse_error_context
12355 (TREE_PURPOSE (cdim
),
12356 "Incompatible type for dimension in array creation expression. "
12357 "%s convert `%s' to `int'",
12358 (valid_cast_to_p (TREE_TYPE (dim
), int_type_node
) ?
12359 "Explicit cast needed to" : "Can't"),
12360 lang_printable_name (TREE_TYPE (dim
), 0));
12364 TREE_PURPOSE (cdim
) = NULL_TREE
;
12367 /* Resolve array base type if unresolved */
12368 if (!(type
= resolve_type_during_patch (type
)))
12373 /* We don't want further evaluation of this bogus array creation
12375 TREE_TYPE (node
) = error_mark_node
;
12376 return error_mark_node
;
12379 /* Set array_type to the actual (promoted) array type of the result. */
12380 if (TREE_CODE (type
) == RECORD_TYPE
)
12381 type
= build_pointer_type (type
);
12382 while (--xdims
>= 0)
12384 type
= promote_type (build_java_array_type (type
, -1));
12386 dims
= nreverse (dims
);
12388 for (cdim
= dims
; cdim
; cdim
= TREE_CHAIN (cdim
))
12391 array_type
= build_java_array_type (type
,
12392 TREE_CODE (cdim
) == INTEGER_CST
?
12393 TREE_INT_CST_LOW (cdim
) : -1);
12394 array_type
= promote_type (array_type
);
12396 dims
= nreverse (dims
);
12398 /* The node is transformed into a function call. Things are done
12399 differently according to the number of dimensions. If the number
12400 of dimension is equal to 1, then the nature of the base type
12401 (primitive or not) matters. */
12403 return build_new_array (type
, TREE_VALUE (dims
));
12405 /* Can't reuse what's already written in expr.c because it uses the
12406 JVM stack representation. Provide a build_multianewarray. FIXME */
12407 return build (CALL_EXPR
, array_type
,
12408 build_address_of (soft_multianewarray_node
),
12409 tree_cons (NULL_TREE
, build_class_ref (TREE_TYPE (array_type
)),
12410 tree_cons (NULL_TREE
,
12411 build_int_2 (ndims
, 0), dims
)),
12415 /* 10.6 Array initializer. */
12417 /* Build a wfl for array element that don't have one, so we can
12418 pin-point errors. */
12421 maybe_build_array_element_wfl (node
)
12424 if (TREE_CODE (node
) != EXPR_WITH_FILE_LOCATION
)
12425 return build_expr_wfl (NULL_TREE
, ctxp
->filename
,
12426 ctxp
->elc
.line
, ctxp
->elc
.prev_col
);
12431 /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
12432 identification of initialized arrays easier to detect during walk
12436 build_new_array_init (location
, values
)
12440 tree constructor
= build (CONSTRUCTOR
, NULL_TREE
, NULL_TREE
, values
);
12441 tree to_return
= build1 (NEW_ARRAY_INIT
, NULL_TREE
, constructor
);
12442 EXPR_WFL_LINECOL (to_return
) = EXPR_WFL_LINECOL (constructor
) = location
;
12446 /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
12447 occurred. Otherwise return NODE after having set its type
12451 patch_new_array_init (type
, node
)
12454 int error_seen
= 0;
12455 tree current
, element_type
;
12456 HOST_WIDE_INT length
;
12457 int all_constant
= 1;
12458 tree init
= TREE_OPERAND (node
, 0);
12460 if (TREE_CODE (type
) != POINTER_TYPE
|| ! TYPE_ARRAY_P (TREE_TYPE (type
)))
12462 parse_error_context (node
,
12463 "Invalid array initializer for non-array type `%s'",
12464 lang_printable_name (type
, 1));
12465 return error_mark_node
;
12467 type
= TREE_TYPE (type
);
12468 element_type
= TYPE_ARRAY_ELEMENT (type
);
12470 CONSTRUCTOR_ELTS (init
) = nreverse (CONSTRUCTOR_ELTS (init
));
12472 for (length
= 0, current
= CONSTRUCTOR_ELTS (init
);
12473 current
; length
++, current
= TREE_CHAIN (current
))
12475 tree elt
= TREE_VALUE (current
);
12476 if (elt
== NULL_TREE
|| TREE_CODE (elt
) != NEW_ARRAY_INIT
)
12478 error_seen
|= array_constructor_check_entry (element_type
, current
);
12479 if (! TREE_CONSTANT (TREE_VALUE (current
)))
12484 TREE_VALUE (current
) = patch_new_array_init (element_type
, elt
);
12485 TREE_PURPOSE (current
) = NULL_TREE
;
12488 if (elt
&& TREE_VALUE (elt
) == error_mark_node
)
12493 return error_mark_node
;
12495 /* Create a new type. We can't reuse the one we have here by
12496 patching its dimension because it originally is of dimension -1
12497 hence reused by gcc. This would prevent triangular arrays. */
12498 type
= build_java_array_type (element_type
, length
);
12499 TREE_TYPE (init
) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type
))));
12500 TREE_TYPE (node
) = promote_type (type
);
12501 TREE_CONSTANT (init
) = all_constant
;
12505 /* Verify that one entry of the initializer element list can be
12506 assigned to the array base type. Report 1 if an error occurred, 0
12510 array_constructor_check_entry (type
, entry
)
12513 char *array_type_string
= NULL
; /* For error reports */
12514 tree value
, type_value
, new_value
, wfl_value
, patched
;
12515 int error_seen
= 0;
12517 new_value
= NULL_TREE
;
12518 wfl_value
= TREE_VALUE (entry
);
12520 value
= java_complete_tree (TREE_VALUE (entry
));
12521 /* patch_string return error_mark_node if arg is error_mark_node */
12522 if ((patched
= patch_string (value
)))
12524 if (value
== error_mark_node
)
12527 type_value
= TREE_TYPE (value
);
12529 /* At anytime, try_builtin_assignconv can report a warning on
12530 constant overflow during narrowing. */
12531 SET_WFL_OPERATOR (wfl_operator
, TREE_PURPOSE (entry
), wfl_value
);
12532 new_value
= try_builtin_assignconv (wfl_operator
, type
, value
);
12533 if (!new_value
&& (new_value
= try_reference_assignconv (type
, value
)))
12534 type_value
= promote_type (type
);
12536 /* Check and report errors */
12539 char *msg
= (!valid_cast_to_p (type_value
, type
) ?
12540 "Can't" : "Explicit cast needed to");
12541 if (!array_type_string
)
12542 array_type_string
= strdup (lang_printable_name (type
, 1));
12543 parse_error_context
12544 (wfl_operator
, "Incompatible type for array. %s convert `%s' to `%s'",
12545 msg
, lang_printable_name (type_value
, 1), array_type_string
);
12551 new_value
= maybe_build_primttype_type_ref (new_value
, wfl_operator
);
12552 TREE_VALUE (entry
) = new_value
;
12555 if (array_type_string
)
12556 free (array_type_string
);
12558 TREE_PURPOSE (entry
) = NULL_TREE
;
12563 build_this (location
)
12566 tree node
= build_wfl_node (this_identifier_node
, input_filename
, 0, 0);
12567 TREE_SET_CODE (node
, THIS_EXPR
);
12568 EXPR_WFL_LINECOL (node
) = location
;
12572 /* 14.15 The return statement. It builds a modify expression that
12573 assigns the returned value to the RESULT_DECL that hold the value
12577 build_return (location
, op
)
12581 tree node
= build1 (RETURN_EXPR
, NULL_TREE
, op
);
12582 EXPR_WFL_LINECOL (node
) = location
;
12583 node
= build_debugable_stmt (location
, node
);
12588 patch_return (node
)
12591 tree return_exp
= TREE_OPERAND (node
, 0);
12592 tree meth
= current_function_decl
;
12593 tree mtype
= TREE_TYPE (TREE_TYPE (current_function_decl
));
12594 int error_found
= 0;
12596 TREE_TYPE (node
) = error_mark_node
;
12597 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12599 /* It's invalid to have a return value within a function that is
12600 declared with the keyword void or that is a constructor */
12601 if (return_exp
&& (mtype
== void_type_node
|| DECL_CONSTRUCTOR_P (meth
)))
12604 /* It's invalid to have a no return value within a function that
12605 isn't declared with the keyword `void' */
12606 if (!return_exp
&& (mtype
!= void_type_node
&& !DECL_CONSTRUCTOR_P (meth
)))
12611 if (!DECL_CONSTRUCTOR_P (meth
))
12613 char *t
= strdup (lang_printable_name (mtype
, 0));
12614 parse_error_context (wfl_operator
,
12615 "`return' with%s value from `%s %s'",
12616 (error_found
== 1 ? "" : "out"),
12617 t
, lang_printable_name (meth
, 0));
12621 parse_error_context (wfl_operator
,
12622 "`return' with value from constructor `%s'",
12623 lang_printable_name (meth
, 0));
12624 return error_mark_node
;
12627 /* If we have a return_exp, build a modify expression and expand
12628 it. Note: at that point, the assignment is declared valid, but we
12629 may want to carry some more hacks */
12632 tree exp
= java_complete_tree (return_exp
);
12633 tree modify
, patched
;
12635 /* If the function returned value and EXP are booleans, EXP has
12636 to be converted into the type of DECL_RESULT, which is integer
12637 (see complete_start_java_method) */
12638 if (TREE_TYPE (exp
) == boolean_type_node
&&
12639 TREE_TYPE (TREE_TYPE (meth
)) == boolean_type_node
)
12640 exp
= convert_to_integer (TREE_TYPE (DECL_RESULT (meth
)), exp
);
12642 /* `null' can be assigned to a function returning a reference */
12643 if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth
))) &&
12644 exp
== null_pointer_node
)
12645 exp
= build_null_of_type (TREE_TYPE (TREE_TYPE (meth
)));
12647 if ((patched
= patch_string (exp
)))
12650 modify
= build (MODIFY_EXPR
, NULL_TREE
, DECL_RESULT (meth
), exp
);
12651 EXPR_WFL_LINECOL (modify
) = EXPR_WFL_LINECOL (node
);
12652 modify
= java_complete_tree (modify
);
12654 if (modify
!= error_mark_node
)
12656 TREE_SIDE_EFFECTS (modify
) = 1;
12657 TREE_OPERAND (node
, 0) = modify
;
12660 return error_mark_node
;
12662 TREE_TYPE (node
) = void_type_node
;
12663 TREE_SIDE_EFFECTS (node
) = 1;
12667 /* 14.8 The if Statement */
12670 build_if_else_statement (location
, expression
, if_body
, else_body
)
12672 tree expression
, if_body
, else_body
;
12676 else_body
= empty_stmt_node
;
12677 node
= build (COND_EXPR
, NULL_TREE
, expression
, if_body
, else_body
);
12678 EXPR_WFL_LINECOL (node
) = location
;
12679 node
= build_debugable_stmt (location
, node
);
12684 patch_if_else_statement (node
)
12687 tree expression
= TREE_OPERAND (node
, 0);
12689 TREE_TYPE (node
) = error_mark_node
;
12690 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12692 /* The type of expression must be boolean */
12693 if (TREE_TYPE (expression
) != boolean_type_node
12694 && TREE_TYPE (expression
) != promoted_boolean_type_node
)
12696 parse_error_context
12698 "Incompatible type for `if'. Can't convert `%s' to `boolean'",
12699 lang_printable_name (TREE_TYPE (expression
), 0));
12700 return error_mark_node
;
12703 TREE_TYPE (node
) = void_type_node
;
12704 TREE_SIDE_EFFECTS (node
) = 1;
12705 CAN_COMPLETE_NORMALLY (node
)
12706 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1))
12707 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 2));
12711 /* 14.6 Labeled Statements */
12713 /* Action taken when a lableled statement is parsed. a new
12714 LABELED_BLOCK_EXPR is created. No statement is attached to the
12718 build_labeled_block (location
, label
)
12722 tree label_name
= merge_qualified_name (label_id
, label
);
12723 tree label_decl
, node
;
12725 /* Issue an error if we try to reuse a label that was previously
12727 if (IDENTIFIER_LOCAL_VALUE (label_name
))
12729 EXPR_WFL_LINECOL (wfl_operator
) = location
;
12730 parse_error_context (wfl_operator
, "Declaration of `%s' shadows "
12731 "a previous label declaration",
12732 IDENTIFIER_POINTER (label
));
12733 EXPR_WFL_LINECOL (wfl_operator
) =
12734 EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name
));
12735 parse_error_context (wfl_operator
, "This is the location of the "
12736 "previous declaration of label `%s'",
12737 IDENTIFIER_POINTER (label
));
12738 java_error_count
--;
12741 label_decl
= create_label_decl (label_name
);
12742 node
= build (LABELED_BLOCK_EXPR
, NULL_TREE
, label_decl
, NULL_TREE
);
12743 EXPR_WFL_LINECOL (node
) = location
;
12744 TREE_SIDE_EFFECTS (node
) = 1;
12748 /* Generate a label crafting a unique name for it. This is used to
12749 implicitely label loops that aren't the body part of labeled
12753 generate_labeled_block ()
12755 return build_labeled_block (0, generate_name ());
12758 /* A labeled statement LBE is attached a statement. */
12761 complete_labeled_statement (lbe
, statement
)
12762 tree lbe
; /* Labeled block expr */
12765 /* In anyways, tie the loop to its statement */
12766 LABELED_BLOCK_BODY (lbe
) = statement
;
12768 /* Ok, if statement is a for loop, we have to attach the labeled
12769 statement to the block the for loop belongs to and return the
12771 if (TREE_CODE (statement
) == LOOP_EXPR
&& IS_FOR_LOOP_P (statement
))
12773 java_method_add_stmt (current_function_decl
, lbe
);
12774 return exit_block ();
12780 /* 14.10, 14.11, 14.12 Loop Statements */
12782 /* Create an empty LOOP_EXPR and make it the last in the nested loop
12786 build_new_loop (loop_body
)
12789 tree loop
= build (LOOP_EXPR
, NULL_TREE
, loop_body
);
12790 TREE_SIDE_EFFECTS (loop
) = 1;
12795 /* Create a loop body according to the following structure:
12797 COMPOUND_EXPR (loop main body)
12798 EXIT_EXPR (this order is for while/for loops.
12799 LABELED_BLOCK_EXPR the order is reversed for do loops)
12800 LABEL_DECL (continue occurding here branche at the
12801 BODY end of this labeled block)
12804 REVERSED, if non zero, tells that the loop condition expr comes
12805 after the body, like in the do-while loop.
12807 To obtain a loop, the loop body structure described above is
12808 encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
12811 LABEL_DECL (use this label to exit the loop)
12813 <structure described above> */
12816 build_loop_body (location
, condition
, reversed
)
12821 tree first
, second
, body
;
12823 condition
= build (EXIT_EXPR
, NULL_TREE
, condition
); /* Force walk */
12824 EXPR_WFL_LINECOL (condition
) = location
; /* For accurate error report */
12825 condition
= build_debugable_stmt (location
, condition
);
12826 TREE_SIDE_EFFECTS (condition
) = 1;
12828 body
= generate_labeled_block ();
12829 first
= (reversed
? body
: condition
);
12830 second
= (reversed
? condition
: body
);
12832 build (COMPOUND_EXPR
, NULL_TREE
,
12833 build (COMPOUND_EXPR
, NULL_TREE
, first
, second
), empty_stmt_node
);
12836 /* Install CONDITION (if any) and loop BODY (using REVERSED to tell
12837 their order) on the current loop. Unlink the current loop from the
12841 complete_loop_body (location
, condition
, body
, reversed
)
12843 tree condition
, body
;
12846 tree to_return
= ctxp
->current_loop
;
12847 tree loop_body
= LOOP_EXPR_BODY (to_return
);
12850 tree cnode
= LOOP_EXPR_BODY_CONDITION_EXPR (loop_body
, reversed
);
12851 /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
12852 The real EXIT_EXPR is one operand further. */
12853 EXPR_WFL_LINECOL (cnode
) = location
;
12854 /* This one is for accurate error reports */
12855 EXPR_WFL_LINECOL (TREE_OPERAND (cnode
, 0)) = location
;
12856 TREE_OPERAND (TREE_OPERAND (cnode
, 0), 0) = condition
;
12858 LOOP_EXPR_BODY_BODY_EXPR (loop_body
, reversed
) = body
;
12863 /* Tailored version of complete_loop_body for FOR loops, when FOR
12864 loops feature the condition part */
12867 complete_for_loop (location
, condition
, update
, body
)
12869 tree condition
, update
, body
;
12871 /* Put the condition and the loop body in place */
12872 tree loop
= complete_loop_body (location
, condition
, body
, 0);
12873 /* LOOP is the current loop which has been now popped of the loop
12874 stack. Install the update block */
12875 LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop
)) = update
;
12879 /* If the loop isn't surrounded by a labeled statement, create one and
12880 insert LOOP as it's body. */
12883 patch_loop_statement (loop
)
12886 tree loop_label
, to_return_as_loop
;
12888 if (LOOP_HAS_LABEL_P (loop
))
12890 loop_label
= ctxp
->current_labeled_block
;
12891 to_return_as_loop
= loop
;
12895 loop_label
= generate_labeled_block ();
12896 LABELED_BLOCK_BODY (loop_label
) = loop
;
12897 PUSH_LABELED_BLOCK (loop_label
);
12898 to_return_as_loop
= loop_label
;
12900 TREE_TYPE (to_return_as_loop
) = void_type_node
;
12901 return to_return_as_loop
;
12904 /* 14.13, 14.14: break and continue Statements */
12906 /* Build a break or a continue statement. a null NAME indicates an
12907 unlabeled break/continue statement. */
12910 build_bc_statement (location
, is_break
, name
)
12911 int location
, is_break
;
12914 tree break_continue
, label_block_expr
= NULL_TREE
;
12918 if (!(label_block_expr
= IDENTIFIER_LOCAL_VALUE
12919 (merge_qualified_name (label_id
, EXPR_WFL_NODE (name
)))))
12920 /* Null means that we don't have a target for this named
12921 break/continue. In this case, we make the target to be the
12922 label name, so that the error can be reported accuratly in
12923 patch_bc_statement. */
12924 label_block_expr
= EXPR_WFL_NODE (name
);
12926 /* Unlabeled break/continue will be handled during the
12927 break/continue patch operation */
12929 = build (EXIT_BLOCK_EXPR
, NULL_TREE
, label_block_expr
, NULL_TREE
);
12931 IS_BREAK_STMT_P (break_continue
) = is_break
;
12932 TREE_SIDE_EFFECTS (break_continue
) = 1;
12933 EXPR_WFL_LINECOL (break_continue
) = location
;
12934 break_continue
= build_debugable_stmt (location
, break_continue
);
12935 return break_continue
;
12938 /* Verification of a break/continue statement. */
12941 patch_bc_statement (node
)
12944 tree bc_label
= EXIT_BLOCK_LABELED_BLOCK (node
), target_stmt
;
12945 int is_unlabeled
= 0;
12946 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12948 /* Not having a target means that the break/continue statement is
12949 unlabeled. We try to find a decent label for it */
12953 /* There should be a loop/switch to branch to */
12954 if (ctxp
->current_loop
)
12956 if (TREE_CODE (ctxp
->current_loop
) == LOOP_EXPR
)
12958 /* At that stage, we're in the loop body, which is
12959 encapsulated around a LABELED_BLOCK_EXPR. So searching
12960 the current loop label requires us to consider the
12961 labeled block before the current one. */
12962 if (!LOOP_HAS_LABEL_SKIP_P (ctxp
->current_loop
))
12963 fatal ("unlabeled loop has no installed label -- "
12964 "patch_bc_statement");
12965 bc_label
= TREE_CHAIN (ctxp
->current_labeled_block
);
12967 /* For a SWITCH statement, this is the current one */
12969 bc_label
= ctxp
->current_labeled_block
;
12971 /* Not having a loop to break/continue to is an error */
12974 parse_error_context (wfl_operator
, "`%s' must be in loop%s",
12975 (IS_BREAK_STMT_P (node
) ? "break" : "continue"),
12976 (IS_BREAK_STMT_P (node
) ? " or switch" : ""));
12977 return error_mark_node
;
12980 /* Having an identifier here means that the target is unknown. */
12981 else if (TREE_CODE (bc_label
) == IDENTIFIER_NODE
)
12983 parse_error_context (wfl_operator
, "No label definition found for `%s'",
12984 IDENTIFIER_POINTER (bc_label
));
12985 return error_mark_node
;
12988 /* Find the statement we're targeting. */
12989 target_stmt
= LABELED_BLOCK_BODY (bc_label
);
12991 /* 14.13 The break Statement */
12992 if (IS_BREAK_STMT_P (node
))
12994 /* Named break are always fine, as far as they have a target
12995 (already verified). Anonymous break need to target
12996 while/do/for/switch */
12997 if (is_unlabeled
&&
12998 !(TREE_CODE (target_stmt
) == LOOP_EXPR
/* do/while/for */
12999 || TREE_CODE (target_stmt
) == SWITCH_EXPR
)) /* switch FIXME */
13001 parse_error_context (wfl_operator
,
13002 "`break' must be in loop or switch");
13003 return error_mark_node
;
13005 /* If previously unlabeled, install the new found label */
13007 EXIT_BLOCK_LABELED_BLOCK (node
) = bc_label
;
13009 /* 14.14 The continue Statement */
13010 /* The continue statement must always target a loop */
13013 if (TREE_CODE (target_stmt
) != LOOP_EXPR
) /* do/while/for */
13015 parse_error_context (wfl_operator
, "`continue' must be in loop");
13016 return error_mark_node
;
13018 /* Everything looks good. We can fix the `continue' jump to go
13019 at the place in the loop were the continue is. The continue
13020 is the current labeled block, by construction. */
13021 EXIT_BLOCK_LABELED_BLOCK (node
) = bc_label
= ctxp
->current_labeled_block
;
13024 CAN_COMPLETE_NORMALLY (bc_label
) = 1;
13026 /* Our break/continue don't return values. */
13027 TREE_TYPE (node
) = void_type_node
;
13028 /* Encapsulate the break within a compound statement so that it's
13029 expanded all the times by expand_expr (and not clobered
13030 sometimes, like after a if statement) */
13031 node
= add_stmt_to_compound (NULL_TREE
, void_type_node
, node
);
13032 TREE_SIDE_EFFECTS (node
) = 1;
13036 /* Process the exit expression belonging to a loop. Its type must be
13040 patch_exit_expr (node
)
13043 tree expression
= TREE_OPERAND (node
, 0);
13044 TREE_TYPE (node
) = error_mark_node
;
13045 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13047 /* The type of expression must be boolean */
13048 if (TREE_TYPE (expression
) != boolean_type_node
)
13050 parse_error_context
13052 "Incompatible type for loop conditional. Can't convert `%s' to "
13054 lang_printable_name (TREE_TYPE (expression
), 0));
13055 return error_mark_node
;
13057 /* Now we know things are allright, invert the condition, fold and
13059 TREE_OPERAND (node
, 0) =
13060 fold (build1 (TRUTH_NOT_EXPR
, boolean_type_node
, expression
));
13062 if (! integer_zerop (TREE_OPERAND (node
, 0))
13063 && ctxp
->current_loop
!= NULL_TREE
13064 && TREE_CODE (ctxp
->current_loop
) == LOOP_EXPR
)
13065 CAN_COMPLETE_NORMALLY (ctxp
->current_loop
) = 1;
13066 if (! integer_onep (TREE_OPERAND (node
, 0)))
13067 CAN_COMPLETE_NORMALLY (node
) = 1;
13070 TREE_TYPE (node
) = void_type_node
;
13074 /* 14.9 Switch statement */
13077 patch_switch_statement (node
)
13080 tree se
= TREE_OPERAND (node
, 0), se_type
;
13082 /* Complete the switch expression */
13083 se
= TREE_OPERAND (node
, 0) = java_complete_tree (se
);
13084 se_type
= TREE_TYPE (se
);
13085 /* The type of the switch expression must be char, byte, short or
13087 if (!JINTEGRAL_TYPE_P (se_type
))
13089 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13090 parse_error_context (wfl_operator
, "Incompatible type for `switch'. "
13091 "Can't convert `%s' to `int'",
13092 lang_printable_name (se_type
, 0));
13093 /* This is what java_complete_tree will check */
13094 TREE_OPERAND (node
, 0) = error_mark_node
;
13095 return error_mark_node
;
13098 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
13100 /* Ready to return */
13101 if (TREE_CODE (TREE_OPERAND (node
, 1)) == ERROR_MARK
)
13103 TREE_TYPE (node
) = error_mark_node
;
13104 return error_mark_node
;
13106 TREE_TYPE (node
) = void_type_node
;
13107 TREE_SIDE_EFFECTS (node
) = 1;
13108 CAN_COMPLETE_NORMALLY (node
)
13109 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1))
13110 || ! SWITCH_HAS_DEFAULT (node
);
13114 /* 14.18 The try statement */
13116 /* Wrap BLOCK around a LABELED_BLOCK, set DECL to the newly generated
13117 exit labeld and issue a jump to FINALLY_LABEL:
13121 <orignal_statments>
13128 build_jump_to_finally (block
, decl
, finally_label
, type
)
13129 tree block
, decl
, finally_label
, type
;
13132 tree new_block
= build (LABELED_BLOCK_EXPR
, type
,
13133 create_label_decl (generate_name ()), block
);
13135 stmt
= build (MODIFY_EXPR
, void_type_node
, decl
,
13136 build_address_of (LABELED_BLOCK_LABEL (new_block
)));
13137 TREE_SIDE_EFFECTS (stmt
) = 1;
13138 CAN_COMPLETE_NORMALLY (stmt
) = 1;
13139 add_stmt_to_block (block
, type
, stmt
);
13140 stmt
= build (GOTO_EXPR
, void_type_node
, finally_label
);
13141 TREE_SIDE_EFFECTS (stmt
) = 1;
13142 add_stmt_to_block (block
, type
, stmt
);
13147 build_try_statement (location
, try_block
, catches
, finally
)
13149 tree try_block
, catches
, finally
;
13153 if (finally
&& ! flag_emit_class_files
)
13155 /* This block defines a scope for the entire try[-catch]-finally
13156 sequence. It hold a local variable used to return from the
13157 finally using a computed goto. We call it
13158 return_from_finally (RFF). */
13159 rff
= build_decl (VAR_DECL
, generate_name (), return_address_type_node
);
13161 /* Modification of the try block. */
13162 try_block
= build_jump_to_finally (try_block
, rff
,
13163 FINALLY_EXPR_LABEL (finally
),
13166 /* To the finally block: add the computed goto */
13167 add_stmt_to_block (FINALLY_EXPR_BLOCK (finally
), NULL_TREE
,
13168 build (GOTO_EXPR
, void_type_node
, rff
));
13170 /* Modification of each catch blocks, if any */
13173 tree
catch, catch_decl
, catch_block
, stmt
;
13175 for (catch = catches
; catch; catch = TREE_CHAIN (catch))
13176 TREE_OPERAND (catch, 0) =
13177 build_jump_to_finally (TREE_OPERAND (catch, 0), rff
,
13178 FINALLY_EXPR_LABEL (finally
),
13181 /* Plus, at the end of the list, we add the catch clause that
13182 will catch an uncaught exception, call finally and rethrow it:
13184 void *exception_parameter; (catch_decl)
13187 exception_parameter = _Jv_exception_info ();
13193 exception_parameter */
13194 catch_decl
= build_decl (VAR_DECL
, generate_name (), ptr_type_node
);
13195 BUILD_ASSIGN_EXCEPTION_INFO (stmt
, catch_decl
);
13196 catch_block
= build_expr_block (stmt
, NULL_TREE
);
13197 catch_block
= build_jump_to_finally (catch_block
, rff
,
13198 FINALLY_EXPR_LABEL (finally
),
13200 BUILD_THROW (stmt
, catch_decl
);
13201 catch_block
= build_expr_block (catch_block
, catch_decl
);
13202 add_stmt_to_block (catch_block
, void_type_node
, stmt
);
13204 /* Link the new handler to the existing list as the first
13205 entry. It will be the last one to be generated. */
13206 catch = build1 (CATCH_EXPR
, void_type_node
, catch_block
);
13207 TREE_CHAIN (catch) = catches
;
13212 node
= build (TRY_EXPR
, NULL_TREE
, try_block
, catches
, finally
);
13213 EXPR_WFL_LINECOL (node
) = location
;
13215 /* If we have a finally, surround this whole thing by a block where
13216 the RFF local variable is defined. */
13218 return (finally
&& ! flag_emit_class_files
? build_expr_block (node
, rff
)
13222 /* Get the catch clause block from an element of the catch clause
13223 list. If depends on whether a finally clause exists or node (in
13224 which case the original catch clause was surrounded by a
13225 LABELED_BLOCK_EXPR. */
13228 java_get_catch_block (node
, finally_present_p
)
13230 int finally_present_p
;
13232 return (CATCH_EXPR_GET_EXPR (TREE_OPERAND (node
, 0), finally_present_p
));
13236 patch_try_statement (node
)
13239 int error_found
= 0;
13240 tree
try = TREE_OPERAND (node
, 0);
13241 /* Exception handlers are considered in left to right order */
13242 tree
catch = nreverse (TREE_OPERAND (node
, 1));
13243 tree finally
= TREE_OPERAND (node
, 2);
13244 int finally_p
= (finally
? 1 : 0);
13245 tree current
, caught_type_list
= NULL_TREE
;
13247 /* Check catch clauses, if any. Every time we find an error, we try
13248 to process the next catch clause. We process the catch clause before
13249 the try block so that when processing the try block we can check thrown
13250 exceptions againts the caught type list. */
13251 for (current
= catch; current
; current
= TREE_CHAIN (current
))
13253 tree carg_decl
, carg_type
;
13254 tree sub_current
, catch_block
, catch_clause
;
13257 /* Always detect the last catch clause if a finally is
13258 present. This is the catch-all handler and it just needs to
13260 if (!TREE_CHAIN (current
) && finally
)
13262 TREE_OPERAND (current
, 0) =
13263 java_complete_tree (TREE_OPERAND (current
, 0));
13267 /* At this point, the structure of the catch clause is
13268 LABELED_BLOCK_EXPR (if we have a finally)
13269 CATCH_EXPR (catch node)
13270 BLOCK (with the decl of the parameter)
13272 MODIFY_EXPR (assignment of the catch parameter)
13273 BLOCK (catch clause block)
13274 LABEL_DECL (where to return after finally (if any))
13276 Since the structure of the catch clause depends on the
13277 presence of a finally, we use a function call to get to the
13279 catch_clause
= java_get_catch_block (current
, finally_p
);
13280 carg_decl
= BLOCK_EXPR_DECLS (catch_clause
);
13281 carg_type
= TREE_TYPE (TREE_TYPE (carg_decl
));
13283 /* Catch clauses can't have more than one parameter declared,
13284 but it's already enforced by the grammar. Make sure that the
13285 only parameter of the clause statement in of class Throwable
13286 or a subclass of Throwable, but that was done earlier. The
13287 catch clause parameter type has also been resolved. */
13289 /* Just make sure that the catch clause parameter type inherits
13290 from java.lang.Throwable */
13291 if (!inherits_from_p (carg_type
, throwable_type_node
))
13293 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (current
);
13294 parse_error_context (wfl_operator
,
13295 "Can't catch class `%s'. Catch clause "
13296 "parameter type must be a subclass of "
13297 "class `java.lang.Throwable'",
13298 lang_printable_name (carg_type
, 0));
13303 /* Partial check for unreachable catch statement: The catch
13304 clause is reachable iff is no earlier catch block A in
13305 the try statement such that the type of the catch
13306 clause's parameter is the same as or a subclass of the
13307 type of A's parameter */
13309 for (sub_current
= catch;
13310 sub_current
!= current
; sub_current
= TREE_CHAIN (sub_current
))
13312 tree sub_catch_clause
, decl
;
13313 sub_catch_clause
= java_get_catch_block (sub_current
, finally_p
);
13314 decl
= BLOCK_EXPR_DECLS (sub_catch_clause
);
13316 if (inherits_from_p (carg_type
, TREE_TYPE (TREE_TYPE (decl
))))
13318 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (current
);
13319 parse_error_context
13320 (wfl_operator
, "`catch' not reached because of the catch "
13321 "clause at line %d", EXPR_WFL_LINENO (sub_current
));
13322 unreachable
= error_found
= 1;
13326 /* Complete the catch clause block */
13327 catch_block
= java_complete_tree (TREE_OPERAND (current
, 0));
13328 if (catch_block
== error_mark_node
)
13333 if (CAN_COMPLETE_NORMALLY (catch_block
))
13334 CAN_COMPLETE_NORMALLY (node
) = 1;
13335 TREE_OPERAND (current
, 0) = catch_block
;
13340 /* Things to do here: the exception must be thrown */
13342 /* Link this type to the caught type list */
13343 caught_type_list
= tree_cons (NULL_TREE
, carg_type
, caught_type_list
);
13346 PUSH_EXCEPTIONS (caught_type_list
);
13347 if ((try = java_complete_tree (try)) == error_mark_node
)
13349 if (CAN_COMPLETE_NORMALLY (try))
13350 CAN_COMPLETE_NORMALLY (node
) = 1;
13353 /* Process finally */
13356 current
= java_complete_tree (FINALLY_EXPR_BLOCK (finally
));
13357 FINALLY_EXPR_BLOCK (finally
) = current
;
13358 if (current
== error_mark_node
)
13360 if (! CAN_COMPLETE_NORMALLY (current
))
13361 CAN_COMPLETE_NORMALLY (node
) = 0;
13364 /* Verification ends here */
13366 return error_mark_node
;
13368 TREE_OPERAND (node
, 0) = try;
13369 TREE_OPERAND (node
, 1) = catch;
13370 TREE_OPERAND (node
, 2) = finally
;
13371 TREE_TYPE (node
) = void_type_node
;
13375 /* 14.17 The synchronized Statement */
13378 patch_synchronized_statement (node
, wfl_op1
)
13379 tree node
, wfl_op1
;
13381 tree expr
= TREE_OPERAND (node
, 0);
13382 tree block
= TREE_OPERAND (node
, 1);
13383 tree try_block
, catch_all
, stmt
, compound
, decl
;
13385 /* The TYPE of expr must be a reference type */
13386 if (!JREFERENCE_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 0))))
13388 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
13389 parse_error_context (wfl_operator
, "Incompatible type for `synchronized'"
13390 ". Can't convert `%s' to `java.lang.Object'",
13391 lang_printable_name (TREE_TYPE (expr
), 0));
13392 return error_mark_node
;
13395 /* Generate a try-finally for the synchronized statement, except
13396 that the handler that catches all throw exception calls
13397 _Jv_MonitorExit and then rethrow the exception.
13398 The synchronized statement is then implemented as:
13401 _Jv_MonitorEnter (expression)
13403 _Jv_MonitorExit (expression)
13407 e = _Jv_exception_info ();
13408 _Jv_MonitorExit (expression)
13413 BUILD_MONITOR_ENTER (stmt
, expr
);
13414 compound
= add_stmt_to_compound (NULL_TREE
, int_type_node
, stmt
);
13415 compound
= add_stmt_to_compound (compound
, void_type_node
, block
);
13416 if (CAN_COMPLETE_NORMALLY (block
))
13418 BUILD_MONITOR_EXIT (stmt
, expr
);
13419 compound
= add_stmt_to_compound (compound
, int_type_node
, stmt
);
13421 try_block
= build_expr_block (compound
, NULL_TREE
);
13422 CAN_COMPLETE_NORMALLY (try_block
) = CAN_COMPLETE_NORMALLY (block
);
13424 /* CATCH_ALL block */
13425 decl
= build_decl (VAR_DECL
, generate_name (), ptr_type_node
);
13426 BUILD_ASSIGN_EXCEPTION_INFO (stmt
, decl
);
13427 compound
= add_stmt_to_compound (NULL_TREE
, void_type_node
, stmt
);
13428 BUILD_MONITOR_EXIT (stmt
, expr
);
13429 compound
= add_stmt_to_compound (compound
, int_type_node
, stmt
);
13430 BUILD_THROW (stmt
, decl
);
13431 compound
= add_stmt_to_compound (compound
, void_type_node
, stmt
);
13432 catch_all
= build_expr_block (compound
, decl
);
13433 catch_all
= build_expr_block (catch_all
, NULL_TREE
);
13434 catch_all
= build1 (CATCH_EXPR
, void_type_node
, catch_all
);
13436 /* TRY-CATCH statement */
13437 compound
= build (TRY_EXPR
, void_type_node
, try_block
, catch_all
, NULL_TREE
);
13438 CAN_COMPLETE_NORMALLY (compound
) = CAN_COMPLETE_NORMALLY (try_block
);
13442 /* 14.16 The throw Statement */
13445 patch_throw_statement (node
, wfl_op1
)
13446 tree node
, wfl_op1
;
13448 tree expr
= TREE_OPERAND (node
, 0);
13449 tree type
= TREE_TYPE (expr
);
13450 int unchecked_ok
= 0, tryblock_throws_ok
= 0;
13452 /* Thrown expression must be assignable to java.lang.Throwable */
13453 if (!try_reference_assignconv (throwable_type_node
, expr
))
13455 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
13456 parse_error_context (wfl_operator
, "Can't throw `%s'; it must be a "
13457 "subclass of class `java.lang.Throwable'",
13458 lang_printable_name (type
, 0));
13459 /* If the thrown expression was a reference, we further the
13460 compile-time check. */
13461 if (!JREFERENCE_TYPE_P (type
))
13462 return error_mark_node
;
13465 /* At least one of the following must be true */
13467 /* The type of the throw expression is a not checked exception,
13468 i.e. is a unchecked expression. */
13469 unchecked_ok
= IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type
));
13471 /* Throw is contained in a try statement and at least one catch
13472 clause can receive the thrown expression or the current method is
13473 declared to throw such an exception. Or, the throw statement is
13474 contained in a method or constructor declaration and the type of
13475 the Expression is assignable to at least one type listed in the
13476 throws clause the declaration. */
13477 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
13479 tryblock_throws_ok
=
13480 check_thrown_exceptions_do (TREE_TYPE (expr
));
13481 if (!(unchecked_ok
|| tryblock_throws_ok
))
13483 /* If there is a surrounding try block that has no matching
13484 clatch clause, report it first. A surrounding try block exits
13485 only if there is something after the list of checked
13486 exception thrown by the current function (if any). */
13487 if (IN_TRY_BLOCK_P ())
13488 parse_error_context (wfl_operator
, "Checked exception `%s' can't be "
13489 "caught by any of the catch clause(s) "
13490 "of the surrounding `try' block",
13491 lang_printable_name (type
, 0));
13492 /* If we have no surrounding try statement and the method doesn't have
13493 any throws, report it now. FIXME */
13494 else if (!EXCEPTIONS_P (currently_caught_type_list
)
13495 && !tryblock_throws_ok
)
13496 parse_error_context (wfl_operator
, "Checked exception `%s' isn't "
13497 "thrown from a `try' block",
13498 lang_printable_name (type
, 0));
13499 /* Otherwise, the current method doesn't have the appropriate
13500 throws declaration */
13502 parse_error_context (wfl_operator
, "Checked exception `%s' doesn't "
13503 "match any of current method's `throws' "
13505 lang_printable_name (type
, 0));
13506 return error_mark_node
;
13509 /* If a throw statement is contained in a static initializer, then a
13510 compile-time check ensures that either its value is always an
13511 unchecked exception or its value is always caught by some try
13512 statement that contains it. FIXME, static initializer. */
13514 if (! flag_emit_class_files
)
13515 BUILD_THROW (node
, expr
);
13519 /* Check that exception said to be thrown by method DECL can be
13520 effectively caught from where DECL is invoked. */
13523 check_thrown_exceptions (location
, decl
)
13528 /* For all the unchecked exceptions thrown by DECL */
13529 for (throws
= DECL_FUNCTION_THROWS (decl
); throws
;
13530 throws
= TREE_CHAIN (throws
))
13531 if (!check_thrown_exceptions_do (TREE_VALUE (throws
)))
13534 /* Temporary hack to suppresses errors about cloning arrays. FIXME */
13535 if (DECL_NAME (decl
) == get_identifier ("clone"))
13538 EXPR_WFL_LINECOL (wfl_operator
) = location
;
13539 parse_error_context
13540 (wfl_operator
, "Exception `%s' must be caught, or it must be "
13541 "declared in the `throws' clause of `%s'",
13542 lang_printable_name (TREE_VALUE (throws
), 0),
13543 IDENTIFIER_POINTER (DECL_NAME (current_function_decl
)));
13547 /* Return 1 if checked EXCEPTION is caught at the current nesting level of
13548 try-catch blocks, OR is listed in the `throws' clause of the
13552 check_thrown_exceptions_do (exception
)
13555 tree list
= currently_caught_type_list
;
13556 resolve_and_layout (exception
, NULL_TREE
);
13557 /* First, all the nested try-catch-finally at that stage. The
13558 last element contains `throws' clause exceptions, if any. */
13559 if (IS_UNCHECKED_EXCEPTION_P (exception
))
13564 for (caught
= TREE_VALUE (list
); caught
; caught
= TREE_CHAIN (caught
))
13565 if (valid_ref_assignconv_cast_p (exception
, TREE_VALUE (caught
), 0))
13567 list
= TREE_CHAIN (list
);
13573 purge_unchecked_exceptions (mdecl
)
13576 tree throws
= DECL_FUNCTION_THROWS (mdecl
);
13577 tree
new = NULL_TREE
;
13581 tree next
= TREE_CHAIN (throws
);
13582 if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws
)))
13584 TREE_CHAIN (throws
) = new;
13589 /* List is inverted here, but it doesn't matter */
13590 DECL_FUNCTION_THROWS (mdecl
) = new;
13593 /* 15.24 Conditional Operator ?: */
13596 patch_conditional_expr (node
, wfl_cond
, wfl_op1
)
13597 tree node
, wfl_cond
, wfl_op1
;
13599 tree cond
= TREE_OPERAND (node
, 0);
13600 tree op1
= TREE_OPERAND (node
, 1);
13601 tree op2
= TREE_OPERAND (node
, 2);
13602 tree resulting_type
= NULL_TREE
;
13603 tree t1
, t2
, patched
;
13604 int error_found
= 0;
13606 /* Operands of ?: might be StringBuffers crafted as a result of a
13607 string concatenation. Obtain a descent operand here. */
13608 if ((patched
= patch_string (op1
)))
13609 TREE_OPERAND (node
, 1) = op1
= patched
;
13610 if ((patched
= patch_string (op2
)))
13611 TREE_OPERAND (node
, 2) = op2
= patched
;
13613 t1
= TREE_TYPE (op1
);
13614 t2
= TREE_TYPE (op2
);
13616 /* The first expression must be a boolean */
13617 if (TREE_TYPE (cond
) != boolean_type_node
)
13619 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_cond
);
13620 parse_error_context (wfl_operator
, "Incompatible type for `?:'. Can't "
13621 "convert `%s' to `boolean'",
13622 lang_printable_name (TREE_TYPE (cond
), 0));
13626 /* Second and third can be numeric, boolean (i.e. primitive),
13627 references or null. Anything else results in an error */
13628 if (!((JNUMERIC_TYPE_P (t1
) && JNUMERIC_TYPE_P (t2
))
13629 || ((JREFERENCE_TYPE_P (t1
) || op1
== null_pointer_node
)
13630 && (JREFERENCE_TYPE_P (t2
) || op2
== null_pointer_node
))
13631 || (t1
== boolean_type_node
&& t2
== boolean_type_node
)))
13634 /* Determine the type of the conditional expression. Same types are
13635 easy to deal with */
13637 resulting_type
= t1
;
13639 /* There are different rules for numeric types */
13640 else if (JNUMERIC_TYPE_P (t1
))
13642 /* if byte/short found, the resulting type is short */
13643 if ((t1
== byte_type_node
&& t2
== short_type_node
)
13644 || (t1
== short_type_node
&& t2
== byte_type_node
))
13645 resulting_type
= short_type_node
;
13647 /* If t1 is a constant int and t2 is of type byte, short or char
13648 and t1's value fits in t2, then the resulting type is t2 */
13649 else if ((t1
== int_type_node
&& TREE_CONSTANT (TREE_OPERAND (node
, 1)))
13650 && JBSC_TYPE_P (t2
) && int_fits_type_p (TREE_OPERAND (node
, 1), t2
))
13651 resulting_type
= t2
;
13653 /* If t2 is a constant int and t1 is of type byte, short or char
13654 and t2's value fits in t1, then the resulting type is t1 */
13655 else if ((t2
== int_type_node
&& TREE_CONSTANT (TREE_OPERAND (node
, 2)))
13656 && JBSC_TYPE_P (t1
) && int_fits_type_p (TREE_OPERAND (node
, 2), t1
))
13657 resulting_type
= t1
;
13659 /* Otherwise, binary numeric promotion is applied and the
13660 resulting type is the promoted type of operand 1 and 2 */
13662 resulting_type
= binary_numeric_promotion (t2
, t2
,
13663 &TREE_OPERAND (node
, 1),
13664 &TREE_OPERAND (node
, 2));
13667 /* Cases of a reference and a null type */
13668 else if (JREFERENCE_TYPE_P (t1
) && op2
== null_pointer_node
)
13669 resulting_type
= t1
;
13671 else if (JREFERENCE_TYPE_P (t2
) && op1
== null_pointer_node
)
13672 resulting_type
= t2
;
13674 /* Last case: different reference types. If a type can be converted
13675 into the other one by assignment conversion, the latter
13676 determines the type of the expression */
13677 else if ((resulting_type
= try_reference_assignconv (t1
, op2
)))
13678 resulting_type
= promote_type (t1
);
13680 else if ((resulting_type
= try_reference_assignconv (t2
, op1
)))
13681 resulting_type
= promote_type (t2
);
13683 /* If we don't have any resulting type, we're in trouble */
13684 if (!resulting_type
)
13686 char *t
= strdup (lang_printable_name (t1
, 0));
13687 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
13688 parse_error_context (wfl_operator
, "Incompatible type for `?:'. Can't "
13689 "convert `%s' to `%s'", t
,
13690 lang_printable_name (t2
, 0));
13697 TREE_TYPE (node
) = error_mark_node
;
13698 return error_mark_node
;
13701 TREE_TYPE (node
) = resulting_type
;
13702 TREE_SET_CODE (node
, COND_EXPR
);
13703 CAN_COMPLETE_NORMALLY (node
) = 1;
13707 /* Try to constant fold NODE.
13708 If NODE is not a constant expression, return NULL_EXPR.
13709 CONTEXT is a static final VAR_DECL whose initializer we are folding. */
13712 fold_constant_for_init (node
, context
)
13716 tree op0
, op1
, val
;
13717 enum tree_code code
= TREE_CODE (node
);
13719 if (code
== INTEGER_CST
|| code
== REAL_CST
|| code
== STRING_CST
)
13721 if (TREE_TYPE (node
) != NULL_TREE
)
13735 case TRUNC_MOD_EXPR
:
13737 case TRUTH_ANDIF_EXPR
:
13738 case TRUTH_ORIF_EXPR
:
13745 op0
= TREE_OPERAND (node
, 0);
13746 op1
= TREE_OPERAND (node
, 1);
13747 val
= fold_constant_for_init (op0
, context
);
13748 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
13750 TREE_OPERAND (node
, 0) = val
;
13751 val
= fold_constant_for_init (op1
, context
);
13752 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
13754 TREE_OPERAND (node
, 1) = val
;
13755 return patch_binop (node
, op0
, op1
);
13757 case UNARY_PLUS_EXPR
:
13759 case TRUTH_NOT_EXPR
:
13762 op0
= TREE_OPERAND (node
, 0);
13763 val
= fold_constant_for_init (op0
, context
);
13764 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
13766 TREE_OPERAND (node
, 0) = val
;
13767 node
= patch_unaryop (node
, op0
);
13771 val
= fold_constant_for_init (TREE_OPERAND (node
, 0), context
);
13772 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
13774 TREE_OPERAND (node
, 0) = val
;
13775 val
= fold_constant_for_init (TREE_OPERAND (node
, 1), context
);
13776 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
13778 TREE_OPERAND (node
, 1) = val
;
13779 val
= fold_constant_for_init (TREE_OPERAND (node
, 2), context
);
13780 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
13782 TREE_OPERAND (node
, 2) = val
;
13783 return integer_zerop (TREE_OPERAND (node
, 0)) ? TREE_OPERAND (node
, 1)
13784 : TREE_OPERAND (node
, 2);
13787 if (! FIELD_STATIC (node
) || ! FIELD_FINAL (node
)
13788 || DECL_INITIAL (node
) == NULL_TREE
)
13790 val
= DECL_INITIAL (node
);
13791 /* Guard against infinite recursion. */
13792 DECL_INITIAL (node
) = NULL_TREE
;
13793 val
= fold_constant_for_init (val
, DECL_CONTEXT (node
));
13794 DECL_INITIAL (node
) = val
;
13797 case EXPR_WITH_FILE_LOCATION
:
13798 /* Compare java_complete_tree and resolve_expression_name. */
13799 if (!EXPR_WFL_NODE (node
) /* Or a PRIMARY flag ? */
13800 || TREE_CODE (EXPR_WFL_NODE (node
)) == IDENTIFIER_NODE
)
13802 tree name
= EXPR_WFL_NODE (node
);
13804 if (PRIMARY_P (node
))
13806 else if (! QUALIFIED_P (name
))
13808 decl
= lookup_field_wrapper (DECL_CONTEXT (context
), name
);
13809 if (! FIELD_STATIC (decl
))
13811 return fold_constant_for_init (decl
, decl
);
13816 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
13817 qualify_ambiguous_name (node
);
13818 if (resolve_field_access (node
, &decl
, NULL
)
13819 && decl
!= NULL_TREE
)
13820 return fold_constant_for_init (decl
, decl
);
13827 op0
= TREE_OPERAND (node
, 0);
13828 val
= fold_constant_for_init (op0
, context
);
13829 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
13831 TREE_OPERAND (node
, 0) = val
;