2 /* A Bison parser, made from ./parse.y
3 by GNU Bison version 1.25
6 #define YYBISON 1 /* Identify Bison output. */
8 #define yyparse java_parse
10 #define yyerror java_error
11 #define yylval java_lval
12 #define yychar java_char
13 #define yydebug java_debug
14 #define yynerrs java_nerrs
26 #define BOOL_AND_TK 269
27 #define BOOL_OR_TK 270
34 #define PLUS_ASSIGN_TK 277
35 #define MINUS_ASSIGN_TK 278
36 #define MULT_ASSIGN_TK 279
37 #define DIV_ASSIGN_TK 280
38 #define REM_ASSIGN_TK 281
39 #define LS_ASSIGN_TK 282
40 #define SRS_ASSIGN_TK 283
41 #define ZRS_ASSIGN_TK 284
42 #define AND_ASSIGN_TK 285
43 #define XOR_ASSIGN_TK 286
44 #define OR_ASSIGN_TK 287
46 #define PRIVATE_TK 289
47 #define PROTECTED_TK 290
50 #define SYNCHRONIZED_TK 293
51 #define VOLATILE_TK 294
52 #define TRANSIENT_TK 295
55 #define ABSTRACT_TK 298
56 #define MODIFIER_TK 299
59 #define DEFAULT_TK 302
62 #define BOOLEAN_TK 305
64 #define IMPLEMENTS_TK 307
69 #define INSTANCEOF_TK 312
73 #define INTERFACE_TK 316
75 #define EXTENDS_TK 318
76 #define FINALLY_TK 319
85 #define CONTINUE_TK 328
87 #define PACKAGE_TK 330
94 #define INTEGRAL_TK 337
100 #define REL_CL_TK 343
103 #define ASSIGN_ANY_TK 346
104 #define ASSIGN_TK 347
114 #define STRING_LIT_TK 357
115 #define CHAR_LIT_TK 358
116 #define INT_LIT_TK 359
117 #define FP_LIT_TK 360
120 #define BOOL_LIT_TK 363
133 #include "java-tree.h"
141 #include "function.h"
143 #include "defaults.h"
145 #ifndef DIR_SEPARATOR
146 #define DIR_SEPARATOR '/'
149 /* Local function prototypes */
150 static char *java_accstring_lookup
PROTO ((int));
151 static void classitf_redefinition_error
PROTO ((const char *,tree
, tree
, tree
));
152 static void variable_redefinition_error
PROTO ((tree
, tree
, tree
, int));
153 static void check_modifiers
PROTO ((const char *, int, int));
154 static tree create_class
PROTO ((int, tree
, tree
, tree
));
155 static tree create_interface
PROTO ((int, tree
, tree
));
156 static tree find_field
PROTO ((tree
, tree
));
157 static tree lookup_field_wrapper
PROTO ((tree
, tree
));
158 static int duplicate_declaration_error_p
PROTO ((tree
, tree
, tree
));
159 static void register_fields
PROTO ((int, tree
, tree
));
160 static tree parser_qualified_classname
PROTO ((tree
));
161 static int parser_check_super
PROTO ((tree
, tree
, tree
));
162 static int parser_check_super_interface
PROTO ((tree
, tree
, tree
));
163 static void check_modifiers_consistency
PROTO ((int));
164 static tree lookup_cl
PROTO ((tree
));
165 static tree lookup_java_method2
PROTO ((tree
, tree
, int));
166 static tree method_header
PROTO ((int, tree
, tree
, tree
));
167 static void fix_method_argument_names
PROTO ((tree
,tree
));
168 static tree method_declarator
PROTO ((tree
, tree
));
169 static void parse_warning_context
PVPROTO ((tree cl
, const char *msg
, ...))
171 static void issue_warning_error_from_context
PROTO ((tree
, const char *msg
, va_list));
172 static tree parse_jdk1_1_error
PROTO ((const char *));
173 static void complete_class_report_errors
PROTO ((jdep
*));
174 static int process_imports
PROTO ((void));
175 static void read_import_dir
PROTO ((tree
));
176 static int find_in_imports_on_demand
PROTO ((tree
));
177 static int find_in_imports
PROTO ((tree
));
178 static int check_pkg_class_access
PROTO ((tree
, tree
));
179 static tree resolve_package
PROTO ((tree
, tree
*));
180 static tree lookup_package_type
PROTO ((const char *, int));
181 static tree lookup_package_type_and_set_next
PROTO ((const char *, int, tree
*));
182 static tree resolve_class
PROTO ((tree
, tree
, tree
));
183 static void declare_local_variables
PROTO ((int, tree
, tree
));
184 static void source_start_java_method
PROTO ((tree
));
185 static void source_end_java_method
PROTO ((void));
186 static void expand_start_java_method
PROTO ((tree
));
187 static tree find_name_in_single_imports
PROTO ((tree
));
188 static void check_abstract_method_header
PROTO ((tree
));
189 static tree lookup_java_interface_method2
PROTO ((tree
, tree
));
190 static tree resolve_expression_name
PROTO ((tree
, tree
*));
191 static tree maybe_create_class_interface_decl
PROTO ((tree
, tree
, tree
));
192 static int check_class_interface_creation
PROTO ((int, int, tree
,
194 static tree patch_method_invocation
PROTO ((tree
, tree
, tree
,
196 static int breakdown_qualified
PROTO ((tree
*, tree
*, tree
));
197 static tree resolve_and_layout
PROTO ((tree
, tree
));
198 static tree resolve_no_layout
PROTO ((tree
, tree
));
199 static int invocation_mode
PROTO ((tree
, int));
200 static tree find_applicable_accessible_methods_list
PROTO ((int, tree
,
202 static void search_applicable_methods_list
PROTO ((int, tree
, tree
, tree
,
204 static tree find_most_specific_methods_list
PROTO ((tree
));
205 static int argument_types_convertible
PROTO ((tree
, tree
));
206 static tree patch_invoke
PROTO ((tree
, tree
, tree
));
207 static tree lookup_method_invoke
PROTO ((int, tree
, tree
, tree
, tree
));
208 static tree register_incomplete_type
PROTO ((int, tree
, tree
, tree
));
209 static tree obtain_incomplete_type
PROTO ((tree
));
210 static tree java_complete_lhs
PROTO ((tree
));
211 static tree java_complete_tree
PROTO ((tree
));
212 static void java_complete_expand_method
PROTO ((tree
));
213 static int unresolved_type_p
PROTO ((tree
, tree
*));
214 static void create_jdep_list
PROTO ((struct parser_ctxt
*));
215 static tree build_expr_block
PROTO ((tree
, tree
));
216 static tree enter_block
PROTO ((void));
217 static tree enter_a_block
PROTO ((tree
));
218 static tree exit_block
PROTO ((void));
219 static tree lookup_name_in_blocks
PROTO ((tree
));
220 static void maybe_absorb_scoping_blocks
PROTO ((void));
221 static tree build_method_invocation
PROTO ((tree
, tree
));
222 static tree build_new_invocation
PROTO ((tree
, tree
));
223 static tree build_assignment
PROTO ((int, int, tree
, tree
));
224 static tree build_binop
PROTO ((enum tree_code
, int, tree
, tree
));
225 static int check_final_assignment
PROTO ((tree
,tree
));
226 static tree patch_assignment
PROTO ((tree
, tree
, tree
));
227 static tree patch_binop
PROTO ((tree
, tree
, tree
));
228 static tree build_unaryop
PROTO ((int, int, tree
));
229 static tree build_incdec
PROTO ((int, int, tree
, int));
230 static tree patch_unaryop
PROTO ((tree
, tree
));
231 static tree build_cast
PROTO ((int, tree
, tree
));
232 static tree build_null_of_type
PROTO ((tree
));
233 static tree patch_cast
PROTO ((tree
, tree
));
234 static int valid_ref_assignconv_cast_p
PROTO ((tree
, tree
, int));
235 static int valid_builtin_assignconv_identity_widening_p
PROTO ((tree
, tree
));
236 static int valid_cast_to_p
PROTO ((tree
, tree
));
237 static int valid_method_invocation_conversion_p
PROTO ((tree
, tree
));
238 static tree try_builtin_assignconv
PROTO ((tree
, tree
, tree
));
239 static tree try_reference_assignconv
PROTO ((tree
, tree
));
240 static tree build_unresolved_array_type
PROTO ((tree
));
241 static tree build_array_from_name
PROTO ((tree
, tree
, tree
, tree
*));
242 static tree build_array_ref
PROTO ((int, tree
, tree
));
243 static tree patch_array_ref
PROTO ((tree
));
244 static tree make_qualified_name
PROTO ((tree
, tree
, int));
245 static tree merge_qualified_name
PROTO ((tree
, tree
));
246 static tree make_qualified_primary
PROTO ((tree
, tree
, int));
247 static int resolve_qualified_expression_name
PROTO ((tree
, tree
*,
249 static void qualify_ambiguous_name
PROTO ((tree
));
250 static void maybe_generate_clinit
PROTO ((void));
251 static tree resolve_field_access
PROTO ((tree
, tree
*, tree
*));
252 static tree build_newarray_node
PROTO ((tree
, tree
, int));
253 static tree patch_newarray
PROTO ((tree
));
254 static tree resolve_type_during_patch
PROTO ((tree
));
255 static tree build_this
PROTO ((int));
256 static tree build_return
PROTO ((int, tree
));
257 static tree patch_return
PROTO ((tree
));
258 static tree maybe_access_field
PROTO ((tree
, tree
, tree
));
259 static int complete_function_arguments
PROTO ((tree
));
260 static int check_for_static_method_reference
PROTO ((tree
, tree
, tree
, tree
, tree
));
261 static int not_accessible_p
PROTO ((tree
, tree
, int));
262 static void check_deprecation
PROTO ((tree
, tree
));
263 static int class_in_current_package
PROTO ((tree
));
264 static tree build_if_else_statement
PROTO ((int, tree
, tree
, tree
));
265 static tree patch_if_else_statement
PROTO ((tree
));
266 static tree add_stmt_to_compound
PROTO ((tree
, tree
, tree
));
267 static tree add_stmt_to_block
PROTO ((tree
, tree
, tree
));
268 static tree patch_exit_expr
PROTO ((tree
));
269 static tree build_labeled_block
PROTO ((int, tree
));
270 static tree finish_labeled_statement
PROTO ((tree
, tree
));
271 static tree build_bc_statement
PROTO ((int, int, tree
));
272 static tree patch_bc_statement
PROTO ((tree
));
273 static tree patch_loop_statement
PROTO ((tree
));
274 static tree build_new_loop
PROTO ((tree
));
275 static tree build_loop_body
PROTO ((int, tree
, int));
276 static tree finish_loop_body
PROTO ((int, tree
, tree
, int));
277 static tree build_debugable_stmt
PROTO ((int, tree
));
278 static tree finish_for_loop
PROTO ((int, tree
, tree
, tree
));
279 static tree patch_switch_statement
PROTO ((tree
));
280 static tree string_constant_concatenation
PROTO ((tree
, tree
));
281 static tree build_string_concatenation
PROTO ((tree
, tree
));
282 static tree patch_string_cst
PROTO ((tree
));
283 static tree patch_string
PROTO ((tree
));
284 static tree build_try_statement
PROTO ((int, tree
, tree
));
285 static tree build_try_finally_statement
PROTO ((int, tree
, tree
));
286 static tree patch_try_statement
PROTO ((tree
));
287 static tree patch_synchronized_statement
PROTO ((tree
, tree
));
288 static tree patch_throw_statement
PROTO ((tree
, tree
));
289 static void check_thrown_exceptions
PROTO ((int, tree
));
290 static int check_thrown_exceptions_do
PROTO ((tree
));
291 static void purge_unchecked_exceptions
PROTO ((tree
));
292 static void check_throws_clauses
PROTO ((tree
, tree
, tree
));
293 static void finish_method_declaration
PROTO ((tree
));
294 static tree build_super_invocation
PROTO ((void));
295 static int verify_constructor_circularity
PROTO ((tree
, tree
));
296 static char *constructor_circularity_msg
PROTO ((tree
, tree
));
297 static tree build_this_super_qualified_invocation
PROTO ((int, tree
, tree
,
299 static const char *get_printable_method_name
PROTO ((tree
));
300 static tree patch_conditional_expr
PROTO ((tree
, tree
, tree
));
301 static void maybe_generate_finit
PROTO ((void));
302 static void fix_constructors
PROTO ((tree
));
303 static int verify_constructor_super
PROTO ((void));
304 static tree create_artificial_method
PROTO ((tree
, int, tree
, tree
, tree
));
305 static void start_artificial_method_body
PROTO ((tree
));
306 static void end_artificial_method_body
PROTO ((tree
));
307 static int check_method_redefinition
PROTO ((tree
, tree
));
308 static int reset_method_name
PROTO ((tree
));
309 static void java_check_regular_methods
PROTO ((tree
));
310 static void java_check_abstract_methods
PROTO ((tree
));
311 static tree maybe_build_primttype_type_ref
PROTO ((tree
, tree
));
312 static void unreachable_stmt_error
PROTO ((tree
));
313 static tree find_expr_with_wfl
PROTO ((tree
));
314 static void missing_return_error
PROTO ((tree
));
315 static tree build_new_array_init
PROTO ((int, tree
));
316 static tree patch_new_array_init
PROTO ((tree
, tree
));
317 static tree maybe_build_array_element_wfl
PROTO ((tree
));
318 static int array_constructor_check_entry
PROTO ((tree
, tree
));
319 static const char *purify_type_name
PROTO ((const char *));
320 static tree fold_constant_for_init
PROTO ((tree
, tree
));
321 static tree strip_out_static_field_access_decl
PROTO ((tree
));
322 static jdeplist
*reverse_jdep_list
PROTO ((struct parser_ctxt
*));
323 static void static_ref_err
PROTO ((tree
, tree
, tree
));
324 static void parser_add_interface
PROTO ((tree
, tree
, tree
));
325 static void add_superinterfaces
PROTO ((tree
, tree
));
326 static tree jdep_resolve_class
PROTO ((jdep
*));
327 static int note_possible_classname
PROTO ((const char *, int));
328 static void java_complete_expand_methods
PROTO ((void));
329 static void java_expand_finals
PROTO ((void));
330 static tree cut_identifier_in_qualified
PROTO ((tree
));
331 static tree java_stabilize_reference
PROTO ((tree
));
332 static tree do_unary_numeric_promotion
PROTO ((tree
));
333 static char * operator_string
PROTO ((tree
));
334 static tree do_merge_string_cste
PROTO ((tree
, const char *, int, int));
335 static tree merge_string_cste
PROTO ((tree
, tree
, int));
336 static tree java_refold
PROTO ((tree
));
338 /* Number of error found so far. */
339 int java_error_count
;
340 /* Number of warning found so far. */
341 int java_warning_count
;
342 /* Tell when not to fold, when doing xrefs */
345 /* The current parser context */
346 struct parser_ctxt
*ctxp
;
348 /* List of things that were analyzed for which code will be generated */
349 static struct parser_ctxt
*ctxp_for_generation
= NULL
;
351 /* binop_lookup maps token to tree_code. It is used where binary
352 operations are involved and required by the parser. RDIV_EXPR
353 covers both integral/floating point division. The code is changed
354 once the type of both operator is worked out. */
356 static enum tree_code binop_lookup
[19] =
358 PLUS_EXPR
, MINUS_EXPR
, MULT_EXPR
, RDIV_EXPR
, TRUNC_MOD_EXPR
,
359 LSHIFT_EXPR
, RSHIFT_EXPR
, URSHIFT_EXPR
,
360 BIT_AND_EXPR
, BIT_XOR_EXPR
, BIT_IOR_EXPR
,
361 TRUTH_ANDIF_EXPR
, TRUTH_ORIF_EXPR
,
362 EQ_EXPR
, NE_EXPR
, GT_EXPR
, GE_EXPR
, LT_EXPR
, LE_EXPR
,
364 #define BINOP_LOOKUP(VALUE) \
365 binop_lookup [((VALUE) - PLUS_TK)% \
366 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
368 /* This is the end index for binary operators that can also be used
369 in compound assignements. */
370 #define BINOP_COMPOUND_CANDIDATES 11
372 /* Fake WFL used to report error message. It is initialized once if
373 needed and reused with it's location information is overriden. */
374 tree wfl_operator
= NULL_TREE
;
376 /* The "$L" identifier we use to create labels. */
377 static tree label_id
= NULL_TREE
;
379 /* The "StringBuffer" identifier used for the String `+' operator. */
380 static tree wfl_string_buffer
= NULL_TREE
;
382 /* The "append" identifier used for String `+' operator. */
383 static tree wfl_append
= NULL_TREE
;
385 /* The "toString" identifier used for String `+' operator. */
386 static tree wfl_to_string
= NULL_TREE
;
388 /* The "java.lang" import qualified name. */
389 static tree java_lang_id
= NULL_TREE
;
391 /* The "java.lang.Cloneable" qualified name. */
392 static tree java_lang_cloneable
= NULL_TREE
;
394 /* Context and flag for static blocks */
395 static tree current_static_block
= NULL_TREE
;
398 #line 323 "./parse.y"
408 #line 333 "./parse.y"
426 #define YYFLAG -32768
429 #define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 266)
431 static const char yytranslate
[] = { 0,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
458 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
459 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
460 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
461 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
462 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
463 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
464 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
465 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
466 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
467 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
472 static const short yyprhs
[] = { 0,
473 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
474 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
475 46, 50, 54, 56, 58, 60, 64, 66, 67, 69,
476 71, 73, 76, 79, 82, 86, 88, 91, 93, 96,
477 100, 103, 107, 109, 111, 115, 118, 122, 128, 133,
478 139, 141, 143, 145, 147, 149, 152, 153, 161, 162,
479 169, 173, 176, 180, 185, 186, 189, 193, 196, 197,
480 200, 203, 205, 209, 213, 216, 220, 222, 225, 227,
481 229, 231, 233, 235, 238, 240, 242, 244, 248, 253,
482 255, 259, 263, 265, 269, 273, 278, 280, 284, 287,
483 291, 295, 297, 299, 300, 304, 307, 311, 315, 320,
484 325, 328, 332, 335, 339, 342, 346, 351, 355, 359,
485 363, 365, 369, 373, 376, 380, 383, 387, 388, 391,
486 394, 396, 400, 404, 406, 409, 411, 414, 418, 420,
487 421, 425, 428, 432, 436, 441, 444, 448, 452, 457,
488 459, 462, 467, 473, 481, 488, 490, 492, 493, 498,
489 499, 505, 506, 512, 513, 520, 524, 529, 532, 536,
490 539, 543, 546, 550, 552, 555, 557, 559, 561, 563,
491 565, 568, 571, 574, 578, 583, 585, 589, 593, 596,
492 600, 602, 604, 606, 609, 611, 613, 615, 618, 621,
493 625, 627, 629, 631, 633, 635, 637, 639, 641, 643,
494 645, 647, 649, 651, 653, 655, 657, 659, 661, 663,
495 665, 667, 669, 671, 674, 677, 680, 683, 686, 689,
496 692, 695, 699, 704, 709, 715, 720, 726, 733, 741,
497 748, 750, 752, 754, 756, 758, 760, 762, 768, 771,
498 775, 780, 788, 796, 797, 801, 806, 809, 813, 819,
499 822, 826, 830, 835, 837, 840, 843, 845, 848, 852,
500 855, 858, 862, 865, 870, 873, 876, 880, 885, 888,
501 890, 898, 906, 913, 917, 923, 928, 936, 943, 946,
502 949, 953, 956, 957, 959, 961, 964, 965, 967, 969,
503 973, 977, 980, 984, 987, 991, 994, 998, 1001, 1005,
504 1008, 1012, 1015, 1019, 1023, 1026, 1030, 1036, 1042, 1045,
505 1050, 1054, 1056, 1060, 1064, 1069, 1072, 1074, 1077, 1080,
506 1085, 1088, 1092, 1097, 1100, 1103, 1105, 1107, 1109, 1111,
507 1115, 1117, 1119, 1121, 1123, 1127, 1131, 1135, 1139, 1143,
508 1147, 1151, 1155, 1161, 1166, 1173, 1179, 1184, 1190, 1196,
509 1203, 1207, 1211, 1216, 1222, 1225, 1229, 1233, 1237, 1239,
510 1243, 1247, 1251, 1255, 1260, 1265, 1270, 1275, 1279, 1283,
511 1285, 1288, 1292, 1296, 1299, 1302, 1306, 1310, 1314, 1318,
512 1321, 1325, 1330, 1336, 1343, 1349, 1356, 1361, 1366, 1371,
513 1376, 1380, 1385, 1389, 1394, 1396, 1398, 1400, 1402, 1405,
514 1408, 1410, 1412, 1415, 1418, 1420, 1423, 1426, 1429, 1432,
515 1435, 1438, 1440, 1443, 1446, 1448, 1451, 1454, 1460, 1465,
516 1470, 1476, 1481, 1484, 1490, 1495, 1501, 1503, 1507, 1511,
517 1515, 1519, 1523, 1527, 1529, 1533, 1537, 1541, 1545, 1547,
518 1551, 1555, 1559, 1563, 1567, 1571, 1573, 1577, 1581, 1585,
519 1589, 1593, 1597, 1601, 1605, 1609, 1613, 1615, 1619, 1623,
520 1627, 1631, 1633, 1637, 1641, 1643, 1647, 1651, 1653, 1657,
521 1661, 1663, 1667, 1671, 1673, 1677, 1681, 1683, 1689, 1694,
522 1698, 1704, 1706, 1708, 1712, 1716, 1718, 1720, 1722, 1724,
526 static const short yyrhs
[] = { 123,
527 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
528 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
529 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
530 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
531 0, 118, 97, 98, 0, 113, 97, 1, 0, 118,
532 97, 1, 0, 120, 0, 121, 0, 122, 0, 119,
533 101, 122, 0, 86, 0, 0, 126, 0, 124, 0,
534 125, 0, 126, 124, 0, 126, 125, 0, 124, 125,
535 0, 126, 124, 125, 0, 127, 0, 124, 127, 0,
536 130, 0, 125, 130, 0, 75, 119, 99, 0, 75,
537 1, 0, 75, 119, 1, 0, 128, 0, 129, 0,
538 55, 119, 99, 0, 55, 1, 0, 55, 119, 1,
539 0, 55, 119, 101, 5, 99, 0, 55, 119, 101,
540 1, 0, 55, 119, 101, 5, 1, 0, 132, 0,
541 166, 0, 99, 0, 1, 0, 44, 0, 131, 44,
542 0, 0, 131, 67, 122, 135, 136, 133, 138, 0,
543 0, 67, 122, 135, 136, 134, 138, 0, 131, 67,
544 1, 0, 67, 1, 0, 67, 122, 1, 0, 131,
545 67, 122, 1, 0, 0, 63, 116, 0, 63, 116,
546 1, 0, 63, 1, 0, 0, 52, 137, 0, 52,
547 1, 0, 117, 0, 137, 100, 117, 0, 137, 100,
548 1, 0, 95, 96, 0, 95, 139, 96, 0, 140,
549 0, 139, 140, 0, 141, 0, 156, 0, 158, 0,
550 179, 0, 142, 0, 142, 99, 0, 147, 0, 132,
551 0, 166, 0, 112, 143, 99, 0, 131, 112, 143,
552 99, 0, 144, 0, 143, 100, 144, 0, 143, 100,
553 1, 0, 145, 0, 145, 92, 146, 0, 145, 92,
554 1, 0, 145, 92, 146, 1, 0, 122, 0, 145,
555 97, 98, 0, 122, 1, 0, 145, 97, 1, 0,
556 145, 98, 1, 0, 264, 0, 177, 0, 0, 149,
557 148, 155, 0, 149, 1, 0, 112, 150, 153, 0,
558 59, 150, 153, 0, 131, 112, 150, 153, 0, 131,
559 59, 150, 153, 0, 112, 1, 0, 131, 112, 1,
560 0, 59, 1, 0, 131, 59, 1, 0, 131, 1,
561 0, 122, 93, 94, 0, 122, 93, 151, 94, 0,
562 150, 97, 98, 0, 122, 93, 1, 0, 150, 97,
563 1, 0, 152, 0, 151, 100, 152, 0, 151, 100,
564 1, 0, 112, 145, 0, 131, 112, 145, 0, 112,
565 1, 0, 131, 112, 1, 0, 0, 53, 154, 0,
566 53, 1, 0, 116, 0, 154, 100, 116, 0, 154,
567 100, 1, 0, 179, 0, 179, 99, 0, 99, 0,
568 157, 179, 0, 157, 179, 99, 0, 44, 0, 0,
569 160, 159, 162, 0, 161, 153, 0, 131, 161, 153,
570 0, 120, 93, 94, 0, 120, 93, 151, 94, 0,
571 180, 163, 0, 180, 164, 163, 0, 180, 182, 163,
572 0, 180, 164, 182, 163, 0, 181, 0, 181, 99,
573 0, 165, 93, 94, 99, 0, 165, 93, 233, 94,
574 99, 0, 119, 101, 65, 93, 233, 94, 99, 0,
575 119, 101, 65, 93, 94, 99, 0, 76, 0, 65,
576 0, 0, 61, 122, 167, 172, 0, 0, 131, 61,
577 122, 168, 172, 0, 0, 61, 122, 171, 169, 172,
578 0, 0, 131, 61, 122, 171, 170, 172, 0, 61,
579 122, 1, 0, 131, 61, 122, 1, 0, 63, 117,
580 0, 171, 100, 117, 0, 63, 1, 0, 171, 100,
581 1, 0, 95, 96, 0, 95, 173, 96, 0, 174,
582 0, 173, 174, 0, 175, 0, 176, 0, 132, 0,
583 166, 0, 142, 0, 149, 99, 0, 149, 1, 0,
584 95, 96, 0, 95, 178, 96, 0, 95, 178, 100,
585 96, 0, 146, 0, 178, 100, 146, 0, 178, 100,
586 1, 0, 95, 96, 0, 180, 182, 181, 0, 95,
587 0, 96, 0, 183, 0, 182, 183, 0, 184, 0,
588 186, 0, 132, 0, 185, 99, 0, 112, 143, 0,
589 131, 112, 143, 0, 188, 0, 191, 0, 195, 0,
590 196, 0, 207, 0, 211, 0, 188, 0, 192, 0,
591 197, 0, 208, 0, 212, 0, 179, 0, 189, 0,
592 193, 0, 198, 0, 210, 0, 218, 0, 219, 0,
593 220, 0, 222, 0, 221, 0, 224, 0, 99, 0,
594 122, 88, 0, 190, 186, 0, 122, 1, 0, 190,
595 187, 0, 194, 99, 0, 1, 99, 0, 1, 95,
596 0, 1, 96, 0, 165, 93, 1, 0, 165, 93,
597 94, 1, 0, 165, 93, 233, 1, 0, 165, 93,
598 233, 94, 1, 0, 119, 101, 65, 1, 0, 119,
599 101, 65, 93, 1, 0, 119, 101, 65, 93, 233,
600 1, 0, 119, 101, 65, 93, 233, 94, 1, 0,
601 119, 101, 65, 93, 94, 1, 0, 261, 0, 245,
602 0, 246, 0, 242, 0, 243, 0, 239, 0, 231,
603 0, 48, 93, 264, 94, 186, 0, 48, 1, 0,
604 48, 93, 1, 0, 48, 93, 264, 1, 0, 48,
605 93, 264, 94, 187, 56, 186, 0, 48, 93, 264,
606 94, 187, 56, 187, 0, 0, 200, 199, 201, 0,
607 68, 93, 264, 94, 0, 68, 1, 0, 68, 93,
608 1, 0, 68, 93, 264, 94, 1, 0, 95, 96,
609 0, 95, 204, 96, 0, 95, 202, 96, 0, 95,
610 202, 204, 96, 0, 203, 0, 202, 203, 0, 204,
611 182, 0, 205, 0, 204, 205, 0, 62, 265, 88,
612 0, 47, 88, 0, 62, 1, 0, 62, 265, 1,
613 0, 47, 1, 0, 66, 93, 264, 94, 0, 206,
614 186, 0, 66, 1, 0, 66, 93, 1, 0, 66,
615 93, 264, 1, 0, 206, 187, 0, 51, 0, 209,
616 186, 66, 93, 264, 94, 99, 0, 214, 99, 264,
617 99, 216, 94, 186, 0, 214, 99, 99, 216, 94,
618 186, 0, 214, 99, 1, 0, 214, 99, 264, 99,
619 1, 0, 214, 99, 99, 1, 0, 214, 99, 264,
620 99, 216, 94, 187, 0, 214, 99, 99, 216, 94,
621 187, 0, 71, 93, 0, 71, 1, 0, 71, 93,
622 1, 0, 213, 215, 0, 0, 217, 0, 185, 0,
623 217, 1, 0, 0, 217, 0, 194, 0, 217, 100,
624 194, 0, 217, 100, 1, 0, 54, 99, 0, 54,
625 122, 99, 0, 54, 1, 0, 54, 122, 1, 0,
626 73, 99, 0, 73, 122, 99, 0, 73, 1, 0,
627 73, 122, 1, 0, 58, 99, 0, 58, 264, 99,
628 0, 58, 1, 0, 58, 264, 1, 0, 49, 264,
629 99, 0, 49, 1, 0, 49, 264, 1, 0, 223,
630 93, 264, 94, 179, 0, 223, 93, 264, 94, 1,
631 0, 223, 1, 0, 223, 93, 1, 94, 0, 223,
632 93, 1, 0, 44, 0, 70, 179, 225, 0, 70,
633 179, 228, 0, 70, 179, 225, 228, 0, 70, 1,
634 0, 226, 0, 225, 226, 0, 227, 179, 0, 60,
635 93, 152, 94, 0, 60, 1, 0, 60, 93, 1,
636 0, 60, 93, 1, 94, 0, 64, 179, 0, 64,
637 1, 0, 230, 0, 234, 0, 111, 0, 76, 0,
638 93, 264, 94, 0, 231, 0, 238, 0, 239, 0,
639 240, 0, 119, 101, 67, 0, 113, 101, 67, 0,
640 59, 101, 67, 0, 119, 101, 76, 0, 93, 264,
641 1, 0, 119, 101, 1, 0, 113, 101, 1, 0,
642 59, 101, 1, 0, 72, 116, 93, 233, 94, 0,
643 72, 116, 93, 94, 0, 72, 116, 93, 233, 94,
644 138, 0, 72, 116, 93, 94, 138, 0, 232, 122,
645 93, 94, 0, 232, 122, 93, 94, 138, 0, 232,
646 122, 93, 233, 94, 0, 232, 122, 93, 233, 94,
647 138, 0, 72, 1, 99, 0, 72, 116, 1, 0,
648 72, 116, 93, 1, 0, 72, 116, 93, 233, 1,
649 0, 232, 1, 0, 232, 122, 1, 0, 119, 101,
650 72, 0, 229, 101, 72, 0, 264, 0, 233, 100,
651 264, 0, 233, 100, 1, 0, 72, 113, 235, 0,
652 72, 115, 235, 0, 72, 113, 235, 237, 0, 72,
653 115, 235, 237, 0, 72, 115, 237, 177, 0, 72,
654 113, 237, 177, 0, 72, 1, 98, 0, 72, 1,
655 97, 0, 236, 0, 235, 236, 0, 97, 264, 98,
656 0, 97, 264, 1, 0, 97, 1, 0, 97, 98,
657 0, 237, 97, 98, 0, 237, 97, 1, 0, 229,
658 101, 122, 0, 65, 101, 122, 0, 65, 1, 0,
659 119, 93, 94, 0, 119, 93, 233, 94, 0, 229,
660 101, 122, 93, 94, 0, 229, 101, 122, 93, 233,
661 94, 0, 65, 101, 122, 93, 94, 0, 65, 101,
662 122, 93, 233, 94, 0, 65, 101, 1, 94, 0,
663 65, 101, 1, 101, 0, 119, 97, 264, 98, 0,
664 230, 97, 264, 98, 0, 119, 97, 1, 0, 119,
665 97, 264, 1, 0, 230, 97, 1, 0, 230, 97,
666 264, 1, 0, 229, 0, 119, 0, 242, 0, 243,
667 0, 241, 46, 0, 241, 45, 0, 245, 0, 246,
668 0, 3, 244, 0, 4, 244, 0, 247, 0, 3,
669 1, 0, 4, 1, 0, 46, 244, 0, 46, 1,
670 0, 45, 244, 0, 45, 1, 0, 241, 0, 89,
671 244, 0, 90, 244, 0, 248, 0, 89, 1, 0,
672 90, 1, 0, 93, 113, 237, 94, 244, 0, 93,
673 113, 94, 244, 0, 93, 264, 94, 247, 0, 93,
674 119, 237, 94, 247, 0, 93, 113, 97, 1, 0,
675 93, 1, 0, 93, 113, 237, 94, 1, 0, 93,
676 113, 94, 1, 0, 93, 119, 237, 94, 1, 0,
677 244, 0, 249, 5, 244, 0, 249, 6, 244, 0,
678 249, 7, 244, 0, 249, 5, 1, 0, 249, 6,
679 1, 0, 249, 7, 1, 0, 249, 0, 250, 3,
680 249, 0, 250, 4, 249, 0, 250, 3, 1, 0,
681 250, 4, 1, 0, 250, 0, 251, 8, 250, 0,
682 251, 9, 250, 0, 251, 10, 250, 0, 251, 8,
683 1, 0, 251, 9, 1, 0, 251, 10, 1, 0,
684 251, 0, 252, 20, 251, 0, 252, 18, 251, 0,
685 252, 21, 251, 0, 252, 19, 251, 0, 252, 57,
686 114, 0, 252, 20, 1, 0, 252, 18, 1, 0,
687 252, 21, 1, 0, 252, 19, 1, 0, 252, 57,
688 1, 0, 252, 0, 253, 16, 252, 0, 253, 17,
689 252, 0, 253, 16, 1, 0, 253, 17, 1, 0,
690 253, 0, 254, 11, 253, 0, 254, 11, 1, 0,
691 254, 0, 255, 12, 254, 0, 255, 12, 1, 0,
692 255, 0, 256, 13, 255, 0, 256, 13, 1, 0,
693 256, 0, 257, 14, 256, 0, 257, 14, 1, 0,
694 257, 0, 258, 15, 257, 0, 258, 15, 1, 0,
695 258, 0, 258, 87, 264, 88, 259, 0, 258, 87,
696 88, 1, 0, 258, 87, 1, 0, 258, 87, 264,
697 88, 1, 0, 259, 0, 261, 0, 262, 263, 260,
698 0, 262, 263, 1, 0, 119, 0, 238, 0, 240,
699 0, 91, 0, 92, 0, 260, 0, 264, 0
705 static const short yyrline
[] = { 0,
706 477, 483, 485, 486, 487, 488, 489, 493, 495, 498,
707 500, 501, 504, 506, 509, 513, 517, 521, 527, 529,
708 531, 533, 538, 540, 543, 547, 552, 557, 559, 560,
709 561, 562, 563, 564, 565, 568, 573, 579, 581, 584,
710 587, 589, 593, 595, 598, 625, 627, 631, 644, 646,
711 650, 657, 662, 664, 674, 679, 694, 698, 701, 704,
712 707, 709, 711, 716, 720, 722, 724, 726, 730, 732,
713 734, 741, 747, 752, 756, 765, 775, 777, 780, 782,
714 783, 784, 788, 790, 792, 793, 795, 800, 803, 813,
715 816, 818, 822, 825, 832, 838, 846, 848, 850, 852,
716 854, 858, 860, 864, 871, 872, 876, 879, 881, 883,
717 885, 887, 889, 891, 893, 900, 903, 905, 914, 916,
718 920, 925, 930, 934, 939, 944, 946, 953, 955, 957,
719 961, 964, 966, 970, 972, 973, 978, 984, 991, 999,
720 1006, 1009, 1012, 1016, 1019, 1023, 1032, 1034, 1036, 1040,
721 1042, 1045, 1052, 1060, 1062, 1066, 1073, 1083, 1087, 1090,
722 1093, 1096, 1099, 1102, 1105, 1108, 1110, 1114, 1120, 1125,
723 1127, 1131, 1134, 1138, 1140, 1143, 1145, 1146, 1148, 1152,
724 1156, 1162, 1167, 1170, 1172, 1176, 1182, 1186, 1191, 1200,
725 1204, 1209, 1221, 1223, 1226, 1228, 1230, 1234, 1238, 1241,
726 1245, 1247, 1248, 1249, 1250, 1251, 1255, 1257, 1258, 1259,
727 1260, 1264, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273,
728 1274, 1275, 1278, 1283, 1294, 1297, 1301, 1308, 1318, 1324,
729 1330, 1336, 1338, 1344, 1346, 1352, 1354, 1356, 1358, 1360,
730 1364, 1366, 1367, 1368, 1369, 1370, 1371, 1374, 1380, 1382,
731 1384, 1388, 1393, 1398, 1404, 1414, 1420, 1422, 1424, 1431,
732 1434, 1436, 1438, 1442, 1444, 1447, 1451, 1453, 1456, 1463,
733 1469, 1471, 1473, 1477, 1485, 1488, 1490, 1492, 1496, 1501,
734 1510, 1515, 1518, 1525, 1527, 1529, 1533, 1536, 1545, 1552,
735 1554, 1558, 1571, 1573, 1579, 1585, 1589, 1591, 1595, 1598,
736 1600, 1604, 1607, 1609, 1611, 1615, 1618, 1620, 1622, 1626,
737 1629, 1631, 1633, 1637, 1643, 1645, 1649, 1656, 1658, 1660,
738 1662, 1666, 1674, 1677, 1679, 1684, 1688, 1690, 1697, 1705,
739 1722, 1724, 1726, 1730, 1733, 1738, 1740, 1743, 1745, 1747,
740 1749, 1750, 1751, 1752, 1756, 1758, 1760, 1765, 1767, 1769,
741 1771, 1773, 1777, 1780, 1785, 1787, 1792, 1793, 1794, 1795,
742 1796, 1798, 1800, 1802, 1804, 1806, 1810, 1812, 1815, 1821,
743 1826, 1830, 1833, 1835, 1837, 1841, 1843, 1845, 1847, 1851,
744 1854, 1858, 1864, 1866, 1874, 1901, 1903, 1907, 1912, 1919,
745 1923, 1926, 1928, 1939, 1950, 1955, 1964, 1966, 1970, 1973,
746 1975, 1980, 1985, 1990, 1997, 1999, 2000, 2001, 2004, 2009,
747 2014, 2016, 2017, 2019, 2021, 2022, 2024, 2028, 2031, 2035,
748 2038, 2042, 2044, 2046, 2048, 2049, 2051, 2055, 2064, 2066,
749 2068, 2081, 2083, 2089, 2091, 2093, 2097, 2099, 2104, 2109,
750 2114, 2116, 2118, 2122, 2124, 2129, 2134, 2136, 2140, 2142,
751 2147, 2152, 2157, 2159, 2161, 2165, 2167, 2172, 2177, 2182,
752 2187, 2189, 2191, 2193, 2195, 2197, 2201, 2203, 2208, 2213,
753 2215, 2219, 2221, 2226, 2230, 2232, 2237, 2241, 2243, 2248,
754 2252, 2254, 2259, 2263, 2265, 2270, 2274, 2276, 2281, 2287,
755 2289, 2293, 2295, 2298, 2301, 2309, 2311, 2312, 2315, 2317,
761 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
763 static const char * const yytname
[] = { "$","error","$undefined.","PLUS_TK",
764 "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
765 "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
766 "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
767 "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
768 "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
769 "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
770 "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
771 "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
772 "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
773 "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
774 "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
775 "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
776 "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
777 "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
778 "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
779 "goal","literal","type","primitive_type","reference_type","class_or_interface_type",
780 "class_type","interface_type","array_type","name","simple_name","qualified_name",
781 "identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
782 "import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
783 "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
784 "interface_type_list","class_body","class_body_declarations","class_body_declaration",
785 "class_member_declaration","field_declaration","variable_declarators","variable_declarator",
786 "variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
787 "method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list",
788 "method_body","static_initializer","static","constructor_declaration","@4","constructor_header",
789 "constructor_declarator","constructor_body","constructor_block_end","explicit_constructor_invocation",
790 "this_or_super","interface_declaration","@5","@6","@7","@8","extends_interfaces",
791 "interface_body","interface_member_declarations","interface_member_declaration",
792 "constant_declaration","abstract_method_declaration","array_initializer","variable_initializers",
793 "block","block_begin","block_end","block_statements","block_statement","local_variable_declaration_statement",
794 "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
795 "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
796 "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
797 "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups",
798 "switch_block_statement_group","switch_labels","switch_label","while_expression",
799 "while_statement","while_statement_nsi","do_statement_begin","do_statement",
800 "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update",
801 "statement_expression_list","break_statement","continue_statement","return_statement",
802 "throw_statement","synchronized_statement","synchronized","try_statement","catches",
803 "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array",
804 "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression",
805 "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access",
806 "postfix_expression","post_increment_expression","post_decrement_expression",
807 "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus",
808 "cast_expression","multiplicative_expression","additive_expression","shift_expression",
809 "relational_expression","equality_expression","and_expression","exclusive_or_expression",
810 "inclusive_or_expression","conditional_and_expression","conditional_or_expression",
811 "conditional_expression","assignment_expression","assignment","left_hand_side",
812 "assignment_operator","expression","constant_expression", NULL
816 static const short yyr1
[] = { 0,
817 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
818 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
819 118, 118, 119, 119, 120, 121, 122, 123, 123, 123,
820 123, 123, 123, 123, 123, 124, 124, 125, 125, 126,
821 126, 126, 127, 127, 128, 128, 128, 129, 129, 129,
822 130, 130, 130, 130, 131, 131, 133, 132, 134, 132,
823 132, 132, 132, 132, 135, 135, 135, 135, 136, 136,
824 136, 137, 137, 137, 138, 138, 139, 139, 140, 140,
825 140, 140, 141, 141, 141, 141, 141, 142, 142, 143,
826 143, 143, 144, 144, 144, 144, 145, 145, 145, 145,
827 145, 146, 146, 148, 147, 147, 149, 149, 149, 149,
828 149, 149, 149, 149, 149, 150, 150, 150, 150, 150,
829 151, 151, 151, 152, 152, 152, 152, 153, 153, 153,
830 154, 154, 154, 155, 155, 155, 156, 156, 157, 159,
831 158, 160, 160, 161, 161, 162, 162, 162, 162, 163,
832 163, 164, 164, 164, 164, 165, 165, 167, 166, 168,
833 166, 169, 166, 170, 166, 166, 166, 171, 171, 171,
834 171, 172, 172, 173, 173, 174, 174, 174, 174, 175,
835 176, 176, 177, 177, 177, 178, 178, 178, 179, 179,
836 180, 181, 182, 182, 183, 183, 183, 184, 185, 185,
837 186, 186, 186, 186, 186, 186, 187, 187, 187, 187,
838 187, 188, 188, 188, 188, 188, 188, 188, 188, 188,
839 188, 188, 189, 190, 191, 191, 192, 193, 193, 193,
840 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
841 194, 194, 194, 194, 194, 194, 194, 195, 195, 195,
842 195, 196, 197, 199, 198, 200, 200, 200, 200, 201,
843 201, 201, 201, 202, 202, 203, 204, 204, 205, 205,
844 205, 205, 205, 206, 207, 207, 207, 207, 208, 209,
845 210, 211, 211, 211, 211, 211, 212, 212, 213, 213,
846 213, 214, 215, 215, 215, 215, 216, 216, 217, 217,
847 217, 218, 218, 218, 218, 219, 219, 219, 219, 220,
848 220, 220, 220, 221, 221, 221, 222, 222, 222, 222,
849 222, 223, 224, 224, 224, 224, 225, 225, 226, 227,
850 227, 227, 227, 228, 228, 229, 229, 230, 230, 230,
851 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
852 230, 230, 231, 231, 231, 231, 231, 231, 231, 231,
853 231, 231, 231, 231, 231, 231, 232, 232, 233, 233,
854 233, 234, 234, 234, 234, 234, 234, 234, 234, 235,
855 235, 236, 236, 236, 237, 237, 237, 238, 238, 238,
856 239, 239, 239, 239, 239, 239, 239, 239, 240, 240,
857 240, 240, 240, 240, 241, 241, 241, 241, 242, 243,
858 244, 244, 244, 244, 244, 244, 244, 245, 245, 246,
859 246, 247, 247, 247, 247, 247, 247, 248, 248, 248,
860 248, 248, 248, 248, 248, 248, 249, 249, 249, 249,
861 249, 249, 249, 250, 250, 250, 250, 250, 251, 251,
862 251, 251, 251, 251, 251, 252, 252, 252, 252, 252,
863 252, 252, 252, 252, 252, 252, 253, 253, 253, 253,
864 253, 254, 254, 254, 255, 255, 255, 256, 256, 256,
865 257, 257, 257, 258, 258, 258, 259, 259, 259, 259,
866 259, 260, 260, 261, 261, 262, 262, 262, 263, 263,
870 static const short yyr2
[] = { 0,
871 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
872 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
873 3, 3, 1, 1, 1, 3, 1, 0, 1, 1,
874 1, 2, 2, 2, 3, 1, 2, 1, 2, 3,
875 2, 3, 1, 1, 3, 2, 3, 5, 4, 5,
876 1, 1, 1, 1, 1, 2, 0, 7, 0, 6,
877 3, 2, 3, 4, 0, 2, 3, 2, 0, 2,
878 2, 1, 3, 3, 2, 3, 1, 2, 1, 1,
879 1, 1, 1, 2, 1, 1, 1, 3, 4, 1,
880 3, 3, 1, 3, 3, 4, 1, 3, 2, 3,
881 3, 1, 1, 0, 3, 2, 3, 3, 4, 4,
882 2, 3, 2, 3, 2, 3, 4, 3, 3, 3,
883 1, 3, 3, 2, 3, 2, 3, 0, 2, 2,
884 1, 3, 3, 1, 2, 1, 2, 3, 1, 0,
885 3, 2, 3, 3, 4, 2, 3, 3, 4, 1,
886 2, 4, 5, 7, 6, 1, 1, 0, 4, 0,
887 5, 0, 5, 0, 6, 3, 4, 2, 3, 2,
888 3, 2, 3, 1, 2, 1, 1, 1, 1, 1,
889 2, 2, 2, 3, 4, 1, 3, 3, 2, 3,
890 1, 1, 1, 2, 1, 1, 1, 2, 2, 3,
891 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
892 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
893 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
894 2, 3, 4, 4, 5, 4, 5, 6, 7, 6,
895 1, 1, 1, 1, 1, 1, 1, 5, 2, 3,
896 4, 7, 7, 0, 3, 4, 2, 3, 5, 2,
897 3, 3, 4, 1, 2, 2, 1, 2, 3, 2,
898 2, 3, 2, 4, 2, 2, 3, 4, 2, 1,
899 7, 7, 6, 3, 5, 4, 7, 6, 2, 2,
900 3, 2, 0, 1, 1, 2, 0, 1, 1, 3,
901 3, 2, 3, 2, 3, 2, 3, 2, 3, 2,
902 3, 2, 3, 3, 2, 3, 5, 5, 2, 4,
903 3, 1, 3, 3, 4, 2, 1, 2, 2, 4,
904 2, 3, 4, 2, 2, 1, 1, 1, 1, 3,
905 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
906 3, 3, 5, 4, 6, 5, 4, 5, 5, 6,
907 3, 3, 4, 5, 2, 3, 3, 3, 1, 3,
908 3, 3, 3, 4, 4, 4, 4, 3, 3, 1,
909 2, 3, 3, 2, 2, 3, 3, 3, 3, 2,
910 3, 4, 5, 6, 5, 6, 4, 4, 4, 4,
911 3, 4, 3, 4, 1, 1, 1, 1, 2, 2,
912 1, 1, 2, 2, 1, 2, 2, 2, 2, 2,
913 2, 1, 2, 2, 1, 2, 2, 5, 4, 4,
914 5, 4, 2, 5, 4, 5, 1, 3, 3, 3,
915 3, 3, 3, 1, 3, 3, 3, 3, 1, 3,
916 3, 3, 3, 3, 3, 1, 3, 3, 3, 3,
917 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
918 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
919 1, 3, 3, 1, 3, 3, 1, 5, 4, 3,
920 5, 1, 1, 3, 3, 1, 1, 1, 1, 1,
924 static const short yydefact
[] = { 0,
925 54, 55, 0, 0, 0, 0, 53, 1, 0, 0,
926 0, 36, 43, 44, 38, 0, 51, 52, 46, 27,
927 0, 23, 24, 25, 0, 62, 0, 41, 0, 0,
928 37, 39, 0, 0, 56, 0, 0, 47, 45, 0,
929 166, 0, 0, 162, 63, 0, 69, 42, 40, 0,
930 0, 0, 61, 0, 49, 0, 26, 170, 17, 168,
931 15, 0, 159, 0, 0, 68, 16, 0, 0, 59,
932 167, 0, 164, 64, 69, 50, 48, 12, 0, 10,
933 11, 172, 0, 8, 9, 13, 14, 15, 0, 178,
934 180, 0, 179, 0, 174, 176, 177, 171, 169, 163,
935 67, 71, 72, 70, 0, 161, 0, 57, 113, 0,
936 128, 111, 0, 0, 90, 93, 128, 0, 0, 0,
937 115, 0, 0, 182, 181, 173, 175, 0, 0, 60,
938 165, 0, 0, 0, 0, 108, 99, 88, 0, 0,
939 0, 0, 107, 21, 18, 22, 20, 19, 114, 128,
940 112, 0, 128, 74, 73, 55, 191, 75, 23, 0,
941 86, 0, 77, 79, 83, 85, 0, 80, 0, 81,
942 140, 128, 87, 82, 0, 58, 119, 116, 0, 0,
943 0, 121, 130, 131, 129, 120, 118, 92, 0, 91,
944 95, 0, 0, 0, 0, 0, 0, 0, 339, 0,
945 0, 0, 0, 6, 5, 2, 3, 4, 7, 338,
946 0, 406, 0, 103, 405, 336, 341, 0, 337, 342,
947 343, 344, 422, 407, 408, 437, 411, 412, 415, 425,
948 444, 449, 456, 467, 472, 475, 478, 481, 484, 487,
949 492, 501, 493, 0, 102, 100, 98, 101, 110, 89,
950 109, 189, 0, 128, 76, 78, 84, 106, 0, 137,
951 0, 142, 0, 55, 0, 0, 280, 0, 0, 0,
952 0, 0, 0, 0, 0, 339, 0, 223, 0, 8,
953 406, 0, 0, 197, 0, 212, 0, 193, 195, 0,
954 196, 201, 213, 0, 202, 214, 0, 203, 204, 215,
955 254, 0, 205, 0, 216, 206, 293, 0, 217, 218,
956 219, 221, 220, 0, 222, 247, 246, 0, 244, 245,
957 242, 243, 241, 126, 124, 0, 117, 0, 0, 416,
958 406, 342, 344, 413, 417, 414, 421, 420, 419, 418,
959 0, 390, 0, 0, 0, 16, 0, 426, 423, 427,
960 424, 433, 0, 406, 0, 183, 186, 0, 0, 0,
961 0, 0, 96, 0, 0, 365, 0, 410, 409, 0,
962 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
963 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
964 499, 500, 0, 144, 0, 143, 136, 105, 134, 138,
965 191, 141, 0, 230, 231, 229, 249, 0, 315, 0,
966 304, 302, 0, 312, 310, 0, 276, 0, 257, 0,
967 326, 0, 290, 0, 308, 306, 0, 0, 199, 0,
968 0, 226, 224, 0, 0, 192, 190, 194, 198, 322,
969 406, 225, 228, 0, 275, 0, 406, 0, 295, 299,
970 292, 0, 0, 319, 0, 127, 125, 123, 122, 133,
971 132, 352, 347, 0, 389, 379, 378, 361, 0, 372,
972 380, 0, 373, 0, 362, 0, 0, 0, 0, 0,
973 0, 349, 340, 184, 0, 351, 346, 391, 0, 369,
974 401, 0, 350, 345, 367, 348, 368, 388, 403, 0,
975 366, 0, 441, 438, 442, 439, 443, 440, 447, 445,
976 448, 446, 453, 450, 454, 451, 455, 452, 463, 458,
977 465, 460, 462, 457, 464, 459, 466, 0, 461, 470,
978 468, 471, 469, 474, 473, 477, 476, 480, 479, 483,
979 482, 486, 485, 490, 0, 0, 495, 494, 145, 135,
980 406, 146, 0, 0, 150, 0, 250, 0, 316, 314,
981 305, 303, 313, 311, 277, 0, 258, 0, 0, 0,
982 323, 327, 0, 324, 291, 309, 307, 340, 0, 200,
983 232, 0, 0, 0, 255, 0, 296, 0, 284, 0,
984 0, 321, 0, 397, 398, 0, 384, 385, 0, 381,
985 374, 0, 377, 375, 376, 363, 354, 0, 435, 429,
986 432, 0, 0, 430, 188, 185, 187, 392, 0, 402,
987 399, 0, 404, 400, 357, 0, 489, 0, 0, 147,
988 0, 0, 151, 148, 251, 0, 278, 274, 0, 331,
989 0, 335, 334, 328, 325, 329, 236, 0, 233, 234,
990 0, 0, 0, 260, 0, 264, 0, 267, 0, 301,
991 300, 286, 0, 298, 0, 320, 0, 395, 0, 383,
992 382, 387, 386, 356, 364, 353, 434, 428, 436, 431,
993 371, 370, 393, 0, 358, 359, 491, 488, 0, 149,
994 0, 0, 0, 248, 0, 201, 0, 208, 209, 0,
995 210, 211, 0, 259, 332, 0, 237, 0, 0, 235,
996 273, 270, 271, 502, 0, 262, 265, 0, 261, 0,
997 268, 0, 0, 285, 0, 318, 317, 396, 355, 394,
998 360, 0, 152, 0, 0, 0, 227, 279, 0, 333,
999 330, 240, 238, 0, 272, 269, 263, 0, 283, 0,
1000 0, 0, 153, 0, 252, 0, 0, 239, 281, 282,
1001 155, 0, 0, 0, 0, 154, 0, 0, 0, 0,
1002 288, 0, 253, 287, 0, 0, 0
1005 static const short yydefgoto
[] = { 775,
1006 210, 279, 211, 85, 86, 68, 60, 87, 212, 22,
1007 23, 24, 8, 9, 10, 11, 12, 13, 14, 15,
1008 283, 284, 132, 105, 47, 70, 104, 130, 162, 163,
1009 164, 91, 114, 115, 116, 213, 166, 259, 92, 111,
1010 181, 182, 136, 185, 398, 168, 169, 170, 261, 171,
1011 172, 402, 552, 553, 285, 18, 43, 72, 65, 107,
1012 44, 63, 94, 95, 96, 97, 214, 358, 286, 175,
1013 555, 720, 288, 289, 290, 291, 695, 292, 293, 294,
1014 295, 698, 296, 297, 298, 299, 699, 300, 444, 301,
1015 585, 655, 656, 657, 658, 302, 303, 701, 304, 305,
1016 306, 702, 307, 308, 451, 663, 664, 309, 310, 311,
1017 312, 313, 314, 315, 571, 572, 573, 574, 215, 216,
1018 217, 218, 489, 219, 470, 471, 472, 220, 221, 222,
1019 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
1020 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
1021 243, 244, 393, 490, 715
1024 static const short yypact
[] = { 507,
1025 -32768,-32768, 15, -30, 18, 244,-32768,-32768, 414, 443,
1026 556,-32768,-32768,-32768,-32768, 714,-32768,-32768,-32768,-32768,
1027 23,-32768,-32768,-32768, 359,-32768, 340,-32768, 49, 601,
1028 -32768,-32768, 585, 603,-32768, -30, 417,-32768,-32768, 92,
1029 -32768, 489, -24, 107,-32768, 529, 295,-32768,-32768, -30,
1030 710, 452,-32768, 344,-32768, 40,-32768,-32768,-32768,-32768,
1031 192, 1047,-32768, 530, -24,-32768,-32768, 388, 534,-32768,
1032 -32768, -24, 107,-32768, 295,-32768,-32768,-32768, 540,-32768,
1033 -32768,-32768, 548, 258,-32768,-32768, 307, 442, 736,-32768,
1034 -32768, 77,-32768, 1638,-32768,-32768,-32768,-32768,-32768,-32768,
1035 -32768,-32768,-32768, 312, 406,-32768, -24,-32768,-32768, 379,
1036 -18,-32768, 426, 331,-32768, 693, -18, 120, 210, 429,
1037 -32768, 564, 587,-32768,-32768,-32768,-32768, 593, 951,-32768,
1038 -32768, 406, 607, 617, 214,-32768,-32768,-32768, 618, 1077,
1039 219, 531,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -18,
1040 -32768, 361, -18,-32768,-32768, 460, 471,-32768, 494, 736,
1041 -32768, 1204,-32768,-32768, 500,-32768, 180,-32768, 535,-32768,
1042 -32768, 591,-32768,-32768, 1759,-32768,-32768,-32768, 620, 728,
1043 377,-32768,-32768,-32768, 613,-32768,-32768,-32768, 157,-32768,
1044 -32768, 2663, 2728, 2779, 2844, 655, 32, 707,-32768, 2895,
1045 2960, 3011, 5025,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1046 673, 881, 56,-32768, 678, 746,-32768, 640,-32768, 671,
1047 -32768, 715, 866,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1048 899, 921, 1006, 838, 920, 654, 814, 820, 847, 263,
1049 -32768,-32768,-32768, 850,-32768,-32768,-32768,-32768,-32768,-32768,
1050 -32768,-32768, 963, 591,-32768,-32768,-32768,-32768, 484, 769,
1051 775,-32768, -1, 306, 353, 3076,-32768, 232, 1357, 35,
1052 392, 419, 228, 424, 234, 779, 5324,-32768, -30, 538,
1053 974, 265, 872,-32768, 784,-32768, 1691,-32768,-32768, 789,
1054 -32768,-32768,-32768, 1827,-32768,-32768, 797,-32768,-32768,-32768,
1055 -32768, 1827,-32768, 1827,-32768,-32768, 5375, 802,-32768,-32768,
1056 -32768,-32768,-32768, 427,-32768, 737, 806, 866, 902, 916,
1057 -32768,-32768,-32768,-32768, 891, 642,-32768, 592, 660,-32768,
1058 189,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1059 409,-32768, 666, 964, 793, 793, 428,-32768,-32768,-32768,
1060 -32768,-32768, 777, 1121, 66,-32768,-32768, 622, 432, 5092,
1061 3127, 729,-32768, -28, 3192,-32768, 435,-32768,-32768, 3243,
1062 3308, 3359, 3424, 3475, 3540, 3591, 3656, 3707, 3772, 3823,
1063 3888, 864, 3939, 4004, 4055, 4120, 4171, 4236, 4287, 2032,
1064 -32768,-32768, 4352,-32768, 605,-32768,-32768,-32768, 810,-32768,
1065 -32768,-32768, 1691,-32768,-32768,-32768,-32768, 4403,-32768, 95,
1066 -32768,-32768, 126,-32768,-32768, 174,-32768, 4468,-32768, 4519,
1067 -32768, 785,-32768, 4933,-32768,-32768, 182, 269, 815, 2083,
1068 604,-32768,-32768, -30, 2148,-32768,-32768,-32768,-32768,-32768,
1069 1158,-32768,-32768, 823,-32768, 861, 1018, 728,-32768,-32768,
1070 -32768, 86, 2199,-32768, 4584,-32768, 891,-32768,-32768,-32768,
1071 -32768,-32768,-32768, 565, 836,-32768,-32768,-32768, 2264, 793,
1072 -32768, 590, 793, 590,-32768, 2315, 4635, 223, -43, 2380,
1073 191,-32768, 894,-32768, 1967,-32768,-32768,-32768, 649,-32768,
1074 -32768, 237,-32768,-32768,-32768,-32768,-32768, 839,-32768, 239,
1075 -32768, 5143,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 899,
1076 -32768, 899,-32768, 921,-32768, 921,-32768, 921,-32768, 1006,
1077 -32768, 1006,-32768, 1006,-32768, 1006,-32768, 258,-32768,-32768,
1078 838,-32768, 838,-32768, 920,-32768, 654,-32768, 814,-32768,
1079 820,-32768, 847,-32768, 933, 857,-32768,-32768,-32768,-32768,
1080 1254,-32768, 1691, 859, 856, 1691,-32768, 314,-32768,-32768,
1081 -32768,-32768,-32768,-32768,-32768, 348,-32768, 870, 461, 229,
1082 785,-32768, 535,-32768,-32768,-32768,-32768,-32768, 467, 815,
1083 -32768, 967, 14, 444,-32768, 878,-32768, 5067,-32768, 4958,
1084 876, 887, 892,-32768,-32768, 5208,-32768,-32768, 241,-32768,
1085 895, 299,-32768, 895,-32768,-32768, 406, 17,-32768,-32768,
1086 -32768, 4700, 487,-32768,-32768,-32768,-32768,-32768, 4751,-32768,
1087 -32768, 5259,-32768,-32768, 406, 704,-32768, 4816, 662,-32768,
1088 1691, 2431,-32768,-32768,-32768, 1893,-32768,-32768, 343,-32768,
1089 835,-32768,-32768,-32768,-32768,-32768,-32768, 2496,-32768,-32768,
1090 999, 91, 4867,-32768, 674,-32768, 1467,-32768, 5324,-32768,
1091 -32768,-32768, 928, 923, 5000,-32768, 410,-32768, 723,-32768,
1092 -32768,-32768,-32768,-32768,-32768, 406,-32768,-32768,-32768,-32768,
1093 -32768,-32768,-32768, 731,-32768, 406,-32768,-32768, 477,-32768,
1094 243, 108, 485,-32768, 978, 979, 1893,-32768,-32768, 1893,
1095 -32768,-32768, 942,-32768, 948, 950,-32768, 1053, 128,-32768,
1096 -32768,-32768,-32768,-32768, 328,-32768,-32768, 1540,-32768, 1608,
1097 -32768, 961, 1827,-32768, 970,-32768,-32768,-32768,-32768,-32768,
1098 -32768, 2547,-32768, 262, 4403, 1827,-32768,-32768, 2612,-32768,
1099 -32768,-32768,-32768, 1071,-32768,-32768,-32768, 980,-32768, 1827,
1100 296, 202,-32768, 358,-32768, 4958, 983,-32768,-32768,-32768,
1101 -32768, 302, 1893, 990, 5000,-32768, 1021, 1893, 992, 1893,
1102 -32768, 1893,-32768,-32768, 1087, 1089,-32768
1105 static const short yypgoto
[] = {-32768,
1106 -32768, -57, -60, 711, -16, -123, 568,-32768, -3, 552,
1107 -32768, 130,-32768, 1085, 791,-32768, 22,-32768,-32768, 778,
1108 12, 154,-32768,-32768, 1044, 1030,-32768, -128,-32768, 945,
1109 -32768, 382, -106, 973, -165, -193,-32768,-32768, 469, -58,
1110 865, -327, -40,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1111 957,-32768, 142,-32768, 718, -10,-32768,-32768,-32768,-32768,
1112 1072, 584,-32768, 1031,-32768,-32768, 372,-32768, -122, 867,
1113 843, -166, -279,-32768, 819, -234, 197, -551,-32768, -529,
1114 -32768,-32768,-32768, -301,-32768,-32768,-32768,-32768,-32768,-32768,
1115 -32768,-32768, 476, 486, -619, -496,-32768,-32768,-32768,-32768,
1116 -32768,-32768,-32768, -436,-32768, -603, 832,-32768,-32768,-32768,
1117 -32768,-32768,-32768,-32768,-32768, 569,-32768, 573,-32768,-32768,
1118 119,-32768, -386,-32768, 799, 362, -326, 858, 163, 1120,
1119 320, 437, 438, -112, 560, 636, -470,-32768, 632, 724,
1120 651, 625, 761, 765, 760, 764, 776,-32768, 526, 771,
1121 717,-32768,-32768, 29,-32768
1128 static const short yytable
[] = { 21,
1129 459, 84, 29, 176, 83, 450, 174, 438, 287, 357,
1130 184, 16, 614, 325, 650, 19, 152, 675, 26, 474,
1131 16, 16, 16, 38, 117, 59, 479, 481, 84, 67,
1132 31, 123, 342, 84, 134, 342, 83, 721, 61, 174,
1133 76, 16, 61, 497, 16, 16, 260, 59, 583, 48,
1134 612, 93, 59, 602, 31, 20, 363, 20, 88, 442,
1135 61, 725, 16, 150, 153, 61, 482, 445, 84, 446,
1136 62, 83, 84, 89, 347, 179, 143, 124, 135, 334,
1137 336, 338, 340, 93, 696, 88, 587, 349, 351, 608,
1138 88, 711, 55, 404, 405, 559, 56, 406, 721, 84,
1139 20, 84, 123, 20, 83, 89, 697, 651, 650, 249,
1140 676, 59, 251, 619, 280, 626, 619, 67, 173, 84,
1141 144, 39, 326, 40, 61, 88, 561, -157, 743, 88,
1142 61, 262, 343, 25, 27, 343, 399, 345, 77, 700,
1143 160, 353, 680, 601, 180, 696, 604, 49, 696, 50,
1144 422, 173, 764, 17, -94, -94, 88, 137, 88, 483,
1145 457, 769, 17, 17, 17, 52, 54, 697, 245, 57,
1146 697, 281, 429, 160, 563, 125, 88, 20, 712, 57,
1147 258, 346, 576, 17, -294, 588, 17, 17, 331, 331,
1148 331, 331, 84, 560, 61, 179, 331, 331, 354, 703,
1149 700, 734, 743, 700, 17, 461, 64, 619, 110, 669,
1150 146, 696, 113, 396, 186, 90, 696, 145, 696, 246,
1151 696, 744, 84, 611, 562, 434, 280, 619, 421, 642,
1152 355, 245, 411, 697, 425, 684, 556, 620, 697, 623,
1153 697, 670, 697, 649, 28, 692, 280, 90, -97, 88,
1154 -97, 110, 113, -97, -97, -97, -97, 504, 506, 508,
1155 703, 709, 710, 703, 180, 432, 700, 84, 189, 482,
1156 179, 700, 564, 700, -104, 700, 438, 389, -104, 88,
1157 577, 360, 161, 281, 613, 361, 661, 602, 450, 362,
1158 441, 617, 50, 316, 410, 762, 742, 416, 441, 672,
1159 441, 619, 758, 447, 282, 428, -322, 147, 189, -25,
1160 -25, 187, 67, 706, 635, 161, 247, 20, 448, 20,
1161 598, 528, 157, 157, 88, 61, 703, 580, 745, 20,
1162 412, 703, 426, 703, 621, 703, 624, 317, 671, 180,
1163 45, 733, 280, 704, 74, 752, 69, 367, 637, 390,
1164 -25, 438, 433, 407, 118, -25, -25, -25, 635, 41,
1165 753, -25, 578, 450, 610, -25, 331, 331, 331, 331,
1166 331, 331, 331, 331, 331, 331, 331, 331, 88, 331,
1167 331, 331, 331, 331, 331, 331, 631, 84, 101, 492,
1168 434, -65, 417, 500, 761, -65, 673, 413, -322, 551,
1169 766, 694, 46, 119, 427, 316, 46, 636, 189, 462,
1170 726, 128, 316, -30, 1, 746, 282, 53, 546, 419,
1171 316, 42, 316, 282, 423, 316, 137, 454, 475, 138,
1172 139, 282, 486, 282, -65, 501, 558, -256, -65, -66,
1173 438, 638, -31, 1, 88, 408, 566, 643, 568, 317,
1174 646, 763, 71, -158, 450, 189, 317, 2, 492, 250,
1175 139, 640, 442, 450, 317, 445, 317, 647, 3, 317,
1176 327, 133, 465, 331, 4, 463, 328, 647, 674, 331,
1177 5, 591, -66, 593, 418, 407, 2, 679, 749, 58,
1178 652, 57, 280, 498, 318, 280, 685, 599, 487, 678,
1179 129, 755, 20, 4, 157, 653, -28, 1, 492, 5,
1180 165, 420, 7, 245, 42, 760, 424, -97, 133, 455,
1181 476, 316, -97, -97, -97, -97, 148, 502, 694, 66,
1182 98, 248, 282, 749, 102, 755, 78, 760, 120, 654,
1183 109, 7, 50, 165, 727, 196, -160, 729, 112, 281,
1184 2, 197, 281, 641, -139, -29, 1, 731, 198, 648,
1185 57, 3, 199, 189, 149, 317, 252, 4, 80, 732,
1186 280, 81, 20, 5, 20, 200, 201, 735, 157, 202,
1187 84, 6, 397, 179, -32, 1, 253, 151, 204, 205,
1188 206, 207, 458, 154, 208, 209, 280, 167, 257, 2,
1189 -34, 1, -33, 1, 493, 7, 318, 177, 331, 331,
1190 3, 319, 320, 318, 20, 20, 4, 183, 188, 20,
1191 324, 318, 5, 318, 331, 20, 318, 281, 2, 157,
1192 167, 99, 441, 20, 118, 2, 103, 88, 359, 3,
1193 366, 78, 456, 134, 2, 4, 2, 682, 100, 20,
1194 2, 5, 180, 281, 7, 106, 78, 280, 594, 280,
1195 460, 4, 493, 4, 385, 595, 464, 5, 579, 5,
1196 494, 316, 20, 80, 316, 495, 81, 20, 20, 496,
1197 159, 714, 282, 7, 203, 282, 602, 722, 80, 20,
1198 131, 81, 20, 441, 630, 155, 441, 634, 549, 7,
1199 178, 7, 20, 20, 328, 20, 316, 344, 316, -35,
1200 1, 159, 329, 159, 281, 317, 281, 484, 317, 441,
1201 652, 485, 318, 319, 320, 20, 689, 20, 494, 493,
1202 319, 320, 441, 495, 321, 653, 121, 496, 319, 320,
1203 319, 320, 618, 319, 320, 20, 441, 20, 619, 316,
1204 317, 20, 317, 2, 316, 341, 78, 35, 57, 441,
1205 282, -497, -497, 754, 441, 282, 441, 757, 441, 716,
1206 4, 35, 690, 359, 36, 316, 5, 78, 364, 35,
1207 37, -341, -341, 316, 140, 78, 282, 32, 80, 141,
1208 142, 81, 20, 317, 122, 494, 36, 686, 317, 30,
1209 495, 34, 37, 619, 496, -498, -498, 32, 7, 80,
1210 322, 32, 81, 20, 20, 316, 728, 80, 316, 317,
1211 81, 20, 619, 51, 730, 386, 282, 317, 32, 282,
1212 619, 600, 387, -341, 600, 705, 316, -341, 316, 319,
1213 320, 316, 365, 603, 569, 605, 321, 282, 570, 282,
1214 -343, -343, 282, 321, 316, 378, 379, 380, 381, 317,
1215 388, 321, 317, 321, 527, 282, 321, 400, 316, 401,
1216 477, -156, 318, 478, 316, 318, 435, 359, 2, 282,
1217 317, 316, 317, 316, 78, 317, 316, 439, 316, 469,
1218 316, 323, 282, 737, 382, 443, 738, 282, 317, 282,
1219 453, 282, -343, 370, 371, 372, -343, 318, 550, 318,
1220 368, 369, 317, 78, 139, 35, 80, 584, 317, 81,
1221 20, 78, 322, 373, 374, 317, 586, 317, 596, 322,
1222 317, 622, 317, 627, 317, 383, 384, 322, 37, 322,
1223 391, 392, 322, 78, 628, 80, -407, -407, 81, 20,
1224 318, 632, 196, 80, 633, 318, 81, 20, 197, 767,
1225 -408, -408, 321, 639, 771, 198, 773, 649, 774, 199,
1226 659, -496, -496, 360, 665, 80, 318, 361, 81, 20,
1227 666, 362, 200, 201, 318, 667, 202, 141, 142, 319,
1228 320, 602, 319, 320, 156, 204, 205, 206, 207, 710,
1229 78, 208, 209, 323, 510, 512, 2, 531, 533, 79,
1230 323, 4, 78, 375, 376, 377, 318, 5, 323, 318,
1231 323, 723, 588, 323, 319, 320, 319, 320, 520, 522,
1232 524, 526, 80, 736, -207, 81, 20, 318, 322, 318,
1233 739, 740, 318, 741, 80, 157, 158, 81, 20, 332,
1234 332, 332, 332, 742, 748, 318, 394, 332, 332, -15,
1235 466, 467, 468, 750, -496, -496, 360, 319, 320, 318,
1236 430, 758, 319, 320, 431, 318, 770, 191, 759, 192,
1237 193, 765, 318, 768, 318, 772, 776, 318, 777, 318,
1238 2, 318, 529, 319, 320, 33, 78, 75, 514, 516,
1239 518, 319, 320, -15, 108, 79, 256, 4, -496, -496,
1240 360, 190, 321, 5, 430, 321, 254, 395, 362, 323,
1241 554, 194, 195, 73, 127, 449, 78, 403, 80, 437,
1242 717, 81, 20, 319, 320, 196, 319, 320, 452, 644,
1243 718, 197, 82, 645, 473, 535, 539, 321, 198, 321,
1244 537, 541, 199, 688, 319, 320, 319, 320, 80, 319,
1245 320, 81, 20, 548, 543, 200, 201, 0, 0, 202,
1246 0, 203, 319, 320, 0, 0, 0, 0, 204, 205,
1247 206, 207, 0, 0, 208, 209, 319, 320, 322, 0,
1248 321, 322, 319, 320, 0, 321, 0, 0, 0, 319,
1249 320, 319, 320, 0, 319, 320, 319, 320, 319, 320,
1250 0, -496, -496, 360, 0, 0, 321, 480, 0, 0,
1251 0, 362, 0, 322, 321, 322, 0, 332, 332, 332,
1252 332, 332, 332, 332, 332, 332, 332, 332, 332, 0,
1253 332, 332, 332, 332, 332, 332, 332, 156, -496, -496,
1254 360, 0, 0, 78, 361, 0, 321, 0, 431, 321,
1255 0, 0, 79, 0, 4, 0, 322, 0, 0, 323,
1256 5, 322, 323, 0, 0, 0, 0, 321, 0, 321,
1257 0, 0, 321, 0, 0, 80, 0, 0, 81, 20,
1258 0, 0, 322, 0, 0, 321, 0, 0, 157, 255,
1259 322, 0, 0, 0, 323, 0, 323, 0, 0, 321,
1260 0, 333, 333, 333, 333, 321, 0, 0, 0, 333,
1261 333, 0, 321, 0, 321, 0, 0, 321, 0, 321,
1262 0, 321, 322, 0, 332, 322, 0, 0, 0, -15,
1263 332, 0, 0, 0, -496, -496, 360, 323, 0, 0,
1264 430, 0, 323, 322, 629, 322, 0, 414, 322, 192,
1265 193, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1266 0, 322, 0, 323, 0, 0, 0, 0, 0, 0,
1267 0, 323, 0, 0, 0, 322, 0, 0, 0, 0,
1268 0, 322, 0, 0, 0, 0, 0, 0, 322, 0,
1269 322, 194, 195, 322, 0, 322, 78, 322, 0, 0,
1270 0, 0, 0, 323, 0, 196, 323, 0, 0, 0,
1271 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1272 0, 0, 199, 0, 323, 0, 323, 0, 80, 323,
1273 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1274 0, 0, 323, 0, 0, 415, 0, 0, 204, 205,
1275 206, 207, 0, 0, 208, 209, 323, 263, 0, 332,
1276 332, 0, 323, 0, 0, 0, 0, 0, 0, 323,
1277 0, 323, 0, 0, 323, 332, 323, 0, 323, 333,
1278 333, 333, 333, 333, 333, 333, 333, 333, 333, 333,
1279 333, 0, 333, 333, 333, 333, 333, 333, 333, 0,
1280 264, 194, 195, 652, 265, 266, 78, 267, 0, 0,
1281 268, 0, 0, 0, 269, 196, 0, 0, 653, 0,
1282 0, 270, 271, 5, 272, 0, 273, 274, 198, 275,
1283 263, 0, 276, 0, 0, 0, 0, 0, 80, 0,
1284 0, 81, 20, 0, 0, 0, 0, 0, 0, 277,
1285 0, 157, 719, 0, 0, 278, 0, 0, 204, 205,
1286 206, 207, 0, 0, 208, 209, 0, 0, 0, 0,
1287 0, 0, 0, 264, 194, 195, 652, 265, 266, 78,
1288 267, 0, 0, 268, 0, 0, 333, 269, 196, 0,
1289 0, 653, 333, 0, 270, 271, 5, 272, 263, 273,
1290 274, 198, 275, 0, 0, 276, 0, 0, 0, 0,
1291 0, 80, 0, 0, 81, 20, 0, 0, 0, 0,
1292 0, 0, 277, 0, 157, 747, 0, 0, 278, 0,
1293 0, 204, 205, 206, 207, 0, 0, 208, 209, 0,
1294 0, 264, 194, 195, -266, 265, 266, 78, 267, 0,
1295 0, 268, 0, 0, 0, 269, 196, 0, 0, -266,
1296 0, 0, 270, 271, 5, 272, 0, 273, 274, 198,
1297 275, 2, 0, 276, 0, 0, 0, 78, 0, 80,
1298 0, 263, 81, 20, 0, 0, 79, 0, 4, 0,
1299 277, 0, 157, -266, 5, 0, 278, 0, 0, 204,
1300 205, 206, 207, 0, 0, 208, 209, 0, 0, 80,
1301 0, 0, 81, 20, 0, 0, 0, 0, 0, 0,
1302 0, 333, 333, 126, 264, 194, 195, 0, 265, 266,
1303 78, 267, 0, 0, 268, 0, 0, 333, 269, 196,
1304 0, 0, 0, 0, 0, 270, 271, 5, 272, 263,
1305 273, 274, 198, 275, 0, 0, 276, 0, 0, 0,
1306 0, 0, 80, 0, 0, 81, 20, 0, 0, 0,
1307 0, 0, 0, 277, 0, 157, 436, 0, 0, 278,
1308 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1309 0, 0, 264, 194, 195, 0, 265, 266, 78, 267,
1310 0, 0, 268, 0, 0, 0, 269, 196, 0, 0,
1311 0, 0, 0, 270, 271, 5, 272, 263, 273, 274,
1312 198, 275, 0, 0, 276, 0, 0, 0, 0, 0,
1313 80, 0, 0, 81, 20, 0, 0, 0, 0, 0,
1314 0, 277, 0, 157, 0, 0, 0, 278, 0, 0,
1315 204, 205, 206, 207, 0, 0, 208, 209, 0, 0,
1316 440, 194, 195, 0, 265, 266, 78, 267, 0, 0,
1317 268, 0, 0, 0, 269, 196, 0, 0, 0, 0,
1318 0, 270, 271, 263, 272, 0, 273, 274, 198, 275,
1319 0, 0, 276, 0, 0, 0, 0, 0, 80, 0,
1320 0, 81, 20, 0, 0, 0, 0, 0, 0, 277,
1321 0, 157, 0, 0, 0, 278, 0, 0, 204, 205,
1322 206, 207, 0, 0, 208, 209, 440, 194, 195, 0,
1323 693, 266, 78, 267, 0, 0, 268, 0, 0, 0,
1324 269, 196, 0, 0, 0, 0, 0, 270, 271, 0,
1325 272, 0, 273, 274, 198, 275, 0, 615, 276, 192,
1326 193, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1327 0, 0, 0, 0, 0, 277, 0, 157, 0, 0,
1328 0, 278, 0, 0, 204, 205, 206, 207, 0, 0,
1329 208, 209, 0, 0, 0, 0, 0, 0, 0, 0,
1330 0, 194, 195, 0, 0, 0, 78, 0, 0, 0,
1331 0, 0, 0, 0, 0, 196, 0, 0, 0, 0,
1332 0, 197, 544, 0, 192, 193, 0, 0, 198, 0,
1333 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1334 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1335 0, 203, 616, 0, 0, 0, 0, 0, 204, 205,
1336 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1337 0, 78, 0, 491, 0, 192, 193, 0, 0, 0,
1338 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1339 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1340 0, 0, 0, 80, 0, 0, 81, 20, 0, 545,
1341 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1342 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1343 209, 196, 0, 0, 0, 0, 0, 197, 581, 0,
1344 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1345 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1346 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1347 148, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1348 208, 209, 194, 195, 0, 0, 0, 78, 0, 589,
1349 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1350 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1351 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1352 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1353 202, 582, 0, 194, 195, 0, 0, 0, 78, 204,
1354 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1355 0, 0, 0, 197, 597, 0, 192, 193, 0, 0,
1356 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1357 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1358 0, 202, 0, 0, 0, 0, 0, 590, 0, 0,
1359 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1360 0, 0, 0, 78, 0, 606, 0, 192, 193, 0,
1361 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1362 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1363 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1364 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1365 195, 598, 0, 0, 78, 204, 205, 206, 207, 0,
1366 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1367 491, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1368 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1369 20, 0, 0, 200, 201, 0, 0, 202, 607, 0,
1370 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1371 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1372 0, 581, 0, 192, 193, 0, 0, 0, 196, 0,
1373 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1374 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1375 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1376 0, 0, 202, 0, 0, 194, 195, 598, 0, 0,
1377 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1378 0, 0, 0, 0, 0, 197, 707, 0, 192, 193,
1379 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1380 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1381 201, 0, 0, 202, 691, 0, 0, 0, 0, 0,
1382 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1383 194, 195, 0, 0, 0, 78, 0, 707, 0, 192,
1384 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1385 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1386 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1387 81, 20, 0, 0, 200, 201, 0, 0, 202, 708,
1388 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1389 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1390 0, 197, 589, 0, 192, 193, 0, 0, 198, 0,
1391 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1392 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1393 751, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1394 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1395 0, 78, 0, 330, 0, 192, 193, 0, 0, 0,
1396 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1397 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1398 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1399 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1400 756, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1401 209, 196, 0, 0, 0, 0, 0, 197, 335, 0,
1402 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1403 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1404 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1405 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1406 208, 209, 194, 195, 0, 0, 0, 78, 0, 337,
1407 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1408 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1409 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1410 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1411 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1412 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1413 0, 0, 0, 197, 339, 0, 192, 193, 0, 0,
1414 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1415 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1416 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1417 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1418 0, 0, 0, 78, 0, 348, 0, 192, 193, 0,
1419 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1420 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1421 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1422 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1423 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1424 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1425 350, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1426 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1427 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1428 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1429 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1430 0, 352, 0, 192, 193, 0, 0, 0, 196, 0,
1431 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1432 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1433 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1434 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1435 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1436 0, 0, 0, 0, 0, 197, 409, 0, 192, 193,
1437 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1438 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1439 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1440 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1441 194, 195, 0, 0, 0, 78, 0, 491, 0, 192,
1442 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1443 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1444 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1445 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1446 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1447 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1448 0, 197, 499, 0, 192, 193, 0, 0, 198, 0,
1449 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1450 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1451 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1452 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1453 0, 78, 0, 503, 0, 192, 193, 0, 0, 0,
1454 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1455 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1456 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1457 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1458 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1459 209, 196, 0, 0, 0, 0, 0, 197, 505, 0,
1460 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1461 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1462 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1463 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1464 208, 209, 194, 195, 0, 0, 0, 78, 0, 507,
1465 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1466 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1467 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1468 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1469 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1470 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1471 0, 0, 0, 197, 509, 0, 192, 193, 0, 0,
1472 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1473 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1474 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1475 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1476 0, 0, 0, 78, 0, 511, 0, 192, 193, 0,
1477 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1478 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1479 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1480 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1481 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1482 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1483 513, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1484 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1485 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1486 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1487 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1488 0, 515, 0, 192, 193, 0, 0, 0, 196, 0,
1489 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1490 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1491 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1492 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1493 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1494 0, 0, 0, 0, 0, 197, 517, 0, 192, 193,
1495 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1496 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1497 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1498 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1499 194, 195, 0, 0, 0, 78, 0, 519, 0, 192,
1500 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1501 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1502 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1503 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1504 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1505 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1506 0, 197, 521, 0, 192, 193, 0, 0, 198, 0,
1507 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1508 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1509 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1510 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1511 0, 78, 0, 523, 0, 192, 193, 0, 0, 0,
1512 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1513 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1514 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1515 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1516 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1517 209, 196, 0, 0, 0, 0, 0, 197, 525, 0,
1518 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1519 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1520 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1521 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1522 208, 209, 194, 195, 0, 0, 0, 78, 0, 530,
1523 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1524 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1525 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1526 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1527 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1528 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1529 0, 0, 0, 197, 532, 0, 192, 193, 0, 0,
1530 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1531 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1532 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1533 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1534 0, 0, 0, 78, 0, 534, 0, 192, 193, 0,
1535 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1536 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1537 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1538 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1539 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1540 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1541 536, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1542 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1543 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1544 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1545 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1546 0, 538, 0, 192, 193, 0, 0, 0, 196, 0,
1547 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1548 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1549 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1550 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1551 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1552 0, 0, 0, 0, 0, 197, 540, 0, 192, 193,
1553 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1554 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1555 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1556 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1557 194, 195, 0, 0, 0, 78, 0, 542, 0, 192,
1558 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1559 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1560 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1561 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1562 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1563 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1564 0, 197, 547, 0, 192, 193, 0, 0, 198, 0,
1565 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1566 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1567 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1568 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1569 0, 78, 0, 557, 0, 192, 193, 0, 0, 0,
1570 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1571 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1572 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1573 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1574 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1575 209, 196, 0, 0, 0, 0, 0, 197, 565, 0,
1576 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1577 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1578 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1579 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1580 208, 209, 194, 195, 0, 0, 0, 78, 0, 567,
1581 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1582 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1583 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1584 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1585 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1586 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1587 0, 0, 0, 197, 592, 0, 192, 193, 0, 0,
1588 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1589 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1590 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1591 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1592 0, 0, 0, 78, 0, 609, 0, 192, 193, 0,
1593 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1594 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1595 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1596 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1597 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1598 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1599 677, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1600 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1601 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1602 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1603 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1604 0, 681, 0, 192, 193, 0, 0, 0, 196, 0,
1605 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1606 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1607 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1608 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1609 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1610 0, 0, 0, 0, 0, 197, 687, 0, 192, 193,
1611 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1612 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1613 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1614 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1615 194, 195, 0, 0, 0, 78, 0, 713, 0, 192,
1616 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1617 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1618 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1619 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1620 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1621 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1622 0, 197, 0, 575, 0, 0, 0, 0, 198, 0,
1623 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1624 0, 81, 20, 0, 0, 200, 201, 0, 662, 202,
1625 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1626 206, 207, 0, 0, 208, 209, -289, -289, -289, 0,
1627 0, 0, -289, 0, 0, 0, 0, 0, 0, 0,
1628 0, -289, 0, 0, 0, 0, 0, -289, 0, 0,
1629 724, 0, 194, 195, -289, 0, 0, 78, -289, 0,
1630 0, 0, 0, 0, -289, 0, 196, -289, -289, 0,
1631 0, 0, 197, 0, 0, -289, 0, 192, 193, 198,
1632 0, -289, 0, 199, -289, -289, -289, -289, 0, 80,
1633 -289, -289, 81, 20, 194, 195, 0, 0, 0, 78,
1634 277, -297, 0, 0, 0, 0, 0, 0, 196, 204,
1635 205, 206, 207, 0, 197, 208, 209, 660, 0, 194,
1636 195, 198, 0, 0, 78, 199, 0, 0, 0, 0,
1637 0, 80, 0, 196, 81, 20, 0, 0, 0, 197,
1638 0, 0, 277, -297, 192, 193, 198, 0, 0, 0,
1639 199, 204, 205, 206, 207, 0, 80, 208, 209, 81,
1640 20, 194, 195, 200, 201, 0, 78, 202, 0, 203,
1641 356, 0, 0, 0, 0, 196, 204, 205, 206, 207,
1642 0, 197, 208, 209, 0, 0, 194, 195, 198, 0,
1643 0, 78, 199, 0, 0, 192, 193, 0, 80, 0,
1644 196, 81, 20, 0, 0, 0, 197, 0, 0, 277,
1645 0, 0, 0, 198, 0, 0, 0, 199, 204, 205,
1646 206, 207, 0, 80, 208, 209, 81, 20, 0, 0,
1647 200, 201, 0, 0, 202, 488, 0, 194, 195, 0,
1648 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1649 209, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1650 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1651 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1652 0, 200, 201, 0, 0, 202, 625, 0, 0, 0,
1653 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1654 208, 209, 194, 195, 0, 0, 0, 78, 0, 0,
1655 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1656 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1657 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1658 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1659 202, 668, 0, 194, 195, 0, 0, 0, 78, 204,
1660 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1661 0, 0, 0, 197, 0, 0, 192, 193, 0, 0,
1662 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1663 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1664 0, 202, 683, 0, 0, 0, 0, 0, 0, 0,
1665 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1666 0, 0, 0, 78, 0, 0, 0, 0, 0, 0,
1667 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1668 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1669 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1670 0, 0, 200, 201, 0, 0, 202, 0, 2, 194,
1671 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1672 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1673 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1674 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1675 20, 0, 0, 0, 0, 0, 0, 277, 0, 0,
1676 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1680 static const short yycheck
[] = { 3,
1681 328, 62, 6, 132, 62, 307, 129, 287, 175, 203,
1682 134, 0, 483, 179, 1, 1, 123, 1, 1, 346,
1683 9, 10, 11, 1, 83, 42, 353, 354, 89, 46,
1684 9, 89, 1, 94, 53, 1, 94, 657, 42, 162,
1685 1, 30, 46, 72, 33, 34, 169, 64, 435, 1,
1686 94, 62, 69, 97, 33, 86, 1, 86, 62, 294,
1687 64, 665, 51, 122, 123, 69, 1, 302, 129, 304,
1688 95, 129, 133, 62, 198, 133, 117, 1, 97, 192,
1689 193, 194, 195, 94, 636, 89, 1, 200, 201, 476,
1690 94, 1, 1, 95, 96, 1, 5, 99, 718, 160,
1691 86, 162, 160, 86, 162, 94, 636, 94, 1, 150,
1692 94, 128, 153, 100, 175, 502, 100, 134, 129, 180,
1693 1, 99, 180, 101, 128, 129, 1, 93, 1, 133,
1694 134, 172, 101, 4, 5, 101, 259, 198, 99, 636,
1695 129, 202, 613, 470, 133, 697, 473, 99, 700, 101,
1696 273, 162, 756, 0, 99, 100, 160, 1, 162, 94,
1697 326, 765, 9, 10, 11, 36, 37, 697, 140, 40,
1698 700, 175, 279, 162, 1, 99, 180, 86, 88, 50,
1699 1, 198, 1, 30, 99, 100, 33, 34, 192, 193,
1700 194, 195, 253, 99, 198, 253, 200, 201, 202, 636,
1701 697, 94, 1, 700, 51, 329, 100, 100, 79, 596,
1702 1, 763, 83, 254, 1, 62, 768, 98, 770, 1,
1703 772, 94, 283, 1, 99, 283, 287, 100, 1, 1,
1704 202, 203, 1, 763, 1, 622, 403, 1, 768, 1,
1705 770, 1, 772, 1, 1, 632, 307, 94, 92, 253,
1706 94, 122, 123, 97, 98, 99, 100, 370, 371, 372,
1707 697, 648, 1, 700, 253, 1, 763, 328, 139, 1,
1708 328, 768, 99, 770, 95, 772, 556, 15, 99, 283,
1709 99, 93, 129, 287, 94, 97, 588, 97, 590, 101,
1710 294, 485, 101, 175, 266, 94, 1, 269, 302, 1,
1711 304, 100, 1, 307, 175, 277, 1, 98, 179, 45,
1712 46, 98, 329, 641, 1, 162, 98, 86, 307, 86,
1713 98, 382, 95, 95, 328, 329, 763, 434, 1, 86,
1714 99, 768, 99, 770, 98, 772, 98, 175, 98, 328,
1715 1, 99, 403, 1, 1, 732, 52, 218, 1, 87,
1716 86, 631, 88, 1, 97, 91, 92, 93, 1, 1,
1717 99, 97, 94, 665, 477, 101, 370, 371, 372, 373,
1718 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
1719 384, 385, 386, 387, 388, 389, 553, 448, 1, 361,
1720 448, 52, 1, 365, 99, 52, 98, 268, 93, 403,
1721 99, 636, 63, 97, 275, 287, 63, 94, 279, 1,
1722 1, 100, 294, 0, 1, 88, 287, 1, 390, 1,
1723 302, 63, 304, 294, 1, 307, 1, 1, 1, 99,
1724 100, 302, 1, 304, 95, 1, 408, 95, 95, 52,
1725 720, 94, 0, 1, 448, 93, 418, 570, 420, 287,
1726 573, 94, 1, 95, 756, 326, 294, 44, 430, 99,
1727 100, 1, 697, 765, 302, 700, 304, 1, 55, 307,
1728 94, 93, 343, 477, 61, 67, 100, 1, 607, 483,
1729 67, 453, 95, 455, 93, 1, 44, 1, 723, 1,
1730 47, 362, 553, 364, 175, 556, 625, 469, 67, 612,
1731 95, 736, 86, 61, 95, 62, 0, 1, 480, 67,
1732 129, 93, 99, 485, 63, 750, 93, 92, 93, 93,
1733 93, 403, 97, 98, 99, 100, 98, 93, 763, 1,
1734 1, 1, 403, 768, 1, 770, 50, 772, 97, 96,
1735 1, 99, 101, 162, 667, 59, 95, 676, 1, 553,
1736 44, 65, 556, 93, 95, 0, 1, 686, 72, 93,
1737 431, 55, 76, 434, 1, 403, 96, 61, 82, 93,
1738 631, 85, 86, 67, 86, 89, 90, 93, 95, 93,
1739 641, 75, 99, 641, 0, 1, 93, 1, 102, 103,
1740 104, 105, 1, 1, 108, 109, 657, 129, 99, 44,
1741 0, 1, 0, 1, 1, 99, 287, 1, 612, 613,
1742 55, 175, 175, 294, 86, 86, 61, 1, 1, 86,
1743 1, 302, 67, 304, 628, 86, 307, 631, 44, 95,
1744 162, 64, 636, 86, 97, 44, 69, 641, 101, 55,
1745 1, 50, 1, 53, 44, 61, 44, 619, 65, 86,
1746 44, 67, 641, 657, 99, 72, 50, 718, 94, 720,
1747 1, 61, 1, 61, 11, 101, 1, 67, 65, 67,
1748 67, 553, 86, 82, 556, 72, 85, 86, 86, 76,
1749 129, 653, 553, 99, 95, 556, 97, 659, 82, 86,
1750 107, 85, 86, 697, 553, 128, 700, 556, 94, 99,
1751 94, 99, 86, 86, 100, 86, 588, 1, 590, 0,
1752 1, 160, 100, 162, 718, 553, 720, 96, 556, 723,
1753 47, 100, 403, 287, 287, 86, 65, 86, 67, 1,
1754 294, 294, 736, 72, 175, 62, 1, 76, 302, 302,
1755 304, 304, 94, 307, 307, 86, 750, 86, 100, 631,
1756 588, 86, 590, 44, 636, 101, 50, 44, 629, 763,
1757 631, 91, 92, 735, 768, 636, 770, 739, 772, 96,
1758 61, 44, 631, 101, 61, 657, 67, 50, 101, 44,
1759 67, 45, 46, 665, 92, 50, 657, 10, 82, 97,
1760 98, 85, 86, 631, 59, 67, 61, 94, 636, 9,
1761 72, 11, 67, 100, 76, 91, 92, 30, 99, 82,
1762 175, 34, 85, 86, 86, 697, 94, 82, 700, 657,
1763 85, 86, 100, 33, 94, 12, 697, 665, 51, 700,
1764 100, 470, 13, 97, 473, 1, 718, 101, 720, 403,
1765 403, 723, 97, 472, 60, 474, 287, 718, 64, 720,
1766 45, 46, 723, 294, 736, 18, 19, 20, 21, 697,
1767 14, 302, 700, 304, 1, 736, 307, 99, 750, 95,
1768 94, 93, 553, 97, 756, 556, 93, 101, 44, 750,
1769 718, 763, 720, 765, 50, 723, 768, 99, 770, 97,
1770 772, 175, 763, 697, 57, 99, 700, 768, 736, 770,
1771 99, 772, 97, 5, 6, 7, 101, 588, 99, 590,
1772 45, 46, 750, 50, 100, 44, 82, 95, 756, 85,
1773 86, 50, 287, 3, 4, 763, 66, 765, 93, 294,
1774 768, 93, 770, 1, 772, 16, 17, 302, 67, 304,
1775 91, 92, 307, 50, 88, 82, 45, 46, 85, 86,
1776 631, 93, 59, 82, 99, 636, 85, 86, 65, 763,
1777 45, 46, 403, 94, 768, 72, 770, 1, 772, 76,
1778 93, 91, 92, 93, 99, 82, 657, 97, 85, 86,
1779 94, 101, 89, 90, 665, 94, 93, 97, 98, 553,
1780 553, 97, 556, 556, 44, 102, 103, 104, 105, 1,
1781 50, 108, 109, 287, 373, 374, 44, 383, 384, 59,
1782 294, 61, 50, 8, 9, 10, 697, 67, 302, 700,
1783 304, 94, 100, 307, 588, 588, 590, 590, 378, 379,
1784 380, 381, 82, 56, 56, 85, 86, 718, 403, 720,
1785 99, 94, 723, 94, 82, 95, 96, 85, 86, 192,
1786 193, 194, 195, 1, 94, 736, 94, 200, 201, 86,
1787 97, 98, 99, 94, 91, 92, 93, 631, 631, 750,
1788 97, 1, 636, 636, 101, 756, 56, 1, 99, 3,
1789 4, 99, 763, 94, 765, 94, 0, 768, 0, 770,
1790 44, 772, 382, 657, 657, 11, 50, 54, 375, 376,
1791 377, 665, 665, 86, 75, 59, 162, 61, 91, 92,
1792 93, 139, 553, 67, 97, 556, 160, 253, 101, 403,
1793 403, 45, 46, 52, 94, 307, 50, 261, 82, 287,
1794 655, 85, 86, 697, 697, 59, 700, 700, 307, 571,
1795 655, 65, 96, 571, 346, 385, 387, 588, 72, 590,
1796 386, 388, 76, 628, 718, 718, 720, 720, 82, 723,
1797 723, 85, 86, 393, 389, 89, 90, -1, -1, 93,
1798 -1, 95, 736, 736, -1, -1, -1, -1, 102, 103,
1799 104, 105, -1, -1, 108, 109, 750, 750, 553, -1,
1800 631, 556, 756, 756, -1, 636, -1, -1, -1, 763,
1801 763, 765, 765, -1, 768, 768, 770, 770, 772, 772,
1802 -1, 91, 92, 93, -1, -1, 657, 97, -1, -1,
1803 -1, 101, -1, 588, 665, 590, -1, 370, 371, 372,
1804 373, 374, 375, 376, 377, 378, 379, 380, 381, -1,
1805 383, 384, 385, 386, 387, 388, 389, 44, 91, 92,
1806 93, -1, -1, 50, 97, -1, 697, -1, 101, 700,
1807 -1, -1, 59, -1, 61, -1, 631, -1, -1, 553,
1808 67, 636, 556, -1, -1, -1, -1, 718, -1, 720,
1809 -1, -1, 723, -1, -1, 82, -1, -1, 85, 86,
1810 -1, -1, 657, -1, -1, 736, -1, -1, 95, 96,
1811 665, -1, -1, -1, 588, -1, 590, -1, -1, 750,
1812 -1, 192, 193, 194, 195, 756, -1, -1, -1, 200,
1813 201, -1, 763, -1, 765, -1, -1, 768, -1, 770,
1814 -1, 772, 697, -1, 477, 700, -1, -1, -1, 86,
1815 483, -1, -1, -1, 91, 92, 93, 631, -1, -1,
1816 97, -1, 636, 718, 101, 720, -1, 1, 723, 3,
1817 4, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1818 -1, 736, -1, 657, -1, -1, -1, -1, -1, -1,
1819 -1, 665, -1, -1, -1, 750, -1, -1, -1, -1,
1820 -1, 756, -1, -1, -1, -1, -1, -1, 763, -1,
1821 765, 45, 46, 768, -1, 770, 50, 772, -1, -1,
1822 -1, -1, -1, 697, -1, 59, 700, -1, -1, -1,
1823 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1824 -1, -1, 76, -1, 718, -1, 720, -1, 82, 723,
1825 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1826 -1, -1, 736, -1, -1, 99, -1, -1, 102, 103,
1827 104, 105, -1, -1, 108, 109, 750, 1, -1, 612,
1828 613, -1, 756, -1, -1, -1, -1, -1, -1, 763,
1829 -1, 765, -1, -1, 768, 628, 770, -1, 772, 370,
1830 371, 372, 373, 374, 375, 376, 377, 378, 379, 380,
1831 381, -1, 383, 384, 385, 386, 387, 388, 389, -1,
1832 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1833 54, -1, -1, -1, 58, 59, -1, -1, 62, -1,
1834 -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
1835 1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1836 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1837 -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
1838 104, 105, -1, -1, 108, 109, -1, -1, -1, -1,
1839 -1, -1, -1, 44, 45, 46, 47, 48, 49, 50,
1840 51, -1, -1, 54, -1, -1, 477, 58, 59, -1,
1841 -1, 62, 483, -1, 65, 66, 67, 68, 1, 70,
1842 71, 72, 73, -1, -1, 76, -1, -1, -1, -1,
1843 -1, 82, -1, -1, 85, 86, -1, -1, -1, -1,
1844 -1, -1, 93, -1, 95, 96, -1, -1, 99, -1,
1845 -1, 102, 103, 104, 105, -1, -1, 108, 109, -1,
1846 -1, 44, 45, 46, 47, 48, 49, 50, 51, -1,
1847 -1, 54, -1, -1, -1, 58, 59, -1, -1, 62,
1848 -1, -1, 65, 66, 67, 68, -1, 70, 71, 72,
1849 73, 44, -1, 76, -1, -1, -1, 50, -1, 82,
1850 -1, 1, 85, 86, -1, -1, 59, -1, 61, -1,
1851 93, -1, 95, 96, 67, -1, 99, -1, -1, 102,
1852 103, 104, 105, -1, -1, 108, 109, -1, -1, 82,
1853 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1854 -1, 612, 613, 96, 44, 45, 46, -1, 48, 49,
1855 50, 51, -1, -1, 54, -1, -1, 628, 58, 59,
1856 -1, -1, -1, -1, -1, 65, 66, 67, 68, 1,
1857 70, 71, 72, 73, -1, -1, 76, -1, -1, -1,
1858 -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
1859 -1, -1, -1, 93, -1, 95, 96, -1, -1, 99,
1860 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1861 -1, -1, 44, 45, 46, -1, 48, 49, 50, 51,
1862 -1, -1, 54, -1, -1, -1, 58, 59, -1, -1,
1863 -1, -1, -1, 65, 66, 67, 68, 1, 70, 71,
1864 72, 73, -1, -1, 76, -1, -1, -1, -1, -1,
1865 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
1866 -1, 93, -1, 95, -1, -1, -1, 99, -1, -1,
1867 102, 103, 104, 105, -1, -1, 108, 109, -1, -1,
1868 44, 45, 46, -1, 48, 49, 50, 51, -1, -1,
1869 54, -1, -1, -1, 58, 59, -1, -1, -1, -1,
1870 -1, 65, 66, 1, 68, -1, 70, 71, 72, 73,
1871 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1872 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1873 -1, 95, -1, -1, -1, 99, -1, -1, 102, 103,
1874 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
1875 48, 49, 50, 51, -1, -1, 54, -1, -1, -1,
1876 58, 59, -1, -1, -1, -1, -1, 65, 66, -1,
1877 68, -1, 70, 71, 72, 73, -1, 1, 76, 3,
1878 4, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1879 -1, -1, -1, -1, -1, 93, -1, 95, -1, -1,
1880 -1, 99, -1, -1, 102, 103, 104, 105, -1, -1,
1881 108, 109, -1, -1, -1, -1, -1, -1, -1, -1,
1882 -1, 45, 46, -1, -1, -1, 50, -1, -1, -1,
1883 -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
1884 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
1885 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1886 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1887 -1, 95, 96, -1, -1, -1, -1, -1, 102, 103,
1888 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
1889 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
1890 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
1891 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1892 -1, -1, -1, 82, -1, -1, 85, 86, -1, 88,
1893 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
1894 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
1895 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
1896 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
1897 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1898 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
1899 98, -1, -1, -1, 102, 103, 104, 105, -1, -1,
1900 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
1901 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
1902 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
1903 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1904 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1905 93, 94, -1, 45, 46, -1, -1, -1, 50, 102,
1906 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
1907 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
1908 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1909 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1910 -1, 93, -1, -1, -1, -1, -1, 99, -1, -1,
1911 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
1912 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
1913 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
1914 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
1915 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1916 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
1917 46, 98, -1, -1, 50, 102, 103, 104, 105, -1,
1918 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
1919 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
1920 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1921 86, -1, -1, 89, 90, -1, -1, 93, 94, -1,
1922 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
1923 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
1924 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
1925 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
1926 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1927 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1928 -1, -1, 93, -1, -1, 45, 46, 98, -1, -1,
1929 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
1930 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
1931 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1932 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1933 90, -1, -1, 93, 94, -1, -1, -1, -1, -1,
1934 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1935 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
1936 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
1937 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1938 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1939 85, 86, -1, -1, 89, 90, -1, -1, 93, 94,
1940 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
1941 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
1942 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
1943 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1944 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1945 94, -1, -1, -1, -1, -1, -1, -1, 102, 103,
1946 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
1947 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
1948 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
1949 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1950 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1951 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
1952 99, -1, 50, 102, 103, 104, 105, -1, -1, 108,
1953 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
1954 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
1955 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1956 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
1957 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
1958 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
1959 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
1960 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
1961 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1962 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1963 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
1964 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
1965 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
1966 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1967 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1968 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
1969 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
1970 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
1971 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
1972 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
1973 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1974 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
1975 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
1976 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
1977 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
1978 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1979 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1980 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
1981 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
1982 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
1983 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
1984 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1985 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1986 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
1987 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
1988 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
1989 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1990 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1991 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
1992 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1993 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
1994 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
1995 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1996 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1997 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1998 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
1999 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2000 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2001 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2002 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2003 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2004 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2005 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2006 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2007 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2008 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2009 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2010 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2011 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2012 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2013 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2014 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2015 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2016 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2017 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2018 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2019 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2020 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2021 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2022 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2023 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2024 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2025 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2026 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2027 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2028 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2029 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2030 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2031 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2032 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2033 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2034 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2035 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2036 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2037 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2038 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2039 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2040 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2041 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2042 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2043 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2044 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2045 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2046 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2047 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2048 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2049 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2050 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2051 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2052 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2053 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2054 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2055 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2056 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2057 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2058 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2059 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2060 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2061 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2062 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2063 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2064 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2065 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2066 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2067 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2068 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2069 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2070 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2071 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2072 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2073 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2074 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2075 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2076 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2077 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2078 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2079 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2080 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2081 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2082 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2083 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2084 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2085 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2086 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2087 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2088 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2089 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2090 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2091 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2092 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2093 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2094 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2095 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2096 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2097 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2098 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2099 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2100 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2101 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2102 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2103 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2104 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2105 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2106 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2107 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2108 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2109 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2110 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2111 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2112 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2113 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2114 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2115 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2116 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2117 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2118 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2119 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2120 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2121 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2122 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2123 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2124 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2125 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2126 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2127 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2128 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2129 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2130 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2131 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2132 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2133 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2134 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2135 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2136 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2137 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2138 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2139 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2140 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2141 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2142 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2143 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2144 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2145 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2146 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2147 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2148 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2149 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2150 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2151 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2152 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2153 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2154 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2155 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2156 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2157 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2158 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2159 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2160 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2161 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2162 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2163 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2164 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2165 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2166 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2167 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2168 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2169 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2170 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2171 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2172 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2173 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2174 -1, 65, -1, 1, -1, -1, -1, -1, 72, -1,
2175 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2176 -1, 85, 86, -1, -1, 89, 90, -1, 1, 93,
2177 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2178 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
2179 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2180 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2181 1, -1, 45, 46, 72, -1, -1, 50, 76, -1,
2182 -1, -1, -1, -1, 82, -1, 59, 85, 86, -1,
2183 -1, -1, 65, -1, -1, 93, -1, 3, 4, 72,
2184 -1, 99, -1, 76, 102, 103, 104, 105, -1, 82,
2185 108, 109, 85, 86, 45, 46, -1, -1, -1, 50,
2186 93, 94, -1, -1, -1, -1, -1, -1, 59, 102,
2187 103, 104, 105, -1, 65, 108, 109, 1, -1, 45,
2188 46, 72, -1, -1, 50, 76, -1, -1, -1, -1,
2189 -1, 82, -1, 59, 85, 86, -1, -1, -1, 65,
2190 -1, -1, 93, 94, 3, 4, 72, -1, -1, -1,
2191 76, 102, 103, 104, 105, -1, 82, 108, 109, 85,
2192 86, 45, 46, 89, 90, -1, 50, 93, -1, 95,
2193 96, -1, -1, -1, -1, 59, 102, 103, 104, 105,
2194 -1, 65, 108, 109, -1, -1, 45, 46, 72, -1,
2195 -1, 50, 76, -1, -1, 3, 4, -1, 82, -1,
2196 59, 85, 86, -1, -1, -1, 65, -1, -1, 93,
2197 -1, -1, -1, 72, -1, -1, -1, 76, 102, 103,
2198 104, 105, -1, 82, 108, 109, 85, 86, -1, -1,
2199 89, 90, -1, -1, 93, 94, -1, 45, 46, -1,
2200 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2201 109, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2202 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2203 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2204 -1, 89, 90, -1, -1, 93, 94, -1, -1, -1,
2205 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2206 108, 109, 45, 46, -1, -1, -1, 50, -1, -1,
2207 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2208 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2209 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2210 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2211 93, 94, -1, 45, 46, -1, -1, -1, 50, 102,
2212 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2213 -1, -1, -1, 65, -1, -1, 3, 4, -1, -1,
2214 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2215 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2216 -1, 93, 94, -1, -1, -1, -1, -1, -1, -1,
2217 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2218 -1, -1, -1, 50, -1, -1, -1, -1, -1, -1,
2219 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2220 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2221 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2222 -1, -1, 89, 90, -1, -1, 93, -1, 44, 45,
2223 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2224 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2225 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2226 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2227 86, -1, -1, -1, -1, -1, -1, 93, -1, -1,
2228 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2233 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2234 #line 3 "/usr/share/misc/bison.simple"
2236 /* Skeleton output parser for bison,
2237 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2239 This program is free software; you can redistribute it and/or modify
2240 it under the terms of the GNU General Public License as published by
2241 the Free Software Foundation; either version 2, or (at your option)
2244 This program is distributed in the hope that it will be useful,
2245 but WITHOUT ANY WARRANTY; without even the implied warranty of
2246 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2247 GNU General Public License for more details.
2249 You should have received a copy of the GNU General Public License
2250 along with this program; if not, write to the Free Software
2251 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2253 /* As a special exception, when this file is copied by Bison into a
2254 Bison output file, you may use that output file without restriction.
2255 This special exception was added by the Free Software Foundation
2256 in version 1.24 of Bison. */
2260 #define alloca __builtin_alloca
2261 #else /* not GNU C. */
2262 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
2264 #else /* not sparc */
2265 #if defined (MSDOS) && !defined (__TURBOC__)
2267 #else /* not MSDOS, or __TURBOC__ */
2271 #else /* not MSDOS, __TURBOC__, or _AIX */
2275 void *alloca (unsigned int);
2277 #else /* not __cplusplus */
2279 #endif /* not __cplusplus */
2281 #endif /* not _AIX */
2282 #endif /* not MSDOS, or __TURBOC__ */
2283 #endif /* not sparc. */
2284 #endif /* not GNU C. */
2285 #endif /* alloca not defined. */
2287 /* This is the parser code that is written into each bison parser
2288 when the %semantic_parser declaration is not specified in the grammar.
2289 It was written by Richard Stallman by simplifying the hairy parser
2290 used when %semantic_parser is specified. */
2292 /* Note: there must be only one dollar sign in this file.
2293 It is replaced by the list of actions, each action
2294 as one case of the switch. */
2296 #define yyerrok (yyerrstatus = 0)
2297 #define yyclearin (yychar = YYEMPTY)
2300 #define YYACCEPT return(0)
2301 #define YYABORT return(1)
2302 #define YYERROR goto yyerrlab1
2303 /* Like YYERROR except do call yyerror.
2304 This remains here temporarily to ease the
2305 transition to the new meaning of YYERROR, for GCC.
2306 Once GCC version 2 has supplanted version 1, this can go. */
2307 #define YYFAIL goto yyerrlab
2308 #define YYRECOVERING() (!!yyerrstatus)
2309 #define YYBACKUP(token, value) \
2311 if (yychar == YYEMPTY && yylen == 1) \
2312 { yychar = (token), yylval = (value); \
2313 yychar1 = YYTRANSLATE (yychar); \
2318 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2322 #define YYERRCODE 256
2325 #define YYLEX yylex()
2331 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2333 #define YYLEX yylex(&yylval, &yylloc)
2335 #else /* not YYLSP_NEEDED */
2337 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2339 #define YYLEX yylex(&yylval)
2341 #endif /* not YYLSP_NEEDED */
2344 /* If nonreentrant, generate the variables here */
2348 int yychar
; /* the lookahead symbol */
2349 YYSTYPE yylval
; /* the semantic value of the */
2350 /* lookahead symbol */
2353 YYLTYPE yylloc
; /* location data for the lookahead */
2357 int yynerrs
; /* number of parse errors so far */
2358 #endif /* not YYPURE */
2361 int yydebug
; /* nonzero means print parse trace */
2362 /* Since this is uninitialized, it does not stop multiple parsers
2366 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2369 #define YYINITDEPTH 200
2372 /* YYMAXDEPTH is the maximum size the stacks can grow to
2373 (effective only if the built-in stack extension method is used). */
2380 #define YYMAXDEPTH 10000
2383 /* Prevent warning if -Wstrict-prototypes. */
2385 #ifndef YYPARSE_PARAM
2390 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2391 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2392 #else /* not GNU C or C++ */
2395 /* This is the most reliable way to avoid incompatibilities
2396 in available built-in functions on various systems. */
2398 __yy_memcpy (to
, from
, count
)
2403 register char *f
= from
;
2404 register char *t
= to
;
2405 register int i
= count
;
2411 #else /* __cplusplus */
2413 /* This is the most reliable way to avoid incompatibilities
2414 in available built-in functions on various systems. */
2416 __yy_memcpy (char *to
, char *from
, int count
)
2418 register char *f
= from
;
2419 register char *t
= to
;
2420 register int i
= count
;
2429 #line 196 "/usr/share/misc/bison.simple"
2431 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2432 into yyparse. The argument should have type void *.
2433 It should actually point to an object.
2434 Grammar actions can access the variable by casting it
2435 to the proper pointer type. */
2437 #ifdef YYPARSE_PARAM
2439 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2440 #define YYPARSE_PARAM_DECL
2441 #else /* not __cplusplus */
2442 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2443 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2444 #endif /* not __cplusplus */
2445 #else /* not YYPARSE_PARAM */
2446 #define YYPARSE_PARAM_ARG
2447 #define YYPARSE_PARAM_DECL
2448 #endif /* not YYPARSE_PARAM */
2451 yyparse(YYPARSE_PARAM_ARG
)
2454 register int yystate
;
2456 register short *yyssp
;
2457 register YYSTYPE
*yyvsp
;
2458 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
2459 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
2461 short yyssa
[YYINITDEPTH
]; /* the state stack */
2462 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
2464 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
2465 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
2468 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
2469 YYLTYPE
*yyls
= yylsa
;
2472 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2474 #define YYPOPSTACK (yyvsp--, yyssp--)
2477 int yystacksize
= YYINITDEPTH
;
2488 YYSTYPE yyval
; /* the variable used to return */
2489 /* semantic values from the action */
2496 fprintf(stderr
, "Starting parse\n");
2502 yychar
= YYEMPTY
; /* Cause a token to be read. */
2504 /* Initialize stack pointers.
2505 Waste one element of value and location stack
2506 so that they stay on the same level as the state stack.
2507 The wasted elements are never initialized. */
2515 /* Push a new state, which is found in yystate . */
2516 /* In all cases, when you get here, the value and location stacks
2517 have just been pushed. so pushing a state here evens the stacks. */
2522 if (yyssp
>= yyss
+ yystacksize
- 1)
2524 /* Give user a chance to reallocate the stack */
2525 /* Use copies of these so that the &'s don't force the real ones into memory. */
2526 YYSTYPE
*yyvs1
= yyvs
;
2527 short *yyss1
= yyss
;
2529 YYLTYPE
*yyls1
= yyls
;
2532 /* Get the current used size of the three stacks, in elements. */
2533 int size
= yyssp
- yyss
+ 1;
2536 /* Each stack pointer address is followed by the size of
2537 the data in use in that stack, in bytes. */
2539 /* This used to be a conditional around just the two extra args,
2540 but that might be undefined if yyoverflow is a macro. */
2541 yyoverflow("parser stack overflow",
2542 &yyss1
, size
* sizeof (*yyssp
),
2543 &yyvs1
, size
* sizeof (*yyvsp
),
2544 &yyls1
, size
* sizeof (*yylsp
),
2547 yyoverflow("parser stack overflow",
2548 &yyss1
, size
* sizeof (*yyssp
),
2549 &yyvs1
, size
* sizeof (*yyvsp
),
2553 yyss
= yyss1
; yyvs
= yyvs1
;
2557 #else /* no yyoverflow */
2558 /* Extend the stack our own way. */
2559 if (yystacksize
>= YYMAXDEPTH
)
2561 yyerror("parser stack overflow");
2565 if (yystacksize
> YYMAXDEPTH
)
2566 yystacksize
= YYMAXDEPTH
;
2567 yyss
= (short *) alloca (yystacksize
* sizeof (*yyssp
));
2568 __yy_memcpy ((char *)yyss
, (char *)yyss1
, size
* sizeof (*yyssp
));
2569 yyvs
= (YYSTYPE
*) alloca (yystacksize
* sizeof (*yyvsp
));
2570 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
, size
* sizeof (*yyvsp
));
2572 yyls
= (YYLTYPE
*) alloca (yystacksize
* sizeof (*yylsp
));
2573 __yy_memcpy ((char *)yyls
, (char *)yyls1
, size
* sizeof (*yylsp
));
2575 #endif /* no yyoverflow */
2577 yyssp
= yyss
+ size
- 1;
2578 yyvsp
= yyvs
+ size
- 1;
2580 yylsp
= yyls
+ size
- 1;
2585 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
2588 if (yyssp
>= yyss
+ yystacksize
- 1)
2594 fprintf(stderr
, "Entering state %d\n", yystate
);
2600 /* Do appropriate processing given the current state. */
2601 /* Read a lookahead token if we need one and don't already have one. */
2604 /* First try to decide what to do without reference to lookahead token. */
2606 yyn
= yypact
[yystate
];
2610 /* Not known => get a lookahead token if don't already have one. */
2612 /* yychar is either YYEMPTY or YYEOF
2613 or a valid token in external form. */
2615 if (yychar
== YYEMPTY
)
2619 fprintf(stderr
, "Reading a token: ");
2624 /* Convert token to internal form (in yychar1) for indexing tables with */
2626 if (yychar
<= 0) /* This means end of input. */
2629 yychar
= YYEOF
; /* Don't call YYLEX any more */
2633 fprintf(stderr
, "Now at end of input.\n");
2638 yychar1
= YYTRANSLATE(yychar
);
2643 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
2644 /* Give the individual parser a way to print the precise meaning
2645 of a token, for further debugging info. */
2647 YYPRINT (stderr
, yychar
, yylval
);
2649 fprintf (stderr
, ")\n");
2655 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
2660 /* yyn is what to do for this token type in this state.
2661 Negative => reduce, -yyn is rule number.
2662 Positive => shift, yyn is new state.
2663 New state is final state => don't bother to shift,
2664 just return success.
2665 0, or most negative number => error. */
2680 /* Shift the lookahead token. */
2684 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
2687 /* Discard the token being shifted unless it is eof. */
2688 if (yychar
!= YYEOF
)
2696 /* count tokens shifted since error; after three, turn off error status. */
2697 if (yyerrstatus
) yyerrstatus
--;
2702 /* Do the default action for the current state. */
2705 yyn
= yydefact
[yystate
];
2709 /* Do a reduction. yyn is the number of a rule to reduce with. */
2713 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
2720 fprintf (stderr
, "Reducing via rule %d (line %d), ",
2723 /* Print the symbols being reduced, and their result. */
2724 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
2725 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
2726 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
2734 #line 479 "./parse.y"
2738 #line 523 "./parse.y"
2740 yyval
.node
= build_java_array_type (yyvsp
[-2].node
, -1);
2741 CLASS_LOADED_P (yyval
.node
) = 1;
2745 #line 528 "./parse.y"
2746 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
2749 #line 530 "./parse.y"
2750 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
2753 #line 532 "./parse.y"
2754 {RULE ("']' expected"); RECOVER
;;
2757 #line 534 "./parse.y"
2758 {RULE ("']' expected"); RECOVER
;;
2761 #line 549 "./parse.y"
2762 { yyval
.node
= make_qualified_name (yyvsp
[-2].node
, yyvsp
[0].node
, yyvsp
[-1].operator.location
); ;
2765 #line 558 "./parse.y"
2766 {yyval
.node
= NULL
;;
2769 #line 570 "./parse.y"
2775 #line 574 "./parse.y"
2781 #line 586 "./parse.y"
2782 { ctxp
->package
= EXPR_WFL_NODE (yyvsp
[-1].node
); ;
2785 #line 588 "./parse.y"
2786 {yyerror ("Missing name"); RECOVER
;;
2789 #line 590 "./parse.y"
2790 {yyerror ("';' expected"); RECOVER
;;
2793 #line 600 "./parse.y"
2795 tree name
= EXPR_WFL_NODE (yyvsp
[-1].node
), node
, last_name
;
2796 int i
= IDENTIFIER_LENGTH (name
)-1;
2797 const char *last
= &IDENTIFIER_POINTER (name
)[i
];
2798 while (last
!= IDENTIFIER_POINTER (name
))
2800 if (last
[0] == '.')
2804 last_name
= get_identifier (++last
);
2805 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name
))
2807 tree err
= find_name_in_single_imports (last_name
);
2808 if (err
&& err
!= name
)
2810 (yyvsp
[-1].node
, "Ambiguous class: `%s' and `%s'",
2811 IDENTIFIER_POINTER (name
),
2812 IDENTIFIER_POINTER (err
));
2814 REGISTER_IMPORT (yyvsp
[-1].node
, last_name
)
2817 REGISTER_IMPORT (yyvsp
[-1].node
, last_name
);
2821 #line 626 "./parse.y"
2822 {yyerror ("Missing name"); RECOVER
;;
2825 #line 628 "./parse.y"
2826 {yyerror ("';' expected"); RECOVER
;;
2829 #line 633 "./parse.y"
2831 tree name
= EXPR_WFL_NODE (yyvsp
[-3].node
);
2832 /* Don't import java.lang.* twice. */
2833 if (name
!= java_lang_id
)
2835 tree node
= build_tree_list (yyvsp
[-3].node
, NULL_TREE
);
2836 read_import_dir (yyvsp
[-3].node
);
2837 TREE_CHAIN (node
) = ctxp
->import_demand_list
;
2838 ctxp
->import_demand_list
= node
;
2843 #line 645 "./parse.y"
2844 {yyerror ("'*' expected"); RECOVER
;;
2847 #line 647 "./parse.y"
2848 {yyerror ("';' expected"); RECOVER
;;
2851 #line 652 "./parse.y"
2853 maybe_generate_finit ();
2854 maybe_generate_clinit ();
2855 yyval
.node
= yyvsp
[0].node
;
2859 #line 658 "./parse.y"
2861 maybe_generate_clinit ();
2862 yyval
.node
= yyvsp
[0].node
;
2866 #line 663 "./parse.y"
2867 { yyval
.node
= NULL
; ;
2870 #line 665 "./parse.y"
2873 yyerror ("Class or interface declaration expected");
2877 #line 676 "./parse.y"
2879 yyval
.value
= (1 << yyvsp
[0].value
);
2883 #line 680 "./parse.y"
2885 int acc
= (1 << yyvsp
[0].value
);
2886 if (yyval
.value
& acc
)
2888 (ctxp
->modifier_ctx
[yyvsp
[0].value
], "Modifier `%s' declared twice",
2889 java_accstring_lookup (acc
));
2897 #line 696 "./parse.y"
2898 { create_class (yyvsp
[-4].value
, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
2901 #line 698 "./parse.y"
2903 yyval
.node
= yyvsp
[0].node
;
2907 #line 702 "./parse.y"
2908 { create_class (0, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
2911 #line 704 "./parse.y"
2913 yyval
.node
= yyvsp
[0].node
;
2917 #line 708 "./parse.y"
2918 {yyerror ("Missing class name"); RECOVER
;;
2921 #line 710 "./parse.y"
2922 {yyerror ("Missing class name"); RECOVER
;;
2925 #line 712 "./parse.y"
2927 if (!ctxp
->class_err
) yyerror ("'{' expected");
2932 #line 717 "./parse.y"
2933 {if (!ctxp
->class_err
) yyerror ("'{' expected"); RECOVER
;;
2936 #line 721 "./parse.y"
2937 { yyval
.node
= NULL
; ;
2940 #line 723 "./parse.y"
2941 { yyval
.node
= yyvsp
[0].node
; ;
2944 #line 725 "./parse.y"
2945 {yyerror ("'{' expected"); ctxp
->class_err
=1;;
2948 #line 727 "./parse.y"
2949 {yyerror ("Missing super class name"); ctxp
->class_err
=1;;
2952 #line 731 "./parse.y"
2953 { yyval
.node
= NULL_TREE
; ;
2956 #line 733 "./parse.y"
2957 { yyval
.node
= yyvsp
[0].node
; ;
2960 #line 735 "./parse.y"
2963 yyerror ("Missing interface name");
2967 #line 743 "./parse.y"
2969 ctxp
->interface_number
= 1;
2970 yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
);
2974 #line 748 "./parse.y"
2976 ctxp
->interface_number
++;
2977 yyval
.node
= chainon (yyvsp
[-2].node
, build_tree_list (yyvsp
[0].node
, NULL_TREE
));
2981 #line 753 "./parse.y"
2982 {yyerror ("Missing interface name"); RECOVER
;;
2985 #line 758 "./parse.y"
2987 /* Store the location of the `}' when doing xrefs */
2989 DECL_END_SOURCE_LINE (ctxp
->current_parsed_class
) =
2990 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
2991 yyval
.node
= ctxp
->current_parsed_class
;
2995 #line 766 "./parse.y"
2997 /* Store the location of the `}' when doing xrefs */
2999 DECL_END_SOURCE_LINE (ctxp
->current_parsed_class
) =
3000 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3001 yyval
.node
= ctxp
->current_parsed_class
;
3005 #line 785 "./parse.y"
3006 { yyval
.node
= parse_jdk1_1_error ("instance initializer"); ;
3009 #line 791 "./parse.y"
3010 { yyval
.node
= yyvsp
[-1].node
; ;
3013 #line 794 "./parse.y"
3014 { yyval
.node
= parse_jdk1_1_error ("inner classe declaration"); ;
3017 #line 796 "./parse.y"
3018 { yyval
.node
= parse_jdk1_1_error ("inner interface declaration"); ;
3021 #line 802 "./parse.y"
3022 { register_fields (0, yyvsp
[-2].node
, yyvsp
[-1].node
); ;
3025 #line 804 "./parse.y"
3028 ("Illegal modifier `%s' for field declaration",
3029 yyvsp
[-3].value
, FIELD_MODIFIERS
);
3030 check_modifiers_consistency (yyvsp
[-3].value
);
3031 register_fields (yyvsp
[-3].value
, yyvsp
[-2].node
, yyvsp
[-1].node
);
3035 #line 817 "./parse.y"
3036 { yyval
.node
= chainon (yyvsp
[-2].node
, yyvsp
[0].node
); ;
3039 #line 819 "./parse.y"
3040 {yyerror ("Missing term"); RECOVER
;;
3043 #line 824 "./parse.y"
3044 { yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
); ;
3047 #line 826 "./parse.y"
3049 if (java_error_count
)
3050 yyvsp
[0].node
= NULL_TREE
;
3051 yyval
.node
= build_tree_list
3052 (yyvsp
[-2].node
, build_assignment (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
));
3056 #line 833 "./parse.y"
3058 yyerror ("Missing variable initializer");
3059 yyval
.node
= build_tree_list (yyvsp
[-2].node
, NULL_TREE
);
3064 #line 839 "./parse.y"
3066 yyerror ("';' expected");
3067 yyval
.node
= build_tree_list (yyvsp
[-3].node
, NULL_TREE
);
3072 #line 849 "./parse.y"
3073 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
3076 #line 851 "./parse.y"
3077 {yyerror ("Invalid declaration"); DRECOVER(vdi
);;
3080 #line 853 "./parse.y"
3081 {yyerror ("']' expected"); DRECOVER(vdi
);;
3084 #line 855 "./parse.y"
3085 {yyerror ("Unbalanced ']'"); DRECOVER(vdi
);;
3088 #line 866 "./parse.y"
3090 current_function_decl
= yyvsp
[0].node
;
3091 source_start_java_method (current_function_decl
);
3095 #line 871 "./parse.y"
3096 { finish_method_declaration (yyvsp
[0].node
); ;
3099 #line 873 "./parse.y"
3100 {YYNOT_TWICE
yyerror ("'{' expected"); RECOVER
;;
3103 #line 878 "./parse.y"
3104 { yyval
.node
= method_header (0, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3107 #line 880 "./parse.y"
3108 { yyval
.node
= method_header (0, void_type_node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3111 #line 882 "./parse.y"
3112 { yyval
.node
= method_header (yyvsp
[-3].value
, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3115 #line 884 "./parse.y"
3116 { yyval
.node
= method_header (yyvsp
[-3].value
, void_type_node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3119 #line 886 "./parse.y"
3123 #line 888 "./parse.y"
3127 #line 890 "./parse.y"
3128 {yyerror ("Identifier expected"); RECOVER
;;
3131 #line 892 "./parse.y"
3132 {yyerror ("Identifier expected"); RECOVER
;;
3135 #line 894 "./parse.y"
3137 yyerror ("Invalid method declaration, return type required");
3142 #line 902 "./parse.y"
3143 { yyval
.node
= method_declarator (yyvsp
[-2].node
, NULL_TREE
); ;
3146 #line 904 "./parse.y"
3147 { yyval
.node
= method_declarator (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
3150 #line 906 "./parse.y"
3152 EXPR_WFL_LINECOL (wfl_operator
) = yyvsp
[-1].operator.location
;
3153 TREE_PURPOSE (yyvsp
[-2].node
) =
3154 build_unresolved_array_type (TREE_PURPOSE (yyvsp
[-2].node
));
3155 parse_warning_context
3157 "Discouraged form of returned type specification");
3161 #line 915 "./parse.y"
3162 {yyerror ("')' expected"); DRECOVER(method_declarator
);;
3165 #line 917 "./parse.y"
3166 {yyerror ("']' expected"); RECOVER
;;
3169 #line 922 "./parse.y"
3171 ctxp
->formal_parameter_number
= 1;
3175 #line 926 "./parse.y"
3177 ctxp
->formal_parameter_number
+= 1;
3178 yyval
.node
= chainon (yyvsp
[-2].node
, yyvsp
[0].node
);
3182 #line 931 "./parse.y"
3183 {yyerror ("Missing formal parameter term"); RECOVER
;;
3186 #line 936 "./parse.y"
3188 yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[-1].node
);
3192 #line 940 "./parse.y"
3194 parse_jdk1_1_error ("final parameters");
3195 yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[-1].node
);
3199 #line 945 "./parse.y"
3200 {yyerror ("Missing identifier"); RECOVER
;;
3203 #line 947 "./parse.y"
3205 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp
[-2].value
));
3206 yyerror ("Missing identifier"); RECOVER
;
3210 #line 954 "./parse.y"
3211 { yyval
.node
= NULL_TREE
; ;
3214 #line 956 "./parse.y"
3215 { yyval
.node
= yyvsp
[0].node
; ;
3218 #line 958 "./parse.y"
3219 {yyerror ("Missing class type term"); RECOVER
;;
3222 #line 963 "./parse.y"
3223 { yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[0].node
); ;
3226 #line 965 "./parse.y"
3227 { yyval
.node
= tree_cons (yyvsp
[0].node
, yyvsp
[0].node
, yyvsp
[-2].node
); ;
3230 #line 967 "./parse.y"
3231 {yyerror ("Missing class type term"); RECOVER
;;
3234 #line 974 "./parse.y"
3235 { yyval
.node
= NULL_TREE
; ;
3238 #line 980 "./parse.y"
3240 TREE_CHAIN (yyvsp
[0].node
) = ctxp
->static_initialized
;
3241 ctxp
->static_initialized
= yyvsp
[0].node
;
3245 #line 985 "./parse.y"
3247 TREE_CHAIN (yyvsp
[-1].node
) = ctxp
->static_initialized
;
3248 ctxp
->static_initialized
= yyvsp
[-1].node
;
3252 #line 993 "./parse.y"
3254 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp
[0].value
));
3258 #line 1001 "./parse.y"
3260 current_function_decl
= yyvsp
[0].node
;
3261 source_start_java_method (current_function_decl
);
3265 #line 1006 "./parse.y"
3266 { finish_method_declaration (yyvsp
[0].node
); ;
3269 #line 1011 "./parse.y"
3270 { yyval
.node
= method_header (0, NULL_TREE
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3273 #line 1013 "./parse.y"
3274 { yyval
.node
= method_header (yyvsp
[-2].value
, NULL_TREE
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3277 #line 1018 "./parse.y"
3278 { yyval
.node
= method_declarator (yyvsp
[-2].node
, NULL_TREE
); ;
3281 #line 1020 "./parse.y"
3282 { yyval
.node
= method_declarator (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
3285 #line 1028 "./parse.y"
3287 BLOCK_EXPR_BODY (yyvsp
[0].node
) = empty_stmt_node
;
3288 yyval
.node
= yyvsp
[0].node
;
3292 #line 1033 "./parse.y"
3293 { yyval
.node
= yyvsp
[0].node
; ;
3296 #line 1035 "./parse.y"
3297 { yyval
.node
= yyvsp
[0].node
; ;
3300 #line 1037 "./parse.y"
3301 { yyval
.node
= yyvsp
[0].node
; ;
3304 #line 1047 "./parse.y"
3306 yyval
.node
= build_method_invocation (yyvsp
[-3].node
, NULL_TREE
);
3307 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-3].node
), yyval
.node
);
3308 yyval
.node
= java_method_add_stmt (current_function_decl
, yyval
.node
);
3312 #line 1053 "./parse.y"
3314 yyval
.node
= build_method_invocation (yyvsp
[-4].node
, yyvsp
[-2].node
);
3315 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyval
.node
);
3316 yyval
.node
= java_method_add_stmt (current_function_decl
, yyval
.node
);
3320 #line 1061 "./parse.y"
3321 {yyval
.node
= parse_jdk1_1_error ("explicit constructor invocation"); ;
3324 #line 1063 "./parse.y"
3325 {yyval
.node
= parse_jdk1_1_error ("explicit constructor invocation"); ;
3328 #line 1068 "./parse.y"
3330 tree wfl
= build_wfl_node (this_identifier_node
);
3331 EXPR_WFL_LINECOL (wfl
) = yyvsp
[0].operator.location
;
3336 #line 1074 "./parse.y"
3338 tree wfl
= build_wfl_node (super_identifier_node
);
3339 EXPR_WFL_LINECOL (wfl
) = yyvsp
[0].operator.location
;
3344 #line 1085 "./parse.y"
3345 { create_interface (0, yyvsp
[0].node
, NULL_TREE
); ;
3348 #line 1087 "./parse.y"
3350 yyval
.node
= yyvsp
[0].node
;
3354 #line 1091 "./parse.y"
3355 { create_interface (yyvsp
[-2].value
, yyvsp
[0].node
, NULL_TREE
); ;
3358 #line 1093 "./parse.y"
3360 yyval
.node
= yyvsp
[0].node
;
3364 #line 1097 "./parse.y"
3365 { create_interface (0, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3368 #line 1099 "./parse.y"
3370 yyval
.node
= yyvsp
[0].node
;
3374 #line 1103 "./parse.y"
3375 { create_interface (yyvsp
[-3].value
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3378 #line 1105 "./parse.y"
3380 yyval
.node
= yyvsp
[0].node
;
3384 #line 1109 "./parse.y"
3385 {yyerror ("'{' expected"); RECOVER
;;
3388 #line 1111 "./parse.y"
3389 {yyerror ("'{' expected"); RECOVER
;;
3392 #line 1116 "./parse.y"
3394 ctxp
->interface_number
= 1;
3395 yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
);
3399 #line 1121 "./parse.y"
3401 ctxp
->interface_number
++;
3402 yyval
.node
= chainon (yyvsp
[-2].node
, build_tree_list (yyvsp
[0].node
, NULL_TREE
));
3406 #line 1126 "./parse.y"
3407 {yyerror ("Invalid interface type"); RECOVER
;;
3410 #line 1128 "./parse.y"
3411 {yyerror ("Missing term"); RECOVER
;;
3414 #line 1133 "./parse.y"
3415 { yyval
.node
= NULL_TREE
; ;
3418 #line 1135 "./parse.y"
3419 { yyval
.node
= NULL_TREE
; ;
3422 #line 1147 "./parse.y"
3423 { yyval
.node
= parse_jdk1_1_error ("inner class declaration"); ;
3426 #line 1149 "./parse.y"
3427 { yyval
.node
= parse_jdk1_1_error ("inner interface declaration"); ;
3430 #line 1158 "./parse.y"
3432 check_abstract_method_header (yyvsp
[-1].node
);
3433 current_function_decl
= NULL_TREE
; /* FIXME ? */
3437 #line 1163 "./parse.y"
3438 {yyerror ("';' expected"); RECOVER
;;
3441 #line 1169 "./parse.y"
3442 { yyval
.node
= build_new_array_init (yyvsp
[-1].operator.location
, NULL_TREE
); ;
3445 #line 1171 "./parse.y"
3446 { yyval
.node
= build_new_array_init (yyvsp
[-2].operator.location
, yyvsp
[-1].node
); ;
3449 #line 1173 "./parse.y"
3450 { yyval
.node
= build_new_array_init (yyvsp
[-3].operator.location
, yyvsp
[-2].node
); ;
3453 #line 1178 "./parse.y"
3455 yyval
.node
= tree_cons (maybe_build_array_element_wfl (yyvsp
[0].node
),
3456 yyvsp
[0].node
, NULL_TREE
);
3460 #line 1183 "./parse.y"
3462 yyval
.node
= tree_cons (maybe_build_array_element_wfl (yyvsp
[0].node
), yyvsp
[0].node
, yyvsp
[-2].node
);
3466 #line 1187 "./parse.y"
3467 {yyerror ("Missing term"); RECOVER
;;
3470 #line 1193 "./parse.y"
3472 /* Store the location of the `}' when doing xrefs */
3473 if (current_function_decl
&& flag_emit_xref
)
3474 DECL_END_SOURCE_LINE (current_function_decl
) =
3475 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3476 yyval
.node
= empty_stmt_node
;
3480 #line 1201 "./parse.y"
3481 { yyval
.node
= yyvsp
[0].node
; ;
3484 #line 1206 "./parse.y"
3488 #line 1211 "./parse.y"
3490 maybe_absorb_scoping_blocks ();
3491 /* Store the location of the `}' when doing xrefs */
3492 if (current_function_decl
&& flag_emit_xref
)
3493 DECL_END_SOURCE_LINE (current_function_decl
) =
3494 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3495 yyval
.node
= exit_block ();
3499 #line 1229 "./parse.y"
3500 { java_method_add_stmt (current_function_decl
, yyvsp
[0].node
); ;
3503 #line 1231 "./parse.y"
3504 { parse_jdk1_1_error ("inner class declaration"); ;
3507 #line 1240 "./parse.y"
3508 { declare_local_variables (0, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3511 #line 1242 "./parse.y"
3512 { declare_local_variables (yyvsp
[-2].value
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3515 #line 1252 "./parse.y"
3516 { yyval
.node
= exit_block (); ;
3519 #line 1261 "./parse.y"
3520 { yyval
.node
= exit_block (); ;
3523 #line 1280 "./parse.y"
3524 { yyval
.node
= empty_stmt_node
; ;
3527 #line 1285 "./parse.y"
3529 yyval
.node
= build_labeled_block (EXPR_WFL_LINECOL (yyvsp
[-1].node
),
3530 EXPR_WFL_NODE (yyvsp
[-1].node
));
3532 push_labeled_block (yyval
.node
);
3533 PUSH_LABELED_BLOCK (yyval
.node
);
3537 #line 1296 "./parse.y"
3538 { yyval
.node
= finish_labeled_statement (yyvsp
[-1].node
, yyvsp
[0].node
); ;
3541 #line 1298 "./parse.y"
3542 {yyerror ("':' expected"); RECOVER
;;
3545 #line 1303 "./parse.y"
3546 { yyval
.node
= finish_labeled_statement (yyvsp
[-1].node
, yyvsp
[0].node
); ;
3549 #line 1310 "./parse.y"
3551 /* We have a statement. Generate a WFL around it so
3553 yyval
.node
= build_expr_wfl (yyvsp
[-1].node
, input_filename
, lineno
, 0);
3554 /* We know we have a statement, so set the debug
3555 info to be eventually generate here. */
3556 yyval
.node
= JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval
.node
);
3560 #line 1319 "./parse.y"
3562 if (ctxp
->prevent_ese
!= lineno
)
3563 yyerror ("Invalid expression statement");
3564 DRECOVER (expr_stmt
);
3568 #line 1325 "./parse.y"
3570 if (ctxp
->prevent_ese
!= lineno
)
3571 yyerror ("Invalid expression statement");
3572 DRECOVER (expr_stmt
);
3576 #line 1331 "./parse.y"
3578 if (ctxp
->prevent_ese
!= lineno
)
3579 yyerror ("Invalid expression statement");
3580 DRECOVER (expr_stmt
);
3584 #line 1337 "./parse.y"
3585 {yyerror ("')' expected"); RECOVER
;;
3588 #line 1339 "./parse.y"
3590 yyerror ("Constructor invocation must be first "
3591 "thing in a constructor");
3596 #line 1345 "./parse.y"
3597 {yyerror ("')' expected"); RECOVER
;;
3600 #line 1347 "./parse.y"
3602 yyerror ("Constructor invocation must be first "
3603 "thing in a constructor");
3608 #line 1353 "./parse.y"
3609 {yyerror ("'(' expected"); RECOVER
;;
3612 #line 1355 "./parse.y"
3613 {yyerror ("')' expected"); RECOVER
;;
3616 #line 1357 "./parse.y"
3617 {yyerror ("')' expected"); RECOVER
;;
3620 #line 1359 "./parse.y"
3621 {yyerror ("';' expected"); RECOVER
;;
3624 #line 1361 "./parse.y"
3625 {yyerror ("';' expected"); RECOVER
;;
3628 #line 1376 "./parse.y"
3630 yyval
.node
= build_if_else_statement (yyvsp
[-3].operator.location
, yyvsp
[-2].node
,
3631 yyvsp
[0].node
, NULL_TREE
);
3635 #line 1381 "./parse.y"
3636 {yyerror ("'(' expected"); RECOVER
;;
3639 #line 1383 "./parse.y"
3640 {yyerror ("Missing term"); RECOVER
;;
3643 #line 1385 "./parse.y"
3644 {yyerror ("')' expected"); RECOVER
;;
3647 #line 1390 "./parse.y"
3648 { yyval
.node
= build_if_else_statement (yyvsp
[-5].operator.location
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3651 #line 1395 "./parse.y"
3652 { yyval
.node
= build_if_else_statement (yyvsp
[-5].operator.location
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3655 #line 1400 "./parse.y"
3661 #line 1404 "./parse.y"
3663 /* Make into "proper list" of COMPOUND_EXPRs.
3664 I.e. make the last statment also have its own
3666 maybe_absorb_scoping_blocks ();
3667 TREE_OPERAND (yyvsp
[-2].node
, 1) = exit_block ();
3668 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-2].node
), yyvsp
[-2].node
);
3672 #line 1416 "./parse.y"
3674 yyval
.node
= build (SWITCH_EXPR
, NULL_TREE
, yyvsp
[-1].node
, NULL_TREE
);
3675 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-2].operator.location
;
3679 #line 1421 "./parse.y"
3680 {yyerror ("'(' expected"); RECOVER
;;
3683 #line 1423 "./parse.y"
3684 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement
);;
3687 #line 1425 "./parse.y"
3688 {yyerror ("'{' expected"); RECOVER
;;
3691 #line 1433 "./parse.y"
3692 { yyval
.node
= NULL_TREE
; ;
3695 #line 1435 "./parse.y"
3696 { yyval
.node
= NULL_TREE
; ;
3699 #line 1437 "./parse.y"
3700 { yyval
.node
= NULL_TREE
; ;
3703 #line 1439 "./parse.y"
3704 { yyval
.node
= NULL_TREE
; ;
3707 #line 1458 "./parse.y"
3709 tree lab
= build1 (CASE_EXPR
, NULL_TREE
, yyvsp
[-1].node
);
3710 EXPR_WFL_LINECOL (lab
) = yyvsp
[-2].operator.location
;
3711 java_method_add_stmt (current_function_decl
, lab
);
3715 #line 1464 "./parse.y"
3717 tree lab
= build1 (DEFAULT_EXPR
, NULL_TREE
, NULL_TREE
);
3718 EXPR_WFL_LINECOL (lab
) = yyvsp
[-1].operator.location
;
3719 java_method_add_stmt (current_function_decl
, lab
);
3723 #line 1470 "./parse.y"
3724 {yyerror ("Missing or invalid constant expression"); RECOVER
;;
3727 #line 1472 "./parse.y"
3728 {yyerror ("':' expected"); RECOVER
;;
3731 #line 1474 "./parse.y"
3732 {yyerror ("':' expected"); RECOVER
;;
3735 #line 1479 "./parse.y"
3737 tree body
= build_loop_body (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, 0);
3738 yyval
.node
= build_new_loop (body
);
3742 #line 1487 "./parse.y"
3743 { yyval
.node
= finish_loop_body (0, NULL_TREE
, yyvsp
[0].node
, 0); ;
3746 #line 1489 "./parse.y"
3747 {YYERROR_NOW
; yyerror ("'(' expected"); RECOVER
;;
3750 #line 1491 "./parse.y"
3751 {yyerror ("Missing term and ')' expected"); RECOVER
;;
3754 #line 1493 "./parse.y"
3755 {yyerror ("')' expected"); RECOVER
;;
3758 #line 1498 "./parse.y"
3759 { yyval
.node
= finish_loop_body (0, NULL_TREE
, yyvsp
[0].node
, 0); ;
3762 #line 1503 "./parse.y"
3764 tree body
= build_loop_body (0, NULL_TREE
, 1);
3765 yyval
.node
= build_new_loop (body
);
3769 #line 1512 "./parse.y"
3770 { yyval
.node
= finish_loop_body (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[-5].node
, 1); ;
3773 #line 1517 "./parse.y"
3774 { yyval
.node
= finish_for_loop (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3777 #line 1519 "./parse.y"
3779 yyval
.node
= finish_for_loop (0, NULL_TREE
, yyvsp
[-2].node
, yyvsp
[0].node
);
3780 /* We have not condition, so we get rid of the EXIT_EXPR */
3781 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval
.node
), 0) =
3786 #line 1526 "./parse.y"
3787 {yyerror ("Invalid control expression"); RECOVER
;;
3790 #line 1528 "./parse.y"
3791 {yyerror ("Invalid update expression"); RECOVER
;;
3794 #line 1530 "./parse.y"
3795 {yyerror ("Invalid update expression"); RECOVER
;;
3798 #line 1535 "./parse.y"
3799 { yyval
.node
= finish_for_loop (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
);;
3802 #line 1537 "./parse.y"
3804 yyval
.node
= finish_for_loop (0, NULL_TREE
, yyvsp
[-2].node
, yyvsp
[0].node
);
3805 /* We have not condition, so we get rid of the EXIT_EXPR */
3806 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval
.node
), 0) =
3811 #line 1547 "./parse.y"
3813 /* This scope defined for local variable that may be
3814 defined within the scope of the for loop */
3819 #line 1553 "./parse.y"
3820 {yyerror ("'(' expected"); DRECOVER(for_1
);;
3823 #line 1555 "./parse.y"
3824 {yyerror ("Invalid init statement"); RECOVER
;;
3827 #line 1560 "./parse.y"
3829 /* We now declare the loop body. The loop is
3830 declared as a for loop. */
3831 tree body
= build_loop_body (0, NULL_TREE
, 0);
3832 yyval
.node
= build_new_loop (body
);
3833 IS_FOR_LOOP_P (yyval
.node
) = 1;
3834 /* The loop is added to the current block the for
3835 statement is defined within */
3836 java_method_add_stmt (current_function_decl
, yyval
.node
);
3840 #line 1572 "./parse.y"
3841 { yyval
.node
= empty_stmt_node
; ;
3844 #line 1574 "./parse.y"
3846 /* Init statement recorded within the previously
3847 defined block scope */
3848 yyval
.node
= java_method_add_stmt (current_function_decl
, yyvsp
[0].node
);
3852 #line 1580 "./parse.y"
3854 /* Local variable are recorded within the previously
3855 defined block scope */
3856 yyval
.node
= NULL_TREE
;
3860 #line 1586 "./parse.y"
3861 {yyerror ("';' expected"); DRECOVER(for_init_1
);;
3864 #line 1590 "./parse.y"
3865 {yyval
.node
= empty_stmt_node
;;
3868 #line 1592 "./parse.y"
3869 { yyval
.node
= build_debugable_stmt (BUILD_LOCATION (), yyvsp
[0].node
); ;
3872 #line 1597 "./parse.y"
3873 { yyval
.node
= add_stmt_to_compound (NULL_TREE
, NULL_TREE
, yyvsp
[0].node
); ;
3876 #line 1599 "./parse.y"
3877 { yyval
.node
= add_stmt_to_compound (yyvsp
[-2].node
, NULL_TREE
, yyvsp
[0].node
); ;
3880 #line 1601 "./parse.y"
3881 {yyerror ("Missing term"); RECOVER
;;
3884 #line 1606 "./parse.y"
3885 { yyval
.node
= build_bc_statement (yyvsp
[-1].operator.location
, 1, NULL_TREE
); ;
3888 #line 1608 "./parse.y"
3889 { yyval
.node
= build_bc_statement (yyvsp
[-2].operator.location
, 1, yyvsp
[-1].node
); ;
3892 #line 1610 "./parse.y"
3893 {yyerror ("Missing term"); RECOVER
;;
3896 #line 1612 "./parse.y"
3897 {yyerror ("';' expected"); RECOVER
;;
3900 #line 1617 "./parse.y"
3901 { yyval
.node
= build_bc_statement (yyvsp
[-1].operator.location
, 0, NULL_TREE
); ;
3904 #line 1619 "./parse.y"
3905 { yyval
.node
= build_bc_statement (yyvsp
[-2].operator.location
, 0, yyvsp
[-1].node
); ;
3908 #line 1621 "./parse.y"
3909 {yyerror ("Missing term"); RECOVER
;;
3912 #line 1623 "./parse.y"
3913 {yyerror ("';' expected"); RECOVER
;;
3916 #line 1628 "./parse.y"
3917 { yyval
.node
= build_return (yyvsp
[-1].operator.location
, NULL_TREE
); ;
3920 #line 1630 "./parse.y"
3921 { yyval
.node
= build_return (yyvsp
[-2].operator.location
, yyvsp
[-1].node
); ;
3924 #line 1632 "./parse.y"
3925 {yyerror ("Missing term"); RECOVER
;;
3928 #line 1634 "./parse.y"
3929 {yyerror ("';' expected"); RECOVER
;;
3932 #line 1639 "./parse.y"
3934 yyval
.node
= build1 (THROW_EXPR
, NULL_TREE
, yyvsp
[-1].node
);
3935 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-2].operator.location
;
3939 #line 1644 "./parse.y"
3940 {yyerror ("Missing term"); RECOVER
;;
3943 #line 1646 "./parse.y"
3944 {yyerror ("';' expected"); RECOVER
;;
3947 #line 1651 "./parse.y"
3949 yyval
.node
= build (SYNCHRONIZED_EXPR
, NULL_TREE
, yyvsp
[-2].node
, yyvsp
[0].node
);
3950 EXPR_WFL_LINECOL (yyval
.node
) =
3951 EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK
));
3955 #line 1657 "./parse.y"
3956 {yyerror ("'{' expected"); RECOVER
;;
3959 #line 1659 "./parse.y"
3960 {yyerror ("'(' expected"); RECOVER
;;
3963 #line 1661 "./parse.y"
3964 {yyerror ("Missing term"); RECOVER
;;
3967 #line 1663 "./parse.y"
3968 {yyerror ("Missing term"); RECOVER
;;
3971 #line 1668 "./parse.y"
3973 if ((1 << yyvsp
[0].value
) != ACC_SYNCHRONIZED
)
3974 fatal ("synchronized was '%d' - yyparse", (1 << yyvsp
[0].value
));
3978 #line 1676 "./parse.y"
3979 { yyval
.node
= build_try_statement (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3982 #line 1678 "./parse.y"
3983 { yyval
.node
= build_try_finally_statement (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3986 #line 1680 "./parse.y"
3987 { yyval
.node
= build_try_finally_statement
3988 (yyvsp
[-3].operator.location
, build_try_statement (yyvsp
[-3].operator.location
,
3989 yyvsp
[-2].node
, yyvsp
[-1].node
), yyvsp
[0].node
);
3993 #line 1685 "./parse.y"
3994 {yyerror ("'{' expected"); DRECOVER (try_statement
);;
3997 #line 1691 "./parse.y"
3999 TREE_CHAIN (yyvsp
[0].node
) = yyvsp
[-1].node
;
4000 yyval
.node
= yyvsp
[0].node
;
4004 #line 1699 "./parse.y"
4006 java_method_add_stmt (current_function_decl
, yyvsp
[0].node
);
4008 yyval
.node
= yyvsp
[-1].node
;
4012 #line 1707 "./parse.y"
4014 /* We add a block to define a scope for
4015 formal_parameter (CCBP). The formal parameter is
4016 declared initialized by the appropriate function
4018 tree ccpb
= enter_block ();
4019 tree init
= build_assignment (ASSIGN_TK
, yyvsp
[-2].operator.location
,
4020 TREE_PURPOSE (yyvsp
[-1].node
),
4021 soft_exceptioninfo_call_node
);
4022 declare_local_variables (0, TREE_VALUE (yyvsp
[-1].node
),
4023 build_tree_list (TREE_PURPOSE (yyvsp
[-1].node
),
4025 yyval
.node
= build1 (CATCH_EXPR
, NULL_TREE
, ccpb
);
4026 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-3].operator.location
;
4030 #line 1723 "./parse.y"
4031 {yyerror ("'(' expected"); RECOVER
;;
4034 #line 1725 "./parse.y"
4035 {yyerror ("Missing term or ')' expected"); DRECOVER (2);;
4038 #line 1727 "./parse.y"
4039 {yyerror ("')' expected"); DRECOVER (1);;
4042 #line 1732 "./parse.y"
4043 { yyval
.node
= yyvsp
[0].node
; ;
4046 #line 1734 "./parse.y"
4047 {yyerror ("'{' expected"); RECOVER
; ;
4050 #line 1746 "./parse.y"
4051 { yyval
.node
= build_this (yyvsp
[0].operator.location
); ;
4054 #line 1748 "./parse.y"
4055 {yyval
.node
= yyvsp
[-1].node
;;
4058 #line 1757 "./parse.y"
4059 { yyval
.node
= parse_jdk1_1_error ("named class literals"); ;
4062 #line 1759 "./parse.y"
4063 { yyval
.node
= build_class_ref (yyvsp
[-2].node
); ;
4066 #line 1761 "./parse.y"
4067 { yyval
.node
= build_class_ref (void_type_node
); ;
4070 #line 1766 "./parse.y"
4071 { yyval
.node
= parse_jdk1_1_error ("class literals"); ;
4074 #line 1768 "./parse.y"
4075 {yyerror ("')' expected"); RECOVER
;;
4078 #line 1770 "./parse.y"
4079 {yyerror ("'class' or 'this' expected" ); RECOVER
;;
4082 #line 1772 "./parse.y"
4083 {yyerror ("'class' expected" ); RECOVER
;;
4086 #line 1774 "./parse.y"
4087 {yyerror ("'class' expected" ); RECOVER
;;
4090 #line 1779 "./parse.y"
4091 { yyval
.node
= build_new_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4094 #line 1781 "./parse.y"
4095 { yyval
.node
= build_new_invocation (yyvsp
[-2].node
, NULL_TREE
); ;
4098 #line 1786 "./parse.y"
4099 { yyval
.node
= parse_jdk1_1_error ("inner class instance creation"); ;
4102 #line 1788 "./parse.y"
4103 { yyval
.node
= parse_jdk1_1_error ("inner class instance creation"); ;
4106 #line 1797 "./parse.y"
4107 {yyerror ("'(' expected"); DRECOVER(new_1
);;
4110 #line 1799 "./parse.y"
4111 {yyerror ("'(' expected"); RECOVER
;;
4114 #line 1801 "./parse.y"
4115 {yyerror ("')' or term expected"); RECOVER
;;
4118 #line 1803 "./parse.y"
4119 {yyerror ("')' expected"); RECOVER
;;
4122 #line 1805 "./parse.y"
4123 {YYERROR_NOW
; yyerror ("Identifier expected"); RECOVER
;;
4126 #line 1807 "./parse.y"
4127 {yyerror ("'(' expected"); RECOVER
;;
4130 #line 1817 "./parse.y"
4132 yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, NULL_TREE
);
4133 ctxp
->formal_parameter_number
= 1;
4137 #line 1822 "./parse.y"
4139 ctxp
->formal_parameter_number
+= 1;
4140 yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, yyvsp
[-2].node
);
4144 #line 1827 "./parse.y"
4145 {yyerror ("Missing term"); RECOVER
;;
4148 #line 1832 "./parse.y"
4149 { yyval
.node
= build_newarray_node (yyvsp
[-1].node
, yyvsp
[0].node
, 0); ;
4152 #line 1834 "./parse.y"
4153 { yyval
.node
= build_newarray_node (yyvsp
[-1].node
, yyvsp
[0].node
, 0); ;
4156 #line 1836 "./parse.y"
4157 { yyval
.node
= build_newarray_node (yyvsp
[-2].node
, yyvsp
[-1].node
, CURRENT_OSB (ctxp
));;
4160 #line 1838 "./parse.y"
4161 { yyval
.node
= build_newarray_node (yyvsp
[-2].node
, yyvsp
[-1].node
, CURRENT_OSB (ctxp
));;
4164 #line 1842 "./parse.y"
4165 { yyval
.node
= parse_jdk1_1_error ("anonymous array"); ;
4168 #line 1844 "./parse.y"
4169 { yyval
.node
= parse_jdk1_1_error ("anonymous array"); ;
4172 #line 1846 "./parse.y"
4173 {yyerror ("'[' expected"); DRECOVER ("]");;
4176 #line 1848 "./parse.y"
4177 {yyerror ("']' expected"); RECOVER
;;
4180 #line 1853 "./parse.y"
4181 { yyval
.node
= build_tree_list (NULL_TREE
, yyvsp
[0].node
); ;
4184 #line 1855 "./parse.y"
4185 { yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, yyval
.node
); ;
4188 #line 1860 "./parse.y"
4190 EXPR_WFL_LINECOL (yyvsp
[-1].node
) = yyvsp
[-2].operator.location
;
4191 yyval
.node
= yyvsp
[-1].node
;
4195 #line 1865 "./parse.y"
4196 {yyerror ("']' expected"); RECOVER
;;
4199 #line 1867 "./parse.y"
4201 yyerror ("Missing term");
4202 yyerror ("']' expected");
4207 #line 1876 "./parse.y"
4210 /* If not initialized, allocate memory for the osb
4212 if (!ctxp
->osb_limit
)
4214 allocate
= ctxp
->osb_limit
= 32;
4215 ctxp
->osb_depth
= -1;
4217 /* If capacity overflown, reallocate a bigger chuck */
4218 else if (ctxp
->osb_depth
+1 == ctxp
->osb_limit
)
4219 allocate
= ctxp
->osb_limit
<< 1;
4223 allocate
*= sizeof (int);
4224 if (ctxp
->osb_number
)
4225 ctxp
->osb_number
= (int *)xrealloc (ctxp
->osb_number
,
4228 ctxp
->osb_number
= (int *)xmalloc (allocate
);
4231 CURRENT_OSB (ctxp
) = 1;
4235 #line 1902 "./parse.y"
4236 { CURRENT_OSB (ctxp
)++; ;
4239 #line 1904 "./parse.y"
4240 { yyerror ("']' expected"); RECOVER
;;
4243 #line 1909 "./parse.y"
4244 { yyval
.node
= make_qualified_primary (yyvsp
[-2].node
, yyvsp
[0].node
, yyvsp
[-1].operator.location
); ;
4247 #line 1913 "./parse.y"
4250 build_wfl_node (super_identifier_node
);
4251 EXPR_WFL_LINECOL (super_wfl
) = yyvsp
[-2].operator.location
;
4252 yyval
.node
= make_qualified_name (super_wfl
, yyvsp
[0].node
, yyvsp
[-1].operator.location
);
4256 #line 1920 "./parse.y"
4257 {yyerror ("Field expected"); DRECOVER (super_field_acces
);;
4260 #line 1925 "./parse.y"
4261 { yyval
.node
= build_method_invocation (yyvsp
[-2].node
, NULL_TREE
); ;
4264 #line 1927 "./parse.y"
4265 { yyval
.node
= build_method_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4268 #line 1929 "./parse.y"
4270 if (TREE_CODE (yyvsp
[-4].node
) == THIS_EXPR
)
4271 yyval
.node
= build_this_super_qualified_invocation
4272 (1, yyvsp
[-2].node
, NULL_TREE
, 0, yyvsp
[-3].operator.location
);
4275 tree invok
= build_method_invocation (yyvsp
[-2].node
, NULL_TREE
);
4276 yyval
.node
= make_qualified_primary (yyvsp
[-4].node
, invok
, yyvsp
[-3].operator.location
);
4281 #line 1940 "./parse.y"
4283 if (TREE_CODE (yyvsp
[-5].node
) == THIS_EXPR
)
4284 yyval
.node
= build_this_super_qualified_invocation
4285 (1, yyvsp
[-3].node
, yyvsp
[-1].node
, 0, yyvsp
[-4].operator.location
);
4288 tree invok
= build_method_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
);
4289 yyval
.node
= make_qualified_primary (yyvsp
[-5].node
, invok
, yyvsp
[-4].operator.location
);
4294 #line 1951 "./parse.y"
4296 yyval
.node
= build_this_super_qualified_invocation
4297 (0, yyvsp
[-2].node
, NULL_TREE
, yyvsp
[-4].operator.location
, yyvsp
[-3].operator.location
);
4301 #line 1956 "./parse.y"
4303 yyval
.node
= build_this_super_qualified_invocation
4304 (0, yyvsp
[-3].node
, yyvsp
[-1].node
, yyvsp
[-5].operator.location
, yyvsp
[-4].operator.location
);
4308 #line 1965 "./parse.y"
4309 { yyerror ("'(' expected"); DRECOVER (method_invocation
); ;
4312 #line 1967 "./parse.y"
4313 { yyerror ("'(' expected"); DRECOVER (method_invocation
); ;
4316 #line 1972 "./parse.y"
4317 { yyval
.node
= build_array_ref (yyvsp
[-2].operator.location
, yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4320 #line 1974 "./parse.y"
4321 { yyval
.node
= build_array_ref (yyvsp
[-2].operator.location
, yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4324 #line 1976 "./parse.y"
4326 yyerror ("Missing term and ']' expected");
4327 DRECOVER(array_access
);
4331 #line 1981 "./parse.y"
4333 yyerror ("']' expected");
4334 DRECOVER(array_access
);
4338 #line 1986 "./parse.y"
4340 yyerror ("Missing term and ']' expected");
4341 DRECOVER(array_access
);
4345 #line 1991 "./parse.y"
4347 yyerror ("']' expected");
4348 DRECOVER(array_access
);
4352 #line 2006 "./parse.y"
4353 { yyval
.node
= build_incdec (yyvsp
[0].operator.token
, yyvsp
[0].operator.location
, yyvsp
[-1].node
, 1); ;
4356 #line 2011 "./parse.y"
4357 { yyval
.node
= build_incdec (yyvsp
[0].operator.token
, yyvsp
[0].operator.location
, yyvsp
[-1].node
, 1); ;
4360 #line 2018 "./parse.y"
4361 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4364 #line 2020 "./parse.y"
4365 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4368 #line 2023 "./parse.y"
4369 {yyerror ("Missing term"); RECOVER
;
4372 #line 2025 "./parse.y"
4373 {yyerror ("Missing term"); RECOVER
;
4376 #line 2030 "./parse.y"
4377 {yyval
.node
= build_incdec (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
, 0); ;
4380 #line 2032 "./parse.y"
4381 {yyerror ("Missing term"); RECOVER
;
4384 #line 2037 "./parse.y"
4385 {yyval
.node
= build_incdec (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
, 0); ;
4388 #line 2039 "./parse.y"
4389 {yyerror ("Missing term"); RECOVER
;
4392 #line 2045 "./parse.y"
4393 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4396 #line 2047 "./parse.y"
4397 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4400 #line 2050 "./parse.y"
4401 {yyerror ("Missing term"); RECOVER
;
4404 #line 2052 "./parse.y"
4405 {yyerror ("Missing term"); RECOVER
;
4408 #line 2057 "./parse.y"
4410 tree type
= yyvsp
[-3].node
;
4411 while (CURRENT_OSB (ctxp
)--)
4412 type
= build_java_array_type (type
, -1);
4414 yyval
.node
= build_cast (yyvsp
[-4].operator.location
, type
, yyvsp
[0].node
);
4418 #line 2065 "./parse.y"
4419 { yyval
.node
= build_cast (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4422 #line 2067 "./parse.y"
4423 { yyval
.node
= build_cast (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4426 #line 2069 "./parse.y"
4429 while (CURRENT_OSB (ctxp
)--)
4430 obstack_1grow (&temporary_obstack
, '[');
4432 obstack_grow0 (&temporary_obstack
,
4433 IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp
[-3].node
)),
4434 IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp
[-3].node
)));
4435 ptr
= obstack_finish (&temporary_obstack
);
4436 EXPR_WFL_NODE (yyvsp
[-3].node
) = get_identifier (ptr
);
4437 yyval
.node
= build_cast (yyvsp
[-4].operator.location
, yyvsp
[-3].node
, yyvsp
[0].node
);
4441 #line 2082 "./parse.y"
4442 {yyerror ("']' expected, invalid type expression");;
4445 #line 2084 "./parse.y"
4447 if (ctxp
->prevent_ese
!= lineno
)
4448 yyerror ("Invalid type expression"); RECOVER
;
4453 #line 2090 "./parse.y"
4454 {yyerror ("Missing term"); RECOVER
;;
4457 #line 2092 "./parse.y"
4458 {yyerror ("Missing term"); RECOVER
;;
4461 #line 2094 "./parse.y"
4462 {yyerror ("Missing term"); RECOVER
;;
4465 #line 2100 "./parse.y"
4467 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
),
4468 yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
);
4472 #line 2105 "./parse.y"
4474 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4475 yyvsp
[-2].node
, yyvsp
[0].node
);
4479 #line 2110 "./parse.y"
4481 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4482 yyvsp
[-2].node
, yyvsp
[0].node
);
4486 #line 2115 "./parse.y"
4487 {yyerror ("Missing term"); RECOVER
;;
4490 #line 2117 "./parse.y"
4491 {yyerror ("Missing term"); RECOVER
;;
4494 #line 2119 "./parse.y"
4495 {yyerror ("Missing term"); RECOVER
;;
4498 #line 2125 "./parse.y"
4500 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4501 yyvsp
[-2].node
, yyvsp
[0].node
);
4505 #line 2130 "./parse.y"
4507 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4508 yyvsp
[-2].node
, yyvsp
[0].node
);
4512 #line 2135 "./parse.y"
4513 {yyerror ("Missing term"); RECOVER
;;
4516 #line 2137 "./parse.y"
4517 {yyerror ("Missing term"); RECOVER
;;
4520 #line 2143 "./parse.y"
4522 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4523 yyvsp
[-2].node
, yyvsp
[0].node
);
4527 #line 2148 "./parse.y"
4529 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4530 yyvsp
[-2].node
, yyvsp
[0].node
);
4534 #line 2153 "./parse.y"
4536 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4537 yyvsp
[-2].node
, yyvsp
[0].node
);
4541 #line 2158 "./parse.y"
4542 {yyerror ("Missing term"); RECOVER
;;
4545 #line 2160 "./parse.y"
4546 {yyerror ("Missing term"); RECOVER
;;
4549 #line 2162 "./parse.y"
4550 {yyerror ("Missing term"); RECOVER
;;
4553 #line 2168 "./parse.y"
4555 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4556 yyvsp
[-2].node
, yyvsp
[0].node
);
4560 #line 2173 "./parse.y"
4562 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4563 yyvsp
[-2].node
, yyvsp
[0].node
);
4567 #line 2178 "./parse.y"
4569 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4570 yyvsp
[-2].node
, yyvsp
[0].node
);
4574 #line 2183 "./parse.y"
4576 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4577 yyvsp
[-2].node
, yyvsp
[0].node
);
4581 #line 2188 "./parse.y"
4582 { yyval
.node
= build_binop (INSTANCEOF_EXPR
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4585 #line 2190 "./parse.y"
4586 {yyerror ("Missing term"); RECOVER
;;
4589 #line 2192 "./parse.y"
4590 {yyerror ("Missing term"); RECOVER
;;
4593 #line 2194 "./parse.y"
4594 {yyerror ("Missing term"); RECOVER
;;
4597 #line 2196 "./parse.y"
4598 {yyerror ("Missing term"); RECOVER
;;
4601 #line 2198 "./parse.y"
4602 {yyerror ("Invalid reference type"); RECOVER
;;
4605 #line 2204 "./parse.y"
4607 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4608 yyvsp
[-2].node
, yyvsp
[0].node
);
4612 #line 2209 "./parse.y"
4614 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4615 yyvsp
[-2].node
, yyvsp
[0].node
);
4619 #line 2214 "./parse.y"
4620 {yyerror ("Missing term"); RECOVER
;;
4623 #line 2216 "./parse.y"
4624 {yyerror ("Missing term"); RECOVER
;;
4627 #line 2222 "./parse.y"
4629 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4630 yyvsp
[-2].node
, yyvsp
[0].node
);
4634 #line 2227 "./parse.y"
4635 {yyerror ("Missing term"); RECOVER
;;
4638 #line 2233 "./parse.y"
4640 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4641 yyvsp
[-2].node
, yyvsp
[0].node
);
4645 #line 2238 "./parse.y"
4646 {yyerror ("Missing term"); RECOVER
;;
4649 #line 2244 "./parse.y"
4651 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4652 yyvsp
[-2].node
, yyvsp
[0].node
);
4656 #line 2249 "./parse.y"
4657 {yyerror ("Missing term"); RECOVER
;;
4660 #line 2255 "./parse.y"
4662 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4663 yyvsp
[-2].node
, yyvsp
[0].node
);
4667 #line 2260 "./parse.y"
4668 {yyerror ("Missing term"); RECOVER
;;
4671 #line 2266 "./parse.y"
4673 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4674 yyvsp
[-2].node
, yyvsp
[0].node
);
4678 #line 2271 "./parse.y"
4679 {yyerror ("Missing term"); RECOVER
;;
4682 #line 2277 "./parse.y"
4684 yyval
.node
= build (CONDITIONAL_EXPR
, NULL_TREE
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
);
4685 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-3].operator.location
;
4689 #line 2282 "./parse.y"
4692 yyerror ("Missing term");
4697 #line 2288 "./parse.y"
4698 {yyerror ("Missing term"); DRECOVER (2);;
4701 #line 2290 "./parse.y"
4702 {yyerror ("Missing term"); DRECOVER (3);;
4705 #line 2300 "./parse.y"
4706 { yyval
.node
= build_assignment (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4709 #line 2302 "./parse.y"
4711 if (ctxp
->prevent_ese
!= lineno
)
4712 yyerror ("Missing term");
4717 /* the action file gets copied in in place of this dollarsign */
4718 #line 498 "/usr/share/misc/bison.simple"
4729 short *ssp1
= yyss
- 1;
4730 fprintf (stderr
, "state stack now");
4731 while (ssp1
!= yyssp
)
4732 fprintf (stderr
, " %d", *++ssp1
);
4733 fprintf (stderr
, "\n");
4743 yylsp
->first_line
= yylloc
.first_line
;
4744 yylsp
->first_column
= yylloc
.first_column
;
4745 yylsp
->last_line
= (yylsp
-1)->last_line
;
4746 yylsp
->last_column
= (yylsp
-1)->last_column
;
4751 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
4752 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
4756 /* Now "shift" the result of the reduction.
4757 Determine what state that goes to,
4758 based on the state we popped back to
4759 and the rule number reduced by. */
4763 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
4764 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
4765 yystate
= yytable
[yystate
];
4767 yystate
= yydefgoto
[yyn
- YYNTBASE
];
4771 yyerrlab
: /* here on detecting error */
4774 /* If not already recovering from an error, report this error. */
4778 #ifdef YYERROR_VERBOSE
4779 yyn
= yypact
[yystate
];
4781 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
4788 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
4789 for (x
= (yyn
< 0 ? -yyn
: 0);
4790 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
4791 if (yycheck
[x
+ yyn
] == x
)
4792 size
+= strlen(yytname
[x
]) + 15, count
++;
4793 msg
= (char *) malloc(size
+ 15);
4796 strcpy(msg
, "parse error");
4801 for (x
= (yyn
< 0 ? -yyn
: 0);
4802 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
4803 if (yycheck
[x
+ yyn
] == x
)
4805 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
4806 strcat(msg
, yytname
[x
]);
4815 yyerror ("parse error; also virtual memory exceeded");
4818 #endif /* YYERROR_VERBOSE */
4819 yyerror("parse error");
4823 yyerrlab1
: /* here on error raised explicitly by an action */
4825 if (yyerrstatus
== 3)
4827 /* if just tried and failed to reuse lookahead token after an error, discard it. */
4829 /* return failure if at end of input */
4830 if (yychar
== YYEOF
)
4835 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
4841 /* Else will try to reuse lookahead token
4842 after shifting the error token. */
4844 yyerrstatus
= 3; /* Each real token shifted decrements this */
4848 yyerrdefault
: /* current state does not do anything special for the error token. */
4851 /* This is wrong; only states that explicitly want error tokens
4852 should shift them. */
4853 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4854 if (yyn
) goto yydefault
;
4857 yyerrpop
: /* pop the current state because it cannot handle the error token */
4859 if (yyssp
== yyss
) YYABORT
;
4869 short *ssp1
= yyss
- 1;
4870 fprintf (stderr
, "Error: state stack now");
4871 while (ssp1
!= yyssp
)
4872 fprintf (stderr
, " %d", *++ssp1
);
4873 fprintf (stderr
, "\n");
4879 yyn
= yypact
[yystate
];
4884 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
4903 fprintf(stderr
, "Shifting error token, ");
4914 #line 2328 "./parse.y"
4918 /* Flag for the error report routine to issue the error the first time
4919 it's called (overriding the default behavior which is to drop the
4920 first invocation and honor the second one, taking advantage of a
4922 static int force_error
= 0;
4924 /* Create a new parser context and make it the current one. */
4927 java_push_parser_context ()
4929 struct parser_ctxt
*new =
4930 (struct parser_ctxt
*)xmalloc(sizeof (struct parser_ctxt
));
4932 bzero ((PTR
) new, sizeof (struct parser_ctxt
));
4937 ctxp
->incomplete_class
= ctxp
->next
->incomplete_class
;
4938 ctxp
->gclass_list
= ctxp
->next
->gclass_list
;
4942 /* If the first file of a file list was a class file, no context
4943 exists for a source file to be parsed. This boolean remembers that
4944 java_parser_context_save_global might have created a dummy one, so
4945 that java_parser_context_restore_global can pop it. */
4946 static int extra_ctxp_pushed_p
= 0;
4949 java_parser_context_save_global ()
4953 java_push_parser_context ();
4954 extra_ctxp_pushed_p
= 1;
4956 ctxp
->finput
= finput
;
4957 ctxp
->lineno
= lineno
;
4958 ctxp
->current_class
= current_class
;
4959 ctxp
->filename
= input_filename
;
4960 ctxp
->current_function_decl
= current_function_decl
;
4964 java_parser_context_restore_global ()
4966 finput
= ctxp
->finput
;
4967 lineno
= ctxp
->lineno
;
4968 current_class
= ctxp
->current_class
;
4969 input_filename
= ctxp
->filename
;
4970 current_function_decl
= ctxp
->current_function_decl
;
4971 if (!ctxp
->next
&& extra_ctxp_pushed_p
)
4973 java_pop_parser_context (0);
4974 extra_ctxp_pushed_p
= 0;
4979 java_pop_parser_context (generate
)
4983 struct parser_ctxt
*toFree
, *next
;
4992 next
->incomplete_class
= ctxp
->incomplete_class
;
4993 next
->gclass_list
= ctxp
->gclass_list
;
4994 lineno
= ctxp
->lineno
;
4995 finput
= ctxp
->finput
;
4996 current_class
= ctxp
->current_class
;
4999 /* Set the single import class file flag to 0 for the current list
5000 of imported things */
5001 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
5002 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current
)) = 0;
5004 /* And restore those of the previous context */
5005 if ((ctxp
= next
)) /* Assignment is really meant here */
5006 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
5007 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current
)) = 1;
5011 toFree
->next
= ctxp_for_generation
;
5012 ctxp_for_generation
= toFree
;
5018 /* Reporting JDK1.1 features not implemented */
5021 parse_jdk1_1_error (msg
)
5024 sorry (": `%s' JDK1.1(TM) feature", msg
);
5026 return empty_stmt_node
;
5029 static int do_warning
= 0;
5036 static int prev_lineno
;
5037 static const char *prev_msg
;
5040 char *remainder
, *code_from_source
;
5041 extern struct obstack temporary_obstack
;
5043 if (!force_error
&& prev_lineno
== lineno
)
5046 /* Save current error location but report latter, when the context is
5048 if (ctxp
->java_error_flag
== 0)
5050 ctxp
->java_error_flag
= 1;
5052 /* Do something to use the previous line if we're reaching the
5053 end of the file... */
5054 #ifdef VERBOSE_SKELETON
5055 printf ("* Error detected (%s)\n", (msg
? msg
: "(null)"));
5060 /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
5061 if (!force_error
&& msg
== prev_msg
&& prev_lineno
== elc
.line
)
5064 ctxp
->java_error_flag
= 0;
5066 java_warning_count
++;
5070 if (elc
.col
== 0 && msg
[1] == ';')
5072 elc
.col
= ctxp
->p_line
->char_col
-1;
5073 elc
.line
= ctxp
->p_line
->lineno
;
5076 save_lineno
= lineno
;
5077 prev_lineno
= lineno
= elc
.line
;
5080 code_from_source
= java_get_line_col (ctxp
->filename
, elc
.line
, elc
.col
);
5081 obstack_grow0 (&temporary_obstack
,
5082 code_from_source
, strlen (code_from_source
));
5083 remainder
= obstack_finish (&temporary_obstack
);
5085 warning ("%s.\n%s", msg
, remainder
);
5087 error ("%s.\n%s", msg
, remainder
);
5089 /* This allow us to cheaply avoid an extra 'Invalid expression
5090 statement' error report when errors have been already reported on
5091 the same line. This occurs when we report an error but don't have
5092 a synchronization point other than ';', which
5093 expression_statement is the only one to take care of. */
5094 ctxp
->prevent_ese
= lineno
= save_lineno
;
5098 issue_warning_error_from_context (cl
, msg
, ap
)
5103 char *saved
, *saved_input_filename
;
5105 vsprintf (buffer
, msg
, ap
);
5108 ctxp
->elc
.line
= EXPR_WFL_LINENO (cl
);
5109 ctxp
->elc
.col
= (EXPR_WFL_COLNO (cl
) == 0xfff ? -1 :
5110 (EXPR_WFL_COLNO (cl
) == 0xffe ? -2 : EXPR_WFL_COLNO (cl
)));
5112 /* We have a CL, that's a good reason for using it if it contains data */
5113 saved
= ctxp
->filename
;
5114 if (TREE_CODE (cl
) == EXPR_WITH_FILE_LOCATION
&& EXPR_WFL_FILENAME_NODE (cl
))
5115 ctxp
->filename
= EXPR_WFL_FILENAME (cl
);
5116 saved_input_filename
= input_filename
;
5117 input_filename
= ctxp
->filename
;
5119 java_error (buffer
);
5120 ctxp
->filename
= saved
;
5121 input_filename
= saved_input_filename
;
5125 /* Issue an error message at a current source line CL */
5128 parse_error_context
VPROTO ((tree cl
, const char *msg
, ...))
5130 #ifndef ANSI_PROTOTYPES
5137 #ifndef ANSI_PROTOTYPES
5138 cl
= va_arg (ap
, tree
);
5139 msg
= va_arg (ap
, const char *);
5141 issue_warning_error_from_context (cl
, msg
, ap
);
5145 /* Issue a warning at a current source line CL */
5148 parse_warning_context
VPROTO ((tree cl
, const char *msg
, ...))
5150 #ifndef ANSI_PROTOTYPES
5157 #ifndef ANSI_PROTOTYPES
5158 cl
= va_arg (ap
, tree
);
5159 msg
= va_arg (ap
, const char *);
5162 force_error
= do_warning
= 1;
5163 issue_warning_error_from_context (cl
, msg
, ap
);
5164 do_warning
= force_error
= 0;
5169 find_expr_with_wfl (node
)
5177 switch (TREE_CODE (node
))
5180 node
= BLOCK_EXPR_BODY (node
);
5184 to_return
= find_expr_with_wfl (TREE_OPERAND (node
, 0));
5187 node
= TREE_OPERAND (node
, 1);
5191 node
= TREE_OPERAND (node
, 0);
5194 case LABELED_BLOCK_EXPR
:
5195 node
= TREE_OPERAND (node
, 1);
5199 code
= TREE_CODE_CLASS (TREE_CODE (node
));
5200 if (((code
== '1') || (code
== '2') || (code
== 'e'))
5201 && EXPR_WFL_LINECOL (node
))
5209 /* Issue a missing return statement error. Uses METHOD to figure the
5210 last line of the method the error occurs in. */
5213 missing_return_error (method
)
5216 EXPR_WFL_SET_LINECOL (wfl_operator
, DECL_SOURCE_LINE_LAST (method
), -2);
5217 parse_error_context (wfl_operator
, "Missing return statement");
5220 /* Issue an unreachable statement error. From NODE, find the next
5221 statement to report appropriately. */
5223 unreachable_stmt_error (node
)
5226 /* Browse node to find the next expression node that has a WFL. Use
5227 the location to report the error */
5228 if (TREE_CODE (node
) == COMPOUND_EXPR
)
5229 node
= find_expr_with_wfl (TREE_OPERAND (node
, 1));
5231 node
= find_expr_with_wfl (node
);
5235 EXPR_WFL_SET_LINECOL (wfl_operator
, EXPR_WFL_LINENO (node
), -2);
5236 parse_error_context (wfl_operator
, "Unreachable statement");
5239 fatal ("Can't get valid statement - unreachable_stmt_error");
5243 java_report_errors ()
5245 if (java_error_count
)
5246 fprintf (stderr
, "%d error%s",
5247 java_error_count
, (java_error_count
== 1 ? "" : "s"));
5248 if (java_warning_count
)
5249 fprintf (stderr
, "%s%d warning%s", (java_error_count
? ", " : ""),
5250 java_warning_count
, (java_warning_count
== 1 ? "" : "s"));
5251 if (java_error_count
|| java_warning_count
)
5252 putc ('\n', stderr
);
5253 return java_error_count
;
5257 java_accstring_lookup (flags
)
5260 static char buffer
[80];
5261 #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
5263 /* Access modifier looked-up first for easier report on forbidden
5265 if (flags
& ACC_PUBLIC
) COPY_RETURN ("public");
5266 if (flags
& ACC_PRIVATE
) COPY_RETURN ("private");
5267 if (flags
& ACC_PROTECTED
) COPY_RETURN ("protected");
5268 if (flags
& ACC_STATIC
) COPY_RETURN ("static");
5269 if (flags
& ACC_FINAL
) COPY_RETURN ("final");
5270 if (flags
& ACC_SYNCHRONIZED
) COPY_RETURN ("synchronized");
5271 if (flags
& ACC_VOLATILE
) COPY_RETURN ("volatile");
5272 if (flags
& ACC_TRANSIENT
) COPY_RETURN ("transient");
5273 if (flags
& ACC_NATIVE
) COPY_RETURN ("native");
5274 if (flags
& ACC_INTERFACE
) COPY_RETURN ("interface");
5275 if (flags
& ACC_ABSTRACT
) COPY_RETURN ("abstract");
5282 /* Issuing error messages upon redefinition of classes, interfaces or
5286 classitf_redefinition_error (context
, id
, decl
, cl
)
5287 const char *context
;
5290 parse_error_context (cl
, "%s `%s' already defined in %s:%d",
5291 context
, IDENTIFIER_POINTER (id
),
5292 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
5293 /* Here we should point out where its redefined. It's a unicode. FIXME */
5297 variable_redefinition_error (context
, name
, type
, line
)
5298 tree context
, name
, type
;
5301 const char *type_name
;
5303 /* Figure a proper name for type. We might haven't resolved it */
5304 if (TREE_CODE (type
) == POINTER_TYPE
&& !TREE_TYPE (type
))
5305 type_name
= IDENTIFIER_POINTER (TYPE_NAME (type
));
5307 type_name
= lang_printable_name (type
, 0);
5309 parse_error_context (context
,
5310 "Variable `%s' is already defined in this method and "
5311 "was declared `%s %s' at line %d",
5312 IDENTIFIER_POINTER (name
),
5313 type_name
, IDENTIFIER_POINTER (name
), line
);
5317 build_array_from_name (type
, type_wfl
, name
, ret_name
)
5318 tree type
, type_wfl
, name
, *ret_name
;
5323 /* Eventually get more dims */
5324 string
= IDENTIFIER_POINTER (name
);
5325 while (string
[more_dims
] == '[')
5328 /* If we have, then craft a new type for this variable */
5331 name
= get_identifier (&string
[more_dims
]);
5333 /* If we have a pointer, use its type */
5334 if (TREE_CODE (type
) == POINTER_TYPE
)
5335 type
= TREE_TYPE (type
);
5337 /* Building the first dimension of a primitive type uses this
5339 if (JPRIMITIVE_TYPE_P (type
))
5341 type
= build_java_array_type (type
, -1);
5342 CLASS_LOADED_P (type
) = 1;
5345 /* Otherwise, if we have a WFL for this type, use it (the type
5346 is already an array on an unresolved type, and we just keep
5347 on adding dimensions) */
5351 /* Add all the dimensions */
5353 type
= build_unresolved_array_type (type
);
5355 /* The type may have been incomplete in the first place */
5357 type
= obtain_incomplete_type (type
);
5364 /* Build something that the type identifier resolver will identify as
5365 being an array to an unresolved type. TYPE_WFL is a WFL on a
5369 build_unresolved_array_type (type_or_wfl
)
5374 /* TYPE_OR_WFL might be an array on a resolved type. In this case,
5375 just create a array type */
5376 if (TREE_CODE (type_or_wfl
) == RECORD_TYPE
)
5378 tree type
= build_java_array_type (type_or_wfl
, -1);
5379 CLASS_LOADED_P (type
) = CLASS_LOADED_P (type_or_wfl
);
5383 obstack_1grow (&temporary_obstack
, '[');
5384 obstack_grow0 (&temporary_obstack
,
5385 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl
)),
5386 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl
)));
5387 ptr
= obstack_finish (&temporary_obstack
);
5388 return build_expr_wfl (get_identifier (ptr
),
5389 EXPR_WFL_FILENAME (type_or_wfl
),
5390 EXPR_WFL_LINENO (type_or_wfl
),
5391 EXPR_WFL_COLNO (type_or_wfl
));
5394 /* Check modifiers. If one doesn't fit, retrieve it in its declaration line
5395 and point it out. */
5398 check_modifiers (message
, value
, mask
)
5399 const char *message
;
5403 /* Should point out the one that don't fit. ASCII/unicode,
5404 going backward. FIXME */
5407 int i
, remainder
= value
& ~mask
;
5408 for (i
= 0; i
<= 10; i
++)
5409 if ((1 << i
) & remainder
)
5410 parse_error_context (ctxp
->modifier_ctx
[i
], message
,
5411 java_accstring_lookup (1 << i
));
5416 parser_add_interface (class_decl
, interface_decl
, wfl
)
5417 tree class_decl
, interface_decl
, wfl
;
5419 if (maybe_add_interface (TREE_TYPE (class_decl
), TREE_TYPE (interface_decl
)))
5420 parse_error_context (wfl
, "Interface `%s' repeated",
5421 IDENTIFIER_POINTER (DECL_NAME (interface_decl
)));
5424 /* Bulk of common class/interface checks. Return 1 if an error was
5425 encountered. TAG is 0 for a class, 1 for an interface. */
5428 check_class_interface_creation (is_interface
, flags
, raw_name
, qualified_name
, decl
, cl
)
5429 int is_interface
, flags
;
5430 tree raw_name
, qualified_name
, decl
, cl
;
5435 fprintf (stderr
, " %s %s", (is_interface
? "interface" : "class"),
5436 IDENTIFIER_POINTER (qualified_name
));
5438 /* Scope of an interface/class type name:
5439 - Can't be imported by a single type import
5440 - Can't already exists in the package */
5441 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name
)
5442 && (node
= find_name_in_single_imports (raw_name
)))
5445 (cl
, "%s name `%s' clashes with imported type `%s'",
5446 (is_interface
? "Interface" : "Class"),
5447 IDENTIFIER_POINTER (raw_name
), IDENTIFIER_POINTER (node
));
5450 if (decl
&& CLASS_COMPLETE_P (decl
))
5452 classitf_redefinition_error ((is_interface
? "Interface" : "Class"),
5453 qualified_name
, decl
, cl
);
5457 /* If public, file name should match class/interface name */
5458 if (flags
& ACC_PUBLIC
)
5462 /* Contains OS dependent assumption on path separator. FIXME */
5463 for (f
= &input_filename
[strlen (input_filename
)];
5464 f
!= input_filename
&& f
[0] != '/' && f
[0] != DIR_SEPARATOR
;
5467 if (f
[0] == '/' || f
[0] == DIR_SEPARATOR
)
5469 if (strncmp (IDENTIFIER_POINTER (raw_name
),
5470 f
, IDENTIFIER_LENGTH (raw_name
)) ||
5471 f
[IDENTIFIER_LENGTH (raw_name
)] != '.')
5472 parse_error_context (cl
, "Public %s `%s' must be defined in a file "
5474 (is_interface
? "interface" : "class"),
5475 IDENTIFIER_POINTER (qualified_name
),
5476 IDENTIFIER_POINTER (raw_name
));
5479 check_modifiers ((is_interface
?
5480 "Illegal modifier `%s' for interface declaration" :
5481 "Illegal modifier `%s' for class declaration"), flags
,
5482 (is_interface
? INTERFACE_MODIFIERS
: CLASS_MODIFIERS
));
5486 /* If DECL is NULL, create and push a new DECL, record the current
5487 line CL and do other maintenance things. */
5490 maybe_create_class_interface_decl (decl
, qualified_name
, cl
)
5491 tree decl
, qualified_name
, cl
;
5494 decl
= push_class (make_class (), qualified_name
);
5496 /* Take care of the file and line business */
5497 DECL_SOURCE_FILE (decl
) = EXPR_WFL_FILENAME (cl
);
5498 /* If we're emiting xrefs, store the line/col number information */
5500 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINECOL (cl
);
5502 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINENO (cl
);
5503 CLASS_FROM_SOURCE_P (TREE_TYPE (decl
)) = 1;
5504 CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl
)) =
5505 IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl
));
5507 ctxp
->current_parsed_class
= decl
;
5509 /* Link the declaration to the already seen ones */
5510 TREE_CHAIN (decl
) = ctxp
->class_list
;
5511 ctxp
->class_list
= decl
;
5513 /* Create a new nodes in the global lists */
5514 ctxp
->gclass_list
= tree_cons (NULL_TREE
, decl
, ctxp
->gclass_list
);
5515 all_class_list
= tree_cons (NULL_TREE
, decl
, all_class_list
);
5517 /* Install a new dependency list element */
5518 create_jdep_list (ctxp
);
5520 SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
5521 IDENTIFIER_POINTER (qualified_name
)));
5526 add_superinterfaces (decl
, interface_list
)
5527 tree decl
, interface_list
;
5530 /* Superinterface(s): if present and defined, parser_check_super_interface ()
5531 takes care of ensuring that:
5532 - This is an accessible interface type,
5533 - Circularity detection.
5534 parser_add_interface is then called. If present but not defined,
5535 the check operation is delayed until the super interface gets
5537 for (node
= interface_list
; node
; node
= TREE_CHAIN (node
))
5539 tree current
= TREE_PURPOSE (node
);
5540 tree idecl
= IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current
));
5541 if (idecl
&& CLASS_LOADED_P (TREE_TYPE (idecl
)))
5543 if (!parser_check_super_interface (idecl
, decl
, current
))
5544 parser_add_interface (decl
, idecl
, current
);
5547 register_incomplete_type (JDEP_INTERFACE
,
5548 current
, decl
, NULL_TREE
);
5552 /* Create an interface in pass1 and return its decl. Return the
5553 interface's decl in pass 2. */
5556 create_interface (flags
, id
, super
)
5560 tree raw_name
= EXPR_WFL_NODE (id
);
5561 tree q_name
= parser_qualified_classname (id
);
5562 tree decl
= IDENTIFIER_CLASS_VALUE (q_name
);
5564 EXPR_WFL_NODE (id
) = q_name
; /* Keep source location, even if refined. */
5566 /* Basic checks: scope, redefinition, modifiers */
5567 if (check_class_interface_creation (1, flags
, raw_name
, q_name
, decl
, id
))
5570 /* Interface modifiers check
5571 - public/abstract allowed (already done at that point)
5572 - abstract is obsolete (comes first, it's a warning, or should be)
5573 - Can't use twice the same (checked in the modifier rule) */
5574 if ((flags
& ACC_ABSTRACT
) && flag_redundant
)
5575 parse_warning_context
5576 (MODIFIER_WFL (ABSTRACT_TK
),
5577 "Redundant use of `abstract' modifier. Interface `%s' is implicitely "
5578 "abstract", IDENTIFIER_POINTER (raw_name
));
5580 /* Create a new decl if DECL is NULL, otherwise fix it */
5581 decl
= maybe_create_class_interface_decl (decl
, q_name
, id
);
5583 /* Set super info and mark the class a complete */
5584 set_super_info (ACC_INTERFACE
| flags
, TREE_TYPE (decl
),
5585 object_type_node
, ctxp
->interface_number
);
5586 ctxp
->interface_number
= 0;
5587 CLASS_COMPLETE_P (decl
) = 1;
5588 add_superinterfaces (decl
, super
);
5593 /* Create an class in pass1 and return its decl. Return class
5594 interface's decl in pass 2. */
5597 create_class (flags
, id
, super
, interfaces
)
5599 tree id
, super
, interfaces
;
5601 tree raw_name
= EXPR_WFL_NODE (id
);
5602 tree class_id
, decl
;
5603 tree super_decl_type
;
5605 class_id
= parser_qualified_classname (id
);
5606 decl
= IDENTIFIER_CLASS_VALUE (class_id
);
5607 ctxp
->current_parsed_class_un
= EXPR_WFL_NODE (id
);
5608 EXPR_WFL_NODE (id
) = class_id
;
5610 /* Basic check: scope, redefinition, modifiers */
5611 if (check_class_interface_creation (0, flags
, raw_name
, class_id
, decl
, id
))
5614 /* Class modifier check:
5615 - Allowed modifier (already done at that point)
5616 - abstract AND final forbidden
5617 - Public classes defined in the correct file */
5618 if ((flags
& ACC_ABSTRACT
) && (flags
& ACC_FINAL
))
5619 parse_error_context (id
, "Class `%s' can't be declared both abstract "
5620 "and final", IDENTIFIER_POINTER (raw_name
));
5622 /* Create a new decl if DECL is NULL, otherwise fix it */
5623 decl
= maybe_create_class_interface_decl (decl
, class_id
, id
);
5625 /* If SUPER exists, use it, otherwise use Object */
5628 /* Can't extend java.lang.Object */
5629 if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id
)) == object_type_node
)
5631 parse_error_context (id
, "Can't extend `java.lang.Object'");
5636 register_incomplete_type (JDEP_SUPER
, super
, decl
, NULL_TREE
);
5638 else if (TREE_TYPE (decl
) != object_type_node
)
5639 super_decl_type
= object_type_node
;
5640 /* We're defining java.lang.Object */
5642 super_decl_type
= NULL_TREE
;
5644 /* Set super info and mark the class a complete */
5645 set_super_info (flags
, TREE_TYPE (decl
), super_decl_type
,
5646 ctxp
->interface_number
);
5647 ctxp
->interface_number
= 0;
5648 CLASS_COMPLETE_P (decl
) = 1;
5649 add_superinterfaces (decl
, interfaces
);
5651 /* If doing xref, store the location at which the inherited class
5652 (if any) was seen. */
5653 if (flag_emit_xref
&& super
)
5654 DECL_INHERITED_SOURCE_LINE (decl
) = EXPR_WFL_LINECOL (super
);
5656 /* Eventually sets the @deprecated tag flag */
5657 CHECK_DEPRECATED (decl
);
5662 /* Can't use lookup_field () since we don't want to load the class and
5663 can't set the CLASS_LOADED_P flag */
5666 find_field (class, name
)
5671 for (decl
= TYPE_FIELDS (class); decl
; decl
= TREE_CHAIN (decl
))
5673 if (DECL_NAME (decl
) == name
)
5679 /* Wrap around lookup_field that doesn't potentially upset the value
5683 lookup_field_wrapper (class, name
)
5688 java_parser_context_save_global ();
5689 decl
= lookup_field (&type
, name
);
5690 java_parser_context_restore_global ();
5691 return decl
== error_mark_node
? NULL
: decl
;
5694 /* Find duplicate field within the same class declarations and report
5695 the error. Returns 1 if a duplicated field was found, 0
5699 duplicate_declaration_error_p (new_field_name
, new_type
, cl
)
5700 tree new_field_name
, new_type
, cl
;
5702 /* This might be modified to work with method decl as well */
5703 tree decl
= find_field (TREE_TYPE (ctxp
->current_parsed_class
),
5707 char *t1
= strdup (purify_type_name
5708 ((TREE_CODE (new_type
) == POINTER_TYPE
5709 && TREE_TYPE (new_type
) == NULL_TREE
) ?
5710 IDENTIFIER_POINTER (TYPE_NAME (new_type
)) :
5711 lang_printable_name (new_type
, 1)));
5712 /* The type may not have been completed by the time we report
5714 char *t2
= strdup (purify_type_name
5715 ((TREE_CODE (TREE_TYPE (decl
)) == POINTER_TYPE
5716 && TREE_TYPE (TREE_TYPE (decl
)) == NULL_TREE
) ?
5717 IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl
))) :
5718 lang_printable_name (TREE_TYPE (decl
), 1)));
5720 (cl
, "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
5721 t1
, IDENTIFIER_POINTER (new_field_name
),
5722 t2
, IDENTIFIER_POINTER (DECL_NAME (decl
)),
5723 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
5731 /* Field registration routine. If TYPE doesn't exist, field
5732 declarations are linked to the undefined TYPE dependency list, to
5733 be later resolved in java_complete_class () */
5736 register_fields (flags
, type
, variable_list
)
5738 tree type
, variable_list
;
5740 tree current
, saved_type
;
5741 tree class_type
= TREE_TYPE (ctxp
->current_parsed_class
);
5742 int saved_lineno
= lineno
;
5744 tree wfl
= NULL_TREE
;
5746 /* If we're adding fields to interfaces, those fields are public,
5748 if (CLASS_INTERFACE (TYPE_NAME (class_type
)))
5750 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK
),
5752 "%s", "interface field(s)");
5753 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK
),
5755 "%s", "interface field(s)");
5756 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK
),
5757 flags
, ACC_FINAL
, "%s", "interface field(s)");
5758 check_modifiers ("Illegal interface member modifier `%s'", flags
,
5759 INTERFACE_FIELD_MODIFIERS
);
5760 flags
|= (ACC_PUBLIC
| ACC_STATIC
| ACC_FINAL
);
5763 /* Obtain a suitable type for resolution, if necessary */
5764 SET_TYPE_FOR_RESOLUTION (type
, wfl
, must_chain
);
5766 /* If TYPE is fully resolved and we don't have a reference, make one */
5767 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
5769 for (current
= variable_list
, saved_type
= type
; current
;
5770 current
= TREE_CHAIN (current
), type
= saved_type
)
5774 tree cl
= TREE_PURPOSE (current
);
5775 tree init
= TREE_VALUE (current
);
5776 tree current_name
= EXPR_WFL_NODE (cl
);
5778 /* Process NAME, as it may specify extra dimension(s) for it */
5779 type
= build_array_from_name (type
, wfl
, current_name
, ¤t_name
);
5781 /* Type adjustment. We may have just readjusted TYPE because
5782 the variable specified more dimensions. Make sure we have
5783 a reference if we can and don't have one already. Also
5784 change the name if we have an init. */
5785 if (type
!= saved_type
)
5787 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
5789 EXPR_WFL_NODE (TREE_OPERAND (init
, 0)) = current_name
;
5792 real_type
= GET_REAL_TYPE (type
);
5793 /* Check for redeclarations */
5794 if (duplicate_declaration_error_p (current_name
, real_type
, cl
))
5797 /* Set lineno to the line the field was found and create a
5798 declaration for it. Eventually sets the @deprecated tag flag. */
5800 lineno
= EXPR_WFL_LINECOL (cl
);
5802 lineno
= EXPR_WFL_LINENO (cl
);
5803 field_decl
= add_field (class_type
, current_name
, real_type
, flags
);
5804 CHECK_DEPRECATED (field_decl
);
5806 /* Check if we must chain. */
5808 register_incomplete_type (JDEP_FIELD
, wfl
, field_decl
, type
);
5810 /* If we have an initialization value tied to the field */
5813 /* The field is declared static */
5814 if (flags
& ACC_STATIC
)
5816 /* We include the field and its initialization part into
5817 a list used to generate <clinit>. After <clinit> is
5818 walked, field initializations will be processed and
5819 fields initialized with known constants will be taken
5820 out of <clinit> and have their DECL_INITIAL set
5822 TREE_CHAIN (init
) = ctxp
->static_initialized
;
5823 ctxp
->static_initialized
= init
;
5824 if (TREE_OPERAND (init
, 1)
5825 && TREE_CODE (TREE_OPERAND (init
, 1)) == NEW_ARRAY_INIT
)
5826 TREE_STATIC (TREE_OPERAND (init
, 1)) = 1;
5828 /* A non-static field declared with an immediate initialization is
5829 to be initialized in <init>, if any. This field is remembered
5830 to be processed at the time of the generation of <init>. */
5833 TREE_CHAIN (init
) = ctxp
->non_static_initialized
;
5834 ctxp
->non_static_initialized
= init
;
5836 MODIFY_EXPR_FROM_INITIALIZATION_P (init
) = 1;
5837 DECL_INITIAL (field_decl
) = TREE_OPERAND (init
, 1);
5840 lineno
= saved_lineno
;
5843 /* Generate the method $finit$ that initializes fields initialized
5844 upon declaration. */
5847 maybe_generate_finit ()
5849 tree mdecl
, current
;
5851 if (!ctxp
->non_static_initialized
|| java_error_count
)
5854 mdecl
= create_artificial_method (TREE_TYPE (ctxp
->current_parsed_class
),
5855 ACC_PRIVATE
, void_type_node
,
5856 finit_identifier_node
, end_params_node
);
5857 start_artificial_method_body (mdecl
);
5859 ctxp
->non_static_initialized
= nreverse (ctxp
->non_static_initialized
);
5860 for (current
= ctxp
->non_static_initialized
; current
;
5861 current
= TREE_CHAIN (current
))
5862 java_method_add_stmt (mdecl
,
5863 build_debugable_stmt (EXPR_WFL_LINECOL (current
),
5866 end_artificial_method_body (mdecl
);
5867 CLASS_HAS_FINIT_P (TREE_TYPE (ctxp
->current_parsed_class
)) = 1;
5868 ctxp
->non_static_initialized
= NULL_TREE
;
5871 /* Check whether it is necessary to generate a <clinit> for the class
5875 maybe_generate_clinit ()
5879 if (!ctxp
->static_initialized
|| java_error_count
)
5882 mdecl
= create_artificial_method (TREE_TYPE (ctxp
->current_parsed_class
),
5883 ACC_STATIC
, void_type_node
,
5884 clinit_identifier_node
, end_params_node
);
5885 start_artificial_method_body (mdecl
);
5887 /* Keep initialization in order to enforce 8.5 */
5888 ctxp
->static_initialized
= nreverse (ctxp
->static_initialized
);
5890 /* We process the list of assignment we produced as the result of
5891 the declaration of initialized static field and add them as
5892 statement to the <clinit> method. */
5893 for (c
= ctxp
->static_initialized
; c
; c
= TREE_CHAIN (c
))
5895 /* We build the assignment expression that will initialize the
5896 field to its value. There are strict rules on static
5897 initializers (8.5). FIXME */
5898 java_method_add_stmt (mdecl
,
5899 build_debugable_stmt (EXPR_WFL_LINECOL (c
), c
));
5902 end_artificial_method_body (mdecl
);
5903 ctxp
->static_initialized
= NULL_TREE
;
5906 /* Shared accros method_declarator and method_header to remember the
5907 patch stage that was reached during the declaration of the method.
5908 A method DECL is built differently is there is no patch
5909 (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
5910 pending on the currently defined method. */
5912 static int patch_stage
;
5914 /* Check the method declaration and add the method to its current
5915 class. If the argument list is known to contain incomplete types,
5916 the method is partially added and the registration will be resume
5917 once the method arguments resolved. If TYPE is NULL, we're dealing
5918 with a constructor. */
5921 method_header (flags
, type
, mdecl
, throws
)
5923 tree type
, mdecl
, throws
;
5925 tree meth
= TREE_VALUE (mdecl
);
5926 tree id
= TREE_PURPOSE (mdecl
);
5927 tree type_wfl
= NULL_TREE
;
5928 tree meth_name
= NULL_TREE
;
5929 tree current
, orig_arg
, this_class
;
5931 int constructor_ok
= 0, must_chain
;
5933 check_modifiers_consistency (flags
);
5935 if (ctxp
->current_parsed_class
)
5936 this_class
= TREE_TYPE (ctxp
->current_parsed_class
);
5940 /* There are some forbidden modifiers for an abstract method and its
5941 class must be abstract as well. */
5942 if (type
&& (flags
& ACC_ABSTRACT
))
5944 ABSTRACT_CHECK (flags
, ACC_PRIVATE
, id
, "Private");
5945 ABSTRACT_CHECK (flags
, ACC_STATIC
, id
, "Static");
5946 ABSTRACT_CHECK (flags
, ACC_FINAL
, id
, "Final");
5947 ABSTRACT_CHECK (flags
, ACC_NATIVE
, id
, "Native");
5948 ABSTRACT_CHECK (flags
, ACC_SYNCHRONIZED
,id
, "Synchronized");
5949 if (!CLASS_ABSTRACT (TYPE_NAME (this_class
))
5950 && !CLASS_INTERFACE (TYPE_NAME (this_class
)))
5952 (id
, "Class `%s' must be declared abstract to define abstract "
5954 IDENTIFIER_POINTER (DECL_NAME (ctxp
->current_parsed_class
)),
5955 IDENTIFIER_POINTER (EXPR_WFL_NODE (id
)));
5957 /* Things to be checked when declaring a constructor */
5960 int ec
= java_error_count
;
5961 /* 8.6: Constructor declarations: we might be trying to define a
5962 method without specifying a return type. */
5963 if (EXPR_WFL_NODE (id
) != ctxp
->current_parsed_class_un
)
5965 (id
, "Invalid method declaration, return type required");
5966 /* 8.6.3: Constructor modifiers */
5969 JCONSTRUCTOR_CHECK (flags
, ACC_ABSTRACT
, id
, "abstract");
5970 JCONSTRUCTOR_CHECK (flags
, ACC_STATIC
, id
, "static");
5971 JCONSTRUCTOR_CHECK (flags
, ACC_FINAL
, id
, "final");
5972 JCONSTRUCTOR_CHECK (flags
, ACC_NATIVE
, id
, "native");
5973 JCONSTRUCTOR_CHECK (flags
, ACC_SYNCHRONIZED
, id
, "synchronized");
5975 /* If we found error here, we don't consider it's OK to tread
5976 the method definition as a constructor, for the rest of this
5978 if (ec
== java_error_count
)
5982 /* Method declared within the scope of an interface are implicitly
5983 abstract and public. Conflicts with other erroneously provided
5984 modifiers are checked right after. */
5986 if (CLASS_INTERFACE (TYPE_NAME (this_class
)))
5988 /* If FLAGS isn't set because of a modifier, turn the
5989 corresponding modifier WFL to NULL so we issue a warning on
5990 the obsolete use of the modifier */
5991 if (!(flags
& ACC_PUBLIC
))
5992 MODIFIER_WFL (PUBLIC_TK
) = NULL
;
5993 if (!(flags
& ACC_ABSTRACT
))
5994 MODIFIER_WFL (ABSTRACT_TK
) = NULL
;
5995 flags
|= ACC_PUBLIC
;
5996 flags
|= ACC_ABSTRACT
;
5999 /* Modifiers context reset moved up, so abstract method declaration
6000 modifiers can be later checked. */
6002 /* Set constructor returned type to void and method name to <init>,
6003 unless we found an error identifier the constructor (in which
6004 case we retain the original name) */
6007 type
= void_type_node
;
6009 meth_name
= init_identifier_node
;
6012 meth_name
= EXPR_WFL_NODE (id
);
6014 /* Do the returned type resolution and registration if necessary */
6015 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
6018 type
= build_array_from_name (type
, type_wfl
, meth_name
, &meth_name
);
6019 EXPR_WFL_NODE (id
) = meth_name
;
6020 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
6024 patch_stage
= JDEP_METHOD_RETURN
;
6025 register_incomplete_type (patch_stage
, type_wfl
, id
, type
);
6026 TREE_TYPE (meth
) = GET_REAL_TYPE (type
);
6029 TREE_TYPE (meth
) = type
;
6031 saved_lineno
= lineno
;
6032 /* When defining an abstract or interface method, the curly
6033 bracket at level 1 doesn't exist because there is no function
6035 lineno
= (ctxp
->first_ccb_indent1
? ctxp
->first_ccb_indent1
:
6036 EXPR_WFL_LINENO (id
));
6038 /* Remember the original argument list */
6039 orig_arg
= TYPE_ARG_TYPES (meth
);
6041 if (patch_stage
) /* includes ret type and/or all args */
6044 meth
= add_method_1 (this_class
, flags
, meth_name
, meth
);
6045 /* Patch for the return type */
6046 if (patch_stage
== JDEP_METHOD_RETURN
)
6048 jdep
= CLASSD_LAST (ctxp
->classd_list
);
6049 JDEP_GET_PATCH (jdep
) = &TREE_TYPE (TREE_TYPE (meth
));
6051 /* This is the stop JDEP. METH allows the function's signature
6053 register_incomplete_type (JDEP_METHOD_END
, NULL_TREE
, meth
, NULL_TREE
);
6056 meth
= add_method (this_class
, flags
, meth_name
,
6057 build_java_signature (meth
));
6059 /* Fix the method argument list so we have the argument name
6061 fix_method_argument_names (orig_arg
, meth
);
6063 /* Register the parameter number and re-install the current line
6065 DECL_MAX_LOCALS (meth
) = ctxp
->formal_parameter_number
+1;
6066 lineno
= saved_lineno
;
6068 /* Register exception specified by the `throws' keyword for
6069 resolution and set the method decl appropriate field to the list.
6070 Note: the grammar ensures that what we get here are class
6074 throws
= nreverse (throws
);
6075 for (current
= throws
; current
; current
= TREE_CHAIN (current
))
6077 register_incomplete_type (JDEP_EXCEPTION
, TREE_VALUE (current
),
6078 NULL_TREE
, NULL_TREE
);
6079 JDEP_GET_PATCH (CLASSD_LAST (ctxp
->classd_list
)) =
6080 &TREE_VALUE (current
);
6082 DECL_FUNCTION_THROWS (meth
) = throws
;
6085 /* We set the DECL_NAME to ID so we can track the location where
6086 the function was declared. This allow us to report
6087 redefinition error accurately. When method are verified,
6088 DECL_NAME is reinstalled properly (using the content of the
6089 WFL node ID) (see check_method_redefinition). We don't do that
6090 when Object is being defined. Constructor <init> names will be
6091 reinstalled the same way. */
6092 if (TREE_TYPE (ctxp
->current_parsed_class
) != object_type_node
)
6093 DECL_NAME (meth
) = id
;
6095 /* Set the flag if we correctly processed a constructor */
6097 DECL_CONSTRUCTOR_P (meth
) = 1;
6099 /* Eventually set the @deprecated tag flag */
6100 CHECK_DEPRECATED (meth
);
6102 /* If doing xref, store column and line number information instead
6103 of the line number only. */
6105 DECL_SOURCE_LINE (meth
) = EXPR_WFL_LINECOL (id
);
6111 fix_method_argument_names (orig_arg
, meth
)
6112 tree orig_arg
, meth
;
6114 tree arg
= TYPE_ARG_TYPES (TREE_TYPE (meth
));
6115 if (TREE_CODE (TREE_TYPE (meth
)) == METHOD_TYPE
)
6117 TREE_PURPOSE (arg
) = this_identifier_node
;
6118 arg
= TREE_CHAIN (arg
);
6120 while (orig_arg
!= end_params_node
)
6122 TREE_PURPOSE (arg
) = TREE_PURPOSE (orig_arg
);
6123 orig_arg
= TREE_CHAIN (orig_arg
);
6124 arg
= TREE_CHAIN (arg
);
6128 /* Complete the method declaration with METHOD_BODY. */
6131 finish_method_declaration (method_body
)
6136 if (!current_function_decl
)
6139 flags
= get_access_flags_from_decl (current_function_decl
);
6141 /* 8.4.5 Method Body */
6142 if ((flags
& ACC_ABSTRACT
|| flags
& ACC_NATIVE
) && method_body
)
6144 tree wfl
= DECL_NAME (current_function_decl
);
6145 parse_error_context (wfl
,
6146 "%s method `%s' can't have a body defined",
6147 (METHOD_NATIVE (current_function_decl
) ?
6148 "Native" : "Abstract"),
6149 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
6150 method_body
= NULL_TREE
;
6152 else if (!(flags
& ACC_ABSTRACT
) && !(flags
& ACC_NATIVE
) && !method_body
)
6154 tree wfl
= DECL_NAME (current_function_decl
);
6155 parse_error_context (wfl
,
6156 "Non native and non abstract method `%s' must "
6157 "have a body defined",
6158 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
6159 method_body
= NULL_TREE
;
6162 if (flag_emit_class_files
&& method_body
6163 && TREE_CODE (method_body
) == NOP_EXPR
6164 && TREE_TYPE (current_function_decl
)
6165 && TREE_TYPE (TREE_TYPE (current_function_decl
)) == void_type_node
)
6166 method_body
= build1 (RETURN_EXPR
, void_type_node
, NULL
);
6168 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl
)) = method_body
;
6169 maybe_absorb_scoping_blocks ();
6170 /* Exit function's body */
6172 /* Merge last line of the function with first line, directly in the
6173 function decl. It will be used to emit correct debug info. */
6174 if (!flag_emit_xref
)
6175 DECL_SOURCE_LINE_MERGE (current_function_decl
, ctxp
->last_ccb_indent1
);
6176 /* So we don't have an irrelevant function declaration context for
6177 the next static block we'll see. */
6178 current_function_decl
= NULL_TREE
;
6181 /* Build a an error message for constructor circularity errors. */
6184 constructor_circularity_msg (from
, to
)
6187 static char string
[4096];
6188 char *t
= strdup (lang_printable_name (from
, 0));
6189 sprintf (string
, "`%s' invokes `%s'", t
, lang_printable_name (to
, 0));
6194 /* Verify a circular call to METH. Return 1 if an error is found, 0
6198 verify_constructor_circularity (meth
, current
)
6201 static tree list
= NULL_TREE
;
6203 for (c
= DECL_CONSTRUCTOR_CALLS (current
); c
; c
= TREE_CHAIN (c
))
6205 if (TREE_VALUE (c
) == meth
)
6211 list
= nreverse (list
);
6212 for (liste
= list
; liste
; liste
= TREE_CHAIN (liste
))
6215 (TREE_PURPOSE (TREE_PURPOSE (liste
)),
6216 constructor_circularity_msg
6217 (TREE_VALUE (liste
), TREE_VALUE (TREE_PURPOSE (liste
))));
6221 t
= strdup (lang_printable_name (meth
, 0));
6222 parse_error_context (TREE_PURPOSE (c
),
6223 "%s: recursive invocation of constructor `%s'",
6224 constructor_circularity_msg (current
, meth
), t
);
6230 for (c
= DECL_CONSTRUCTOR_CALLS (current
); c
; c
= TREE_CHAIN (c
))
6232 list
= tree_cons (c
, current
, list
);
6233 if (verify_constructor_circularity (meth
, TREE_VALUE (c
)))
6235 list
= TREE_CHAIN (list
);
6240 /* Check modifiers that can be declared but exclusively */
6243 check_modifiers_consistency (flags
)
6247 tree cl
= NULL_TREE
;
6249 THIS_MODIFIER_ONLY (flags
, ACC_PUBLIC
, 0, acc_count
, cl
);
6250 THIS_MODIFIER_ONLY (flags
, ACC_PRIVATE
, 1, acc_count
, cl
);
6251 THIS_MODIFIER_ONLY (flags
, ACC_PROTECTED
, 2, acc_count
, cl
);
6254 (cl
, "Inconsistent member declaration. At most one of `public', "
6255 "`private', or `protected' may be specified");
6258 /* Check the methode header METH for abstract specifics features */
6261 check_abstract_method_header (meth
)
6264 int flags
= get_access_flags_from_decl (meth
);
6265 /* DECL_NAME might still be a WFL node */
6266 tree name
= GET_METHOD_NAME (meth
);
6268 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK
), flags
,
6269 ACC_ABSTRACT
, "abstract method `%s'",
6270 IDENTIFIER_POINTER (name
));
6271 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK
), flags
,
6272 ACC_PUBLIC
, "abstract method `%s'",
6273 IDENTIFIER_POINTER (name
));
6275 check_modifiers ("Illegal modifier `%s' for interface method",
6276 flags
, INTERFACE_METHOD_MODIFIERS
);
6279 /* Create a FUNCTION_TYPE node and start augmenting it with the
6280 declared function arguments. Arguments type that can't be resolved
6281 are left as they are, but the returned node is marked as containing
6282 incomplete types. */
6285 method_declarator (id
, list
)
6288 tree arg_types
= NULL_TREE
, current
, node
;
6289 tree meth
= make_node (FUNCTION_TYPE
);
6292 patch_stage
= JDEP_NO_PATCH
;
6294 for (current
= list
; current
; current
= TREE_CHAIN (current
))
6297 tree wfl_name
= TREE_PURPOSE (current
);
6298 tree type
= TREE_VALUE (current
);
6299 tree name
= EXPR_WFL_NODE (wfl_name
);
6300 tree already
, arg_node
;
6301 tree type_wfl
= NULL_TREE
;
6304 /* Obtain a suitable type for resolution, if necessary */
6305 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
6307 /* Process NAME, as it may specify extra dimension(s) for it */
6308 type
= build_array_from_name (type
, type_wfl
, name
, &name
);
6309 EXPR_WFL_NODE (wfl_name
) = name
;
6311 real_type
= GET_REAL_TYPE (type
);
6312 if (TREE_CODE (real_type
) == RECORD_TYPE
)
6314 real_type
= promote_type (real_type
);
6315 if (TREE_CODE (type
) == TREE_LIST
)
6316 TREE_PURPOSE (type
) = real_type
;
6319 /* Check redefinition */
6320 for (already
= arg_types
; already
; already
= TREE_CHAIN (already
))
6321 if (TREE_PURPOSE (already
) == name
)
6324 (wfl_name
, "Variable `%s' is used more than once in the "
6325 "argument list of method `%s'", IDENTIFIER_POINTER (name
),
6326 IDENTIFIER_POINTER (EXPR_WFL_NODE (id
)));
6330 /* If we've an incomplete argument type, we know there is a location
6331 to patch when the type get resolved, later. */
6335 patch_stage
= JDEP_METHOD
;
6336 type
= register_incomplete_type (patch_stage
,
6337 type_wfl
, wfl_name
, type
);
6338 jdep
= CLASSD_LAST (ctxp
->classd_list
);
6339 JDEP_MISC (jdep
) = id
;
6342 /* The argument node: a name and a (possibly) incomplete type */
6343 arg_node
= build_tree_list (name
, real_type
);
6345 JDEP_GET_PATCH (jdep
) = &TREE_VALUE (arg_node
);
6346 TREE_CHAIN (arg_node
) = arg_types
;
6347 arg_types
= arg_node
;
6349 TYPE_ARG_TYPES (meth
) = chainon (nreverse (arg_types
), end_params_node
);
6350 node
= build_tree_list (id
, meth
);
6355 unresolved_type_p (wfl
, returned
)
6360 if (TREE_CODE (wfl
) == EXPR_WITH_FILE_LOCATION
)
6362 tree decl
= IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl
));
6364 *returned
= (decl
? TREE_TYPE (decl
) : NULL_TREE
);
6372 /* From NAME, build a qualified identifier node using the
6373 qualification from the current package definition. */
6376 parser_qualified_classname (name
)
6380 return merge_qualified_name (ctxp
->package
, EXPR_WFL_NODE (name
));
6382 return EXPR_WFL_NODE (name
);
6385 /* Called once the type a interface extends is resolved. Returns 0 if
6386 everything is OK. */
6389 parser_check_super_interface (super_decl
, this_decl
, this_wfl
)
6390 tree super_decl
, this_decl
, this_wfl
;
6392 tree super_type
= TREE_TYPE (super_decl
);
6394 /* Has to be an interface */
6395 if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl
))))
6398 (this_wfl
, "Can't use %s `%s' to implement/extend %s `%s'",
6399 (TYPE_ARRAY_P (super_type
) ? "array" : "class"),
6400 IDENTIFIER_POINTER (DECL_NAME (super_decl
)),
6401 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl
))) ?
6402 "interface" : "class"),
6403 IDENTIFIER_POINTER (DECL_NAME (this_decl
)));
6407 /* Check scope: same package OK, other package: OK if public */
6408 if (check_pkg_class_access (DECL_NAME (super_decl
), lookup_cl (this_decl
)))
6411 SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
6412 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6413 IDENTIFIER_POINTER (DECL_NAME (super_decl
))));
6417 /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
6418 0 if everthing is OK. */
6421 parser_check_super (super_decl
, this_decl
, wfl
)
6422 tree super_decl
, this_decl
, wfl
;
6424 tree super_type
= TREE_TYPE (super_decl
);
6426 /* SUPER should be a CLASS (neither an array nor an interface) */
6427 if (TYPE_ARRAY_P (super_type
) || CLASS_INTERFACE (TYPE_NAME (super_type
)))
6430 (wfl
, "Class `%s' can't subclass %s `%s'",
6431 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6432 (CLASS_INTERFACE (TYPE_NAME (super_type
)) ? "interface" : "array"),
6433 IDENTIFIER_POINTER (DECL_NAME (super_decl
)));
6437 if (CLASS_FINAL (TYPE_NAME (super_type
)))
6439 parse_error_context (wfl
, "Can't subclass final classes: %s",
6440 IDENTIFIER_POINTER (DECL_NAME (super_decl
)));
6444 /* Check scope: same package OK, other package: OK if public */
6445 if (check_pkg_class_access (DECL_NAME (super_decl
), wfl
))
6448 SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
6449 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6450 IDENTIFIER_POINTER (DECL_NAME (super_decl
))));
6454 /* Create a new dependency list and link it (in a LIFO manner) to the
6455 CTXP list of type dependency list. */
6458 create_jdep_list (ctxp
)
6459 struct parser_ctxt
*ctxp
;
6461 jdeplist
*new = (jdeplist
*)xmalloc (sizeof (jdeplist
));
6462 new->first
= new->last
= NULL
;
6463 new->next
= ctxp
->classd_list
;
6464 ctxp
->classd_list
= new;
6468 reverse_jdep_list (ctxp
)
6469 struct parser_ctxt
*ctxp
;
6471 register jdeplist
*prev
= NULL
, *current
, *next
;
6472 for (current
= ctxp
->classd_list
; current
; current
= next
)
6474 next
= current
->next
;
6475 current
->next
= prev
;
6481 /* Create a fake pointer based on the ID stored in
6482 TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
6483 registered again. */
6486 obtain_incomplete_type (type_name
)
6491 if (TREE_CODE (type_name
) == EXPR_WITH_FILE_LOCATION
)
6492 name
= EXPR_WFL_NODE (type_name
);
6493 else if (INCOMPLETE_TYPE_P (type_name
))
6494 name
= TYPE_NAME (type_name
);
6496 fatal ("invalid type name - obtain_incomplete_type");
6498 for (ptr
= ctxp
->incomplete_class
; ptr
; ptr
= TREE_CHAIN (ptr
))
6499 if (TYPE_NAME (ptr
) == name
)
6504 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6505 BUILD_PTR_FROM_NAME (ptr
, name
);
6508 TREE_CHAIN (ptr
) = ctxp
->incomplete_class
;
6509 ctxp
->incomplete_class
= ptr
;
6515 /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
6516 non NULL instead of computing a new fake type based on WFL. The new
6517 dependency is inserted in the current type dependency list, in FIFO
6521 register_incomplete_type (kind
, wfl
, decl
, ptr
)
6523 tree wfl
, decl
, ptr
;
6525 jdep
*new = (jdep
*)xmalloc (sizeof (jdep
));
6527 if (!ptr
&& kind
!= JDEP_METHOD_END
) /* JDEP_METHOD_END is a mere marker */
6528 ptr
= obtain_incomplete_type (wfl
);
6530 JDEP_KIND (new) = kind
;
6531 JDEP_DECL (new) = decl
;
6532 JDEP_SOLV (new) = ptr
;
6533 JDEP_WFL (new) = wfl
;
6534 JDEP_CHAIN (new) = NULL
;
6535 JDEP_MISC (new) = NULL_TREE
;
6536 JDEP_GET_PATCH (new) = (tree
*)NULL
;
6538 JDEP_INSERT (ctxp
->classd_list
, new);
6544 java_check_circular_reference ()
6547 for (current
= ctxp
->class_list
; current
; current
= TREE_CHAIN (current
))
6549 tree type
= TREE_TYPE (current
);
6550 if (CLASS_INTERFACE (TYPE_NAME (type
)))
6552 /* Check all interfaces this class extends */
6553 tree basetype_vec
= TYPE_BINFO_BASETYPES (type
);
6558 n
= TREE_VEC_LENGTH (basetype_vec
);
6559 for (i
= 0; i
< n
; i
++)
6561 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
);
6562 if (vec_elt
&& BINFO_TYPE (vec_elt
) != object_type_node
6563 && interface_of_p (type
, BINFO_TYPE (vec_elt
)))
6564 parse_error_context (lookup_cl (current
),
6565 "Cyclic interface inheritance");
6569 if (inherits_from_p (CLASSTYPE_SUPER (type
), type
))
6570 parse_error_context (lookup_cl (current
),
6571 "Cyclic class inheritance");
6575 /* safe_layout_class just makes sure that we can load a class without
6576 disrupting the current_class, input_file, lineno, etc, information
6577 about the class processed currently. */
6580 safe_layout_class (class)
6583 tree save_current_class
= current_class
;
6584 char *save_input_filename
= input_filename
;
6585 int save_lineno
= lineno
;
6587 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6589 layout_class (class);
6592 current_class
= save_current_class
;
6593 input_filename
= save_input_filename
;
6594 lineno
= save_lineno
;
6595 CLASS_LOADED_P (class) = 1;
6599 jdep_resolve_class (dep
)
6604 if (JDEP_RESOLVED_P (dep
))
6605 decl
= JDEP_RESOLVED_DECL (dep
);
6608 decl
= resolve_class (JDEP_TO_RESOLVE (dep
),
6609 JDEP_DECL (dep
), JDEP_WFL (dep
));
6610 JDEP_RESOLVED (dep
, decl
);
6614 complete_class_report_errors (dep
);
6619 /* Complete unsatisfied class declaration and their dependencies */
6622 java_complete_class ()
6629 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6631 /* Process imports and reverse the import on demand list */
6633 if (ctxp
->import_demand_list
)
6634 ctxp
->import_demand_list
= nreverse (ctxp
->import_demand_list
);
6636 /* Rever things so we have the right order */
6637 ctxp
->class_list
= nreverse (ctxp
->class_list
);
6638 ctxp
->classd_list
= reverse_jdep_list (ctxp
);
6640 for (cclassd
= ctxp
->classd_list
, cclass
= ctxp
->class_list
;
6642 cclass
= TREE_CHAIN (cclass
), cclassd
= CLASSD_CHAIN (cclassd
))
6645 for (dep
= CLASSD_FIRST (cclassd
); dep
; dep
= JDEP_CHAIN (dep
))
6648 if (!(decl
= jdep_resolve_class (dep
)))
6651 /* Now it's time to patch */
6652 switch (JDEP_KIND (dep
))
6655 /* Simply patch super */
6656 if (parser_check_super (decl
, JDEP_DECL (dep
), JDEP_WFL (dep
)))
6658 BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
6659 (TREE_TYPE (JDEP_DECL (dep
)))), 0)) = TREE_TYPE (decl
);
6664 /* We do part of the job done in add_field */
6665 tree field_decl
= JDEP_DECL (dep
);
6666 tree field_type
= TREE_TYPE (decl
);
6667 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6668 if (TREE_CODE (field_type
) == RECORD_TYPE
)
6669 field_type
= promote_type (field_type
);
6671 TREE_TYPE (field_decl
) = field_type
;
6672 DECL_ALIGN (field_decl
) = 0;
6673 layout_decl (field_decl
, 0);
6674 SOURCE_FRONTEND_DEBUG
6675 (("Completed field/var decl `%s' with `%s'",
6676 IDENTIFIER_POINTER (DECL_NAME (field_decl
)),
6677 IDENTIFIER_POINTER (DECL_NAME (decl
))));
6680 case JDEP_METHOD
: /* We start patching a method */
6681 case JDEP_METHOD_RETURN
:
6687 type
= TREE_TYPE(decl
);
6688 if (TREE_CODE (type
) == RECORD_TYPE
)
6689 type
= promote_type (type
);
6690 JDEP_APPLY_PATCH (dep
, type
);
6691 SOURCE_FRONTEND_DEBUG
6692 (((JDEP_KIND (dep
) == JDEP_METHOD_RETURN
?
6693 "Completing fct `%s' with ret type `%s'":
6694 "Completing arg `%s' with type `%s'"),
6695 IDENTIFIER_POINTER (EXPR_WFL_NODE
6696 (JDEP_DECL_WFL (dep
))),
6697 IDENTIFIER_POINTER (DECL_NAME (decl
))));
6701 dep
= JDEP_CHAIN (dep
);
6702 if (JDEP_KIND (dep
) == JDEP_METHOD_END
)
6705 decl
= jdep_resolve_class (dep
);
6709 tree mdecl
= JDEP_DECL (dep
), signature
;
6710 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6711 /* Recompute and reset the signature */
6712 signature
= build_java_signature (TREE_TYPE (mdecl
));
6713 set_java_signature (TREE_TYPE (mdecl
), signature
);
6720 case JDEP_INTERFACE
:
6721 if (parser_check_super_interface (decl
, JDEP_DECL (dep
),
6724 parser_add_interface (JDEP_DECL (dep
), decl
, JDEP_WFL (dep
));
6729 type
= TREE_TYPE(decl
);
6730 if (TREE_CODE (type
) == RECORD_TYPE
)
6731 type
= promote_type (type
);
6732 JDEP_APPLY_PATCH (dep
, type
);
6736 JDEP_APPLY_PATCH (dep
, TREE_TYPE (decl
));
6737 SOURCE_FRONTEND_DEBUG
6738 (("Completing a random type dependency on a '%s' node",
6739 tree_code_name
[TREE_CODE (JDEP_DECL (dep
))]));
6742 case JDEP_EXCEPTION
:
6743 JDEP_APPLY_PATCH (dep
, TREE_TYPE (decl
));
6744 SOURCE_FRONTEND_DEBUG
6745 (("Completing `%s' `throws' argument node",
6746 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
)))));
6750 fatal ("Can't handle patch code %d - java_complete_class",
6759 /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
6763 resolve_class (class_type
, decl
, cl
)
6764 tree class_type
, decl
, cl
;
6766 const char *name
= IDENTIFIER_POINTER (TYPE_NAME (class_type
));
6767 const char *base
= name
;
6768 tree resolved_type
= TREE_TYPE (class_type
);
6769 tree resolved_type_decl
;
6771 if (resolved_type
!= NULL_TREE
)
6773 tree resolved_type_decl
= TYPE_NAME (resolved_type
);
6774 if (resolved_type_decl
== NULL_TREE
6775 || TREE_CODE (resolved_type_decl
) == IDENTIFIER_NODE
)
6777 resolved_type_decl
= build_decl (TYPE_DECL
,
6778 TYPE_NAME (class_type
),
6781 return resolved_type_decl
;
6784 /* 1- Check to see if we have an array. If true, find what we really
6786 while (name
[0] == '[')
6789 TYPE_NAME (class_type
) = get_identifier (name
);
6791 /* 2- Resolve the bare type */
6792 if (!(resolved_type_decl
= do_resolve_class (class_type
, decl
, cl
)))
6794 resolved_type
= TREE_TYPE (resolved_type_decl
);
6796 /* 3- If we have and array, reconstruct the array down to its nesting */
6799 while (base
!= name
)
6801 if (TREE_CODE (resolved_type
) == RECORD_TYPE
)
6802 resolved_type
= promote_type (resolved_type
);
6803 resolved_type
= build_java_array_type (resolved_type
, -1);
6804 CLASS_LOADED_P (resolved_type
) = 1;
6807 /* Build a fake decl for this, since this is what is expected to
6809 resolved_type_decl
=
6810 build_decl (TYPE_DECL
, TYPE_NAME (resolved_type
), resolved_type
);
6811 /* Figure how those two things are important for error report. FIXME */
6812 DECL_SOURCE_LINE (resolved_type_decl
) = 0;
6813 DECL_SOURCE_FILE (resolved_type_decl
) = input_filename
;
6814 TYPE_NAME (class_type
) = TYPE_NAME (resolved_type
);
6816 TREE_TYPE (class_type
) = resolved_type
;
6817 return resolved_type_decl
;
6820 /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
6821 are used to report error messages. */
6824 do_resolve_class (class_type
, decl
, cl
)
6829 tree new_class_decl
;
6830 tree original_name
= NULL_TREE
;
6832 /* Do not try to replace TYPE_NAME (class_type) by a variable, since
6833 its is changed by find_in_imports{_on_demand} */
6835 /* 1- Check for the type in single imports */
6836 if (find_in_imports (class_type
))
6839 /* 2- And check for the type in the current compilation unit. If it fails,
6840 try with a name qualified with the package name if appropriate. */
6841 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6843 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6844 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6845 load_class (TYPE_NAME (class_type
), 0);
6846 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6849 original_name
= TYPE_NAME (class_type
);
6850 if (!QUALIFIED_P (TYPE_NAME (class_type
)) && ctxp
->package
)
6851 TYPE_NAME (class_type
) = merge_qualified_name (ctxp
->package
,
6852 TYPE_NAME (class_type
));
6854 if (!(new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6855 load_class (TYPE_NAME (class_type
), 0);
6856 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6858 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6859 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6860 load_class (TYPE_NAME (class_type
), 0);
6861 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6864 new_name
= TYPE_NAME (class_type
);
6865 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (new_name
)) != NULL_TREE
)
6867 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6868 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6869 load_class (new_name
, 0);
6870 return IDENTIFIER_CLASS_VALUE (new_name
);
6874 tree
class = read_class (new_name
);
6875 if (class != NULL_TREE
)
6877 tree decl
= IDENTIFIER_CLASS_VALUE (new_name
);
6878 if (decl
== NULL_TREE
)
6879 decl
= push_class (class, new_name
);
6884 TYPE_NAME (class_type
) = original_name
;
6886 /* 3- Check an other compilation unit that bears the name of type */
6887 load_class (TYPE_NAME (class_type
), 0);
6888 if (check_pkg_class_access (TYPE_NAME (class_type
),
6889 (cl
? cl
: lookup_cl (decl
))))
6892 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6893 return new_class_decl
;
6895 /* 4- Check the import on demands. Don't allow bar.baz to be
6896 imported from foo.* */
6897 if (!QUALIFIED_P (TYPE_NAME (class_type
)))
6898 if (find_in_imports_on_demand (class_type
))
6901 /* 5- Last call for a resolution */
6902 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6905 /* Resolve NAME and lay it out (if not done and if not the current
6906 parsed class). Return a decl node. This function is meant to be
6907 called when type resolution is necessary during the walk pass. */
6910 resolve_and_layout (something
, cl
)
6916 /* Don't do that on the current class */
6917 if (something
== current_class
)
6918 return TYPE_NAME (current_class
);
6920 /* Don't do anything for void and other primitive types */
6921 if (JPRIMITIVE_TYPE_P (something
) || something
== void_type_node
)
6924 /* Pointer types can be reall pointer types or fake pointers. When
6925 finding a real pointer, recheck for primitive types */
6926 if (TREE_CODE (something
) == POINTER_TYPE
)
6928 if (TREE_TYPE (something
))
6930 something
= TREE_TYPE (something
);
6931 if (JPRIMITIVE_TYPE_P (something
) || something
== void_type_node
)
6935 something
= TYPE_NAME (something
);
6938 /* Don't do anything for arrays of primitive types */
6939 if (TREE_CODE (something
) == RECORD_TYPE
&& TYPE_ARRAY_P (something
)
6940 && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something
)))
6943 /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
6945 if (TREE_CODE (something
) != IDENTIFIER_NODE
)
6946 something
= (TREE_CODE (TYPE_NAME (something
)) == TYPE_DECL
?
6947 DECL_NAME (TYPE_NAME (something
)) : TYPE_NAME (something
));
6949 if (!(decl
= resolve_no_layout (something
, cl
)))
6952 /* Resolve and layout if necessary */
6953 layout_class_methods (TREE_TYPE (decl
));
6954 /* Check methods, but only once */
6955 if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl
))
6956 && !CLASS_LOADED_P (TREE_TYPE (decl
)))
6957 CHECK_METHODS (decl
);
6958 if (TREE_TYPE (decl
) != current_class
&& !CLASS_LOADED_P (TREE_TYPE (decl
)))
6959 safe_layout_class (TREE_TYPE (decl
));
6964 /* Resolve a class, returns its decl but doesn't perform any
6965 layout. The current parsing context is saved and restored */
6968 resolve_no_layout (name
, cl
)
6972 BUILD_PTR_FROM_NAME (ptr
, name
);
6973 java_parser_context_save_global ();
6974 decl
= resolve_class (ptr
, NULL_TREE
, cl
);
6975 java_parser_context_restore_global ();
6980 /* Called when reporting errors. Skip leader '[' in a complex array
6981 type description that failed to be resolved. */
6984 purify_type_name (name
)
6987 while (*name
&& *name
== '[')
6992 /* The type CURRENT refers to can't be found. We print error messages. */
6995 complete_class_report_errors (dep
)
7000 if (!JDEP_WFL (dep
))
7003 name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
)));
7004 switch (JDEP_KIND (dep
))
7008 (JDEP_WFL (dep
), "Superclass `%s' of class `%s' not found",
7009 purify_type_name (name
),
7010 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7014 (JDEP_WFL (dep
), "Type `%s' not found in declaration of field `%s'",
7015 purify_type_name (name
),
7016 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7018 case JDEP_METHOD
: /* Covers arguments */
7020 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
7021 "argument `%s' of method `%s'",
7022 purify_type_name (name
),
7023 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep
))),
7024 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep
))));
7026 case JDEP_METHOD_RETURN
: /* Covers return type */
7028 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
7029 "return type of method `%s'",
7030 purify_type_name (name
),
7031 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep
))));
7033 case JDEP_INTERFACE
:
7035 (JDEP_WFL (dep
), "Superinterface `%s' of %s `%s' not found",
7036 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
))),
7037 (CLASS_OR_INTERFACE (JDEP_DECL (dep
), "class", "interface")),
7038 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7042 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
7043 "local variable `%s'",
7044 purify_type_name (IDENTIFIER_POINTER
7045 (EXPR_WFL_NODE (JDEP_WFL (dep
)))),
7046 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7048 case JDEP_EXCEPTION
: /* As specified by `throws' */
7050 (JDEP_WFL (dep
), "Class `%s' not found in `throws'",
7051 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
))));
7054 /* Fix for -Wall. Just break doing nothing. The error will be
7060 /* Check uninitialized final. */
7067 /* Return a static string containing the DECL prototype string. If
7068 DECL is a constructor, use the class name instead of the form
7072 get_printable_method_name (decl
)
7075 const char *to_return
;
7076 tree name
= NULL_TREE
;
7078 if (DECL_CONSTRUCTOR_P (decl
))
7080 name
= DECL_NAME (decl
);
7081 DECL_NAME (decl
) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl
)));
7084 to_return
= lang_printable_name (decl
, 0);
7085 if (DECL_CONSTRUCTOR_P (decl
))
7086 DECL_NAME (decl
) = name
;
7091 /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
7092 nevertheless needs to be verfied, 1 otherwise. */
7095 reset_method_name (method
)
7098 if (!IS_CLINIT (method
) && DECL_NAME (method
) != finit_identifier_node
)
7100 /* NAME is just the plain name when Object is being defined */
7101 if (DECL_CONTEXT (method
) != object_type_node
)
7102 DECL_NAME (method
) = (DECL_CONSTRUCTOR_P (method
) ?
7103 init_identifier_node
: GET_METHOD_NAME (method
));
7110 /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
7113 java_get_real_method_name (method_decl
)
7116 tree method_name
= DECL_NAME (method_decl
);
7117 if (DECL_CONSTRUCTOR_P (method_decl
))
7118 return init_identifier_node
;
7120 /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
7121 and still can be a constructor. FIXME */
7123 /* Don't confuse method only bearing the name of their class as
7125 else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl
))
7127 && ctxp
->current_parsed_class_un
== EXPR_WFL_NODE (method_name
)
7128 && get_access_flags_from_decl (method_decl
) <= ACC_PROTECTED
7129 && TREE_TYPE (TREE_TYPE (method_decl
)) == void_type_node
)
7130 return init_identifier_node
;
7132 return EXPR_WFL_NODE (method_name
);
7135 /* Track method being redefined inside the same class. As a side
7136 effect, set DECL_NAME to an IDENTIFIER (prior entering this
7137 function it's a FWL, so we can track errors more accurately.) */
7140 check_method_redefinition (class, method
)
7144 tree cl
= DECL_NAME (method
);
7145 tree sig
= TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method
));
7146 /* decl name of artificial <clinit> and $finit$ doesn't need to be
7147 fixed and checked */
7149 /* Reset the method name before running the check. If it returns 1,
7150 the method doesn't need to be verified with respect to method
7151 redeclaration and we return 0 */
7152 if (reset_method_name (method
))
7155 name
= DECL_NAME (method
);
7156 for (redef
= TYPE_METHODS (class); redef
; redef
= TREE_CHAIN (redef
))
7158 if (redef
== method
)
7160 if (DECL_NAME (redef
) == name
7161 && sig
== TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef
)))
7164 (cl
, "Duplicate %s declaration `%s'",
7165 (DECL_CONSTRUCTOR_P (redef
) ? "constructor" : "method"),
7166 get_printable_method_name (redef
));
7174 check_abstract_method_definitions (do_interface
, class_decl
, type
)
7176 tree class_decl
, type
;
7178 tree
class = TREE_TYPE (class_decl
);
7179 tree method
, end_type
;
7181 end_type
= (do_interface
? object_type_node
: type
);
7182 for (method
= TYPE_METHODS (type
); method
; method
= TREE_CHAIN (method
))
7184 tree other_super
, other_method
, method_sig
, method_name
;
7187 if (!METHOD_ABSTRACT (method
) || METHOD_FINAL (method
))
7190 /* Now verify that somewhere in between TYPE and CLASS,
7191 abstract method METHOD gets a non abstract definition
7192 that is inherited by CLASS. */
7194 method_sig
= build_java_signature (TREE_TYPE (method
));
7195 method_name
= DECL_NAME (method
);
7196 if (TREE_CODE (method_name
) == EXPR_WITH_FILE_LOCATION
)
7197 method_name
= EXPR_WFL_NODE (method_name
);
7199 for (other_super
= class; other_super
!= end_type
;
7200 other_super
= CLASSTYPE_SUPER (other_super
))
7202 for (other_method
= TYPE_METHODS (other_super
); other_method
;
7203 other_method
= TREE_CHAIN (other_method
))
7205 tree s
= build_java_signature (TREE_TYPE (other_method
));
7206 tree other_name
= DECL_NAME (other_method
);
7208 if (TREE_CODE (other_name
) == EXPR_WITH_FILE_LOCATION
)
7209 other_name
= EXPR_WFL_NODE (other_name
);
7210 if (!IS_CLINIT (other_method
)
7211 && !DECL_CONSTRUCTOR_P (other_method
)
7212 && method_name
== other_name
&& method_sig
== s
)
7220 /* Report that abstract METHOD didn't find an implementation
7221 that CLASS can use. */
7224 char *t
= strdup (lang_printable_name
7225 (TREE_TYPE (TREE_TYPE (method
)), 0));
7226 tree ccn
= DECL_NAME (TYPE_NAME (DECL_CONTEXT (method
)));
7227 tree saved_wfl
= NULL_TREE
;
7229 if (TREE_CODE (DECL_NAME (method
)) == EXPR_WITH_FILE_LOCATION
)
7231 saved_wfl
= DECL_NAME (method
);
7232 DECL_NAME (method
) = EXPR_WFL_NODE (DECL_NAME (method
));
7236 (lookup_cl (class_decl
),
7237 "Class `%s' doesn't define the abstract method `%s %s' from "
7238 "%s `%s'. This method must be defined or %s `%s' must be "
7239 "declared abstract",
7240 IDENTIFIER_POINTER (DECL_NAME (class_decl
)),
7241 t
, lang_printable_name (method
, 0),
7242 (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method
))) ?
7243 "interface" : "class"),
7244 IDENTIFIER_POINTER (ccn
),
7245 (CLASS_INTERFACE (class_decl
) ? "interface" : "class"),
7246 IDENTIFIER_POINTER (DECL_NAME (class_decl
)));
7251 DECL_NAME (method
) = saved_wfl
;
7256 /* Check that CLASS_DECL somehoow implements all inherited abstract
7260 java_check_abstract_method_definitions (class_decl
)
7263 tree
class = TREE_TYPE (class_decl
);
7267 if (CLASS_ABSTRACT (class_decl
))
7270 /* Check for inherited types */
7271 for (super
= CLASSTYPE_SUPER (class); super
!= object_type_node
;
7272 super
= CLASSTYPE_SUPER (super
))
7274 if (!CLASS_ABSTRACT (TYPE_NAME (super
)))
7277 check_abstract_method_definitions (0, class_decl
, super
);
7280 /* Check for implemented interfaces. */
7281 vector
= TYPE_BINFO_BASETYPES (class);
7282 for (i
= 1; i
< TREE_VEC_LENGTH (vector
); i
++)
7284 super
= BINFO_TYPE (TREE_VEC_ELT (vector
, i
));
7285 check_abstract_method_definitions (1, class_decl
, super
);
7289 /* Check all the methods of CLASS_DECL. Methods are first completed
7290 then checked according to regular method existance rules. If no
7291 constructor for CLASS_DECL were encountered, then build its
7295 java_check_regular_methods (class_decl
)
7298 int saw_constructor
= 0;
7300 tree
class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl
));
7301 tree super_class
= CLASSTYPE_SUPER (class);
7302 tree saved_found_wfl
= NULL_TREE
, found
= NULL_TREE
;
7305 /* It is not necessary to check methods defined in java.lang.Object */
7306 if (class == object_type_node
)
7309 if (!TYPE_NVIRTUALS (class))
7310 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7312 /* Should take interfaces into account. FIXME */
7313 for (method
= TYPE_METHODS (class); method
; method
= TREE_CHAIN (method
))
7316 tree method_wfl
= DECL_NAME (method
);
7319 /* If we previously found something and its name was saved,
7321 if (found
&& saved_found_wfl
)
7323 DECL_NAME (found
) = saved_found_wfl
;
7324 saved_found_wfl
= NULL_TREE
;
7327 /* Check for redefinitions */
7328 if (check_method_redefinition (class, method
))
7331 /* If we see one constructor a mark so we don't generate the
7332 default one. Also skip other verifications: constructors
7333 can't be inherited hence hiden or overriden */
7334 if (DECL_CONSTRUCTOR_P (method
))
7336 saw_constructor
= 1;
7340 /* We verify things thrown by the method. They must inherits from
7341 java.lang.Throwable */
7342 for (mthrows
= DECL_FUNCTION_THROWS (method
);
7343 mthrows
; mthrows
= TREE_CHAIN (mthrows
))
7345 if (!inherits_from_p (TREE_VALUE (mthrows
), throwable_type_node
))
7347 (TREE_PURPOSE (mthrows
), "Class `%s' in `throws' clause must be "
7348 "a subclass of class `java.lang.Throwable'",
7350 (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows
)))));
7353 sig
= build_java_argument_signature (TREE_TYPE (method
));
7354 found
= lookup_argument_method (super_class
, DECL_NAME (method
), sig
);
7356 /* Nothing overrides or it's a private method. */
7359 if (METHOD_PRIVATE (found
))
7365 /* If found wasn't verified, it's DECL_NAME won't be set properly.
7366 We set it temporarily for the sake of the error report. */
7367 saved_found_wfl
= DECL_NAME (found
);
7368 reset_method_name (found
);
7370 /* Can't override a method with the same name and different return
7372 if (TREE_TYPE (TREE_TYPE (found
)) != TREE_TYPE (TREE_TYPE (method
)))
7374 char *t
= strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found
)),
7378 "Method `%s' was defined with return type `%s' in class `%s'",
7379 lang_printable_name (found
, 0), t
,
7381 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7385 aflags
= get_access_flags_from_decl (found
);
7386 /* If the method has default, access in an other package, then
7387 issue a warning that the current method doesn't override the
7388 one that was found elsewhere. Do not issue this warning when
7389 the match was found in java.lang.Object. */
7390 if (DECL_CONTEXT (found
) != object_type_node
7391 && ((aflags
& 0x7) == 0)
7392 && !class_in_current_package (DECL_CONTEXT (found
))
7393 && DECL_NAME (found
) != clinit_identifier_node
7394 && flag_not_overriding
)
7396 parse_warning_context
7397 (method_wfl
, "Method `%s' in class `%s' does not "
7398 "override the corresponding method in class `%s', which is "
7399 "private to a different package",
7400 lang_printable_name (found
, 0),
7401 IDENTIFIER_POINTER (DECL_NAME (class_decl
)),
7402 IDENTIFIER_POINTER (DECL_NAME
7403 (TYPE_NAME (DECL_CONTEXT (found
)))));
7407 /* Can't override final. Can't override static. */
7408 if (METHOD_FINAL (found
) || METHOD_STATIC (found
))
7410 /* Static *can* override static */
7411 if (METHOD_STATIC (found
) && METHOD_STATIC (method
))
7415 "%s methods can't be overriden. Method `%s' is %s in class `%s'",
7416 (METHOD_FINAL (found
) ? "Final" : "Static"),
7417 lang_printable_name (found
, 0),
7418 (METHOD_FINAL (found
) ? "final" : "static"),
7420 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7424 /* Static method can't override instance method. */
7425 if (METHOD_STATIC (method
))
7429 "Instance methods can't be overriden by a static method. Method "
7430 "`%s' is an instance method in class `%s'",
7431 lang_printable_name (found
, 0),
7433 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7437 /* - Overriding/hiding public must be public
7438 - Overriding/hiding protected must be protected or public
7439 - If the overriden or hidden method has default (package)
7440 access, then the overriding or hiding method must not be
7441 private; otherwise, a compile-time error occurs */
7442 if ((METHOD_PUBLIC (found
) && !METHOD_PUBLIC (method
))
7443 || (METHOD_PROTECTED (found
)
7444 && !(METHOD_PUBLIC (method
) || METHOD_PROTECTED (method
)))
7445 || (!(aflags
& (ACC_PUBLIC
| ACC_PRIVATE
| ACC_STATIC
))
7446 && METHOD_PRIVATE (method
)))
7450 "Methods can't be overridden to be more private. Method `%s' is "
7451 "not %s in class `%s'", lang_printable_name (method
, 0),
7452 (METHOD_PUBLIC (method
) ? "public" :
7453 (METHOD_PRIVATE (method
) ? "private" : "protected")),
7454 IDENTIFIER_POINTER (DECL_NAME
7455 (TYPE_NAME (DECL_CONTEXT (found
)))));
7459 /* Overriding methods must have compatible `throws' clauses on checked
7460 exceptions, if any */
7461 check_throws_clauses (method
, method_wfl
, found
);
7463 /* Inheriting multiple methods with the same signature. FIXME */
7466 /* Don't forget eventual pending found and saved_found_wfl. Take
7467 into account that we might have exited because we saw an
7468 artificial method as the last entry. */
7470 if (found
&& !DECL_ARTIFICIAL (found
) && saved_found_wfl
)
7471 DECL_NAME (found
) = saved_found_wfl
;
7473 if (!TYPE_NVIRTUALS (class))
7474 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7476 /* Search for inherited abstract method not yet implemented in this
7478 java_check_abstract_method_definitions (class_decl
);
7480 if (!saw_constructor
)
7482 /* No constructor seen, we craft one, at line 0. Since this
7483 operation takes place after we laid methods out
7484 (layout_class_methods), we prepare the its DECL
7489 /* If the class is declared PUBLIC, the default constructor is
7490 PUBLIC otherwise it has default access implied by no access
7492 flags
= (get_access_flags_from_decl (class_decl
) & ACC_PUBLIC
?
7494 decl
= create_artificial_method (class, flags
, void_type_node
,
7495 init_identifier_node
, end_params_node
);
7496 DECL_CONSTRUCTOR_P (decl
) = 1;
7497 layout_class_method (TREE_TYPE (class_decl
), NULL_TREE
, decl
, NULL_TREE
);
7501 /* Return a non zero value if the `throws' clause of METHOD (if any)
7502 is incompatible with the `throws' clause of FOUND (if any). */
7505 check_throws_clauses (method
, method_wfl
, found
)
7506 tree method
, method_wfl
, found
;
7508 tree mthrows
, fthrows
;
7510 /* Can't check these things with class loaded from bytecode. FIXME */
7511 if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found
)))
7514 for (mthrows
= DECL_FUNCTION_THROWS (method
);
7515 mthrows
; mthrows
= TREE_CHAIN (mthrows
))
7517 /* We don't verify unchecked expressions */
7518 if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows
)))
7520 /* Checked expression must be compatible */
7521 for (fthrows
= DECL_FUNCTION_THROWS (found
);
7522 fthrows
; fthrows
= TREE_CHAIN (fthrows
))
7523 if (inherits_from_p (TREE_VALUE (mthrows
), TREE_VALUE (fthrows
)))
7528 (method_wfl
, "Invalid checked exception class `%s' in "
7529 "`throws' clause. The exception must be a subclass of an "
7530 "exception thrown by `%s' from class `%s'",
7531 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows
)))),
7532 lang_printable_name (found
, 0),
7534 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7539 /* Check abstract method of interface INTERFACE */
7542 java_check_abstract_methods (interface_decl
)
7543 tree interface_decl
;
7546 tree method
, basetype_vec
, found
;
7547 tree interface
= TREE_TYPE (interface_decl
);
7549 for (method
= TYPE_METHODS (interface
); method
; method
= TREE_CHAIN (method
))
7551 tree method_wfl
= DECL_NAME (method
);
7553 /* 2- Check for double definition inside the defining interface */
7554 if (check_method_redefinition (interface
, method
))
7557 /* 3- Overriding is OK as far as we preserve the return type and
7558 the thrown exceptions (FIXME) */
7559 found
= lookup_java_interface_method2 (interface
, method
);
7563 tree saved_found_wfl
= DECL_NAME (found
);
7564 reset_method_name (found
);
7565 t
= strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found
)), 0));
7568 "Method `%s' was defined with return type `%s' in class `%s'",
7569 lang_printable_name (found
, 0), t
,
7571 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7575 DECL_NAME (found
) = saved_found_wfl
;
7579 /* 4- Inherited methods can't differ by their returned types */
7580 if (!(basetype_vec
= TYPE_BINFO_BASETYPES (interface
)))
7582 n
= TREE_VEC_LENGTH (basetype_vec
);
7583 for (i
= 0; i
< n
; i
++)
7585 tree sub_interface_method
, sub_interface
;
7586 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
);
7589 sub_interface
= BINFO_TYPE (vec_elt
);
7590 for (sub_interface_method
= TYPE_METHODS (sub_interface
);
7591 sub_interface_method
;
7592 sub_interface_method
= TREE_CHAIN (sub_interface_method
))
7594 found
= lookup_java_interface_method2 (interface
,
7595 sub_interface_method
);
7596 if (found
&& (found
!= sub_interface_method
))
7598 tree saved_found_wfl
= DECL_NAME (found
);
7599 reset_method_name (found
);
7601 (lookup_cl (sub_interface_method
),
7602 "Interface `%s' inherits method `%s' from interface `%s'. "
7603 "This method is redefined with a different return type in "
7605 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface
))),
7606 lang_printable_name (found
, 0),
7608 (DECL_NAME (TYPE_NAME
7609 (DECL_CONTEXT (sub_interface_method
)))),
7611 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7612 DECL_NAME (found
) = saved_found_wfl
;
7618 /* Lookup methods in interfaces using their name and partial
7619 signature. Return a matching method only if their types differ. */
7622 lookup_java_interface_method2 (class, method_decl
)
7623 tree
class, method_decl
;
7626 tree basetype_vec
= TYPE_BINFO_BASETYPES (class), to_return
;
7631 n
= TREE_VEC_LENGTH (basetype_vec
);
7632 for (i
= 0; i
< n
; i
++)
7634 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
), to_return
;
7635 if ((BINFO_TYPE (vec_elt
) != object_type_node
)
7637 lookup_java_method2 (BINFO_TYPE (vec_elt
), method_decl
, 1)))
7640 for (i
= 0; i
< n
; i
++)
7642 to_return
= lookup_java_interface_method2
7643 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec
, i
)), method_decl
);
7651 /* Lookup method using their name and partial signature. Return a
7652 matching method only if their types differ. */
7655 lookup_java_method2 (clas
, method_decl
, do_interface
)
7656 tree clas
, method_decl
;
7659 tree method
, method_signature
, method_name
, method_type
, name
;
7661 method_signature
= build_java_argument_signature (TREE_TYPE (method_decl
));
7662 name
= DECL_NAME (method_decl
);
7663 method_name
= (TREE_CODE (name
) == EXPR_WITH_FILE_LOCATION
?
7664 EXPR_WFL_NODE (name
) : name
);
7665 method_type
= TREE_TYPE (TREE_TYPE (method_decl
));
7667 while (clas
!= NULL_TREE
)
7669 for (method
= TYPE_METHODS (clas
);
7670 method
!= NULL_TREE
; method
= TREE_CHAIN (method
))
7672 tree method_sig
= build_java_argument_signature (TREE_TYPE (method
));
7673 tree name
= DECL_NAME (method
);
7674 if ((TREE_CODE (name
) == EXPR_WITH_FILE_LOCATION
?
7675 EXPR_WFL_NODE (name
) : name
) == method_name
7676 && method_sig
== method_signature
7677 && TREE_TYPE (TREE_TYPE (method
)) != method_type
)
7680 clas
= (do_interface
? NULL_TREE
: CLASSTYPE_SUPER (clas
));
7685 /* Return the line that matches DECL line number. Used during error
7692 static tree cl
= NULL_TREE
;
7697 if (cl
== NULL_TREE
)
7698 cl
= build_expr_wfl (NULL_TREE
, NULL
, 0, 0);
7700 EXPR_WFL_FILENAME_NODE (cl
) = get_identifier (DECL_SOURCE_FILE (decl
));
7701 EXPR_WFL_SET_LINECOL (cl
, DECL_SOURCE_LINE_FIRST (decl
), -1);
7706 /* Look for a simple name in the single-type import list */
7709 find_name_in_single_imports (name
)
7714 for (node
= ctxp
->import_list
; node
; node
= TREE_CHAIN (node
))
7715 if (TREE_VALUE (node
) == name
)
7716 return (EXPR_WFL_NODE (TREE_PURPOSE (node
)));
7721 /* Process all single-type import. */
7729 for (import
= ctxp
->import_list
; import
; import
= TREE_CHAIN (import
))
7731 tree to_be_found
= EXPR_WFL_NODE (TREE_PURPOSE (import
));
7733 /* Don't load twice something already defined. */
7734 if (IDENTIFIER_CLASS_VALUE (to_be_found
))
7736 QUALIFIED_P (to_be_found
) = 1;
7737 load_class (to_be_found
, 0);
7739 check_pkg_class_access (to_be_found
, TREE_PURPOSE (import
));
7740 if (!IDENTIFIER_CLASS_VALUE (to_be_found
))
7742 parse_error_context (TREE_PURPOSE (import
),
7743 "Class or interface `%s' not found in import",
7744 IDENTIFIER_POINTER (to_be_found
));
7753 /* Possibly find a class imported by a single-type import statement. Return
7754 1 if an error occured, 0 otherwise. */
7757 find_in_imports (class_type
)
7762 for (import
= ctxp
->import_list
; import
; import
= TREE_CHAIN (import
))
7763 if (TREE_VALUE (import
) == TYPE_NAME (class_type
))
7765 TYPE_NAME (class_type
) = EXPR_WFL_NODE (TREE_PURPOSE (import
));
7766 QUALIFIED_P (TYPE_NAME (class_type
)) = 1;
7772 note_possible_classname (name
, len
)
7777 if (len
> 5 && strncmp (&name
[len
-5], ".java", 5) == 0)
7779 else if (len
> 6 && strncmp (&name
[len
-6], ".class", 6) == 0)
7783 node
= ident_subst (name
, len
, "", '/', '.', "");
7784 IS_A_CLASSFILE_NAME (node
) = 1; /* Or soon to be */
7785 QUALIFIED_P (node
) = strchr (name
, '/') ? 1 : 0;
7789 /* Read a import directory, gathering potential match for further type
7790 references. Indifferently reads a filesystem or a ZIP archive
7794 read_import_dir (wfl
)
7797 tree package_id
= EXPR_WFL_NODE (wfl
);
7798 const char *package_name
= IDENTIFIER_POINTER (package_id
);
7799 int package_length
= IDENTIFIER_LENGTH (package_id
);
7801 JCF
*saved_jcf
= current_jcf
;
7806 struct buffer filename
[1];
7809 if (IS_AN_IMPORT_ON_DEMAND_P (package_id
))
7811 IS_AN_IMPORT_ON_DEMAND_P (package_id
) = 1;
7813 BUFFER_INIT (filename
);
7814 buffer_grow (filename
, package_length
+ 100);
7816 for (entry
= jcf_path_start (); entry
!= NULL
; entry
= jcf_path_next (entry
))
7818 const char *entry_name
= jcf_path_name (entry
);
7819 int entry_length
= strlen (entry_name
);
7820 if (jcf_path_is_zipfile (entry
))
7823 buffer_grow (filename
, entry_length
);
7824 memcpy (filename
->data
, entry_name
, entry_length
- 1);
7825 filename
->data
[entry_length
-1] = '\0';
7826 zipf
= opendir_in_zip (filename
->data
, jcf_path_is_system (entry
));
7828 error ("malformed .zip archive in CLASSPATH: %s", entry_name
);
7831 ZipDirectory
*zipd
= (ZipDirectory
*) zipf
->central_directory
;
7832 BUFFER_RESET (filename
);
7833 for (k
= 0; k
< package_length
; k
++)
7835 char ch
= package_name
[k
];
7836 *filename
->ptr
++ = ch
== '.' ? '/' : ch
;
7838 *filename
->ptr
++ = '/';
7840 for (k
= 0; k
< zipf
->count
; k
++, zipd
= ZIPDIR_NEXT (zipd
))
7842 const char *current_entry
= ZIPDIR_FILENAME (zipd
);
7843 int current_entry_len
= zipd
->filename_length
;
7845 if (current_entry_len
>= BUFFER_LENGTH (filename
)
7846 && strncmp (filename
->data
, current_entry
,
7847 BUFFER_LENGTH (filename
)) != 0)
7849 found
|= note_possible_classname (current_entry
,
7856 BUFFER_RESET (filename
);
7857 buffer_grow (filename
, entry_length
+ package_length
+ 4);
7858 strcpy (filename
->data
, entry_name
);
7859 filename
->ptr
= filename
->data
+ entry_length
;
7860 for (k
= 0; k
< package_length
; k
++)
7862 char ch
= package_name
[k
];
7863 *filename
->ptr
++ = ch
== '.' ? '/' : ch
;
7865 *filename
->ptr
= '\0';
7867 dirp
= opendir (filename
->data
);
7870 *filename
->ptr
++ = '/';
7875 struct dirent
*direntp
= readdir (dirp
);
7878 d_name
= direntp
->d_name
;
7879 len
= strlen (direntp
->d_name
);
7880 buffer_grow (filename
, len
+1);
7881 strcpy (filename
->ptr
, d_name
);
7882 found
|= note_possible_classname (filename
->data
+ entry_length
,
7883 package_length
+len
+1);
7890 free (filename
->data
);
7892 /* Here we should have a unified way of retrieving an entry, to be
7896 static int first
= 1;
7900 sprintf (buffer
, "Can't find default package `%s'. Check "
7901 "the CLASSPATH environment variable and the access to the "
7902 "archives.", package_name
);
7908 parse_error_context (wfl
, "Package `%s' not found in import",
7910 current_jcf
= saved_jcf
;
7913 current_jcf
= saved_jcf
;
7916 /* Possibly find a type in the import on demands specified
7917 types. Returns 1 if an error occured, 0 otherwise. Run throught the
7918 entire list, to detected potential double definitions. */
7921 find_in_imports_on_demand (class_type
)
7924 tree node
, import
, node_to_use
= NULL_TREE
;
7926 tree cl
= NULL_TREE
;
7928 for (import
= ctxp
->import_demand_list
; import
; import
= TREE_CHAIN (import
))
7930 const char *id_name
;
7931 obstack_grow (&temporary_obstack
,
7932 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import
))),
7933 IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import
))));
7934 obstack_1grow (&temporary_obstack
, '.');
7935 obstack_grow0 (&temporary_obstack
,
7936 IDENTIFIER_POINTER (TYPE_NAME (class_type
)),
7937 IDENTIFIER_LENGTH (TYPE_NAME (class_type
)));
7938 id_name
= obstack_finish (&temporary_obstack
);
7940 node
= maybe_get_identifier (id_name
);
7941 if (node
&& IS_A_CLASSFILE_NAME (node
))
7945 cl
= TREE_PURPOSE (import
);
7953 (import
, "Type `%s' also potentially defined in package `%s'",
7954 IDENTIFIER_POINTER (TYPE_NAME (class_type
)),
7955 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import
))));
7962 /* Setup lineno so that it refers to the line of the import (in
7963 case we parse a class file and encounter errors */
7965 int saved_lineno
= lineno
;
7966 lineno
= EXPR_WFL_LINENO (cl
);
7967 TYPE_NAME (class_type
) = node_to_use
;
7968 QUALIFIED_P (TYPE_NAME (class_type
)) = 1;
7969 decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
7970 /* If there is no DECL set for the class or if the class isn't
7971 loaded and not seen in source yet, the load */
7972 if (!decl
|| (!CLASS_LOADED_P (TREE_TYPE (decl
))
7973 && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl
))))
7974 load_class (node_to_use
, 0);
7975 lineno
= saved_lineno
;
7976 return check_pkg_class_access (TYPE_NAME (class_type
), cl
);
7979 return (seen_once
< 0 ? 0 : seen_once
); /* It's ok not to have found */
7983 resolve_package (pkg
, next
)
7987 tree type_name
= NULL_TREE
;
7988 const char *name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg
));
7990 /* The trick is to determine when the package name stops and were
7991 the name of something contained in the package starts. Then we
7992 return a fully qualified name of what we want to get. */
7994 /* Do a quick search on well known package names */
7995 if (!strncmp (name
, "java.lang.reflect", 17))
7998 TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg
))));
7999 type_name
= lookup_package_type (name
, 17);
8001 else if (!strncmp (name
, "java.lang", 9))
8003 *next
= TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg
)));
8004 type_name
= lookup_package_type (name
, 9);
8007 /* If we found something here, return */
8011 *next
= EXPR_WFL_QUALIFICATION (pkg
);
8013 /* Try the current package. */
8014 if (ctxp
->package
&& !strncmp (name
, IDENTIFIER_POINTER (ctxp
->package
),
8015 IDENTIFIER_LENGTH (ctxp
->package
)))
8018 lookup_package_type_and_set_next (name
,
8019 IDENTIFIER_LENGTH (ctxp
->package
),
8025 /* Search in imported package */
8026 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
8028 tree current_pkg_name
= EXPR_WFL_NODE (TREE_PURPOSE (current
));
8029 int len
= IDENTIFIER_LENGTH (current_pkg_name
);
8030 if (!strncmp (name
, IDENTIFIER_POINTER (current_pkg_name
), len
))
8034 breakdown_qualified (&left
, &dummy
, current_pkg_name
);
8035 len
= IDENTIFIER_LENGTH (left
);
8036 type_name
= lookup_package_type_and_set_next (name
, len
, next
);
8046 lookup_package_type_and_set_next (name
, len
, next
)
8052 tree type_name
= lookup_package_type (name
, len
);
8057 ptr
= IDENTIFIER_POINTER (type_name
);
8058 while (ptr
&& (ptr
= strchr (ptr
, '.')))
8060 *next
= TREE_CHAIN (*next
);
8067 lookup_package_type (name
, from
)
8072 const char *sub
= &name
[from
+1];
8073 while (*sub
!= '.' && *sub
)
8075 strncpy (subname
, name
, sub
-name
);
8076 subname
[sub
-name
] = '\0';
8077 return get_identifier (subname
);
8080 /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
8081 access violations were found, 1 otherwise. */
8084 check_pkg_class_access (class_name
, cl
)
8090 if (!QUALIFIED_P (class_name
) || !IDENTIFIER_CLASS_VALUE (class_name
))
8093 if (!(type
= TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name
))))
8096 if (!CLASS_PUBLIC (TYPE_NAME (type
)))
8098 /* Access to a private class within the same package is
8101 breakdown_qualified (&l
, &r
, class_name
);
8102 if (l
== ctxp
->package
)
8106 (cl
, "Can't access %s `%s'. Only public classes and interfaces in "
8107 "other packages can be accessed",
8108 (CLASS_INTERFACE (TYPE_NAME (type
)) ? "interface" : "class"),
8109 IDENTIFIER_POINTER (class_name
));
8115 /* Local variable declaration. */
8118 declare_local_variables (modifier
, type
, vlist
)
8123 tree decl
, current
, saved_type
;
8124 tree type_wfl
= NULL_TREE
;
8127 /* Push a new block if statements were seen between the last time we
8128 pushed a block and now. Keep a cound of block to close */
8129 if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl
)))
8131 tree body
= GET_CURRENT_BLOCK (current_function_decl
);
8132 tree b
= enter_block ();
8133 BLOCK_EXPR_ORIGIN (b
) = body
;
8139 for (i
= 0; i
<= 10; i
++) if (1 << i
& modifier
) break;
8140 if (modifier
== ACC_FINAL
)
8142 if (flag_static_local_jdk1_1
)
8143 parse_warning_context (ctxp
->modifier_ctx
[i
],
8144 "Unsupported JDK1.1 `final' local variable "
8145 "(treated as non final)");
8150 (ctxp
->modifier_ctx
[i
],
8151 "Only `final' is allowed as a local variables modifier");
8156 /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
8157 hold the TYPE value if a new incomplete has to be created (as
8158 opposed to being found already existing and reused). */
8159 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
8161 /* If TYPE is fully resolved and we don't have a reference, make one */
8162 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
8164 /* Go through all the declared variables */
8165 for (current
= vlist
, saved_type
= type
; current
;
8166 current
= TREE_CHAIN (current
), type
= saved_type
)
8168 tree other
, real_type
;
8169 tree wfl
= TREE_PURPOSE (current
);
8170 tree name
= EXPR_WFL_NODE (wfl
);
8171 tree init
= TREE_VALUE (current
);
8173 /* Process NAME, as it may specify extra dimension(s) for it */
8174 type
= build_array_from_name (type
, type_wfl
, name
, &name
);
8176 /* Variable redefinition check */
8177 if ((other
= lookup_name_in_blocks (name
)))
8179 variable_redefinition_error (wfl
, name
, TREE_TYPE (other
),
8180 DECL_SOURCE_LINE (other
));
8184 /* Type adjustment. We may have just readjusted TYPE because
8185 the variable specified more dimensions. Make sure we have
8186 a reference if we can and don't have one already. */
8187 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
8189 real_type
= GET_REAL_TYPE (type
);
8190 /* Never layout this decl. This will be done when its scope
8192 decl
= build_decl (VAR_DECL
, name
, real_type
);
8193 BLOCK_CHAIN_DECL (decl
);
8195 /* If doing xreferencing, replace the line number with the WFL
8198 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINECOL (wfl
);
8200 /* Don't try to use an INIT statement when an error was found */
8201 if (init
&& java_error_count
)
8204 /* Add the initialization function to the current function's code */
8207 /* Name might have been readjusted */
8208 EXPR_WFL_NODE (TREE_OPERAND (init
, 0)) = name
;
8209 MODIFY_EXPR_FROM_INITIALIZATION_P (init
) = 1;
8210 java_method_add_stmt (current_function_decl
,
8211 build_debugable_stmt (EXPR_WFL_LINECOL (init
),
8215 /* Setup dependency the type of the decl */
8219 register_incomplete_type (JDEP_VARIABLE
, type_wfl
, decl
, type
);
8220 dep
= CLASSD_LAST (ctxp
->classd_list
);
8221 JDEP_GET_PATCH (dep
) = &TREE_TYPE (decl
);
8224 SOURCE_FRONTEND_DEBUG (("Defined locals"));
8227 /* Called during parsing. Build decls from argument list. */
8230 source_start_java_method (fndecl
)
8240 current_function_decl
= fndecl
;
8242 /* New scope for the function */
8244 for (tem
= TYPE_ARG_TYPES (TREE_TYPE (fndecl
)), i
= 0;
8245 tem
!= end_params_node
; tem
= TREE_CHAIN (tem
), i
++)
8247 tree type
= TREE_VALUE (tem
);
8248 tree name
= TREE_PURPOSE (tem
);
8250 /* If type is incomplete. Create an incomplete decl and ask for
8251 the decl to be patched later */
8252 if (INCOMPLETE_TYPE_P (type
))
8255 tree real_type
= GET_REAL_TYPE (type
);
8256 parm_decl
= build_decl (PARM_DECL
, name
, real_type
);
8257 type
= obtain_incomplete_type (type
);
8258 register_incomplete_type (JDEP_PARM
, NULL_TREE
, NULL_TREE
, type
);
8259 jdep
= CLASSD_LAST (ctxp
->classd_list
);
8260 JDEP_MISC (jdep
) = name
;
8261 JDEP_GET_PATCH (jdep
) = &TREE_TYPE (parm_decl
);
8264 parm_decl
= build_decl (PARM_DECL
, name
, type
);
8266 BLOCK_CHAIN_DECL (parm_decl
);
8268 tem
= BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
));
8269 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
)) =
8271 DECL_ARG_SLOT_COUNT (current_function_decl
) = i
;
8274 /* Called during parsing. Creates an artificial method declaration. */
8277 create_artificial_method (class, flags
, type
, name
, args
)
8280 tree type
, name
, args
;
8282 int saved_lineno
= lineno
;
8286 mdecl
= make_node (FUNCTION_TYPE
);
8287 TREE_TYPE (mdecl
) = type
;
8288 TYPE_ARG_TYPES (mdecl
) = args
;
8289 mdecl
= add_method (class, flags
, name
, build_java_signature (mdecl
));
8290 lineno
= saved_lineno
;
8291 DECL_ARTIFICIAL (mdecl
) = 1;
8295 /* Starts the body if an artifical method. */
8298 start_artificial_method_body (mdecl
)
8301 DECL_SOURCE_LINE (mdecl
) = 1;
8302 DECL_SOURCE_LINE_MERGE (mdecl
, 1);
8303 source_start_java_method (mdecl
);
8308 end_artificial_method_body (mdecl
)
8311 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl
)) = exit_block ();
8315 /* Called during expansion. Push decls formerly built from argument
8316 list so they're usable during expansion. */
8319 expand_start_java_method (fndecl
)
8324 current_function_decl
= fndecl
;
8326 announce_function (fndecl
);
8327 pushlevel (1); /* Push parameters */
8328 ptr
= &DECL_ARGUMENTS (fndecl
);
8329 tem
= BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
));
8332 tree next
= TREE_CHAIN (tem
);
8333 tree type
= TREE_TYPE (tem
);
8334 if (PROMOTE_PROTOTYPES
8335 && TYPE_PRECISION (type
) < TYPE_PRECISION (integer_type_node
)
8336 && INTEGRAL_TYPE_P (type
))
8337 type
= integer_type_node
;
8338 DECL_ARG_TYPE (tem
) = type
;
8339 layout_decl (tem
, 0);
8342 ptr
= &TREE_CHAIN (tem
);
8346 pushdecl_force_head (DECL_ARGUMENTS (fndecl
));
8347 lineno
= DECL_SOURCE_LINE_FIRST (fndecl
);
8350 /* Terminate a function and expand its body. */
8353 source_end_java_method ()
8355 tree fndecl
= current_function_decl
;
8356 int flag_asynchronous_exceptions
= asynchronous_exceptions
;
8361 java_parser_context_save_global ();
8362 lineno
= ctxp
->last_ccb_indent1
;
8364 /* Set EH language codes */
8365 java_set_exception_lang_code ();
8367 /* Turn function bodies with only a NOP expr null, so they don't get
8368 generated at all and we won't get warnings when using the -W
8370 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)) == empty_stmt_node
)
8371 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)) = NULL_TREE
;
8373 /* Generate function's code */
8374 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
))
8375 && ! flag_emit_class_files
8376 && ! flag_emit_xref
)
8377 expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)));
8379 /* pop out of its parameters */
8380 pushdecl_force_head (DECL_ARGUMENTS (fndecl
));
8382 BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl
)) = fndecl
;
8384 /* Generate rtl for function exit. */
8385 if (! flag_emit_class_files
&& ! flag_emit_xref
)
8387 lineno
= DECL_SOURCE_LINE_LAST (fndecl
);
8388 /* Emit catch-finally clauses */
8390 expand_function_end (input_filename
, lineno
, 0);
8392 /* FIXME: If the current method contains any exception handlers,
8393 force asynchronous_exceptions: this is necessary because signal
8394 handlers in libjava may throw exceptions. This is far from being
8395 a perfect solution, but it's better than doing nothing at all.*/
8397 asynchronous_exceptions
= 1;
8399 /* Run the optimizers and output assembler code for this function. */
8400 rest_of_compilation (fndecl
);
8403 current_function_decl
= NULL_TREE
;
8404 /* permanent_allocation (1); */
8405 java_parser_context_restore_global ();
8406 asynchronous_exceptions
= flag_asynchronous_exceptions
;
8409 /* Record EXPR in the current function block. Complements compound
8410 expression second operand if necessary. */
8413 java_method_add_stmt (fndecl
, expr
)
8418 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl
), NULL_TREE
, expr
);
8422 add_stmt_to_block (b
, type
, stmt
)
8425 tree body
= BLOCK_EXPR_BODY (b
), c
;
8427 if (java_error_count
)
8430 if ((c
= add_stmt_to_compound (body
, type
, stmt
)) == body
)
8433 BLOCK_EXPR_BODY (b
) = c
;
8434 TREE_SIDE_EFFECTS (c
) = 1;
8438 /* Add STMT to EXISTING if possible, otherwise create a new
8439 COMPOUND_EXPR and add STMT to it. */
8442 add_stmt_to_compound (existing
, type
, stmt
)
8443 tree existing
, type
, stmt
;
8446 return build (COMPOUND_EXPR
, type
, existing
, stmt
);
8451 /* Hold THIS for the scope of the current public method decl. */
8452 static tree current_this
;
8454 void java_layout_seen_class_methods ()
8456 tree previous_list
= all_class_list
;
8457 tree end
= NULL_TREE
;
8462 for (current
= previous_list
;
8463 current
!= end
; current
= TREE_CHAIN (current
))
8464 layout_class_methods (TREE_TYPE (TREE_VALUE (current
)));
8466 if (previous_list
!= all_class_list
)
8468 end
= previous_list
;
8469 previous_list
= all_class_list
;
8476 /* Layout the methods of all classes loaded in one way on an
8477 other. Check methods of source parsed classes. Then reorder the
8478 fields and layout the classes or the type of all source parsed
8482 java_layout_classes ()
8485 int save_error_count
= java_error_count
;
8487 /* Layout the methods of all classes seen so far */
8488 java_layout_seen_class_methods ();
8489 java_parse_abort_on_error ();
8490 all_class_list
= NULL_TREE
;
8492 /* Then check the methods of all parsed classes */
8493 for (current
= ctxp
->gclass_list
; current
; current
= TREE_CHAIN (current
))
8494 if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current
))))
8495 CHECK_METHODS (TREE_VALUE (current
));
8496 java_parse_abort_on_error ();
8498 for (current
= ctxp
->gclass_list
; current
; current
= TREE_CHAIN (current
))
8500 current_class
= TREE_TYPE (TREE_VALUE (current
));
8502 /* Reverse the fields, but leave the dummy field in front.
8503 Fields are already ordered for Object and Class */
8504 if (TYPE_FIELDS (current_class
) && current_class
!= object_type_node
8505 && current_class
!= class_type_node
)
8507 /* If the dummy field is there, reverse the right fields and
8508 just layout the type for proper fields offset */
8509 if (!DECL_NAME (TYPE_FIELDS (current_class
)))
8511 tree fields
= TYPE_FIELDS (current_class
);
8512 TREE_CHAIN (fields
) = nreverse (TREE_CHAIN (fields
));
8513 TYPE_SIZE (current_class
) = NULL_TREE
;
8514 layout_type (current_class
);
8516 /* We don't have a dummy field, we need to layout the class,
8517 after having reversed the fields */
8520 TYPE_FIELDS (current_class
) =
8521 nreverse (TYPE_FIELDS (current_class
));
8522 TYPE_SIZE (current_class
) = NULL_TREE
;
8523 layout_class (current_class
);
8527 layout_class (current_class
);
8529 /* From now on, the class is considered completely loaded */
8530 CLASS_LOADED_P (current_class
) = 1;
8532 /* Error reported by the caller */
8533 if (java_error_count
)
8537 /* We might have reloaded classes durign the process of laying out
8538 classes for code generation. We must layout the methods of those
8539 late additions, as constructor checks might use them */
8540 java_layout_seen_class_methods ();
8541 java_parse_abort_on_error ();
8544 /* Expand all methods in all registered classes. */
8547 java_complete_expand_methods ()
8551 do_not_fold
= flag_emit_xref
;
8553 for (current
= ctxp
->class_list
; current
; current
= TREE_CHAIN (current
))
8556 tree class_type
= CLASS_TO_HANDLE_TYPE (TREE_TYPE (current
));
8559 current_class
= TREE_TYPE (current
);
8560 is_interface
= CLASS_INTERFACE (TYPE_NAME (current_class
));
8562 /* Initialize a new constant pool */
8563 init_outgoing_cpool ();
8565 /* We want <clinit> (if any) to be processed first. */
8566 decl
= tree_last (TYPE_METHODS (class_type
));
8567 if (IS_CLINIT (decl
))
8569 tree fbody
= DECL_FUNCTION_BODY (decl
);
8571 if (fbody
!= NULL_TREE
)
8573 /* First check if we can ignore empty <clinit> */
8574 tree block_body
= BLOCK_EXPR_BODY (fbody
);
8576 current_this
= NULL_TREE
;
8577 current_function_decl
= decl
;
8578 if (block_body
!= NULL_TREE
)
8580 /* Prevent the use of `this' inside <clinit> */
8581 ctxp
->explicit_constructor_p
= 1;
8583 block_body
= java_complete_tree (block_body
);
8584 ctxp
->explicit_constructor_p
= 0;
8585 BLOCK_EXPR_BODY (fbody
) = block_body
;
8586 if (block_body
!= NULL_TREE
8587 && TREE_CODE (block_body
) == BLOCK
8588 && BLOCK_EXPR_BODY (block_body
) == empty_stmt_node
)
8592 list
= nreverse (TREE_CHAIN (nreverse (TYPE_METHODS (class_type
))));
8593 if (decl
!= NULL_TREE
)
8595 TREE_CHAIN (decl
) = list
;
8596 TYPE_METHODS (class_type
) = decl
;
8599 TYPE_METHODS (class_type
) = list
;
8602 for (decl
= TYPE_METHODS (class_type
); decl
; decl
= TREE_CHAIN (decl
))
8604 current_function_decl
= decl
;
8605 /* Don't generate debug info on line zero when expanding a
8606 generated constructor. */
8607 if (DECL_CONSTRUCTOR_P (decl
) && !DECL_FUNCTION_BODY (decl
))
8609 /* If we found errors, it's too dangerous to try to
8610 generate and expand a constructor */
8611 if (!java_error_count
)
8613 restore_line_number_status (1);
8614 java_complete_expand_method (decl
);
8615 restore_line_number_status (0);
8618 else if (METHOD_ABSTRACT (decl
) || METHOD_NATIVE (decl
))
8621 java_complete_expand_method (decl
);
8624 /* Now verify constructor circularity (stop after the first one
8627 for (decl
= TYPE_METHODS (class_type
); decl
; decl
= TREE_CHAIN (decl
))
8628 if (DECL_CONSTRUCTOR_P (decl
) &&
8629 verify_constructor_circularity (decl
, decl
))
8632 /* Make the class data, register it and run the rest of decl
8633 compilation on it */
8634 if (!java_error_count
)
8636 if (flag_emit_class_files
)
8637 write_classfile (current_class
);
8639 expand_xref (current_class
);
8640 else if (! flag_syntax_only
)
8641 finish_class (current_class
);
8646 /* Hold a list of catch clauses list. The first element of this list is
8647 the list of the catch clauses of the currently analysed try block. */
8648 static tree currently_caught_type_list
;
8650 /* Complete and expand a method. */
8653 java_complete_expand_method (mdecl
)
8656 /* Fix constructors before expanding them */
8657 if (DECL_CONSTRUCTOR_P (mdecl
))
8658 fix_constructors (mdecl
);
8660 /* Expand functions that have a body */
8661 if (DECL_FUNCTION_BODY (mdecl
))
8663 tree fbody
= DECL_FUNCTION_BODY (mdecl
);
8664 tree block_body
= BLOCK_EXPR_BODY (fbody
);
8665 tree exception_copy
= NULL_TREE
;
8666 expand_start_java_method (mdecl
);
8667 build_result_decl (mdecl
);
8670 = (!METHOD_STATIC (mdecl
) ?
8671 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl
)) : NULL_TREE
);
8673 /* Purge the `throws' list of unchecked exceptions. If we're
8674 doing xref, save a copy of the list and re-install it
8677 exception_copy
= copy_list (DECL_FUNCTION_THROWS (mdecl
));
8679 purge_unchecked_exceptions (mdecl
);
8681 /* Install exceptions thrown with `throws' */
8682 PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl
));
8684 if (block_body
!= NULL_TREE
)
8686 block_body
= java_complete_tree (block_body
);
8687 if (!flag_emit_xref
)
8688 check_for_initialization (block_body
);
8689 ctxp
->explicit_constructor_p
= 0;
8691 BLOCK_EXPR_BODY (fbody
) = block_body
;
8693 if ((block_body
== NULL_TREE
|| CAN_COMPLETE_NORMALLY (block_body
))
8694 && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl
))) != VOID_TYPE
8696 missing_return_error (current_function_decl
);
8698 complete_start_java_method (mdecl
);
8700 /* Don't go any further if we've found error(s) during the
8702 if (!java_error_count
)
8703 source_end_java_method ();
8706 pushdecl_force_head (DECL_ARGUMENTS (mdecl
));
8710 /* Pop the exceptions and sanity check */
8712 if (currently_caught_type_list
)
8713 fatal ("Exception list non empty - java_complete_expand_method");
8716 DECL_FUNCTION_THROWS (mdecl
) = exception_copy
;
8720 /* Craft a body for default constructor. Patch existing constructor
8721 bodies with call to super() and field initialization statements if
8725 fix_constructors (mdecl
)
8728 tree body
= DECL_FUNCTION_BODY (mdecl
);
8732 /* The constructor body must be crafted by hand. It's the
8733 constructor we defined when we realize we didn't have the
8734 CLASSNAME() constructor */
8738 /* It is an error for the compiler to generate a default
8739 constructor if the superclass doesn't have a constructor that
8740 takes no argument */
8741 if (verify_constructor_super ())
8743 tree sclass_decl
= TYPE_NAME (CLASSTYPE_SUPER (current_class
));
8744 const char *n
= IDENTIFIER_POINTER (DECL_NAME (sclass_decl
));
8745 parse_error_context (lookup_cl (TYPE_NAME (current_class
)),
8746 "No constructor matching `%s()' found in "
8747 "class `%s'", n
, n
);
8750 start_artificial_method_body (mdecl
);
8752 /* We don't generate a super constructor invocation if we're
8753 compiling java.lang.Object. build_super_invocation takes care
8755 compound
= java_method_add_stmt (mdecl
, build_super_invocation ());
8757 end_artificial_method_body (mdecl
);
8759 /* Search for an explicit constructor invocation */
8763 tree main_block
= BLOCK_EXPR_BODY (body
);
8764 tree compound
= NULL_TREE
;
8767 switch (TREE_CODE (body
))
8770 found
= CALL_EXPLICIT_CONSTRUCTOR_P (body
);
8774 case EXPR_WITH_FILE_LOCATION
:
8775 body
= TREE_OPERAND (body
, 0);
8778 body
= BLOCK_EXPR_BODY (body
);
8784 /* The constructor is missing an invocation of super() */
8786 compound
= add_stmt_to_compound (compound
, NULL_TREE
,
8787 build_super_invocation ());
8789 /* Fix the constructor main block if we're adding extra stmts */
8792 compound
= add_stmt_to_compound (compound
, NULL_TREE
,
8793 BLOCK_EXPR_BODY (main_block
));
8794 BLOCK_EXPR_BODY (main_block
) = compound
;
8799 /* Browse constructors in the super class, searching for a constructor
8800 that doesn't take any argument. Return 0 if one is found, 1
8804 verify_constructor_super ()
8806 tree
class = CLASSTYPE_SUPER (current_class
);
8813 for (mdecl
= TYPE_METHODS (class); mdecl
; mdecl
= TREE_CHAIN (mdecl
))
8815 if (DECL_CONSTRUCTOR_P (mdecl
)
8816 && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl
)))
8824 /* Expand finals. */
8827 java_expand_finals ()
8831 /* Generate code for all context remembered for code generation. */
8834 java_expand_classes ()
8836 int save_error_count
= 0;
8837 java_parse_abort_on_error ();
8838 if (!(ctxp
= ctxp_for_generation
))
8840 java_layout_classes ();
8841 java_parse_abort_on_error ();
8843 for (; ctxp_for_generation
; ctxp_for_generation
= ctxp_for_generation
->next
)
8845 ctxp
= ctxp_for_generation
;
8846 lang_init_source (2); /* Error msgs have method prototypes */
8847 java_complete_expand_methods (); /* Complete and expand method bodies */
8848 java_parse_abort_on_error ();
8849 java_expand_finals (); /* Expand and check the finals */
8850 java_parse_abort_on_error ();
8851 java_check_final (); /* Check unitialized final */
8852 java_parse_abort_on_error ();
8856 /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
8857 a tree list node containing RIGHT. Fore coming RIGHTs will be
8858 chained to this hook. LOCATION contains the location of the
8859 separating `.' operator. */
8862 make_qualified_primary (primary
, right
, location
)
8863 tree primary
, right
;
8868 /* We want to process THIS . xxx symbolicaly, to keep it consistent
8869 with the way we're processing SUPER. A THIS from a primary as a
8870 different form than a SUPER. Turn THIS into something symbolic */
8871 if (TREE_CODE (primary
) == THIS_EXPR
)
8873 wfl
= build_wfl_node (this_identifier_node
);
8874 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (primary
);
8875 wfl
= make_qualified_name (wfl
, right
, location
);
8876 PRIMARY_P (wfl
) = 1;
8879 /* Other non WFL node are wrapped around a WFL */
8880 else if (TREE_CODE (primary
) != EXPR_WITH_FILE_LOCATION
)
8882 wfl
= build_expr_wfl (NULL_TREE
, ctxp
->filename
, 0, 0);
8883 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (primary
);
8884 EXPR_WFL_QUALIFICATION (wfl
) = build_tree_list (primary
, NULL_TREE
);
8889 if (!EXPR_WFL_QUALIFICATION (primary
))
8890 EXPR_WFL_QUALIFICATION (primary
) =
8891 build_tree_list (primary
, NULL_TREE
);
8894 EXPR_WFL_LINECOL (right
) = location
;
8895 chainon (EXPR_WFL_QUALIFICATION (wfl
), build_tree_list (right
, NULL_TREE
));
8896 PRIMARY_P (wfl
) = 1;
8900 /* Simple merge of two name separated by a `.' */
8903 merge_qualified_name (left
, right
)
8907 obstack_grow (&temporary_obstack
, IDENTIFIER_POINTER (left
),
8908 IDENTIFIER_LENGTH (left
));
8909 obstack_1grow (&temporary_obstack
, '.');
8910 obstack_grow0 (&temporary_obstack
, IDENTIFIER_POINTER (right
),
8911 IDENTIFIER_LENGTH (right
));
8912 node
= get_identifier (obstack_base (&temporary_obstack
));
8913 obstack_free (&temporary_obstack
, obstack_base (&temporary_obstack
));
8914 QUALIFIED_P (node
) = 1;
8918 /* Merge the two parts of a qualified name into LEFT. Set the
8919 location information of the resulting node to LOCATION, usually
8920 inherited from the location information of the `.' operator. */
8923 make_qualified_name (left
, right
, location
)
8927 #ifdef USE_COMPONENT_REF
8928 tree node
= build (COMPONENT_REF
, NULL_TREE
, left
, right
);
8929 EXPR_WFL_LINECOL (node
) = location
;
8932 tree left_id
= EXPR_WFL_NODE (left
);
8933 tree right_id
= EXPR_WFL_NODE (right
);
8936 merge
= merge_qualified_name (left_id
, right_id
);
8938 /* Left wasn't qualified and is now qualified */
8939 if (!QUALIFIED_P (left_id
))
8941 tree wfl
= build_expr_wfl (left_id
, ctxp
->filename
, 0, 0);
8942 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (left
);
8943 EXPR_WFL_QUALIFICATION (left
) = build_tree_list (wfl
, NULL_TREE
);
8946 wfl
= build_expr_wfl (right_id
, ctxp
->filename
, 0, 0);
8947 EXPR_WFL_LINECOL (wfl
) = location
;
8948 chainon (EXPR_WFL_QUALIFICATION (left
), build_tree_list (wfl
, NULL_TREE
));
8950 EXPR_WFL_NODE (left
) = merge
;
8955 /* Extract the last identifier component of the qualified in WFL. The
8956 last identifier is removed from the linked list */
8959 cut_identifier_in_qualified (wfl
)
8963 tree previous
= NULL_TREE
;
8964 for (q
= EXPR_WFL_QUALIFICATION (wfl
); ; previous
= q
, q
= TREE_CHAIN (q
))
8965 if (!TREE_CHAIN (q
))
8968 fatal ("Operating on a non qualified qualified WFL - "
8969 "cut_identifier_in_qualified");
8970 TREE_CHAIN (previous
) = NULL_TREE
;
8971 return TREE_PURPOSE (q
);
8975 /* Resolve the expression name NAME. Return its decl. */
8978 resolve_expression_name (id
, orig
)
8982 tree name
= EXPR_WFL_NODE (id
);
8985 /* 6.5.5.1: Simple expression names */
8986 if (!PRIMARY_P (id
) && !QUALIFIED_P (name
))
8988 /* 15.13.1: NAME can appear within the scope of a local variable
8990 if ((decl
= IDENTIFIER_LOCAL_VALUE (name
)))
8993 /* 15.13.1: NAME can appear within a class declaration */
8996 decl
= lookup_field_wrapper (current_class
, name
);
8999 int fs
= FIELD_STATIC (decl
);
9000 /* Instance variable (8.3.1.1) can't appear within
9001 static method, static initializer or initializer for
9002 a static variable. */
9003 if (!fs
&& METHOD_STATIC (current_function_decl
))
9005 static_ref_err (id
, name
, current_class
);
9006 return error_mark_node
;
9008 /* Instance variables can't appear as an argument of
9009 an explicit constructor invocation */
9010 if (!fs
&& ctxp
->explicit_constructor_p
)
9013 (id
, "Can't reference `%s' before the superclass "
9014 "constructor has been called", IDENTIFIER_POINTER (name
));
9015 return error_mark_node
;
9018 /* Otherwise build what it takes to access the field */
9019 decl
= build_field_ref ((fs
? NULL_TREE
: current_this
),
9020 DECL_CONTEXT (decl
), name
);
9021 if (fs
&& !flag_emit_class_files
&& !flag_emit_xref
)
9022 decl
= build_class_init (DECL_CONTEXT (decl
), decl
);
9023 /* We may be asked to save the real field access node */
9026 /* And we return what we got */
9029 /* Fall down to error report on undefined variable */
9032 /* 6.5.5.2 Qualified Expression Names */
9037 qualify_ambiguous_name (id
);
9038 /* 15.10.1 Field Access Using a Primary and/or Expression Name */
9039 /* 15.10.2: Accessing Superclass Members using super */
9040 return resolve_field_access (id
, NULL
, NULL
);
9043 /* We've got an error here */
9044 parse_error_context (id
, "Undefined variable `%s'",
9045 IDENTIFIER_POINTER (name
));
9047 return error_mark_node
;
9051 static_ref_err (wfl
, field_id
, class_type
)
9052 tree wfl
, field_id
, class_type
;
9056 "Can't make a static reference to nonstatic variable `%s' in class `%s'",
9057 IDENTIFIER_POINTER (field_id
),
9058 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type
))));
9061 /* 15.10.1 Field Acess Using a Primary and/or Expression Name.
9062 We return something suitable to generate the field access. We also
9063 return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
9064 recipient's address can be null. */
9067 resolve_field_access (qual_wfl
, field_decl
, field_type
)
9069 tree
*field_decl
, *field_type
;
9073 tree decl
, where_found
, type_found
;
9075 if (resolve_qualified_expression_name (qual_wfl
, &decl
,
9076 &where_found
, &type_found
))
9077 return error_mark_node
;
9079 /* Resolve the LENGTH field of an array here */
9080 if (DECL_NAME (decl
) == length_identifier_node
&& TYPE_ARRAY_P (type_found
)
9081 && ! flag_emit_class_files
&& ! flag_emit_xref
)
9083 tree length
= build_java_array_length_access (where_found
);
9085 build_java_arraynull_check (type_found
, length
, int_type_node
);
9087 /* We might have been trying to resolve field.method(). In which
9088 case, the resolution is over and decl is the answer */
9089 else if (JDECL_P (decl
) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl
)) == decl
)
9091 else if (JDECL_P (decl
))
9093 int static_final_found
= 0;
9095 type_found
= DECL_CONTEXT (decl
);
9096 is_static
= JDECL_P (decl
) && FIELD_STATIC (decl
);
9097 if (FIELD_FINAL (decl
)
9098 && JPRIMITIVE_TYPE_P (TREE_TYPE (decl
))
9099 && DECL_LANG_SPECIFIC (decl
)
9100 && DECL_INITIAL (decl
))
9102 field_ref
= DECL_INITIAL (decl
);
9103 static_final_found
= 1;
9106 field_ref
= build_field_ref ((is_static
&& !flag_emit_xref
?
9107 NULL_TREE
: where_found
),
9108 type_found
, DECL_NAME (decl
));
9109 if (field_ref
== error_mark_node
)
9110 return error_mark_node
;
9111 if (is_static
&& !static_final_found
9112 && !flag_emit_class_files
&& !flag_emit_xref
)
9114 field_ref
= build_class_init (type_found
, field_ref
);
9115 /* If the static field was identified by an expression that
9116 needs to be generated, make the field access a compound
9117 expression whose first part is the evaluation of the
9118 field selector part. */
9119 if (where_found
&& TREE_CODE (where_found
) != TYPE_DECL
9120 && TREE_CODE (where_found
) != RECORD_TYPE
)
9122 tree type
= QUAL_DECL_TYPE (field_ref
);
9123 if (TREE_CODE (type
) == RECORD_TYPE
)
9124 type
= build_pointer_type (type
);
9125 field_ref
= build (COMPOUND_EXPR
, type
, where_found
, field_ref
);
9135 *field_type
= (QUAL_DECL_TYPE (decl
) ?
9136 QUAL_DECL_TYPE (decl
) : TREE_TYPE (decl
));
9140 /* If NODE is an access to f static field, strip out the class
9141 initialization part and return the field decl, otherwise, return
9145 strip_out_static_field_access_decl (node
)
9148 if (TREE_CODE (node
) == COMPOUND_EXPR
)
9150 tree op1
= TREE_OPERAND (node
, 1);
9151 if (TREE_CODE (op1
) == COMPOUND_EXPR
)
9153 tree call
= TREE_OPERAND (op1
, 0);
9154 if (TREE_CODE (call
) == CALL_EXPR
9155 && TREE_CODE (TREE_OPERAND (call
, 0)) == ADDR_EXPR
9156 && TREE_OPERAND (TREE_OPERAND (call
, 0), 0)
9157 == soft_initclass_node
)
9158 return TREE_OPERAND (op1
, 1);
9164 /* 6.5.5.2: Qualified Expression Names */
9167 resolve_qualified_expression_name (wfl
, found_decl
, where_found
, type_found
)
9169 tree
*found_decl
, *type_found
, *where_found
;
9171 int from_type
= 0; /* Field search initiated from a type */
9172 int from_super
= 0, from_cast
= 0;
9173 int previous_call_static
= 0;
9175 tree decl
= NULL_TREE
, type
= NULL_TREE
, q
;
9176 *type_found
= *where_found
= NULL_TREE
;
9178 for (q
= EXPR_WFL_QUALIFICATION (wfl
); q
; q
= TREE_CHAIN (q
))
9180 tree qual_wfl
= QUAL_WFL (q
);
9181 tree ret_decl
; /* for EH checking */
9182 int location
; /* for EH checking */
9184 /* 15.10.1 Field Access Using a Primary */
9185 switch (TREE_CODE (qual_wfl
))
9188 case NEW_CLASS_EXPR
:
9189 /* If the access to the function call is a non static field,
9190 build the code to access it. */
9191 if (JDECL_P (decl
) && !FIELD_STATIC (decl
))
9193 decl
= maybe_access_field (decl
, *where_found
,
9194 DECL_CONTEXT (decl
));
9195 if (decl
== error_mark_node
)
9198 /* And code for the function call */
9199 if (complete_function_arguments (qual_wfl
))
9202 if (from_super
&& TREE_CODE (qual_wfl
) == CALL_EXPR
)
9203 CALL_USING_SUPER (qual_wfl
) = 1;
9204 location
= (TREE_CODE (qual_wfl
) == CALL_EXPR
?
9205 EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl
, 0)) : 0);
9206 *where_found
= patch_method_invocation (qual_wfl
, decl
, type
,
9207 &is_static
, &ret_decl
);
9208 if (*where_found
== error_mark_node
)
9210 *type_found
= type
= QUAL_DECL_TYPE (*where_found
);
9214 check_thrown_exceptions (location
, ret_decl
);
9216 /* If the previous call was static and this one is too,
9217 build a compound expression to hold the two (because in
9218 that case, previous function calls aren't transported as
9219 forcoming function's argument. */
9220 if (previous_call_static
&& is_static
)
9222 decl
= build (COMPOUND_EXPR
, type
, decl
, *where_found
);
9223 TREE_SIDE_EFFECTS (decl
) = 1;
9227 previous_call_static
= is_static
;
9228 decl
= *where_found
;
9232 case NEW_ARRAY_EXPR
:
9233 *where_found
= decl
= java_complete_tree (qual_wfl
);
9234 if (decl
== error_mark_node
)
9236 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9237 CLASS_LOADED_P (type
) = 1;
9241 *where_found
= decl
= java_complete_tree (qual_wfl
);
9242 if (decl
== error_mark_node
)
9244 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9248 case CONDITIONAL_EXPR
:
9250 *where_found
= decl
= java_complete_tree (qual_wfl
);
9251 if (decl
== error_mark_node
)
9253 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9257 /* If the access to the function call is a non static field,
9258 build the code to access it. */
9259 if (JDECL_P (decl
) && !FIELD_STATIC (decl
))
9261 decl
= maybe_access_field (decl
, *where_found
, type
);
9262 if (decl
== error_mark_node
)
9265 /* And code for the array reference expression */
9266 decl
= java_complete_tree (qual_wfl
);
9267 if (decl
== error_mark_node
)
9269 type
= QUAL_DECL_TYPE (decl
);
9273 /* Fix for -Wall Just go to the next statement. Don't
9278 /* If we fall here, we weren't processing a (static) function call. */
9279 previous_call_static
= 0;
9281 /* It can be the keyword THIS */
9282 if (EXPR_WFL_NODE (qual_wfl
) == this_identifier_node
)
9287 (wfl
, "Keyword `this' used outside allowed context");
9290 /* We have to generate code for intermediate acess */
9291 *where_found
= decl
= current_this
;
9292 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9296 /* 15.10.2 Accessing Superclass Members using SUPER */
9297 if (EXPR_WFL_NODE (qual_wfl
) == super_identifier_node
)
9300 /* Check on the restricted use of SUPER */
9301 if (METHOD_STATIC (current_function_decl
)
9302 || current_class
== object_type_node
)
9305 (wfl
, "Keyword `super' used outside allowed context");
9308 /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
9309 node
= build_cast (EXPR_WFL_LINECOL (qual_wfl
),
9310 CLASSTYPE_SUPER (current_class
),
9311 build_this (EXPR_WFL_LINECOL (qual_wfl
)));
9312 *where_found
= decl
= java_complete_tree (node
);
9313 if (decl
== error_mark_node
)
9315 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9316 from_super
= from_type
= 1;
9320 /* 15.13.1: Can't search for field name in packages, so we
9321 assume a variable/class name was meant. */
9322 if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
9324 tree name
= resolve_package (wfl
, &q
);
9327 *where_found
= decl
= resolve_no_layout (name
, qual_wfl
);
9328 /* We wan't to be absolutely that the class is laid
9329 out. We're going to search something inside it. */
9330 *type_found
= type
= TREE_TYPE (decl
);
9331 layout_class (type
);
9333 /* Should be a list, really. FIXME */
9334 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q
))) = 1;
9335 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q
))) = 0;
9339 if (from_super
|| from_cast
)
9341 ((from_cast
? qual_wfl
: wfl
),
9342 "No variable `%s' defined in class `%s'",
9343 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9344 lang_printable_name (type
, 0));
9347 (qual_wfl
, "Undefined variable or class name: `%s'",
9348 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)));
9353 /* We have a type name. It's been already resolved when the
9354 expression was qualified. */
9355 else if (RESOLVE_TYPE_NAME_P (qual_wfl
))
9357 if (!(decl
= QUAL_RESOLUTION (q
)))
9358 return 1; /* Error reported already */
9360 if (not_accessible_p (TREE_TYPE (decl
), decl
, 0))
9363 (qual_wfl
, "Can't access %s field `%s.%s' from `%s'",
9364 java_accstring_lookup (get_access_flags_from_decl (decl
)),
9365 GET_TYPE_NAME (type
),
9366 IDENTIFIER_POINTER (DECL_NAME (decl
)),
9367 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))));
9370 check_deprecation (qual_wfl
, decl
);
9372 type
= TREE_TYPE (decl
);
9375 /* We resolve and expression name */
9378 tree field_decl
= NULL_TREE
;
9380 /* If there exists an early resolution, use it. That occurs
9381 only once and we know that there are more things to
9382 come. Don't do that when processing something after SUPER
9383 (we need more thing to be put in place below */
9384 if (!from_super
&& QUAL_RESOLUTION (q
))
9386 decl
= QUAL_RESOLUTION (q
);
9389 if (TREE_CODE (decl
) == FIELD_DECL
&& !FIELD_STATIC (decl
))
9392 *where_found
= current_this
;
9395 static_ref_err (qual_wfl
, DECL_NAME (decl
),
9402 *where_found
= TREE_TYPE (decl
);
9403 if (TREE_CODE (*where_found
) == POINTER_TYPE
)
9404 *where_found
= TREE_TYPE (*where_found
);
9409 /* We have to search for a field, knowing the type of its
9410 container. The flag FROM_TYPE indicates that we resolved
9411 the last member of the expression as a type name, which
9412 means that for the resolution of this field, we'll look
9413 for other errors than if it was resolved as a member of
9418 tree field_decl_type
; /* For layout */
9420 if (!from_type
&& !JREFERENCE_TYPE_P (type
))
9423 (qual_wfl
, "Attempt to reference field `%s' in `%s %s'",
9424 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9425 lang_printable_name (type
, 0),
9426 IDENTIFIER_POINTER (DECL_NAME (field_decl
)));
9430 field_decl
= lookup_field_wrapper (type
,
9431 EXPR_WFL_NODE (qual_wfl
));
9432 if (field_decl
== NULL_TREE
)
9435 (qual_wfl
, "No variable `%s' defined in type `%s'",
9436 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9437 GET_TYPE_NAME (type
));
9440 if (field_decl
== error_mark_node
)
9443 /* Layout the type of field_decl, since we may need
9444 it. Don't do primitive types or loaded classes. The
9445 situation of non primitive arrays may not handled
9446 properly here. FIXME */
9447 if (TREE_CODE (TREE_TYPE (field_decl
)) == POINTER_TYPE
)
9448 field_decl_type
= TREE_TYPE (TREE_TYPE (field_decl
));
9450 field_decl_type
= TREE_TYPE (field_decl
);
9451 if (!JPRIMITIVE_TYPE_P (field_decl_type
)
9452 && !CLASS_LOADED_P (field_decl_type
)
9453 && !TYPE_ARRAY_P (field_decl_type
))
9454 resolve_and_layout (field_decl_type
, NULL_TREE
);
9455 if (TYPE_ARRAY_P (field_decl_type
))
9456 CLASS_LOADED_P (field_decl_type
) = 1;
9458 /* Check on accessibility here */
9459 if (not_accessible_p (type
, field_decl
, from_super
))
9463 "Can't access %s field `%s.%s' from `%s'",
9464 java_accstring_lookup
9465 (get_access_flags_from_decl (field_decl
)),
9466 GET_TYPE_NAME (type
),
9467 IDENTIFIER_POINTER (DECL_NAME (field_decl
)),
9469 (DECL_NAME (TYPE_NAME (current_class
))));
9472 check_deprecation (qual_wfl
, field_decl
);
9474 /* There are things to check when fields are accessed
9475 from type. There are no restrictions on a static
9476 declaration of the field when it is accessed from an
9478 is_static
= FIELD_STATIC (field_decl
);
9479 if (!from_super
&& from_type
9480 && !TYPE_INTERFACE_P (type
) && !is_static
)
9482 static_ref_err (qual_wfl
, EXPR_WFL_NODE (qual_wfl
), type
);
9485 from_cast
= from_super
= 0;
9487 /* If we need to generate something to get a proper
9488 handle on what this field is accessed from, do it
9492 decl
= maybe_access_field (decl
, *where_found
, *type_found
);
9493 if (decl
== error_mark_node
)
9497 /* We want to keep the location were found it, and the type
9499 *where_found
= decl
;
9502 /* This is the decl found and eventually the next one to
9507 type
= QUAL_DECL_TYPE (decl
);
9514 /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
9515 can't be accessed from REFERENCE (a record type). */
9517 int not_accessible_p (reference
, member
, from_super
)
9518 tree reference
, member
;
9521 int access_flag
= get_access_flags_from_decl (member
);
9523 /* Access always granted for members declared public */
9524 if (access_flag
& ACC_PUBLIC
)
9527 /* Check access on protected members */
9528 if (access_flag
& ACC_PROTECTED
)
9530 /* Access granted if it occurs from within the package
9531 containing the class in which the protected member is
9533 if (class_in_current_package (DECL_CONTEXT (member
)))
9536 /* If accessed with the form `super.member', then access is granted */
9540 /* Otherwise, access is granted if occuring from the class where
9541 member is declared or a subclass of it */
9542 if (inherits_from_p (reference
, current_class
))
9547 /* Check access on private members. Access is granted only if it
9548 occurs from within the class in witch it is declared */
9549 if (access_flag
& ACC_PRIVATE
)
9550 return (current_class
== DECL_CONTEXT (member
) ? 0 : 1);
9552 /* Default access are permitted only when occuring within the
9553 package in which the type (REFERENCE) is declared. In other words,
9554 REFERENCE is defined in the current package */
9556 return !class_in_current_package (reference
);
9558 /* Otherwise, access is granted */
9562 /* Test deprecated decl access. */
9564 check_deprecation (wfl
, decl
)
9567 const char *file
= DECL_SOURCE_FILE (decl
);
9568 /* Complain if the field is deprecated and the file it was defined
9569 in isn't compiled at the same time the file which contains its
9571 if (DECL_DEPRECATED (decl
)
9572 && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file
)))
9575 switch (TREE_CODE (decl
))
9578 strcpy (the
, "method");
9581 strcpy (the
, "field");
9584 strcpy (the
, "class");
9587 fatal ("unexpected DECL code - check_deprecation");
9589 parse_warning_context
9590 (wfl
, "The %s `%s' in class `%s' has been deprecated",
9591 the
, lang_printable_name (decl
, 0),
9592 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl
)))));
9596 /* Returns 1 if class was declared in the current package, 0 otherwise */
9599 class_in_current_package (class)
9602 static tree cache
= NULL_TREE
;
9609 qualified_flag
= QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
9611 /* If the current package is empty and the name of CLASS is
9612 qualified, class isn't in the current package. If there is a
9613 current package and the name of the CLASS is not qualified, class
9614 isn't in the current package */
9615 if ((!ctxp
->package
&& qualified_flag
) || (ctxp
->package
&& !qualified_flag
))
9618 /* If there is not package and the name of CLASS isn't qualified,
9619 they belong to the same unnamed package */
9620 if (!ctxp
->package
&& !qualified_flag
)
9623 /* Compare the left part of the name of CLASS with the package name */
9624 breakdown_qualified (&left
, NULL
, DECL_NAME (TYPE_NAME (class)));
9625 if (ctxp
->package
== left
)
9633 /* This function may generate code to access DECL from WHERE. This is
9634 done only if certain conditions meet. */
9637 maybe_access_field (decl
, where
, type
)
9638 tree decl
, where
, type
;
9640 if (TREE_CODE (decl
) == FIELD_DECL
&& decl
!= current_this
9641 && !FIELD_STATIC (decl
))
9642 decl
= build_field_ref (where
? where
: current_this
,
9643 (type
? type
: DECL_CONTEXT (decl
)),
9648 /* Build a method invocation, by patching PATCH. If non NULL
9649 and according to the situation, PRIMARY and WHERE may be
9650 used. IS_STATIC is set to 1 if the invoked function is static. */
9653 patch_method_invocation (patch
, primary
, where
, is_static
, ret_decl
)
9654 tree patch
, primary
, where
;
9658 tree wfl
= TREE_OPERAND (patch
, 0);
9659 tree args
= TREE_OPERAND (patch
, 1);
9660 tree name
= EXPR_WFL_NODE (wfl
);
9662 int is_static_flag
= 0;
9663 int is_super_init
= 0;
9664 tree this_arg
= NULL_TREE
;
9666 /* Should be overriden if everything goes well. Otherwise, if
9667 something fails, it should keep this value. It stop the
9668 evaluation of a bogus assignment. See java_complete_tree,
9669 MODIFY_EXPR: for the reasons why we sometimes want to keep on
9670 evaluating an assignment */
9671 TREE_TYPE (patch
) = error_mark_node
;
9673 /* Since lookup functions are messing with line numbers, save the
9675 java_parser_context_save_global ();
9677 /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
9679 /* Resolution of qualified name, excluding constructors */
9680 if (QUALIFIED_P (name
) && !CALL_CONSTRUCTOR_P (patch
))
9682 tree class_decl
, identifier
, identifier_wfl
;
9683 /* Extract the last IDENTIFIER of the qualified
9684 expression. This is a wfl and we will use it's location
9685 data during error report. */
9686 identifier_wfl
= cut_identifier_in_qualified (wfl
);
9687 identifier
= EXPR_WFL_NODE (identifier_wfl
);
9689 /* Given the context, IDENTIFIER is syntactically qualified
9690 as a MethodName. We need to qualify what's before */
9691 qualify_ambiguous_name (wfl
);
9693 /* Package resolution */
9694 if (RESOLVE_PACKAGE_NAME_P (wfl
))
9696 tree next
, decl
, name
= resolve_package (wfl
, &next
);
9701 breakdown_qualified (&remainder
, NULL
, EXPR_WFL_NODE (wfl
));
9702 parse_error_context (wfl
, "Can't search method `%s' in package "
9703 "`%s'",IDENTIFIER_POINTER (identifier
),
9704 IDENTIFIER_POINTER (remainder
));
9705 PATCH_METHOD_RETURN_ERROR ();
9707 RESOLVE_PACKAGE_NAME_P (wfl
) = 0;
9708 if ((decl
= resolve_no_layout (name
, QUAL_WFL (next
))))
9710 QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl
)) = decl
;
9711 RESOLVE_EXPRESSION_NAME_P (wfl
) = 0;
9712 RESOLVE_TYPE_NAME_P (wfl
) = 1;
9716 RESOLVE_EXPRESSION_NAME_P (wfl
) = 1;
9717 RESOLVE_TYPE_NAME_P (wfl
) = 0;
9721 /* We're resolving a call from a type */
9722 if (RESOLVE_TYPE_NAME_P (wfl
))
9724 tree decl
= QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl
));
9725 tree name
= DECL_NAME (decl
);
9728 class_decl
= resolve_and_layout (name
, wfl
);
9729 if (CLASS_INTERFACE (decl
))
9732 (identifier_wfl
, "Can't make static reference to method "
9733 "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier
),
9734 IDENTIFIER_POINTER (name
));
9735 PATCH_METHOD_RETURN_ERROR ();
9737 /* Look the method up in the type selector. The method ought
9739 type
= TREE_TYPE (class_decl
);
9740 list
= lookup_method_invoke (0, wfl
, type
, identifier
, args
);
9741 if (list
&& !METHOD_STATIC (list
))
9743 char *fct_name
= strdup (lang_printable_name (list
, 0));
9746 "Can't make static reference to method `%s %s' in class `%s'",
9747 lang_printable_name (TREE_TYPE (TREE_TYPE (list
)), 0),
9748 fct_name
, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type
))));
9750 PATCH_METHOD_RETURN_ERROR ();
9752 args
= nreverse (args
);
9754 /* We're resolving an expression name */
9759 /* 1- Find the field to which the call applies */
9760 field
= resolve_field_access (wfl
, NULL
, &type
);
9761 if (field
== error_mark_node
)
9762 PATCH_METHOD_RETURN_ERROR ();
9763 /* field is used in lieu of a primary. It alows us not to
9764 report errors on erroneous use of `this' in
9768 /* 2- Do the layout of the class where the last field
9769 was found, so we can search it. */
9770 class_decl
= resolve_and_layout (type
, NULL_TREE
);
9771 if (class_decl
!= NULL_TREE
)
9772 type
= TREE_TYPE (class_decl
);
9774 /* 3- Retrieve a filtered list of method matches, Refine
9775 if necessary. In any cases, point out errors. */
9776 list
= lookup_method_invoke (0, identifier_wfl
, type
,
9779 /* 4- Add the field as an argument */
9780 args
= nreverse (args
);
9784 /* IDENTIFIER_WFL will be used to report any problem further */
9785 wfl
= identifier_wfl
;
9787 /* Resolution of simple names, names generated after a primary: or
9791 tree class_to_search
= NULL_TREE
;
9792 int lc
; /* Looking for Constructor */
9794 /* We search constructor in their target class */
9795 if (CALL_CONSTRUCTOR_P (patch
))
9797 if (TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9798 class_to_search
= EXPR_WFL_NODE (wfl
);
9799 else if (EXPR_WFL_NODE (TREE_OPERAND (patch
, 0)) ==
9800 this_identifier_node
)
9801 class_to_search
= NULL_TREE
;
9802 else if (EXPR_WFL_NODE (TREE_OPERAND (patch
, 0)) ==
9803 super_identifier_node
)
9806 if (CLASSTYPE_SUPER (current_class
))
9808 DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class
)));
9811 parse_error_context (wfl
, "Can't invoke super constructor "
9812 "on java.lang.Object");
9813 PATCH_METHOD_RETURN_ERROR ();
9817 /* Class to search is NULL if we're searching the current one */
9818 if (class_to_search
)
9820 class_to_search
= resolve_and_layout (class_to_search
,
9822 if (!class_to_search
)
9825 (wfl
, "Class `%s' not found in type declaration",
9826 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
9827 PATCH_METHOD_RETURN_ERROR ();
9830 /* Can't instantiate an abstract class, but we can
9831 invoke it's constructor. It's use within the `new'
9832 context is denied here. */
9833 if (CLASS_ABSTRACT (class_to_search
)
9834 && TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9837 (wfl
, "Class `%s' is an abstract class. It can't be "
9838 "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
9839 PATCH_METHOD_RETURN_ERROR ();
9841 class_to_search
= TREE_TYPE (class_to_search
);
9844 class_to_search
= current_class
;
9847 /* This is a regular search in the local class, unless an
9848 alternate class is specified. */
9851 class_to_search
= (where
? where
: current_class
);
9855 /* NAME is a simple identifier or comes from a primary. Search
9856 in the class whose declaration contain the method being
9858 resolve_and_layout (class_to_search
, NULL_TREE
);
9859 list
= lookup_method_invoke (lc
, wfl
, class_to_search
, name
, args
);
9861 /* Don't continue if no method were found, as the next statement
9862 can't be executed then. */
9864 PATCH_METHOD_RETURN_ERROR ();
9866 /* Check for static reference if non static methods */
9867 if (check_for_static_method_reference (wfl
, patch
, list
,
9868 class_to_search
, primary
))
9869 PATCH_METHOD_RETURN_ERROR ();
9871 /* Non static methods are called with the current object extra
9872 argument. If patch a `new TYPE()', the argument is the value
9873 returned by the object allocator. If method is resolved as a
9874 primary, use the primary otherwise use the current THIS. */
9875 args
= nreverse (args
);
9876 if (TREE_CODE (patch
) != NEW_CLASS_EXPR
)
9877 this_arg
= primary
? primary
: current_this
;
9880 /* Merge point of all resolution schemes. If we have nothing, this
9881 is an error, already signaled */
9883 PATCH_METHOD_RETURN_ERROR ();
9885 /* Check accessibility, position the is_static flag, build and
9887 if (not_accessible_p (DECL_CONTEXT (current_function_decl
), list
, 0))
9889 char *fct_name
= strdup (lang_printable_name (list
, 0));
9891 (wfl
, "Can't access %s method `%s %s.%s' from `%s'",
9892 java_accstring_lookup (get_access_flags_from_decl (list
)),
9893 lang_printable_name (TREE_TYPE (TREE_TYPE (list
)), 0),
9894 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list
)))),
9895 fct_name
, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))));
9897 PATCH_METHOD_RETURN_ERROR ();
9899 check_deprecation (wfl
, list
);
9901 is_static_flag
= METHOD_STATIC (list
);
9902 if (! METHOD_STATIC (list
) && this_arg
!= NULL_TREE
)
9903 args
= tree_cons (NULL_TREE
, this_arg
, args
);
9905 /* In the context of an explicit constructor invocation, we can't
9906 invoke any method relying on `this'. Exceptions are: we're
9907 invoking a static function, primary exists and is not the current
9908 this, we're creating a new object. */
9909 if (ctxp
->explicit_constructor_p
9911 && (!primary
|| primary
== current_this
)
9912 && (TREE_CODE (patch
) != NEW_CLASS_EXPR
))
9915 (wfl
, "Can't reference `this' before the superclass constructor has "
9917 PATCH_METHOD_RETURN_ERROR ();
9919 java_parser_context_restore_global ();
9921 *is_static
= is_static_flag
;
9922 /* Sometimes, we want the decl of the selected method. Such as for
9926 patch
= patch_invoke (patch
, list
, args
);
9927 if (is_super_init
&& CLASS_HAS_FINIT_P (current_class
))
9929 /* Generate the code used to initialize fields declared with an
9930 initialization statement. For now, it returns a call the the
9931 artificial function $finit$, if required. */
9934 build_method_invocation (build_expr_wfl (finit_identifier_node
,
9935 input_filename
, 0, 0),
9937 patch
= build (COMPOUND_EXPR
, void_type_node
, patch
,
9938 java_complete_tree (finit_call
));
9939 CAN_COMPLETE_NORMALLY (patch
) = 1;
9944 /* Check that we're not trying to do a static reference to a method in
9945 non static method. Return 1 if it's the case, 0 otherwise. */
9948 check_for_static_method_reference (wfl
, node
, method
, where
, primary
)
9949 tree wfl
, node
, method
, where
, primary
;
9951 if (METHOD_STATIC (current_function_decl
)
9952 && !METHOD_STATIC (method
) && !primary
&& !CALL_CONSTRUCTOR_P (node
))
9954 char *fct_name
= strdup (lang_printable_name (method
, 0));
9956 (wfl
, "Can't make static reference to method `%s %s' in class `%s'",
9957 lang_printable_name (TREE_TYPE (TREE_TYPE (method
)), 0), fct_name
,
9958 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where
))));
9965 /* Patch an invoke expression METHOD and ARGS, based on its invocation
9969 patch_invoke (patch
, method
, args
)
9970 tree patch
, method
, args
;
9973 tree original_call
, t
, ta
;
9975 /* Last step for args: convert build-in types. If we're dealing with
9976 a new TYPE() type call, the first argument to the constructor
9977 isn't found in the incomming argument list, but delivered by
9979 t
= TYPE_ARG_TYPES (TREE_TYPE (method
));
9980 if (TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9982 for (ta
= args
; t
!= end_params_node
&& ta
;
9983 t
= TREE_CHAIN (t
), ta
= TREE_CHAIN (ta
))
9984 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta
))) &&
9985 TREE_TYPE (TREE_VALUE (ta
)) != TREE_VALUE (t
))
9986 TREE_VALUE (ta
) = convert (TREE_VALUE (t
), TREE_VALUE (ta
));
9988 /* Resolve unresolved returned type isses */
9989 t
= TREE_TYPE (TREE_TYPE (method
));
9990 if (TREE_CODE (t
) == POINTER_TYPE
&& !CLASS_LOADED_P (TREE_TYPE (t
)))
9991 resolve_and_layout (TREE_TYPE (t
), NULL
);
9993 if (flag_emit_class_files
|| flag_emit_xref
)
9997 tree signature
= build_java_signature (TREE_TYPE (method
));
9998 switch (invocation_mode (method
, CALL_USING_SUPER (patch
)))
10000 case INVOKE_VIRTUAL
:
10001 dtable
= invoke_build_dtable (0, args
);
10002 func
= build_invokevirtual (dtable
, method
);
10006 case INVOKE_STATIC
:
10007 func
= build_known_method_ref (method
, TREE_TYPE (method
),
10008 DECL_CONTEXT (method
),
10012 case INVOKE_INTERFACE
:
10013 dtable
= invoke_build_dtable (1, args
);
10014 func
= build_invokeinterface (dtable
, DECL_NAME (method
), signature
);
10018 fatal ("internal error - unknown invocation_mode result");
10021 /* Ensure self_type is initialized, (invokestatic). FIXME */
10022 func
= build1 (NOP_EXPR
, build_pointer_type (TREE_TYPE (method
)), func
);
10025 TREE_TYPE (patch
) = TREE_TYPE (TREE_TYPE (method
));
10026 TREE_OPERAND (patch
, 0) = func
;
10027 TREE_OPERAND (patch
, 1) = args
;
10028 original_call
= patch
;
10030 /* We're processing a `new TYPE ()' form. New is called an its
10031 returned value is the first argument to the constructor. We build
10032 a COMPOUND_EXPR and use saved expression so that the overall NEW
10033 expression value is a pointer to a newly created and initialized
10035 if (TREE_CODE (original_call
) == NEW_CLASS_EXPR
)
10037 tree
class = DECL_CONTEXT (method
);
10038 tree c1
, saved_new
, size
, new;
10039 if (flag_emit_class_files
|| flag_emit_xref
)
10041 TREE_TYPE (patch
) = build_pointer_type (class);
10044 if (!TYPE_SIZE (class))
10045 safe_layout_class (class);
10046 size
= size_in_bytes (class);
10047 new = build (CALL_EXPR
, promote_type (class),
10048 build_address_of (alloc_object_node
),
10049 tree_cons (NULL_TREE
, build_class_ref (class),
10050 build_tree_list (NULL_TREE
,
10051 size_in_bytes (class))),
10053 saved_new
= save_expr (new);
10054 c1
= build_tree_list (NULL_TREE
, saved_new
);
10055 TREE_CHAIN (c1
) = TREE_OPERAND (original_call
, 1);
10056 TREE_OPERAND (original_call
, 1) = c1
;
10057 TREE_SET_CODE (original_call
, CALL_EXPR
);
10058 patch
= build (COMPOUND_EXPR
, TREE_TYPE (new), patch
, saved_new
);
10064 invocation_mode (method
, super
)
10068 int access
= get_access_flags_from_decl (method
);
10071 return INVOKE_SUPER
;
10073 if (access
& ACC_STATIC
|| access
& ACC_FINAL
|| access
& ACC_PRIVATE
)
10074 return INVOKE_STATIC
;
10076 if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method
))))
10077 return INVOKE_STATIC
;
10079 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method
))))
10080 return INVOKE_INTERFACE
;
10082 if (DECL_CONSTRUCTOR_P (method
))
10083 return INVOKE_STATIC
;
10085 return INVOKE_VIRTUAL
;
10088 /* Retrieve a refined list of matching methods. It covers the step
10089 15.11.2 (Compile-Time Step 2) */
10092 lookup_method_invoke (lc
, cl
, class, name
, arg_list
)
10095 tree
class, name
, arg_list
;
10097 tree atl
= end_params_node
; /* Arg Type List */
10098 tree method
, signature
, list
, node
;
10099 const char *candidates
; /* Used for error report */
10101 /* Fix the arguments */
10102 for (node
= arg_list
; node
; node
= TREE_CHAIN (node
))
10104 tree current_arg
= TREE_TYPE (TREE_VALUE (node
));
10105 /* Non primitive type may have to be resolved */
10106 if (!JPRIMITIVE_TYPE_P (current_arg
))
10107 resolve_and_layout (current_arg
, NULL_TREE
);
10109 if (TREE_CODE (current_arg
) == RECORD_TYPE
)
10110 current_arg
= promote_type (current_arg
);
10111 atl
= tree_cons (NULL_TREE
, current_arg
, atl
);
10114 /* Find all candidates and then refine the list, searching for the
10115 most specific method. */
10116 list
= find_applicable_accessible_methods_list (lc
, class, name
, atl
);
10117 list
= find_most_specific_methods_list (list
);
10118 if (list
&& !TREE_CHAIN (list
))
10119 return TREE_VALUE (list
);
10121 /* Issue an error. List candidates if any. Candidates are listed
10122 only if accessible (non accessible methods may end-up here for
10123 the sake of a better error report). */
10128 obstack_grow (&temporary_obstack
, ". Candidates are:\n", 18);
10129 for (current
= list
; current
; current
= TREE_CHAIN (current
))
10131 tree cm
= TREE_VALUE (current
);
10132 char string
[4096];
10133 if (!cm
|| not_accessible_p (class, cm
, 0))
10136 (string
, " `%s' in `%s'%s",
10137 get_printable_method_name (cm
),
10138 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm
)))),
10139 (TREE_CHAIN (current
) ? "\n" : ""));
10140 obstack_grow (&temporary_obstack
, string
, strlen (string
));
10142 obstack_1grow (&temporary_obstack
, '\0');
10143 candidates
= obstack_finish (&temporary_obstack
);
10145 /* Issue the error message */
10146 method
= make_node (FUNCTION_TYPE
);
10147 TYPE_ARG_TYPES (method
) = atl
;
10148 signature
= build_java_argument_signature (method
);
10149 parse_error_context (cl
, "Can't find %s `%s(%s)' in class `%s'%s",
10150 (lc
? "constructor" : "method"),
10152 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))) :
10153 IDENTIFIER_POINTER (name
)),
10154 IDENTIFIER_POINTER (signature
),
10155 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
10156 (candidates
? candidates
: ""));
10160 /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
10161 when we're looking for a constructor. */
10164 find_applicable_accessible_methods_list (lc
, class, name
, arglist
)
10166 tree
class, name
, arglist
;
10168 tree list
= NULL_TREE
, all_list
= NULL_TREE
;
10170 /* Search interfaces */
10171 if (CLASS_INTERFACE (TYPE_NAME (class)))
10173 static tree searched_interfaces
= NULL_TREE
;
10174 static int search_not_done
= 0;
10176 tree basetype_vec
= TYPE_BINFO_BASETYPES (class);
10178 /* Have we searched this interface already? */
10179 if (searched_interfaces
)
10182 for (current
= searched_interfaces
;
10183 current
; current
= TREE_CHAIN (current
))
10184 if (TREE_VALUE (current
) == class)
10187 searched_interfaces
= tree_cons (NULL_TREE
, class, searched_interfaces
);
10189 search_applicable_methods_list
10190 (lc
, TYPE_METHODS (class), name
, arglist
, &list
, &all_list
);
10192 n
= TREE_VEC_LENGTH (basetype_vec
);
10193 for (i
= 0; i
< n
; i
++)
10195 tree t
= BINFO_TYPE (TREE_VEC_ELT (basetype_vec
, i
));
10198 /* Skip java.lang.Object (we'll search it once later.) */
10199 if (t
== object_type_node
)
10203 rlist
= find_applicable_accessible_methods_list (lc
, t
, name
,
10205 all_list
= chainon (rlist
, (list
? list
: all_list
));
10209 /* We're done. Reset the searched interfaces list and finally search
10210 java.lang.Object */
10211 if (!search_not_done
)
10213 searched_interfaces
= NULL_TREE
;
10214 search_applicable_methods_list (lc
, TYPE_METHODS (object_type_node
),
10215 name
, arglist
, &list
, &all_list
);
10218 /* Search classes */
10220 while (class != NULL_TREE
)
10222 search_applicable_methods_list
10223 (lc
, TYPE_METHODS (class), name
, arglist
, &list
, &all_list
);
10224 class = (lc
? NULL_TREE
: CLASSTYPE_SUPER (class));
10227 /* Either return the list obtained or all selected (but
10228 inaccessible) methods for better error report. */
10229 return (!list
? all_list
: list
);
10232 /* Effectively search for the approriate method in method */
10235 search_applicable_methods_list(lc
, method
, name
, arglist
, list
, all_list
)
10237 tree method
, name
, arglist
;
10238 tree
*list
, *all_list
;
10240 for (; method
; method
= TREE_CHAIN (method
))
10242 /* When dealing with constructor, stop here, otherwise search
10244 if (lc
&& !DECL_CONSTRUCTOR_P (method
))
10246 else if (!lc
&& (DECL_CONSTRUCTOR_P (method
)
10247 || (GET_METHOD_NAME (method
) != name
)))
10250 if (argument_types_convertible (method
, arglist
))
10252 /* Retain accessible methods only */
10253 if (!not_accessible_p (DECL_CONTEXT (current_function_decl
),
10255 *list
= tree_cons (NULL_TREE
, method
, *list
);
10257 /* Also retain all selected method here */
10258 *all_list
= tree_cons (NULL_TREE
, method
, *list
);
10263 /* 15.11.2.2 Choose the Most Specific Method */
10266 find_most_specific_methods_list (list
)
10270 tree current
, new_list
= NULL_TREE
;
10271 for (current
= list
; current
; current
= TREE_CHAIN (current
))
10274 DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) = 0;
10276 for (method
= list
; method
; method
= TREE_CHAIN (method
))
10278 /* Don't test a method against itself */
10279 if (method
== current
)
10282 /* Compare arguments and location where method where declared */
10283 if (argument_types_convertible (TREE_VALUE (method
),
10284 TREE_VALUE (current
))
10285 && valid_method_invocation_conversion_p
10286 (DECL_CONTEXT (TREE_VALUE (method
)),
10287 DECL_CONTEXT (TREE_VALUE (current
))))
10289 int v
= ++DECL_SPECIFIC_COUNT (TREE_VALUE (current
));
10290 max
= (v
> max
? v
: max
);
10295 /* Review the list and select the maximally specific methods */
10296 for (current
= list
; current
; current
= TREE_CHAIN (current
))
10297 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) == max
)
10298 new_list
= tree_cons (NULL_TREE
, TREE_VALUE (current
), new_list
);
10300 /* If we can't find one, lower expectations and try to gather multiple
10301 maximally specific methods */
10306 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) == max
)
10307 new_list
= tree_cons (NULL_TREE
, TREE_VALUE (current
), new_list
);
10315 /* Make sure that the type of each M2_OR_ARGLIST arguments can be
10316 converted by method invocation conversion (5.3) to the type of the
10317 corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
10318 to change less often than M1. */
10321 argument_types_convertible (m1
, m2_or_arglist
)
10322 tree m1
, m2_or_arglist
;
10324 static tree m2_arg_value
= NULL_TREE
;
10325 static tree m2_arg_cache
= NULL_TREE
;
10327 register tree m1_arg
, m2_arg
;
10329 m1_arg
= TYPE_ARG_TYPES (TREE_TYPE (m1
));
10330 if (!METHOD_STATIC (m1
))
10331 m1_arg
= TREE_CHAIN (m1_arg
);
10333 if (m2_arg_value
== m2_or_arglist
)
10334 m2_arg
= m2_arg_cache
;
10337 /* M2_OR_ARGLIST can be a function DECL or a raw list of
10339 if (m2_or_arglist
&& TREE_CODE (m2_or_arglist
) == FUNCTION_DECL
)
10341 m2_arg
= TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist
));
10342 if (!METHOD_STATIC (m2_or_arglist
))
10343 m2_arg
= TREE_CHAIN (m2_arg
);
10346 m2_arg
= m2_or_arglist
;
10348 m2_arg_value
= m2_or_arglist
;
10349 m2_arg_cache
= m2_arg
;
10352 while (m1_arg
!= end_params_node
&& m2_arg
!= end_params_node
)
10354 resolve_and_layout (TREE_VALUE (m1_arg
), NULL_TREE
);
10355 if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg
),
10356 TREE_VALUE (m2_arg
)))
10358 m1_arg
= TREE_CHAIN (m1_arg
);
10359 m2_arg
= TREE_CHAIN (m2_arg
);
10361 return m1_arg
== end_params_node
&& m2_arg
== end_params_node
;
10364 /* Qualification routines */
10367 qualify_ambiguous_name (id
)
10370 tree qual
, qual_wfl
, name
= NULL_TREE
, decl
, ptr_type
= NULL_TREE
,
10371 saved_current_class
;
10372 int again
, super_found
= 0, this_found
= 0, new_array_found
= 0;
10375 /* We first qualify the first element, then derive qualification of
10376 others based on the first one. If the first element is qualified
10377 by a resolution (field or type), this resolution is stored in the
10378 QUAL_RESOLUTION of the qual element being examined. We need to
10379 save the current_class since the use of SUPER might change the
10381 saved_current_class
= current_class
;
10382 qual
= EXPR_WFL_QUALIFICATION (id
);
10385 /* Simple qualified expression feature a qual_wfl that is a
10386 WFL. Expression derived from a primary feature more complicated
10387 things like a CALL_EXPR. Expression from primary need to be
10388 worked out to extract the part on which the qualification will
10390 qual_wfl
= QUAL_WFL (qual
);
10391 switch (TREE_CODE (qual_wfl
))
10394 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
10395 if (TREE_CODE (qual_wfl
) != EXPR_WITH_FILE_LOCATION
)
10397 qual
= EXPR_WFL_QUALIFICATION (qual_wfl
);
10398 qual_wfl
= QUAL_WFL (qual
);
10401 case NEW_ARRAY_EXPR
:
10402 qual
= TREE_CHAIN (qual
);
10403 again
= new_array_found
= 1;
10405 case NEW_CLASS_EXPR
:
10407 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
10410 while (TREE_CODE (qual_wfl
) == ARRAY_REF
)
10411 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
10414 qual
= TREE_CHAIN (qual
);
10415 qual_wfl
= QUAL_WFL (qual
);
10418 /* Fix for -Wall. Just break doing nothing */
10422 ptr_type
= current_class
;
10424 code
= TREE_CODE (qual_wfl
);
10426 /* Pos evaluation: non WFL leading expression nodes */
10427 if (code
== CONVERT_EXPR
10428 && TREE_CODE (TREE_TYPE (qual_wfl
)) == EXPR_WITH_FILE_LOCATION
)
10429 name
= EXPR_WFL_NODE (TREE_TYPE (qual_wfl
));
10431 else if (code
== ARRAY_REF
&&
10432 TREE_CODE (TREE_OPERAND (qual_wfl
, 0)) == EXPR_WITH_FILE_LOCATION
)
10433 name
= EXPR_WFL_NODE (TREE_OPERAND (qual_wfl
, 0));
10435 else if (code
== CALL_EXPR
&&
10436 TREE_CODE (TREE_OPERAND (qual_wfl
, 0)) == EXPR_WITH_FILE_LOCATION
)
10437 name
= EXPR_WFL_NODE (TREE_OPERAND (qual_wfl
, 0));
10439 else if (code
== STRING_CST
|| code
== CONDITIONAL_EXPR
)
10441 qual
= TREE_CHAIN (qual
);
10442 qual_wfl
= QUAL_WFL (qual
);
10446 name
= EXPR_WFL_NODE (qual_wfl
);
10448 /* If we have a THIS (from a primary), we set the context accordingly */
10449 if (name
== this_identifier_node
)
10451 qual
= TREE_CHAIN (qual
);
10452 qual_wfl
= QUAL_WFL (qual
);
10453 if (TREE_CODE (qual_wfl
) == CALL_EXPR
)
10456 name
= EXPR_WFL_NODE (qual_wfl
);
10459 /* If we have a SUPER, we set the context accordingly */
10460 if (name
== super_identifier_node
)
10462 current_class
= CLASSTYPE_SUPER (ptr_type
);
10463 /* Check that there is such a thing as a super class. If not,
10464 return. The error will be caught later on, during the
10466 if (!current_class
)
10468 current_class
= saved_current_class
;
10471 qual
= TREE_CHAIN (qual
);
10472 /* Do one more interation to set things up */
10473 super_found
= again
= 1;
10477 /* If name appears within the scope of a location variable
10478 declaration or parameter declaration, then it is an expression
10479 name. We don't carry this test out if we're in the context of the
10480 use of SUPER or THIS */
10481 if (!this_found
&& !super_found
&&
10482 TREE_CODE (name
) != STRING_CST
&& (decl
= IDENTIFIER_LOCAL_VALUE (name
)))
10484 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
10485 QUAL_RESOLUTION (qual
) = decl
;
10488 /* If within the class/interface NAME was found to be used there
10489 exists a (possibly inherited) field named NAME, then this is an
10490 expression name. If we saw a NEW_ARRAY_EXPR before and want to
10491 address length, it is OK. */
10492 else if ((decl
= lookup_field_wrapper (ptr_type
, name
))
10493 || (new_array_found
&& name
== length_identifier_node
))
10495 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
10496 QUAL_RESOLUTION (qual
) = (new_array_found
? NULL_TREE
: decl
);
10499 /* We reclassify NAME as yielding to a type name resolution if:
10500 - NAME is a class/interface declared within the compilation
10501 unit containing NAME,
10502 - NAME is imported via a single-type-import declaration,
10503 - NAME is declared in an another compilation unit of the package
10504 of the compilation unit containing NAME,
10505 - NAME is declared by exactly on type-import-on-demand declaration
10506 of the compilation unit containing NAME.
10507 - NAME is actually a STRING_CST. */
10508 else if (TREE_CODE (name
) == STRING_CST
||
10509 (decl
= resolve_and_layout (name
, NULL_TREE
)))
10511 RESOLVE_TYPE_NAME_P (qual_wfl
) = 1;
10512 QUAL_RESOLUTION (qual
) = decl
;
10515 /* Method call are expression name */
10516 else if (TREE_CODE (QUAL_WFL (qual
)) == CALL_EXPR
10517 || TREE_CODE (QUAL_WFL (qual
)) == ARRAY_REF
10518 || TREE_CODE (QUAL_WFL (qual
)) == CONVERT_EXPR
)
10519 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
10521 /* Check here that NAME isn't declared by more than one
10522 type-import-on-demand declaration of the compilation unit
10523 containing NAME. FIXME */
10525 /* Otherwise, NAME is reclassified as a package name */
10527 RESOLVE_PACKAGE_NAME_P (qual_wfl
) = 1;
10529 /* Propagate the qualification accross other components of the
10531 for (qual
= TREE_CHAIN (qual
); qual
;
10532 qual_wfl
= QUAL_WFL (qual
), qual
= TREE_CHAIN (qual
))
10534 if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
10535 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual
)) = 1;
10537 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual
)) = 1;
10540 /* Store the global qualification for the ambiguous part of ID back
10542 if (RESOLVE_EXPRESSION_NAME_P (qual_wfl
))
10543 RESOLVE_EXPRESSION_NAME_P (id
) = 1;
10544 else if (RESOLVE_TYPE_NAME_P (qual_wfl
))
10545 RESOLVE_TYPE_NAME_P (id
) = 1;
10546 else if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
10547 RESOLVE_PACKAGE_NAME_P (id
) = 1;
10549 /* Restore the current class */
10550 current_class
= saved_current_class
;
10554 breakdown_qualified (left
, right
, source
)
10555 tree
*left
, *right
, source
;
10557 char *p
= IDENTIFIER_POINTER (source
), *base
;
10558 int l
= IDENTIFIER_LENGTH (source
);
10560 /* Breakdown NAME into REMAINDER . IDENTIFIER */
10563 while (*p
!= '.' && p
!= base
)
10566 /* We didn't find a '.'. Return an error */
10572 *right
= get_identifier (p
+1);
10573 *left
= get_identifier (IDENTIFIER_POINTER (source
));
10579 /* Patch tree nodes in a function body. When a BLOCK is found, push
10580 local variable decls if present.
10581 Same as java_complete_lhs, but does resolve static finals to values. */
10584 java_complete_tree (node
)
10587 node
= java_complete_lhs (node
);
10588 if (TREE_CODE (node
) == VAR_DECL
&& FIELD_STATIC (node
)
10589 && FIELD_FINAL (node
) && DECL_INITIAL (node
) != NULL_TREE
10590 && !flag_emit_xref
)
10592 tree value
= DECL_INITIAL (node
);
10593 DECL_INITIAL (node
) = NULL_TREE
;
10594 value
= fold_constant_for_init (value
, node
);
10595 DECL_INITIAL (node
) = value
;
10596 if (value
!= NULL_TREE
)
10603 java_stabilize_reference (node
)
10606 if (TREE_CODE (node
) == COMPOUND_EXPR
)
10608 tree op0
= TREE_OPERAND (node
, 0);
10609 tree op1
= TREE_OPERAND (node
, 1);
10610 TREE_OPERAND (node
, 0) = save_expr (op0
);
10611 TREE_OPERAND (node
, 1) = java_stabilize_reference (op1
);
10614 return stabilize_reference (node
);
10617 /* Patch tree nodes in a function body. When a BLOCK is found, push
10618 local variable decls if present.
10619 Same as java_complete_tree, but does not resolve static finals to values. */
10622 java_complete_lhs (node
)
10625 tree nn
, cn
, wfl_op1
, wfl_op2
, wfl_op3
;
10628 /* CONVERT_EXPR always has its type set, even though it needs to be
10630 if (TREE_TYPE (node
) && TREE_CODE (node
) != CONVERT_EXPR
)
10633 /* The switch block implements cases processing container nodes
10634 first. Contained nodes are always written back. Leaves come
10635 next and return a value. */
10636 switch (TREE_CODE (node
))
10640 /* 1- Block section.
10641 Set the local values on decl names so we can identify them
10642 faster when they're referenced. At that stage, identifiers
10643 are legal so we don't check for declaration errors. */
10644 for (cn
= BLOCK_EXPR_DECLS (node
); cn
; cn
= TREE_CHAIN (cn
))
10646 DECL_CONTEXT (cn
) = current_function_decl
;
10647 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn
)) = cn
;
10649 if (BLOCK_EXPR_BODY (node
) == NULL_TREE
)
10650 CAN_COMPLETE_NORMALLY (node
) = 1;
10653 tree stmt
= BLOCK_EXPR_BODY (node
);
10655 int error_seen
= 0;
10656 if (TREE_CODE (stmt
) == COMPOUND_EXPR
)
10658 /* Re-order from (((A; B); C); ...; Z) to
10659 (A; (B; (C ; (...; Z)))).
10660 This makes it easier to scan the statements left-to-right
10661 without using recursion (which might overflow the stack
10662 if the block has many statements. */
10665 tree left
= TREE_OPERAND (stmt
, 0);
10666 if (TREE_CODE (left
) != COMPOUND_EXPR
)
10668 TREE_OPERAND (stmt
, 0) = TREE_OPERAND (left
, 1);
10669 TREE_OPERAND (left
, 1) = stmt
;
10672 BLOCK_EXPR_BODY (node
) = stmt
;
10675 /* Now do the actual complete, without deep recursion for
10677 ptr
= &BLOCK_EXPR_BODY (node
);
10678 while (TREE_CODE (*ptr
) == COMPOUND_EXPR
10679 && TREE_OPERAND (*ptr
, 1) != empty_stmt_node
)
10681 tree cur
= java_complete_tree (TREE_OPERAND (*ptr
, 0));
10682 tree
*next
= &TREE_OPERAND (*ptr
, 1);
10683 TREE_OPERAND (*ptr
, 0) = cur
;
10684 if (cur
== empty_stmt_node
)
10686 /* Optimization; makes it easier to detect empty bodies.
10687 Most useful for <clinit> with all-constant initializer. */
10691 if (TREE_CODE (cur
) == ERROR_MARK
)
10693 else if (! CAN_COMPLETE_NORMALLY (cur
))
10698 if (TREE_CODE (wfl_op2
) == BLOCK
)
10699 wfl_op2
= BLOCK_EXPR_BODY (wfl_op2
);
10700 else if (TREE_CODE (wfl_op2
) == COMPOUND_EXPR
)
10701 wfl_op2
= TREE_OPERAND (wfl_op2
, 0);
10705 if (TREE_CODE (wfl_op2
) != CASE_EXPR
10706 && TREE_CODE (wfl_op2
) != DEFAULT_EXPR
)
10707 unreachable_stmt_error (*ptr
);
10711 *ptr
= java_complete_tree (*ptr
);
10713 if (TREE_CODE (*ptr
) == ERROR_MARK
|| error_seen
> 0)
10714 return error_mark_node
;
10715 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (*ptr
);
10717 /* Turn local bindings to null */
10718 for (cn
= BLOCK_EXPR_DECLS (node
); cn
; cn
= TREE_CHAIN (cn
))
10719 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn
)) = NULL_TREE
;
10721 TREE_TYPE (node
) = void_type_node
;
10724 /* 2- They are expressions but ultimately deal with statements */
10727 wfl_op1
= TREE_OPERAND (node
, 0);
10728 COMPLETE_CHECK_OP_0 (node
);
10729 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10730 return patch_throw_statement (node
, wfl_op1
);
10732 case SYNCHRONIZED_EXPR
:
10733 wfl_op1
= TREE_OPERAND (node
, 0);
10734 return patch_synchronized_statement (node
, wfl_op1
);
10737 return patch_try_statement (node
);
10739 case TRY_FINALLY_EXPR
:
10740 COMPLETE_CHECK_OP_0 (node
);
10741 COMPLETE_CHECK_OP_1 (node
);
10742 CAN_COMPLETE_NORMALLY (node
)
10743 = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 0))
10744 && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1)));
10745 TREE_TYPE (node
) = TREE_TYPE (TREE_OPERAND (node
, 0));
10748 case CLEANUP_POINT_EXPR
:
10749 COMPLETE_CHECK_OP_0 (node
);
10750 TREE_TYPE (node
) = void_type_node
;
10751 CAN_COMPLETE_NORMALLY (node
) =
10752 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 0));
10755 case WITH_CLEANUP_EXPR
:
10756 COMPLETE_CHECK_OP_0 (node
);
10757 COMPLETE_CHECK_OP_2 (node
);
10758 CAN_COMPLETE_NORMALLY (node
) =
10759 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 0));
10760 TREE_TYPE (node
) = void_type_node
;
10763 case LABELED_BLOCK_EXPR
:
10764 PUSH_LABELED_BLOCK (node
);
10765 if (LABELED_BLOCK_BODY (node
))
10766 COMPLETE_CHECK_OP_1 (node
);
10767 TREE_TYPE (node
) = void_type_node
;
10768 POP_LABELED_BLOCK ();
10770 if (LABELED_BLOCK_BODY (node
) == empty_stmt_node
)
10772 LABELED_BLOCK_BODY (node
) = NULL_TREE
;
10773 CAN_COMPLETE_NORMALLY (node
) = 1;
10775 else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node
)))
10776 CAN_COMPLETE_NORMALLY (node
) = 1;
10779 case EXIT_BLOCK_EXPR
:
10780 /* We don't complete operand 1, because it's the return value of
10781 the EXIT_BLOCK_EXPR which doesn't exist it Java */
10782 return patch_bc_statement (node
);
10785 cn
= java_complete_tree (TREE_OPERAND (node
, 0));
10786 if (cn
== error_mark_node
)
10789 /* First, the case expression must be constant. Values of final
10790 fields are accepted. */
10792 if ((TREE_CODE (cn
) == COMPOUND_EXPR
|| TREE_CODE (cn
) == COMPONENT_REF
)
10793 && JDECL_P (TREE_OPERAND (cn
, 1))
10794 && FIELD_FINAL (TREE_OPERAND (cn
, 1))
10795 && DECL_INITIAL (TREE_OPERAND (cn
, 1)))
10796 cn
= fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn
, 1)),
10797 TREE_OPERAND (cn
, 1));
10799 if (!TREE_CONSTANT (cn
) && !flag_emit_xref
)
10801 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10802 parse_error_context (node
, "Constant expression required");
10803 return error_mark_node
;
10806 nn
= ctxp
->current_loop
;
10808 /* It must be assignable to the type of the switch expression. */
10809 if (!try_builtin_assignconv (NULL_TREE
,
10810 TREE_TYPE (TREE_OPERAND (nn
, 0)), cn
))
10812 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10813 parse_error_context
10815 "Incompatible type for case. Can't convert `%s' to `int'",
10816 lang_printable_name (TREE_TYPE (cn
), 0));
10817 return error_mark_node
;
10820 cn
= fold (convert (int_type_node
, cn
));
10822 /* Multiple instance of a case label bearing the same
10823 value is checked during code generation. The case
10824 expression is allright so far. */
10825 TREE_OPERAND (node
, 0) = cn
;
10826 TREE_TYPE (node
) = void_type_node
;
10827 CAN_COMPLETE_NORMALLY (node
) = 1;
10828 TREE_SIDE_EFFECTS (node
) = 1;
10832 nn
= ctxp
->current_loop
;
10833 /* Only one default label is allowed per switch statement */
10834 if (SWITCH_HAS_DEFAULT (nn
))
10836 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10837 parse_error_context (wfl_operator
,
10838 "Duplicate case label: `default'");
10839 return error_mark_node
;
10842 SWITCH_HAS_DEFAULT (nn
) = 1;
10843 TREE_TYPE (node
) = void_type_node
;
10844 TREE_SIDE_EFFECTS (node
) = 1;
10845 CAN_COMPLETE_NORMALLY (node
) = 1;
10851 /* Check whether the loop was enclosed in a labeled
10852 statement. If not, create one, insert the loop in it and
10854 nn
= patch_loop_statement (node
);
10856 /* Anyways, walk the body of the loop */
10857 if (TREE_CODE (node
) == LOOP_EXPR
)
10858 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10859 /* Switch statement: walk the switch expression and the cases */
10861 node
= patch_switch_statement (node
);
10863 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10864 nn
= error_mark_node
;
10867 TREE_TYPE (nn
) = TREE_TYPE (node
) = void_type_node
;
10868 /* If we returned something different, that's because we
10869 inserted a label. Pop the label too. */
10872 if (CAN_COMPLETE_NORMALLY (node
))
10873 CAN_COMPLETE_NORMALLY (nn
) = 1;
10874 POP_LABELED_BLOCK ();
10881 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10882 return patch_exit_expr (node
);
10886 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10887 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10888 return error_mark_node
;
10889 /* then-else branches */
10890 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
10891 if (TREE_OPERAND (node
, 1) == error_mark_node
)
10892 return error_mark_node
;
10893 TREE_OPERAND (node
, 2) = java_complete_tree (TREE_OPERAND (node
, 2));
10894 if (TREE_OPERAND (node
, 2) == error_mark_node
)
10895 return error_mark_node
;
10896 return patch_if_else_statement (node
);
10899 case CONDITIONAL_EXPR
:
10901 wfl_op1
= TREE_OPERAND (node
, 0);
10902 COMPLETE_CHECK_OP_0 (node
);
10903 wfl_op2
= TREE_OPERAND (node
, 1);
10904 COMPLETE_CHECK_OP_1 (node
);
10905 wfl_op3
= TREE_OPERAND (node
, 2);
10906 COMPLETE_CHECK_OP_2 (node
);
10907 return patch_conditional_expr (node
, wfl_op1
, wfl_op2
);
10909 /* 3- Expression section */
10910 case COMPOUND_EXPR
:
10911 wfl_op2
= TREE_OPERAND (node
, 1);
10912 TREE_OPERAND (node
, 0) = nn
=
10913 java_complete_tree (TREE_OPERAND (node
, 0));
10914 if (wfl_op2
== empty_stmt_node
)
10915 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (nn
);
10918 if (! CAN_COMPLETE_NORMALLY (nn
) && TREE_CODE (nn
) != ERROR_MARK
)
10920 /* An unreachable condition in a do-while statement
10921 is *not* (technically) an unreachable statement. */
10923 if (TREE_CODE (nn
) == EXPR_WITH_FILE_LOCATION
)
10924 nn
= EXPR_WFL_NODE (nn
);
10925 if (TREE_CODE (nn
) != EXIT_EXPR
)
10927 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op2
);
10928 parse_error_context (wfl_operator
, "Unreachable statement");
10931 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
10932 if (TREE_OPERAND (node
, 1) == error_mark_node
)
10933 return error_mark_node
;
10934 CAN_COMPLETE_NORMALLY (node
)
10935 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1));
10937 TREE_TYPE (node
) = TREE_TYPE (TREE_OPERAND (node
, 1));
10941 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10942 return patch_return (node
);
10944 case EXPR_WITH_FILE_LOCATION
:
10945 if (!EXPR_WFL_NODE (node
) /* Or a PRIMARY flag ? */
10946 || TREE_CODE (EXPR_WFL_NODE (node
)) == IDENTIFIER_NODE
)
10949 node
= resolve_expression_name (node
, NULL
);
10950 if (node
== error_mark_node
)
10952 /* Keep line number information somewhere were it doesn't
10953 disrupt the completion process. */
10954 if (flag_emit_xref
&& TREE_CODE (node
) != CALL_EXPR
)
10956 EXPR_WFL_NODE (wfl
) = TREE_OPERAND (node
, 1);
10957 TREE_OPERAND (node
, 1) = wfl
;
10959 CAN_COMPLETE_NORMALLY (node
) = 1;
10964 int save_lineno
= lineno
;
10965 lineno
= EXPR_WFL_LINENO (node
);
10966 body
= java_complete_tree (EXPR_WFL_NODE (node
));
10967 lineno
= save_lineno
;
10968 EXPR_WFL_NODE (node
) = body
;
10969 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (body
);
10970 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (body
);
10971 if (body
== empty_stmt_node
)
10973 /* Optimization; makes it easier to detect empty bodies. */
10976 if (body
== error_mark_node
)
10978 /* Its important for the evaluation of assignment that
10979 this mark on the TREE_TYPE is propagated. */
10980 TREE_TYPE (node
) = error_mark_node
;
10981 return error_mark_node
;
10984 TREE_TYPE (node
) = TREE_TYPE (EXPR_WFL_NODE (node
));
10989 case NEW_ARRAY_EXPR
:
10990 /* Patch all the dimensions */
10992 for (cn
= TREE_OPERAND (node
, 1); cn
; cn
= TREE_CHAIN (cn
))
10994 int location
= EXPR_WFL_LINECOL (TREE_VALUE (cn
));
10995 tree dim
= java_complete_tree (TREE_VALUE (cn
));
10996 if (dim
== error_mark_node
)
11003 TREE_VALUE (cn
) = dim
;
11004 /* Setup the location of the current dimension, for
11005 later error report. */
11006 TREE_PURPOSE (cn
) =
11007 build_expr_wfl (NULL_TREE
, input_filename
, 0, 0);
11008 EXPR_WFL_LINECOL (TREE_PURPOSE (cn
)) = location
;
11011 /* They complete the array creation expression, if no errors
11013 CAN_COMPLETE_NORMALLY (node
) = 1;
11014 return (flag
? error_mark_node
11015 : force_evaluation_order (patch_newarray (node
)));
11017 case NEW_CLASS_EXPR
:
11019 /* Complete function's argument(s) first */
11020 if (complete_function_arguments (node
))
11021 return error_mark_node
;
11024 tree decl
, wfl
= TREE_OPERAND (node
, 0);
11025 int in_this
= CALL_THIS_CONSTRUCTOR_P (node
);
11027 node
= patch_method_invocation (node
, NULL_TREE
,
11028 NULL_TREE
, 0, &decl
);
11029 if (node
== error_mark_node
)
11030 return error_mark_node
;
11032 check_thrown_exceptions (EXPR_WFL_LINECOL (node
), decl
);
11033 /* If we call this(...), register signature and positions */
11035 DECL_CONSTRUCTOR_CALLS (current_function_decl
) =
11036 tree_cons (wfl
, decl
,
11037 DECL_CONSTRUCTOR_CALLS (current_function_decl
));
11038 CAN_COMPLETE_NORMALLY (node
) = 1;
11039 return force_evaluation_order (node
);
11043 /* Save potential wfls */
11044 wfl_op1
= TREE_OPERAND (node
, 0);
11045 TREE_OPERAND (node
, 0) = nn
= java_complete_lhs (wfl_op1
);
11046 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node
)
11047 && TREE_CODE (nn
) == VAR_DECL
&& TREE_STATIC (nn
)
11048 && DECL_INITIAL (nn
) != NULL_TREE
)
11050 tree value
= fold_constant_for_init (nn
, nn
);
11051 if (value
!= NULL_TREE
)
11053 tree type
= TREE_TYPE (value
);
11054 if (JPRIMITIVE_TYPE_P (type
) || type
== string_ptr_type_node
)
11055 return empty_stmt_node
;
11057 DECL_INITIAL (nn
) = NULL_TREE
;
11059 wfl_op2
= TREE_OPERAND (node
, 1);
11061 if (TREE_OPERAND (node
, 0) == error_mark_node
)
11062 return error_mark_node
;
11064 flag
= COMPOUND_ASSIGN_P (wfl_op2
);
11067 tree lvalue
= java_stabilize_reference (TREE_OPERAND (node
, 0));
11069 /* Hand stablize the lhs on both places */
11070 TREE_OPERAND (node
, 0) = lvalue
;
11071 TREE_OPERAND (TREE_OPERAND (node
, 1), 0) =
11072 (flag_emit_class_files
? lvalue
: save_expr (lvalue
));
11074 /* 15.25.2.a: Left hand is not an array access. FIXME */
11075 /* Now complete the RHS. We write it back later on. */
11076 nn
= java_complete_tree (TREE_OPERAND (node
, 1));
11078 if ((cn
= patch_string (nn
)))
11081 /* The last part of the rewrite for E1 op= E2 is to have
11082 E1 = (T)(E1 op E2), with T being the type of E1. */
11083 nn
= java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2
),
11084 TREE_TYPE (lvalue
), nn
));
11086 /* 15.25.2.b: Left hand is an array access. FIXME */
11089 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
11090 function to complete this RHS */
11091 else if (TREE_CODE (wfl_op2
) == NEW_ARRAY_INIT
)
11092 nn
= patch_new_array_init (TREE_TYPE (TREE_OPERAND (node
, 0)),
11093 TREE_OPERAND (node
, 1));
11094 /* Otherwise we simply complete the RHS */
11096 nn
= java_complete_tree (TREE_OPERAND (node
, 1));
11098 if (nn
== error_mark_node
)
11099 return error_mark_node
;
11101 /* Write back the RHS as we evaluated it. */
11102 TREE_OPERAND (node
, 1) = nn
;
11104 /* In case we're handling = with a String as a RHS, we need to
11105 produce a String out of the RHS (it might still be a
11106 STRING_CST or a StringBuffer at this stage */
11107 if ((nn
= patch_string (TREE_OPERAND (node
, 1))))
11108 TREE_OPERAND (node
, 1) = nn
;
11109 node
= patch_assignment (node
, wfl_op1
, wfl_op2
);
11110 /* Reorganize the tree if necessary. */
11111 if (flag
&& (!JREFERENCE_TYPE_P (TREE_TYPE (node
))
11112 || JSTRING_P (TREE_TYPE (node
))))
11113 node
= java_refold (node
);
11114 CAN_COMPLETE_NORMALLY (node
) = 1;
11126 case TRUNC_MOD_EXPR
:
11128 case TRUTH_ANDIF_EXPR
:
11129 case TRUTH_ORIF_EXPR
:
11136 /* Operands 0 and 1 are WFL in certain cases only. patch_binop
11137 knows how to handle those cases. */
11138 wfl_op1
= TREE_OPERAND (node
, 0);
11139 wfl_op2
= TREE_OPERAND (node
, 1);
11141 CAN_COMPLETE_NORMALLY (node
) = 1;
11142 /* Don't complete string nodes if dealing with the PLUS operand. */
11143 if (TREE_CODE (node
) != PLUS_EXPR
|| !JSTRING_P (wfl_op1
))
11145 nn
= java_complete_tree (wfl_op1
);
11146 if (nn
== error_mark_node
)
11147 return error_mark_node
;
11148 if ((cn
= patch_string (nn
)))
11150 TREE_OPERAND (node
, 0) = nn
;
11152 if (TREE_CODE (node
) != PLUS_EXPR
|| !JSTRING_P (wfl_op2
))
11154 nn
= java_complete_tree (wfl_op2
);
11155 if (nn
== error_mark_node
)
11156 return error_mark_node
;
11157 if ((cn
= patch_string (nn
)))
11159 TREE_OPERAND (node
, 1) = nn
;
11161 return force_evaluation_order (patch_binop (node
, wfl_op1
, wfl_op2
));
11163 case INSTANCEOF_EXPR
:
11164 wfl_op1
= TREE_OPERAND (node
, 0);
11165 COMPLETE_CHECK_OP_0 (node
);
11166 if (flag_emit_xref
)
11168 TREE_TYPE (node
) = boolean_type_node
;
11171 return patch_binop (node
, wfl_op1
, TREE_OPERAND (node
, 1));
11173 case UNARY_PLUS_EXPR
:
11175 case TRUTH_NOT_EXPR
:
11177 case PREDECREMENT_EXPR
:
11178 case PREINCREMENT_EXPR
:
11179 case POSTDECREMENT_EXPR
:
11180 case POSTINCREMENT_EXPR
:
11182 /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
11183 how to handle those cases. */
11184 wfl_op1
= TREE_OPERAND (node
, 0);
11185 CAN_COMPLETE_NORMALLY (node
) = 1;
11186 TREE_OPERAND (node
, 0) = java_complete_tree (wfl_op1
);
11187 if (TREE_OPERAND (node
, 0) == error_mark_node
)
11188 return error_mark_node
;
11189 node
= patch_unaryop (node
, wfl_op1
);
11190 CAN_COMPLETE_NORMALLY (node
) = 1;
11194 /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
11195 how to handle those cases. */
11196 wfl_op1
= TREE_OPERAND (node
, 0);
11197 TREE_OPERAND (node
, 0) = java_complete_tree (wfl_op1
);
11198 if (TREE_OPERAND (node
, 0) == error_mark_node
)
11199 return error_mark_node
;
11200 if (!flag_emit_class_files
&& !flag_emit_xref
)
11201 TREE_OPERAND (node
, 0) = save_expr (TREE_OPERAND (node
, 0));
11202 /* The same applies to wfl_op2 */
11203 wfl_op2
= TREE_OPERAND (node
, 1);
11204 TREE_OPERAND (node
, 1) = java_complete_tree (wfl_op2
);
11205 if (TREE_OPERAND (node
, 1) == error_mark_node
)
11206 return error_mark_node
;
11207 if (!flag_emit_class_files
&& !flag_emit_xref
)
11208 TREE_OPERAND (node
, 1) = save_expr (TREE_OPERAND (node
, 1));
11209 return patch_array_ref (node
);
11214 case COMPONENT_REF
:
11215 /* The first step in the re-write of qualified name handling. FIXME.
11216 So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
11217 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
11218 if (TREE_CODE (TREE_OPERAND (node
, 0)) == RECORD_TYPE
)
11220 tree name
= TREE_OPERAND (node
, 1);
11221 tree field
= lookup_field_wrapper (TREE_OPERAND (node
, 0), name
);
11222 if (field
== NULL_TREE
)
11224 error ("missing static field `%s'", IDENTIFIER_POINTER (name
));
11225 return error_mark_node
;
11227 if (! FIELD_STATIC (field
))
11229 error ("not a static field `%s'", IDENTIFIER_POINTER (name
));
11230 return error_mark_node
;
11235 fatal ("unimplemented java_complete_tree for COMPONENT_REF");
11239 /* Can't use THIS in a static environment */
11242 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11243 parse_error_context (wfl_operator
, "Keyword `this' used outside "
11244 "allowed context");
11245 TREE_TYPE (node
) = error_mark_node
;
11246 return error_mark_node
;
11248 if (ctxp
->explicit_constructor_p
)
11250 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11251 parse_error_context
11252 (wfl_operator
, "Can't reference `this' or `super' before the "
11253 "superclass constructor has been called");
11254 TREE_TYPE (node
) = error_mark_node
;
11255 return error_mark_node
;
11257 return current_this
;
11260 CAN_COMPLETE_NORMALLY (node
) = 1;
11261 /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
11262 and it's time to turn it into the appropriate String object
11264 if ((node
= patch_string (node
)))
11266 fatal ("No case for tree code `%s' - java_complete_tree\n",
11267 tree_code_name
[TREE_CODE (node
)]);
11272 /* Complete function call's argument. Return a non zero value is an
11273 error was found. */
11276 complete_function_arguments (node
)
11282 ctxp
->explicit_constructor_p
+= (CALL_THIS_CONSTRUCTOR_P (node
) ? 1 : 0);
11283 for (cn
= TREE_OPERAND (node
, 1); cn
; cn
= TREE_CHAIN (cn
))
11285 tree wfl
= TREE_VALUE (cn
), parm
, temp
;
11286 parm
= java_complete_tree (wfl
);
11287 if (parm
== error_mark_node
)
11292 /* If have a string literal that we haven't transformed yet or a
11293 crafted string buffer, as a result of use of the the String
11294 `+' operator. Build `parm.toString()' and expand it. */
11295 if ((temp
= patch_string (parm
)))
11297 /* Inline PRIMTYPE.TYPE read access */
11298 parm
= maybe_build_primttype_type_ref (parm
, wfl
);
11300 TREE_VALUE (cn
) = parm
;
11302 ctxp
->explicit_constructor_p
-= (CALL_THIS_CONSTRUCTOR_P (node
) ? 1 : 0);
11306 /* Sometimes (for loops and variable initialized during their
11307 declaration), we want to wrap a statement around a WFL and turn it
11311 build_debugable_stmt (location
, stmt
)
11315 if (TREE_CODE (stmt
) != EXPR_WITH_FILE_LOCATION
)
11317 stmt
= build_expr_wfl (stmt
, input_filename
, 0, 0);
11318 EXPR_WFL_LINECOL (stmt
) = location
;
11320 JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt
);
11325 build_expr_block (body
, decls
)
11328 tree node
= make_node (BLOCK
);
11329 BLOCK_EXPR_DECLS (node
) = decls
;
11330 BLOCK_EXPR_BODY (node
) = body
;
11332 TREE_TYPE (node
) = TREE_TYPE (body
);
11333 TREE_SIDE_EFFECTS (node
) = 1;
11337 /* Create a new function block and link it approriately to current
11338 function block chain */
11343 return (enter_a_block (build_expr_block (NULL_TREE
, NULL_TREE
)));
11346 /* Link block B supercontext to the previous block. The current
11347 function DECL is used as supercontext when enter_a_block is called
11348 for the first time for a given function. The current function body
11349 (DECL_FUNCTION_BODY) is set to be block B. */
11355 tree fndecl
= current_function_decl
;
11358 BLOCK_SUPERCONTEXT (b
) = current_static_block
;
11359 current_static_block
= b
;
11362 else if (!DECL_FUNCTION_BODY (fndecl
))
11364 BLOCK_SUPERCONTEXT (b
) = fndecl
;
11365 DECL_FUNCTION_BODY (fndecl
) = b
;
11369 BLOCK_SUPERCONTEXT (b
) = DECL_FUNCTION_BODY (fndecl
);
11370 DECL_FUNCTION_BODY (fndecl
) = b
;
11375 /* Exit a block by changing the current function body
11376 (DECL_FUNCTION_BODY) to the current block super context, only if
11377 the block being exited isn't the method's top level one. */
11383 if (current_function_decl
)
11385 b
= DECL_FUNCTION_BODY (current_function_decl
);
11386 if (BLOCK_SUPERCONTEXT (b
) != current_function_decl
)
11387 DECL_FUNCTION_BODY (current_function_decl
) = BLOCK_SUPERCONTEXT (b
);
11391 b
= current_static_block
;
11393 if (BLOCK_SUPERCONTEXT (b
))
11394 current_static_block
= BLOCK_SUPERCONTEXT (b
);
11399 /* Lookup for NAME in the nested function's blocks, all the way up to
11400 the current toplevel one. It complies with Java's local variable
11404 lookup_name_in_blocks (name
)
11407 tree b
= GET_CURRENT_BLOCK (current_function_decl
);
11409 while (b
!= current_function_decl
)
11413 /* Paranoid sanity check. To be removed */
11414 if (TREE_CODE (b
) != BLOCK
)
11415 fatal ("non block expr function body - lookup_name_in_blocks");
11417 for (current
= BLOCK_EXPR_DECLS (b
); current
;
11418 current
= TREE_CHAIN (current
))
11419 if (DECL_NAME (current
) == name
)
11421 b
= BLOCK_SUPERCONTEXT (b
);
11427 maybe_absorb_scoping_blocks ()
11429 while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl
)))
11431 tree b
= exit_block ();
11432 java_method_add_stmt (current_function_decl
, b
);
11433 SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno
));
11438 /* This section of the source is reserved to build_* functions that
11439 are building incomplete tree nodes and the patch_* functions that
11440 are completing them. */
11442 /* Build a super() constructor invocation. Returns empty_stmt_node if
11443 we're currently dealing with the class java.lang.Object. */
11446 build_super_invocation ()
11448 if (current_class
== object_type_node
)
11449 return empty_stmt_node
;
11452 tree super_wfl
= build_wfl_node (super_identifier_node
);
11453 return build_method_invocation (super_wfl
, NULL_TREE
);
11457 /* Build a SUPER/THIS qualified method invocation. */
11460 build_this_super_qualified_invocation (use_this
, name
, args
, lloc
, rloc
)
11468 build_wfl_node (use_this
? this_identifier_node
: super_identifier_node
);
11469 EXPR_WFL_LINECOL (wfl
) = lloc
;
11470 invok
= build_method_invocation (name
, args
);
11471 return make_qualified_primary (wfl
, invok
, rloc
);
11474 /* Build an incomplete CALL_EXPR node. */
11477 build_method_invocation (name
, args
)
11481 tree call
= build (CALL_EXPR
, NULL_TREE
, name
, args
, NULL_TREE
);
11482 TREE_SIDE_EFFECTS (call
) = 1;
11483 EXPR_WFL_LINECOL (call
) = EXPR_WFL_LINECOL (name
);
11487 /* Build an incomplete new xxx(...) node. */
11490 build_new_invocation (name
, args
)
11493 tree call
= build (NEW_CLASS_EXPR
, NULL_TREE
, name
, args
, NULL_TREE
);
11494 TREE_SIDE_EFFECTS (call
) = 1;
11495 EXPR_WFL_LINECOL (call
) = EXPR_WFL_LINECOL (name
);
11499 /* Build an incomplete assignment expression. */
11502 build_assignment (op
, op_location
, lhs
, rhs
)
11503 int op
, op_location
;
11507 /* Build the corresponding binop if we deal with a Compound
11508 Assignment operator. Mark the binop sub-tree as part of a
11509 Compound Assignment expression */
11510 if (op
!= ASSIGN_TK
)
11512 rhs
= build_binop (BINOP_LOOKUP (op
), op_location
, lhs
, rhs
);
11513 COMPOUND_ASSIGN_P (rhs
) = 1;
11515 assignment
= build (MODIFY_EXPR
, NULL_TREE
, lhs
, rhs
);
11516 TREE_SIDE_EFFECTS (assignment
) = 1;
11517 EXPR_WFL_LINECOL (assignment
) = op_location
;
11521 /* Print an INTEGER_CST node in a static buffer, and return the buffer. */
11524 print_int_node (node
)
11527 static char buffer
[80];
11528 if (TREE_CONSTANT_OVERFLOW (node
))
11529 sprintf (buffer
, "<overflow>");
11531 if (TREE_INT_CST_HIGH (node
) == 0)
11532 sprintf (buffer
, HOST_WIDE_INT_PRINT_UNSIGNED
,
11533 TREE_INT_CST_LOW (node
));
11534 else if (TREE_INT_CST_HIGH (node
) == -1
11535 && TREE_INT_CST_LOW (node
) != 0)
11538 sprintf (&buffer
[1], HOST_WIDE_INT_PRINT_UNSIGNED
,
11539 -TREE_INT_CST_LOW (node
));
11542 sprintf (buffer
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
11543 TREE_INT_CST_HIGH (node
), TREE_INT_CST_LOW (node
));
11548 /* Return 1 if an assignment to a FINAL is attempted in a non suitable
11552 check_final_assignment (lvalue
, wfl
)
11555 if (JDECL_P (lvalue
)
11556 && FIELD_FINAL (lvalue
) && !IS_CLINIT (current_function_decl
))
11558 parse_error_context
11559 (wfl
, "Can't assign a value to the final variable `%s'",
11560 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
11566 /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
11567 read. This is needed to avoid circularities in the implementation
11568 of these fields in libjava. */
11571 maybe_build_primttype_type_ref (rhs
, wfl
)
11574 tree to_return
= NULL_TREE
;
11575 tree rhs_type
= TREE_TYPE (rhs
);
11576 if (TREE_CODE (rhs
) == COMPOUND_EXPR
)
11578 tree n
= TREE_OPERAND (rhs
, 1);
11579 if (TREE_CODE (n
) == VAR_DECL
11580 && DECL_NAME (n
) == TYPE_identifier_node
11581 && rhs_type
== class_ptr_type
)
11583 const char *self_name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
));
11584 if (!strncmp (self_name
, "java.lang.", 10))
11585 to_return
= build_primtype_type_ref (self_name
);
11588 return (to_return
? to_return
: rhs
);
11591 /* 15.25 Assignment operators. */
11594 patch_assignment (node
, wfl_op1
, wfl_op2
)
11599 tree rhs
= TREE_OPERAND (node
, 1);
11600 tree lvalue
= TREE_OPERAND (node
, 0), llvalue
;
11601 tree lhs_type
= NULL_TREE
, rhs_type
, new_rhs
= NULL_TREE
;
11602 int error_found
= 0;
11603 int lvalue_from_array
= 0;
11605 /* Can't assign to a final. */
11606 if (check_final_assignment (lvalue
, wfl_op1
))
11609 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11611 /* Lhs can be a named variable */
11612 if (JDECL_P (lvalue
))
11614 lhs_type
= TREE_TYPE (lvalue
);
11616 /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
11617 comment on reason why */
11618 else if (TREE_CODE (wfl_op1
) == ARRAY_REF
)
11620 lhs_type
= TREE_TYPE (lvalue
);
11621 lvalue_from_array
= 1;
11623 /* Or a field access */
11624 else if (TREE_CODE (lvalue
) == COMPONENT_REF
)
11625 lhs_type
= TREE_TYPE (lvalue
);
11626 /* Or a function return slot */
11627 else if (TREE_CODE (lvalue
) == RESULT_DECL
)
11628 lhs_type
= TREE_TYPE (lvalue
);
11629 /* Otherwise, we might want to try to write into an optimized static
11630 final, this is an of a different nature, reported further on. */
11631 else if (TREE_CODE (wfl_op1
) == EXPR_WITH_FILE_LOCATION
11632 && resolve_expression_name (wfl_op1
, &llvalue
))
11634 if (check_final_assignment (llvalue
, wfl_op1
))
11636 /* What we should do instead is resetting the all the flags
11637 previously set, exchange lvalue for llvalue and continue. */
11639 return error_mark_node
;
11642 lhs_type
= TREE_TYPE (lvalue
);
11646 parse_error_context (wfl_op1
, "Invalid left hand side of assignment");
11650 rhs_type
= TREE_TYPE (rhs
);
11651 /* 5.1 Try the assignment conversion for builtin type. */
11652 new_rhs
= try_builtin_assignconv (wfl_op1
, lhs_type
, rhs
);
11654 /* 5.2 If it failed, try a reference conversion */
11655 if (!new_rhs
&& (new_rhs
= try_reference_assignconv (lhs_type
, rhs
)))
11656 lhs_type
= promote_type (rhs_type
);
11658 /* 15.25.2 If we have a compound assignment, convert RHS into the
11660 else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node
, 1)))
11661 new_rhs
= convert (lhs_type
, rhs
);
11663 /* Explicit cast required. This is an error */
11666 char *t1
= strdup (lang_printable_name (TREE_TYPE (rhs
), 0));
11667 char *t2
= strdup (lang_printable_name (lhs_type
, 0));
11669 char operation
[32]; /* Max size known */
11671 /* If the assignment is part of a declaration, we use the WFL of
11672 the declared variable to point out the error and call it a
11673 declaration problem. If the assignment is a genuine =
11674 operator, we call is a operator `=' problem, otherwise we
11675 call it an assignment problem. In both of these last cases,
11676 we use the WFL of the operator to indicate the error. */
11678 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node
))
11681 strcpy (operation
, "declaration");
11685 wfl
= wfl_operator
;
11686 if (COMPOUND_ASSIGN_P (TREE_OPERAND (node
, 1)))
11687 strcpy (operation
, "assignment");
11688 else if (TREE_CODE (TREE_OPERAND (node
, 0)) == RESULT_DECL
)
11689 strcpy (operation
, "`return'");
11691 strcpy (operation
, "`='");
11694 parse_error_context
11695 (wfl
, (!valid_cast_to_p (rhs_type
, lhs_type
) ?
11696 "Incompatible type for %s. Can't convert `%s' to `%s'" :
11697 "Incompatible type for %s. Explicit cast "
11698 "needed to convert `%s' to `%s'"), operation
, t1
, t2
);
11699 free (t1
); free (t2
);
11703 /* Inline read access to java.lang.PRIMTYPE.TYPE */
11705 new_rhs
= maybe_build_primttype_type_ref (new_rhs
, wfl_op2
);
11708 return error_mark_node
;
11710 /* 10.10: Array Store Exception runtime check */
11711 if (!flag_emit_class_files
11713 && lvalue_from_array
11714 && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type
))
11715 && !CLASS_FINAL (TYPE_NAME (GET_SKIP_TYPE (rhs_type
))))
11718 tree base
= lvalue
;
11720 /* We need to retrieve the right argument for _Jv_CheckArrayStore */
11721 if (TREE_CODE (lvalue
) == COMPOUND_EXPR
)
11722 base
= TREE_OPERAND (lvalue
, 0);
11725 if (flag_bounds_check
)
11726 base
= TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base
, 0), 1), 0);
11728 base
= TREE_OPERAND (TREE_OPERAND (base
, 0), 0);
11731 /* Build the invocation of _Jv_CheckArrayStore */
11732 new_rhs
= save_expr (new_rhs
);
11733 check
= build (CALL_EXPR
, void_type_node
,
11734 build_address_of (soft_checkarraystore_node
),
11735 tree_cons (NULL_TREE
, base
,
11736 build_tree_list (NULL_TREE
, new_rhs
)),
11738 TREE_SIDE_EFFECTS (check
) = 1;
11740 /* We have to decide on an insertion point */
11741 if (TREE_CODE (lvalue
) == COMPOUND_EXPR
)
11744 if (flag_bounds_check
)
11746 t
= TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue
, 1), 0), 0);
11747 TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue
, 1), 0), 0) =
11748 build (COMPOUND_EXPR
, void_type_node
, t
, check
);
11751 TREE_OPERAND (lvalue
, 1) = build (COMPOUND_EXPR
, lhs_type
,
11752 check
, TREE_OPERAND (lvalue
, 1));
11756 /* Make sure the bound check will happen before the store check */
11757 if (flag_bounds_check
)
11758 TREE_OPERAND (TREE_OPERAND (lvalue
, 0), 0) =
11759 build (COMPOUND_EXPR
, void_type_node
,
11760 TREE_OPERAND (TREE_OPERAND (lvalue
, 0), 0), check
);
11762 lvalue
= build (COMPOUND_EXPR
, lhs_type
, check
, lvalue
);
11766 TREE_OPERAND (node
, 0) = lvalue
;
11767 TREE_OPERAND (node
, 1) = new_rhs
;
11768 TREE_TYPE (node
) = lhs_type
;
11772 /* Check that type SOURCE can be cast into type DEST. If the cast
11773 can't occur at all, return 0 otherwise 1. This function is used to
11774 produce accurate error messages on the reasons why an assignment
11778 try_reference_assignconv (lhs_type
, rhs
)
11779 tree lhs_type
, rhs
;
11781 tree new_rhs
= NULL_TREE
;
11782 tree rhs_type
= TREE_TYPE (rhs
);
11784 if (!JPRIMITIVE_TYPE_P (rhs_type
) && JREFERENCE_TYPE_P (lhs_type
))
11786 /* `null' may be assigned to any reference type */
11787 if (rhs
== null_pointer_node
)
11788 new_rhs
= null_pointer_node
;
11789 /* Try the reference assignment conversion */
11790 else if (valid_ref_assignconv_cast_p (rhs_type
, lhs_type
, 0))
11792 /* This is a magic assignment that we process differently */
11793 else if (rhs
== soft_exceptioninfo_call_node
)
11799 /* Check that RHS can be converted into LHS_TYPE by the assignment
11800 conversion (5.2), for the cases of RHS being a builtin type. Return
11801 NULL_TREE if the conversion fails or if because RHS isn't of a
11802 builtin type. Return a converted RHS if the conversion is possible. */
11805 try_builtin_assignconv (wfl_op1
, lhs_type
, rhs
)
11806 tree wfl_op1
, lhs_type
, rhs
;
11808 tree new_rhs
= NULL_TREE
;
11809 tree rhs_type
= TREE_TYPE (rhs
);
11811 /* Zero accepted everywhere */
11812 if (TREE_CODE (rhs
) == INTEGER_CST
11813 && TREE_INT_CST_HIGH (rhs
) == 0 && TREE_INT_CST_LOW (rhs
) == 0
11814 && JPRIMITIVE_TYPE_P (rhs_type
))
11815 new_rhs
= convert (lhs_type
, rhs
);
11817 /* 5.1.1 Try Identity Conversion,
11818 5.1.2 Try Widening Primitive Conversion */
11819 else if (valid_builtin_assignconv_identity_widening_p (lhs_type
, rhs_type
))
11820 new_rhs
= convert (lhs_type
, rhs
);
11822 /* Try a narrowing primitive conversion (5.1.3):
11823 - expression is a constant expression of type int AND
11824 - variable is byte, short or char AND
11825 - The value of the expression is representable in the type of the
11827 else if (rhs_type
== int_type_node
&& TREE_CONSTANT (rhs
)
11828 && (lhs_type
== byte_type_node
|| lhs_type
== char_type_node
11829 || lhs_type
== short_type_node
))
11831 if (int_fits_type_p (rhs
, lhs_type
))
11832 new_rhs
= convert (lhs_type
, rhs
);
11833 else if (wfl_op1
) /* Might be called with a NULL */
11834 parse_warning_context
11835 (wfl_op1
, "Constant expression `%s' to wide for narrowing "
11836 "primitive conversion to `%s'",
11837 print_int_node (rhs
), lang_printable_name (lhs_type
, 0));
11838 /* Reported a warning that will turn into an error further
11839 down, so we don't return */
11845 /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
11846 conversion (5.1.1) or widening primitve conversion (5.1.2). Return
11847 0 is the conversion test fails. This implements parts the method
11848 invocation convertion (5.3). */
11851 valid_builtin_assignconv_identity_widening_p (lhs_type
, rhs_type
)
11852 tree lhs_type
, rhs_type
;
11854 /* 5.1.1: This is the identity conversion part. */
11855 if (lhs_type
== rhs_type
)
11858 /* Reject non primitive types */
11859 if (!JPRIMITIVE_TYPE_P (lhs_type
) || !JPRIMITIVE_TYPE_P (rhs_type
))
11862 /* 5.1.2: widening primitive conversion. byte, even if it's smaller
11863 than a char can't be converted into a char. Short can't too, but
11864 the < test below takes care of that */
11865 if (lhs_type
== char_type_node
&& rhs_type
== byte_type_node
)
11868 /* Accept all promoted type here. Note, we can't use <= in the test
11869 below, because we still need to bounce out assignments of short
11870 to char and the likes */
11871 if (lhs_type
== int_type_node
11872 && (rhs_type
== promoted_byte_type_node
11873 || rhs_type
== promoted_short_type_node
11874 || rhs_type
== promoted_char_type_node
11875 || rhs_type
== promoted_boolean_type_node
))
11878 /* From here, an integral is widened if its precision is smaller
11879 than the precision of the LHS or if the LHS is a floating point
11880 type, or the RHS is a float and the RHS a double. */
11881 if ((JINTEGRAL_TYPE_P (rhs_type
) && JINTEGRAL_TYPE_P (lhs_type
)
11882 && (TYPE_PRECISION (rhs_type
) < TYPE_PRECISION (lhs_type
)))
11883 || (JINTEGRAL_TYPE_P (rhs_type
) && JFLOAT_TYPE_P (lhs_type
))
11884 || (rhs_type
== float_type_node
&& lhs_type
== double_type_node
))
11890 /* Check that something of SOURCE type can be assigned or cast to
11891 something of DEST type at runtime. Return 1 if the operation is
11892 valid, 0 otherwise. If CAST is set to 1, we're treating the case
11893 were SOURCE is cast into DEST, which borrows a lot of the
11894 assignment check. */
11897 valid_ref_assignconv_cast_p (source
, dest
, cast
)
11902 /* SOURCE or DEST might be null if not from a declared entity. */
11903 if (!source
|| !dest
)
11905 if (JNULLP_TYPE_P (source
))
11907 if (TREE_CODE (source
) == POINTER_TYPE
)
11908 source
= TREE_TYPE (source
);
11909 if (TREE_CODE (dest
) == POINTER_TYPE
)
11910 dest
= TREE_TYPE (dest
);
11911 /* Case where SOURCE is a class type */
11912 if (TYPE_CLASS_P (source
))
11914 if (TYPE_CLASS_P (dest
))
11915 return source
== dest
|| inherits_from_p (source
, dest
)
11916 || (cast
&& inherits_from_p (dest
, source
));
11917 if (TYPE_INTERFACE_P (dest
))
11919 /* If doing a cast and SOURCE is final, the operation is
11920 always correct a compile time (because even if SOURCE
11921 does not implement DEST, a subclass of SOURCE might). */
11922 if (cast
&& !CLASS_FINAL (TYPE_NAME (source
)))
11924 /* Otherwise, SOURCE must implement DEST */
11925 return interface_of_p (dest
, source
);
11927 /* DEST is an array, cast permited if SOURCE is of Object type */
11928 return (cast
&& source
== object_type_node
? 1 : 0);
11930 if (TYPE_INTERFACE_P (source
))
11932 if (TYPE_CLASS_P (dest
))
11934 /* If not casting, DEST must be the Object type */
11936 return dest
== object_type_node
;
11937 /* We're doing a cast. The cast is always valid is class
11938 DEST is not final, otherwise, DEST must implement SOURCE */
11939 else if (!CLASS_FINAL (TYPE_NAME (dest
)))
11942 return interface_of_p (source
, dest
);
11944 if (TYPE_INTERFACE_P (dest
))
11946 /* If doing a cast, then if SOURCE and DEST contain method
11947 with the same signature but different return type, then
11948 this is a (compile time) error */
11951 tree method_source
, method_dest
;
11955 for (method_source
= TYPE_METHODS (source
); method_source
;
11956 method_source
= TREE_CHAIN (method_source
))
11959 build_java_argument_signature (TREE_TYPE (method_source
));
11960 source_type
= TREE_TYPE (TREE_TYPE (method_source
));
11961 source_name
= DECL_NAME (method_source
);
11962 for (method_dest
= TYPE_METHODS (dest
);
11963 method_dest
; method_dest
= TREE_CHAIN (method_dest
))
11965 build_java_argument_signature (TREE_TYPE (method_dest
))
11966 && source_name
== DECL_NAME (method_dest
)
11967 && source_type
!= TREE_TYPE (TREE_TYPE (method_dest
)))
11973 return source
== dest
|| interface_of_p (dest
, source
);
11977 (DECL_NAME (TYPE_NAME (source
)) == java_lang_cloneable
) : 0);
11979 if (TYPE_ARRAY_P (source
))
11981 if (TYPE_CLASS_P (dest
))
11982 return dest
== object_type_node
;
11983 /* Can't cast an array to an interface unless the interface is
11984 java.lang.Cloneable */
11985 if (TYPE_INTERFACE_P (dest
))
11986 return (DECL_NAME (TYPE_NAME (dest
)) == java_lang_cloneable
? 1 : 0);
11989 tree source_element_type
= TYPE_ARRAY_ELEMENT (source
);
11990 tree dest_element_type
= TYPE_ARRAY_ELEMENT (dest
);
11992 /* In case of severe errors, they turn out null */
11993 if (!dest_element_type
|| !source_element_type
)
11995 if (source_element_type
== dest_element_type
)
11997 return valid_ref_assignconv_cast_p (source_element_type
,
11998 dest_element_type
, cast
);
12006 valid_cast_to_p (source
, dest
)
12010 if (TREE_CODE (source
) == POINTER_TYPE
)
12011 source
= TREE_TYPE (source
);
12012 if (TREE_CODE (dest
) == POINTER_TYPE
)
12013 dest
= TREE_TYPE (dest
);
12015 if (TREE_CODE (source
) == RECORD_TYPE
&& TREE_CODE (dest
) == RECORD_TYPE
)
12016 return valid_ref_assignconv_cast_p (source
, dest
, 1);
12018 else if (JNUMERIC_TYPE_P (source
) && JNUMERIC_TYPE_P (dest
))
12024 /* Method invocation conversion test. Return 1 if type SOURCE can be
12025 converted to type DEST through the methond invocation conversion
12029 do_unary_numeric_promotion (arg
)
12032 tree type
= TREE_TYPE (arg
);
12033 if (TREE_CODE (type
) == INTEGER_TYPE
? TYPE_PRECISION (type
) < 32
12034 : TREE_CODE (type
) == CHAR_TYPE
)
12035 arg
= convert (int_type_node
, arg
);
12039 /* Return a non zero value if SOURCE can be converted into DEST using
12040 the method invocation conversion rule (5.3). */
12042 valid_method_invocation_conversion_p (dest
, source
)
12045 return ((JPRIMITIVE_TYPE_P (source
) && JPRIMITIVE_TYPE_P (dest
)
12046 && valid_builtin_assignconv_identity_widening_p (dest
, source
))
12047 || ((JREFERENCE_TYPE_P (source
) || JNULLP_TYPE_P (source
))
12048 && (JREFERENCE_TYPE_P (dest
) || JNULLP_TYPE_P (dest
))
12049 && valid_ref_assignconv_cast_p (source
, dest
, 0)));
12052 /* Build an incomplete binop expression. */
12055 build_binop (op
, op_location
, op1
, op2
)
12060 tree binop
= build (op
, NULL_TREE
, op1
, op2
);
12061 TREE_SIDE_EFFECTS (binop
) = 1;
12062 /* Store the location of the operator, for better error report. The
12063 string of the operator will be rebuild based on the OP value. */
12064 EXPR_WFL_LINECOL (binop
) = op_location
;
12068 /* Build the string of the operator retained by NODE. If NODE is part
12069 of a compound expression, add an '=' at the end of the string. This
12070 function is called when an error needs to be reported on an
12071 operator. The string is returned as a pointer to a static character
12075 operator_string (node
)
12078 #define BUILD_OPERATOR_STRING(S) \
12080 sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
12084 static char buffer
[10];
12085 switch (TREE_CODE (node
))
12087 case MULT_EXPR
: BUILD_OPERATOR_STRING ("*");
12088 case RDIV_EXPR
: BUILD_OPERATOR_STRING ("/");
12089 case TRUNC_MOD_EXPR
: BUILD_OPERATOR_STRING ("%");
12090 case PLUS_EXPR
: BUILD_OPERATOR_STRING ("+");
12091 case MINUS_EXPR
: BUILD_OPERATOR_STRING ("-");
12092 case LSHIFT_EXPR
: BUILD_OPERATOR_STRING ("<<");
12093 case RSHIFT_EXPR
: BUILD_OPERATOR_STRING (">>");
12094 case URSHIFT_EXPR
: BUILD_OPERATOR_STRING (">>>");
12095 case BIT_AND_EXPR
: BUILD_OPERATOR_STRING ("&");
12096 case BIT_XOR_EXPR
: BUILD_OPERATOR_STRING ("^");
12097 case BIT_IOR_EXPR
: BUILD_OPERATOR_STRING ("|");
12098 case TRUTH_ANDIF_EXPR
: BUILD_OPERATOR_STRING ("&&");
12099 case TRUTH_ORIF_EXPR
: BUILD_OPERATOR_STRING ("||");
12100 case EQ_EXPR
: BUILD_OPERATOR_STRING ("==");
12101 case NE_EXPR
: BUILD_OPERATOR_STRING ("!=");
12102 case GT_EXPR
: BUILD_OPERATOR_STRING (">");
12103 case GE_EXPR
: BUILD_OPERATOR_STRING (">=");
12104 case LT_EXPR
: BUILD_OPERATOR_STRING ("<");
12105 case LE_EXPR
: BUILD_OPERATOR_STRING ("<=");
12106 case UNARY_PLUS_EXPR
: BUILD_OPERATOR_STRING ("+");
12107 case NEGATE_EXPR
: BUILD_OPERATOR_STRING ("-");
12108 case TRUTH_NOT_EXPR
: BUILD_OPERATOR_STRING ("!");
12109 case BIT_NOT_EXPR
: BUILD_OPERATOR_STRING ("~");
12110 case PREINCREMENT_EXPR
: /* Fall through */
12111 case POSTINCREMENT_EXPR
: BUILD_OPERATOR_STRING ("++");
12112 case PREDECREMENT_EXPR
: /* Fall through */
12113 case POSTDECREMENT_EXPR
: BUILD_OPERATOR_STRING ("--");
12115 fatal ("unregistered operator %s - operator_string",
12116 tree_code_name
[TREE_CODE (node
)]);
12119 #undef BUILD_OPERATOR_STRING
12122 /* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
12125 java_decl_equiv (var_acc1
, var_acc2
)
12126 tree var_acc1
, var_acc2
;
12128 if (JDECL_P (var_acc1
))
12129 return (var_acc1
== var_acc2
);
12131 return (TREE_CODE (var_acc1
) == COMPONENT_REF
12132 && TREE_CODE (var_acc2
) == COMPONENT_REF
12133 && TREE_OPERAND (TREE_OPERAND (var_acc1
, 0), 0)
12134 == TREE_OPERAND (TREE_OPERAND (var_acc2
, 0), 0)
12135 && TREE_OPERAND (var_acc1
, 1) == TREE_OPERAND (var_acc2
, 1));
12138 /* Return a non zero value if CODE is one of the operators that can be
12139 used in conjunction with the `=' operator in a compound assignment. */
12142 binop_compound_p (code
)
12143 enum tree_code code
;
12146 for (i
= 0; i
< BINOP_COMPOUND_CANDIDATES
; i
++)
12147 if (binop_lookup
[i
] == code
)
12150 return i
< BINOP_COMPOUND_CANDIDATES
;
12153 /* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
12159 tree c
, b
, ns
, decl
;
12161 if (TREE_CODE (t
) != MODIFY_EXPR
)
12164 c
= TREE_OPERAND (t
, 1);
12165 if (! (c
&& TREE_CODE (c
) == COMPOUND_EXPR
12166 && TREE_CODE (TREE_OPERAND (c
, 0)) == MODIFY_EXPR
12167 && binop_compound_p (TREE_CODE (TREE_OPERAND (c
, 1)))))
12170 /* Now the left branch of the binary operator. */
12171 b
= TREE_OPERAND (TREE_OPERAND (c
, 1), 0);
12172 if (! (b
&& TREE_CODE (b
) == NOP_EXPR
12173 && TREE_CODE (TREE_OPERAND (b
, 0)) == SAVE_EXPR
))
12176 ns
= TREE_OPERAND (TREE_OPERAND (b
, 0), 0);
12177 if (! (ns
&& TREE_CODE (ns
) == NOP_EXPR
12178 && TREE_CODE (TREE_OPERAND (ns
, 0)) == SAVE_EXPR
))
12181 decl
= TREE_OPERAND (TREE_OPERAND (ns
, 0), 0);
12182 if ((JDECL_P (decl
) || TREE_CODE (decl
) == COMPONENT_REF
)
12183 /* It's got to be the an equivalent decl */
12184 && java_decl_equiv (decl
, TREE_OPERAND (TREE_OPERAND (c
, 0), 0)))
12186 /* Shorten the NOP_EXPR/SAVE_EXPR path. */
12187 TREE_OPERAND (TREE_OPERAND (c
, 1), 0) = TREE_OPERAND (ns
, 0);
12188 /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
12189 TREE_OPERAND (t
, 1) = TREE_OPERAND (c
, 1);
12190 /* Change the right part of the BINOP_EXPR */
12191 TREE_OPERAND (TREE_OPERAND (t
, 1), 1) = TREE_OPERAND (c
, 0);
12197 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
12198 errors but we modify NODE so that it contains the type computed
12199 according to the expression, when it's fixed. Otherwise, we write
12200 error_mark_node as the type. It allows us to further the analysis
12201 of remaining nodes and detects more errors in certain cases. */
12204 patch_binop (node
, wfl_op1
, wfl_op2
)
12209 tree op1
= TREE_OPERAND (node
, 0);
12210 tree op2
= TREE_OPERAND (node
, 1);
12211 tree op1_type
= TREE_TYPE (op1
);
12212 tree op2_type
= TREE_TYPE (op2
);
12213 tree prom_type
= NULL_TREE
;
12214 int code
= TREE_CODE (node
);
12216 /* If 1, tell the routine that we have to return error_mark_node
12217 after checking for the initialization of the RHS */
12218 int error_found
= 0;
12220 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12224 /* 15.16 Multiplicative operators */
12225 case MULT_EXPR
: /* 15.16.1 Multiplication Operator * */
12226 case RDIV_EXPR
: /* 15.16.2 Division Operator / */
12227 case TRUNC_MOD_EXPR
: /* 15.16.3 Remainder operator % */
12228 if (!JPRIMITIVE_TYPE_P (op1_type
) || !JPRIMITIVE_TYPE_P (op2_type
))
12230 if (!JPRIMITIVE_TYPE_P (op1_type
))
12231 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
12232 if (!JPRIMITIVE_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12233 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
12234 TREE_TYPE (node
) = error_mark_node
;
12238 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12239 /* Change the division operator if necessary */
12240 if (code
== RDIV_EXPR
&& TREE_CODE (prom_type
) == INTEGER_TYPE
)
12241 TREE_SET_CODE (node
, TRUNC_DIV_EXPR
);
12243 if (TREE_CODE (prom_type
) == INTEGER_TYPE
12244 && flag_use_divide_subroutine
12245 && ! flag_emit_class_files
12246 && (code
== RDIV_EXPR
|| code
== TRUNC_MOD_EXPR
))
12247 return build_java_soft_divmod (TREE_CODE (node
), prom_type
, op1
, op2
);
12249 /* This one is more complicated. FLOATs are processed by a
12250 function call to soft_fmod. Duplicate the value of the
12251 COMPOUND_ASSIGN_P flag. */
12252 if (code
== TRUNC_MOD_EXPR
)
12254 tree mod
= build_java_binop (TRUNC_MOD_EXPR
, prom_type
, op1
, op2
);
12255 COMPOUND_ASSIGN_P (mod
) = COMPOUND_ASSIGN_P (node
);
12256 TREE_SIDE_EFFECTS (mod
)
12257 = TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12262 /* 15.17 Additive Operators */
12263 case PLUS_EXPR
: /* 15.17.1 String Concatenation Operator + */
12265 /* Operation is valid if either one argument is a string
12266 constant, a String object or a StringBuffer crafted for the
12267 purpose of the a previous usage of the String concatenation
12270 if (TREE_CODE (op1
) == STRING_CST
12271 || TREE_CODE (op2
) == STRING_CST
12272 || JSTRING_TYPE_P (op1_type
)
12273 || JSTRING_TYPE_P (op2_type
)
12274 || IS_CRAFTED_STRING_BUFFER_P (op1
)
12275 || IS_CRAFTED_STRING_BUFFER_P (op2
))
12276 return build_string_concatenation (op1
, op2
);
12278 case MINUS_EXPR
: /* 15.17.2 Additive Operators (+ and -) for
12280 if (!JPRIMITIVE_TYPE_P (op1_type
) || !JPRIMITIVE_TYPE_P (op2_type
))
12282 if (!JPRIMITIVE_TYPE_P (op1_type
))
12283 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
12284 if (!JPRIMITIVE_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12285 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
12286 TREE_TYPE (node
) = error_mark_node
;
12290 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12293 /* 15.18 Shift Operators */
12297 if (!JINTEGRAL_TYPE_P (op1_type
) || !JINTEGRAL_TYPE_P (op2_type
))
12299 if (!JINTEGRAL_TYPE_P (op1_type
))
12300 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op1_type
);
12302 parse_error_context
12303 (wfl_operator
, (JPRIMITIVE_TYPE_P (op2_type
) ?
12304 "Incompatible type for `%s'. Explicit cast needed to convert "
12305 "shift distance from `%s' to integral" :
12306 "Incompatible type for `%s'. Can't convert shift distance from "
12307 "`%s' to integral"),
12308 operator_string (node
), lang_printable_name (op2_type
, 0));
12309 TREE_TYPE (node
) = error_mark_node
;
12314 /* Unary numeric promotion (5.6.1) is performed on each operand
12316 op1
= do_unary_numeric_promotion (op1
);
12317 op2
= do_unary_numeric_promotion (op2
);
12319 /* The type of the shift expression is the type of the promoted
12320 type of the left-hand operand */
12321 prom_type
= TREE_TYPE (op1
);
12323 /* Shift int only up to 0x1f and long up to 0x3f */
12324 if (prom_type
== int_type_node
)
12325 op2
= fold (build (BIT_AND_EXPR
, int_type_node
, op2
,
12326 build_int_2 (0x1f, 0)));
12328 op2
= fold (build (BIT_AND_EXPR
, int_type_node
, op2
,
12329 build_int_2 (0x3f, 0)));
12331 /* The >>> operator is a >> operating on unsigned quantities */
12332 if (code
== URSHIFT_EXPR
&& ! flag_emit_class_files
)
12335 tree utype
= unsigned_type (prom_type
);
12336 op1
= convert (utype
, op1
);
12337 TREE_SET_CODE (node
, RSHIFT_EXPR
);
12338 TREE_OPERAND (node
, 0) = op1
;
12339 TREE_OPERAND (node
, 1) = op2
;
12340 TREE_TYPE (node
) = utype
;
12341 to_return
= convert (prom_type
, node
);
12342 /* Copy the original value of the COMPOUND_ASSIGN_P flag */
12343 COMPOUND_ASSIGN_P (to_return
) = COMPOUND_ASSIGN_P (node
);
12344 TREE_SIDE_EFFECTS (to_return
)
12345 = TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12350 /* 15.19.1 Type Comparison Operator instaceof */
12351 case INSTANCEOF_EXPR
:
12353 TREE_TYPE (node
) = boolean_type_node
;
12355 if (!(op2_type
= resolve_type_during_patch (op2
)))
12356 return error_mark_node
;
12358 /* The first operand must be a reference type or the null type */
12359 if (!JREFERENCE_TYPE_P (op1_type
) && op1
!= null_pointer_node
)
12360 error_found
= 1; /* Error reported further below */
12362 /* The second operand must be a reference type */
12363 if (!JREFERENCE_TYPE_P (op2_type
))
12365 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op2
);
12366 parse_error_context
12367 (wfl_operator
, "Invalid argument `%s' for `instanceof'",
12368 lang_printable_name (op2_type
, 0));
12372 if (!error_found
&& valid_ref_assignconv_cast_p (op1_type
, op2_type
, 1))
12374 /* If the first operand is null, the result is always false */
12375 if (op1
== null_pointer_node
)
12376 return boolean_false_node
;
12377 else if (flag_emit_class_files
)
12379 TREE_OPERAND (node
, 1) = op2_type
;
12380 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (op1
);
12383 /* Otherwise we have to invoke instance of to figure it out */
12387 build (CALL_EXPR
, boolean_type_node
,
12388 build_address_of (soft_instanceof_node
),
12391 build_tree_list (NULL_TREE
,
12392 build_class_ref (op2_type
))),
12394 TREE_SIDE_EFFECTS (call
) = TREE_SIDE_EFFECTS (op1
);
12398 /* There is no way the expression operand can be an instance of
12399 the type operand. This is a compile time error. */
12402 char *t1
= strdup (lang_printable_name (op1_type
, 0));
12403 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
12404 parse_error_context
12405 (wfl_operator
, "Impossible for `%s' to be instance of `%s'",
12406 t1
, lang_printable_name (op2_type
, 0));
12413 /* 15.21 Bitwise and Logical Operators */
12417 if (JINTEGRAL_TYPE_P (op1_type
) && JINTEGRAL_TYPE_P (op2_type
))
12418 /* Binary numeric promotion is performed on both operand and the
12419 expression retain that type */
12420 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12422 else if (TREE_CODE (op1_type
) == BOOLEAN_TYPE
12423 && TREE_CODE (op1_type
) == BOOLEAN_TYPE
)
12424 /* The type of the bitwise operator expression is BOOLEAN */
12425 prom_type
= boolean_type_node
;
12428 if (!JINTEGRAL_TYPE_P (op1_type
))
12429 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op1_type
);
12430 if (!JINTEGRAL_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12431 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op2_type
);
12432 TREE_TYPE (node
) = error_mark_node
;
12434 /* Insert a break here if adding thing before the switch's
12435 break for this case */
12439 /* 15.22 Conditional-And Operator */
12440 case TRUTH_ANDIF_EXPR
:
12441 /* 15.23 Conditional-Or Operator */
12442 case TRUTH_ORIF_EXPR
:
12443 /* Operands must be of BOOLEAN type */
12444 if (TREE_CODE (op1_type
) != BOOLEAN_TYPE
||
12445 TREE_CODE (op2_type
) != BOOLEAN_TYPE
)
12447 if (TREE_CODE (op1_type
) != BOOLEAN_TYPE
)
12448 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op1_type
);
12449 if (TREE_CODE (op2_type
) != BOOLEAN_TYPE
&& (op1_type
!= op2_type
))
12450 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op2_type
);
12451 TREE_TYPE (node
) = boolean_type_node
;
12455 /* The type of the conditional operators is BOOLEAN */
12456 prom_type
= boolean_type_node
;
12459 /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
12464 /* The type of each of the operands must be a primitive numeric
12466 if (!JNUMERIC_TYPE_P (op1_type
) || ! JNUMERIC_TYPE_P (op2_type
))
12468 if (!JNUMERIC_TYPE_P (op1_type
))
12469 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
12470 if (!JNUMERIC_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12471 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
12472 TREE_TYPE (node
) = boolean_type_node
;
12476 /* Binary numeric promotion is performed on the operands */
12477 binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12478 /* The type of the relation expression is always BOOLEAN */
12479 prom_type
= boolean_type_node
;
12482 /* 15.20 Equality Operator */
12485 /* 15.20.1 Numerical Equality Operators == and != */
12486 /* Binary numeric promotion is performed on the operands */
12487 if (JNUMERIC_TYPE_P (op1_type
) && JNUMERIC_TYPE_P (op2_type
))
12488 binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12490 /* 15.20.2 Boolean Equality Operators == and != */
12491 else if (TREE_CODE (op1_type
) == BOOLEAN_TYPE
&&
12492 TREE_CODE (op2_type
) == BOOLEAN_TYPE
)
12493 ; /* Nothing to do here */
12495 /* 15.20.3 Reference Equality Operators == and != */
12496 /* Types have to be either references or the null type. If
12497 they're references, it must be possible to convert either
12498 type to the other by casting conversion. */
12499 else if (op1
== null_pointer_node
|| op2
== null_pointer_node
12500 || (JREFERENCE_TYPE_P (op1_type
) && JREFERENCE_TYPE_P (op2_type
)
12501 && (valid_ref_assignconv_cast_p (op1_type
, op2_type
, 1)
12502 || valid_ref_assignconv_cast_p (op2_type
,
12504 ; /* Nothing to do here */
12506 /* Else we have an error figure what can't be converted into
12507 what and report the error */
12511 t1
= strdup (lang_printable_name (op1_type
, 0));
12512 parse_error_context
12513 (wfl_operator
, "Incompatible type for `%s'. Can't convert `%s' "
12514 "to `%s'", operator_string (node
), t1
,
12515 lang_printable_name (op2_type
, 0));
12517 TREE_TYPE (node
) = boolean_type_node
;
12521 prom_type
= boolean_type_node
;
12526 return error_mark_node
;
12528 TREE_OPERAND (node
, 0) = op1
;
12529 TREE_OPERAND (node
, 1) = op2
;
12530 TREE_TYPE (node
) = prom_type
;
12531 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12533 if (flag_emit_xref
)
12536 /* fold does not respect side-effect order as required for Java but not C.
12537 * Also, it sometimes create SAVE_EXPRs which are bad when emitting
12540 if (flag_emit_class_files
? (TREE_CONSTANT (op1
) && TREE_CONSTANT (op2
))
12541 : ! TREE_SIDE_EFFECTS (node
))
12542 node
= fold (node
);
12546 /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
12547 zero value, the value of CSTE comes after the valude of STRING */
12550 do_merge_string_cste (cste
, string
, string_len
, after
)
12552 const char *string
;
12553 int string_len
, after
;
12555 int len
= TREE_STRING_LENGTH (cste
) + string_len
;
12556 const char *old
= TREE_STRING_POINTER (cste
);
12557 TREE_STRING_LENGTH (cste
) = len
;
12558 TREE_STRING_POINTER (cste
) = obstack_alloc (expression_obstack
, len
+1);
12561 strcpy (TREE_STRING_POINTER (cste
), string
);
12562 strcat (TREE_STRING_POINTER (cste
), old
);
12566 strcpy (TREE_STRING_POINTER (cste
), old
);
12567 strcat (TREE_STRING_POINTER (cste
), string
);
12572 /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
12573 new STRING_CST on success, NULL_TREE on failure */
12576 merge_string_cste (op1
, op2
, after
)
12580 /* Handle two string constants right away */
12581 if (TREE_CODE (op2
) == STRING_CST
)
12582 return do_merge_string_cste (op1
, TREE_STRING_POINTER (op2
),
12583 TREE_STRING_LENGTH (op2
), after
);
12585 /* Reasonable integer constant can be treated right away */
12586 if (TREE_CODE (op2
) == INTEGER_CST
&& !TREE_CONSTANT_OVERFLOW (op2
))
12588 static const char *boolean_true
= "true";
12589 static const char *boolean_false
= "false";
12590 static const char *null_pointer
= "null";
12592 const char *string
;
12594 if (op2
== boolean_true_node
)
12595 string
= boolean_true
;
12596 else if (op2
== boolean_false_node
)
12597 string
= boolean_false
;
12598 else if (op2
== null_pointer_node
)
12599 string
= null_pointer
;
12600 else if (TREE_TYPE (op2
) == char_type_node
)
12602 ch
[0] = (char )TREE_INT_CST_LOW (op2
);
12607 string
= print_int_node (op2
);
12609 return do_merge_string_cste (op1
, string
, strlen (string
), after
);
12614 /* Tries to statically concatenate OP1 and OP2 if possible. Either one
12615 has to be a STRING_CST and the other part must be a STRING_CST or a
12616 INTEGRAL constant. Return a new STRING_CST if the operation
12617 succeed, NULL_TREE otherwise.
12619 If the case we want to optimize for space, we might want to return
12620 NULL_TREE for each invocation of this routine. FIXME */
12623 string_constant_concatenation (op1
, op2
)
12626 if (TREE_CODE (op1
) == STRING_CST
|| (TREE_CODE (op2
) == STRING_CST
))
12631 string
= (TREE_CODE (op1
) == STRING_CST
? op1
: op2
);
12632 rest
= (string
== op1
? op2
: op1
);
12633 invert
= (string
== op1
? 0 : 1 );
12635 /* Walk REST, only if it looks reasonable */
12636 if (TREE_CODE (rest
) != STRING_CST
12637 && !IS_CRAFTED_STRING_BUFFER_P (rest
)
12638 && !JSTRING_TYPE_P (TREE_TYPE (rest
))
12639 && TREE_CODE (rest
) == EXPR_WITH_FILE_LOCATION
)
12641 rest
= java_complete_tree (rest
);
12642 if (rest
== error_mark_node
)
12643 return error_mark_node
;
12644 rest
= fold (rest
);
12646 return merge_string_cste (string
, rest
, invert
);
12651 /* Implement the `+' operator. Does static optimization if possible,
12652 otherwise create (if necessary) and append elements to a
12653 StringBuffer. The StringBuffer will be carried around until it is
12654 used for a function call or an assignment. Then toString() will be
12655 called on it to turn it into a String object. */
12658 build_string_concatenation (op1
, op2
)
12662 int side_effects
= TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12664 if (flag_emit_xref
)
12665 return build (PLUS_EXPR
, string_type_node
, op1
, op2
);
12667 /* Try to do some static optimization */
12668 if ((result
= string_constant_concatenation (op1
, op2
)))
12671 /* Discard empty strings on either side of the expression */
12672 if (TREE_CODE (op1
) == STRING_CST
&& TREE_STRING_LENGTH (op1
) == 0)
12677 else if (TREE_CODE (op2
) == STRING_CST
&& TREE_STRING_LENGTH (op2
) == 0)
12680 /* If operands are string constant, turn then into object references */
12681 if (TREE_CODE (op1
) == STRING_CST
)
12682 op1
= patch_string_cst (op1
);
12683 if (op2
&& TREE_CODE (op2
) == STRING_CST
)
12684 op2
= patch_string_cst (op2
);
12686 /* If either one of the constant is null and the other non null
12687 operand is a String object, return it. */
12688 if (JSTRING_TYPE_P (TREE_TYPE (op1
)) && !op2
)
12691 /* If OP1 isn't already a StringBuffer, create and
12692 initialize a new one */
12693 if (!IS_CRAFTED_STRING_BUFFER_P (op1
))
12695 /* Two solutions here:
12696 1) OP1 is a string reference, we call new StringBuffer(OP1)
12697 2) OP1 is something else, we call new StringBuffer().append(OP1). */
12698 if (JSTRING_TYPE_P (TREE_TYPE (op1
)))
12699 op1
= BUILD_STRING_BUFFER (op1
);
12702 tree aNew
= BUILD_STRING_BUFFER (NULL_TREE
);
12703 op1
= make_qualified_primary (aNew
, BUILD_APPEND (op1
), 0);
12709 /* OP1 is no longer the last node holding a crafted StringBuffer */
12710 IS_CRAFTED_STRING_BUFFER_P (op1
) = 0;
12711 /* Create a node for `{new...,xxx}.append (op2)' */
12713 op1
= make_qualified_primary (op1
, BUILD_APPEND (op2
), 0);
12716 /* Mark the last node holding a crafted StringBuffer */
12717 IS_CRAFTED_STRING_BUFFER_P (op1
) = 1;
12719 TREE_SIDE_EFFECTS (op1
) = side_effects
;
12723 /* Patch the string node NODE. NODE can be a STRING_CST of a crafted
12724 StringBuffer. If no string were found to be patched, return
12728 patch_string (node
)
12731 if (node
== error_mark_node
)
12732 return error_mark_node
;
12733 if (TREE_CODE (node
) == STRING_CST
)
12734 return patch_string_cst (node
);
12735 else if (IS_CRAFTED_STRING_BUFFER_P (node
))
12737 int saved
= ctxp
->explicit_constructor_p
;
12738 tree invoke
= build_method_invocation (wfl_to_string
, NULL_TREE
);
12740 /* Temporary disable forbid the use of `this'. */
12741 ctxp
->explicit_constructor_p
= 0;
12742 ret
= java_complete_tree (make_qualified_primary (node
, invoke
, 0));
12743 /* Restore it at its previous value */
12744 ctxp
->explicit_constructor_p
= saved
;
12750 /* Build the internal representation of a string constant. */
12753 patch_string_cst (node
)
12757 if (! flag_emit_class_files
)
12759 push_obstacks (&permanent_obstack
, &permanent_obstack
);
12760 node
= get_identifier (TREE_STRING_POINTER (node
));
12761 location
= alloc_name_constant (CONSTANT_String
, node
);
12762 node
= build_ref_from_constant_pool (location
);
12764 TREE_TYPE (node
) = string_ptr_type_node
;
12765 TREE_CONSTANT (node
) = 1;
12769 /* Build an incomplete unary operator expression. */
12772 build_unaryop (op_token
, op_location
, op1
)
12773 int op_token
, op_location
;
12780 case PLUS_TK
: op
= UNARY_PLUS_EXPR
; break;
12781 case MINUS_TK
: op
= NEGATE_EXPR
; break;
12782 case NEG_TK
: op
= TRUTH_NOT_EXPR
; break;
12783 case NOT_TK
: op
= BIT_NOT_EXPR
; break;
12784 default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
12788 unaryop
= build1 (op
, NULL_TREE
, op1
);
12789 TREE_SIDE_EFFECTS (unaryop
) = 1;
12790 /* Store the location of the operator, for better error report. The
12791 string of the operator will be rebuild based on the OP value. */
12792 EXPR_WFL_LINECOL (unaryop
) = op_location
;
12796 /* Special case for the ++/-- operators, since they require an extra
12797 argument to build, which is set to NULL and patched
12798 later. IS_POST_P is 1 if the operator, 0 otherwise. */
12801 build_incdec (op_token
, op_location
, op1
, is_post_p
)
12802 int op_token
, op_location
;
12806 static enum tree_code lookup
[2][2] =
12808 { PREDECREMENT_EXPR
, PREINCREMENT_EXPR
, },
12809 { POSTDECREMENT_EXPR
, POSTINCREMENT_EXPR
, },
12811 tree node
= build (lookup
[is_post_p
][(op_token
- DECR_TK
)],
12812 NULL_TREE
, op1
, NULL_TREE
);
12813 TREE_SIDE_EFFECTS (node
) = 1;
12814 /* Store the location of the operator, for better error report. The
12815 string of the operator will be rebuild based on the OP value. */
12816 EXPR_WFL_LINECOL (node
) = op_location
;
12820 /* Build an incomplete cast operator, based on the use of the
12821 CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
12822 set. java_complete_tree is trained to walk a CONVERT_EXPR even
12823 though its type is already set. */
12826 build_cast (location
, type
, exp
)
12830 tree node
= build1 (CONVERT_EXPR
, type
, exp
);
12831 EXPR_WFL_LINECOL (node
) = location
;
12835 /* 15.14 Unary operators. We return error_mark_node in case of error,
12836 but preserve the type of NODE if the type is fixed. */
12839 patch_unaryop (node
, wfl_op
)
12843 tree op
= TREE_OPERAND (node
, 0);
12844 tree op_type
= TREE_TYPE (op
);
12845 tree prom_type
= NULL_TREE
, value
, decl
;
12846 int code
= TREE_CODE (node
);
12847 int error_found
= 0;
12849 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12853 /* 15.13.2 Postfix Increment Operator ++ */
12854 case POSTINCREMENT_EXPR
:
12855 /* 15.13.3 Postfix Increment Operator -- */
12856 case POSTDECREMENT_EXPR
:
12857 /* 15.14.1 Prefix Increment Operator ++ */
12858 case PREINCREMENT_EXPR
:
12859 /* 15.14.2 Prefix Decrement Operator -- */
12860 case PREDECREMENT_EXPR
:
12861 op
= decl
= strip_out_static_field_access_decl (op
);
12862 /* We really should have a JAVA_ARRAY_EXPR to avoid this */
12863 if (!JDECL_P (decl
)
12864 && TREE_CODE (decl
) != COMPONENT_REF
12865 && !(flag_emit_class_files
&& TREE_CODE (decl
) == ARRAY_REF
)
12866 && TREE_CODE (decl
) != INDIRECT_REF
12867 && !(TREE_CODE (decl
) == COMPOUND_EXPR
12868 && TREE_OPERAND (decl
, 1)
12869 && (TREE_CODE (TREE_OPERAND (decl
, 1)) == INDIRECT_REF
)))
12872 /* Before screaming, check that we're not in fact trying to
12873 increment a optimized static final access, in which case
12874 we issue an different error message. */
12875 if (!(TREE_CODE (wfl_op
) == EXPR_WITH_FILE_LOCATION
12876 && resolve_expression_name (wfl_op
, &lvalue
)
12877 && check_final_assignment (lvalue
, wfl_op
)))
12878 parse_error_context (wfl_operator
, "Invalid argument to `%s'",
12879 operator_string (node
));
12880 TREE_TYPE (node
) = error_mark_node
;
12883 else if (check_final_assignment (op
, wfl_op
))
12886 /* From now on, we know that op if a variable and that it has a
12887 valid wfl. We use wfl_op to locate errors related to the
12889 else if (!JNUMERIC_TYPE_P (op_type
))
12891 parse_error_context
12892 (wfl_op
, "Invalid argument type `%s' to `%s'",
12893 lang_printable_name (op_type
, 0), operator_string (node
));
12894 TREE_TYPE (node
) = error_mark_node
;
12899 /* Before the addition, binary numeric promotion is performed on
12900 both operands, if really necessary */
12901 if (JINTEGRAL_TYPE_P (op_type
))
12903 value
= build_int_2 (1, 0);
12904 TREE_TYPE (value
) = TREE_TYPE (node
) = op_type
;
12908 value
= build_int_2 (1, 0);
12910 binary_numeric_promotion (op_type
,
12911 TREE_TYPE (value
), &op
, &value
);
12913 /* And write back into the node. */
12914 TREE_OPERAND (node
, 0) = op
;
12915 TREE_OPERAND (node
, 1) = value
;
12916 /* Convert the overall back into its original type, if
12917 necessary, and return */
12918 if (JINTEGRAL_TYPE_P (op_type
))
12919 return fold (node
);
12921 return fold (convert (op_type
, node
));
12925 /* 15.14.3 Unary Plus Operator + */
12926 case UNARY_PLUS_EXPR
:
12927 /* 15.14.4 Unary Minus Operator - */
12929 if (!JNUMERIC_TYPE_P (op_type
))
12931 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op_type
);
12932 TREE_TYPE (node
) = error_mark_node
;
12935 /* Unary numeric promotion is performed on operand */
12938 op
= do_unary_numeric_promotion (op
);
12939 prom_type
= TREE_TYPE (op
);
12940 if (code
== UNARY_PLUS_EXPR
)
12945 /* 15.14.5 Bitwise Complement Operator ~ */
12947 if (!JINTEGRAL_TYPE_P (op_type
))
12949 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op_type
);
12950 TREE_TYPE (node
) = error_mark_node
;
12955 op
= do_unary_numeric_promotion (op
);
12956 prom_type
= TREE_TYPE (op
);
12960 /* 15.14.6 Logical Complement Operator ! */
12961 case TRUTH_NOT_EXPR
:
12962 if (TREE_CODE (op_type
) != BOOLEAN_TYPE
)
12964 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op_type
);
12965 /* But the type is known. We will report an error if further
12966 attempt of a assignment is made with this rhs */
12967 TREE_TYPE (node
) = boolean_type_node
;
12971 prom_type
= boolean_type_node
;
12974 /* 15.15 Cast Expression */
12976 value
= patch_cast (node
, wfl_operator
);
12977 if (value
== error_mark_node
)
12979 /* If this cast is part of an assignment, we tell the code
12980 that deals with it not to complain about a mismatch,
12981 because things have been cast, anyways */
12982 TREE_TYPE (node
) = error_mark_node
;
12987 value
= fold (value
);
12988 TREE_SIDE_EFFECTS (value
) = TREE_SIDE_EFFECTS (op
);
12995 return error_mark_node
;
12997 /* There are cases where node has been replaced by something else
12998 and we don't end up returning here: UNARY_PLUS_EXPR,
12999 CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
13000 TREE_OPERAND (node
, 0) = fold (op
);
13001 TREE_TYPE (node
) = prom_type
;
13002 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (op
);
13003 return fold (node
);
13006 /* Generic type resolution that sometimes takes place during node
13007 patching. Returned the resolved type or generate an error
13008 message. Return the resolved type or NULL_TREE. */
13011 resolve_type_during_patch (type
)
13014 if (unresolved_type_p (type
, NULL
))
13016 tree type_decl
= resolve_no_layout (EXPR_WFL_NODE (type
), NULL_TREE
);
13019 parse_error_context (type
,
13020 "Class `%s' not found in type declaration",
13021 IDENTIFIER_POINTER (EXPR_WFL_NODE (type
)));
13026 CLASS_LOADED_P (TREE_TYPE (type_decl
)) = 1;
13027 return TREE_TYPE (type_decl
);
13032 /* 5.5 Casting Conversion. error_mark_node is returned if an error is
13033 found. Otherwise NODE or something meant to replace it is returned. */
13036 patch_cast (node
, wfl_operator
)
13040 tree op
= TREE_OPERAND (node
, 0);
13041 tree op_type
= TREE_TYPE (op
);
13042 tree cast_type
= TREE_TYPE (node
);
13045 /* First resolve OP_TYPE if unresolved */
13046 if (!(cast_type
= resolve_type_during_patch (cast_type
)))
13047 return error_mark_node
;
13049 /* Check on cast that are proven correct at compile time */
13050 if (JNUMERIC_TYPE_P (cast_type
) && JNUMERIC_TYPE_P (op_type
))
13053 if (cast_type
== op_type
)
13056 /* float and double type are converted to the original type main
13057 variant and then to the target type. */
13058 if (JFLOAT_TYPE_P (op_type
) && TREE_CODE (cast_type
) == CHAR_TYPE
)
13059 op
= convert (integer_type_node
, op
);
13061 /* Try widening/narowwing convertion. Potentially, things need
13062 to be worked out in gcc so we implement the extreme cases
13063 correctly. fold_convert() needs to be fixed. */
13064 return convert (cast_type
, op
);
13067 /* It's also valid to cast a boolean into a boolean */
13068 if (op_type
== boolean_type_node
&& cast_type
== boolean_type_node
)
13071 /* null can be casted to references */
13072 if (op
== null_pointer_node
&& JREFERENCE_TYPE_P (cast_type
))
13073 return build_null_of_type (cast_type
);
13075 /* The remaining legal casts involve conversion between reference
13076 types. Check for their compile time correctness. */
13077 if (JREFERENCE_TYPE_P (op_type
) && JREFERENCE_TYPE_P (cast_type
)
13078 && valid_ref_assignconv_cast_p (op_type
, cast_type
, 1))
13080 TREE_TYPE (node
) = promote_type (cast_type
);
13081 /* Now, the case can be determined correct at compile time if
13082 OP_TYPE can be converted into CAST_TYPE by assignment
13083 conversion (5.2) */
13085 if (valid_ref_assignconv_cast_p (op_type
, cast_type
, 0))
13087 TREE_SET_CODE (node
, NOP_EXPR
);
13091 if (flag_emit_class_files
)
13093 TREE_SET_CODE (node
, CONVERT_EXPR
);
13097 /* The cast requires a run-time check */
13098 return build (CALL_EXPR
, promote_type (cast_type
),
13099 build_address_of (soft_checkcast_node
),
13100 tree_cons (NULL_TREE
, build_class_ref (cast_type
),
13101 build_tree_list (NULL_TREE
, op
)),
13105 /* Any other casts are proven incorrect at compile time */
13106 t1
= strdup (lang_printable_name (op_type
, 0));
13107 parse_error_context (wfl_operator
, "Invalid cast from `%s' to `%s'",
13108 t1
, lang_printable_name (cast_type
, 0));
13110 return error_mark_node
;
13113 /* Build a null constant and give it the type TYPE. */
13116 build_null_of_type (type
)
13119 tree node
= build_int_2 (0, 0);
13120 TREE_TYPE (node
) = promote_type (type
);
13124 /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
13125 a list of indices. */
13127 build_array_ref (location
, array
, index
)
13131 tree node
= build (ARRAY_REF
, NULL_TREE
, array
, index
);
13132 EXPR_WFL_LINECOL (node
) = location
;
13136 /* 15.12 Array Access Expression */
13139 patch_array_ref (node
)
13142 tree array
= TREE_OPERAND (node
, 0);
13143 tree array_type
= TREE_TYPE (array
);
13144 tree index
= TREE_OPERAND (node
, 1);
13145 tree index_type
= TREE_TYPE (index
);
13146 int error_found
= 0;
13148 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13150 if (TREE_CODE (array_type
) == POINTER_TYPE
)
13151 array_type
= TREE_TYPE (array_type
);
13153 /* The array reference must be an array */
13154 if (!TYPE_ARRAY_P (array_type
))
13156 parse_error_context
13157 (wfl_operator
, "`[]' can only be applied to arrays. It can't be "
13158 "applied to `%s'", lang_printable_name (array_type
, 0));
13159 TREE_TYPE (node
) = error_mark_node
;
13163 /* The array index underdoes unary numeric promotion. The promoted
13164 type must be int */
13165 index
= do_unary_numeric_promotion (index
);
13166 if (TREE_TYPE (index
) != int_type_node
)
13168 int could_cast
= valid_cast_to_p (index_type
, int_type_node
);
13169 parse_error_context
13171 (could_cast
? "Incompatible type for `[]'. Explicit cast needed to "
13172 "convert `%s' to `int'" : "Incompatible type for `[]'. "
13173 "Can't convert `%s' to `int'"),
13174 lang_printable_name (index_type
, 0));
13175 TREE_TYPE (node
) = error_mark_node
;
13180 return error_mark_node
;
13182 array_type
= TYPE_ARRAY_ELEMENT (array_type
);
13184 if (flag_emit_class_files
|| flag_emit_xref
)
13186 TREE_OPERAND (node
, 0) = array
;
13187 TREE_OPERAND (node
, 1) = index
;
13191 /* The save_expr is for correct evaluation order. It would be cleaner
13192 to use force_evaluation_order (see comment there), but that is
13193 difficult when we also have to deal with bounds checking. */
13194 if (TREE_SIDE_EFFECTS (index
))
13195 array
= save_expr (array
);
13196 node
= build_java_arrayaccess (array
, array_type
, index
);
13197 if (TREE_SIDE_EFFECTS (index
))
13198 node
= build (COMPOUND_EXPR
, array_type
, array
, node
);
13200 TREE_TYPE (node
) = array_type
;
13204 /* 15.9 Array Creation Expressions */
13207 build_newarray_node (type
, dims
, extra_dims
)
13213 build (NEW_ARRAY_EXPR
, NULL_TREE
, type
, nreverse (dims
),
13214 build_int_2 (extra_dims
, 0));
13219 patch_newarray (node
)
13222 tree type
= TREE_OPERAND (node
, 0);
13223 tree dims
= TREE_OPERAND (node
, 1);
13224 tree cdim
, array_type
;
13225 int error_found
= 0;
13227 int xdims
= TREE_INT_CST_LOW (TREE_OPERAND (node
, 2));
13229 /* Dimension types are verified. It's better for the types to be
13230 verified in order. */
13231 for (cdim
= dims
, ndims
= 0; cdim
; cdim
= TREE_CHAIN (cdim
), ndims
++ )
13234 tree dim
= TREE_VALUE (cdim
);
13236 /* Dim might have been saved during its evaluation */
13237 dim
= (TREE_CODE (dim
) == SAVE_EXPR
? dim
= TREE_OPERAND (dim
, 0) : dim
);
13239 /* The type of each specified dimension must be an integral type. */
13240 if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim
)))
13243 /* Each expression undergoes an unary numeric promotion (5.6.1) and the
13244 promoted type must be int. */
13247 dim
= do_unary_numeric_promotion (dim
);
13248 if (TREE_TYPE (dim
) != int_type_node
)
13252 /* Report errors on types here */
13255 parse_error_context
13256 (TREE_PURPOSE (cdim
),
13257 "Incompatible type for dimension in array creation expression. "
13258 "%s convert `%s' to `int'",
13259 (valid_cast_to_p (TREE_TYPE (dim
), int_type_node
) ?
13260 "Explicit cast needed to" : "Can't"),
13261 lang_printable_name (TREE_TYPE (dim
), 0));
13265 TREE_PURPOSE (cdim
) = NULL_TREE
;
13268 /* Resolve array base type if unresolved */
13269 if (!(type
= resolve_type_during_patch (type
)))
13274 /* We don't want further evaluation of this bogus array creation
13276 TREE_TYPE (node
) = error_mark_node
;
13277 return error_mark_node
;
13280 /* Set array_type to the actual (promoted) array type of the result. */
13281 if (TREE_CODE (type
) == RECORD_TYPE
)
13282 type
= build_pointer_type (type
);
13283 while (--xdims
>= 0)
13285 type
= promote_type (build_java_array_type (type
, -1));
13287 dims
= nreverse (dims
);
13289 for (cdim
= dims
; cdim
; cdim
= TREE_CHAIN (cdim
))
13292 array_type
= build_java_array_type (type
,
13293 TREE_CODE (cdim
) == INTEGER_CST
?
13294 TREE_INT_CST_LOW (cdim
) : -1);
13295 array_type
= promote_type (array_type
);
13297 dims
= nreverse (dims
);
13299 /* The node is transformed into a function call. Things are done
13300 differently according to the number of dimensions. If the number
13301 of dimension is equal to 1, then the nature of the base type
13302 (primitive or not) matters. */
13304 return build_new_array (type
, TREE_VALUE (dims
));
13306 /* Can't reuse what's already written in expr.c because it uses the
13307 JVM stack representation. Provide a build_multianewarray. FIXME */
13308 return build (CALL_EXPR
, array_type
,
13309 build_address_of (soft_multianewarray_node
),
13310 tree_cons (NULL_TREE
, build_class_ref (TREE_TYPE (array_type
)),
13311 tree_cons (NULL_TREE
,
13312 build_int_2 (ndims
, 0), dims
)),
13316 /* 10.6 Array initializer. */
13318 /* Build a wfl for array element that don't have one, so we can
13319 pin-point errors. */
13322 maybe_build_array_element_wfl (node
)
13325 if (TREE_CODE (node
) != EXPR_WITH_FILE_LOCATION
)
13326 return build_expr_wfl (NULL_TREE
, ctxp
->filename
,
13327 ctxp
->elc
.line
, ctxp
->elc
.prev_col
);
13332 /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
13333 identification of initialized arrays easier to detect during walk
13337 build_new_array_init (location
, values
)
13341 tree constructor
= build (CONSTRUCTOR
, NULL_TREE
, NULL_TREE
, values
);
13342 tree to_return
= build1 (NEW_ARRAY_INIT
, NULL_TREE
, constructor
);
13343 EXPR_WFL_LINECOL (to_return
) = location
;
13347 /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
13348 occurred. Otherwise return NODE after having set its type
13352 patch_new_array_init (type
, node
)
13355 int error_seen
= 0;
13356 tree current
, element_type
;
13357 HOST_WIDE_INT length
;
13358 int all_constant
= 1;
13359 tree init
= TREE_OPERAND (node
, 0);
13361 if (TREE_CODE (type
) != POINTER_TYPE
|| ! TYPE_ARRAY_P (TREE_TYPE (type
)))
13363 parse_error_context (node
,
13364 "Invalid array initializer for non-array type `%s'",
13365 lang_printable_name (type
, 1));
13366 return error_mark_node
;
13368 type
= TREE_TYPE (type
);
13369 element_type
= TYPE_ARRAY_ELEMENT (type
);
13371 CONSTRUCTOR_ELTS (init
) = nreverse (CONSTRUCTOR_ELTS (init
));
13373 for (length
= 0, current
= CONSTRUCTOR_ELTS (init
);
13374 current
; length
++, current
= TREE_CHAIN (current
))
13376 tree elt
= TREE_VALUE (current
);
13377 if (elt
== NULL_TREE
|| TREE_CODE (elt
) != NEW_ARRAY_INIT
)
13379 error_seen
|= array_constructor_check_entry (element_type
, current
);
13380 elt
= TREE_VALUE (current
);
13381 /* When compiling to native code, STRING_CST is converted to
13382 INDIRECT_REF, but still with a TREE_CONSTANT flag. */
13383 if (! TREE_CONSTANT (elt
) || TREE_CODE (elt
) == INDIRECT_REF
)
13388 TREE_VALUE (current
) = patch_new_array_init (element_type
, elt
);
13389 TREE_PURPOSE (current
) = NULL_TREE
;
13392 if (elt
&& TREE_VALUE (elt
) == error_mark_node
)
13397 return error_mark_node
;
13399 /* Create a new type. We can't reuse the one we have here by
13400 patching its dimension because it originally is of dimension -1
13401 hence reused by gcc. This would prevent triangular arrays. */
13402 type
= build_java_array_type (element_type
, length
);
13403 TREE_TYPE (init
) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type
))));
13404 TREE_TYPE (node
) = promote_type (type
);
13405 TREE_CONSTANT (init
) = all_constant
;
13406 TREE_CONSTANT (node
) = all_constant
;
13410 /* Verify that one entry of the initializer element list can be
13411 assigned to the array base type. Report 1 if an error occurred, 0
13415 array_constructor_check_entry (type
, entry
)
13418 char *array_type_string
= NULL
; /* For error reports */
13419 tree value
, type_value
, new_value
, wfl_value
, patched
;
13420 int error_seen
= 0;
13422 new_value
= NULL_TREE
;
13423 wfl_value
= TREE_VALUE (entry
);
13425 value
= java_complete_tree (TREE_VALUE (entry
));
13426 /* patch_string return error_mark_node if arg is error_mark_node */
13427 if ((patched
= patch_string (value
)))
13429 if (value
== error_mark_node
)
13432 type_value
= TREE_TYPE (value
);
13434 /* At anytime, try_builtin_assignconv can report a warning on
13435 constant overflow during narrowing. */
13436 SET_WFL_OPERATOR (wfl_operator
, TREE_PURPOSE (entry
), wfl_value
);
13437 new_value
= try_builtin_assignconv (wfl_operator
, type
, value
);
13438 if (!new_value
&& (new_value
= try_reference_assignconv (type
, value
)))
13439 type_value
= promote_type (type
);
13441 /* Check and report errors */
13444 const char *msg
= (!valid_cast_to_p (type_value
, type
) ?
13445 "Can't" : "Explicit cast needed to");
13446 if (!array_type_string
)
13447 array_type_string
= strdup (lang_printable_name (type
, 1));
13448 parse_error_context
13449 (wfl_operator
, "Incompatible type for array. %s convert `%s' to `%s'",
13450 msg
, lang_printable_name (type_value
, 1), array_type_string
);
13456 new_value
= maybe_build_primttype_type_ref (new_value
, wfl_operator
);
13457 TREE_VALUE (entry
) = new_value
;
13460 if (array_type_string
)
13461 free (array_type_string
);
13463 TREE_PURPOSE (entry
) = NULL_TREE
;
13468 build_this (location
)
13471 tree node
= build_wfl_node (this_identifier_node
);
13472 TREE_SET_CODE (node
, THIS_EXPR
);
13473 EXPR_WFL_LINECOL (node
) = location
;
13477 /* 14.15 The return statement. It builds a modify expression that
13478 assigns the returned value to the RESULT_DECL that hold the value
13482 build_return (location
, op
)
13486 tree node
= build1 (RETURN_EXPR
, NULL_TREE
, op
);
13487 EXPR_WFL_LINECOL (node
) = location
;
13488 node
= build_debugable_stmt (location
, node
);
13493 patch_return (node
)
13496 tree return_exp
= TREE_OPERAND (node
, 0);
13497 tree meth
= current_function_decl
;
13498 tree mtype
= TREE_TYPE (TREE_TYPE (current_function_decl
));
13499 int error_found
= 0;
13501 TREE_TYPE (node
) = error_mark_node
;
13502 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13504 /* It's invalid to have a return value within a function that is
13505 declared with the keyword void or that is a constructor */
13506 if (return_exp
&& (mtype
== void_type_node
|| DECL_CONSTRUCTOR_P (meth
)))
13509 /* It's invalid to use a return statement in a static block */
13510 if (IS_CLINIT (current_function_decl
))
13513 /* It's invalid to have a no return value within a function that
13514 isn't declared with the keyword `void' */
13515 if (!return_exp
&& (mtype
!= void_type_node
&& !DECL_CONSTRUCTOR_P (meth
)))
13520 if (IS_CLINIT (current_function_decl
))
13521 parse_error_context (wfl_operator
,
13522 "`return' inside static initializer.");
13524 else if (!DECL_CONSTRUCTOR_P (meth
))
13526 char *t
= strdup (lang_printable_name (mtype
, 0));
13527 parse_error_context (wfl_operator
,
13528 "`return' with%s value from `%s %s'",
13529 (error_found
== 1 ? "" : "out"),
13530 t
, lang_printable_name (meth
, 0));
13534 parse_error_context (wfl_operator
,
13535 "`return' with value from constructor `%s'",
13536 lang_printable_name (meth
, 0));
13537 return error_mark_node
;
13540 /* If we have a return_exp, build a modify expression and expand
13541 it. Note: at that point, the assignment is declared valid, but we
13542 may want to carry some more hacks */
13545 tree exp
= java_complete_tree (return_exp
);
13546 tree modify
, patched
;
13548 /* If the function returned value and EXP are booleans, EXP has
13549 to be converted into the type of DECL_RESULT, which is integer
13550 (see complete_start_java_method) */
13551 if (TREE_TYPE (exp
) == boolean_type_node
&&
13552 TREE_TYPE (TREE_TYPE (meth
)) == boolean_type_node
)
13553 exp
= convert_to_integer (TREE_TYPE (DECL_RESULT (meth
)), exp
);
13555 /* `null' can be assigned to a function returning a reference */
13556 if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth
))) &&
13557 exp
== null_pointer_node
)
13558 exp
= build_null_of_type (TREE_TYPE (TREE_TYPE (meth
)));
13560 if ((patched
= patch_string (exp
)))
13563 modify
= build (MODIFY_EXPR
, NULL_TREE
, DECL_RESULT (meth
), exp
);
13564 EXPR_WFL_LINECOL (modify
) = EXPR_WFL_LINECOL (node
);
13565 modify
= java_complete_tree (modify
);
13567 if (modify
!= error_mark_node
)
13569 TREE_SIDE_EFFECTS (modify
) = 1;
13570 TREE_OPERAND (node
, 0) = modify
;
13573 return error_mark_node
;
13575 TREE_TYPE (node
) = void_type_node
;
13576 TREE_SIDE_EFFECTS (node
) = 1;
13580 /* 14.8 The if Statement */
13583 build_if_else_statement (location
, expression
, if_body
, else_body
)
13585 tree expression
, if_body
, else_body
;
13589 else_body
= empty_stmt_node
;
13590 node
= build (COND_EXPR
, NULL_TREE
, expression
, if_body
, else_body
);
13591 EXPR_WFL_LINECOL (node
) = location
;
13592 node
= build_debugable_stmt (location
, node
);
13597 patch_if_else_statement (node
)
13600 tree expression
= TREE_OPERAND (node
, 0);
13602 TREE_TYPE (node
) = error_mark_node
;
13603 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13605 /* The type of expression must be boolean */
13606 if (TREE_TYPE (expression
) != boolean_type_node
13607 && TREE_TYPE (expression
) != promoted_boolean_type_node
)
13609 parse_error_context
13611 "Incompatible type for `if'. Can't convert `%s' to `boolean'",
13612 lang_printable_name (TREE_TYPE (expression
), 0));
13613 return error_mark_node
;
13616 TREE_TYPE (node
) = void_type_node
;
13617 TREE_SIDE_EFFECTS (node
) = 1;
13618 CAN_COMPLETE_NORMALLY (node
)
13619 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1))
13620 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 2));
13624 /* 14.6 Labeled Statements */
13626 /* Action taken when a lableled statement is parsed. a new
13627 LABELED_BLOCK_EXPR is created. No statement is attached to the
13628 label, yet. LABEL can be NULL_TREE for artificially-generated blocks. */
13631 build_labeled_block (location
, label
)
13636 tree label_decl
, node
;
13637 if (label
== NULL_TREE
|| label
== continue_identifier_node
)
13638 label_name
= label
;
13641 label_name
= merge_qualified_name (label_id
, label
);
13642 /* Issue an error if we try to reuse a label that was previously
13644 if (IDENTIFIER_LOCAL_VALUE (label_name
))
13646 EXPR_WFL_LINECOL (wfl_operator
) = location
;
13647 parse_error_context (wfl_operator
, "Declaration of `%s' shadows "
13648 "a previous label declaration",
13649 IDENTIFIER_POINTER (label
));
13650 EXPR_WFL_LINECOL (wfl_operator
) =
13651 EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name
));
13652 parse_error_context (wfl_operator
, "This is the location of the "
13653 "previous declaration of label `%s'",
13654 IDENTIFIER_POINTER (label
));
13655 java_error_count
--;
13659 label_decl
= create_label_decl (label_name
);
13660 node
= build (LABELED_BLOCK_EXPR
, NULL_TREE
, label_decl
, NULL_TREE
);
13661 EXPR_WFL_LINECOL (node
) = location
;
13662 TREE_SIDE_EFFECTS (node
) = 1;
13666 /* A labeled statement LBE is attached a statement. */
13669 finish_labeled_statement (lbe
, statement
)
13670 tree lbe
; /* Labeled block expr */
13673 /* In anyways, tie the loop to its statement */
13674 LABELED_BLOCK_BODY (lbe
) = statement
;
13675 pop_labeled_block ();
13676 POP_LABELED_BLOCK ();
13680 /* 14.10, 14.11, 14.12 Loop Statements */
13682 /* Create an empty LOOP_EXPR and make it the last in the nested loop
13686 build_new_loop (loop_body
)
13689 tree loop
= build (LOOP_EXPR
, NULL_TREE
, loop_body
);
13690 TREE_SIDE_EFFECTS (loop
) = 1;
13695 /* Create a loop body according to the following structure:
13697 COMPOUND_EXPR (loop main body)
13698 EXIT_EXPR (this order is for while/for loops.
13699 LABELED_BLOCK_EXPR the order is reversed for do loops)
13700 LABEL_DECL (a continue occuring here branches at the
13701 BODY end of this labeled block)
13704 REVERSED, if non zero, tells that the loop condition expr comes
13705 after the body, like in the do-while loop.
13707 To obtain a loop, the loop body structure described above is
13708 encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
13711 LABEL_DECL (use this label to exit the loop)
13713 <structure described above> */
13716 build_loop_body (location
, condition
, reversed
)
13721 tree first
, second
, body
;
13723 condition
= build (EXIT_EXPR
, NULL_TREE
, condition
); /* Force walk */
13724 EXPR_WFL_LINECOL (condition
) = location
; /* For accurate error report */
13725 condition
= build_debugable_stmt (location
, condition
);
13726 TREE_SIDE_EFFECTS (condition
) = 1;
13728 body
= build_labeled_block (0, continue_identifier_node
);
13729 first
= (reversed
? body
: condition
);
13730 second
= (reversed
? condition
: body
);
13732 build (COMPOUND_EXPR
, NULL_TREE
,
13733 build (COMPOUND_EXPR
, NULL_TREE
, first
, second
), empty_stmt_node
);
13736 /* Install CONDITION (if any) and loop BODY (using REVERSED to tell
13737 their order) on the current loop. Unlink the current loop from the
13741 finish_loop_body (location
, condition
, body
, reversed
)
13743 tree condition
, body
;
13746 tree to_return
= ctxp
->current_loop
;
13747 tree loop_body
= LOOP_EXPR_BODY (to_return
);
13750 tree cnode
= LOOP_EXPR_BODY_CONDITION_EXPR (loop_body
, reversed
);
13751 /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
13752 The real EXIT_EXPR is one operand further. */
13753 EXPR_WFL_LINECOL (cnode
) = location
;
13754 /* This one is for accurate error reports */
13755 EXPR_WFL_LINECOL (TREE_OPERAND (cnode
, 0)) = location
;
13756 TREE_OPERAND (TREE_OPERAND (cnode
, 0), 0) = condition
;
13758 LOOP_EXPR_BODY_BODY_EXPR (loop_body
, reversed
) = body
;
13763 /* Tailored version of finish_loop_body for FOR loops, when FOR
13764 loops feature the condition part */
13767 finish_for_loop (location
, condition
, update
, body
)
13769 tree condition
, update
, body
;
13771 /* Put the condition and the loop body in place */
13772 tree loop
= finish_loop_body (location
, condition
, body
, 0);
13773 /* LOOP is the current loop which has been now popped of the loop
13774 stack. Install the update block */
13775 LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop
)) = update
;
13779 /* Try to find the loop a block might be related to. This comprises
13780 the case where the LOOP_EXPR is found as the second operand of a
13781 COMPOUND_EXPR, because the loop happens to have an initialization
13782 part, then expressed as the first operand of the COMPOUND_EXPR. If
13783 the search finds something, 1 is returned. Otherwise, 0 is
13784 returned. The search is assumed to start from a
13785 LABELED_BLOCK_EXPR's block. */
13788 search_loop (statement
)
13791 if (TREE_CODE (statement
) == LOOP_EXPR
)
13794 if (TREE_CODE (statement
) == BLOCK
)
13795 statement
= BLOCK_SUBBLOCKS (statement
);
13799 if (statement
&& TREE_CODE (statement
) == COMPOUND_EXPR
)
13800 while (statement
&& TREE_CODE (statement
) == COMPOUND_EXPR
)
13801 statement
= TREE_OPERAND (statement
, 1);
13803 return (TREE_CODE (statement
) == LOOP_EXPR
13804 && IS_FOR_LOOP_P (statement
) ? statement
: NULL_TREE
);
13807 /* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
13808 returned otherwise. */
13811 labeled_block_contains_loop_p (block
, loop
)
13817 if (LABELED_BLOCK_BODY (block
) == loop
)
13820 if (IS_FOR_LOOP_P (loop
)
13821 && search_loop (LABELED_BLOCK_BODY (block
)) == loop
)
13827 /* If the loop isn't surrounded by a labeled statement, create one and
13828 insert LOOP as its body. */
13831 patch_loop_statement (loop
)
13836 TREE_TYPE (loop
) = void_type_node
;
13837 if (labeled_block_contains_loop_p (ctxp
->current_labeled_block
, loop
))
13840 loop_label
= build_labeled_block (0, NULL_TREE
);
13841 /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
13842 that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
13843 LABELED_BLOCK_BODY (loop_label
) = loop
;
13844 PUSH_LABELED_BLOCK (loop_label
);
13848 /* 14.13, 14.14: break and continue Statements */
13850 /* Build a break or a continue statement. a null NAME indicates an
13851 unlabeled break/continue statement. */
13854 build_bc_statement (location
, is_break
, name
)
13855 int location
, is_break
;
13858 tree break_continue
, label_block_expr
= NULL_TREE
;
13862 if (!(label_block_expr
= IDENTIFIER_LOCAL_VALUE
13863 (merge_qualified_name (label_id
, EXPR_WFL_NODE (name
)))))
13864 /* Null means that we don't have a target for this named
13865 break/continue. In this case, we make the target to be the
13866 label name, so that the error can be reported accuratly in
13867 patch_bc_statement. */
13868 label_block_expr
= EXPR_WFL_NODE (name
);
13870 /* Unlabeled break/continue will be handled during the
13871 break/continue patch operation */
13873 = build (EXIT_BLOCK_EXPR
, NULL_TREE
, label_block_expr
, NULL_TREE
);
13875 IS_BREAK_STMT_P (break_continue
) = is_break
;
13876 TREE_SIDE_EFFECTS (break_continue
) = 1;
13877 EXPR_WFL_LINECOL (break_continue
) = location
;
13878 break_continue
= build_debugable_stmt (location
, break_continue
);
13879 return break_continue
;
13882 /* Verification of a break/continue statement. */
13885 patch_bc_statement (node
)
13888 tree bc_label
= EXIT_BLOCK_LABELED_BLOCK (node
), target_stmt
;
13889 tree labeled_block
= ctxp
->current_labeled_block
;
13890 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13892 /* Having an identifier here means that the target is unknown. */
13893 if (bc_label
!= NULL_TREE
&& TREE_CODE (bc_label
) == IDENTIFIER_NODE
)
13895 parse_error_context (wfl_operator
, "No label definition found for `%s'",
13896 IDENTIFIER_POINTER (bc_label
));
13897 return error_mark_node
;
13899 if (! IS_BREAK_STMT_P (node
))
13901 /* It's a continue statement. */
13902 for (;; labeled_block
= TREE_CHAIN (labeled_block
))
13904 if (labeled_block
== NULL_TREE
)
13906 if (bc_label
== NULL_TREE
)
13907 parse_error_context (wfl_operator
,
13908 "`continue' must be in loop");
13910 parse_error_context
13911 (wfl_operator
, "continue label `%s' does not name a loop",
13912 IDENTIFIER_POINTER (bc_label
));
13913 return error_mark_node
;
13915 if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block
))
13916 == continue_identifier_node
)
13917 && (bc_label
== NULL_TREE
13918 || TREE_CHAIN (labeled_block
) == bc_label
))
13920 bc_label
= labeled_block
;
13925 else if (!bc_label
)
13927 for (;; labeled_block
= TREE_CHAIN (labeled_block
))
13929 if (labeled_block
== NULL_TREE
)
13931 parse_error_context (wfl_operator
,
13932 "`break' must be in loop or switch");
13933 return error_mark_node
;
13935 target_stmt
= LABELED_BLOCK_BODY (labeled_block
);
13936 if (TREE_CODE (target_stmt
) == SWITCH_EXPR
13937 || search_loop (target_stmt
))
13939 bc_label
= labeled_block
;
13945 EXIT_BLOCK_LABELED_BLOCK (node
) = bc_label
;
13946 CAN_COMPLETE_NORMALLY (bc_label
) = 1;
13948 /* Our break/continue don't return values. */
13949 TREE_TYPE (node
) = void_type_node
;
13950 /* Encapsulate the break within a compound statement so that it's
13951 expanded all the times by expand_expr (and not clobbered
13952 sometimes, like after a if statement) */
13953 node
= add_stmt_to_compound (NULL_TREE
, void_type_node
, node
);
13954 TREE_SIDE_EFFECTS (node
) = 1;
13958 /* Process the exit expression belonging to a loop. Its type must be
13962 patch_exit_expr (node
)
13965 tree expression
= TREE_OPERAND (node
, 0);
13966 TREE_TYPE (node
) = error_mark_node
;
13967 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13969 /* The type of expression must be boolean */
13970 if (TREE_TYPE (expression
) != boolean_type_node
)
13972 parse_error_context
13974 "Incompatible type for loop conditional. Can't convert `%s' to "
13976 lang_printable_name (TREE_TYPE (expression
), 0));
13977 return error_mark_node
;
13979 /* Now we know things are allright, invert the condition, fold and
13981 TREE_OPERAND (node
, 0) =
13982 fold (build1 (TRUTH_NOT_EXPR
, boolean_type_node
, expression
));
13984 if (! integer_zerop (TREE_OPERAND (node
, 0))
13985 && ctxp
->current_loop
!= NULL_TREE
13986 && TREE_CODE (ctxp
->current_loop
) == LOOP_EXPR
)
13987 CAN_COMPLETE_NORMALLY (ctxp
->current_loop
) = 1;
13988 if (! integer_onep (TREE_OPERAND (node
, 0)))
13989 CAN_COMPLETE_NORMALLY (node
) = 1;
13992 TREE_TYPE (node
) = void_type_node
;
13996 /* 14.9 Switch statement */
13999 patch_switch_statement (node
)
14002 tree se
= TREE_OPERAND (node
, 0), se_type
;
14004 /* Complete the switch expression */
14005 se
= TREE_OPERAND (node
, 0) = java_complete_tree (se
);
14006 se_type
= TREE_TYPE (se
);
14007 /* The type of the switch expression must be char, byte, short or
14009 if (!JINTEGRAL_TYPE_P (se_type
))
14011 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
14012 parse_error_context (wfl_operator
, "Incompatible type for `switch'. "
14013 "Can't convert `%s' to `int'",
14014 lang_printable_name (se_type
, 0));
14015 /* This is what java_complete_tree will check */
14016 TREE_OPERAND (node
, 0) = error_mark_node
;
14017 return error_mark_node
;
14020 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
14022 /* Ready to return */
14023 if (TREE_CODE (TREE_OPERAND (node
, 1)) == ERROR_MARK
)
14025 TREE_TYPE (node
) = error_mark_node
;
14026 return error_mark_node
;
14028 TREE_TYPE (node
) = void_type_node
;
14029 TREE_SIDE_EFFECTS (node
) = 1;
14030 CAN_COMPLETE_NORMALLY (node
)
14031 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1))
14032 || ! SWITCH_HAS_DEFAULT (node
);
14036 /* 14.18 The try statement */
14039 build_try_statement (location
, try_block
, catches
)
14041 tree try_block
, catches
;
14043 tree node
= build (TRY_EXPR
, NULL_TREE
, try_block
, catches
);
14044 EXPR_WFL_LINECOL (node
) = location
;
14049 build_try_finally_statement (location
, try_block
, finally
)
14051 tree try_block
, finally
;
14053 tree node
= build (TRY_FINALLY_EXPR
, NULL_TREE
, try_block
, finally
);
14054 EXPR_WFL_LINECOL (node
) = location
;
14059 patch_try_statement (node
)
14062 int error_found
= 0;
14063 tree
try = TREE_OPERAND (node
, 0);
14064 /* Exception handlers are considered in left to right order */
14065 tree
catch = nreverse (TREE_OPERAND (node
, 1));
14066 tree current
, caught_type_list
= NULL_TREE
;
14068 /* Check catch clauses, if any. Every time we find an error, we try
14069 to process the next catch clause. We process the catch clause before
14070 the try block so that when processing the try block we can check thrown
14071 exceptions againts the caught type list. */
14072 for (current
= catch; current
; current
= TREE_CHAIN (current
))
14074 tree carg_decl
, carg_type
;
14075 tree sub_current
, catch_block
, catch_clause
;
14078 /* At this point, the structure of the catch clause is
14079 CATCH_EXPR (catch node)
14080 BLOCK (with the decl of the parameter)
14082 MODIFY_EXPR (assignment of the catch parameter)
14083 BLOCK (catch clause block)
14085 catch_clause
= TREE_OPERAND (current
, 0);
14086 carg_decl
= BLOCK_EXPR_DECLS (catch_clause
);
14087 carg_type
= TREE_TYPE (TREE_TYPE (carg_decl
));
14089 /* Catch clauses can't have more than one parameter declared,
14090 but it's already enforced by the grammar. Make sure that the
14091 only parameter of the clause statement in of class Throwable
14092 or a subclass of Throwable, but that was done earlier. The
14093 catch clause parameter type has also been resolved. */
14095 /* Just make sure that the catch clause parameter type inherits
14096 from java.lang.Throwable */
14097 if (!inherits_from_p (carg_type
, throwable_type_node
))
14099 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (current
);
14100 parse_error_context (wfl_operator
,
14101 "Can't catch class `%s'. Catch clause "
14102 "parameter type must be a subclass of "
14103 "class `java.lang.Throwable'",
14104 lang_printable_name (carg_type
, 0));
14109 /* Partial check for unreachable catch statement: The catch
14110 clause is reachable iff is no earlier catch block A in
14111 the try statement such that the type of the catch
14112 clause's parameter is the same as or a subclass of the
14113 type of A's parameter */
14115 for (sub_current
= catch;
14116 sub_current
!= current
; sub_current
= TREE_CHAIN (sub_current
))
14118 tree sub_catch_clause
, decl
;
14119 sub_catch_clause
= TREE_OPERAND (sub_current
, 0);
14120 decl
= BLOCK_EXPR_DECLS (sub_catch_clause
);
14122 if (inherits_from_p (carg_type
, TREE_TYPE (TREE_TYPE (decl
))))
14124 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (current
);
14125 parse_error_context
14126 (wfl_operator
, "`catch' not reached because of the catch "
14127 "clause at line %d", EXPR_WFL_LINENO (sub_current
));
14128 unreachable
= error_found
= 1;
14132 /* Complete the catch clause block */
14133 catch_block
= java_complete_tree (TREE_OPERAND (current
, 0));
14134 if (catch_block
== error_mark_node
)
14139 if (CAN_COMPLETE_NORMALLY (catch_block
))
14140 CAN_COMPLETE_NORMALLY (node
) = 1;
14141 TREE_OPERAND (current
, 0) = catch_block
;
14146 /* Things to do here: the exception must be thrown */
14148 /* Link this type to the caught type list */
14149 caught_type_list
= tree_cons (NULL_TREE
, carg_type
, caught_type_list
);
14152 PUSH_EXCEPTIONS (caught_type_list
);
14153 if ((try = java_complete_tree (try)) == error_mark_node
)
14155 if (CAN_COMPLETE_NORMALLY (try))
14156 CAN_COMPLETE_NORMALLY (node
) = 1;
14159 /* Verification ends here */
14161 return error_mark_node
;
14163 TREE_OPERAND (node
, 0) = try;
14164 TREE_OPERAND (node
, 1) = catch;
14165 TREE_TYPE (node
) = void_type_node
;
14169 /* 14.17 The synchronized Statement */
14172 patch_synchronized_statement (node
, wfl_op1
)
14173 tree node
, wfl_op1
;
14175 tree expr
= java_complete_tree (TREE_OPERAND (node
, 0));
14176 tree block
= TREE_OPERAND (node
, 1);
14178 tree enter
, exit
, expr_decl
, assignment
;
14180 if (expr
== error_mark_node
)
14182 block
= java_complete_tree (block
);
14186 /* The TYPE of expr must be a reference type */
14187 if (!JREFERENCE_TYPE_P (TREE_TYPE (expr
)))
14189 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14190 parse_error_context (wfl_operator
, "Incompatible type for `synchronized'"
14191 ". Can't convert `%s' to `java.lang.Object'",
14192 lang_printable_name (TREE_TYPE (expr
), 0));
14193 return error_mark_node
;
14196 if (flag_emit_xref
)
14198 TREE_OPERAND (node
, 0) = expr
;
14199 TREE_OPERAND (node
, 1) = java_complete_tree (block
);
14200 CAN_COMPLETE_NORMALLY (node
) = 1;
14204 /* Generate a try-finally for the synchronized statement, except
14205 that the handler that catches all throw exception calls
14206 _Jv_MonitorExit and then rethrow the exception.
14207 The synchronized statement is then implemented as:
14210 _Jv_MonitorEnter (expression)
14212 _Jv_MonitorExit (expression)
14216 e = _Jv_exception_info ();
14217 _Jv_MonitorExit (expression)
14221 expr_decl
= build_decl (VAR_DECL
, generate_name (), TREE_TYPE (expr
));
14222 BUILD_MONITOR_ENTER (enter
, expr_decl
);
14223 BUILD_MONITOR_EXIT (exit
, expr_decl
);
14224 CAN_COMPLETE_NORMALLY (enter
) = 1;
14225 CAN_COMPLETE_NORMALLY (exit
) = 1;
14226 assignment
= build (MODIFY_EXPR
, NULL_TREE
, expr_decl
, expr
);
14227 TREE_SIDE_EFFECTS (assignment
) = 1;
14228 node
= build1 (CLEANUP_POINT_EXPR
, NULL_TREE
,
14229 build (COMPOUND_EXPR
, NULL_TREE
,
14230 build (WITH_CLEANUP_EXPR
, NULL_TREE
,
14231 build (COMPOUND_EXPR
, NULL_TREE
,
14232 assignment
, enter
),
14235 node
= build_expr_block (node
, expr_decl
);
14237 return java_complete_tree (node
);
14240 /* 14.16 The throw Statement */
14243 patch_throw_statement (node
, wfl_op1
)
14244 tree node
, wfl_op1
;
14246 tree expr
= TREE_OPERAND (node
, 0);
14247 tree type
= TREE_TYPE (expr
);
14248 int unchecked_ok
= 0, tryblock_throws_ok
= 0;
14250 /* Thrown expression must be assignable to java.lang.Throwable */
14251 if (!try_reference_assignconv (throwable_type_node
, expr
))
14253 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14254 parse_error_context (wfl_operator
, "Can't throw `%s'; it must be a "
14255 "subclass of class `java.lang.Throwable'",
14256 lang_printable_name (type
, 0));
14257 /* If the thrown expression was a reference, we further the
14258 compile-time check. */
14259 if (!JREFERENCE_TYPE_P (type
))
14260 return error_mark_node
;
14263 /* At least one of the following must be true */
14265 /* The type of the throw expression is a not checked exception,
14266 i.e. is a unchecked expression. */
14267 unchecked_ok
= IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type
));
14269 /* Throw is contained in a try statement and at least one catch
14270 clause can receive the thrown expression or the current method is
14271 declared to throw such an exception. Or, the throw statement is
14272 contained in a method or constructor declaration and the type of
14273 the Expression is assignable to at least one type listed in the
14274 throws clause the declaration. */
14275 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14277 tryblock_throws_ok
= check_thrown_exceptions_do (TREE_TYPE (expr
));
14278 if (!(unchecked_ok
|| tryblock_throws_ok
))
14280 /* If there is a surrounding try block that has no matching
14281 clatch clause, report it first. A surrounding try block exits
14282 only if there is something after the list of checked
14283 exception thrown by the current function (if any). */
14284 if (IN_TRY_BLOCK_P ())
14285 parse_error_context (wfl_operator
, "Checked exception `%s' can't be "
14286 "caught by any of the catch clause(s) "
14287 "of the surrounding `try' block",
14288 lang_printable_name (type
, 0));
14289 /* If we have no surrounding try statement and the method doesn't have
14290 any throws, report it now. FIXME */
14292 /* We report that the exception can't be throw from a try block
14293 in all circumstances but when the `throw' is inside a static
14295 else if (!EXCEPTIONS_P (currently_caught_type_list
)
14296 && !tryblock_throws_ok
)
14298 if (IS_CLINIT (current_function_decl
))
14299 parse_error_context (wfl_operator
, "Checked exception `%s' can't "
14300 "be thrown in initializer",
14301 lang_printable_name (type
, 0));
14303 parse_error_context (wfl_operator
, "Checked exception `%s' isn't "
14304 "thrown from a `try' block",
14305 lang_printable_name (type
, 0));
14307 /* Otherwise, the current method doesn't have the appropriate
14308 throws declaration */
14310 parse_error_context (wfl_operator
, "Checked exception `%s' doesn't "
14311 "match any of current method's `throws' "
14313 lang_printable_name (type
, 0));
14314 return error_mark_node
;
14317 if (! flag_emit_class_files
&& ! flag_emit_xref
)
14318 BUILD_THROW (node
, expr
);
14320 /* If doing xrefs, keep the location where the `throw' was seen. */
14321 if (flag_emit_xref
)
14322 EXPR_WFL_LINECOL (node
) = EXPR_WFL_LINECOL (wfl_op1
);
14326 /* Check that exception said to be thrown by method DECL can be
14327 effectively caught from where DECL is invoked. */
14330 check_thrown_exceptions (location
, decl
)
14335 /* For all the unchecked exceptions thrown by DECL */
14336 for (throws
= DECL_FUNCTION_THROWS (decl
); throws
;
14337 throws
= TREE_CHAIN (throws
))
14338 if (!check_thrown_exceptions_do (TREE_VALUE (throws
)))
14341 /* Temporary hack to suppresses errors about cloning arrays. FIXME */
14342 if (DECL_NAME (decl
) == get_identifier ("clone"))
14345 EXPR_WFL_LINECOL (wfl_operator
) = location
;
14346 if (DECL_NAME (current_function_decl
) == finit_identifier_node
)
14347 parse_error_context
14348 (wfl_operator
, "Exception `%s' can't be thrown in initializer",
14349 lang_printable_name (TREE_VALUE (throws
), 0));
14352 parse_error_context
14353 (wfl_operator
, "Exception `%s' must be caught, or it must be "
14354 "declared in the `throws' clause of `%s'",
14355 lang_printable_name (TREE_VALUE (throws
), 0),
14356 (DECL_NAME (current_function_decl
) == init_identifier_node
?
14357 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))) :
14358 IDENTIFIER_POINTER (DECL_NAME (current_function_decl
))));
14363 /* Return 1 if checked EXCEPTION is caught at the current nesting level of
14364 try-catch blocks, OR is listed in the `throws' clause of the
14368 check_thrown_exceptions_do (exception
)
14371 tree list
= currently_caught_type_list
;
14372 resolve_and_layout (exception
, NULL_TREE
);
14373 /* First, all the nested try-catch-finally at that stage. The
14374 last element contains `throws' clause exceptions, if any. */
14375 if (IS_UNCHECKED_EXCEPTION_P (exception
))
14380 for (caught
= TREE_VALUE (list
); caught
; caught
= TREE_CHAIN (caught
))
14381 if (valid_ref_assignconv_cast_p (exception
, TREE_VALUE (caught
), 0))
14383 list
= TREE_CHAIN (list
);
14389 purge_unchecked_exceptions (mdecl
)
14392 tree throws
= DECL_FUNCTION_THROWS (mdecl
);
14393 tree
new = NULL_TREE
;
14397 tree next
= TREE_CHAIN (throws
);
14398 if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws
)))
14400 TREE_CHAIN (throws
) = new;
14405 /* List is inverted here, but it doesn't matter */
14406 DECL_FUNCTION_THROWS (mdecl
) = new;
14409 /* 15.24 Conditional Operator ?: */
14412 patch_conditional_expr (node
, wfl_cond
, wfl_op1
)
14413 tree node
, wfl_cond
, wfl_op1
;
14415 tree cond
= TREE_OPERAND (node
, 0);
14416 tree op1
= TREE_OPERAND (node
, 1);
14417 tree op2
= TREE_OPERAND (node
, 2);
14418 tree resulting_type
= NULL_TREE
;
14419 tree t1
, t2
, patched
;
14420 int error_found
= 0;
14422 /* Operands of ?: might be StringBuffers crafted as a result of a
14423 string concatenation. Obtain a descent operand here. */
14424 if ((patched
= patch_string (op1
)))
14425 TREE_OPERAND (node
, 1) = op1
= patched
;
14426 if ((patched
= patch_string (op2
)))
14427 TREE_OPERAND (node
, 2) = op2
= patched
;
14429 t1
= TREE_TYPE (op1
);
14430 t2
= TREE_TYPE (op2
);
14432 /* The first expression must be a boolean */
14433 if (TREE_TYPE (cond
) != boolean_type_node
)
14435 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_cond
);
14436 parse_error_context (wfl_operator
, "Incompatible type for `?:'. Can't "
14437 "convert `%s' to `boolean'",
14438 lang_printable_name (TREE_TYPE (cond
), 0));
14442 /* Second and third can be numeric, boolean (i.e. primitive),
14443 references or null. Anything else results in an error */
14444 if (!((JNUMERIC_TYPE_P (t1
) && JNUMERIC_TYPE_P (t2
))
14445 || ((JREFERENCE_TYPE_P (t1
) || op1
== null_pointer_node
)
14446 && (JREFERENCE_TYPE_P (t2
) || op2
== null_pointer_node
))
14447 || (t1
== boolean_type_node
&& t2
== boolean_type_node
)))
14450 /* Determine the type of the conditional expression. Same types are
14451 easy to deal with */
14453 resulting_type
= t1
;
14455 /* There are different rules for numeric types */
14456 else if (JNUMERIC_TYPE_P (t1
))
14458 /* if byte/short found, the resulting type is short */
14459 if ((t1
== byte_type_node
&& t2
== short_type_node
)
14460 || (t1
== short_type_node
&& t2
== byte_type_node
))
14461 resulting_type
= short_type_node
;
14463 /* If t1 is a constant int and t2 is of type byte, short or char
14464 and t1's value fits in t2, then the resulting type is t2 */
14465 else if ((t1
== int_type_node
&& TREE_CONSTANT (TREE_OPERAND (node
, 1)))
14466 && JBSC_TYPE_P (t2
) && int_fits_type_p (TREE_OPERAND (node
, 1), t2
))
14467 resulting_type
= t2
;
14469 /* If t2 is a constant int and t1 is of type byte, short or char
14470 and t2's value fits in t1, then the resulting type is t1 */
14471 else if ((t2
== int_type_node
&& TREE_CONSTANT (TREE_OPERAND (node
, 2)))
14472 && JBSC_TYPE_P (t1
) && int_fits_type_p (TREE_OPERAND (node
, 2), t1
))
14473 resulting_type
= t1
;
14475 /* Otherwise, binary numeric promotion is applied and the
14476 resulting type is the promoted type of operand 1 and 2 */
14478 resulting_type
= binary_numeric_promotion (t1
, t2
,
14479 &TREE_OPERAND (node
, 1),
14480 &TREE_OPERAND (node
, 2));
14483 /* Cases of a reference and a null type */
14484 else if (JREFERENCE_TYPE_P (t1
) && op2
== null_pointer_node
)
14485 resulting_type
= t1
;
14487 else if (JREFERENCE_TYPE_P (t2
) && op1
== null_pointer_node
)
14488 resulting_type
= t2
;
14490 /* Last case: different reference types. If a type can be converted
14491 into the other one by assignment conversion, the latter
14492 determines the type of the expression */
14493 else if ((resulting_type
= try_reference_assignconv (t1
, op2
)))
14494 resulting_type
= promote_type (t1
);
14496 else if ((resulting_type
= try_reference_assignconv (t2
, op1
)))
14497 resulting_type
= promote_type (t2
);
14499 /* If we don't have any resulting type, we're in trouble */
14500 if (!resulting_type
)
14502 char *t
= strdup (lang_printable_name (t1
, 0));
14503 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14504 parse_error_context (wfl_operator
, "Incompatible type for `?:'. Can't "
14505 "convert `%s' to `%s'", t
,
14506 lang_printable_name (t2
, 0));
14513 TREE_TYPE (node
) = error_mark_node
;
14514 return error_mark_node
;
14517 TREE_TYPE (node
) = resulting_type
;
14518 TREE_SET_CODE (node
, COND_EXPR
);
14519 CAN_COMPLETE_NORMALLY (node
) = 1;
14523 /* Try to constant fold NODE.
14524 If NODE is not a constant expression, return NULL_EXPR.
14525 CONTEXT is a static final VAR_DECL whose initializer we are folding. */
14528 fold_constant_for_init (node
, context
)
14532 tree op0
, op1
, val
;
14533 enum tree_code code
= TREE_CODE (node
);
14535 if (code
== STRING_CST
)
14538 if (code
== INTEGER_CST
|| code
== REAL_CST
)
14539 return convert (TREE_TYPE (context
), node
);
14540 if (TREE_TYPE (node
) != NULL_TREE
&& code
!= VAR_DECL
&& code
!= FIELD_DECL
)
14548 case TRUNC_MOD_EXPR
:
14556 case TRUTH_ANDIF_EXPR
:
14557 case TRUTH_ORIF_EXPR
:
14564 op0
= TREE_OPERAND (node
, 0);
14565 op1
= TREE_OPERAND (node
, 1);
14566 val
= fold_constant_for_init (op0
, context
);
14567 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14569 TREE_OPERAND (node
, 0) = val
;
14570 val
= fold_constant_for_init (op1
, context
);
14571 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14573 TREE_OPERAND (node
, 1) = val
;
14574 return patch_binop (node
, op0
, op1
);
14576 case UNARY_PLUS_EXPR
:
14578 case TRUTH_NOT_EXPR
:
14581 op0
= TREE_OPERAND (node
, 0);
14582 val
= fold_constant_for_init (op0
, context
);
14583 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14585 TREE_OPERAND (node
, 0) = val
;
14586 return patch_unaryop (node
, op0
);
14590 val
= fold_constant_for_init (TREE_OPERAND (node
, 0), context
);
14591 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14593 TREE_OPERAND (node
, 0) = val
;
14594 val
= fold_constant_for_init (TREE_OPERAND (node
, 1), context
);
14595 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14597 TREE_OPERAND (node
, 1) = val
;
14598 val
= fold_constant_for_init (TREE_OPERAND (node
, 2), context
);
14599 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14601 TREE_OPERAND (node
, 2) = val
;
14602 return integer_zerop (TREE_OPERAND (node
, 0)) ? TREE_OPERAND (node
, 1)
14603 : TREE_OPERAND (node
, 2);
14607 if (! FIELD_FINAL (node
)
14608 || DECL_INITIAL (node
) == NULL_TREE
)
14610 val
= DECL_INITIAL (node
);
14611 /* Guard against infinite recursion. */
14612 DECL_INITIAL (node
) = NULL_TREE
;
14613 val
= fold_constant_for_init (val
, node
);
14614 DECL_INITIAL (node
) = val
;
14617 case EXPR_WITH_FILE_LOCATION
:
14618 /* Compare java_complete_tree and resolve_expression_name. */
14619 if (!EXPR_WFL_NODE (node
) /* Or a PRIMARY flag ? */
14620 || TREE_CODE (EXPR_WFL_NODE (node
)) == IDENTIFIER_NODE
)
14622 tree name
= EXPR_WFL_NODE (node
);
14624 if (PRIMARY_P (node
))
14626 else if (! QUALIFIED_P (name
))
14628 decl
= lookup_field_wrapper (DECL_CONTEXT (context
), name
);
14629 if (decl
== NULL_TREE
14630 || (! FIELD_STATIC (decl
) && ! FIELD_FINAL (decl
)))
14632 return fold_constant_for_init (decl
, decl
);
14636 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
14637 qualify_ambiguous_name (node
);
14638 if (resolve_field_access (node
, &decl
, NULL
)
14639 && decl
!= NULL_TREE
)
14640 return fold_constant_for_init (decl
, decl
);
14646 op0
= TREE_OPERAND (node
, 0);
14647 val
= fold_constant_for_init (op0
, context
);
14648 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14650 TREE_OPERAND (node
, 0) = val
;
14654 #ifdef USE_COMPONENT_REF
14656 case COMPONENT_REF
:
14665 #ifdef USE_COMPONENT_REF
14666 /* Context is 'T' for TypeName, 'P' for PackageName,
14667 'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */
14670 resolve_simple_name (name
, context
)
14677 resolve_qualified_name (name
, context
)