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
));
337 static int java_decl_equiv
PROTO ((tree
, tree
));
338 static int binop_compound_p
PROTO ((enum tree_code
));
339 static tree search_loop
PROTO ((tree
));
340 static int labeled_block_contains_loop_p
PROTO ((tree
, tree
));
341 static void check_abstract_method_definitions
PROTO ((int, tree
, tree
));
342 static void java_check_abstract_method_definitions
PROTO ((tree
));
344 /* Number of error found so far. */
345 int java_error_count
;
346 /* Number of warning found so far. */
347 int java_warning_count
;
348 /* Tell when not to fold, when doing xrefs */
351 /* The current parser context */
352 struct parser_ctxt
*ctxp
;
354 /* List of things that were analyzed for which code will be generated */
355 static struct parser_ctxt
*ctxp_for_generation
= NULL
;
357 /* binop_lookup maps token to tree_code. It is used where binary
358 operations are involved and required by the parser. RDIV_EXPR
359 covers both integral/floating point division. The code is changed
360 once the type of both operator is worked out. */
362 static enum tree_code binop_lookup
[19] =
364 PLUS_EXPR
, MINUS_EXPR
, MULT_EXPR
, RDIV_EXPR
, TRUNC_MOD_EXPR
,
365 LSHIFT_EXPR
, RSHIFT_EXPR
, URSHIFT_EXPR
,
366 BIT_AND_EXPR
, BIT_XOR_EXPR
, BIT_IOR_EXPR
,
367 TRUTH_ANDIF_EXPR
, TRUTH_ORIF_EXPR
,
368 EQ_EXPR
, NE_EXPR
, GT_EXPR
, GE_EXPR
, LT_EXPR
, LE_EXPR
,
370 #define BINOP_LOOKUP(VALUE) \
371 binop_lookup [((VALUE) - PLUS_TK)% \
372 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
374 /* This is the end index for binary operators that can also be used
375 in compound assignements. */
376 #define BINOP_COMPOUND_CANDIDATES 11
378 /* Fake WFL used to report error message. It is initialized once if
379 needed and reused with it's location information is overriden. */
380 tree wfl_operator
= NULL_TREE
;
382 /* The "$L" identifier we use to create labels. */
383 static tree label_id
= NULL_TREE
;
385 /* The "StringBuffer" identifier used for the String `+' operator. */
386 static tree wfl_string_buffer
= NULL_TREE
;
388 /* The "append" identifier used for String `+' operator. */
389 static tree wfl_append
= NULL_TREE
;
391 /* The "toString" identifier used for String `+' operator. */
392 static tree wfl_to_string
= NULL_TREE
;
394 /* The "java.lang" import qualified name. */
395 static tree java_lang_id
= NULL_TREE
;
397 /* The "java.lang.Cloneable" qualified name. */
398 static tree java_lang_cloneable
= NULL_TREE
;
400 /* Context and flag for static blocks */
401 static tree current_static_block
= NULL_TREE
;
404 #line 329 "./parse.y"
414 #line 339 "./parse.y"
432 #define YYFLAG -32768
435 #define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 266)
437 static const char yytranslate
[] = { 0,
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, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
464 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
465 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
466 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
467 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
468 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
469 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
470 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
471 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
472 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
473 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
478 static const short yyprhs
[] = { 0,
479 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
480 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
481 46, 50, 54, 56, 58, 60, 64, 66, 67, 69,
482 71, 73, 76, 79, 82, 86, 88, 91, 93, 96,
483 100, 103, 107, 109, 111, 115, 118, 122, 128, 133,
484 139, 141, 143, 145, 147, 149, 152, 153, 161, 162,
485 169, 173, 176, 180, 185, 186, 189, 193, 196, 197,
486 200, 203, 205, 209, 213, 216, 220, 222, 225, 227,
487 229, 231, 233, 235, 238, 240, 242, 244, 248, 253,
488 255, 259, 263, 265, 269, 273, 278, 280, 284, 287,
489 291, 295, 297, 299, 300, 304, 307, 311, 315, 320,
490 325, 328, 332, 335, 339, 342, 346, 351, 355, 359,
491 363, 365, 369, 373, 376, 380, 383, 387, 388, 391,
492 394, 396, 400, 404, 406, 409, 411, 414, 418, 420,
493 421, 425, 428, 432, 436, 441, 444, 448, 452, 457,
494 459, 462, 467, 473, 481, 488, 490, 492, 493, 498,
495 499, 505, 506, 512, 513, 520, 524, 529, 532, 536,
496 539, 543, 546, 550, 552, 555, 557, 559, 561, 563,
497 565, 568, 571, 574, 578, 583, 585, 589, 593, 596,
498 600, 602, 604, 606, 609, 611, 613, 615, 618, 621,
499 625, 627, 629, 631, 633, 635, 637, 639, 641, 643,
500 645, 647, 649, 651, 653, 655, 657, 659, 661, 663,
501 665, 667, 669, 671, 674, 677, 680, 683, 686, 689,
502 692, 695, 699, 704, 709, 715, 720, 726, 733, 741,
503 748, 750, 752, 754, 756, 758, 760, 762, 768, 771,
504 775, 780, 788, 796, 797, 801, 806, 809, 813, 819,
505 822, 826, 830, 835, 837, 840, 843, 845, 848, 852,
506 855, 858, 862, 865, 870, 873, 876, 880, 885, 888,
507 890, 898, 906, 913, 917, 923, 928, 936, 943, 946,
508 949, 953, 956, 957, 959, 961, 964, 965, 967, 969,
509 973, 977, 980, 984, 987, 991, 994, 998, 1001, 1005,
510 1008, 1012, 1015, 1019, 1023, 1026, 1030, 1036, 1042, 1045,
511 1050, 1054, 1056, 1060, 1064, 1069, 1072, 1074, 1077, 1080,
512 1085, 1088, 1092, 1097, 1100, 1103, 1105, 1107, 1109, 1111,
513 1115, 1117, 1119, 1121, 1123, 1127, 1131, 1135, 1139, 1143,
514 1147, 1151, 1155, 1161, 1166, 1173, 1179, 1184, 1190, 1196,
515 1203, 1207, 1211, 1216, 1222, 1225, 1229, 1233, 1237, 1239,
516 1243, 1247, 1251, 1255, 1260, 1265, 1270, 1275, 1279, 1283,
517 1285, 1288, 1292, 1296, 1299, 1302, 1306, 1310, 1314, 1318,
518 1321, 1325, 1330, 1336, 1343, 1349, 1356, 1361, 1366, 1371,
519 1376, 1380, 1385, 1389, 1394, 1396, 1398, 1400, 1402, 1405,
520 1408, 1410, 1412, 1415, 1418, 1420, 1423, 1426, 1429, 1432,
521 1435, 1438, 1440, 1443, 1446, 1448, 1451, 1454, 1460, 1465,
522 1470, 1476, 1481, 1484, 1490, 1495, 1501, 1503, 1507, 1511,
523 1515, 1519, 1523, 1527, 1529, 1533, 1537, 1541, 1545, 1547,
524 1551, 1555, 1559, 1563, 1567, 1571, 1573, 1577, 1581, 1585,
525 1589, 1593, 1597, 1601, 1605, 1609, 1613, 1615, 1619, 1623,
526 1627, 1631, 1633, 1637, 1641, 1643, 1647, 1651, 1653, 1657,
527 1661, 1663, 1667, 1671, 1673, 1677, 1681, 1683, 1689, 1694,
528 1698, 1704, 1706, 1708, 1712, 1716, 1718, 1720, 1722, 1724,
532 static const short yyrhs
[] = { 123,
533 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
534 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
535 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
536 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
537 0, 118, 97, 98, 0, 113, 97, 1, 0, 118,
538 97, 1, 0, 120, 0, 121, 0, 122, 0, 119,
539 101, 122, 0, 86, 0, 0, 126, 0, 124, 0,
540 125, 0, 126, 124, 0, 126, 125, 0, 124, 125,
541 0, 126, 124, 125, 0, 127, 0, 124, 127, 0,
542 130, 0, 125, 130, 0, 75, 119, 99, 0, 75,
543 1, 0, 75, 119, 1, 0, 128, 0, 129, 0,
544 55, 119, 99, 0, 55, 1, 0, 55, 119, 1,
545 0, 55, 119, 101, 5, 99, 0, 55, 119, 101,
546 1, 0, 55, 119, 101, 5, 1, 0, 132, 0,
547 166, 0, 99, 0, 1, 0, 44, 0, 131, 44,
548 0, 0, 131, 67, 122, 135, 136, 133, 138, 0,
549 0, 67, 122, 135, 136, 134, 138, 0, 131, 67,
550 1, 0, 67, 1, 0, 67, 122, 1, 0, 131,
551 67, 122, 1, 0, 0, 63, 116, 0, 63, 116,
552 1, 0, 63, 1, 0, 0, 52, 137, 0, 52,
553 1, 0, 117, 0, 137, 100, 117, 0, 137, 100,
554 1, 0, 95, 96, 0, 95, 139, 96, 0, 140,
555 0, 139, 140, 0, 141, 0, 156, 0, 158, 0,
556 179, 0, 142, 0, 142, 99, 0, 147, 0, 132,
557 0, 166, 0, 112, 143, 99, 0, 131, 112, 143,
558 99, 0, 144, 0, 143, 100, 144, 0, 143, 100,
559 1, 0, 145, 0, 145, 92, 146, 0, 145, 92,
560 1, 0, 145, 92, 146, 1, 0, 122, 0, 145,
561 97, 98, 0, 122, 1, 0, 145, 97, 1, 0,
562 145, 98, 1, 0, 264, 0, 177, 0, 0, 149,
563 148, 155, 0, 149, 1, 0, 112, 150, 153, 0,
564 59, 150, 153, 0, 131, 112, 150, 153, 0, 131,
565 59, 150, 153, 0, 112, 1, 0, 131, 112, 1,
566 0, 59, 1, 0, 131, 59, 1, 0, 131, 1,
567 0, 122, 93, 94, 0, 122, 93, 151, 94, 0,
568 150, 97, 98, 0, 122, 93, 1, 0, 150, 97,
569 1, 0, 152, 0, 151, 100, 152, 0, 151, 100,
570 1, 0, 112, 145, 0, 131, 112, 145, 0, 112,
571 1, 0, 131, 112, 1, 0, 0, 53, 154, 0,
572 53, 1, 0, 116, 0, 154, 100, 116, 0, 154,
573 100, 1, 0, 179, 0, 179, 99, 0, 99, 0,
574 157, 179, 0, 157, 179, 99, 0, 44, 0, 0,
575 160, 159, 162, 0, 161, 153, 0, 131, 161, 153,
576 0, 120, 93, 94, 0, 120, 93, 151, 94, 0,
577 180, 163, 0, 180, 164, 163, 0, 180, 182, 163,
578 0, 180, 164, 182, 163, 0, 181, 0, 181, 99,
579 0, 165, 93, 94, 99, 0, 165, 93, 233, 94,
580 99, 0, 119, 101, 65, 93, 233, 94, 99, 0,
581 119, 101, 65, 93, 94, 99, 0, 76, 0, 65,
582 0, 0, 61, 122, 167, 172, 0, 0, 131, 61,
583 122, 168, 172, 0, 0, 61, 122, 171, 169, 172,
584 0, 0, 131, 61, 122, 171, 170, 172, 0, 61,
585 122, 1, 0, 131, 61, 122, 1, 0, 63, 117,
586 0, 171, 100, 117, 0, 63, 1, 0, 171, 100,
587 1, 0, 95, 96, 0, 95, 173, 96, 0, 174,
588 0, 173, 174, 0, 175, 0, 176, 0, 132, 0,
589 166, 0, 142, 0, 149, 99, 0, 149, 1, 0,
590 95, 96, 0, 95, 178, 96, 0, 95, 178, 100,
591 96, 0, 146, 0, 178, 100, 146, 0, 178, 100,
592 1, 0, 95, 96, 0, 180, 182, 181, 0, 95,
593 0, 96, 0, 183, 0, 182, 183, 0, 184, 0,
594 186, 0, 132, 0, 185, 99, 0, 112, 143, 0,
595 131, 112, 143, 0, 188, 0, 191, 0, 195, 0,
596 196, 0, 207, 0, 211, 0, 188, 0, 192, 0,
597 197, 0, 208, 0, 212, 0, 179, 0, 189, 0,
598 193, 0, 198, 0, 210, 0, 218, 0, 219, 0,
599 220, 0, 222, 0, 221, 0, 224, 0, 99, 0,
600 122, 88, 0, 190, 186, 0, 122, 1, 0, 190,
601 187, 0, 194, 99, 0, 1, 99, 0, 1, 95,
602 0, 1, 96, 0, 165, 93, 1, 0, 165, 93,
603 94, 1, 0, 165, 93, 233, 1, 0, 165, 93,
604 233, 94, 1, 0, 119, 101, 65, 1, 0, 119,
605 101, 65, 93, 1, 0, 119, 101, 65, 93, 233,
606 1, 0, 119, 101, 65, 93, 233, 94, 1, 0,
607 119, 101, 65, 93, 94, 1, 0, 261, 0, 245,
608 0, 246, 0, 242, 0, 243, 0, 239, 0, 231,
609 0, 48, 93, 264, 94, 186, 0, 48, 1, 0,
610 48, 93, 1, 0, 48, 93, 264, 1, 0, 48,
611 93, 264, 94, 187, 56, 186, 0, 48, 93, 264,
612 94, 187, 56, 187, 0, 0, 200, 199, 201, 0,
613 68, 93, 264, 94, 0, 68, 1, 0, 68, 93,
614 1, 0, 68, 93, 264, 94, 1, 0, 95, 96,
615 0, 95, 204, 96, 0, 95, 202, 96, 0, 95,
616 202, 204, 96, 0, 203, 0, 202, 203, 0, 204,
617 182, 0, 205, 0, 204, 205, 0, 62, 265, 88,
618 0, 47, 88, 0, 62, 1, 0, 62, 265, 1,
619 0, 47, 1, 0, 66, 93, 264, 94, 0, 206,
620 186, 0, 66, 1, 0, 66, 93, 1, 0, 66,
621 93, 264, 1, 0, 206, 187, 0, 51, 0, 209,
622 186, 66, 93, 264, 94, 99, 0, 214, 99, 264,
623 99, 216, 94, 186, 0, 214, 99, 99, 216, 94,
624 186, 0, 214, 99, 1, 0, 214, 99, 264, 99,
625 1, 0, 214, 99, 99, 1, 0, 214, 99, 264,
626 99, 216, 94, 187, 0, 214, 99, 99, 216, 94,
627 187, 0, 71, 93, 0, 71, 1, 0, 71, 93,
628 1, 0, 213, 215, 0, 0, 217, 0, 185, 0,
629 217, 1, 0, 0, 217, 0, 194, 0, 217, 100,
630 194, 0, 217, 100, 1, 0, 54, 99, 0, 54,
631 122, 99, 0, 54, 1, 0, 54, 122, 1, 0,
632 73, 99, 0, 73, 122, 99, 0, 73, 1, 0,
633 73, 122, 1, 0, 58, 99, 0, 58, 264, 99,
634 0, 58, 1, 0, 58, 264, 1, 0, 49, 264,
635 99, 0, 49, 1, 0, 49, 264, 1, 0, 223,
636 93, 264, 94, 179, 0, 223, 93, 264, 94, 1,
637 0, 223, 1, 0, 223, 93, 1, 94, 0, 223,
638 93, 1, 0, 44, 0, 70, 179, 225, 0, 70,
639 179, 228, 0, 70, 179, 225, 228, 0, 70, 1,
640 0, 226, 0, 225, 226, 0, 227, 179, 0, 60,
641 93, 152, 94, 0, 60, 1, 0, 60, 93, 1,
642 0, 60, 93, 1, 94, 0, 64, 179, 0, 64,
643 1, 0, 230, 0, 234, 0, 111, 0, 76, 0,
644 93, 264, 94, 0, 231, 0, 238, 0, 239, 0,
645 240, 0, 119, 101, 67, 0, 113, 101, 67, 0,
646 59, 101, 67, 0, 119, 101, 76, 0, 93, 264,
647 1, 0, 119, 101, 1, 0, 113, 101, 1, 0,
648 59, 101, 1, 0, 72, 116, 93, 233, 94, 0,
649 72, 116, 93, 94, 0, 72, 116, 93, 233, 94,
650 138, 0, 72, 116, 93, 94, 138, 0, 232, 122,
651 93, 94, 0, 232, 122, 93, 94, 138, 0, 232,
652 122, 93, 233, 94, 0, 232, 122, 93, 233, 94,
653 138, 0, 72, 1, 99, 0, 72, 116, 1, 0,
654 72, 116, 93, 1, 0, 72, 116, 93, 233, 1,
655 0, 232, 1, 0, 232, 122, 1, 0, 119, 101,
656 72, 0, 229, 101, 72, 0, 264, 0, 233, 100,
657 264, 0, 233, 100, 1, 0, 72, 113, 235, 0,
658 72, 115, 235, 0, 72, 113, 235, 237, 0, 72,
659 115, 235, 237, 0, 72, 115, 237, 177, 0, 72,
660 113, 237, 177, 0, 72, 1, 98, 0, 72, 1,
661 97, 0, 236, 0, 235, 236, 0, 97, 264, 98,
662 0, 97, 264, 1, 0, 97, 1, 0, 97, 98,
663 0, 237, 97, 98, 0, 237, 97, 1, 0, 229,
664 101, 122, 0, 65, 101, 122, 0, 65, 1, 0,
665 119, 93, 94, 0, 119, 93, 233, 94, 0, 229,
666 101, 122, 93, 94, 0, 229, 101, 122, 93, 233,
667 94, 0, 65, 101, 122, 93, 94, 0, 65, 101,
668 122, 93, 233, 94, 0, 65, 101, 1, 94, 0,
669 65, 101, 1, 101, 0, 119, 97, 264, 98, 0,
670 230, 97, 264, 98, 0, 119, 97, 1, 0, 119,
671 97, 264, 1, 0, 230, 97, 1, 0, 230, 97,
672 264, 1, 0, 229, 0, 119, 0, 242, 0, 243,
673 0, 241, 46, 0, 241, 45, 0, 245, 0, 246,
674 0, 3, 244, 0, 4, 244, 0, 247, 0, 3,
675 1, 0, 4, 1, 0, 46, 244, 0, 46, 1,
676 0, 45, 244, 0, 45, 1, 0, 241, 0, 89,
677 244, 0, 90, 244, 0, 248, 0, 89, 1, 0,
678 90, 1, 0, 93, 113, 237, 94, 244, 0, 93,
679 113, 94, 244, 0, 93, 264, 94, 247, 0, 93,
680 119, 237, 94, 247, 0, 93, 113, 97, 1, 0,
681 93, 1, 0, 93, 113, 237, 94, 1, 0, 93,
682 113, 94, 1, 0, 93, 119, 237, 94, 1, 0,
683 244, 0, 249, 5, 244, 0, 249, 6, 244, 0,
684 249, 7, 244, 0, 249, 5, 1, 0, 249, 6,
685 1, 0, 249, 7, 1, 0, 249, 0, 250, 3,
686 249, 0, 250, 4, 249, 0, 250, 3, 1, 0,
687 250, 4, 1, 0, 250, 0, 251, 8, 250, 0,
688 251, 9, 250, 0, 251, 10, 250, 0, 251, 8,
689 1, 0, 251, 9, 1, 0, 251, 10, 1, 0,
690 251, 0, 252, 20, 251, 0, 252, 18, 251, 0,
691 252, 21, 251, 0, 252, 19, 251, 0, 252, 57,
692 114, 0, 252, 20, 1, 0, 252, 18, 1, 0,
693 252, 21, 1, 0, 252, 19, 1, 0, 252, 57,
694 1, 0, 252, 0, 253, 16, 252, 0, 253, 17,
695 252, 0, 253, 16, 1, 0, 253, 17, 1, 0,
696 253, 0, 254, 11, 253, 0, 254, 11, 1, 0,
697 254, 0, 255, 12, 254, 0, 255, 12, 1, 0,
698 255, 0, 256, 13, 255, 0, 256, 13, 1, 0,
699 256, 0, 257, 14, 256, 0, 257, 14, 1, 0,
700 257, 0, 258, 15, 257, 0, 258, 15, 1, 0,
701 258, 0, 258, 87, 264, 88, 259, 0, 258, 87,
702 88, 1, 0, 258, 87, 1, 0, 258, 87, 264,
703 88, 1, 0, 259, 0, 261, 0, 262, 263, 260,
704 0, 262, 263, 1, 0, 119, 0, 238, 0, 240,
705 0, 91, 0, 92, 0, 260, 0, 264, 0
711 static const short yyrline
[] = { 0,
712 483, 489, 491, 492, 493, 494, 495, 499, 501, 504,
713 506, 507, 510, 512, 515, 519, 523, 527, 533, 535,
714 537, 539, 544, 546, 549, 553, 558, 563, 565, 566,
715 567, 568, 569, 570, 571, 574, 579, 585, 587, 590,
716 593, 595, 599, 601, 604, 631, 633, 637, 650, 652,
717 656, 663, 668, 670, 680, 685, 700, 704, 707, 710,
718 713, 715, 717, 722, 726, 728, 730, 732, 736, 738,
719 740, 747, 753, 758, 762, 771, 781, 783, 786, 788,
720 789, 790, 794, 796, 798, 799, 801, 806, 809, 819,
721 822, 824, 828, 831, 838, 844, 852, 854, 856, 858,
722 860, 864, 866, 870, 877, 878, 882, 885, 887, 889,
723 891, 893, 895, 897, 899, 906, 909, 911, 920, 922,
724 926, 931, 936, 940, 945, 950, 952, 959, 961, 963,
725 967, 970, 972, 976, 978, 979, 984, 990, 997, 1005,
726 1012, 1015, 1018, 1022, 1025, 1029, 1038, 1040, 1042, 1046,
727 1048, 1051, 1058, 1066, 1068, 1072, 1079, 1089, 1093, 1096,
728 1099, 1102, 1105, 1108, 1111, 1114, 1116, 1120, 1126, 1131,
729 1133, 1137, 1140, 1144, 1146, 1149, 1151, 1152, 1154, 1158,
730 1162, 1168, 1173, 1176, 1178, 1182, 1188, 1192, 1197, 1206,
731 1210, 1215, 1227, 1229, 1232, 1234, 1236, 1240, 1244, 1247,
732 1251, 1253, 1254, 1255, 1256, 1257, 1261, 1263, 1264, 1265,
733 1266, 1270, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279,
734 1280, 1281, 1284, 1289, 1300, 1303, 1307, 1314, 1324, 1330,
735 1336, 1342, 1344, 1350, 1352, 1358, 1360, 1362, 1364, 1366,
736 1370, 1372, 1373, 1374, 1375, 1376, 1377, 1380, 1386, 1388,
737 1390, 1394, 1399, 1404, 1410, 1420, 1426, 1428, 1430, 1437,
738 1440, 1442, 1444, 1448, 1450, 1453, 1457, 1459, 1462, 1469,
739 1475, 1477, 1479, 1483, 1491, 1494, 1496, 1498, 1502, 1507,
740 1516, 1521, 1524, 1531, 1533, 1535, 1539, 1542, 1551, 1558,
741 1560, 1564, 1577, 1579, 1585, 1591, 1595, 1597, 1601, 1604,
742 1606, 1610, 1613, 1615, 1617, 1621, 1624, 1626, 1628, 1632,
743 1635, 1637, 1639, 1643, 1649, 1651, 1655, 1662, 1664, 1666,
744 1668, 1672, 1680, 1683, 1685, 1690, 1694, 1696, 1703, 1711,
745 1728, 1730, 1732, 1736, 1739, 1744, 1746, 1749, 1751, 1753,
746 1755, 1756, 1757, 1758, 1762, 1764, 1766, 1771, 1773, 1775,
747 1777, 1779, 1783, 1786, 1791, 1793, 1798, 1799, 1800, 1801,
748 1802, 1804, 1806, 1808, 1810, 1812, 1816, 1818, 1821, 1827,
749 1832, 1836, 1839, 1841, 1843, 1847, 1849, 1851, 1853, 1857,
750 1860, 1864, 1870, 1872, 1880, 1907, 1909, 1913, 1918, 1925,
751 1929, 1932, 1934, 1945, 1956, 1961, 1970, 1972, 1976, 1979,
752 1981, 1986, 1991, 1996, 2003, 2005, 2006, 2007, 2010, 2015,
753 2020, 2022, 2023, 2025, 2027, 2028, 2030, 2034, 2037, 2041,
754 2044, 2048, 2050, 2052, 2054, 2055, 2057, 2061, 2070, 2072,
755 2074, 2087, 2089, 2095, 2097, 2099, 2103, 2105, 2110, 2115,
756 2120, 2122, 2124, 2128, 2130, 2135, 2140, 2142, 2146, 2148,
757 2153, 2158, 2163, 2165, 2167, 2171, 2173, 2178, 2183, 2188,
758 2193, 2195, 2197, 2199, 2201, 2203, 2207, 2209, 2214, 2219,
759 2221, 2225, 2227, 2232, 2236, 2238, 2243, 2247, 2249, 2254,
760 2258, 2260, 2265, 2269, 2271, 2276, 2280, 2282, 2287, 2293,
761 2295, 2299, 2301, 2304, 2307, 2315, 2317, 2318, 2321, 2323,
767 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
769 static const char * const yytname
[] = { "$","error","$undefined.","PLUS_TK",
770 "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
771 "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
772 "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
773 "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
774 "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
775 "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
776 "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
777 "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
778 "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
779 "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
780 "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
781 "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
782 "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
783 "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
784 "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
785 "goal","literal","type","primitive_type","reference_type","class_or_interface_type",
786 "class_type","interface_type","array_type","name","simple_name","qualified_name",
787 "identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
788 "import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
789 "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
790 "interface_type_list","class_body","class_body_declarations","class_body_declaration",
791 "class_member_declaration","field_declaration","variable_declarators","variable_declarator",
792 "variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
793 "method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list",
794 "method_body","static_initializer","static","constructor_declaration","@4","constructor_header",
795 "constructor_declarator","constructor_body","constructor_block_end","explicit_constructor_invocation",
796 "this_or_super","interface_declaration","@5","@6","@7","@8","extends_interfaces",
797 "interface_body","interface_member_declarations","interface_member_declaration",
798 "constant_declaration","abstract_method_declaration","array_initializer","variable_initializers",
799 "block","block_begin","block_end","block_statements","block_statement","local_variable_declaration_statement",
800 "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
801 "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
802 "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
803 "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups",
804 "switch_block_statement_group","switch_labels","switch_label","while_expression",
805 "while_statement","while_statement_nsi","do_statement_begin","do_statement",
806 "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update",
807 "statement_expression_list","break_statement","continue_statement","return_statement",
808 "throw_statement","synchronized_statement","synchronized","try_statement","catches",
809 "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array",
810 "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression",
811 "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access",
812 "postfix_expression","post_increment_expression","post_decrement_expression",
813 "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus",
814 "cast_expression","multiplicative_expression","additive_expression","shift_expression",
815 "relational_expression","equality_expression","and_expression","exclusive_or_expression",
816 "inclusive_or_expression","conditional_and_expression","conditional_or_expression",
817 "conditional_expression","assignment_expression","assignment","left_hand_side",
818 "assignment_operator","expression","constant_expression", NULL
822 static const short yyr1
[] = { 0,
823 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
824 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
825 118, 118, 119, 119, 120, 121, 122, 123, 123, 123,
826 123, 123, 123, 123, 123, 124, 124, 125, 125, 126,
827 126, 126, 127, 127, 128, 128, 128, 129, 129, 129,
828 130, 130, 130, 130, 131, 131, 133, 132, 134, 132,
829 132, 132, 132, 132, 135, 135, 135, 135, 136, 136,
830 136, 137, 137, 137, 138, 138, 139, 139, 140, 140,
831 140, 140, 141, 141, 141, 141, 141, 142, 142, 143,
832 143, 143, 144, 144, 144, 144, 145, 145, 145, 145,
833 145, 146, 146, 148, 147, 147, 149, 149, 149, 149,
834 149, 149, 149, 149, 149, 150, 150, 150, 150, 150,
835 151, 151, 151, 152, 152, 152, 152, 153, 153, 153,
836 154, 154, 154, 155, 155, 155, 156, 156, 157, 159,
837 158, 160, 160, 161, 161, 162, 162, 162, 162, 163,
838 163, 164, 164, 164, 164, 165, 165, 167, 166, 168,
839 166, 169, 166, 170, 166, 166, 166, 171, 171, 171,
840 171, 172, 172, 173, 173, 174, 174, 174, 174, 175,
841 176, 176, 177, 177, 177, 178, 178, 178, 179, 179,
842 180, 181, 182, 182, 183, 183, 183, 184, 185, 185,
843 186, 186, 186, 186, 186, 186, 187, 187, 187, 187,
844 187, 188, 188, 188, 188, 188, 188, 188, 188, 188,
845 188, 188, 189, 190, 191, 191, 192, 193, 193, 193,
846 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
847 194, 194, 194, 194, 194, 194, 194, 195, 195, 195,
848 195, 196, 197, 199, 198, 200, 200, 200, 200, 201,
849 201, 201, 201, 202, 202, 203, 204, 204, 205, 205,
850 205, 205, 205, 206, 207, 207, 207, 207, 208, 209,
851 210, 211, 211, 211, 211, 211, 212, 212, 213, 213,
852 213, 214, 215, 215, 215, 215, 216, 216, 217, 217,
853 217, 218, 218, 218, 218, 219, 219, 219, 219, 220,
854 220, 220, 220, 221, 221, 221, 222, 222, 222, 222,
855 222, 223, 224, 224, 224, 224, 225, 225, 226, 227,
856 227, 227, 227, 228, 228, 229, 229, 230, 230, 230,
857 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
858 230, 230, 231, 231, 231, 231, 231, 231, 231, 231,
859 231, 231, 231, 231, 231, 231, 232, 232, 233, 233,
860 233, 234, 234, 234, 234, 234, 234, 234, 234, 235,
861 235, 236, 236, 236, 237, 237, 237, 238, 238, 238,
862 239, 239, 239, 239, 239, 239, 239, 239, 240, 240,
863 240, 240, 240, 240, 241, 241, 241, 241, 242, 243,
864 244, 244, 244, 244, 244, 244, 244, 245, 245, 246,
865 246, 247, 247, 247, 247, 247, 247, 248, 248, 248,
866 248, 248, 248, 248, 248, 248, 249, 249, 249, 249,
867 249, 249, 249, 250, 250, 250, 250, 250, 251, 251,
868 251, 251, 251, 251, 251, 252, 252, 252, 252, 252,
869 252, 252, 252, 252, 252, 252, 253, 253, 253, 253,
870 253, 254, 254, 254, 255, 255, 255, 256, 256, 256,
871 257, 257, 257, 258, 258, 258, 259, 259, 259, 259,
872 259, 260, 260, 261, 261, 262, 262, 262, 263, 263,
876 static const short yyr2
[] = { 0,
877 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
878 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
879 3, 3, 1, 1, 1, 3, 1, 0, 1, 1,
880 1, 2, 2, 2, 3, 1, 2, 1, 2, 3,
881 2, 3, 1, 1, 3, 2, 3, 5, 4, 5,
882 1, 1, 1, 1, 1, 2, 0, 7, 0, 6,
883 3, 2, 3, 4, 0, 2, 3, 2, 0, 2,
884 2, 1, 3, 3, 2, 3, 1, 2, 1, 1,
885 1, 1, 1, 2, 1, 1, 1, 3, 4, 1,
886 3, 3, 1, 3, 3, 4, 1, 3, 2, 3,
887 3, 1, 1, 0, 3, 2, 3, 3, 4, 4,
888 2, 3, 2, 3, 2, 3, 4, 3, 3, 3,
889 1, 3, 3, 2, 3, 2, 3, 0, 2, 2,
890 1, 3, 3, 1, 2, 1, 2, 3, 1, 0,
891 3, 2, 3, 3, 4, 2, 3, 3, 4, 1,
892 2, 4, 5, 7, 6, 1, 1, 0, 4, 0,
893 5, 0, 5, 0, 6, 3, 4, 2, 3, 2,
894 3, 2, 3, 1, 2, 1, 1, 1, 1, 1,
895 2, 2, 2, 3, 4, 1, 3, 3, 2, 3,
896 1, 1, 1, 2, 1, 1, 1, 2, 2, 3,
897 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
898 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
899 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
900 2, 3, 4, 4, 5, 4, 5, 6, 7, 6,
901 1, 1, 1, 1, 1, 1, 1, 5, 2, 3,
902 4, 7, 7, 0, 3, 4, 2, 3, 5, 2,
903 3, 3, 4, 1, 2, 2, 1, 2, 3, 2,
904 2, 3, 2, 4, 2, 2, 3, 4, 2, 1,
905 7, 7, 6, 3, 5, 4, 7, 6, 2, 2,
906 3, 2, 0, 1, 1, 2, 0, 1, 1, 3,
907 3, 2, 3, 2, 3, 2, 3, 2, 3, 2,
908 3, 2, 3, 3, 2, 3, 5, 5, 2, 4,
909 3, 1, 3, 3, 4, 2, 1, 2, 2, 4,
910 2, 3, 4, 2, 2, 1, 1, 1, 1, 3,
911 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
912 3, 3, 5, 4, 6, 5, 4, 5, 5, 6,
913 3, 3, 4, 5, 2, 3, 3, 3, 1, 3,
914 3, 3, 3, 4, 4, 4, 4, 3, 3, 1,
915 2, 3, 3, 2, 2, 3, 3, 3, 3, 2,
916 3, 4, 5, 6, 5, 6, 4, 4, 4, 4,
917 3, 4, 3, 4, 1, 1, 1, 1, 2, 2,
918 1, 1, 2, 2, 1, 2, 2, 2, 2, 2,
919 2, 1, 2, 2, 1, 2, 2, 5, 4, 4,
920 5, 4, 2, 5, 4, 5, 1, 3, 3, 3,
921 3, 3, 3, 1, 3, 3, 3, 3, 1, 3,
922 3, 3, 3, 3, 3, 1, 3, 3, 3, 3,
923 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
924 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
925 1, 3, 3, 1, 3, 3, 1, 5, 4, 3,
926 5, 1, 1, 3, 3, 1, 1, 1, 1, 1,
930 static const short yydefact
[] = { 0,
931 54, 55, 0, 0, 0, 0, 53, 1, 0, 0,
932 0, 36, 43, 44, 38, 0, 51, 52, 46, 27,
933 0, 23, 24, 25, 0, 62, 0, 41, 0, 0,
934 37, 39, 0, 0, 56, 0, 0, 47, 45, 0,
935 166, 0, 0, 162, 63, 0, 69, 42, 40, 0,
936 0, 0, 61, 0, 49, 0, 26, 170, 17, 168,
937 15, 0, 159, 0, 0, 68, 16, 0, 0, 59,
938 167, 0, 164, 64, 69, 50, 48, 12, 0, 10,
939 11, 172, 0, 8, 9, 13, 14, 15, 0, 178,
940 180, 0, 179, 0, 174, 176, 177, 171, 169, 163,
941 67, 71, 72, 70, 0, 161, 0, 57, 113, 0,
942 128, 111, 0, 0, 90, 93, 128, 0, 0, 0,
943 115, 0, 0, 182, 181, 173, 175, 0, 0, 60,
944 165, 0, 0, 0, 0, 108, 99, 88, 0, 0,
945 0, 0, 107, 21, 18, 22, 20, 19, 114, 128,
946 112, 0, 128, 74, 73, 55, 191, 75, 23, 0,
947 86, 0, 77, 79, 83, 85, 0, 80, 0, 81,
948 140, 128, 87, 82, 0, 58, 119, 116, 0, 0,
949 0, 121, 130, 131, 129, 120, 118, 92, 0, 91,
950 95, 0, 0, 0, 0, 0, 0, 0, 339, 0,
951 0, 0, 0, 6, 5, 2, 3, 4, 7, 338,
952 0, 406, 0, 103, 405, 336, 341, 0, 337, 342,
953 343, 344, 422, 407, 408, 437, 411, 412, 415, 425,
954 444, 449, 456, 467, 472, 475, 478, 481, 484, 487,
955 492, 501, 493, 0, 102, 100, 98, 101, 110, 89,
956 109, 189, 0, 128, 76, 78, 84, 106, 0, 137,
957 0, 142, 0, 55, 0, 0, 280, 0, 0, 0,
958 0, 0, 0, 0, 0, 339, 0, 223, 0, 8,
959 406, 0, 0, 197, 0, 212, 0, 193, 195, 0,
960 196, 201, 213, 0, 202, 214, 0, 203, 204, 215,
961 254, 0, 205, 0, 216, 206, 293, 0, 217, 218,
962 219, 221, 220, 0, 222, 247, 246, 0, 244, 245,
963 242, 243, 241, 126, 124, 0, 117, 0, 0, 416,
964 406, 342, 344, 413, 417, 414, 421, 420, 419, 418,
965 0, 390, 0, 0, 0, 16, 0, 426, 423, 427,
966 424, 433, 0, 406, 0, 183, 186, 0, 0, 0,
967 0, 0, 96, 0, 0, 365, 0, 410, 409, 0,
968 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
969 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
970 499, 500, 0, 144, 0, 143, 136, 105, 134, 138,
971 191, 141, 0, 230, 231, 229, 249, 0, 315, 0,
972 304, 302, 0, 312, 310, 0, 276, 0, 257, 0,
973 326, 0, 290, 0, 308, 306, 0, 0, 199, 0,
974 0, 226, 224, 0, 0, 192, 190, 194, 198, 322,
975 406, 225, 228, 0, 275, 0, 406, 0, 295, 299,
976 292, 0, 0, 319, 0, 127, 125, 123, 122, 133,
977 132, 352, 347, 0, 389, 379, 378, 361, 0, 372,
978 380, 0, 373, 0, 362, 0, 0, 0, 0, 0,
979 0, 349, 340, 184, 0, 351, 346, 391, 0, 369,
980 401, 0, 350, 345, 367, 348, 368, 388, 403, 0,
981 366, 0, 441, 438, 442, 439, 443, 440, 447, 445,
982 448, 446, 453, 450, 454, 451, 455, 452, 463, 458,
983 465, 460, 462, 457, 464, 459, 466, 0, 461, 470,
984 468, 471, 469, 474, 473, 477, 476, 480, 479, 483,
985 482, 486, 485, 490, 0, 0, 495, 494, 145, 135,
986 406, 146, 0, 0, 150, 0, 250, 0, 316, 314,
987 305, 303, 313, 311, 277, 0, 258, 0, 0, 0,
988 323, 327, 0, 324, 291, 309, 307, 340, 0, 200,
989 232, 0, 0, 0, 255, 0, 296, 0, 284, 0,
990 0, 321, 0, 397, 398, 0, 384, 385, 0, 381,
991 374, 0, 377, 375, 376, 363, 354, 0, 435, 429,
992 432, 0, 0, 430, 188, 185, 187, 392, 0, 402,
993 399, 0, 404, 400, 357, 0, 489, 0, 0, 147,
994 0, 0, 151, 148, 251, 0, 278, 274, 0, 331,
995 0, 335, 334, 328, 325, 329, 236, 0, 233, 234,
996 0, 0, 0, 260, 0, 264, 0, 267, 0, 301,
997 300, 286, 0, 298, 0, 320, 0, 395, 0, 383,
998 382, 387, 386, 356, 364, 353, 434, 428, 436, 431,
999 371, 370, 393, 0, 358, 359, 491, 488, 0, 149,
1000 0, 0, 0, 248, 0, 201, 0, 208, 209, 0,
1001 210, 211, 0, 259, 332, 0, 237, 0, 0, 235,
1002 273, 270, 271, 502, 0, 262, 265, 0, 261, 0,
1003 268, 0, 0, 285, 0, 318, 317, 396, 355, 394,
1004 360, 0, 152, 0, 0, 0, 227, 279, 0, 333,
1005 330, 240, 238, 0, 272, 269, 263, 0, 283, 0,
1006 0, 0, 153, 0, 252, 0, 0, 239, 281, 282,
1007 155, 0, 0, 0, 0, 154, 0, 0, 0, 0,
1008 288, 0, 253, 287, 0, 0, 0
1011 static const short yydefgoto
[] = { 775,
1012 210, 279, 211, 85, 86, 68, 60, 87, 212, 22,
1013 23, 24, 8, 9, 10, 11, 12, 13, 14, 15,
1014 283, 284, 132, 105, 47, 70, 104, 130, 162, 163,
1015 164, 91, 114, 115, 116, 213, 166, 259, 92, 111,
1016 181, 182, 136, 185, 398, 168, 169, 170, 261, 171,
1017 172, 402, 552, 553, 285, 18, 43, 72, 65, 107,
1018 44, 63, 94, 95, 96, 97, 214, 358, 286, 175,
1019 555, 720, 288, 289, 290, 291, 695, 292, 293, 294,
1020 295, 698, 296, 297, 298, 299, 699, 300, 444, 301,
1021 585, 655, 656, 657, 658, 302, 303, 701, 304, 305,
1022 306, 702, 307, 308, 451, 663, 664, 309, 310, 311,
1023 312, 313, 314, 315, 571, 572, 573, 574, 215, 216,
1024 217, 218, 489, 219, 470, 471, 472, 220, 221, 222,
1025 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
1026 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
1027 243, 244, 393, 490, 715
1030 static const short yypact
[] = { 507,
1031 -32768,-32768, 15, -30, 18, 244,-32768,-32768, 414, 443,
1032 556,-32768,-32768,-32768,-32768, 714,-32768,-32768,-32768,-32768,
1033 23,-32768,-32768,-32768, 359,-32768, 340,-32768, 49, 601,
1034 -32768,-32768, 585, 603,-32768, -30, 417,-32768,-32768, 92,
1035 -32768, 489, -24, 107,-32768, 529, 295,-32768,-32768, -30,
1036 710, 452,-32768, 344,-32768, 40,-32768,-32768,-32768,-32768,
1037 192, 1047,-32768, 530, -24,-32768,-32768, 388, 534,-32768,
1038 -32768, -24, 107,-32768, 295,-32768,-32768,-32768, 540,-32768,
1039 -32768,-32768, 548, 258,-32768,-32768, 307, 442, 736,-32768,
1040 -32768, 77,-32768, 1638,-32768,-32768,-32768,-32768,-32768,-32768,
1041 -32768,-32768,-32768, 312, 406,-32768, -24,-32768,-32768, 379,
1042 -18,-32768, 426, 331,-32768, 693, -18, 120, 210, 429,
1043 -32768, 564, 587,-32768,-32768,-32768,-32768, 593, 951,-32768,
1044 -32768, 406, 607, 617, 214,-32768,-32768,-32768, 618, 1077,
1045 219, 531,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -18,
1046 -32768, 361, -18,-32768,-32768, 460, 471,-32768, 494, 736,
1047 -32768, 1204,-32768,-32768, 500,-32768, 180,-32768, 535,-32768,
1048 -32768, 591,-32768,-32768, 1759,-32768,-32768,-32768, 620, 728,
1049 377,-32768,-32768,-32768, 613,-32768,-32768,-32768, 157,-32768,
1050 -32768, 2663, 2728, 2779, 2844, 655, 32, 707,-32768, 2895,
1051 2960, 3011, 5025,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1052 673, 881, 56,-32768, 678, 746,-32768, 640,-32768, 671,
1053 -32768, 715, 866,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1054 899, 921, 1006, 838, 920, 654, 814, 820, 847, 263,
1055 -32768,-32768,-32768, 850,-32768,-32768,-32768,-32768,-32768,-32768,
1056 -32768,-32768, 963, 591,-32768,-32768,-32768,-32768, 484, 769,
1057 775,-32768, -1, 306, 353, 3076,-32768, 232, 1357, 35,
1058 392, 419, 228, 424, 234, 779, 5324,-32768, -30, 538,
1059 974, 265, 872,-32768, 784,-32768, 1691,-32768,-32768, 789,
1060 -32768,-32768,-32768, 1827,-32768,-32768, 797,-32768,-32768,-32768,
1061 -32768, 1827,-32768, 1827,-32768,-32768, 5375, 802,-32768,-32768,
1062 -32768,-32768,-32768, 427,-32768, 737, 806, 866, 902, 916,
1063 -32768,-32768,-32768,-32768, 891, 642,-32768, 592, 660,-32768,
1064 189,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1065 409,-32768, 666, 964, 793, 793, 428,-32768,-32768,-32768,
1066 -32768,-32768, 777, 1121, 66,-32768,-32768, 622, 432, 5092,
1067 3127, 729,-32768, -28, 3192,-32768, 435,-32768,-32768, 3243,
1068 3308, 3359, 3424, 3475, 3540, 3591, 3656, 3707, 3772, 3823,
1069 3888, 864, 3939, 4004, 4055, 4120, 4171, 4236, 4287, 2032,
1070 -32768,-32768, 4352,-32768, 605,-32768,-32768,-32768, 810,-32768,
1071 -32768,-32768, 1691,-32768,-32768,-32768,-32768, 4403,-32768, 95,
1072 -32768,-32768, 126,-32768,-32768, 174,-32768, 4468,-32768, 4519,
1073 -32768, 785,-32768, 4933,-32768,-32768, 182, 269, 815, 2083,
1074 604,-32768,-32768, -30, 2148,-32768,-32768,-32768,-32768,-32768,
1075 1158,-32768,-32768, 823,-32768, 861, 1018, 728,-32768,-32768,
1076 -32768, 86, 2199,-32768, 4584,-32768, 891,-32768,-32768,-32768,
1077 -32768,-32768,-32768, 565, 836,-32768,-32768,-32768, 2264, 793,
1078 -32768, 590, 793, 590,-32768, 2315, 4635, 223, -43, 2380,
1079 191,-32768, 894,-32768, 1967,-32768,-32768,-32768, 649,-32768,
1080 -32768, 237,-32768,-32768,-32768,-32768,-32768, 839,-32768, 239,
1081 -32768, 5143,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 899,
1082 -32768, 899,-32768, 921,-32768, 921,-32768, 921,-32768, 1006,
1083 -32768, 1006,-32768, 1006,-32768, 1006,-32768, 258,-32768,-32768,
1084 838,-32768, 838,-32768, 920,-32768, 654,-32768, 814,-32768,
1085 820,-32768, 847,-32768, 933, 857,-32768,-32768,-32768,-32768,
1086 1254,-32768, 1691, 859, 856, 1691,-32768, 314,-32768,-32768,
1087 -32768,-32768,-32768,-32768,-32768, 348,-32768, 870, 461, 229,
1088 785,-32768, 535,-32768,-32768,-32768,-32768,-32768, 467, 815,
1089 -32768, 967, 14, 444,-32768, 878,-32768, 5067,-32768, 4958,
1090 876, 887, 892,-32768,-32768, 5208,-32768,-32768, 241,-32768,
1091 895, 299,-32768, 895,-32768,-32768, 406, 17,-32768,-32768,
1092 -32768, 4700, 487,-32768,-32768,-32768,-32768,-32768, 4751,-32768,
1093 -32768, 5259,-32768,-32768, 406, 704,-32768, 4816, 662,-32768,
1094 1691, 2431,-32768,-32768,-32768, 1893,-32768,-32768, 343,-32768,
1095 835,-32768,-32768,-32768,-32768,-32768,-32768, 2496,-32768,-32768,
1096 999, 91, 4867,-32768, 674,-32768, 1467,-32768, 5324,-32768,
1097 -32768,-32768, 928, 923, 5000,-32768, 410,-32768, 723,-32768,
1098 -32768,-32768,-32768,-32768,-32768, 406,-32768,-32768,-32768,-32768,
1099 -32768,-32768,-32768, 731,-32768, 406,-32768,-32768, 477,-32768,
1100 243, 108, 485,-32768, 978, 979, 1893,-32768,-32768, 1893,
1101 -32768,-32768, 942,-32768, 948, 950,-32768, 1053, 128,-32768,
1102 -32768,-32768,-32768,-32768, 328,-32768,-32768, 1540,-32768, 1608,
1103 -32768, 961, 1827,-32768, 970,-32768,-32768,-32768,-32768,-32768,
1104 -32768, 2547,-32768, 262, 4403, 1827,-32768,-32768, 2612,-32768,
1105 -32768,-32768,-32768, 1071,-32768,-32768,-32768, 980,-32768, 1827,
1106 296, 202,-32768, 358,-32768, 4958, 983,-32768,-32768,-32768,
1107 -32768, 302, 1893, 990, 5000,-32768, 1021, 1893, 992, 1893,
1108 -32768, 1893,-32768,-32768, 1087, 1089,-32768
1111 static const short yypgoto
[] = {-32768,
1112 -32768, -57, -60, 711, -16, -123, 568,-32768, -3, 552,
1113 -32768, 130,-32768, 1085, 791,-32768, 22,-32768,-32768, 778,
1114 12, 154,-32768,-32768, 1044, 1030,-32768, -128,-32768, 945,
1115 -32768, 382, -106, 973, -165, -193,-32768,-32768, 469, -58,
1116 865, -327, -40,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1117 957,-32768, 142,-32768, 718, -10,-32768,-32768,-32768,-32768,
1118 1072, 584,-32768, 1031,-32768,-32768, 372,-32768, -122, 867,
1119 843, -166, -279,-32768, 819, -234, 197, -551,-32768, -529,
1120 -32768,-32768,-32768, -301,-32768,-32768,-32768,-32768,-32768,-32768,
1121 -32768,-32768, 476, 486, -619, -496,-32768,-32768,-32768,-32768,
1122 -32768,-32768,-32768, -436,-32768, -603, 832,-32768,-32768,-32768,
1123 -32768,-32768,-32768,-32768,-32768, 569,-32768, 573,-32768,-32768,
1124 119,-32768, -386,-32768, 799, 362, -326, 858, 163, 1120,
1125 320, 437, 438, -112, 560, 636, -470,-32768, 632, 724,
1126 651, 625, 761, 765, 760, 764, 776,-32768, 526, 771,
1127 717,-32768,-32768, 29,-32768
1134 static const short yytable
[] = { 21,
1135 459, 84, 29, 176, 83, 450, 174, 438, 287, 357,
1136 184, 16, 614, 325, 650, 19, 152, 675, 26, 474,
1137 16, 16, 16, 38, 117, 59, 479, 481, 84, 67,
1138 31, 123, 342, 84, 134, 342, 83, 721, 61, 174,
1139 76, 16, 61, 497, 16, 16, 260, 59, 583, 48,
1140 612, 93, 59, 602, 31, 20, 363, 20, 88, 442,
1141 61, 725, 16, 150, 153, 61, 482, 445, 84, 446,
1142 62, 83, 84, 89, 347, 179, 143, 124, 135, 334,
1143 336, 338, 340, 93, 696, 88, 587, 349, 351, 608,
1144 88, 711, 55, 404, 405, 559, 56, 406, 721, 84,
1145 20, 84, 123, 20, 83, 89, 697, 651, 650, 249,
1146 676, 59, 251, 619, 280, 626, 619, 67, 173, 84,
1147 144, 39, 326, 40, 61, 88, 561, -157, 743, 88,
1148 61, 262, 343, 25, 27, 343, 399, 345, 77, 700,
1149 160, 353, 680, 601, 180, 696, 604, 49, 696, 50,
1150 422, 173, 764, 17, -94, -94, 88, 137, 88, 483,
1151 457, 769, 17, 17, 17, 52, 54, 697, 245, 57,
1152 697, 281, 429, 160, 563, 125, 88, 20, 712, 57,
1153 258, 346, 576, 17, -294, 588, 17, 17, 331, 331,
1154 331, 331, 84, 560, 61, 179, 331, 331, 354, 703,
1155 700, 734, 743, 700, 17, 461, 64, 619, 110, 669,
1156 146, 696, 113, 396, 186, 90, 696, 145, 696, 246,
1157 696, 744, 84, 611, 562, 434, 280, 619, 421, 642,
1158 355, 245, 411, 697, 425, 684, 556, 620, 697, 623,
1159 697, 670, 697, 649, 28, 692, 280, 90, -97, 88,
1160 -97, 110, 113, -97, -97, -97, -97, 504, 506, 508,
1161 703, 709, 710, 703, 180, 432, 700, 84, 189, 482,
1162 179, 700, 564, 700, -104, 700, 438, 389, -104, 88,
1163 577, 360, 161, 281, 613, 361, 661, 602, 450, 362,
1164 441, 617, 50, 316, 410, 762, 742, 416, 441, 672,
1165 441, 619, 758, 447, 282, 428, -322, 147, 189, -25,
1166 -25, 187, 67, 706, 635, 161, 247, 20, 448, 20,
1167 598, 528, 157, 157, 88, 61, 703, 580, 745, 20,
1168 412, 703, 426, 703, 621, 703, 624, 317, 671, 180,
1169 45, 733, 280, 704, 74, 752, 69, 367, 637, 390,
1170 -25, 438, 433, 407, 118, -25, -25, -25, 635, 41,
1171 753, -25, 578, 450, 610, -25, 331, 331, 331, 331,
1172 331, 331, 331, 331, 331, 331, 331, 331, 88, 331,
1173 331, 331, 331, 331, 331, 331, 631, 84, 101, 492,
1174 434, -65, 417, 500, 761, -65, 673, 413, -322, 551,
1175 766, 694, 46, 119, 427, 316, 46, 636, 189, 462,
1176 726, 128, 316, -30, 1, 746, 282, 53, 546, 419,
1177 316, 42, 316, 282, 423, 316, 137, 454, 475, 138,
1178 139, 282, 486, 282, -65, 501, 558, -256, -65, -66,
1179 438, 638, -31, 1, 88, 408, 566, 643, 568, 317,
1180 646, 763, 71, -158, 450, 189, 317, 2, 492, 250,
1181 139, 640, 442, 450, 317, 445, 317, 647, 3, 317,
1182 327, 133, 465, 331, 4, 463, 328, 647, 674, 331,
1183 5, 591, -66, 593, 418, 407, 2, 679, 749, 58,
1184 652, 57, 280, 498, 318, 280, 685, 599, 487, 678,
1185 129, 755, 20, 4, 157, 653, -28, 1, 492, 5,
1186 165, 420, 7, 245, 42, 760, 424, -97, 133, 455,
1187 476, 316, -97, -97, -97, -97, 148, 502, 694, 66,
1188 98, 248, 282, 749, 102, 755, 78, 760, 120, 654,
1189 109, 7, 50, 165, 727, 196, -160, 729, 112, 281,
1190 2, 197, 281, 641, -139, -29, 1, 731, 198, 648,
1191 57, 3, 199, 189, 149, 317, 252, 4, 80, 732,
1192 280, 81, 20, 5, 20, 200, 201, 735, 157, 202,
1193 84, 6, 397, 179, -32, 1, 253, 151, 204, 205,
1194 206, 207, 458, 154, 208, 209, 280, 167, 257, 2,
1195 -34, 1, -33, 1, 493, 7, 318, 177, 331, 331,
1196 3, 319, 320, 318, 20, 20, 4, 183, 188, 20,
1197 324, 318, 5, 318, 331, 20, 318, 281, 2, 157,
1198 167, 99, 441, 20, 118, 2, 103, 88, 359, 3,
1199 366, 78, 456, 134, 2, 4, 2, 682, 100, 20,
1200 2, 5, 180, 281, 7, 106, 78, 280, 594, 280,
1201 460, 4, 493, 4, 385, 595, 464, 5, 579, 5,
1202 494, 316, 20, 80, 316, 495, 81, 20, 20, 496,
1203 159, 714, 282, 7, 203, 282, 602, 722, 80, 20,
1204 131, 81, 20, 441, 630, 155, 441, 634, 549, 7,
1205 178, 7, 20, 20, 328, 20, 316, 344, 316, -35,
1206 1, 159, 329, 159, 281, 317, 281, 484, 317, 441,
1207 652, 485, 318, 319, 320, 20, 689, 20, 494, 493,
1208 319, 320, 441, 495, 321, 653, 121, 496, 319, 320,
1209 319, 320, 618, 319, 320, 20, 441, 20, 619, 316,
1210 317, 20, 317, 2, 316, 341, 78, 35, 57, 441,
1211 282, -497, -497, 754, 441, 282, 441, 757, 441, 716,
1212 4, 35, 690, 359, 36, 316, 5, 78, 364, 35,
1213 37, -341, -341, 316, 140, 78, 282, 32, 80, 141,
1214 142, 81, 20, 317, 122, 494, 36, 686, 317, 30,
1215 495, 34, 37, 619, 496, -498, -498, 32, 7, 80,
1216 322, 32, 81, 20, 20, 316, 728, 80, 316, 317,
1217 81, 20, 619, 51, 730, 386, 282, 317, 32, 282,
1218 619, 600, 387, -341, 600, 705, 316, -341, 316, 319,
1219 320, 316, 365, 603, 569, 605, 321, 282, 570, 282,
1220 -343, -343, 282, 321, 316, 378, 379, 380, 381, 317,
1221 388, 321, 317, 321, 527, 282, 321, 400, 316, 401,
1222 477, -156, 318, 478, 316, 318, 435, 359, 2, 282,
1223 317, 316, 317, 316, 78, 317, 316, 439, 316, 469,
1224 316, 323, 282, 737, 382, 443, 738, 282, 317, 282,
1225 453, 282, -343, 370, 371, 372, -343, 318, 550, 318,
1226 368, 369, 317, 78, 139, 35, 80, 584, 317, 81,
1227 20, 78, 322, 373, 374, 317, 586, 317, 596, 322,
1228 317, 622, 317, 627, 317, 383, 384, 322, 37, 322,
1229 391, 392, 322, 78, 628, 80, -407, -407, 81, 20,
1230 318, 632, 196, 80, 633, 318, 81, 20, 197, 767,
1231 -408, -408, 321, 639, 771, 198, 773, 649, 774, 199,
1232 659, -496, -496, 360, 665, 80, 318, 361, 81, 20,
1233 666, 362, 200, 201, 318, 667, 202, 141, 142, 319,
1234 320, 602, 319, 320, 156, 204, 205, 206, 207, 710,
1235 78, 208, 209, 323, 510, 512, 2, 531, 533, 79,
1236 323, 4, 78, 375, 376, 377, 318, 5, 323, 318,
1237 323, 723, 588, 323, 319, 320, 319, 320, 520, 522,
1238 524, 526, 80, 736, -207, 81, 20, 318, 322, 318,
1239 739, 740, 318, 741, 80, 157, 158, 81, 20, 332,
1240 332, 332, 332, 742, 748, 318, 394, 332, 332, -15,
1241 466, 467, 468, 750, -496, -496, 360, 319, 320, 318,
1242 430, 758, 319, 320, 431, 318, 770, 191, 759, 192,
1243 193, 765, 318, 768, 318, 772, 776, 318, 777, 318,
1244 2, 318, 529, 319, 320, 33, 78, 75, 514, 516,
1245 518, 319, 320, -15, 108, 79, 256, 4, -496, -496,
1246 360, 190, 321, 5, 430, 321, 254, 395, 362, 323,
1247 554, 194, 195, 73, 127, 449, 78, 403, 80, 437,
1248 717, 81, 20, 319, 320, 196, 319, 320, 452, 644,
1249 718, 197, 82, 645, 473, 535, 539, 321, 198, 321,
1250 537, 541, 199, 688, 319, 320, 319, 320, 80, 319,
1251 320, 81, 20, 548, 543, 200, 201, 0, 0, 202,
1252 0, 203, 319, 320, 0, 0, 0, 0, 204, 205,
1253 206, 207, 0, 0, 208, 209, 319, 320, 322, 0,
1254 321, 322, 319, 320, 0, 321, 0, 0, 0, 319,
1255 320, 319, 320, 0, 319, 320, 319, 320, 319, 320,
1256 0, -496, -496, 360, 0, 0, 321, 480, 0, 0,
1257 0, 362, 0, 322, 321, 322, 0, 332, 332, 332,
1258 332, 332, 332, 332, 332, 332, 332, 332, 332, 0,
1259 332, 332, 332, 332, 332, 332, 332, 156, -496, -496,
1260 360, 0, 0, 78, 361, 0, 321, 0, 431, 321,
1261 0, 0, 79, 0, 4, 0, 322, 0, 0, 323,
1262 5, 322, 323, 0, 0, 0, 0, 321, 0, 321,
1263 0, 0, 321, 0, 0, 80, 0, 0, 81, 20,
1264 0, 0, 322, 0, 0, 321, 0, 0, 157, 255,
1265 322, 0, 0, 0, 323, 0, 323, 0, 0, 321,
1266 0, 333, 333, 333, 333, 321, 0, 0, 0, 333,
1267 333, 0, 321, 0, 321, 0, 0, 321, 0, 321,
1268 0, 321, 322, 0, 332, 322, 0, 0, 0, -15,
1269 332, 0, 0, 0, -496, -496, 360, 323, 0, 0,
1270 430, 0, 323, 322, 629, 322, 0, 414, 322, 192,
1271 193, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1272 0, 322, 0, 323, 0, 0, 0, 0, 0, 0,
1273 0, 323, 0, 0, 0, 322, 0, 0, 0, 0,
1274 0, 322, 0, 0, 0, 0, 0, 0, 322, 0,
1275 322, 194, 195, 322, 0, 322, 78, 322, 0, 0,
1276 0, 0, 0, 323, 0, 196, 323, 0, 0, 0,
1277 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1278 0, 0, 199, 0, 323, 0, 323, 0, 80, 323,
1279 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1280 0, 0, 323, 0, 0, 415, 0, 0, 204, 205,
1281 206, 207, 0, 0, 208, 209, 323, 263, 0, 332,
1282 332, 0, 323, 0, 0, 0, 0, 0, 0, 323,
1283 0, 323, 0, 0, 323, 332, 323, 0, 323, 333,
1284 333, 333, 333, 333, 333, 333, 333, 333, 333, 333,
1285 333, 0, 333, 333, 333, 333, 333, 333, 333, 0,
1286 264, 194, 195, 652, 265, 266, 78, 267, 0, 0,
1287 268, 0, 0, 0, 269, 196, 0, 0, 653, 0,
1288 0, 270, 271, 5, 272, 0, 273, 274, 198, 275,
1289 263, 0, 276, 0, 0, 0, 0, 0, 80, 0,
1290 0, 81, 20, 0, 0, 0, 0, 0, 0, 277,
1291 0, 157, 719, 0, 0, 278, 0, 0, 204, 205,
1292 206, 207, 0, 0, 208, 209, 0, 0, 0, 0,
1293 0, 0, 0, 264, 194, 195, 652, 265, 266, 78,
1294 267, 0, 0, 268, 0, 0, 333, 269, 196, 0,
1295 0, 653, 333, 0, 270, 271, 5, 272, 263, 273,
1296 274, 198, 275, 0, 0, 276, 0, 0, 0, 0,
1297 0, 80, 0, 0, 81, 20, 0, 0, 0, 0,
1298 0, 0, 277, 0, 157, 747, 0, 0, 278, 0,
1299 0, 204, 205, 206, 207, 0, 0, 208, 209, 0,
1300 0, 264, 194, 195, -266, 265, 266, 78, 267, 0,
1301 0, 268, 0, 0, 0, 269, 196, 0, 0, -266,
1302 0, 0, 270, 271, 5, 272, 0, 273, 274, 198,
1303 275, 2, 0, 276, 0, 0, 0, 78, 0, 80,
1304 0, 263, 81, 20, 0, 0, 79, 0, 4, 0,
1305 277, 0, 157, -266, 5, 0, 278, 0, 0, 204,
1306 205, 206, 207, 0, 0, 208, 209, 0, 0, 80,
1307 0, 0, 81, 20, 0, 0, 0, 0, 0, 0,
1308 0, 333, 333, 126, 264, 194, 195, 0, 265, 266,
1309 78, 267, 0, 0, 268, 0, 0, 333, 269, 196,
1310 0, 0, 0, 0, 0, 270, 271, 5, 272, 263,
1311 273, 274, 198, 275, 0, 0, 276, 0, 0, 0,
1312 0, 0, 80, 0, 0, 81, 20, 0, 0, 0,
1313 0, 0, 0, 277, 0, 157, 436, 0, 0, 278,
1314 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1315 0, 0, 264, 194, 195, 0, 265, 266, 78, 267,
1316 0, 0, 268, 0, 0, 0, 269, 196, 0, 0,
1317 0, 0, 0, 270, 271, 5, 272, 263, 273, 274,
1318 198, 275, 0, 0, 276, 0, 0, 0, 0, 0,
1319 80, 0, 0, 81, 20, 0, 0, 0, 0, 0,
1320 0, 277, 0, 157, 0, 0, 0, 278, 0, 0,
1321 204, 205, 206, 207, 0, 0, 208, 209, 0, 0,
1322 440, 194, 195, 0, 265, 266, 78, 267, 0, 0,
1323 268, 0, 0, 0, 269, 196, 0, 0, 0, 0,
1324 0, 270, 271, 263, 272, 0, 273, 274, 198, 275,
1325 0, 0, 276, 0, 0, 0, 0, 0, 80, 0,
1326 0, 81, 20, 0, 0, 0, 0, 0, 0, 277,
1327 0, 157, 0, 0, 0, 278, 0, 0, 204, 205,
1328 206, 207, 0, 0, 208, 209, 440, 194, 195, 0,
1329 693, 266, 78, 267, 0, 0, 268, 0, 0, 0,
1330 269, 196, 0, 0, 0, 0, 0, 270, 271, 0,
1331 272, 0, 273, 274, 198, 275, 0, 615, 276, 192,
1332 193, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1333 0, 0, 0, 0, 0, 277, 0, 157, 0, 0,
1334 0, 278, 0, 0, 204, 205, 206, 207, 0, 0,
1335 208, 209, 0, 0, 0, 0, 0, 0, 0, 0,
1336 0, 194, 195, 0, 0, 0, 78, 0, 0, 0,
1337 0, 0, 0, 0, 0, 196, 0, 0, 0, 0,
1338 0, 197, 544, 0, 192, 193, 0, 0, 198, 0,
1339 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1340 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1341 0, 203, 616, 0, 0, 0, 0, 0, 204, 205,
1342 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1343 0, 78, 0, 491, 0, 192, 193, 0, 0, 0,
1344 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1345 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1346 0, 0, 0, 80, 0, 0, 81, 20, 0, 545,
1347 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1348 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1349 209, 196, 0, 0, 0, 0, 0, 197, 581, 0,
1350 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1351 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1352 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1353 148, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1354 208, 209, 194, 195, 0, 0, 0, 78, 0, 589,
1355 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1356 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1357 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1358 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1359 202, 582, 0, 194, 195, 0, 0, 0, 78, 204,
1360 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1361 0, 0, 0, 197, 597, 0, 192, 193, 0, 0,
1362 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1363 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1364 0, 202, 0, 0, 0, 0, 0, 590, 0, 0,
1365 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1366 0, 0, 0, 78, 0, 606, 0, 192, 193, 0,
1367 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1368 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1369 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1370 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1371 195, 598, 0, 0, 78, 204, 205, 206, 207, 0,
1372 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1373 491, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1374 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1375 20, 0, 0, 200, 201, 0, 0, 202, 607, 0,
1376 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1377 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1378 0, 581, 0, 192, 193, 0, 0, 0, 196, 0,
1379 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1380 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1381 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1382 0, 0, 202, 0, 0, 194, 195, 598, 0, 0,
1383 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1384 0, 0, 0, 0, 0, 197, 707, 0, 192, 193,
1385 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1386 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1387 201, 0, 0, 202, 691, 0, 0, 0, 0, 0,
1388 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1389 194, 195, 0, 0, 0, 78, 0, 707, 0, 192,
1390 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1391 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1392 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1393 81, 20, 0, 0, 200, 201, 0, 0, 202, 708,
1394 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1395 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1396 0, 197, 589, 0, 192, 193, 0, 0, 198, 0,
1397 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1398 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1399 751, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1400 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1401 0, 78, 0, 330, 0, 192, 193, 0, 0, 0,
1402 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1403 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1404 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1405 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1406 756, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1407 209, 196, 0, 0, 0, 0, 0, 197, 335, 0,
1408 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1409 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1410 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1411 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1412 208, 209, 194, 195, 0, 0, 0, 78, 0, 337,
1413 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1414 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1415 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1416 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1417 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1418 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1419 0, 0, 0, 197, 339, 0, 192, 193, 0, 0,
1420 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1421 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1422 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1423 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1424 0, 0, 0, 78, 0, 348, 0, 192, 193, 0,
1425 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1426 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1427 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1428 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1429 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1430 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1431 350, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1432 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1433 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1434 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1435 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1436 0, 352, 0, 192, 193, 0, 0, 0, 196, 0,
1437 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1438 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1439 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1440 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1441 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1442 0, 0, 0, 0, 0, 197, 409, 0, 192, 193,
1443 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1444 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1445 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1446 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1447 194, 195, 0, 0, 0, 78, 0, 491, 0, 192,
1448 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1449 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1450 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1451 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1452 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1453 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1454 0, 197, 499, 0, 192, 193, 0, 0, 198, 0,
1455 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1456 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1457 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1458 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1459 0, 78, 0, 503, 0, 192, 193, 0, 0, 0,
1460 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1461 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1462 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1463 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1464 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1465 209, 196, 0, 0, 0, 0, 0, 197, 505, 0,
1466 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1467 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1468 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1469 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1470 208, 209, 194, 195, 0, 0, 0, 78, 0, 507,
1471 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1472 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1473 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1474 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1475 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1476 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1477 0, 0, 0, 197, 509, 0, 192, 193, 0, 0,
1478 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1479 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1480 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1481 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1482 0, 0, 0, 78, 0, 511, 0, 192, 193, 0,
1483 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1484 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1485 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1486 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1487 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1488 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1489 513, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1490 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1491 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1492 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1493 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1494 0, 515, 0, 192, 193, 0, 0, 0, 196, 0,
1495 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1496 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1497 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1498 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1499 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1500 0, 0, 0, 0, 0, 197, 517, 0, 192, 193,
1501 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1502 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1503 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1504 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1505 194, 195, 0, 0, 0, 78, 0, 519, 0, 192,
1506 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1507 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1508 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1509 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1510 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1511 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1512 0, 197, 521, 0, 192, 193, 0, 0, 198, 0,
1513 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1514 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1515 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1516 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1517 0, 78, 0, 523, 0, 192, 193, 0, 0, 0,
1518 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1519 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1520 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1521 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1522 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1523 209, 196, 0, 0, 0, 0, 0, 197, 525, 0,
1524 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1525 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1526 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1527 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1528 208, 209, 194, 195, 0, 0, 0, 78, 0, 530,
1529 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1530 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1531 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1532 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1533 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1534 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1535 0, 0, 0, 197, 532, 0, 192, 193, 0, 0,
1536 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1537 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1538 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1539 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1540 0, 0, 0, 78, 0, 534, 0, 192, 193, 0,
1541 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1542 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1543 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1544 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1545 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1546 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1547 536, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1548 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1549 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1550 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1551 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1552 0, 538, 0, 192, 193, 0, 0, 0, 196, 0,
1553 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1554 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1555 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1556 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1557 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1558 0, 0, 0, 0, 0, 197, 540, 0, 192, 193,
1559 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1560 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1561 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1562 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1563 194, 195, 0, 0, 0, 78, 0, 542, 0, 192,
1564 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1565 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1566 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1567 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1568 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1569 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1570 0, 197, 547, 0, 192, 193, 0, 0, 198, 0,
1571 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1572 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1573 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1574 206, 207, 0, 0, 208, 209, 194, 195, 0, 0,
1575 0, 78, 0, 557, 0, 192, 193, 0, 0, 0,
1576 196, 0, 0, 0, 0, 0, 197, 0, 0, 0,
1577 0, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1578 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1579 200, 201, 0, 0, 202, 0, 0, 194, 195, 0,
1580 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1581 209, 196, 0, 0, 0, 0, 0, 197, 565, 0,
1582 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1583 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1584 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1585 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1586 208, 209, 194, 195, 0, 0, 0, 78, 0, 567,
1587 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1588 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1589 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1590 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1591 202, 0, 0, 194, 195, 0, 0, 0, 78, 204,
1592 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1593 0, 0, 0, 197, 592, 0, 192, 193, 0, 0,
1594 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1595 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1596 0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
1597 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1598 0, 0, 0, 78, 0, 609, 0, 192, 193, 0,
1599 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1600 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1601 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1602 0, 0, 200, 201, 0, 0, 202, 0, 0, 194,
1603 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1604 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1605 677, 0, 192, 193, 0, 0, 198, 0, 0, 0,
1606 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1607 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1608 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1609 0, 0, 208, 209, 194, 195, 0, 0, 0, 78,
1610 0, 681, 0, 192, 193, 0, 0, 0, 196, 0,
1611 0, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1612 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1613 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1614 0, 0, 202, 0, 0, 194, 195, 0, 0, 0,
1615 78, 204, 205, 206, 207, 0, 0, 208, 209, 196,
1616 0, 0, 0, 0, 0, 197, 687, 0, 192, 193,
1617 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1618 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1619 201, 0, 0, 202, 0, 0, 0, 0, 0, 0,
1620 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1621 194, 195, 0, 0, 0, 78, 0, 713, 0, 192,
1622 193, 0, 0, 0, 196, 0, 0, 0, 0, 0,
1623 197, 0, 0, 0, 0, 0, 0, 198, 0, 0,
1624 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1625 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1626 0, 194, 195, 0, 0, 0, 78, 204, 205, 206,
1627 207, 0, 0, 208, 209, 196, 0, 0, 0, 0,
1628 0, 197, 0, 575, 0, 0, 0, 0, 198, 0,
1629 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1630 0, 81, 20, 0, 0, 200, 201, 0, 662, 202,
1631 0, 0, 0, 0, 0, 0, 0, 0, 204, 205,
1632 206, 207, 0, 0, 208, 209, -289, -289, -289, 0,
1633 0, 0, -289, 0, 0, 0, 0, 0, 0, 0,
1634 0, -289, 0, 0, 0, 0, 0, -289, 0, 0,
1635 724, 0, 194, 195, -289, 0, 0, 78, -289, 0,
1636 0, 0, 0, 0, -289, 0, 196, -289, -289, 0,
1637 0, 0, 197, 0, 0, -289, 0, 192, 193, 198,
1638 0, -289, 0, 199, -289, -289, -289, -289, 0, 80,
1639 -289, -289, 81, 20, 194, 195, 0, 0, 0, 78,
1640 277, -297, 0, 0, 0, 0, 0, 0, 196, 204,
1641 205, 206, 207, 0, 197, 208, 209, 660, 0, 194,
1642 195, 198, 0, 0, 78, 199, 0, 0, 0, 0,
1643 0, 80, 0, 196, 81, 20, 0, 0, 0, 197,
1644 0, 0, 277, -297, 192, 193, 198, 0, 0, 0,
1645 199, 204, 205, 206, 207, 0, 80, 208, 209, 81,
1646 20, 194, 195, 200, 201, 0, 78, 202, 0, 203,
1647 356, 0, 0, 0, 0, 196, 204, 205, 206, 207,
1648 0, 197, 208, 209, 0, 0, 194, 195, 198, 0,
1649 0, 78, 199, 0, 0, 192, 193, 0, 80, 0,
1650 196, 81, 20, 0, 0, 0, 197, 0, 0, 277,
1651 0, 0, 0, 198, 0, 0, 0, 199, 204, 205,
1652 206, 207, 0, 80, 208, 209, 81, 20, 0, 0,
1653 200, 201, 0, 0, 202, 488, 0, 194, 195, 0,
1654 0, 0, 78, 204, 205, 206, 207, 0, 0, 208,
1655 209, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1656 192, 193, 0, 0, 198, 0, 0, 0, 199, 0,
1657 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1658 0, 200, 201, 0, 0, 202, 625, 0, 0, 0,
1659 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1660 208, 209, 194, 195, 0, 0, 0, 78, 0, 0,
1661 0, 192, 193, 0, 0, 0, 196, 0, 0, 0,
1662 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1663 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1664 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1665 202, 668, 0, 194, 195, 0, 0, 0, 78, 204,
1666 205, 206, 207, 0, 0, 208, 209, 196, 0, 0,
1667 0, 0, 0, 197, 0, 0, 192, 193, 0, 0,
1668 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1669 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1670 0, 202, 683, 0, 0, 0, 0, 0, 0, 0,
1671 204, 205, 206, 207, 0, 0, 208, 209, 194, 195,
1672 0, 0, 0, 78, 0, 0, 0, 0, 0, 0,
1673 0, 0, 196, 0, 0, 0, 0, 0, 197, 0,
1674 0, 0, 0, 0, 0, 198, 0, 0, 0, 199,
1675 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1676 0, 0, 200, 201, 0, 0, 202, 0, 2, 194,
1677 195, 0, 0, 0, 78, 204, 205, 206, 207, 0,
1678 0, 208, 209, 196, 0, 0, 0, 0, 0, 197,
1679 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1680 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1681 20, 0, 0, 0, 0, 0, 0, 277, 0, 0,
1682 0, 0, 0, 0, 0, 0, 204, 205, 206, 207,
1686 static const short yycheck
[] = { 3,
1687 328, 62, 6, 132, 62, 307, 129, 287, 175, 203,
1688 134, 0, 483, 179, 1, 1, 123, 1, 1, 346,
1689 9, 10, 11, 1, 83, 42, 353, 354, 89, 46,
1690 9, 89, 1, 94, 53, 1, 94, 657, 42, 162,
1691 1, 30, 46, 72, 33, 34, 169, 64, 435, 1,
1692 94, 62, 69, 97, 33, 86, 1, 86, 62, 294,
1693 64, 665, 51, 122, 123, 69, 1, 302, 129, 304,
1694 95, 129, 133, 62, 198, 133, 117, 1, 97, 192,
1695 193, 194, 195, 94, 636, 89, 1, 200, 201, 476,
1696 94, 1, 1, 95, 96, 1, 5, 99, 718, 160,
1697 86, 162, 160, 86, 162, 94, 636, 94, 1, 150,
1698 94, 128, 153, 100, 175, 502, 100, 134, 129, 180,
1699 1, 99, 180, 101, 128, 129, 1, 93, 1, 133,
1700 134, 172, 101, 4, 5, 101, 259, 198, 99, 636,
1701 129, 202, 613, 470, 133, 697, 473, 99, 700, 101,
1702 273, 162, 756, 0, 99, 100, 160, 1, 162, 94,
1703 326, 765, 9, 10, 11, 36, 37, 697, 140, 40,
1704 700, 175, 279, 162, 1, 99, 180, 86, 88, 50,
1705 1, 198, 1, 30, 99, 100, 33, 34, 192, 193,
1706 194, 195, 253, 99, 198, 253, 200, 201, 202, 636,
1707 697, 94, 1, 700, 51, 329, 100, 100, 79, 596,
1708 1, 763, 83, 254, 1, 62, 768, 98, 770, 1,
1709 772, 94, 283, 1, 99, 283, 287, 100, 1, 1,
1710 202, 203, 1, 763, 1, 622, 403, 1, 768, 1,
1711 770, 1, 772, 1, 1, 632, 307, 94, 92, 253,
1712 94, 122, 123, 97, 98, 99, 100, 370, 371, 372,
1713 697, 648, 1, 700, 253, 1, 763, 328, 139, 1,
1714 328, 768, 99, 770, 95, 772, 556, 15, 99, 283,
1715 99, 93, 129, 287, 94, 97, 588, 97, 590, 101,
1716 294, 485, 101, 175, 266, 94, 1, 269, 302, 1,
1717 304, 100, 1, 307, 175, 277, 1, 98, 179, 45,
1718 46, 98, 329, 641, 1, 162, 98, 86, 307, 86,
1719 98, 382, 95, 95, 328, 329, 763, 434, 1, 86,
1720 99, 768, 99, 770, 98, 772, 98, 175, 98, 328,
1721 1, 99, 403, 1, 1, 732, 52, 218, 1, 87,
1722 86, 631, 88, 1, 97, 91, 92, 93, 1, 1,
1723 99, 97, 94, 665, 477, 101, 370, 371, 372, 373,
1724 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
1725 384, 385, 386, 387, 388, 389, 553, 448, 1, 361,
1726 448, 52, 1, 365, 99, 52, 98, 268, 93, 403,
1727 99, 636, 63, 97, 275, 287, 63, 94, 279, 1,
1728 1, 100, 294, 0, 1, 88, 287, 1, 390, 1,
1729 302, 63, 304, 294, 1, 307, 1, 1, 1, 99,
1730 100, 302, 1, 304, 95, 1, 408, 95, 95, 52,
1731 720, 94, 0, 1, 448, 93, 418, 570, 420, 287,
1732 573, 94, 1, 95, 756, 326, 294, 44, 430, 99,
1733 100, 1, 697, 765, 302, 700, 304, 1, 55, 307,
1734 94, 93, 343, 477, 61, 67, 100, 1, 607, 483,
1735 67, 453, 95, 455, 93, 1, 44, 1, 723, 1,
1736 47, 362, 553, 364, 175, 556, 625, 469, 67, 612,
1737 95, 736, 86, 61, 95, 62, 0, 1, 480, 67,
1738 129, 93, 99, 485, 63, 750, 93, 92, 93, 93,
1739 93, 403, 97, 98, 99, 100, 98, 93, 763, 1,
1740 1, 1, 403, 768, 1, 770, 50, 772, 97, 96,
1741 1, 99, 101, 162, 667, 59, 95, 676, 1, 553,
1742 44, 65, 556, 93, 95, 0, 1, 686, 72, 93,
1743 431, 55, 76, 434, 1, 403, 96, 61, 82, 93,
1744 631, 85, 86, 67, 86, 89, 90, 93, 95, 93,
1745 641, 75, 99, 641, 0, 1, 93, 1, 102, 103,
1746 104, 105, 1, 1, 108, 109, 657, 129, 99, 44,
1747 0, 1, 0, 1, 1, 99, 287, 1, 612, 613,
1748 55, 175, 175, 294, 86, 86, 61, 1, 1, 86,
1749 1, 302, 67, 304, 628, 86, 307, 631, 44, 95,
1750 162, 64, 636, 86, 97, 44, 69, 641, 101, 55,
1751 1, 50, 1, 53, 44, 61, 44, 619, 65, 86,
1752 44, 67, 641, 657, 99, 72, 50, 718, 94, 720,
1753 1, 61, 1, 61, 11, 101, 1, 67, 65, 67,
1754 67, 553, 86, 82, 556, 72, 85, 86, 86, 76,
1755 129, 653, 553, 99, 95, 556, 97, 659, 82, 86,
1756 107, 85, 86, 697, 553, 128, 700, 556, 94, 99,
1757 94, 99, 86, 86, 100, 86, 588, 1, 590, 0,
1758 1, 160, 100, 162, 718, 553, 720, 96, 556, 723,
1759 47, 100, 403, 287, 287, 86, 65, 86, 67, 1,
1760 294, 294, 736, 72, 175, 62, 1, 76, 302, 302,
1761 304, 304, 94, 307, 307, 86, 750, 86, 100, 631,
1762 588, 86, 590, 44, 636, 101, 50, 44, 629, 763,
1763 631, 91, 92, 735, 768, 636, 770, 739, 772, 96,
1764 61, 44, 631, 101, 61, 657, 67, 50, 101, 44,
1765 67, 45, 46, 665, 92, 50, 657, 10, 82, 97,
1766 98, 85, 86, 631, 59, 67, 61, 94, 636, 9,
1767 72, 11, 67, 100, 76, 91, 92, 30, 99, 82,
1768 175, 34, 85, 86, 86, 697, 94, 82, 700, 657,
1769 85, 86, 100, 33, 94, 12, 697, 665, 51, 700,
1770 100, 470, 13, 97, 473, 1, 718, 101, 720, 403,
1771 403, 723, 97, 472, 60, 474, 287, 718, 64, 720,
1772 45, 46, 723, 294, 736, 18, 19, 20, 21, 697,
1773 14, 302, 700, 304, 1, 736, 307, 99, 750, 95,
1774 94, 93, 553, 97, 756, 556, 93, 101, 44, 750,
1775 718, 763, 720, 765, 50, 723, 768, 99, 770, 97,
1776 772, 175, 763, 697, 57, 99, 700, 768, 736, 770,
1777 99, 772, 97, 5, 6, 7, 101, 588, 99, 590,
1778 45, 46, 750, 50, 100, 44, 82, 95, 756, 85,
1779 86, 50, 287, 3, 4, 763, 66, 765, 93, 294,
1780 768, 93, 770, 1, 772, 16, 17, 302, 67, 304,
1781 91, 92, 307, 50, 88, 82, 45, 46, 85, 86,
1782 631, 93, 59, 82, 99, 636, 85, 86, 65, 763,
1783 45, 46, 403, 94, 768, 72, 770, 1, 772, 76,
1784 93, 91, 92, 93, 99, 82, 657, 97, 85, 86,
1785 94, 101, 89, 90, 665, 94, 93, 97, 98, 553,
1786 553, 97, 556, 556, 44, 102, 103, 104, 105, 1,
1787 50, 108, 109, 287, 373, 374, 44, 383, 384, 59,
1788 294, 61, 50, 8, 9, 10, 697, 67, 302, 700,
1789 304, 94, 100, 307, 588, 588, 590, 590, 378, 379,
1790 380, 381, 82, 56, 56, 85, 86, 718, 403, 720,
1791 99, 94, 723, 94, 82, 95, 96, 85, 86, 192,
1792 193, 194, 195, 1, 94, 736, 94, 200, 201, 86,
1793 97, 98, 99, 94, 91, 92, 93, 631, 631, 750,
1794 97, 1, 636, 636, 101, 756, 56, 1, 99, 3,
1795 4, 99, 763, 94, 765, 94, 0, 768, 0, 770,
1796 44, 772, 382, 657, 657, 11, 50, 54, 375, 376,
1797 377, 665, 665, 86, 75, 59, 162, 61, 91, 92,
1798 93, 139, 553, 67, 97, 556, 160, 253, 101, 403,
1799 403, 45, 46, 52, 94, 307, 50, 261, 82, 287,
1800 655, 85, 86, 697, 697, 59, 700, 700, 307, 571,
1801 655, 65, 96, 571, 346, 385, 387, 588, 72, 590,
1802 386, 388, 76, 628, 718, 718, 720, 720, 82, 723,
1803 723, 85, 86, 393, 389, 89, 90, -1, -1, 93,
1804 -1, 95, 736, 736, -1, -1, -1, -1, 102, 103,
1805 104, 105, -1, -1, 108, 109, 750, 750, 553, -1,
1806 631, 556, 756, 756, -1, 636, -1, -1, -1, 763,
1807 763, 765, 765, -1, 768, 768, 770, 770, 772, 772,
1808 -1, 91, 92, 93, -1, -1, 657, 97, -1, -1,
1809 -1, 101, -1, 588, 665, 590, -1, 370, 371, 372,
1810 373, 374, 375, 376, 377, 378, 379, 380, 381, -1,
1811 383, 384, 385, 386, 387, 388, 389, 44, 91, 92,
1812 93, -1, -1, 50, 97, -1, 697, -1, 101, 700,
1813 -1, -1, 59, -1, 61, -1, 631, -1, -1, 553,
1814 67, 636, 556, -1, -1, -1, -1, 718, -1, 720,
1815 -1, -1, 723, -1, -1, 82, -1, -1, 85, 86,
1816 -1, -1, 657, -1, -1, 736, -1, -1, 95, 96,
1817 665, -1, -1, -1, 588, -1, 590, -1, -1, 750,
1818 -1, 192, 193, 194, 195, 756, -1, -1, -1, 200,
1819 201, -1, 763, -1, 765, -1, -1, 768, -1, 770,
1820 -1, 772, 697, -1, 477, 700, -1, -1, -1, 86,
1821 483, -1, -1, -1, 91, 92, 93, 631, -1, -1,
1822 97, -1, 636, 718, 101, 720, -1, 1, 723, 3,
1823 4, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1824 -1, 736, -1, 657, -1, -1, -1, -1, -1, -1,
1825 -1, 665, -1, -1, -1, 750, -1, -1, -1, -1,
1826 -1, 756, -1, -1, -1, -1, -1, -1, 763, -1,
1827 765, 45, 46, 768, -1, 770, 50, 772, -1, -1,
1828 -1, -1, -1, 697, -1, 59, 700, -1, -1, -1,
1829 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1830 -1, -1, 76, -1, 718, -1, 720, -1, 82, 723,
1831 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1832 -1, -1, 736, -1, -1, 99, -1, -1, 102, 103,
1833 104, 105, -1, -1, 108, 109, 750, 1, -1, 612,
1834 613, -1, 756, -1, -1, -1, -1, -1, -1, 763,
1835 -1, 765, -1, -1, 768, 628, 770, -1, 772, 370,
1836 371, 372, 373, 374, 375, 376, 377, 378, 379, 380,
1837 381, -1, 383, 384, 385, 386, 387, 388, 389, -1,
1838 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1839 54, -1, -1, -1, 58, 59, -1, -1, 62, -1,
1840 -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
1841 1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1842 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1843 -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
1844 104, 105, -1, -1, 108, 109, -1, -1, -1, -1,
1845 -1, -1, -1, 44, 45, 46, 47, 48, 49, 50,
1846 51, -1, -1, 54, -1, -1, 477, 58, 59, -1,
1847 -1, 62, 483, -1, 65, 66, 67, 68, 1, 70,
1848 71, 72, 73, -1, -1, 76, -1, -1, -1, -1,
1849 -1, 82, -1, -1, 85, 86, -1, -1, -1, -1,
1850 -1, -1, 93, -1, 95, 96, -1, -1, 99, -1,
1851 -1, 102, 103, 104, 105, -1, -1, 108, 109, -1,
1852 -1, 44, 45, 46, 47, 48, 49, 50, 51, -1,
1853 -1, 54, -1, -1, -1, 58, 59, -1, -1, 62,
1854 -1, -1, 65, 66, 67, 68, -1, 70, 71, 72,
1855 73, 44, -1, 76, -1, -1, -1, 50, -1, 82,
1856 -1, 1, 85, 86, -1, -1, 59, -1, 61, -1,
1857 93, -1, 95, 96, 67, -1, 99, -1, -1, 102,
1858 103, 104, 105, -1, -1, 108, 109, -1, -1, 82,
1859 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1860 -1, 612, 613, 96, 44, 45, 46, -1, 48, 49,
1861 50, 51, -1, -1, 54, -1, -1, 628, 58, 59,
1862 -1, -1, -1, -1, -1, 65, 66, 67, 68, 1,
1863 70, 71, 72, 73, -1, -1, 76, -1, -1, -1,
1864 -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
1865 -1, -1, -1, 93, -1, 95, 96, -1, -1, 99,
1866 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1867 -1, -1, 44, 45, 46, -1, 48, 49, 50, 51,
1868 -1, -1, 54, -1, -1, -1, 58, 59, -1, -1,
1869 -1, -1, -1, 65, 66, 67, 68, 1, 70, 71,
1870 72, 73, -1, -1, 76, -1, -1, -1, -1, -1,
1871 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
1872 -1, 93, -1, 95, -1, -1, -1, 99, -1, -1,
1873 102, 103, 104, 105, -1, -1, 108, 109, -1, -1,
1874 44, 45, 46, -1, 48, 49, 50, 51, -1, -1,
1875 54, -1, -1, -1, 58, 59, -1, -1, -1, -1,
1876 -1, 65, 66, 1, 68, -1, 70, 71, 72, 73,
1877 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1878 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1879 -1, 95, -1, -1, -1, 99, -1, -1, 102, 103,
1880 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
1881 48, 49, 50, 51, -1, -1, 54, -1, -1, -1,
1882 58, 59, -1, -1, -1, -1, -1, 65, 66, -1,
1883 68, -1, 70, 71, 72, 73, -1, 1, 76, 3,
1884 4, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1885 -1, -1, -1, -1, -1, 93, -1, 95, -1, -1,
1886 -1, 99, -1, -1, 102, 103, 104, 105, -1, -1,
1887 108, 109, -1, -1, -1, -1, -1, -1, -1, -1,
1888 -1, 45, 46, -1, -1, -1, 50, -1, -1, -1,
1889 -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
1890 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
1891 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1892 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1893 -1, 95, 96, -1, -1, -1, -1, -1, 102, 103,
1894 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
1895 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
1896 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
1897 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1898 -1, -1, -1, 82, -1, -1, 85, 86, -1, 88,
1899 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
1900 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
1901 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
1902 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
1903 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1904 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
1905 98, -1, -1, -1, 102, 103, 104, 105, -1, -1,
1906 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
1907 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
1908 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
1909 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1910 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1911 93, 94, -1, 45, 46, -1, -1, -1, 50, 102,
1912 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
1913 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
1914 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1915 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1916 -1, 93, -1, -1, -1, -1, -1, 99, -1, -1,
1917 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
1918 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
1919 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
1920 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
1921 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1922 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
1923 46, 98, -1, -1, 50, 102, 103, 104, 105, -1,
1924 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
1925 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
1926 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1927 86, -1, -1, 89, 90, -1, -1, 93, 94, -1,
1928 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
1929 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
1930 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
1931 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
1932 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1933 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1934 -1, -1, 93, -1, -1, 45, 46, 98, -1, -1,
1935 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
1936 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
1937 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1938 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1939 90, -1, -1, 93, 94, -1, -1, -1, -1, -1,
1940 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1941 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
1942 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
1943 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1944 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1945 85, 86, -1, -1, 89, 90, -1, -1, 93, 94,
1946 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
1947 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
1948 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
1949 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1950 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1951 94, -1, -1, -1, -1, -1, -1, -1, 102, 103,
1952 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
1953 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
1954 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
1955 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1956 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1957 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
1958 99, -1, 50, 102, 103, 104, 105, -1, -1, 108,
1959 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
1960 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
1961 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1962 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
1963 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
1964 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
1965 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
1966 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
1967 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1968 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1969 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
1970 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
1971 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
1972 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1973 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1974 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
1975 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
1976 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
1977 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
1978 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
1979 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1980 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
1981 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
1982 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
1983 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
1984 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1985 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1986 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
1987 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
1988 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
1989 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
1990 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1991 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1992 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
1993 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
1994 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
1995 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1996 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1997 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
1998 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1999 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2000 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2001 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2002 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2003 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2004 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2005 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2006 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2007 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2008 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2009 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2010 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2011 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2012 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2013 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2014 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2015 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2016 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2017 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2018 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2019 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2020 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2021 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2022 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2023 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2024 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2025 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2026 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2027 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2028 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2029 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2030 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2031 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2032 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2033 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2034 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2035 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2036 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2037 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2038 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2039 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2040 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2041 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2042 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2043 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2044 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2045 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2046 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2047 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2048 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2049 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2050 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2051 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2052 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2053 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2054 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2055 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2056 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2057 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2058 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2059 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2060 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2061 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2062 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2063 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2064 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2065 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2066 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2067 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2068 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2069 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2070 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2071 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2072 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2073 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2074 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2075 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2076 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2077 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2078 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2079 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2080 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2081 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2082 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2083 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2084 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2085 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2086 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2087 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2088 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2089 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2090 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2091 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2092 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2093 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2094 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2095 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2096 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2097 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2098 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2099 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2100 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2101 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2102 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2103 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2104 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2105 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2106 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2107 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2108 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2109 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2110 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2111 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2112 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2113 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2114 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2115 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2116 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2117 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2118 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2119 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2120 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2121 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2122 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1,
2123 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2124 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2125 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2126 104, 105, -1, -1, 108, 109, 45, 46, -1, -1,
2127 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1,
2128 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2129 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2130 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2131 89, 90, -1, -1, 93, -1, -1, 45, 46, -1,
2132 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2133 109, 59, -1, -1, -1, -1, -1, 65, 1, -1,
2134 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2135 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2136 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2137 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2138 108, 109, 45, 46, -1, -1, -1, 50, -1, 1,
2139 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2140 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2141 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2142 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2143 93, -1, -1, 45, 46, -1, -1, -1, 50, 102,
2144 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2145 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1,
2146 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2147 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2148 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2149 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2150 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1,
2151 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2152 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2153 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2154 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45,
2155 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2156 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2157 1, -1, 3, 4, -1, -1, 72, -1, -1, -1,
2158 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2159 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2160 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2161 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50,
2162 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1,
2163 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1,
2164 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2165 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2166 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1,
2167 50, 102, 103, 104, 105, -1, -1, 108, 109, 59,
2168 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4,
2169 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2170 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2171 90, -1, -1, 93, -1, -1, -1, -1, -1, -1,
2172 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
2173 45, 46, -1, -1, -1, 50, -1, 1, -1, 3,
2174 4, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2175 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
2176 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2177 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2178 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104,
2179 105, -1, -1, 108, 109, 59, -1, -1, -1, -1,
2180 -1, 65, -1, 1, -1, -1, -1, -1, 72, -1,
2181 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2182 -1, 85, 86, -1, -1, 89, 90, -1, 1, 93,
2183 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103,
2184 104, 105, -1, -1, 108, 109, 44, 45, 46, -1,
2185 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2186 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2187 1, -1, 45, 46, 72, -1, -1, 50, 76, -1,
2188 -1, -1, -1, -1, 82, -1, 59, 85, 86, -1,
2189 -1, -1, 65, -1, -1, 93, -1, 3, 4, 72,
2190 -1, 99, -1, 76, 102, 103, 104, 105, -1, 82,
2191 108, 109, 85, 86, 45, 46, -1, -1, -1, 50,
2192 93, 94, -1, -1, -1, -1, -1, -1, 59, 102,
2193 103, 104, 105, -1, 65, 108, 109, 1, -1, 45,
2194 46, 72, -1, -1, 50, 76, -1, -1, -1, -1,
2195 -1, 82, -1, 59, 85, 86, -1, -1, -1, 65,
2196 -1, -1, 93, 94, 3, 4, 72, -1, -1, -1,
2197 76, 102, 103, 104, 105, -1, 82, 108, 109, 85,
2198 86, 45, 46, 89, 90, -1, 50, 93, -1, 95,
2199 96, -1, -1, -1, -1, 59, 102, 103, 104, 105,
2200 -1, 65, 108, 109, -1, -1, 45, 46, 72, -1,
2201 -1, 50, 76, -1, -1, 3, 4, -1, 82, -1,
2202 59, 85, 86, -1, -1, -1, 65, -1, -1, 93,
2203 -1, -1, -1, 72, -1, -1, -1, 76, 102, 103,
2204 104, 105, -1, 82, 108, 109, 85, 86, -1, -1,
2205 89, 90, -1, -1, 93, 94, -1, 45, 46, -1,
2206 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108,
2207 109, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2208 3, 4, -1, -1, 72, -1, -1, -1, 76, -1,
2209 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2210 -1, 89, 90, -1, -1, 93, 94, -1, -1, -1,
2211 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2212 108, 109, 45, 46, -1, -1, -1, 50, -1, -1,
2213 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1,
2214 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2215 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2216 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2217 93, 94, -1, 45, 46, -1, -1, -1, 50, 102,
2218 103, 104, 105, -1, -1, 108, 109, 59, -1, -1,
2219 -1, -1, -1, 65, -1, -1, 3, 4, -1, -1,
2220 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2221 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2222 -1, 93, 94, -1, -1, -1, -1, -1, -1, -1,
2223 102, 103, 104, 105, -1, -1, 108, 109, 45, 46,
2224 -1, -1, -1, 50, -1, -1, -1, -1, -1, -1,
2225 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1,
2226 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2227 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2228 -1, -1, 89, 90, -1, -1, 93, -1, 44, 45,
2229 46, -1, -1, -1, 50, 102, 103, 104, 105, -1,
2230 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65,
2231 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2232 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2233 86, -1, -1, -1, -1, -1, -1, 93, -1, -1,
2234 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105,
2239 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2240 #line 3 "/usr/share/misc/bison.simple"
2242 /* Skeleton output parser for bison,
2243 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2245 This program is free software; you can redistribute it and/or modify
2246 it under the terms of the GNU General Public License as published by
2247 the Free Software Foundation; either version 2, or (at your option)
2250 This program is distributed in the hope that it will be useful,
2251 but WITHOUT ANY WARRANTY; without even the implied warranty of
2252 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2253 GNU General Public License for more details.
2255 You should have received a copy of the GNU General Public License
2256 along with this program; if not, write to the Free Software
2257 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2259 /* As a special exception, when this file is copied by Bison into a
2260 Bison output file, you may use that output file without restriction.
2261 This special exception was added by the Free Software Foundation
2262 in version 1.24 of Bison. */
2266 #define alloca __builtin_alloca
2267 #else /* not GNU C. */
2268 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
2270 #else /* not sparc */
2271 #if defined (MSDOS) && !defined (__TURBOC__)
2273 #else /* not MSDOS, or __TURBOC__ */
2277 #else /* not MSDOS, __TURBOC__, or _AIX */
2281 void *alloca (unsigned int);
2283 #else /* not __cplusplus */
2285 #endif /* not __cplusplus */
2287 #endif /* not _AIX */
2288 #endif /* not MSDOS, or __TURBOC__ */
2289 #endif /* not sparc. */
2290 #endif /* not GNU C. */
2291 #endif /* alloca not defined. */
2293 /* This is the parser code that is written into each bison parser
2294 when the %semantic_parser declaration is not specified in the grammar.
2295 It was written by Richard Stallman by simplifying the hairy parser
2296 used when %semantic_parser is specified. */
2298 /* Note: there must be only one dollar sign in this file.
2299 It is replaced by the list of actions, each action
2300 as one case of the switch. */
2302 #define yyerrok (yyerrstatus = 0)
2303 #define yyclearin (yychar = YYEMPTY)
2306 #define YYACCEPT return(0)
2307 #define YYABORT return(1)
2308 #define YYERROR goto yyerrlab1
2309 /* Like YYERROR except do call yyerror.
2310 This remains here temporarily to ease the
2311 transition to the new meaning of YYERROR, for GCC.
2312 Once GCC version 2 has supplanted version 1, this can go. */
2313 #define YYFAIL goto yyerrlab
2314 #define YYRECOVERING() (!!yyerrstatus)
2315 #define YYBACKUP(token, value) \
2317 if (yychar == YYEMPTY && yylen == 1) \
2318 { yychar = (token), yylval = (value); \
2319 yychar1 = YYTRANSLATE (yychar); \
2324 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2328 #define YYERRCODE 256
2331 #define YYLEX yylex()
2337 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2339 #define YYLEX yylex(&yylval, &yylloc)
2341 #else /* not YYLSP_NEEDED */
2343 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2345 #define YYLEX yylex(&yylval)
2347 #endif /* not YYLSP_NEEDED */
2350 /* If nonreentrant, generate the variables here */
2354 int yychar
; /* the lookahead symbol */
2355 YYSTYPE yylval
; /* the semantic value of the */
2356 /* lookahead symbol */
2359 YYLTYPE yylloc
; /* location data for the lookahead */
2363 int yynerrs
; /* number of parse errors so far */
2364 #endif /* not YYPURE */
2367 int yydebug
; /* nonzero means print parse trace */
2368 /* Since this is uninitialized, it does not stop multiple parsers
2372 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2375 #define YYINITDEPTH 200
2378 /* YYMAXDEPTH is the maximum size the stacks can grow to
2379 (effective only if the built-in stack extension method is used). */
2386 #define YYMAXDEPTH 10000
2389 /* Prevent warning if -Wstrict-prototypes. */
2391 #ifndef YYPARSE_PARAM
2396 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2397 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2398 #else /* not GNU C or C++ */
2401 /* This is the most reliable way to avoid incompatibilities
2402 in available built-in functions on various systems. */
2404 __yy_memcpy (to
, from
, count
)
2409 register char *f
= from
;
2410 register char *t
= to
;
2411 register int i
= count
;
2417 #else /* __cplusplus */
2419 /* This is the most reliable way to avoid incompatibilities
2420 in available built-in functions on various systems. */
2422 __yy_memcpy (char *to
, char *from
, int count
)
2424 register char *f
= from
;
2425 register char *t
= to
;
2426 register int i
= count
;
2435 #line 196 "/usr/share/misc/bison.simple"
2437 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2438 into yyparse. The argument should have type void *.
2439 It should actually point to an object.
2440 Grammar actions can access the variable by casting it
2441 to the proper pointer type. */
2443 #ifdef YYPARSE_PARAM
2445 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2446 #define YYPARSE_PARAM_DECL
2447 #else /* not __cplusplus */
2448 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2449 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2450 #endif /* not __cplusplus */
2451 #else /* not YYPARSE_PARAM */
2452 #define YYPARSE_PARAM_ARG
2453 #define YYPARSE_PARAM_DECL
2454 #endif /* not YYPARSE_PARAM */
2457 yyparse(YYPARSE_PARAM_ARG
)
2460 register int yystate
;
2462 register short *yyssp
;
2463 register YYSTYPE
*yyvsp
;
2464 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
2465 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
2467 short yyssa
[YYINITDEPTH
]; /* the state stack */
2468 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
2470 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
2471 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
2474 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
2475 YYLTYPE
*yyls
= yylsa
;
2478 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2480 #define YYPOPSTACK (yyvsp--, yyssp--)
2483 int yystacksize
= YYINITDEPTH
;
2494 YYSTYPE yyval
; /* the variable used to return */
2495 /* semantic values from the action */
2502 fprintf(stderr
, "Starting parse\n");
2508 yychar
= YYEMPTY
; /* Cause a token to be read. */
2510 /* Initialize stack pointers.
2511 Waste one element of value and location stack
2512 so that they stay on the same level as the state stack.
2513 The wasted elements are never initialized. */
2521 /* Push a new state, which is found in yystate . */
2522 /* In all cases, when you get here, the value and location stacks
2523 have just been pushed. so pushing a state here evens the stacks. */
2528 if (yyssp
>= yyss
+ yystacksize
- 1)
2530 /* Give user a chance to reallocate the stack */
2531 /* Use copies of these so that the &'s don't force the real ones into memory. */
2532 YYSTYPE
*yyvs1
= yyvs
;
2533 short *yyss1
= yyss
;
2535 YYLTYPE
*yyls1
= yyls
;
2538 /* Get the current used size of the three stacks, in elements. */
2539 int size
= yyssp
- yyss
+ 1;
2542 /* Each stack pointer address is followed by the size of
2543 the data in use in that stack, in bytes. */
2545 /* This used to be a conditional around just the two extra args,
2546 but that might be undefined if yyoverflow is a macro. */
2547 yyoverflow("parser stack overflow",
2548 &yyss1
, size
* sizeof (*yyssp
),
2549 &yyvs1
, size
* sizeof (*yyvsp
),
2550 &yyls1
, size
* sizeof (*yylsp
),
2553 yyoverflow("parser stack overflow",
2554 &yyss1
, size
* sizeof (*yyssp
),
2555 &yyvs1
, size
* sizeof (*yyvsp
),
2559 yyss
= yyss1
; yyvs
= yyvs1
;
2563 #else /* no yyoverflow */
2564 /* Extend the stack our own way. */
2565 if (yystacksize
>= YYMAXDEPTH
)
2567 yyerror("parser stack overflow");
2571 if (yystacksize
> YYMAXDEPTH
)
2572 yystacksize
= YYMAXDEPTH
;
2573 yyss
= (short *) alloca (yystacksize
* sizeof (*yyssp
));
2574 __yy_memcpy ((char *)yyss
, (char *)yyss1
, size
* sizeof (*yyssp
));
2575 yyvs
= (YYSTYPE
*) alloca (yystacksize
* sizeof (*yyvsp
));
2576 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
, size
* sizeof (*yyvsp
));
2578 yyls
= (YYLTYPE
*) alloca (yystacksize
* sizeof (*yylsp
));
2579 __yy_memcpy ((char *)yyls
, (char *)yyls1
, size
* sizeof (*yylsp
));
2581 #endif /* no yyoverflow */
2583 yyssp
= yyss
+ size
- 1;
2584 yyvsp
= yyvs
+ size
- 1;
2586 yylsp
= yyls
+ size
- 1;
2591 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
2594 if (yyssp
>= yyss
+ yystacksize
- 1)
2600 fprintf(stderr
, "Entering state %d\n", yystate
);
2606 /* Do appropriate processing given the current state. */
2607 /* Read a lookahead token if we need one and don't already have one. */
2610 /* First try to decide what to do without reference to lookahead token. */
2612 yyn
= yypact
[yystate
];
2616 /* Not known => get a lookahead token if don't already have one. */
2618 /* yychar is either YYEMPTY or YYEOF
2619 or a valid token in external form. */
2621 if (yychar
== YYEMPTY
)
2625 fprintf(stderr
, "Reading a token: ");
2630 /* Convert token to internal form (in yychar1) for indexing tables with */
2632 if (yychar
<= 0) /* This means end of input. */
2635 yychar
= YYEOF
; /* Don't call YYLEX any more */
2639 fprintf(stderr
, "Now at end of input.\n");
2644 yychar1
= YYTRANSLATE(yychar
);
2649 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
2650 /* Give the individual parser a way to print the precise meaning
2651 of a token, for further debugging info. */
2653 YYPRINT (stderr
, yychar
, yylval
);
2655 fprintf (stderr
, ")\n");
2661 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
2666 /* yyn is what to do for this token type in this state.
2667 Negative => reduce, -yyn is rule number.
2668 Positive => shift, yyn is new state.
2669 New state is final state => don't bother to shift,
2670 just return success.
2671 0, or most negative number => error. */
2686 /* Shift the lookahead token. */
2690 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
2693 /* Discard the token being shifted unless it is eof. */
2694 if (yychar
!= YYEOF
)
2702 /* count tokens shifted since error; after three, turn off error status. */
2703 if (yyerrstatus
) yyerrstatus
--;
2708 /* Do the default action for the current state. */
2711 yyn
= yydefact
[yystate
];
2715 /* Do a reduction. yyn is the number of a rule to reduce with. */
2719 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
2726 fprintf (stderr
, "Reducing via rule %d (line %d), ",
2729 /* Print the symbols being reduced, and their result. */
2730 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
2731 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
2732 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
2740 #line 485 "./parse.y"
2744 #line 529 "./parse.y"
2746 yyval
.node
= build_java_array_type (yyvsp
[-2].node
, -1);
2747 CLASS_LOADED_P (yyval
.node
) = 1;
2751 #line 534 "./parse.y"
2752 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
2755 #line 536 "./parse.y"
2756 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
2759 #line 538 "./parse.y"
2760 {RULE ("']' expected"); RECOVER
;;
2763 #line 540 "./parse.y"
2764 {RULE ("']' expected"); RECOVER
;;
2767 #line 555 "./parse.y"
2768 { yyval
.node
= make_qualified_name (yyvsp
[-2].node
, yyvsp
[0].node
, yyvsp
[-1].operator.location
); ;
2771 #line 564 "./parse.y"
2772 {yyval
.node
= NULL
;;
2775 #line 576 "./parse.y"
2781 #line 580 "./parse.y"
2787 #line 592 "./parse.y"
2788 { ctxp
->package
= EXPR_WFL_NODE (yyvsp
[-1].node
); ;
2791 #line 594 "./parse.y"
2792 {yyerror ("Missing name"); RECOVER
;;
2795 #line 596 "./parse.y"
2796 {yyerror ("';' expected"); RECOVER
;;
2799 #line 606 "./parse.y"
2801 tree name
= EXPR_WFL_NODE (yyvsp
[-1].node
), node
, last_name
;
2802 int i
= IDENTIFIER_LENGTH (name
)-1;
2803 const char *last
= &IDENTIFIER_POINTER (name
)[i
];
2804 while (last
!= IDENTIFIER_POINTER (name
))
2806 if (last
[0] == '.')
2810 last_name
= get_identifier (++last
);
2811 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name
))
2813 tree err
= find_name_in_single_imports (last_name
);
2814 if (err
&& err
!= name
)
2816 (yyvsp
[-1].node
, "Ambiguous class: `%s' and `%s'",
2817 IDENTIFIER_POINTER (name
),
2818 IDENTIFIER_POINTER (err
));
2820 REGISTER_IMPORT (yyvsp
[-1].node
, last_name
)
2823 REGISTER_IMPORT (yyvsp
[-1].node
, last_name
);
2827 #line 632 "./parse.y"
2828 {yyerror ("Missing name"); RECOVER
;;
2831 #line 634 "./parse.y"
2832 {yyerror ("';' expected"); RECOVER
;;
2835 #line 639 "./parse.y"
2837 tree name
= EXPR_WFL_NODE (yyvsp
[-3].node
);
2838 /* Don't import java.lang.* twice. */
2839 if (name
!= java_lang_id
)
2841 tree node
= build_tree_list (yyvsp
[-3].node
, NULL_TREE
);
2842 read_import_dir (yyvsp
[-3].node
);
2843 TREE_CHAIN (node
) = ctxp
->import_demand_list
;
2844 ctxp
->import_demand_list
= node
;
2849 #line 651 "./parse.y"
2850 {yyerror ("'*' expected"); RECOVER
;;
2853 #line 653 "./parse.y"
2854 {yyerror ("';' expected"); RECOVER
;;
2857 #line 658 "./parse.y"
2859 maybe_generate_finit ();
2860 maybe_generate_clinit ();
2861 yyval
.node
= yyvsp
[0].node
;
2865 #line 664 "./parse.y"
2867 maybe_generate_clinit ();
2868 yyval
.node
= yyvsp
[0].node
;
2872 #line 669 "./parse.y"
2873 { yyval
.node
= NULL
; ;
2876 #line 671 "./parse.y"
2879 yyerror ("Class or interface declaration expected");
2883 #line 682 "./parse.y"
2885 yyval
.value
= (1 << yyvsp
[0].value
);
2889 #line 686 "./parse.y"
2891 int acc
= (1 << yyvsp
[0].value
);
2892 if (yyval
.value
& acc
)
2894 (ctxp
->modifier_ctx
[yyvsp
[0].value
], "Modifier `%s' declared twice",
2895 java_accstring_lookup (acc
));
2903 #line 702 "./parse.y"
2904 { create_class (yyvsp
[-4].value
, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
2907 #line 704 "./parse.y"
2909 yyval
.node
= yyvsp
[0].node
;
2913 #line 708 "./parse.y"
2914 { create_class (0, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
2917 #line 710 "./parse.y"
2919 yyval
.node
= yyvsp
[0].node
;
2923 #line 714 "./parse.y"
2924 {yyerror ("Missing class name"); RECOVER
;;
2927 #line 716 "./parse.y"
2928 {yyerror ("Missing class name"); RECOVER
;;
2931 #line 718 "./parse.y"
2933 if (!ctxp
->class_err
) yyerror ("'{' expected");
2938 #line 723 "./parse.y"
2939 {if (!ctxp
->class_err
) yyerror ("'{' expected"); RECOVER
;;
2942 #line 727 "./parse.y"
2943 { yyval
.node
= NULL
; ;
2946 #line 729 "./parse.y"
2947 { yyval
.node
= yyvsp
[0].node
; ;
2950 #line 731 "./parse.y"
2951 {yyerror ("'{' expected"); ctxp
->class_err
=1;;
2954 #line 733 "./parse.y"
2955 {yyerror ("Missing super class name"); ctxp
->class_err
=1;;
2958 #line 737 "./parse.y"
2959 { yyval
.node
= NULL_TREE
; ;
2962 #line 739 "./parse.y"
2963 { yyval
.node
= yyvsp
[0].node
; ;
2966 #line 741 "./parse.y"
2969 yyerror ("Missing interface name");
2973 #line 749 "./parse.y"
2975 ctxp
->interface_number
= 1;
2976 yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
);
2980 #line 754 "./parse.y"
2982 ctxp
->interface_number
++;
2983 yyval
.node
= chainon (yyvsp
[-2].node
, build_tree_list (yyvsp
[0].node
, NULL_TREE
));
2987 #line 759 "./parse.y"
2988 {yyerror ("Missing interface name"); RECOVER
;;
2991 #line 764 "./parse.y"
2993 /* Store the location of the `}' when doing xrefs */
2995 DECL_END_SOURCE_LINE (ctxp
->current_parsed_class
) =
2996 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
2997 yyval
.node
= ctxp
->current_parsed_class
;
3001 #line 772 "./parse.y"
3003 /* Store the location of the `}' when doing xrefs */
3005 DECL_END_SOURCE_LINE (ctxp
->current_parsed_class
) =
3006 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3007 yyval
.node
= ctxp
->current_parsed_class
;
3011 #line 791 "./parse.y"
3012 { yyval
.node
= parse_jdk1_1_error ("instance initializer"); ;
3015 #line 797 "./parse.y"
3016 { yyval
.node
= yyvsp
[-1].node
; ;
3019 #line 800 "./parse.y"
3020 { yyval
.node
= parse_jdk1_1_error ("inner classe declaration"); ;
3023 #line 802 "./parse.y"
3024 { yyval
.node
= parse_jdk1_1_error ("inner interface declaration"); ;
3027 #line 808 "./parse.y"
3028 { register_fields (0, yyvsp
[-2].node
, yyvsp
[-1].node
); ;
3031 #line 810 "./parse.y"
3034 ("Illegal modifier `%s' for field declaration",
3035 yyvsp
[-3].value
, FIELD_MODIFIERS
);
3036 check_modifiers_consistency (yyvsp
[-3].value
);
3037 register_fields (yyvsp
[-3].value
, yyvsp
[-2].node
, yyvsp
[-1].node
);
3041 #line 823 "./parse.y"
3042 { yyval
.node
= chainon (yyvsp
[-2].node
, yyvsp
[0].node
); ;
3045 #line 825 "./parse.y"
3046 {yyerror ("Missing term"); RECOVER
;;
3049 #line 830 "./parse.y"
3050 { yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
); ;
3053 #line 832 "./parse.y"
3055 if (java_error_count
)
3056 yyvsp
[0].node
= NULL_TREE
;
3057 yyval
.node
= build_tree_list
3058 (yyvsp
[-2].node
, build_assignment (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
));
3062 #line 839 "./parse.y"
3064 yyerror ("Missing variable initializer");
3065 yyval
.node
= build_tree_list (yyvsp
[-2].node
, NULL_TREE
);
3070 #line 845 "./parse.y"
3072 yyerror ("';' expected");
3073 yyval
.node
= build_tree_list (yyvsp
[-3].node
, NULL_TREE
);
3078 #line 855 "./parse.y"
3079 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
3082 #line 857 "./parse.y"
3083 {yyerror ("Invalid declaration"); DRECOVER(vdi
);;
3086 #line 859 "./parse.y"
3087 {yyerror ("']' expected"); DRECOVER(vdi
);;
3090 #line 861 "./parse.y"
3091 {yyerror ("Unbalanced ']'"); DRECOVER(vdi
);;
3094 #line 872 "./parse.y"
3096 current_function_decl
= yyvsp
[0].node
;
3097 source_start_java_method (current_function_decl
);
3101 #line 877 "./parse.y"
3102 { finish_method_declaration (yyvsp
[0].node
); ;
3105 #line 879 "./parse.y"
3106 {YYNOT_TWICE
yyerror ("'{' expected"); RECOVER
;;
3109 #line 884 "./parse.y"
3110 { yyval
.node
= method_header (0, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3113 #line 886 "./parse.y"
3114 { yyval
.node
= method_header (0, void_type_node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3117 #line 888 "./parse.y"
3118 { yyval
.node
= method_header (yyvsp
[-3].value
, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3121 #line 890 "./parse.y"
3122 { yyval
.node
= method_header (yyvsp
[-3].value
, void_type_node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3125 #line 892 "./parse.y"
3129 #line 894 "./parse.y"
3133 #line 896 "./parse.y"
3134 {yyerror ("Identifier expected"); RECOVER
;;
3137 #line 898 "./parse.y"
3138 {yyerror ("Identifier expected"); RECOVER
;;
3141 #line 900 "./parse.y"
3143 yyerror ("Invalid method declaration, return type required");
3148 #line 908 "./parse.y"
3149 { yyval
.node
= method_declarator (yyvsp
[-2].node
, NULL_TREE
); ;
3152 #line 910 "./parse.y"
3153 { yyval
.node
= method_declarator (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
3156 #line 912 "./parse.y"
3158 EXPR_WFL_LINECOL (wfl_operator
) = yyvsp
[-1].operator.location
;
3159 TREE_PURPOSE (yyvsp
[-2].node
) =
3160 build_unresolved_array_type (TREE_PURPOSE (yyvsp
[-2].node
));
3161 parse_warning_context
3163 "Discouraged form of returned type specification");
3167 #line 921 "./parse.y"
3168 {yyerror ("')' expected"); DRECOVER(method_declarator
);;
3171 #line 923 "./parse.y"
3172 {yyerror ("']' expected"); RECOVER
;;
3175 #line 928 "./parse.y"
3177 ctxp
->formal_parameter_number
= 1;
3181 #line 932 "./parse.y"
3183 ctxp
->formal_parameter_number
+= 1;
3184 yyval
.node
= chainon (yyvsp
[-2].node
, yyvsp
[0].node
);
3188 #line 937 "./parse.y"
3189 {yyerror ("Missing formal parameter term"); RECOVER
;;
3192 #line 942 "./parse.y"
3194 yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[-1].node
);
3198 #line 946 "./parse.y"
3200 parse_jdk1_1_error ("final parameters");
3201 yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[-1].node
);
3205 #line 951 "./parse.y"
3206 {yyerror ("Missing identifier"); RECOVER
;;
3209 #line 953 "./parse.y"
3211 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp
[-2].value
));
3212 yyerror ("Missing identifier"); RECOVER
;
3216 #line 960 "./parse.y"
3217 { yyval
.node
= NULL_TREE
; ;
3220 #line 962 "./parse.y"
3221 { yyval
.node
= yyvsp
[0].node
; ;
3224 #line 964 "./parse.y"
3225 {yyerror ("Missing class type term"); RECOVER
;;
3228 #line 969 "./parse.y"
3229 { yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[0].node
); ;
3232 #line 971 "./parse.y"
3233 { yyval
.node
= tree_cons (yyvsp
[0].node
, yyvsp
[0].node
, yyvsp
[-2].node
); ;
3236 #line 973 "./parse.y"
3237 {yyerror ("Missing class type term"); RECOVER
;;
3240 #line 980 "./parse.y"
3241 { yyval
.node
= NULL_TREE
; ;
3244 #line 986 "./parse.y"
3246 TREE_CHAIN (yyvsp
[0].node
) = ctxp
->static_initialized
;
3247 ctxp
->static_initialized
= yyvsp
[0].node
;
3251 #line 991 "./parse.y"
3253 TREE_CHAIN (yyvsp
[-1].node
) = ctxp
->static_initialized
;
3254 ctxp
->static_initialized
= yyvsp
[-1].node
;
3258 #line 999 "./parse.y"
3260 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp
[0].value
));
3264 #line 1007 "./parse.y"
3266 current_function_decl
= yyvsp
[0].node
;
3267 source_start_java_method (current_function_decl
);
3271 #line 1012 "./parse.y"
3272 { finish_method_declaration (yyvsp
[0].node
); ;
3275 #line 1017 "./parse.y"
3276 { yyval
.node
= method_header (0, NULL_TREE
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3279 #line 1019 "./parse.y"
3280 { yyval
.node
= method_header (yyvsp
[-2].value
, NULL_TREE
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3283 #line 1024 "./parse.y"
3284 { yyval
.node
= method_declarator (yyvsp
[-2].node
, NULL_TREE
); ;
3287 #line 1026 "./parse.y"
3288 { yyval
.node
= method_declarator (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
3291 #line 1034 "./parse.y"
3293 BLOCK_EXPR_BODY (yyvsp
[0].node
) = empty_stmt_node
;
3294 yyval
.node
= yyvsp
[0].node
;
3298 #line 1039 "./parse.y"
3299 { yyval
.node
= yyvsp
[0].node
; ;
3302 #line 1041 "./parse.y"
3303 { yyval
.node
= yyvsp
[0].node
; ;
3306 #line 1043 "./parse.y"
3307 { yyval
.node
= yyvsp
[0].node
; ;
3310 #line 1053 "./parse.y"
3312 yyval
.node
= build_method_invocation (yyvsp
[-3].node
, NULL_TREE
);
3313 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-3].node
), yyval
.node
);
3314 yyval
.node
= java_method_add_stmt (current_function_decl
, yyval
.node
);
3318 #line 1059 "./parse.y"
3320 yyval
.node
= build_method_invocation (yyvsp
[-4].node
, yyvsp
[-2].node
);
3321 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyval
.node
);
3322 yyval
.node
= java_method_add_stmt (current_function_decl
, yyval
.node
);
3326 #line 1067 "./parse.y"
3327 {yyval
.node
= parse_jdk1_1_error ("explicit constructor invocation"); ;
3330 #line 1069 "./parse.y"
3331 {yyval
.node
= parse_jdk1_1_error ("explicit constructor invocation"); ;
3334 #line 1074 "./parse.y"
3336 tree wfl
= build_wfl_node (this_identifier_node
);
3337 EXPR_WFL_LINECOL (wfl
) = yyvsp
[0].operator.location
;
3342 #line 1080 "./parse.y"
3344 tree wfl
= build_wfl_node (super_identifier_node
);
3345 EXPR_WFL_LINECOL (wfl
) = yyvsp
[0].operator.location
;
3350 #line 1091 "./parse.y"
3351 { create_interface (0, yyvsp
[0].node
, NULL_TREE
); ;
3354 #line 1093 "./parse.y"
3356 yyval
.node
= yyvsp
[0].node
;
3360 #line 1097 "./parse.y"
3361 { create_interface (yyvsp
[-2].value
, yyvsp
[0].node
, NULL_TREE
); ;
3364 #line 1099 "./parse.y"
3366 yyval
.node
= yyvsp
[0].node
;
3370 #line 1103 "./parse.y"
3371 { create_interface (0, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3374 #line 1105 "./parse.y"
3376 yyval
.node
= yyvsp
[0].node
;
3380 #line 1109 "./parse.y"
3381 { create_interface (yyvsp
[-3].value
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3384 #line 1111 "./parse.y"
3386 yyval
.node
= yyvsp
[0].node
;
3390 #line 1115 "./parse.y"
3391 {yyerror ("'{' expected"); RECOVER
;;
3394 #line 1117 "./parse.y"
3395 {yyerror ("'{' expected"); RECOVER
;;
3398 #line 1122 "./parse.y"
3400 ctxp
->interface_number
= 1;
3401 yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
);
3405 #line 1127 "./parse.y"
3407 ctxp
->interface_number
++;
3408 yyval
.node
= chainon (yyvsp
[-2].node
, build_tree_list (yyvsp
[0].node
, NULL_TREE
));
3412 #line 1132 "./parse.y"
3413 {yyerror ("Invalid interface type"); RECOVER
;;
3416 #line 1134 "./parse.y"
3417 {yyerror ("Missing term"); RECOVER
;;
3420 #line 1139 "./parse.y"
3421 { yyval
.node
= NULL_TREE
; ;
3424 #line 1141 "./parse.y"
3425 { yyval
.node
= NULL_TREE
; ;
3428 #line 1153 "./parse.y"
3429 { yyval
.node
= parse_jdk1_1_error ("inner class declaration"); ;
3432 #line 1155 "./parse.y"
3433 { yyval
.node
= parse_jdk1_1_error ("inner interface declaration"); ;
3436 #line 1164 "./parse.y"
3438 check_abstract_method_header (yyvsp
[-1].node
);
3439 current_function_decl
= NULL_TREE
; /* FIXME ? */
3443 #line 1169 "./parse.y"
3444 {yyerror ("';' expected"); RECOVER
;;
3447 #line 1175 "./parse.y"
3448 { yyval
.node
= build_new_array_init (yyvsp
[-1].operator.location
, NULL_TREE
); ;
3451 #line 1177 "./parse.y"
3452 { yyval
.node
= build_new_array_init (yyvsp
[-2].operator.location
, yyvsp
[-1].node
); ;
3455 #line 1179 "./parse.y"
3456 { yyval
.node
= build_new_array_init (yyvsp
[-3].operator.location
, yyvsp
[-2].node
); ;
3459 #line 1184 "./parse.y"
3461 yyval
.node
= tree_cons (maybe_build_array_element_wfl (yyvsp
[0].node
),
3462 yyvsp
[0].node
, NULL_TREE
);
3466 #line 1189 "./parse.y"
3468 yyval
.node
= tree_cons (maybe_build_array_element_wfl (yyvsp
[0].node
), yyvsp
[0].node
, yyvsp
[-2].node
);
3472 #line 1193 "./parse.y"
3473 {yyerror ("Missing term"); RECOVER
;;
3476 #line 1199 "./parse.y"
3478 /* Store the location of the `}' when doing xrefs */
3479 if (current_function_decl
&& flag_emit_xref
)
3480 DECL_END_SOURCE_LINE (current_function_decl
) =
3481 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3482 yyval
.node
= empty_stmt_node
;
3486 #line 1207 "./parse.y"
3487 { yyval
.node
= yyvsp
[0].node
; ;
3490 #line 1212 "./parse.y"
3494 #line 1217 "./parse.y"
3496 maybe_absorb_scoping_blocks ();
3497 /* Store the location of the `}' when doing xrefs */
3498 if (current_function_decl
&& flag_emit_xref
)
3499 DECL_END_SOURCE_LINE (current_function_decl
) =
3500 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3501 yyval
.node
= exit_block ();
3505 #line 1235 "./parse.y"
3506 { java_method_add_stmt (current_function_decl
, yyvsp
[0].node
); ;
3509 #line 1237 "./parse.y"
3510 { parse_jdk1_1_error ("inner class declaration"); ;
3513 #line 1246 "./parse.y"
3514 { declare_local_variables (0, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3517 #line 1248 "./parse.y"
3518 { declare_local_variables (yyvsp
[-2].value
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3521 #line 1258 "./parse.y"
3522 { yyval
.node
= exit_block (); ;
3525 #line 1267 "./parse.y"
3526 { yyval
.node
= exit_block (); ;
3529 #line 1286 "./parse.y"
3530 { yyval
.node
= empty_stmt_node
; ;
3533 #line 1291 "./parse.y"
3535 yyval
.node
= build_labeled_block (EXPR_WFL_LINECOL (yyvsp
[-1].node
),
3536 EXPR_WFL_NODE (yyvsp
[-1].node
));
3538 push_labeled_block (yyval
.node
);
3539 PUSH_LABELED_BLOCK (yyval
.node
);
3543 #line 1302 "./parse.y"
3544 { yyval
.node
= finish_labeled_statement (yyvsp
[-1].node
, yyvsp
[0].node
); ;
3547 #line 1304 "./parse.y"
3548 {yyerror ("':' expected"); RECOVER
;;
3551 #line 1309 "./parse.y"
3552 { yyval
.node
= finish_labeled_statement (yyvsp
[-1].node
, yyvsp
[0].node
); ;
3555 #line 1316 "./parse.y"
3557 /* We have a statement. Generate a WFL around it so
3559 yyval
.node
= build_expr_wfl (yyvsp
[-1].node
, input_filename
, lineno
, 0);
3560 /* We know we have a statement, so set the debug
3561 info to be eventually generate here. */
3562 yyval
.node
= JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval
.node
);
3566 #line 1325 "./parse.y"
3568 if (ctxp
->prevent_ese
!= lineno
)
3569 yyerror ("Invalid expression statement");
3570 DRECOVER (expr_stmt
);
3574 #line 1331 "./parse.y"
3576 if (ctxp
->prevent_ese
!= lineno
)
3577 yyerror ("Invalid expression statement");
3578 DRECOVER (expr_stmt
);
3582 #line 1337 "./parse.y"
3584 if (ctxp
->prevent_ese
!= lineno
)
3585 yyerror ("Invalid expression statement");
3586 DRECOVER (expr_stmt
);
3590 #line 1343 "./parse.y"
3591 {yyerror ("')' expected"); RECOVER
;;
3594 #line 1345 "./parse.y"
3596 yyerror ("Constructor invocation must be first "
3597 "thing in a constructor");
3602 #line 1351 "./parse.y"
3603 {yyerror ("')' expected"); RECOVER
;;
3606 #line 1353 "./parse.y"
3608 yyerror ("Constructor invocation must be first "
3609 "thing in a constructor");
3614 #line 1359 "./parse.y"
3615 {yyerror ("'(' expected"); RECOVER
;;
3618 #line 1361 "./parse.y"
3619 {yyerror ("')' expected"); RECOVER
;;
3622 #line 1363 "./parse.y"
3623 {yyerror ("')' expected"); RECOVER
;;
3626 #line 1365 "./parse.y"
3627 {yyerror ("';' expected"); RECOVER
;;
3630 #line 1367 "./parse.y"
3631 {yyerror ("';' expected"); RECOVER
;;
3634 #line 1382 "./parse.y"
3636 yyval
.node
= build_if_else_statement (yyvsp
[-3].operator.location
, yyvsp
[-2].node
,
3637 yyvsp
[0].node
, NULL_TREE
);
3641 #line 1387 "./parse.y"
3642 {yyerror ("'(' expected"); RECOVER
;;
3645 #line 1389 "./parse.y"
3646 {yyerror ("Missing term"); RECOVER
;;
3649 #line 1391 "./parse.y"
3650 {yyerror ("')' expected"); RECOVER
;;
3653 #line 1396 "./parse.y"
3654 { yyval
.node
= build_if_else_statement (yyvsp
[-5].operator.location
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3657 #line 1401 "./parse.y"
3658 { yyval
.node
= build_if_else_statement (yyvsp
[-5].operator.location
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3661 #line 1406 "./parse.y"
3667 #line 1410 "./parse.y"
3669 /* Make into "proper list" of COMPOUND_EXPRs.
3670 I.e. make the last statment also have its own
3672 maybe_absorb_scoping_blocks ();
3673 TREE_OPERAND (yyvsp
[-2].node
, 1) = exit_block ();
3674 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-2].node
), yyvsp
[-2].node
);
3678 #line 1422 "./parse.y"
3680 yyval
.node
= build (SWITCH_EXPR
, NULL_TREE
, yyvsp
[-1].node
, NULL_TREE
);
3681 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-2].operator.location
;
3685 #line 1427 "./parse.y"
3686 {yyerror ("'(' expected"); RECOVER
;;
3689 #line 1429 "./parse.y"
3690 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement
);;
3693 #line 1431 "./parse.y"
3694 {yyerror ("'{' expected"); RECOVER
;;
3697 #line 1439 "./parse.y"
3698 { yyval
.node
= NULL_TREE
; ;
3701 #line 1441 "./parse.y"
3702 { yyval
.node
= NULL_TREE
; ;
3705 #line 1443 "./parse.y"
3706 { yyval
.node
= NULL_TREE
; ;
3709 #line 1445 "./parse.y"
3710 { yyval
.node
= NULL_TREE
; ;
3713 #line 1464 "./parse.y"
3715 tree lab
= build1 (CASE_EXPR
, NULL_TREE
, yyvsp
[-1].node
);
3716 EXPR_WFL_LINECOL (lab
) = yyvsp
[-2].operator.location
;
3717 java_method_add_stmt (current_function_decl
, lab
);
3721 #line 1470 "./parse.y"
3723 tree lab
= build1 (DEFAULT_EXPR
, NULL_TREE
, NULL_TREE
);
3724 EXPR_WFL_LINECOL (lab
) = yyvsp
[-1].operator.location
;
3725 java_method_add_stmt (current_function_decl
, lab
);
3729 #line 1476 "./parse.y"
3730 {yyerror ("Missing or invalid constant expression"); RECOVER
;;
3733 #line 1478 "./parse.y"
3734 {yyerror ("':' expected"); RECOVER
;;
3737 #line 1480 "./parse.y"
3738 {yyerror ("':' expected"); RECOVER
;;
3741 #line 1485 "./parse.y"
3743 tree body
= build_loop_body (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, 0);
3744 yyval
.node
= build_new_loop (body
);
3748 #line 1493 "./parse.y"
3749 { yyval
.node
= finish_loop_body (0, NULL_TREE
, yyvsp
[0].node
, 0); ;
3752 #line 1495 "./parse.y"
3753 {YYERROR_NOW
; yyerror ("'(' expected"); RECOVER
;;
3756 #line 1497 "./parse.y"
3757 {yyerror ("Missing term and ')' expected"); RECOVER
;;
3760 #line 1499 "./parse.y"
3761 {yyerror ("')' expected"); RECOVER
;;
3764 #line 1504 "./parse.y"
3765 { yyval
.node
= finish_loop_body (0, NULL_TREE
, yyvsp
[0].node
, 0); ;
3768 #line 1509 "./parse.y"
3770 tree body
= build_loop_body (0, NULL_TREE
, 1);
3771 yyval
.node
= build_new_loop (body
);
3775 #line 1518 "./parse.y"
3776 { yyval
.node
= finish_loop_body (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[-5].node
, 1); ;
3779 #line 1523 "./parse.y"
3780 { yyval
.node
= finish_for_loop (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3783 #line 1525 "./parse.y"
3785 yyval
.node
= finish_for_loop (0, NULL_TREE
, yyvsp
[-2].node
, yyvsp
[0].node
);
3786 /* We have not condition, so we get rid of the EXIT_EXPR */
3787 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval
.node
), 0) =
3792 #line 1532 "./parse.y"
3793 {yyerror ("Invalid control expression"); RECOVER
;;
3796 #line 1534 "./parse.y"
3797 {yyerror ("Invalid update expression"); RECOVER
;;
3800 #line 1536 "./parse.y"
3801 {yyerror ("Invalid update expression"); RECOVER
;;
3804 #line 1541 "./parse.y"
3805 { yyval
.node
= finish_for_loop (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
);;
3808 #line 1543 "./parse.y"
3810 yyval
.node
= finish_for_loop (0, NULL_TREE
, yyvsp
[-2].node
, yyvsp
[0].node
);
3811 /* We have not condition, so we get rid of the EXIT_EXPR */
3812 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval
.node
), 0) =
3817 #line 1553 "./parse.y"
3819 /* This scope defined for local variable that may be
3820 defined within the scope of the for loop */
3825 #line 1559 "./parse.y"
3826 {yyerror ("'(' expected"); DRECOVER(for_1
);;
3829 #line 1561 "./parse.y"
3830 {yyerror ("Invalid init statement"); RECOVER
;;
3833 #line 1566 "./parse.y"
3835 /* We now declare the loop body. The loop is
3836 declared as a for loop. */
3837 tree body
= build_loop_body (0, NULL_TREE
, 0);
3838 yyval
.node
= build_new_loop (body
);
3839 IS_FOR_LOOP_P (yyval
.node
) = 1;
3840 /* The loop is added to the current block the for
3841 statement is defined within */
3842 java_method_add_stmt (current_function_decl
, yyval
.node
);
3846 #line 1578 "./parse.y"
3847 { yyval
.node
= empty_stmt_node
; ;
3850 #line 1580 "./parse.y"
3852 /* Init statement recorded within the previously
3853 defined block scope */
3854 yyval
.node
= java_method_add_stmt (current_function_decl
, yyvsp
[0].node
);
3858 #line 1586 "./parse.y"
3860 /* Local variable are recorded within the previously
3861 defined block scope */
3862 yyval
.node
= NULL_TREE
;
3866 #line 1592 "./parse.y"
3867 {yyerror ("';' expected"); DRECOVER(for_init_1
);;
3870 #line 1596 "./parse.y"
3871 {yyval
.node
= empty_stmt_node
;;
3874 #line 1598 "./parse.y"
3875 { yyval
.node
= build_debugable_stmt (BUILD_LOCATION (), yyvsp
[0].node
); ;
3878 #line 1603 "./parse.y"
3879 { yyval
.node
= add_stmt_to_compound (NULL_TREE
, NULL_TREE
, yyvsp
[0].node
); ;
3882 #line 1605 "./parse.y"
3883 { yyval
.node
= add_stmt_to_compound (yyvsp
[-2].node
, NULL_TREE
, yyvsp
[0].node
); ;
3886 #line 1607 "./parse.y"
3887 {yyerror ("Missing term"); RECOVER
;;
3890 #line 1612 "./parse.y"
3891 { yyval
.node
= build_bc_statement (yyvsp
[-1].operator.location
, 1, NULL_TREE
); ;
3894 #line 1614 "./parse.y"
3895 { yyval
.node
= build_bc_statement (yyvsp
[-2].operator.location
, 1, yyvsp
[-1].node
); ;
3898 #line 1616 "./parse.y"
3899 {yyerror ("Missing term"); RECOVER
;;
3902 #line 1618 "./parse.y"
3903 {yyerror ("';' expected"); RECOVER
;;
3906 #line 1623 "./parse.y"
3907 { yyval
.node
= build_bc_statement (yyvsp
[-1].operator.location
, 0, NULL_TREE
); ;
3910 #line 1625 "./parse.y"
3911 { yyval
.node
= build_bc_statement (yyvsp
[-2].operator.location
, 0, yyvsp
[-1].node
); ;
3914 #line 1627 "./parse.y"
3915 {yyerror ("Missing term"); RECOVER
;;
3918 #line 1629 "./parse.y"
3919 {yyerror ("';' expected"); RECOVER
;;
3922 #line 1634 "./parse.y"
3923 { yyval
.node
= build_return (yyvsp
[-1].operator.location
, NULL_TREE
); ;
3926 #line 1636 "./parse.y"
3927 { yyval
.node
= build_return (yyvsp
[-2].operator.location
, yyvsp
[-1].node
); ;
3930 #line 1638 "./parse.y"
3931 {yyerror ("Missing term"); RECOVER
;;
3934 #line 1640 "./parse.y"
3935 {yyerror ("';' expected"); RECOVER
;;
3938 #line 1645 "./parse.y"
3940 yyval
.node
= build1 (THROW_EXPR
, NULL_TREE
, yyvsp
[-1].node
);
3941 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-2].operator.location
;
3945 #line 1650 "./parse.y"
3946 {yyerror ("Missing term"); RECOVER
;;
3949 #line 1652 "./parse.y"
3950 {yyerror ("';' expected"); RECOVER
;;
3953 #line 1657 "./parse.y"
3955 yyval
.node
= build (SYNCHRONIZED_EXPR
, NULL_TREE
, yyvsp
[-2].node
, yyvsp
[0].node
);
3956 EXPR_WFL_LINECOL (yyval
.node
) =
3957 EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK
));
3961 #line 1663 "./parse.y"
3962 {yyerror ("'{' expected"); RECOVER
;;
3965 #line 1665 "./parse.y"
3966 {yyerror ("'(' expected"); RECOVER
;;
3969 #line 1667 "./parse.y"
3970 {yyerror ("Missing term"); RECOVER
;;
3973 #line 1669 "./parse.y"
3974 {yyerror ("Missing term"); RECOVER
;;
3977 #line 1674 "./parse.y"
3979 if ((1 << yyvsp
[0].value
) != ACC_SYNCHRONIZED
)
3980 fatal ("synchronized was '%d' - yyparse", (1 << yyvsp
[0].value
));
3984 #line 1682 "./parse.y"
3985 { yyval
.node
= build_try_statement (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3988 #line 1684 "./parse.y"
3989 { yyval
.node
= build_try_finally_statement (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3992 #line 1686 "./parse.y"
3993 { yyval
.node
= build_try_finally_statement
3994 (yyvsp
[-3].operator.location
, build_try_statement (yyvsp
[-3].operator.location
,
3995 yyvsp
[-2].node
, yyvsp
[-1].node
), yyvsp
[0].node
);
3999 #line 1691 "./parse.y"
4000 {yyerror ("'{' expected"); DRECOVER (try_statement
);;
4003 #line 1697 "./parse.y"
4005 TREE_CHAIN (yyvsp
[0].node
) = yyvsp
[-1].node
;
4006 yyval
.node
= yyvsp
[0].node
;
4010 #line 1705 "./parse.y"
4012 java_method_add_stmt (current_function_decl
, yyvsp
[0].node
);
4014 yyval
.node
= yyvsp
[-1].node
;
4018 #line 1713 "./parse.y"
4020 /* We add a block to define a scope for
4021 formal_parameter (CCBP). The formal parameter is
4022 declared initialized by the appropriate function
4024 tree ccpb
= enter_block ();
4025 tree init
= build_assignment (ASSIGN_TK
, yyvsp
[-2].operator.location
,
4026 TREE_PURPOSE (yyvsp
[-1].node
),
4027 soft_exceptioninfo_call_node
);
4028 declare_local_variables (0, TREE_VALUE (yyvsp
[-1].node
),
4029 build_tree_list (TREE_PURPOSE (yyvsp
[-1].node
),
4031 yyval
.node
= build1 (CATCH_EXPR
, NULL_TREE
, ccpb
);
4032 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-3].operator.location
;
4036 #line 1729 "./parse.y"
4037 {yyerror ("'(' expected"); RECOVER
;;
4040 #line 1731 "./parse.y"
4041 {yyerror ("Missing term or ')' expected"); DRECOVER (2);;
4044 #line 1733 "./parse.y"
4045 {yyerror ("')' expected"); DRECOVER (1);;
4048 #line 1738 "./parse.y"
4049 { yyval
.node
= yyvsp
[0].node
; ;
4052 #line 1740 "./parse.y"
4053 {yyerror ("'{' expected"); RECOVER
; ;
4056 #line 1752 "./parse.y"
4057 { yyval
.node
= build_this (yyvsp
[0].operator.location
); ;
4060 #line 1754 "./parse.y"
4061 {yyval
.node
= yyvsp
[-1].node
;;
4064 #line 1763 "./parse.y"
4065 { yyval
.node
= parse_jdk1_1_error ("named class literals"); ;
4068 #line 1765 "./parse.y"
4069 { yyval
.node
= build_class_ref (yyvsp
[-2].node
); ;
4072 #line 1767 "./parse.y"
4073 { yyval
.node
= build_class_ref (void_type_node
); ;
4076 #line 1772 "./parse.y"
4077 { yyval
.node
= parse_jdk1_1_error ("class literals"); ;
4080 #line 1774 "./parse.y"
4081 {yyerror ("')' expected"); RECOVER
;;
4084 #line 1776 "./parse.y"
4085 {yyerror ("'class' or 'this' expected" ); RECOVER
;;
4088 #line 1778 "./parse.y"
4089 {yyerror ("'class' expected" ); RECOVER
;;
4092 #line 1780 "./parse.y"
4093 {yyerror ("'class' expected" ); RECOVER
;;
4096 #line 1785 "./parse.y"
4097 { yyval
.node
= build_new_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4100 #line 1787 "./parse.y"
4101 { yyval
.node
= build_new_invocation (yyvsp
[-2].node
, NULL_TREE
); ;
4104 #line 1792 "./parse.y"
4105 { yyval
.node
= parse_jdk1_1_error ("inner class instance creation"); ;
4108 #line 1794 "./parse.y"
4109 { yyval
.node
= parse_jdk1_1_error ("inner class instance creation"); ;
4112 #line 1803 "./parse.y"
4113 {yyerror ("'(' expected"); DRECOVER(new_1
);;
4116 #line 1805 "./parse.y"
4117 {yyerror ("'(' expected"); RECOVER
;;
4120 #line 1807 "./parse.y"
4121 {yyerror ("')' or term expected"); RECOVER
;;
4124 #line 1809 "./parse.y"
4125 {yyerror ("')' expected"); RECOVER
;;
4128 #line 1811 "./parse.y"
4129 {YYERROR_NOW
; yyerror ("Identifier expected"); RECOVER
;;
4132 #line 1813 "./parse.y"
4133 {yyerror ("'(' expected"); RECOVER
;;
4136 #line 1823 "./parse.y"
4138 yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, NULL_TREE
);
4139 ctxp
->formal_parameter_number
= 1;
4143 #line 1828 "./parse.y"
4145 ctxp
->formal_parameter_number
+= 1;
4146 yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, yyvsp
[-2].node
);
4150 #line 1833 "./parse.y"
4151 {yyerror ("Missing term"); RECOVER
;;
4154 #line 1838 "./parse.y"
4155 { yyval
.node
= build_newarray_node (yyvsp
[-1].node
, yyvsp
[0].node
, 0); ;
4158 #line 1840 "./parse.y"
4159 { yyval
.node
= build_newarray_node (yyvsp
[-1].node
, yyvsp
[0].node
, 0); ;
4162 #line 1842 "./parse.y"
4163 { yyval
.node
= build_newarray_node (yyvsp
[-2].node
, yyvsp
[-1].node
, CURRENT_OSB (ctxp
));;
4166 #line 1844 "./parse.y"
4167 { yyval
.node
= build_newarray_node (yyvsp
[-2].node
, yyvsp
[-1].node
, CURRENT_OSB (ctxp
));;
4170 #line 1848 "./parse.y"
4171 { yyval
.node
= parse_jdk1_1_error ("anonymous array"); ;
4174 #line 1850 "./parse.y"
4175 { yyval
.node
= parse_jdk1_1_error ("anonymous array"); ;
4178 #line 1852 "./parse.y"
4179 {yyerror ("'[' expected"); DRECOVER ("]");;
4182 #line 1854 "./parse.y"
4183 {yyerror ("']' expected"); RECOVER
;;
4186 #line 1859 "./parse.y"
4187 { yyval
.node
= build_tree_list (NULL_TREE
, yyvsp
[0].node
); ;
4190 #line 1861 "./parse.y"
4191 { yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, yyval
.node
); ;
4194 #line 1866 "./parse.y"
4196 EXPR_WFL_LINECOL (yyvsp
[-1].node
) = yyvsp
[-2].operator.location
;
4197 yyval
.node
= yyvsp
[-1].node
;
4201 #line 1871 "./parse.y"
4202 {yyerror ("']' expected"); RECOVER
;;
4205 #line 1873 "./parse.y"
4207 yyerror ("Missing term");
4208 yyerror ("']' expected");
4213 #line 1882 "./parse.y"
4216 /* If not initialized, allocate memory for the osb
4218 if (!ctxp
->osb_limit
)
4220 allocate
= ctxp
->osb_limit
= 32;
4221 ctxp
->osb_depth
= -1;
4223 /* If capacity overflown, reallocate a bigger chuck */
4224 else if (ctxp
->osb_depth
+1 == ctxp
->osb_limit
)
4225 allocate
= ctxp
->osb_limit
<< 1;
4229 allocate
*= sizeof (int);
4230 if (ctxp
->osb_number
)
4231 ctxp
->osb_number
= (int *)xrealloc (ctxp
->osb_number
,
4234 ctxp
->osb_number
= (int *)xmalloc (allocate
);
4237 CURRENT_OSB (ctxp
) = 1;
4241 #line 1908 "./parse.y"
4242 { CURRENT_OSB (ctxp
)++; ;
4245 #line 1910 "./parse.y"
4246 { yyerror ("']' expected"); RECOVER
;;
4249 #line 1915 "./parse.y"
4250 { yyval
.node
= make_qualified_primary (yyvsp
[-2].node
, yyvsp
[0].node
, yyvsp
[-1].operator.location
); ;
4253 #line 1919 "./parse.y"
4256 build_wfl_node (super_identifier_node
);
4257 EXPR_WFL_LINECOL (super_wfl
) = yyvsp
[-2].operator.location
;
4258 yyval
.node
= make_qualified_name (super_wfl
, yyvsp
[0].node
, yyvsp
[-1].operator.location
);
4262 #line 1926 "./parse.y"
4263 {yyerror ("Field expected"); DRECOVER (super_field_acces
);;
4266 #line 1931 "./parse.y"
4267 { yyval
.node
= build_method_invocation (yyvsp
[-2].node
, NULL_TREE
); ;
4270 #line 1933 "./parse.y"
4271 { yyval
.node
= build_method_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4274 #line 1935 "./parse.y"
4276 if (TREE_CODE (yyvsp
[-4].node
) == THIS_EXPR
)
4277 yyval
.node
= build_this_super_qualified_invocation
4278 (1, yyvsp
[-2].node
, NULL_TREE
, 0, yyvsp
[-3].operator.location
);
4281 tree invok
= build_method_invocation (yyvsp
[-2].node
, NULL_TREE
);
4282 yyval
.node
= make_qualified_primary (yyvsp
[-4].node
, invok
, yyvsp
[-3].operator.location
);
4287 #line 1946 "./parse.y"
4289 if (TREE_CODE (yyvsp
[-5].node
) == THIS_EXPR
)
4290 yyval
.node
= build_this_super_qualified_invocation
4291 (1, yyvsp
[-3].node
, yyvsp
[-1].node
, 0, yyvsp
[-4].operator.location
);
4294 tree invok
= build_method_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
);
4295 yyval
.node
= make_qualified_primary (yyvsp
[-5].node
, invok
, yyvsp
[-4].operator.location
);
4300 #line 1957 "./parse.y"
4302 yyval
.node
= build_this_super_qualified_invocation
4303 (0, yyvsp
[-2].node
, NULL_TREE
, yyvsp
[-4].operator.location
, yyvsp
[-3].operator.location
);
4307 #line 1962 "./parse.y"
4309 yyval
.node
= build_this_super_qualified_invocation
4310 (0, yyvsp
[-3].node
, yyvsp
[-1].node
, yyvsp
[-5].operator.location
, yyvsp
[-4].operator.location
);
4314 #line 1971 "./parse.y"
4315 { yyerror ("'(' expected"); DRECOVER (method_invocation
); ;
4318 #line 1973 "./parse.y"
4319 { yyerror ("'(' expected"); DRECOVER (method_invocation
); ;
4322 #line 1978 "./parse.y"
4323 { yyval
.node
= build_array_ref (yyvsp
[-2].operator.location
, yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4326 #line 1980 "./parse.y"
4327 { yyval
.node
= build_array_ref (yyvsp
[-2].operator.location
, yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4330 #line 1982 "./parse.y"
4332 yyerror ("Missing term and ']' expected");
4333 DRECOVER(array_access
);
4337 #line 1987 "./parse.y"
4339 yyerror ("']' expected");
4340 DRECOVER(array_access
);
4344 #line 1992 "./parse.y"
4346 yyerror ("Missing term and ']' expected");
4347 DRECOVER(array_access
);
4351 #line 1997 "./parse.y"
4353 yyerror ("']' expected");
4354 DRECOVER(array_access
);
4358 #line 2012 "./parse.y"
4359 { yyval
.node
= build_incdec (yyvsp
[0].operator.token
, yyvsp
[0].operator.location
, yyvsp
[-1].node
, 1); ;
4362 #line 2017 "./parse.y"
4363 { yyval
.node
= build_incdec (yyvsp
[0].operator.token
, yyvsp
[0].operator.location
, yyvsp
[-1].node
, 1); ;
4366 #line 2024 "./parse.y"
4367 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4370 #line 2026 "./parse.y"
4371 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4374 #line 2029 "./parse.y"
4375 {yyerror ("Missing term"); RECOVER
;
4378 #line 2031 "./parse.y"
4379 {yyerror ("Missing term"); RECOVER
;
4382 #line 2036 "./parse.y"
4383 {yyval
.node
= build_incdec (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
, 0); ;
4386 #line 2038 "./parse.y"
4387 {yyerror ("Missing term"); RECOVER
;
4390 #line 2043 "./parse.y"
4391 {yyval
.node
= build_incdec (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
, 0); ;
4394 #line 2045 "./parse.y"
4395 {yyerror ("Missing term"); RECOVER
;
4398 #line 2051 "./parse.y"
4399 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4402 #line 2053 "./parse.y"
4403 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4406 #line 2056 "./parse.y"
4407 {yyerror ("Missing term"); RECOVER
;
4410 #line 2058 "./parse.y"
4411 {yyerror ("Missing term"); RECOVER
;
4414 #line 2063 "./parse.y"
4416 tree type
= yyvsp
[-3].node
;
4417 while (CURRENT_OSB (ctxp
)--)
4418 type
= build_java_array_type (type
, -1);
4420 yyval
.node
= build_cast (yyvsp
[-4].operator.location
, type
, yyvsp
[0].node
);
4424 #line 2071 "./parse.y"
4425 { yyval
.node
= build_cast (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4428 #line 2073 "./parse.y"
4429 { yyval
.node
= build_cast (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4432 #line 2075 "./parse.y"
4435 while (CURRENT_OSB (ctxp
)--)
4436 obstack_1grow (&temporary_obstack
, '[');
4438 obstack_grow0 (&temporary_obstack
,
4439 IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp
[-3].node
)),
4440 IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp
[-3].node
)));
4441 ptr
= obstack_finish (&temporary_obstack
);
4442 EXPR_WFL_NODE (yyvsp
[-3].node
) = get_identifier (ptr
);
4443 yyval
.node
= build_cast (yyvsp
[-4].operator.location
, yyvsp
[-3].node
, yyvsp
[0].node
);
4447 #line 2088 "./parse.y"
4448 {yyerror ("']' expected, invalid type expression");;
4451 #line 2090 "./parse.y"
4453 if (ctxp
->prevent_ese
!= lineno
)
4454 yyerror ("Invalid type expression"); RECOVER
;
4459 #line 2096 "./parse.y"
4460 {yyerror ("Missing term"); RECOVER
;;
4463 #line 2098 "./parse.y"
4464 {yyerror ("Missing term"); RECOVER
;;
4467 #line 2100 "./parse.y"
4468 {yyerror ("Missing term"); RECOVER
;;
4471 #line 2106 "./parse.y"
4473 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
),
4474 yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
);
4478 #line 2111 "./parse.y"
4480 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4481 yyvsp
[-2].node
, yyvsp
[0].node
);
4485 #line 2116 "./parse.y"
4487 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4488 yyvsp
[-2].node
, yyvsp
[0].node
);
4492 #line 2121 "./parse.y"
4493 {yyerror ("Missing term"); RECOVER
;;
4496 #line 2123 "./parse.y"
4497 {yyerror ("Missing term"); RECOVER
;;
4500 #line 2125 "./parse.y"
4501 {yyerror ("Missing term"); RECOVER
;;
4504 #line 2131 "./parse.y"
4506 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4507 yyvsp
[-2].node
, yyvsp
[0].node
);
4511 #line 2136 "./parse.y"
4513 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4514 yyvsp
[-2].node
, yyvsp
[0].node
);
4518 #line 2141 "./parse.y"
4519 {yyerror ("Missing term"); RECOVER
;;
4522 #line 2143 "./parse.y"
4523 {yyerror ("Missing term"); RECOVER
;;
4526 #line 2149 "./parse.y"
4528 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4529 yyvsp
[-2].node
, yyvsp
[0].node
);
4533 #line 2154 "./parse.y"
4535 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4536 yyvsp
[-2].node
, yyvsp
[0].node
);
4540 #line 2159 "./parse.y"
4542 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4543 yyvsp
[-2].node
, yyvsp
[0].node
);
4547 #line 2164 "./parse.y"
4548 {yyerror ("Missing term"); RECOVER
;;
4551 #line 2166 "./parse.y"
4552 {yyerror ("Missing term"); RECOVER
;;
4555 #line 2168 "./parse.y"
4556 {yyerror ("Missing term"); RECOVER
;;
4559 #line 2174 "./parse.y"
4561 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4562 yyvsp
[-2].node
, yyvsp
[0].node
);
4566 #line 2179 "./parse.y"
4568 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4569 yyvsp
[-2].node
, yyvsp
[0].node
);
4573 #line 2184 "./parse.y"
4575 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4576 yyvsp
[-2].node
, yyvsp
[0].node
);
4580 #line 2189 "./parse.y"
4582 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4583 yyvsp
[-2].node
, yyvsp
[0].node
);
4587 #line 2194 "./parse.y"
4588 { yyval
.node
= build_binop (INSTANCEOF_EXPR
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4591 #line 2196 "./parse.y"
4592 {yyerror ("Missing term"); RECOVER
;;
4595 #line 2198 "./parse.y"
4596 {yyerror ("Missing term"); RECOVER
;;
4599 #line 2200 "./parse.y"
4600 {yyerror ("Missing term"); RECOVER
;;
4603 #line 2202 "./parse.y"
4604 {yyerror ("Missing term"); RECOVER
;;
4607 #line 2204 "./parse.y"
4608 {yyerror ("Invalid reference type"); RECOVER
;;
4611 #line 2210 "./parse.y"
4613 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4614 yyvsp
[-2].node
, yyvsp
[0].node
);
4618 #line 2215 "./parse.y"
4620 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4621 yyvsp
[-2].node
, yyvsp
[0].node
);
4625 #line 2220 "./parse.y"
4626 {yyerror ("Missing term"); RECOVER
;;
4629 #line 2222 "./parse.y"
4630 {yyerror ("Missing term"); RECOVER
;;
4633 #line 2228 "./parse.y"
4635 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4636 yyvsp
[-2].node
, yyvsp
[0].node
);
4640 #line 2233 "./parse.y"
4641 {yyerror ("Missing term"); RECOVER
;;
4644 #line 2239 "./parse.y"
4646 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4647 yyvsp
[-2].node
, yyvsp
[0].node
);
4651 #line 2244 "./parse.y"
4652 {yyerror ("Missing term"); RECOVER
;;
4655 #line 2250 "./parse.y"
4657 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4658 yyvsp
[-2].node
, yyvsp
[0].node
);
4662 #line 2255 "./parse.y"
4663 {yyerror ("Missing term"); RECOVER
;;
4666 #line 2261 "./parse.y"
4668 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4669 yyvsp
[-2].node
, yyvsp
[0].node
);
4673 #line 2266 "./parse.y"
4674 {yyerror ("Missing term"); RECOVER
;;
4677 #line 2272 "./parse.y"
4679 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4680 yyvsp
[-2].node
, yyvsp
[0].node
);
4684 #line 2277 "./parse.y"
4685 {yyerror ("Missing term"); RECOVER
;;
4688 #line 2283 "./parse.y"
4690 yyval
.node
= build (CONDITIONAL_EXPR
, NULL_TREE
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
);
4691 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-3].operator.location
;
4695 #line 2288 "./parse.y"
4698 yyerror ("Missing term");
4703 #line 2294 "./parse.y"
4704 {yyerror ("Missing term"); DRECOVER (2);;
4707 #line 2296 "./parse.y"
4708 {yyerror ("Missing term"); DRECOVER (3);;
4711 #line 2306 "./parse.y"
4712 { yyval
.node
= build_assignment (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4715 #line 2308 "./parse.y"
4717 if (ctxp
->prevent_ese
!= lineno
)
4718 yyerror ("Missing term");
4723 /* the action file gets copied in in place of this dollarsign */
4724 #line 498 "/usr/share/misc/bison.simple"
4735 short *ssp1
= yyss
- 1;
4736 fprintf (stderr
, "state stack now");
4737 while (ssp1
!= yyssp
)
4738 fprintf (stderr
, " %d", *++ssp1
);
4739 fprintf (stderr
, "\n");
4749 yylsp
->first_line
= yylloc
.first_line
;
4750 yylsp
->first_column
= yylloc
.first_column
;
4751 yylsp
->last_line
= (yylsp
-1)->last_line
;
4752 yylsp
->last_column
= (yylsp
-1)->last_column
;
4757 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
4758 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
4762 /* Now "shift" the result of the reduction.
4763 Determine what state that goes to,
4764 based on the state we popped back to
4765 and the rule number reduced by. */
4769 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
4770 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
4771 yystate
= yytable
[yystate
];
4773 yystate
= yydefgoto
[yyn
- YYNTBASE
];
4777 yyerrlab
: /* here on detecting error */
4780 /* If not already recovering from an error, report this error. */
4784 #ifdef YYERROR_VERBOSE
4785 yyn
= yypact
[yystate
];
4787 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
4794 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
4795 for (x
= (yyn
< 0 ? -yyn
: 0);
4796 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
4797 if (yycheck
[x
+ yyn
] == x
)
4798 size
+= strlen(yytname
[x
]) + 15, count
++;
4799 msg
= (char *) malloc(size
+ 15);
4802 strcpy(msg
, "parse error");
4807 for (x
= (yyn
< 0 ? -yyn
: 0);
4808 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
4809 if (yycheck
[x
+ yyn
] == x
)
4811 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
4812 strcat(msg
, yytname
[x
]);
4821 yyerror ("parse error; also virtual memory exceeded");
4824 #endif /* YYERROR_VERBOSE */
4825 yyerror("parse error");
4829 yyerrlab1
: /* here on error raised explicitly by an action */
4831 if (yyerrstatus
== 3)
4833 /* if just tried and failed to reuse lookahead token after an error, discard it. */
4835 /* return failure if at end of input */
4836 if (yychar
== YYEOF
)
4841 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
4847 /* Else will try to reuse lookahead token
4848 after shifting the error token. */
4850 yyerrstatus
= 3; /* Each real token shifted decrements this */
4854 yyerrdefault
: /* current state does not do anything special for the error token. */
4857 /* This is wrong; only states that explicitly want error tokens
4858 should shift them. */
4859 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4860 if (yyn
) goto yydefault
;
4863 yyerrpop
: /* pop the current state because it cannot handle the error token */
4865 if (yyssp
== yyss
) YYABORT
;
4875 short *ssp1
= yyss
- 1;
4876 fprintf (stderr
, "Error: state stack now");
4877 while (ssp1
!= yyssp
)
4878 fprintf (stderr
, " %d", *++ssp1
);
4879 fprintf (stderr
, "\n");
4885 yyn
= yypact
[yystate
];
4890 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
4909 fprintf(stderr
, "Shifting error token, ");
4920 #line 2334 "./parse.y"
4924 /* Flag for the error report routine to issue the error the first time
4925 it's called (overriding the default behavior which is to drop the
4926 first invocation and honor the second one, taking advantage of a
4928 static int force_error
= 0;
4930 /* Create a new parser context and make it the current one. */
4933 java_push_parser_context ()
4935 struct parser_ctxt
*new =
4936 (struct parser_ctxt
*)xmalloc(sizeof (struct parser_ctxt
));
4938 bzero ((PTR
) new, sizeof (struct parser_ctxt
));
4943 ctxp
->incomplete_class
= ctxp
->next
->incomplete_class
;
4944 ctxp
->gclass_list
= ctxp
->next
->gclass_list
;
4948 /* If the first file of a file list was a class file, no context
4949 exists for a source file to be parsed. This boolean remembers that
4950 java_parser_context_save_global might have created a dummy one, so
4951 that java_parser_context_restore_global can pop it. */
4952 static int extra_ctxp_pushed_p
= 0;
4955 java_parser_context_save_global ()
4959 java_push_parser_context ();
4960 extra_ctxp_pushed_p
= 1;
4962 ctxp
->finput
= finput
;
4963 ctxp
->lineno
= lineno
;
4964 ctxp
->current_class
= current_class
;
4965 ctxp
->filename
= input_filename
;
4966 ctxp
->current_function_decl
= current_function_decl
;
4970 java_parser_context_restore_global ()
4972 finput
= ctxp
->finput
;
4973 lineno
= ctxp
->lineno
;
4974 current_class
= ctxp
->current_class
;
4975 input_filename
= ctxp
->filename
;
4976 current_function_decl
= ctxp
->current_function_decl
;
4977 if (!ctxp
->next
&& extra_ctxp_pushed_p
)
4979 java_pop_parser_context (0);
4980 extra_ctxp_pushed_p
= 0;
4985 java_pop_parser_context (generate
)
4989 struct parser_ctxt
*toFree
, *next
;
4998 next
->incomplete_class
= ctxp
->incomplete_class
;
4999 next
->gclass_list
= ctxp
->gclass_list
;
5000 lineno
= ctxp
->lineno
;
5001 finput
= ctxp
->finput
;
5002 current_class
= ctxp
->current_class
;
5005 /* Set the single import class file flag to 0 for the current list
5006 of imported things */
5007 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
5008 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current
)) = 0;
5010 /* And restore those of the previous context */
5011 if ((ctxp
= next
)) /* Assignment is really meant here */
5012 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
5013 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current
)) = 1;
5017 toFree
->next
= ctxp_for_generation
;
5018 ctxp_for_generation
= toFree
;
5024 /* Reporting JDK1.1 features not implemented */
5027 parse_jdk1_1_error (msg
)
5030 sorry (": `%s' JDK1.1(TM) feature", msg
);
5032 return empty_stmt_node
;
5035 static int do_warning
= 0;
5042 static int prev_lineno
;
5043 static const char *prev_msg
;
5046 char *remainder
, *code_from_source
;
5047 extern struct obstack temporary_obstack
;
5049 if (!force_error
&& prev_lineno
== lineno
)
5052 /* Save current error location but report latter, when the context is
5054 if (ctxp
->java_error_flag
== 0)
5056 ctxp
->java_error_flag
= 1;
5058 /* Do something to use the previous line if we're reaching the
5059 end of the file... */
5060 #ifdef VERBOSE_SKELETON
5061 printf ("* Error detected (%s)\n", (msg
? msg
: "(null)"));
5066 /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
5067 if (!force_error
&& msg
== prev_msg
&& prev_lineno
== elc
.line
)
5070 ctxp
->java_error_flag
= 0;
5072 java_warning_count
++;
5076 if (elc
.col
== 0 && msg
[1] == ';')
5078 elc
.col
= ctxp
->p_line
->char_col
-1;
5079 elc
.line
= ctxp
->p_line
->lineno
;
5082 save_lineno
= lineno
;
5083 prev_lineno
= lineno
= elc
.line
;
5086 code_from_source
= java_get_line_col (ctxp
->filename
, elc
.line
, elc
.col
);
5087 obstack_grow0 (&temporary_obstack
,
5088 code_from_source
, strlen (code_from_source
));
5089 remainder
= obstack_finish (&temporary_obstack
);
5091 warning ("%s.\n%s", msg
, remainder
);
5093 error ("%s.\n%s", msg
, remainder
);
5095 /* This allow us to cheaply avoid an extra 'Invalid expression
5096 statement' error report when errors have been already reported on
5097 the same line. This occurs when we report an error but don't have
5098 a synchronization point other than ';', which
5099 expression_statement is the only one to take care of. */
5100 ctxp
->prevent_ese
= lineno
= save_lineno
;
5104 issue_warning_error_from_context (cl
, msg
, ap
)
5109 char *saved
, *saved_input_filename
;
5111 vsprintf (buffer
, msg
, ap
);
5114 ctxp
->elc
.line
= EXPR_WFL_LINENO (cl
);
5115 ctxp
->elc
.col
= (EXPR_WFL_COLNO (cl
) == 0xfff ? -1 :
5116 (EXPR_WFL_COLNO (cl
) == 0xffe ? -2 : EXPR_WFL_COLNO (cl
)));
5118 /* We have a CL, that's a good reason for using it if it contains data */
5119 saved
= ctxp
->filename
;
5120 if (TREE_CODE (cl
) == EXPR_WITH_FILE_LOCATION
&& EXPR_WFL_FILENAME_NODE (cl
))
5121 ctxp
->filename
= EXPR_WFL_FILENAME (cl
);
5122 saved_input_filename
= input_filename
;
5123 input_filename
= ctxp
->filename
;
5125 java_error (buffer
);
5126 ctxp
->filename
= saved
;
5127 input_filename
= saved_input_filename
;
5131 /* Issue an error message at a current source line CL */
5134 parse_error_context
VPROTO ((tree cl
, const char *msg
, ...))
5136 #ifndef ANSI_PROTOTYPES
5143 #ifndef ANSI_PROTOTYPES
5144 cl
= va_arg (ap
, tree
);
5145 msg
= va_arg (ap
, const char *);
5147 issue_warning_error_from_context (cl
, msg
, ap
);
5151 /* Issue a warning at a current source line CL */
5154 parse_warning_context
VPROTO ((tree cl
, const char *msg
, ...))
5156 #ifndef ANSI_PROTOTYPES
5163 #ifndef ANSI_PROTOTYPES
5164 cl
= va_arg (ap
, tree
);
5165 msg
= va_arg (ap
, const char *);
5168 force_error
= do_warning
= 1;
5169 issue_warning_error_from_context (cl
, msg
, ap
);
5170 do_warning
= force_error
= 0;
5175 find_expr_with_wfl (node
)
5183 switch (TREE_CODE (node
))
5186 node
= BLOCK_EXPR_BODY (node
);
5190 to_return
= find_expr_with_wfl (TREE_OPERAND (node
, 0));
5193 node
= TREE_OPERAND (node
, 1);
5197 node
= TREE_OPERAND (node
, 0);
5200 case LABELED_BLOCK_EXPR
:
5201 node
= TREE_OPERAND (node
, 1);
5205 code
= TREE_CODE_CLASS (TREE_CODE (node
));
5206 if (((code
== '1') || (code
== '2') || (code
== 'e'))
5207 && EXPR_WFL_LINECOL (node
))
5215 /* Issue a missing return statement error. Uses METHOD to figure the
5216 last line of the method the error occurs in. */
5219 missing_return_error (method
)
5222 EXPR_WFL_SET_LINECOL (wfl_operator
, DECL_SOURCE_LINE_LAST (method
), -2);
5223 parse_error_context (wfl_operator
, "Missing return statement");
5226 /* Issue an unreachable statement error. From NODE, find the next
5227 statement to report appropriately. */
5229 unreachable_stmt_error (node
)
5232 /* Browse node to find the next expression node that has a WFL. Use
5233 the location to report the error */
5234 if (TREE_CODE (node
) == COMPOUND_EXPR
)
5235 node
= find_expr_with_wfl (TREE_OPERAND (node
, 1));
5237 node
= find_expr_with_wfl (node
);
5241 EXPR_WFL_SET_LINECOL (wfl_operator
, EXPR_WFL_LINENO (node
), -2);
5242 parse_error_context (wfl_operator
, "Unreachable statement");
5245 fatal ("Can't get valid statement - unreachable_stmt_error");
5249 java_report_errors ()
5251 if (java_error_count
)
5252 fprintf (stderr
, "%d error%s",
5253 java_error_count
, (java_error_count
== 1 ? "" : "s"));
5254 if (java_warning_count
)
5255 fprintf (stderr
, "%s%d warning%s", (java_error_count
? ", " : ""),
5256 java_warning_count
, (java_warning_count
== 1 ? "" : "s"));
5257 if (java_error_count
|| java_warning_count
)
5258 putc ('\n', stderr
);
5259 return java_error_count
;
5263 java_accstring_lookup (flags
)
5266 static char buffer
[80];
5267 #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
5269 /* Access modifier looked-up first for easier report on forbidden
5271 if (flags
& ACC_PUBLIC
) COPY_RETURN ("public");
5272 if (flags
& ACC_PRIVATE
) COPY_RETURN ("private");
5273 if (flags
& ACC_PROTECTED
) COPY_RETURN ("protected");
5274 if (flags
& ACC_STATIC
) COPY_RETURN ("static");
5275 if (flags
& ACC_FINAL
) COPY_RETURN ("final");
5276 if (flags
& ACC_SYNCHRONIZED
) COPY_RETURN ("synchronized");
5277 if (flags
& ACC_VOLATILE
) COPY_RETURN ("volatile");
5278 if (flags
& ACC_TRANSIENT
) COPY_RETURN ("transient");
5279 if (flags
& ACC_NATIVE
) COPY_RETURN ("native");
5280 if (flags
& ACC_INTERFACE
) COPY_RETURN ("interface");
5281 if (flags
& ACC_ABSTRACT
) COPY_RETURN ("abstract");
5288 /* Issuing error messages upon redefinition of classes, interfaces or
5292 classitf_redefinition_error (context
, id
, decl
, cl
)
5293 const char *context
;
5296 parse_error_context (cl
, "%s `%s' already defined in %s:%d",
5297 context
, IDENTIFIER_POINTER (id
),
5298 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
5299 /* Here we should point out where its redefined. It's a unicode. FIXME */
5303 variable_redefinition_error (context
, name
, type
, line
)
5304 tree context
, name
, type
;
5307 const char *type_name
;
5309 /* Figure a proper name for type. We might haven't resolved it */
5310 if (TREE_CODE (type
) == POINTER_TYPE
&& !TREE_TYPE (type
))
5311 type_name
= IDENTIFIER_POINTER (TYPE_NAME (type
));
5313 type_name
= lang_printable_name (type
, 0);
5315 parse_error_context (context
,
5316 "Variable `%s' is already defined in this method and "
5317 "was declared `%s %s' at line %d",
5318 IDENTIFIER_POINTER (name
),
5319 type_name
, IDENTIFIER_POINTER (name
), line
);
5323 build_array_from_name (type
, type_wfl
, name
, ret_name
)
5324 tree type
, type_wfl
, name
, *ret_name
;
5329 /* Eventually get more dims */
5330 string
= IDENTIFIER_POINTER (name
);
5331 while (string
[more_dims
] == '[')
5334 /* If we have, then craft a new type for this variable */
5337 name
= get_identifier (&string
[more_dims
]);
5339 /* If we have a pointer, use its type */
5340 if (TREE_CODE (type
) == POINTER_TYPE
)
5341 type
= TREE_TYPE (type
);
5343 /* Building the first dimension of a primitive type uses this
5345 if (JPRIMITIVE_TYPE_P (type
))
5347 type
= build_java_array_type (type
, -1);
5348 CLASS_LOADED_P (type
) = 1;
5351 /* Otherwise, if we have a WFL for this type, use it (the type
5352 is already an array on an unresolved type, and we just keep
5353 on adding dimensions) */
5357 /* Add all the dimensions */
5359 type
= build_unresolved_array_type (type
);
5361 /* The type may have been incomplete in the first place */
5363 type
= obtain_incomplete_type (type
);
5370 /* Build something that the type identifier resolver will identify as
5371 being an array to an unresolved type. TYPE_WFL is a WFL on a
5375 build_unresolved_array_type (type_or_wfl
)
5380 /* TYPE_OR_WFL might be an array on a resolved type. In this case,
5381 just create a array type */
5382 if (TREE_CODE (type_or_wfl
) == RECORD_TYPE
)
5384 tree type
= build_java_array_type (type_or_wfl
, -1);
5385 CLASS_LOADED_P (type
) = CLASS_LOADED_P (type_or_wfl
);
5389 obstack_1grow (&temporary_obstack
, '[');
5390 obstack_grow0 (&temporary_obstack
,
5391 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl
)),
5392 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl
)));
5393 ptr
= obstack_finish (&temporary_obstack
);
5394 return build_expr_wfl (get_identifier (ptr
),
5395 EXPR_WFL_FILENAME (type_or_wfl
),
5396 EXPR_WFL_LINENO (type_or_wfl
),
5397 EXPR_WFL_COLNO (type_or_wfl
));
5400 /* Check modifiers. If one doesn't fit, retrieve it in its declaration line
5401 and point it out. */
5404 check_modifiers (message
, value
, mask
)
5405 const char *message
;
5409 /* Should point out the one that don't fit. ASCII/unicode,
5410 going backward. FIXME */
5413 int i
, remainder
= value
& ~mask
;
5414 for (i
= 0; i
<= 10; i
++)
5415 if ((1 << i
) & remainder
)
5416 parse_error_context (ctxp
->modifier_ctx
[i
], message
,
5417 java_accstring_lookup (1 << i
));
5422 parser_add_interface (class_decl
, interface_decl
, wfl
)
5423 tree class_decl
, interface_decl
, wfl
;
5425 if (maybe_add_interface (TREE_TYPE (class_decl
), TREE_TYPE (interface_decl
)))
5426 parse_error_context (wfl
, "Interface `%s' repeated",
5427 IDENTIFIER_POINTER (DECL_NAME (interface_decl
)));
5430 /* Bulk of common class/interface checks. Return 1 if an error was
5431 encountered. TAG is 0 for a class, 1 for an interface. */
5434 check_class_interface_creation (is_interface
, flags
, raw_name
, qualified_name
, decl
, cl
)
5435 int is_interface
, flags
;
5436 tree raw_name
, qualified_name
, decl
, cl
;
5441 fprintf (stderr
, " %s %s", (is_interface
? "interface" : "class"),
5442 IDENTIFIER_POINTER (qualified_name
));
5444 /* Scope of an interface/class type name:
5445 - Can't be imported by a single type import
5446 - Can't already exists in the package */
5447 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name
)
5448 && (node
= find_name_in_single_imports (raw_name
)))
5451 (cl
, "%s name `%s' clashes with imported type `%s'",
5452 (is_interface
? "Interface" : "Class"),
5453 IDENTIFIER_POINTER (raw_name
), IDENTIFIER_POINTER (node
));
5456 if (decl
&& CLASS_COMPLETE_P (decl
))
5458 classitf_redefinition_error ((is_interface
? "Interface" : "Class"),
5459 qualified_name
, decl
, cl
);
5463 /* If public, file name should match class/interface name */
5464 if (flags
& ACC_PUBLIC
)
5468 /* Contains OS dependent assumption on path separator. FIXME */
5469 for (f
= &input_filename
[strlen (input_filename
)];
5470 f
!= input_filename
&& f
[0] != '/' && f
[0] != DIR_SEPARATOR
;
5473 if (f
[0] == '/' || f
[0] == DIR_SEPARATOR
)
5475 if (strncmp (IDENTIFIER_POINTER (raw_name
),
5476 f
, IDENTIFIER_LENGTH (raw_name
)) ||
5477 f
[IDENTIFIER_LENGTH (raw_name
)] != '.')
5478 parse_error_context (cl
, "Public %s `%s' must be defined in a file "
5480 (is_interface
? "interface" : "class"),
5481 IDENTIFIER_POINTER (qualified_name
),
5482 IDENTIFIER_POINTER (raw_name
));
5485 check_modifiers ((is_interface
?
5486 "Illegal modifier `%s' for interface declaration" :
5487 "Illegal modifier `%s' for class declaration"), flags
,
5488 (is_interface
? INTERFACE_MODIFIERS
: CLASS_MODIFIERS
));
5492 /* If DECL is NULL, create and push a new DECL, record the current
5493 line CL and do other maintenance things. */
5496 maybe_create_class_interface_decl (decl
, qualified_name
, cl
)
5497 tree decl
, qualified_name
, cl
;
5500 decl
= push_class (make_class (), qualified_name
);
5502 /* Take care of the file and line business */
5503 DECL_SOURCE_FILE (decl
) = EXPR_WFL_FILENAME (cl
);
5504 /* If we're emiting xrefs, store the line/col number information */
5506 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINECOL (cl
);
5508 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINENO (cl
);
5509 CLASS_FROM_SOURCE_P (TREE_TYPE (decl
)) = 1;
5510 CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl
)) =
5511 IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl
));
5513 ctxp
->current_parsed_class
= decl
;
5515 /* Link the declaration to the already seen ones */
5516 TREE_CHAIN (decl
) = ctxp
->class_list
;
5517 ctxp
->class_list
= decl
;
5519 /* Create a new nodes in the global lists */
5520 ctxp
->gclass_list
= tree_cons (NULL_TREE
, decl
, ctxp
->gclass_list
);
5521 all_class_list
= tree_cons (NULL_TREE
, decl
, all_class_list
);
5523 /* Install a new dependency list element */
5524 create_jdep_list (ctxp
);
5526 SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
5527 IDENTIFIER_POINTER (qualified_name
)));
5532 add_superinterfaces (decl
, interface_list
)
5533 tree decl
, interface_list
;
5536 /* Superinterface(s): if present and defined, parser_check_super_interface ()
5537 takes care of ensuring that:
5538 - This is an accessible interface type,
5539 - Circularity detection.
5540 parser_add_interface is then called. If present but not defined,
5541 the check operation is delayed until the super interface gets
5543 for (node
= interface_list
; node
; node
= TREE_CHAIN (node
))
5545 tree current
= TREE_PURPOSE (node
);
5546 tree idecl
= IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current
));
5547 if (idecl
&& CLASS_LOADED_P (TREE_TYPE (idecl
)))
5549 if (!parser_check_super_interface (idecl
, decl
, current
))
5550 parser_add_interface (decl
, idecl
, current
);
5553 register_incomplete_type (JDEP_INTERFACE
,
5554 current
, decl
, NULL_TREE
);
5558 /* Create an interface in pass1 and return its decl. Return the
5559 interface's decl in pass 2. */
5562 create_interface (flags
, id
, super
)
5566 tree raw_name
= EXPR_WFL_NODE (id
);
5567 tree q_name
= parser_qualified_classname (id
);
5568 tree decl
= IDENTIFIER_CLASS_VALUE (q_name
);
5570 EXPR_WFL_NODE (id
) = q_name
; /* Keep source location, even if refined. */
5572 /* Basic checks: scope, redefinition, modifiers */
5573 if (check_class_interface_creation (1, flags
, raw_name
, q_name
, decl
, id
))
5576 /* Interface modifiers check
5577 - public/abstract allowed (already done at that point)
5578 - abstract is obsolete (comes first, it's a warning, or should be)
5579 - Can't use twice the same (checked in the modifier rule) */
5580 if ((flags
& ACC_ABSTRACT
) && flag_redundant
)
5581 parse_warning_context
5582 (MODIFIER_WFL (ABSTRACT_TK
),
5583 "Redundant use of `abstract' modifier. Interface `%s' is implicitely "
5584 "abstract", IDENTIFIER_POINTER (raw_name
));
5586 /* Create a new decl if DECL is NULL, otherwise fix it */
5587 decl
= maybe_create_class_interface_decl (decl
, q_name
, id
);
5589 /* Set super info and mark the class a complete */
5590 set_super_info (ACC_INTERFACE
| flags
, TREE_TYPE (decl
),
5591 object_type_node
, ctxp
->interface_number
);
5592 ctxp
->interface_number
= 0;
5593 CLASS_COMPLETE_P (decl
) = 1;
5594 add_superinterfaces (decl
, super
);
5599 /* Create an class in pass1 and return its decl. Return class
5600 interface's decl in pass 2. */
5603 create_class (flags
, id
, super
, interfaces
)
5605 tree id
, super
, interfaces
;
5607 tree raw_name
= EXPR_WFL_NODE (id
);
5608 tree class_id
, decl
;
5609 tree super_decl_type
;
5611 class_id
= parser_qualified_classname (id
);
5612 decl
= IDENTIFIER_CLASS_VALUE (class_id
);
5613 ctxp
->current_parsed_class_un
= EXPR_WFL_NODE (id
);
5614 EXPR_WFL_NODE (id
) = class_id
;
5616 /* Basic check: scope, redefinition, modifiers */
5617 if (check_class_interface_creation (0, flags
, raw_name
, class_id
, decl
, id
))
5620 /* Class modifier check:
5621 - Allowed modifier (already done at that point)
5622 - abstract AND final forbidden
5623 - Public classes defined in the correct file */
5624 if ((flags
& ACC_ABSTRACT
) && (flags
& ACC_FINAL
))
5625 parse_error_context (id
, "Class `%s' can't be declared both abstract "
5626 "and final", IDENTIFIER_POINTER (raw_name
));
5628 /* Create a new decl if DECL is NULL, otherwise fix it */
5629 decl
= maybe_create_class_interface_decl (decl
, class_id
, id
);
5631 /* If SUPER exists, use it, otherwise use Object */
5634 /* Can't extend java.lang.Object */
5635 if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id
)) == object_type_node
)
5637 parse_error_context (id
, "Can't extend `java.lang.Object'");
5642 register_incomplete_type (JDEP_SUPER
, super
, decl
, NULL_TREE
);
5644 else if (TREE_TYPE (decl
) != object_type_node
)
5645 super_decl_type
= object_type_node
;
5646 /* We're defining java.lang.Object */
5648 super_decl_type
= NULL_TREE
;
5650 /* Set super info and mark the class a complete */
5651 set_super_info (flags
, TREE_TYPE (decl
), super_decl_type
,
5652 ctxp
->interface_number
);
5653 ctxp
->interface_number
= 0;
5654 CLASS_COMPLETE_P (decl
) = 1;
5655 add_superinterfaces (decl
, interfaces
);
5657 /* If doing xref, store the location at which the inherited class
5658 (if any) was seen. */
5659 if (flag_emit_xref
&& super
)
5660 DECL_INHERITED_SOURCE_LINE (decl
) = EXPR_WFL_LINECOL (super
);
5662 /* Eventually sets the @deprecated tag flag */
5663 CHECK_DEPRECATED (decl
);
5668 /* Can't use lookup_field () since we don't want to load the class and
5669 can't set the CLASS_LOADED_P flag */
5672 find_field (class, name
)
5677 for (decl
= TYPE_FIELDS (class); decl
; decl
= TREE_CHAIN (decl
))
5679 if (DECL_NAME (decl
) == name
)
5685 /* Wrap around lookup_field that doesn't potentially upset the value
5689 lookup_field_wrapper (class, name
)
5694 java_parser_context_save_global ();
5695 decl
= lookup_field (&type
, name
);
5696 java_parser_context_restore_global ();
5697 return decl
== error_mark_node
? NULL
: decl
;
5700 /* Find duplicate field within the same class declarations and report
5701 the error. Returns 1 if a duplicated field was found, 0
5705 duplicate_declaration_error_p (new_field_name
, new_type
, cl
)
5706 tree new_field_name
, new_type
, cl
;
5708 /* This might be modified to work with method decl as well */
5709 tree decl
= find_field (TREE_TYPE (ctxp
->current_parsed_class
),
5713 char *t1
= xstrdup (purify_type_name
5714 ((TREE_CODE (new_type
) == POINTER_TYPE
5715 && TREE_TYPE (new_type
) == NULL_TREE
) ?
5716 IDENTIFIER_POINTER (TYPE_NAME (new_type
)) :
5717 lang_printable_name (new_type
, 1)));
5718 /* The type may not have been completed by the time we report
5720 char *t2
= xstrdup (purify_type_name
5721 ((TREE_CODE (TREE_TYPE (decl
)) == POINTER_TYPE
5722 && TREE_TYPE (TREE_TYPE (decl
)) == NULL_TREE
) ?
5723 IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl
))) :
5724 lang_printable_name (TREE_TYPE (decl
), 1)));
5726 (cl
, "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
5727 t1
, IDENTIFIER_POINTER (new_field_name
),
5728 t2
, IDENTIFIER_POINTER (DECL_NAME (decl
)),
5729 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
5737 /* Field registration routine. If TYPE doesn't exist, field
5738 declarations are linked to the undefined TYPE dependency list, to
5739 be later resolved in java_complete_class () */
5742 register_fields (flags
, type
, variable_list
)
5744 tree type
, variable_list
;
5746 tree current
, saved_type
;
5747 tree class_type
= TREE_TYPE (ctxp
->current_parsed_class
);
5748 int saved_lineno
= lineno
;
5750 tree wfl
= NULL_TREE
;
5752 /* If we're adding fields to interfaces, those fields are public,
5754 if (CLASS_INTERFACE (TYPE_NAME (class_type
)))
5756 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK
),
5758 "%s", "interface field(s)");
5759 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK
),
5761 "%s", "interface field(s)");
5762 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK
),
5763 flags
, ACC_FINAL
, "%s", "interface field(s)");
5764 check_modifiers ("Illegal interface member modifier `%s'", flags
,
5765 INTERFACE_FIELD_MODIFIERS
);
5766 flags
|= (ACC_PUBLIC
| ACC_STATIC
| ACC_FINAL
);
5769 /* Obtain a suitable type for resolution, if necessary */
5770 SET_TYPE_FOR_RESOLUTION (type
, wfl
, must_chain
);
5772 /* If TYPE is fully resolved and we don't have a reference, make one */
5773 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
5775 for (current
= variable_list
, saved_type
= type
; current
;
5776 current
= TREE_CHAIN (current
), type
= saved_type
)
5780 tree cl
= TREE_PURPOSE (current
);
5781 tree init
= TREE_VALUE (current
);
5782 tree current_name
= EXPR_WFL_NODE (cl
);
5784 /* Process NAME, as it may specify extra dimension(s) for it */
5785 type
= build_array_from_name (type
, wfl
, current_name
, ¤t_name
);
5787 /* Type adjustment. We may have just readjusted TYPE because
5788 the variable specified more dimensions. Make sure we have
5789 a reference if we can and don't have one already. Also
5790 change the name if we have an init. */
5791 if (type
!= saved_type
)
5793 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
5795 EXPR_WFL_NODE (TREE_OPERAND (init
, 0)) = current_name
;
5798 real_type
= GET_REAL_TYPE (type
);
5799 /* Check for redeclarations */
5800 if (duplicate_declaration_error_p (current_name
, real_type
, cl
))
5803 /* Set lineno to the line the field was found and create a
5804 declaration for it. Eventually sets the @deprecated tag flag. */
5806 lineno
= EXPR_WFL_LINECOL (cl
);
5808 lineno
= EXPR_WFL_LINENO (cl
);
5809 field_decl
= add_field (class_type
, current_name
, real_type
, flags
);
5810 CHECK_DEPRECATED (field_decl
);
5812 /* Check if we must chain. */
5814 register_incomplete_type (JDEP_FIELD
, wfl
, field_decl
, type
);
5816 /* If we have an initialization value tied to the field */
5819 /* The field is declared static */
5820 if (flags
& ACC_STATIC
)
5822 /* We include the field and its initialization part into
5823 a list used to generate <clinit>. After <clinit> is
5824 walked, field initializations will be processed and
5825 fields initialized with known constants will be taken
5826 out of <clinit> and have their DECL_INITIAL set
5828 TREE_CHAIN (init
) = ctxp
->static_initialized
;
5829 ctxp
->static_initialized
= init
;
5830 if (TREE_OPERAND (init
, 1)
5831 && TREE_CODE (TREE_OPERAND (init
, 1)) == NEW_ARRAY_INIT
)
5832 TREE_STATIC (TREE_OPERAND (init
, 1)) = 1;
5834 /* A non-static field declared with an immediate initialization is
5835 to be initialized in <init>, if any. This field is remembered
5836 to be processed at the time of the generation of <init>. */
5839 TREE_CHAIN (init
) = ctxp
->non_static_initialized
;
5840 ctxp
->non_static_initialized
= init
;
5842 MODIFY_EXPR_FROM_INITIALIZATION_P (init
) = 1;
5843 DECL_INITIAL (field_decl
) = TREE_OPERAND (init
, 1);
5846 lineno
= saved_lineno
;
5849 /* Generate the method $finit$ that initializes fields initialized
5850 upon declaration. */
5853 maybe_generate_finit ()
5855 tree mdecl
, current
;
5857 if (!ctxp
->non_static_initialized
|| java_error_count
)
5860 mdecl
= create_artificial_method (TREE_TYPE (ctxp
->current_parsed_class
),
5861 ACC_PRIVATE
, void_type_node
,
5862 finit_identifier_node
, end_params_node
);
5863 start_artificial_method_body (mdecl
);
5865 ctxp
->non_static_initialized
= nreverse (ctxp
->non_static_initialized
);
5866 for (current
= ctxp
->non_static_initialized
; current
;
5867 current
= TREE_CHAIN (current
))
5868 java_method_add_stmt (mdecl
,
5869 build_debugable_stmt (EXPR_WFL_LINECOL (current
),
5872 end_artificial_method_body (mdecl
);
5873 CLASS_HAS_FINIT_P (TREE_TYPE (ctxp
->current_parsed_class
)) = 1;
5874 ctxp
->non_static_initialized
= NULL_TREE
;
5877 /* Check whether it is necessary to generate a <clinit> for the class
5881 maybe_generate_clinit ()
5885 if (!ctxp
->static_initialized
|| java_error_count
)
5888 mdecl
= create_artificial_method (TREE_TYPE (ctxp
->current_parsed_class
),
5889 ACC_STATIC
, void_type_node
,
5890 clinit_identifier_node
, end_params_node
);
5891 start_artificial_method_body (mdecl
);
5893 /* Keep initialization in order to enforce 8.5 */
5894 ctxp
->static_initialized
= nreverse (ctxp
->static_initialized
);
5896 /* We process the list of assignment we produced as the result of
5897 the declaration of initialized static field and add them as
5898 statement to the <clinit> method. */
5899 for (c
= ctxp
->static_initialized
; c
; c
= TREE_CHAIN (c
))
5901 /* We build the assignment expression that will initialize the
5902 field to its value. There are strict rules on static
5903 initializers (8.5). FIXME */
5904 java_method_add_stmt (mdecl
,
5905 build_debugable_stmt (EXPR_WFL_LINECOL (c
), c
));
5908 end_artificial_method_body (mdecl
);
5909 ctxp
->static_initialized
= NULL_TREE
;
5912 /* Shared accros method_declarator and method_header to remember the
5913 patch stage that was reached during the declaration of the method.
5914 A method DECL is built differently is there is no patch
5915 (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
5916 pending on the currently defined method. */
5918 static int patch_stage
;
5920 /* Check the method declaration and add the method to its current
5921 class. If the argument list is known to contain incomplete types,
5922 the method is partially added and the registration will be resume
5923 once the method arguments resolved. If TYPE is NULL, we're dealing
5924 with a constructor. */
5927 method_header (flags
, type
, mdecl
, throws
)
5929 tree type
, mdecl
, throws
;
5931 tree meth
= TREE_VALUE (mdecl
);
5932 tree id
= TREE_PURPOSE (mdecl
);
5933 tree type_wfl
= NULL_TREE
;
5934 tree meth_name
= NULL_TREE
;
5935 tree current
, orig_arg
, this_class
;
5937 int constructor_ok
= 0, must_chain
;
5939 check_modifiers_consistency (flags
);
5941 if (ctxp
->current_parsed_class
)
5942 this_class
= TREE_TYPE (ctxp
->current_parsed_class
);
5946 /* There are some forbidden modifiers for an abstract method and its
5947 class must be abstract as well. */
5948 if (type
&& (flags
& ACC_ABSTRACT
))
5950 ABSTRACT_CHECK (flags
, ACC_PRIVATE
, id
, "Private");
5951 ABSTRACT_CHECK (flags
, ACC_STATIC
, id
, "Static");
5952 ABSTRACT_CHECK (flags
, ACC_FINAL
, id
, "Final");
5953 ABSTRACT_CHECK (flags
, ACC_NATIVE
, id
, "Native");
5954 ABSTRACT_CHECK (flags
, ACC_SYNCHRONIZED
,id
, "Synchronized");
5955 if (!CLASS_ABSTRACT (TYPE_NAME (this_class
))
5956 && !CLASS_INTERFACE (TYPE_NAME (this_class
)))
5958 (id
, "Class `%s' must be declared abstract to define abstract "
5960 IDENTIFIER_POINTER (DECL_NAME (ctxp
->current_parsed_class
)),
5961 IDENTIFIER_POINTER (EXPR_WFL_NODE (id
)));
5963 /* Things to be checked when declaring a constructor */
5966 int ec
= java_error_count
;
5967 /* 8.6: Constructor declarations: we might be trying to define a
5968 method without specifying a return type. */
5969 if (EXPR_WFL_NODE (id
) != ctxp
->current_parsed_class_un
)
5971 (id
, "Invalid method declaration, return type required");
5972 /* 8.6.3: Constructor modifiers */
5975 JCONSTRUCTOR_CHECK (flags
, ACC_ABSTRACT
, id
, "abstract");
5976 JCONSTRUCTOR_CHECK (flags
, ACC_STATIC
, id
, "static");
5977 JCONSTRUCTOR_CHECK (flags
, ACC_FINAL
, id
, "final");
5978 JCONSTRUCTOR_CHECK (flags
, ACC_NATIVE
, id
, "native");
5979 JCONSTRUCTOR_CHECK (flags
, ACC_SYNCHRONIZED
, id
, "synchronized");
5981 /* If we found error here, we don't consider it's OK to tread
5982 the method definition as a constructor, for the rest of this
5984 if (ec
== java_error_count
)
5988 /* Method declared within the scope of an interface are implicitly
5989 abstract and public. Conflicts with other erroneously provided
5990 modifiers are checked right after. */
5992 if (CLASS_INTERFACE (TYPE_NAME (this_class
)))
5994 /* If FLAGS isn't set because of a modifier, turn the
5995 corresponding modifier WFL to NULL so we issue a warning on
5996 the obsolete use of the modifier */
5997 if (!(flags
& ACC_PUBLIC
))
5998 MODIFIER_WFL (PUBLIC_TK
) = NULL
;
5999 if (!(flags
& ACC_ABSTRACT
))
6000 MODIFIER_WFL (ABSTRACT_TK
) = NULL
;
6001 flags
|= ACC_PUBLIC
;
6002 flags
|= ACC_ABSTRACT
;
6005 /* Modifiers context reset moved up, so abstract method declaration
6006 modifiers can be later checked. */
6008 /* Set constructor returned type to void and method name to <init>,
6009 unless we found an error identifier the constructor (in which
6010 case we retain the original name) */
6013 type
= void_type_node
;
6015 meth_name
= init_identifier_node
;
6018 meth_name
= EXPR_WFL_NODE (id
);
6020 /* Do the returned type resolution and registration if necessary */
6021 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
6024 type
= build_array_from_name (type
, type_wfl
, meth_name
, &meth_name
);
6025 EXPR_WFL_NODE (id
) = meth_name
;
6026 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
6030 patch_stage
= JDEP_METHOD_RETURN
;
6031 register_incomplete_type (patch_stage
, type_wfl
, id
, type
);
6032 TREE_TYPE (meth
) = GET_REAL_TYPE (type
);
6035 TREE_TYPE (meth
) = type
;
6037 saved_lineno
= lineno
;
6038 /* When defining an abstract or interface method, the curly
6039 bracket at level 1 doesn't exist because there is no function
6041 lineno
= (ctxp
->first_ccb_indent1
? ctxp
->first_ccb_indent1
:
6042 EXPR_WFL_LINENO (id
));
6044 /* Remember the original argument list */
6045 orig_arg
= TYPE_ARG_TYPES (meth
);
6047 if (patch_stage
) /* includes ret type and/or all args */
6050 meth
= add_method_1 (this_class
, flags
, meth_name
, meth
);
6051 /* Patch for the return type */
6052 if (patch_stage
== JDEP_METHOD_RETURN
)
6054 jdep
= CLASSD_LAST (ctxp
->classd_list
);
6055 JDEP_GET_PATCH (jdep
) = &TREE_TYPE (TREE_TYPE (meth
));
6057 /* This is the stop JDEP. METH allows the function's signature
6059 register_incomplete_type (JDEP_METHOD_END
, NULL_TREE
, meth
, NULL_TREE
);
6062 meth
= add_method (this_class
, flags
, meth_name
,
6063 build_java_signature (meth
));
6065 /* Fix the method argument list so we have the argument name
6067 fix_method_argument_names (orig_arg
, meth
);
6069 /* Register the parameter number and re-install the current line
6071 DECL_MAX_LOCALS (meth
) = ctxp
->formal_parameter_number
+1;
6072 lineno
= saved_lineno
;
6074 /* Register exception specified by the `throws' keyword for
6075 resolution and set the method decl appropriate field to the list.
6076 Note: the grammar ensures that what we get here are class
6080 throws
= nreverse (throws
);
6081 for (current
= throws
; current
; current
= TREE_CHAIN (current
))
6083 register_incomplete_type (JDEP_EXCEPTION
, TREE_VALUE (current
),
6084 NULL_TREE
, NULL_TREE
);
6085 JDEP_GET_PATCH (CLASSD_LAST (ctxp
->classd_list
)) =
6086 &TREE_VALUE (current
);
6088 DECL_FUNCTION_THROWS (meth
) = throws
;
6091 /* We set the DECL_NAME to ID so we can track the location where
6092 the function was declared. This allow us to report
6093 redefinition error accurately. When method are verified,
6094 DECL_NAME is reinstalled properly (using the content of the
6095 WFL node ID) (see check_method_redefinition). We don't do that
6096 when Object is being defined. Constructor <init> names will be
6097 reinstalled the same way. */
6098 if (TREE_TYPE (ctxp
->current_parsed_class
) != object_type_node
)
6099 DECL_NAME (meth
) = id
;
6101 /* Set the flag if we correctly processed a constructor */
6103 DECL_CONSTRUCTOR_P (meth
) = 1;
6105 /* Eventually set the @deprecated tag flag */
6106 CHECK_DEPRECATED (meth
);
6108 /* If doing xref, store column and line number information instead
6109 of the line number only. */
6111 DECL_SOURCE_LINE (meth
) = EXPR_WFL_LINECOL (id
);
6117 fix_method_argument_names (orig_arg
, meth
)
6118 tree orig_arg
, meth
;
6120 tree arg
= TYPE_ARG_TYPES (TREE_TYPE (meth
));
6121 if (TREE_CODE (TREE_TYPE (meth
)) == METHOD_TYPE
)
6123 TREE_PURPOSE (arg
) = this_identifier_node
;
6124 arg
= TREE_CHAIN (arg
);
6126 while (orig_arg
!= end_params_node
)
6128 TREE_PURPOSE (arg
) = TREE_PURPOSE (orig_arg
);
6129 orig_arg
= TREE_CHAIN (orig_arg
);
6130 arg
= TREE_CHAIN (arg
);
6134 /* Complete the method declaration with METHOD_BODY. */
6137 finish_method_declaration (method_body
)
6142 if (!current_function_decl
)
6145 flags
= get_access_flags_from_decl (current_function_decl
);
6147 /* 8.4.5 Method Body */
6148 if ((flags
& ACC_ABSTRACT
|| flags
& ACC_NATIVE
) && method_body
)
6150 tree wfl
= DECL_NAME (current_function_decl
);
6151 parse_error_context (wfl
,
6152 "%s method `%s' can't have a body defined",
6153 (METHOD_NATIVE (current_function_decl
) ?
6154 "Native" : "Abstract"),
6155 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
6156 method_body
= NULL_TREE
;
6158 else if (!(flags
& ACC_ABSTRACT
) && !(flags
& ACC_NATIVE
) && !method_body
)
6160 tree wfl
= DECL_NAME (current_function_decl
);
6161 parse_error_context (wfl
,
6162 "Non native and non abstract method `%s' must "
6163 "have a body defined",
6164 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
6165 method_body
= NULL_TREE
;
6168 if (flag_emit_class_files
&& method_body
6169 && TREE_CODE (method_body
) == NOP_EXPR
6170 && TREE_TYPE (current_function_decl
)
6171 && TREE_TYPE (TREE_TYPE (current_function_decl
)) == void_type_node
)
6172 method_body
= build1 (RETURN_EXPR
, void_type_node
, NULL
);
6174 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl
)) = method_body
;
6175 maybe_absorb_scoping_blocks ();
6176 /* Exit function's body */
6178 /* Merge last line of the function with first line, directly in the
6179 function decl. It will be used to emit correct debug info. */
6180 if (!flag_emit_xref
)
6181 DECL_SOURCE_LINE_MERGE (current_function_decl
, ctxp
->last_ccb_indent1
);
6182 /* So we don't have an irrelevant function declaration context for
6183 the next static block we'll see. */
6184 current_function_decl
= NULL_TREE
;
6187 /* Build a an error message for constructor circularity errors. */
6190 constructor_circularity_msg (from
, to
)
6193 static char string
[4096];
6194 char *t
= xstrdup (lang_printable_name (from
, 0));
6195 sprintf (string
, "`%s' invokes `%s'", t
, lang_printable_name (to
, 0));
6200 /* Verify a circular call to METH. Return 1 if an error is found, 0
6204 verify_constructor_circularity (meth
, current
)
6207 static tree list
= NULL_TREE
;
6209 for (c
= DECL_CONSTRUCTOR_CALLS (current
); c
; c
= TREE_CHAIN (c
))
6211 if (TREE_VALUE (c
) == meth
)
6217 list
= nreverse (list
);
6218 for (liste
= list
; liste
; liste
= TREE_CHAIN (liste
))
6221 (TREE_PURPOSE (TREE_PURPOSE (liste
)),
6222 constructor_circularity_msg
6223 (TREE_VALUE (liste
), TREE_VALUE (TREE_PURPOSE (liste
))));
6227 t
= xstrdup (lang_printable_name (meth
, 0));
6228 parse_error_context (TREE_PURPOSE (c
),
6229 "%s: recursive invocation of constructor `%s'",
6230 constructor_circularity_msg (current
, meth
), t
);
6236 for (c
= DECL_CONSTRUCTOR_CALLS (current
); c
; c
= TREE_CHAIN (c
))
6238 list
= tree_cons (c
, current
, list
);
6239 if (verify_constructor_circularity (meth
, TREE_VALUE (c
)))
6241 list
= TREE_CHAIN (list
);
6246 /* Check modifiers that can be declared but exclusively */
6249 check_modifiers_consistency (flags
)
6253 tree cl
= NULL_TREE
;
6255 THIS_MODIFIER_ONLY (flags
, ACC_PUBLIC
, 0, acc_count
, cl
);
6256 THIS_MODIFIER_ONLY (flags
, ACC_PRIVATE
, 1, acc_count
, cl
);
6257 THIS_MODIFIER_ONLY (flags
, ACC_PROTECTED
, 2, acc_count
, cl
);
6260 (cl
, "Inconsistent member declaration. At most one of `public', "
6261 "`private', or `protected' may be specified");
6264 /* Check the methode header METH for abstract specifics features */
6267 check_abstract_method_header (meth
)
6270 int flags
= get_access_flags_from_decl (meth
);
6271 /* DECL_NAME might still be a WFL node */
6272 tree name
= GET_METHOD_NAME (meth
);
6274 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK
), flags
,
6275 ACC_ABSTRACT
, "abstract method `%s'",
6276 IDENTIFIER_POINTER (name
));
6277 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK
), flags
,
6278 ACC_PUBLIC
, "abstract method `%s'",
6279 IDENTIFIER_POINTER (name
));
6281 check_modifiers ("Illegal modifier `%s' for interface method",
6282 flags
, INTERFACE_METHOD_MODIFIERS
);
6285 /* Create a FUNCTION_TYPE node and start augmenting it with the
6286 declared function arguments. Arguments type that can't be resolved
6287 are left as they are, but the returned node is marked as containing
6288 incomplete types. */
6291 method_declarator (id
, list
)
6294 tree arg_types
= NULL_TREE
, current
, node
;
6295 tree meth
= make_node (FUNCTION_TYPE
);
6298 patch_stage
= JDEP_NO_PATCH
;
6300 for (current
= list
; current
; current
= TREE_CHAIN (current
))
6303 tree wfl_name
= TREE_PURPOSE (current
);
6304 tree type
= TREE_VALUE (current
);
6305 tree name
= EXPR_WFL_NODE (wfl_name
);
6306 tree already
, arg_node
;
6307 tree type_wfl
= NULL_TREE
;
6310 /* Obtain a suitable type for resolution, if necessary */
6311 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
6313 /* Process NAME, as it may specify extra dimension(s) for it */
6314 type
= build_array_from_name (type
, type_wfl
, name
, &name
);
6315 EXPR_WFL_NODE (wfl_name
) = name
;
6317 real_type
= GET_REAL_TYPE (type
);
6318 if (TREE_CODE (real_type
) == RECORD_TYPE
)
6320 real_type
= promote_type (real_type
);
6321 if (TREE_CODE (type
) == TREE_LIST
)
6322 TREE_PURPOSE (type
) = real_type
;
6325 /* Check redefinition */
6326 for (already
= arg_types
; already
; already
= TREE_CHAIN (already
))
6327 if (TREE_PURPOSE (already
) == name
)
6330 (wfl_name
, "Variable `%s' is used more than once in the "
6331 "argument list of method `%s'", IDENTIFIER_POINTER (name
),
6332 IDENTIFIER_POINTER (EXPR_WFL_NODE (id
)));
6336 /* If we've an incomplete argument type, we know there is a location
6337 to patch when the type get resolved, later. */
6341 patch_stage
= JDEP_METHOD
;
6342 type
= register_incomplete_type (patch_stage
,
6343 type_wfl
, wfl_name
, type
);
6344 jdep
= CLASSD_LAST (ctxp
->classd_list
);
6345 JDEP_MISC (jdep
) = id
;
6348 /* The argument node: a name and a (possibly) incomplete type */
6349 arg_node
= build_tree_list (name
, real_type
);
6351 JDEP_GET_PATCH (jdep
) = &TREE_VALUE (arg_node
);
6352 TREE_CHAIN (arg_node
) = arg_types
;
6353 arg_types
= arg_node
;
6355 TYPE_ARG_TYPES (meth
) = chainon (nreverse (arg_types
), end_params_node
);
6356 node
= build_tree_list (id
, meth
);
6361 unresolved_type_p (wfl
, returned
)
6366 if (TREE_CODE (wfl
) == EXPR_WITH_FILE_LOCATION
)
6368 tree decl
= IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl
));
6370 *returned
= (decl
? TREE_TYPE (decl
) : NULL_TREE
);
6378 /* From NAME, build a qualified identifier node using the
6379 qualification from the current package definition. */
6382 parser_qualified_classname (name
)
6386 return merge_qualified_name (ctxp
->package
, EXPR_WFL_NODE (name
));
6388 return EXPR_WFL_NODE (name
);
6391 /* Called once the type a interface extends is resolved. Returns 0 if
6392 everything is OK. */
6395 parser_check_super_interface (super_decl
, this_decl
, this_wfl
)
6396 tree super_decl
, this_decl
, this_wfl
;
6398 tree super_type
= TREE_TYPE (super_decl
);
6400 /* Has to be an interface */
6401 if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl
))))
6404 (this_wfl
, "Can't use %s `%s' to implement/extend %s `%s'",
6405 (TYPE_ARRAY_P (super_type
) ? "array" : "class"),
6406 IDENTIFIER_POINTER (DECL_NAME (super_decl
)),
6407 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl
))) ?
6408 "interface" : "class"),
6409 IDENTIFIER_POINTER (DECL_NAME (this_decl
)));
6413 /* Check scope: same package OK, other package: OK if public */
6414 if (check_pkg_class_access (DECL_NAME (super_decl
), lookup_cl (this_decl
)))
6417 SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
6418 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6419 IDENTIFIER_POINTER (DECL_NAME (super_decl
))));
6423 /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
6424 0 if everthing is OK. */
6427 parser_check_super (super_decl
, this_decl
, wfl
)
6428 tree super_decl
, this_decl
, wfl
;
6430 tree super_type
= TREE_TYPE (super_decl
);
6432 /* SUPER should be a CLASS (neither an array nor an interface) */
6433 if (TYPE_ARRAY_P (super_type
) || CLASS_INTERFACE (TYPE_NAME (super_type
)))
6436 (wfl
, "Class `%s' can't subclass %s `%s'",
6437 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6438 (CLASS_INTERFACE (TYPE_NAME (super_type
)) ? "interface" : "array"),
6439 IDENTIFIER_POINTER (DECL_NAME (super_decl
)));
6443 if (CLASS_FINAL (TYPE_NAME (super_type
)))
6445 parse_error_context (wfl
, "Can't subclass final classes: %s",
6446 IDENTIFIER_POINTER (DECL_NAME (super_decl
)));
6450 /* Check scope: same package OK, other package: OK if public */
6451 if (check_pkg_class_access (DECL_NAME (super_decl
), wfl
))
6454 SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
6455 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6456 IDENTIFIER_POINTER (DECL_NAME (super_decl
))));
6460 /* Create a new dependency list and link it (in a LIFO manner) to the
6461 CTXP list of type dependency list. */
6464 create_jdep_list (ctxp
)
6465 struct parser_ctxt
*ctxp
;
6467 jdeplist
*new = (jdeplist
*)xmalloc (sizeof (jdeplist
));
6468 new->first
= new->last
= NULL
;
6469 new->next
= ctxp
->classd_list
;
6470 ctxp
->classd_list
= new;
6474 reverse_jdep_list (ctxp
)
6475 struct parser_ctxt
*ctxp
;
6477 register jdeplist
*prev
= NULL
, *current
, *next
;
6478 for (current
= ctxp
->classd_list
; current
; current
= next
)
6480 next
= current
->next
;
6481 current
->next
= prev
;
6487 /* Create a fake pointer based on the ID stored in
6488 TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
6489 registered again. */
6492 obtain_incomplete_type (type_name
)
6497 if (TREE_CODE (type_name
) == EXPR_WITH_FILE_LOCATION
)
6498 name
= EXPR_WFL_NODE (type_name
);
6499 else if (INCOMPLETE_TYPE_P (type_name
))
6500 name
= TYPE_NAME (type_name
);
6502 fatal ("invalid type name - obtain_incomplete_type");
6504 for (ptr
= ctxp
->incomplete_class
; ptr
; ptr
= TREE_CHAIN (ptr
))
6505 if (TYPE_NAME (ptr
) == name
)
6510 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6511 BUILD_PTR_FROM_NAME (ptr
, name
);
6514 TREE_CHAIN (ptr
) = ctxp
->incomplete_class
;
6515 ctxp
->incomplete_class
= ptr
;
6521 /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
6522 non NULL instead of computing a new fake type based on WFL. The new
6523 dependency is inserted in the current type dependency list, in FIFO
6527 register_incomplete_type (kind
, wfl
, decl
, ptr
)
6529 tree wfl
, decl
, ptr
;
6531 jdep
*new = (jdep
*)xmalloc (sizeof (jdep
));
6533 if (!ptr
&& kind
!= JDEP_METHOD_END
) /* JDEP_METHOD_END is a mere marker */
6534 ptr
= obtain_incomplete_type (wfl
);
6536 JDEP_KIND (new) = kind
;
6537 JDEP_DECL (new) = decl
;
6538 JDEP_SOLV (new) = ptr
;
6539 JDEP_WFL (new) = wfl
;
6540 JDEP_CHAIN (new) = NULL
;
6541 JDEP_MISC (new) = NULL_TREE
;
6542 JDEP_GET_PATCH (new) = (tree
*)NULL
;
6544 JDEP_INSERT (ctxp
->classd_list
, new);
6550 java_check_circular_reference ()
6553 for (current
= ctxp
->class_list
; current
; current
= TREE_CHAIN (current
))
6555 tree type
= TREE_TYPE (current
);
6556 if (CLASS_INTERFACE (TYPE_NAME (type
)))
6558 /* Check all interfaces this class extends */
6559 tree basetype_vec
= TYPE_BINFO_BASETYPES (type
);
6564 n
= TREE_VEC_LENGTH (basetype_vec
);
6565 for (i
= 0; i
< n
; i
++)
6567 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
);
6568 if (vec_elt
&& BINFO_TYPE (vec_elt
) != object_type_node
6569 && interface_of_p (type
, BINFO_TYPE (vec_elt
)))
6570 parse_error_context (lookup_cl (current
),
6571 "Cyclic interface inheritance");
6575 if (inherits_from_p (CLASSTYPE_SUPER (type
), type
))
6576 parse_error_context (lookup_cl (current
),
6577 "Cyclic class inheritance");
6581 /* safe_layout_class just makes sure that we can load a class without
6582 disrupting the current_class, input_file, lineno, etc, information
6583 about the class processed currently. */
6586 safe_layout_class (class)
6589 tree save_current_class
= current_class
;
6590 char *save_input_filename
= input_filename
;
6591 int save_lineno
= lineno
;
6593 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6595 layout_class (class);
6598 current_class
= save_current_class
;
6599 input_filename
= save_input_filename
;
6600 lineno
= save_lineno
;
6601 CLASS_LOADED_P (class) = 1;
6605 jdep_resolve_class (dep
)
6610 if (JDEP_RESOLVED_P (dep
))
6611 decl
= JDEP_RESOLVED_DECL (dep
);
6614 decl
= resolve_class (JDEP_TO_RESOLVE (dep
),
6615 JDEP_DECL (dep
), JDEP_WFL (dep
));
6616 JDEP_RESOLVED (dep
, decl
);
6620 complete_class_report_errors (dep
);
6625 /* Complete unsatisfied class declaration and their dependencies */
6628 java_complete_class ()
6635 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6637 /* Process imports and reverse the import on demand list */
6639 if (ctxp
->import_demand_list
)
6640 ctxp
->import_demand_list
= nreverse (ctxp
->import_demand_list
);
6642 /* Rever things so we have the right order */
6643 ctxp
->class_list
= nreverse (ctxp
->class_list
);
6644 ctxp
->classd_list
= reverse_jdep_list (ctxp
);
6646 for (cclassd
= ctxp
->classd_list
, cclass
= ctxp
->class_list
;
6648 cclass
= TREE_CHAIN (cclass
), cclassd
= CLASSD_CHAIN (cclassd
))
6651 for (dep
= CLASSD_FIRST (cclassd
); dep
; dep
= JDEP_CHAIN (dep
))
6654 if (!(decl
= jdep_resolve_class (dep
)))
6657 /* Now it's time to patch */
6658 switch (JDEP_KIND (dep
))
6661 /* Simply patch super */
6662 if (parser_check_super (decl
, JDEP_DECL (dep
), JDEP_WFL (dep
)))
6664 BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
6665 (TREE_TYPE (JDEP_DECL (dep
)))), 0)) = TREE_TYPE (decl
);
6670 /* We do part of the job done in add_field */
6671 tree field_decl
= JDEP_DECL (dep
);
6672 tree field_type
= TREE_TYPE (decl
);
6673 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6674 if (TREE_CODE (field_type
) == RECORD_TYPE
)
6675 field_type
= promote_type (field_type
);
6677 TREE_TYPE (field_decl
) = field_type
;
6678 DECL_ALIGN (field_decl
) = 0;
6679 layout_decl (field_decl
, 0);
6680 SOURCE_FRONTEND_DEBUG
6681 (("Completed field/var decl `%s' with `%s'",
6682 IDENTIFIER_POINTER (DECL_NAME (field_decl
)),
6683 IDENTIFIER_POINTER (DECL_NAME (decl
))));
6686 case JDEP_METHOD
: /* We start patching a method */
6687 case JDEP_METHOD_RETURN
:
6693 type
= TREE_TYPE(decl
);
6694 if (TREE_CODE (type
) == RECORD_TYPE
)
6695 type
= promote_type (type
);
6696 JDEP_APPLY_PATCH (dep
, type
);
6697 SOURCE_FRONTEND_DEBUG
6698 (((JDEP_KIND (dep
) == JDEP_METHOD_RETURN
?
6699 "Completing fct `%s' with ret type `%s'":
6700 "Completing arg `%s' with type `%s'"),
6701 IDENTIFIER_POINTER (EXPR_WFL_NODE
6702 (JDEP_DECL_WFL (dep
))),
6703 IDENTIFIER_POINTER (DECL_NAME (decl
))));
6707 dep
= JDEP_CHAIN (dep
);
6708 if (JDEP_KIND (dep
) == JDEP_METHOD_END
)
6711 decl
= jdep_resolve_class (dep
);
6715 tree mdecl
= JDEP_DECL (dep
), signature
;
6716 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6717 /* Recompute and reset the signature */
6718 signature
= build_java_signature (TREE_TYPE (mdecl
));
6719 set_java_signature (TREE_TYPE (mdecl
), signature
);
6726 case JDEP_INTERFACE
:
6727 if (parser_check_super_interface (decl
, JDEP_DECL (dep
),
6730 parser_add_interface (JDEP_DECL (dep
), decl
, JDEP_WFL (dep
));
6735 type
= TREE_TYPE(decl
);
6736 if (TREE_CODE (type
) == RECORD_TYPE
)
6737 type
= promote_type (type
);
6738 JDEP_APPLY_PATCH (dep
, type
);
6742 JDEP_APPLY_PATCH (dep
, TREE_TYPE (decl
));
6743 SOURCE_FRONTEND_DEBUG
6744 (("Completing a random type dependency on a '%s' node",
6745 tree_code_name
[TREE_CODE (JDEP_DECL (dep
))]));
6748 case JDEP_EXCEPTION
:
6749 JDEP_APPLY_PATCH (dep
, TREE_TYPE (decl
));
6750 SOURCE_FRONTEND_DEBUG
6751 (("Completing `%s' `throws' argument node",
6752 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
)))));
6756 fatal ("Can't handle patch code %d - java_complete_class",
6765 /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
6769 resolve_class (class_type
, decl
, cl
)
6770 tree class_type
, decl
, cl
;
6772 const char *name
= IDENTIFIER_POINTER (TYPE_NAME (class_type
));
6773 const char *base
= name
;
6774 tree resolved_type
= TREE_TYPE (class_type
);
6775 tree resolved_type_decl
;
6777 if (resolved_type
!= NULL_TREE
)
6779 tree resolved_type_decl
= TYPE_NAME (resolved_type
);
6780 if (resolved_type_decl
== NULL_TREE
6781 || TREE_CODE (resolved_type_decl
) == IDENTIFIER_NODE
)
6783 resolved_type_decl
= build_decl (TYPE_DECL
,
6784 TYPE_NAME (class_type
),
6787 return resolved_type_decl
;
6790 /* 1- Check to see if we have an array. If true, find what we really
6792 while (name
[0] == '[')
6795 TYPE_NAME (class_type
) = get_identifier (name
);
6797 /* 2- Resolve the bare type */
6798 if (!(resolved_type_decl
= do_resolve_class (class_type
, decl
, cl
)))
6800 resolved_type
= TREE_TYPE (resolved_type_decl
);
6802 /* 3- If we have and array, reconstruct the array down to its nesting */
6805 while (base
!= name
)
6807 if (TREE_CODE (resolved_type
) == RECORD_TYPE
)
6808 resolved_type
= promote_type (resolved_type
);
6809 resolved_type
= build_java_array_type (resolved_type
, -1);
6810 CLASS_LOADED_P (resolved_type
) = 1;
6813 /* Build a fake decl for this, since this is what is expected to
6815 resolved_type_decl
=
6816 build_decl (TYPE_DECL
, TYPE_NAME (resolved_type
), resolved_type
);
6817 /* Figure how those two things are important for error report. FIXME */
6818 DECL_SOURCE_LINE (resolved_type_decl
) = 0;
6819 DECL_SOURCE_FILE (resolved_type_decl
) = input_filename
;
6820 TYPE_NAME (class_type
) = TYPE_NAME (resolved_type
);
6822 TREE_TYPE (class_type
) = resolved_type
;
6823 return resolved_type_decl
;
6826 /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
6827 are used to report error messages. */
6830 do_resolve_class (class_type
, decl
, cl
)
6835 tree new_class_decl
;
6836 tree original_name
= NULL_TREE
;
6838 /* Do not try to replace TYPE_NAME (class_type) by a variable, since
6839 its is changed by find_in_imports{_on_demand} */
6841 /* 1- Check for the type in single imports */
6842 if (find_in_imports (class_type
))
6845 /* 2- And check for the type in the current compilation unit. If it fails,
6846 try with a name qualified with the package name if appropriate. */
6847 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6849 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6850 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6851 load_class (TYPE_NAME (class_type
), 0);
6852 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6855 original_name
= TYPE_NAME (class_type
);
6856 if (!QUALIFIED_P (TYPE_NAME (class_type
)) && ctxp
->package
)
6857 TYPE_NAME (class_type
) = merge_qualified_name (ctxp
->package
,
6858 TYPE_NAME (class_type
));
6860 if (!(new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6861 load_class (TYPE_NAME (class_type
), 0);
6862 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6864 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6865 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6866 load_class (TYPE_NAME (class_type
), 0);
6867 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6870 new_name
= TYPE_NAME (class_type
);
6871 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (new_name
)) != NULL_TREE
)
6873 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6874 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6875 load_class (new_name
, 0);
6876 return IDENTIFIER_CLASS_VALUE (new_name
);
6880 tree
class = read_class (new_name
);
6881 if (class != NULL_TREE
)
6883 tree decl
= IDENTIFIER_CLASS_VALUE (new_name
);
6884 if (decl
== NULL_TREE
)
6885 decl
= push_class (class, new_name
);
6890 TYPE_NAME (class_type
) = original_name
;
6892 /* 3- Check an other compilation unit that bears the name of type */
6893 load_class (TYPE_NAME (class_type
), 0);
6894 if (check_pkg_class_access (TYPE_NAME (class_type
),
6895 (cl
? cl
: lookup_cl (decl
))))
6898 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6899 return new_class_decl
;
6901 /* 4- Check the import on demands. Don't allow bar.baz to be
6902 imported from foo.* */
6903 if (!QUALIFIED_P (TYPE_NAME (class_type
)))
6904 if (find_in_imports_on_demand (class_type
))
6907 /* 5- Last call for a resolution */
6908 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6911 /* Resolve NAME and lay it out (if not done and if not the current
6912 parsed class). Return a decl node. This function is meant to be
6913 called when type resolution is necessary during the walk pass. */
6916 resolve_and_layout (something
, cl
)
6922 /* Don't do that on the current class */
6923 if (something
== current_class
)
6924 return TYPE_NAME (current_class
);
6926 /* Don't do anything for void and other primitive types */
6927 if (JPRIMITIVE_TYPE_P (something
) || something
== void_type_node
)
6930 /* Pointer types can be reall pointer types or fake pointers. When
6931 finding a real pointer, recheck for primitive types */
6932 if (TREE_CODE (something
) == POINTER_TYPE
)
6934 if (TREE_TYPE (something
))
6936 something
= TREE_TYPE (something
);
6937 if (JPRIMITIVE_TYPE_P (something
) || something
== void_type_node
)
6941 something
= TYPE_NAME (something
);
6944 /* Don't do anything for arrays of primitive types */
6945 if (TREE_CODE (something
) == RECORD_TYPE
&& TYPE_ARRAY_P (something
)
6946 && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something
)))
6949 /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
6951 if (TREE_CODE (something
) != IDENTIFIER_NODE
)
6952 something
= (TREE_CODE (TYPE_NAME (something
)) == TYPE_DECL
?
6953 DECL_NAME (TYPE_NAME (something
)) : TYPE_NAME (something
));
6955 if (!(decl
= resolve_no_layout (something
, cl
)))
6958 /* Resolve and layout if necessary */
6959 layout_class_methods (TREE_TYPE (decl
));
6960 /* Check methods, but only once */
6961 if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl
))
6962 && !CLASS_LOADED_P (TREE_TYPE (decl
)))
6963 CHECK_METHODS (decl
);
6964 if (TREE_TYPE (decl
) != current_class
&& !CLASS_LOADED_P (TREE_TYPE (decl
)))
6965 safe_layout_class (TREE_TYPE (decl
));
6970 /* Resolve a class, returns its decl but doesn't perform any
6971 layout. The current parsing context is saved and restored */
6974 resolve_no_layout (name
, cl
)
6978 BUILD_PTR_FROM_NAME (ptr
, name
);
6979 java_parser_context_save_global ();
6980 decl
= resolve_class (ptr
, NULL_TREE
, cl
);
6981 java_parser_context_restore_global ();
6986 /* Called when reporting errors. Skip leader '[' in a complex array
6987 type description that failed to be resolved. */
6990 purify_type_name (name
)
6993 while (*name
&& *name
== '[')
6998 /* The type CURRENT refers to can't be found. We print error messages. */
7001 complete_class_report_errors (dep
)
7006 if (!JDEP_WFL (dep
))
7009 name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
)));
7010 switch (JDEP_KIND (dep
))
7014 (JDEP_WFL (dep
), "Superclass `%s' of class `%s' not found",
7015 purify_type_name (name
),
7016 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7020 (JDEP_WFL (dep
), "Type `%s' not found in declaration of field `%s'",
7021 purify_type_name (name
),
7022 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7024 case JDEP_METHOD
: /* Covers arguments */
7026 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
7027 "argument `%s' of method `%s'",
7028 purify_type_name (name
),
7029 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep
))),
7030 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep
))));
7032 case JDEP_METHOD_RETURN
: /* Covers return type */
7034 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
7035 "return type of method `%s'",
7036 purify_type_name (name
),
7037 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep
))));
7039 case JDEP_INTERFACE
:
7041 (JDEP_WFL (dep
), "Superinterface `%s' of %s `%s' not found",
7042 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
))),
7043 (CLASS_OR_INTERFACE (JDEP_DECL (dep
), "class", "interface")),
7044 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7048 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
7049 "local variable `%s'",
7050 purify_type_name (IDENTIFIER_POINTER
7051 (EXPR_WFL_NODE (JDEP_WFL (dep
)))),
7052 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7054 case JDEP_EXCEPTION
: /* As specified by `throws' */
7056 (JDEP_WFL (dep
), "Class `%s' not found in `throws'",
7057 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
))));
7060 /* Fix for -Wall. Just break doing nothing. The error will be
7066 /* Check uninitialized final. */
7073 /* Return a static string containing the DECL prototype string. If
7074 DECL is a constructor, use the class name instead of the form
7078 get_printable_method_name (decl
)
7081 const char *to_return
;
7082 tree name
= NULL_TREE
;
7084 if (DECL_CONSTRUCTOR_P (decl
))
7086 name
= DECL_NAME (decl
);
7087 DECL_NAME (decl
) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl
)));
7090 to_return
= lang_printable_name (decl
, 0);
7091 if (DECL_CONSTRUCTOR_P (decl
))
7092 DECL_NAME (decl
) = name
;
7097 /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
7098 nevertheless needs to be verfied, 1 otherwise. */
7101 reset_method_name (method
)
7104 if (!IS_CLINIT (method
) && DECL_NAME (method
) != finit_identifier_node
)
7106 /* NAME is just the plain name when Object is being defined */
7107 if (DECL_CONTEXT (method
) != object_type_node
)
7108 DECL_NAME (method
) = (DECL_CONSTRUCTOR_P (method
) ?
7109 init_identifier_node
: GET_METHOD_NAME (method
));
7116 /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
7119 java_get_real_method_name (method_decl
)
7122 tree method_name
= DECL_NAME (method_decl
);
7123 if (DECL_CONSTRUCTOR_P (method_decl
))
7124 return init_identifier_node
;
7126 /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
7127 and still can be a constructor. FIXME */
7129 /* Don't confuse method only bearing the name of their class as
7131 else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl
))
7133 && ctxp
->current_parsed_class_un
== EXPR_WFL_NODE (method_name
)
7134 && get_access_flags_from_decl (method_decl
) <= ACC_PROTECTED
7135 && TREE_TYPE (TREE_TYPE (method_decl
)) == void_type_node
)
7136 return init_identifier_node
;
7138 return EXPR_WFL_NODE (method_name
);
7141 /* Track method being redefined inside the same class. As a side
7142 effect, set DECL_NAME to an IDENTIFIER (prior entering this
7143 function it's a FWL, so we can track errors more accurately.) */
7146 check_method_redefinition (class, method
)
7150 tree cl
= DECL_NAME (method
);
7151 tree sig
= TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method
));
7152 /* decl name of artificial <clinit> and $finit$ doesn't need to be
7153 fixed and checked */
7155 /* Reset the method name before running the check. If it returns 1,
7156 the method doesn't need to be verified with respect to method
7157 redeclaration and we return 0 */
7158 if (reset_method_name (method
))
7161 name
= DECL_NAME (method
);
7162 for (redef
= TYPE_METHODS (class); redef
; redef
= TREE_CHAIN (redef
))
7164 if (redef
== method
)
7166 if (DECL_NAME (redef
) == name
7167 && sig
== TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef
)))
7170 (cl
, "Duplicate %s declaration `%s'",
7171 (DECL_CONSTRUCTOR_P (redef
) ? "constructor" : "method"),
7172 get_printable_method_name (redef
));
7180 check_abstract_method_definitions (do_interface
, class_decl
, type
)
7182 tree class_decl
, type
;
7184 tree
class = TREE_TYPE (class_decl
);
7185 tree method
, end_type
;
7187 end_type
= (do_interface
? object_type_node
: type
);
7188 for (method
= TYPE_METHODS (type
); method
; method
= TREE_CHAIN (method
))
7190 tree other_super
, other_method
, method_sig
, method_name
;
7193 if (!METHOD_ABSTRACT (method
) || METHOD_FINAL (method
))
7196 /* Now verify that somewhere in between TYPE and CLASS,
7197 abstract method METHOD gets a non abstract definition
7198 that is inherited by CLASS. */
7200 method_sig
= build_java_signature (TREE_TYPE (method
));
7201 method_name
= DECL_NAME (method
);
7202 if (TREE_CODE (method_name
) == EXPR_WITH_FILE_LOCATION
)
7203 method_name
= EXPR_WFL_NODE (method_name
);
7205 for (other_super
= class; other_super
!= end_type
;
7206 other_super
= CLASSTYPE_SUPER (other_super
))
7208 for (other_method
= TYPE_METHODS (other_super
); other_method
;
7209 other_method
= TREE_CHAIN (other_method
))
7211 tree s
= build_java_signature (TREE_TYPE (other_method
));
7212 tree other_name
= DECL_NAME (other_method
);
7214 if (TREE_CODE (other_name
) == EXPR_WITH_FILE_LOCATION
)
7215 other_name
= EXPR_WFL_NODE (other_name
);
7216 if (!IS_CLINIT (other_method
)
7217 && !DECL_CONSTRUCTOR_P (other_method
)
7218 && method_name
== other_name
&& method_sig
== s
)
7226 /* Report that abstract METHOD didn't find an implementation
7227 that CLASS can use. */
7230 char *t
= xstrdup (lang_printable_name
7231 (TREE_TYPE (TREE_TYPE (method
)), 0));
7232 tree ccn
= DECL_NAME (TYPE_NAME (DECL_CONTEXT (method
)));
7233 tree saved_wfl
= NULL_TREE
;
7235 if (TREE_CODE (DECL_NAME (method
)) == EXPR_WITH_FILE_LOCATION
)
7237 saved_wfl
= DECL_NAME (method
);
7238 DECL_NAME (method
) = EXPR_WFL_NODE (DECL_NAME (method
));
7242 (lookup_cl (class_decl
),
7243 "Class `%s' doesn't define the abstract method `%s %s' from "
7244 "%s `%s'. This method must be defined or %s `%s' must be "
7245 "declared abstract",
7246 IDENTIFIER_POINTER (DECL_NAME (class_decl
)),
7247 t
, lang_printable_name (method
, 0),
7248 (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method
))) ?
7249 "interface" : "class"),
7250 IDENTIFIER_POINTER (ccn
),
7251 (CLASS_INTERFACE (class_decl
) ? "interface" : "class"),
7252 IDENTIFIER_POINTER (DECL_NAME (class_decl
)));
7257 DECL_NAME (method
) = saved_wfl
;
7262 /* Check that CLASS_DECL somehoow implements all inherited abstract
7266 java_check_abstract_method_definitions (class_decl
)
7269 tree
class = TREE_TYPE (class_decl
);
7273 if (CLASS_ABSTRACT (class_decl
))
7276 /* Check for inherited types */
7277 for (super
= CLASSTYPE_SUPER (class); super
!= object_type_node
;
7278 super
= CLASSTYPE_SUPER (super
))
7280 if (!CLASS_ABSTRACT (TYPE_NAME (super
)))
7283 check_abstract_method_definitions (0, class_decl
, super
);
7286 /* Check for implemented interfaces. */
7287 vector
= TYPE_BINFO_BASETYPES (class);
7288 for (i
= 1; i
< TREE_VEC_LENGTH (vector
); i
++)
7290 super
= BINFO_TYPE (TREE_VEC_ELT (vector
, i
));
7291 check_abstract_method_definitions (1, class_decl
, super
);
7295 /* Check all the methods of CLASS_DECL. Methods are first completed
7296 then checked according to regular method existance rules. If no
7297 constructor for CLASS_DECL were encountered, then build its
7301 java_check_regular_methods (class_decl
)
7304 int saw_constructor
= 0;
7306 tree
class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl
));
7307 tree super_class
= CLASSTYPE_SUPER (class);
7308 tree saved_found_wfl
= NULL_TREE
, found
= NULL_TREE
;
7311 /* It is not necessary to check methods defined in java.lang.Object */
7312 if (class == object_type_node
)
7315 if (!TYPE_NVIRTUALS (class))
7316 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7318 /* Should take interfaces into account. FIXME */
7319 for (method
= TYPE_METHODS (class); method
; method
= TREE_CHAIN (method
))
7322 tree method_wfl
= DECL_NAME (method
);
7325 /* If we previously found something and its name was saved,
7327 if (found
&& saved_found_wfl
)
7329 DECL_NAME (found
) = saved_found_wfl
;
7330 saved_found_wfl
= NULL_TREE
;
7333 /* Check for redefinitions */
7334 if (check_method_redefinition (class, method
))
7337 /* If we see one constructor a mark so we don't generate the
7338 default one. Also skip other verifications: constructors
7339 can't be inherited hence hiden or overriden */
7340 if (DECL_CONSTRUCTOR_P (method
))
7342 saw_constructor
= 1;
7346 /* We verify things thrown by the method. They must inherits from
7347 java.lang.Throwable */
7348 for (mthrows
= DECL_FUNCTION_THROWS (method
);
7349 mthrows
; mthrows
= TREE_CHAIN (mthrows
))
7351 if (!inherits_from_p (TREE_VALUE (mthrows
), throwable_type_node
))
7353 (TREE_PURPOSE (mthrows
), "Class `%s' in `throws' clause must be "
7354 "a subclass of class `java.lang.Throwable'",
7356 (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows
)))));
7359 sig
= build_java_argument_signature (TREE_TYPE (method
));
7360 found
= lookup_argument_method (super_class
, DECL_NAME (method
), sig
);
7362 /* Nothing overrides or it's a private method. */
7365 if (METHOD_PRIVATE (found
))
7371 /* If found wasn't verified, it's DECL_NAME won't be set properly.
7372 We set it temporarily for the sake of the error report. */
7373 saved_found_wfl
= DECL_NAME (found
);
7374 reset_method_name (found
);
7376 /* Can't override a method with the same name and different return
7378 if (TREE_TYPE (TREE_TYPE (found
)) != TREE_TYPE (TREE_TYPE (method
)))
7380 char *t
= xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found
)),
7384 "Method `%s' was defined with return type `%s' in class `%s'",
7385 lang_printable_name (found
, 0), t
,
7387 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7391 aflags
= get_access_flags_from_decl (found
);
7392 /* If the method has default, access in an other package, then
7393 issue a warning that the current method doesn't override the
7394 one that was found elsewhere. Do not issue this warning when
7395 the match was found in java.lang.Object. */
7396 if (DECL_CONTEXT (found
) != object_type_node
7397 && ((aflags
& 0x7) == 0)
7398 && !class_in_current_package (DECL_CONTEXT (found
))
7399 && DECL_NAME (found
) != clinit_identifier_node
7400 && flag_not_overriding
)
7402 parse_warning_context
7403 (method_wfl
, "Method `%s' in class `%s' does not "
7404 "override the corresponding method in class `%s', which is "
7405 "private to a different package",
7406 lang_printable_name (found
, 0),
7407 IDENTIFIER_POINTER (DECL_NAME (class_decl
)),
7408 IDENTIFIER_POINTER (DECL_NAME
7409 (TYPE_NAME (DECL_CONTEXT (found
)))));
7413 /* Can't override final. Can't override static. */
7414 if (METHOD_FINAL (found
) || METHOD_STATIC (found
))
7416 /* Static *can* override static */
7417 if (METHOD_STATIC (found
) && METHOD_STATIC (method
))
7421 "%s methods can't be overriden. Method `%s' is %s in class `%s'",
7422 (METHOD_FINAL (found
) ? "Final" : "Static"),
7423 lang_printable_name (found
, 0),
7424 (METHOD_FINAL (found
) ? "final" : "static"),
7426 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7430 /* Static method can't override instance method. */
7431 if (METHOD_STATIC (method
))
7435 "Instance methods can't be overriden by a static method. Method "
7436 "`%s' is an instance method in class `%s'",
7437 lang_printable_name (found
, 0),
7439 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7443 /* - Overriding/hiding public must be public
7444 - Overriding/hiding protected must be protected or public
7445 - If the overriden or hidden method has default (package)
7446 access, then the overriding or hiding method must not be
7447 private; otherwise, a compile-time error occurs */
7448 if ((METHOD_PUBLIC (found
) && !METHOD_PUBLIC (method
))
7449 || (METHOD_PROTECTED (found
)
7450 && !(METHOD_PUBLIC (method
) || METHOD_PROTECTED (method
)))
7451 || (!(aflags
& (ACC_PUBLIC
| ACC_PRIVATE
| ACC_STATIC
))
7452 && METHOD_PRIVATE (method
)))
7456 "Methods can't be overridden to be more private. Method `%s' is "
7457 "not %s in class `%s'", lang_printable_name (method
, 0),
7458 (METHOD_PUBLIC (method
) ? "public" :
7459 (METHOD_PRIVATE (method
) ? "private" : "protected")),
7460 IDENTIFIER_POINTER (DECL_NAME
7461 (TYPE_NAME (DECL_CONTEXT (found
)))));
7465 /* Overriding methods must have compatible `throws' clauses on checked
7466 exceptions, if any */
7467 check_throws_clauses (method
, method_wfl
, found
);
7469 /* Inheriting multiple methods with the same signature. FIXME */
7472 /* Don't forget eventual pending found and saved_found_wfl. Take
7473 into account that we might have exited because we saw an
7474 artificial method as the last entry. */
7476 if (found
&& !DECL_ARTIFICIAL (found
) && saved_found_wfl
)
7477 DECL_NAME (found
) = saved_found_wfl
;
7479 if (!TYPE_NVIRTUALS (class))
7480 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7482 /* Search for inherited abstract method not yet implemented in this
7484 java_check_abstract_method_definitions (class_decl
);
7486 if (!saw_constructor
)
7488 /* No constructor seen, we craft one, at line 0. Since this
7489 operation takes place after we laid methods out
7490 (layout_class_methods), we prepare the its DECL
7495 /* If the class is declared PUBLIC, the default constructor is
7496 PUBLIC otherwise it has default access implied by no access
7498 flags
= (get_access_flags_from_decl (class_decl
) & ACC_PUBLIC
?
7500 decl
= create_artificial_method (class, flags
, void_type_node
,
7501 init_identifier_node
, end_params_node
);
7502 DECL_CONSTRUCTOR_P (decl
) = 1;
7503 layout_class_method (TREE_TYPE (class_decl
), NULL_TREE
, decl
, NULL_TREE
);
7507 /* Return a non zero value if the `throws' clause of METHOD (if any)
7508 is incompatible with the `throws' clause of FOUND (if any). */
7511 check_throws_clauses (method
, method_wfl
, found
)
7512 tree method
, method_wfl
, found
;
7514 tree mthrows
, fthrows
;
7516 /* Can't check these things with class loaded from bytecode. FIXME */
7517 if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found
)))
7520 for (mthrows
= DECL_FUNCTION_THROWS (method
);
7521 mthrows
; mthrows
= TREE_CHAIN (mthrows
))
7523 /* We don't verify unchecked expressions */
7524 if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows
)))
7526 /* Checked expression must be compatible */
7527 for (fthrows
= DECL_FUNCTION_THROWS (found
);
7528 fthrows
; fthrows
= TREE_CHAIN (fthrows
))
7529 if (inherits_from_p (TREE_VALUE (mthrows
), TREE_VALUE (fthrows
)))
7534 (method_wfl
, "Invalid checked exception class `%s' in "
7535 "`throws' clause. The exception must be a subclass of an "
7536 "exception thrown by `%s' from class `%s'",
7537 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows
)))),
7538 lang_printable_name (found
, 0),
7540 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7545 /* Check abstract method of interface INTERFACE */
7548 java_check_abstract_methods (interface_decl
)
7549 tree interface_decl
;
7552 tree method
, basetype_vec
, found
;
7553 tree interface
= TREE_TYPE (interface_decl
);
7555 for (method
= TYPE_METHODS (interface
); method
; method
= TREE_CHAIN (method
))
7557 tree method_wfl
= DECL_NAME (method
);
7559 /* 2- Check for double definition inside the defining interface */
7560 if (check_method_redefinition (interface
, method
))
7563 /* 3- Overriding is OK as far as we preserve the return type and
7564 the thrown exceptions (FIXME) */
7565 found
= lookup_java_interface_method2 (interface
, method
);
7569 tree saved_found_wfl
= DECL_NAME (found
);
7570 reset_method_name (found
);
7571 t
= xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found
)), 0));
7574 "Method `%s' was defined with return type `%s' in class `%s'",
7575 lang_printable_name (found
, 0), t
,
7577 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7581 DECL_NAME (found
) = saved_found_wfl
;
7585 /* 4- Inherited methods can't differ by their returned types */
7586 if (!(basetype_vec
= TYPE_BINFO_BASETYPES (interface
)))
7588 n
= TREE_VEC_LENGTH (basetype_vec
);
7589 for (i
= 0; i
< n
; i
++)
7591 tree sub_interface_method
, sub_interface
;
7592 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
);
7595 sub_interface
= BINFO_TYPE (vec_elt
);
7596 for (sub_interface_method
= TYPE_METHODS (sub_interface
);
7597 sub_interface_method
;
7598 sub_interface_method
= TREE_CHAIN (sub_interface_method
))
7600 found
= lookup_java_interface_method2 (interface
,
7601 sub_interface_method
);
7602 if (found
&& (found
!= sub_interface_method
))
7604 tree saved_found_wfl
= DECL_NAME (found
);
7605 reset_method_name (found
);
7607 (lookup_cl (sub_interface_method
),
7608 "Interface `%s' inherits method `%s' from interface `%s'. "
7609 "This method is redefined with a different return type in "
7611 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface
))),
7612 lang_printable_name (found
, 0),
7614 (DECL_NAME (TYPE_NAME
7615 (DECL_CONTEXT (sub_interface_method
)))),
7617 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7618 DECL_NAME (found
) = saved_found_wfl
;
7624 /* Lookup methods in interfaces using their name and partial
7625 signature. Return a matching method only if their types differ. */
7628 lookup_java_interface_method2 (class, method_decl
)
7629 tree
class, method_decl
;
7632 tree basetype_vec
= TYPE_BINFO_BASETYPES (class), to_return
;
7637 n
= TREE_VEC_LENGTH (basetype_vec
);
7638 for (i
= 0; i
< n
; i
++)
7640 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
), to_return
;
7641 if ((BINFO_TYPE (vec_elt
) != object_type_node
)
7643 lookup_java_method2 (BINFO_TYPE (vec_elt
), method_decl
, 1)))
7646 for (i
= 0; i
< n
; i
++)
7648 to_return
= lookup_java_interface_method2
7649 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec
, i
)), method_decl
);
7657 /* Lookup method using their name and partial signature. Return a
7658 matching method only if their types differ. */
7661 lookup_java_method2 (clas
, method_decl
, do_interface
)
7662 tree clas
, method_decl
;
7665 tree method
, method_signature
, method_name
, method_type
, name
;
7667 method_signature
= build_java_argument_signature (TREE_TYPE (method_decl
));
7668 name
= DECL_NAME (method_decl
);
7669 method_name
= (TREE_CODE (name
) == EXPR_WITH_FILE_LOCATION
?
7670 EXPR_WFL_NODE (name
) : name
);
7671 method_type
= TREE_TYPE (TREE_TYPE (method_decl
));
7673 while (clas
!= NULL_TREE
)
7675 for (method
= TYPE_METHODS (clas
);
7676 method
!= NULL_TREE
; method
= TREE_CHAIN (method
))
7678 tree method_sig
= build_java_argument_signature (TREE_TYPE (method
));
7679 tree name
= DECL_NAME (method
);
7680 if ((TREE_CODE (name
) == EXPR_WITH_FILE_LOCATION
?
7681 EXPR_WFL_NODE (name
) : name
) == method_name
7682 && method_sig
== method_signature
7683 && TREE_TYPE (TREE_TYPE (method
)) != method_type
)
7686 clas
= (do_interface
? NULL_TREE
: CLASSTYPE_SUPER (clas
));
7691 /* Return the line that matches DECL line number, and try its best to
7692 position the column number. Used during error reports. */
7698 static tree cl
= NULL_TREE
;
7704 if (cl
== NULL_TREE
)
7705 cl
= build_expr_wfl (NULL_TREE
, NULL
, 0, 0);
7707 EXPR_WFL_FILENAME_NODE (cl
) = get_identifier (DECL_SOURCE_FILE (decl
));
7708 EXPR_WFL_SET_LINECOL (cl
, DECL_SOURCE_LINE_FIRST (decl
), -1);
7710 line
= java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl
)),
7711 EXPR_WFL_LINENO (cl
), EXPR_WFL_COLNO (cl
));
7713 found
= strstr ((const char *)line
,
7714 (const char *)IDENTIFIER_POINTER (DECL_NAME (decl
)));
7716 EXPR_WFL_SET_LINECOL (cl
, EXPR_WFL_LINENO (cl
), found
- line
);
7721 /* Look for a simple name in the single-type import list */
7724 find_name_in_single_imports (name
)
7729 for (node
= ctxp
->import_list
; node
; node
= TREE_CHAIN (node
))
7730 if (TREE_VALUE (node
) == name
)
7731 return (EXPR_WFL_NODE (TREE_PURPOSE (node
)));
7736 /* Process all single-type import. */
7744 for (import
= ctxp
->import_list
; import
; import
= TREE_CHAIN (import
))
7746 tree to_be_found
= EXPR_WFL_NODE (TREE_PURPOSE (import
));
7748 /* Don't load twice something already defined. */
7749 if (IDENTIFIER_CLASS_VALUE (to_be_found
))
7751 QUALIFIED_P (to_be_found
) = 1;
7752 load_class (to_be_found
, 0);
7754 check_pkg_class_access (to_be_found
, TREE_PURPOSE (import
));
7755 if (!IDENTIFIER_CLASS_VALUE (to_be_found
))
7757 parse_error_context (TREE_PURPOSE (import
),
7758 "Class or interface `%s' not found in import",
7759 IDENTIFIER_POINTER (to_be_found
));
7768 /* Possibly find a class imported by a single-type import statement. Return
7769 1 if an error occured, 0 otherwise. */
7772 find_in_imports (class_type
)
7777 for (import
= ctxp
->import_list
; import
; import
= TREE_CHAIN (import
))
7778 if (TREE_VALUE (import
) == TYPE_NAME (class_type
))
7780 TYPE_NAME (class_type
) = EXPR_WFL_NODE (TREE_PURPOSE (import
));
7781 QUALIFIED_P (TYPE_NAME (class_type
)) = 1;
7787 note_possible_classname (name
, len
)
7792 if (len
> 5 && strncmp (&name
[len
-5], ".java", 5) == 0)
7794 else if (len
> 6 && strncmp (&name
[len
-6], ".class", 6) == 0)
7798 node
= ident_subst (name
, len
, "", '/', '.', "");
7799 IS_A_CLASSFILE_NAME (node
) = 1; /* Or soon to be */
7800 QUALIFIED_P (node
) = strchr (name
, '/') ? 1 : 0;
7804 /* Read a import directory, gathering potential match for further type
7805 references. Indifferently reads a filesystem or a ZIP archive
7809 read_import_dir (wfl
)
7812 tree package_id
= EXPR_WFL_NODE (wfl
);
7813 const char *package_name
= IDENTIFIER_POINTER (package_id
);
7814 int package_length
= IDENTIFIER_LENGTH (package_id
);
7816 JCF
*saved_jcf
= current_jcf
;
7821 struct buffer filename
[1];
7824 if (IS_AN_IMPORT_ON_DEMAND_P (package_id
))
7826 IS_AN_IMPORT_ON_DEMAND_P (package_id
) = 1;
7828 BUFFER_INIT (filename
);
7829 buffer_grow (filename
, package_length
+ 100);
7831 for (entry
= jcf_path_start (); entry
!= NULL
; entry
= jcf_path_next (entry
))
7833 const char *entry_name
= jcf_path_name (entry
);
7834 int entry_length
= strlen (entry_name
);
7835 if (jcf_path_is_zipfile (entry
))
7838 buffer_grow (filename
, entry_length
);
7839 memcpy (filename
->data
, entry_name
, entry_length
- 1);
7840 filename
->data
[entry_length
-1] = '\0';
7841 zipf
= opendir_in_zip (filename
->data
, jcf_path_is_system (entry
));
7843 error ("malformed .zip archive in CLASSPATH: %s", entry_name
);
7846 ZipDirectory
*zipd
= (ZipDirectory
*) zipf
->central_directory
;
7847 BUFFER_RESET (filename
);
7848 for (k
= 0; k
< package_length
; k
++)
7850 char ch
= package_name
[k
];
7851 *filename
->ptr
++ = ch
== '.' ? '/' : ch
;
7853 *filename
->ptr
++ = '/';
7855 for (k
= 0; k
< zipf
->count
; k
++, zipd
= ZIPDIR_NEXT (zipd
))
7857 const char *current_entry
= ZIPDIR_FILENAME (zipd
);
7858 int current_entry_len
= zipd
->filename_length
;
7860 if (current_entry_len
>= BUFFER_LENGTH (filename
)
7861 && strncmp (filename
->data
, current_entry
,
7862 BUFFER_LENGTH (filename
)) != 0)
7864 found
|= note_possible_classname (current_entry
,
7871 BUFFER_RESET (filename
);
7872 buffer_grow (filename
, entry_length
+ package_length
+ 4);
7873 strcpy (filename
->data
, entry_name
);
7874 filename
->ptr
= filename
->data
+ entry_length
;
7875 for (k
= 0; k
< package_length
; k
++)
7877 char ch
= package_name
[k
];
7878 *filename
->ptr
++ = ch
== '.' ? '/' : ch
;
7880 *filename
->ptr
= '\0';
7882 dirp
= opendir (filename
->data
);
7885 *filename
->ptr
++ = '/';
7890 struct dirent
*direntp
= readdir (dirp
);
7893 d_name
= direntp
->d_name
;
7894 len
= strlen (direntp
->d_name
);
7895 buffer_grow (filename
, len
+1);
7896 strcpy (filename
->ptr
, d_name
);
7897 found
|= note_possible_classname (filename
->data
+ entry_length
,
7898 package_length
+len
+1);
7905 free (filename
->data
);
7907 /* Here we should have a unified way of retrieving an entry, to be
7911 static int first
= 1;
7914 error ("Can't find default package `%s'. Check "
7915 "the CLASSPATH environment variable and the access to the "
7916 "archives.", package_name
);
7921 parse_error_context (wfl
, "Package `%s' not found in import",
7923 current_jcf
= saved_jcf
;
7926 current_jcf
= saved_jcf
;
7929 /* Possibly find a type in the import on demands specified
7930 types. Returns 1 if an error occured, 0 otherwise. Run throught the
7931 entire list, to detected potential double definitions. */
7934 find_in_imports_on_demand (class_type
)
7937 tree node
, import
, node_to_use
= NULL_TREE
;
7939 tree cl
= NULL_TREE
;
7941 for (import
= ctxp
->import_demand_list
; import
; import
= TREE_CHAIN (import
))
7943 const char *id_name
;
7944 obstack_grow (&temporary_obstack
,
7945 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import
))),
7946 IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import
))));
7947 obstack_1grow (&temporary_obstack
, '.');
7948 obstack_grow0 (&temporary_obstack
,
7949 IDENTIFIER_POINTER (TYPE_NAME (class_type
)),
7950 IDENTIFIER_LENGTH (TYPE_NAME (class_type
)));
7951 id_name
= obstack_finish (&temporary_obstack
);
7953 node
= maybe_get_identifier (id_name
);
7954 if (node
&& IS_A_CLASSFILE_NAME (node
))
7958 cl
= TREE_PURPOSE (import
);
7966 (import
, "Type `%s' also potentially defined in package `%s'",
7967 IDENTIFIER_POINTER (TYPE_NAME (class_type
)),
7968 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import
))));
7975 /* Setup lineno so that it refers to the line of the import (in
7976 case we parse a class file and encounter errors */
7978 int saved_lineno
= lineno
;
7979 lineno
= EXPR_WFL_LINENO (cl
);
7980 TYPE_NAME (class_type
) = node_to_use
;
7981 QUALIFIED_P (TYPE_NAME (class_type
)) = 1;
7982 decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
7983 /* If there is no DECL set for the class or if the class isn't
7984 loaded and not seen in source yet, the load */
7985 if (!decl
|| (!CLASS_LOADED_P (TREE_TYPE (decl
))
7986 && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl
))))
7987 load_class (node_to_use
, 0);
7988 lineno
= saved_lineno
;
7989 return check_pkg_class_access (TYPE_NAME (class_type
), cl
);
7992 return (seen_once
< 0 ? 0 : seen_once
); /* It's ok not to have found */
7996 resolve_package (pkg
, next
)
8000 tree type_name
= NULL_TREE
;
8001 const char *name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg
));
8003 /* The trick is to determine when the package name stops and were
8004 the name of something contained in the package starts. Then we
8005 return a fully qualified name of what we want to get. */
8007 /* Do a quick search on well known package names */
8008 if (!strncmp (name
, "java.lang.reflect", 17))
8011 TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg
))));
8012 type_name
= lookup_package_type (name
, 17);
8014 else if (!strncmp (name
, "java.lang", 9))
8016 *next
= TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg
)));
8017 type_name
= lookup_package_type (name
, 9);
8020 /* If we found something here, return */
8024 *next
= EXPR_WFL_QUALIFICATION (pkg
);
8026 /* Try the current package. */
8027 if (ctxp
->package
&& !strncmp (name
, IDENTIFIER_POINTER (ctxp
->package
),
8028 IDENTIFIER_LENGTH (ctxp
->package
)))
8031 lookup_package_type_and_set_next (name
,
8032 IDENTIFIER_LENGTH (ctxp
->package
),
8038 /* Search in imported package */
8039 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
8041 tree current_pkg_name
= EXPR_WFL_NODE (TREE_PURPOSE (current
));
8042 int len
= IDENTIFIER_LENGTH (current_pkg_name
);
8043 if (!strncmp (name
, IDENTIFIER_POINTER (current_pkg_name
), len
))
8047 breakdown_qualified (&left
, &dummy
, current_pkg_name
);
8048 len
= IDENTIFIER_LENGTH (left
);
8049 type_name
= lookup_package_type_and_set_next (name
, len
, next
);
8059 lookup_package_type_and_set_next (name
, len
, next
)
8065 tree type_name
= lookup_package_type (name
, len
);
8070 ptr
= IDENTIFIER_POINTER (type_name
);
8071 while (ptr
&& (ptr
= strchr (ptr
, '.')))
8073 *next
= TREE_CHAIN (*next
);
8080 lookup_package_type (name
, from
)
8085 const char *sub
= &name
[from
+1];
8086 while (*sub
!= '.' && *sub
)
8088 strncpy (subname
, name
, sub
-name
);
8089 subname
[sub
-name
] = '\0';
8090 return get_identifier (subname
);
8093 /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
8094 access violations were found, 1 otherwise. */
8097 check_pkg_class_access (class_name
, cl
)
8103 if (!QUALIFIED_P (class_name
) || !IDENTIFIER_CLASS_VALUE (class_name
))
8106 if (!(type
= TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name
))))
8109 if (!CLASS_PUBLIC (TYPE_NAME (type
)))
8111 /* Access to a private class within the same package is
8114 breakdown_qualified (&l
, &r
, class_name
);
8115 if (l
== ctxp
->package
)
8119 (cl
, "Can't access %s `%s'. Only public classes and interfaces in "
8120 "other packages can be accessed",
8121 (CLASS_INTERFACE (TYPE_NAME (type
)) ? "interface" : "class"),
8122 IDENTIFIER_POINTER (class_name
));
8128 /* Local variable declaration. */
8131 declare_local_variables (modifier
, type
, vlist
)
8136 tree decl
, current
, saved_type
;
8137 tree type_wfl
= NULL_TREE
;
8140 /* Push a new block if statements were seen between the last time we
8141 pushed a block and now. Keep a cound of block to close */
8142 if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl
)))
8144 tree body
= GET_CURRENT_BLOCK (current_function_decl
);
8145 tree b
= enter_block ();
8146 BLOCK_EXPR_ORIGIN (b
) = body
;
8152 for (i
= 0; i
<= 10; i
++) if (1 << i
& modifier
) break;
8153 if (modifier
== ACC_FINAL
)
8155 if (flag_static_local_jdk1_1
)
8156 parse_warning_context (ctxp
->modifier_ctx
[i
],
8157 "Unsupported JDK1.1 `final' local variable "
8158 "(treated as non final)");
8163 (ctxp
->modifier_ctx
[i
],
8164 "Only `final' is allowed as a local variables modifier");
8169 /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
8170 hold the TYPE value if a new incomplete has to be created (as
8171 opposed to being found already existing and reused). */
8172 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
8174 /* If TYPE is fully resolved and we don't have a reference, make one */
8175 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
8177 /* Go through all the declared variables */
8178 for (current
= vlist
, saved_type
= type
; current
;
8179 current
= TREE_CHAIN (current
), type
= saved_type
)
8181 tree other
, real_type
;
8182 tree wfl
= TREE_PURPOSE (current
);
8183 tree name
= EXPR_WFL_NODE (wfl
);
8184 tree init
= TREE_VALUE (current
);
8186 /* Process NAME, as it may specify extra dimension(s) for it */
8187 type
= build_array_from_name (type
, type_wfl
, name
, &name
);
8189 /* Variable redefinition check */
8190 if ((other
= lookup_name_in_blocks (name
)))
8192 variable_redefinition_error (wfl
, name
, TREE_TYPE (other
),
8193 DECL_SOURCE_LINE (other
));
8197 /* Type adjustment. We may have just readjusted TYPE because
8198 the variable specified more dimensions. Make sure we have
8199 a reference if we can and don't have one already. */
8200 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
8202 real_type
= GET_REAL_TYPE (type
);
8203 /* Never layout this decl. This will be done when its scope
8205 decl
= build_decl (VAR_DECL
, name
, real_type
);
8206 BLOCK_CHAIN_DECL (decl
);
8208 /* If doing xreferencing, replace the line number with the WFL
8211 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINECOL (wfl
);
8213 /* Don't try to use an INIT statement when an error was found */
8214 if (init
&& java_error_count
)
8217 /* Add the initialization function to the current function's code */
8220 /* Name might have been readjusted */
8221 EXPR_WFL_NODE (TREE_OPERAND (init
, 0)) = name
;
8222 MODIFY_EXPR_FROM_INITIALIZATION_P (init
) = 1;
8223 java_method_add_stmt (current_function_decl
,
8224 build_debugable_stmt (EXPR_WFL_LINECOL (init
),
8228 /* Setup dependency the type of the decl */
8232 register_incomplete_type (JDEP_VARIABLE
, type_wfl
, decl
, type
);
8233 dep
= CLASSD_LAST (ctxp
->classd_list
);
8234 JDEP_GET_PATCH (dep
) = &TREE_TYPE (decl
);
8237 SOURCE_FRONTEND_DEBUG (("Defined locals"));
8240 /* Called during parsing. Build decls from argument list. */
8243 source_start_java_method (fndecl
)
8253 current_function_decl
= fndecl
;
8255 /* New scope for the function */
8257 for (tem
= TYPE_ARG_TYPES (TREE_TYPE (fndecl
)), i
= 0;
8258 tem
!= end_params_node
; tem
= TREE_CHAIN (tem
), i
++)
8260 tree type
= TREE_VALUE (tem
);
8261 tree name
= TREE_PURPOSE (tem
);
8263 /* If type is incomplete. Create an incomplete decl and ask for
8264 the decl to be patched later */
8265 if (INCOMPLETE_TYPE_P (type
))
8268 tree real_type
= GET_REAL_TYPE (type
);
8269 parm_decl
= build_decl (PARM_DECL
, name
, real_type
);
8270 type
= obtain_incomplete_type (type
);
8271 register_incomplete_type (JDEP_PARM
, NULL_TREE
, NULL_TREE
, type
);
8272 jdep
= CLASSD_LAST (ctxp
->classd_list
);
8273 JDEP_MISC (jdep
) = name
;
8274 JDEP_GET_PATCH (jdep
) = &TREE_TYPE (parm_decl
);
8277 parm_decl
= build_decl (PARM_DECL
, name
, type
);
8279 BLOCK_CHAIN_DECL (parm_decl
);
8281 tem
= BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
));
8282 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
)) =
8284 DECL_ARG_SLOT_COUNT (current_function_decl
) = i
;
8287 /* Called during parsing. Creates an artificial method declaration. */
8290 create_artificial_method (class, flags
, type
, name
, args
)
8293 tree type
, name
, args
;
8295 int saved_lineno
= lineno
;
8299 mdecl
= make_node (FUNCTION_TYPE
);
8300 TREE_TYPE (mdecl
) = type
;
8301 TYPE_ARG_TYPES (mdecl
) = args
;
8302 mdecl
= add_method (class, flags
, name
, build_java_signature (mdecl
));
8303 lineno
= saved_lineno
;
8304 DECL_ARTIFICIAL (mdecl
) = 1;
8308 /* Starts the body if an artifical method. */
8311 start_artificial_method_body (mdecl
)
8314 DECL_SOURCE_LINE (mdecl
) = 1;
8315 DECL_SOURCE_LINE_MERGE (mdecl
, 1);
8316 source_start_java_method (mdecl
);
8321 end_artificial_method_body (mdecl
)
8324 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl
)) = exit_block ();
8328 /* Called during expansion. Push decls formerly built from argument
8329 list so they're usable during expansion. */
8332 expand_start_java_method (fndecl
)
8337 current_function_decl
= fndecl
;
8339 announce_function (fndecl
);
8340 pushlevel (1); /* Push parameters */
8341 ptr
= &DECL_ARGUMENTS (fndecl
);
8342 tem
= BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
));
8345 tree next
= TREE_CHAIN (tem
);
8346 tree type
= TREE_TYPE (tem
);
8347 if (PROMOTE_PROTOTYPES
8348 && TYPE_PRECISION (type
) < TYPE_PRECISION (integer_type_node
)
8349 && INTEGRAL_TYPE_P (type
))
8350 type
= integer_type_node
;
8351 DECL_ARG_TYPE (tem
) = type
;
8352 layout_decl (tem
, 0);
8355 ptr
= &TREE_CHAIN (tem
);
8359 pushdecl_force_head (DECL_ARGUMENTS (fndecl
));
8360 lineno
= DECL_SOURCE_LINE_FIRST (fndecl
);
8363 /* Terminate a function and expand its body. */
8366 source_end_java_method ()
8368 tree fndecl
= current_function_decl
;
8369 int flag_asynchronous_exceptions
= asynchronous_exceptions
;
8374 java_parser_context_save_global ();
8375 lineno
= ctxp
->last_ccb_indent1
;
8377 /* Set EH language codes */
8378 java_set_exception_lang_code ();
8380 /* Turn function bodies with only a NOP expr null, so they don't get
8381 generated at all and we won't get warnings when using the -W
8383 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)) == empty_stmt_node
)
8384 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)) = NULL_TREE
;
8386 /* Generate function's code */
8387 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
))
8388 && ! flag_emit_class_files
8389 && ! flag_emit_xref
)
8390 expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)));
8392 /* pop out of its parameters */
8393 pushdecl_force_head (DECL_ARGUMENTS (fndecl
));
8395 BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl
)) = fndecl
;
8397 /* Generate rtl for function exit. */
8398 if (! flag_emit_class_files
&& ! flag_emit_xref
)
8400 lineno
= DECL_SOURCE_LINE_LAST (fndecl
);
8401 /* Emit catch-finally clauses */
8403 expand_function_end (input_filename
, lineno
, 0);
8405 /* FIXME: If the current method contains any exception handlers,
8406 force asynchronous_exceptions: this is necessary because signal
8407 handlers in libjava may throw exceptions. This is far from being
8408 a perfect solution, but it's better than doing nothing at all.*/
8410 asynchronous_exceptions
= 1;
8412 /* Run the optimizers and output assembler code for this function. */
8413 rest_of_compilation (fndecl
);
8416 current_function_decl
= NULL_TREE
;
8417 /* permanent_allocation (1); */
8418 java_parser_context_restore_global ();
8419 asynchronous_exceptions
= flag_asynchronous_exceptions
;
8422 /* Record EXPR in the current function block. Complements compound
8423 expression second operand if necessary. */
8426 java_method_add_stmt (fndecl
, expr
)
8429 if (!GET_CURRENT_BLOCK (fndecl
))
8431 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl
), NULL_TREE
, expr
);
8435 add_stmt_to_block (b
, type
, stmt
)
8438 tree body
= BLOCK_EXPR_BODY (b
), c
;
8440 if (java_error_count
)
8443 if ((c
= add_stmt_to_compound (body
, type
, stmt
)) == body
)
8446 BLOCK_EXPR_BODY (b
) = c
;
8447 TREE_SIDE_EFFECTS (c
) = 1;
8451 /* Add STMT to EXISTING if possible, otherwise create a new
8452 COMPOUND_EXPR and add STMT to it. */
8455 add_stmt_to_compound (existing
, type
, stmt
)
8456 tree existing
, type
, stmt
;
8459 return build (COMPOUND_EXPR
, type
, existing
, stmt
);
8464 /* Hold THIS for the scope of the current public method decl. */
8465 static tree current_this
;
8467 void java_layout_seen_class_methods ()
8469 tree previous_list
= all_class_list
;
8470 tree end
= NULL_TREE
;
8475 for (current
= previous_list
;
8476 current
!= end
; current
= TREE_CHAIN (current
))
8477 layout_class_methods (TREE_TYPE (TREE_VALUE (current
)));
8479 if (previous_list
!= all_class_list
)
8481 end
= previous_list
;
8482 previous_list
= all_class_list
;
8489 /* Layout the methods of all classes loaded in one way on an
8490 other. Check methods of source parsed classes. Then reorder the
8491 fields and layout the classes or the type of all source parsed
8495 java_layout_classes ()
8498 int save_error_count
= java_error_count
;
8500 /* Layout the methods of all classes seen so far */
8501 java_layout_seen_class_methods ();
8502 java_parse_abort_on_error ();
8503 all_class_list
= NULL_TREE
;
8505 /* Then check the methods of all parsed classes */
8506 for (current
= ctxp
->gclass_list
; current
; current
= TREE_CHAIN (current
))
8507 if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current
))))
8508 CHECK_METHODS (TREE_VALUE (current
));
8509 java_parse_abort_on_error ();
8511 for (current
= ctxp
->gclass_list
; current
; current
= TREE_CHAIN (current
))
8513 current_class
= TREE_TYPE (TREE_VALUE (current
));
8515 /* Reverse the fields, but leave the dummy field in front.
8516 Fields are already ordered for Object and Class */
8517 if (TYPE_FIELDS (current_class
) && current_class
!= object_type_node
8518 && current_class
!= class_type_node
)
8520 /* If the dummy field is there, reverse the right fields and
8521 just layout the type for proper fields offset */
8522 if (!DECL_NAME (TYPE_FIELDS (current_class
)))
8524 tree fields
= TYPE_FIELDS (current_class
);
8525 TREE_CHAIN (fields
) = nreverse (TREE_CHAIN (fields
));
8526 TYPE_SIZE (current_class
) = NULL_TREE
;
8527 layout_type (current_class
);
8529 /* We don't have a dummy field, we need to layout the class,
8530 after having reversed the fields */
8533 TYPE_FIELDS (current_class
) =
8534 nreverse (TYPE_FIELDS (current_class
));
8535 TYPE_SIZE (current_class
) = NULL_TREE
;
8536 layout_class (current_class
);
8540 layout_class (current_class
);
8542 /* From now on, the class is considered completely loaded */
8543 CLASS_LOADED_P (current_class
) = 1;
8545 /* Error reported by the caller */
8546 if (java_error_count
)
8550 /* We might have reloaded classes durign the process of laying out
8551 classes for code generation. We must layout the methods of those
8552 late additions, as constructor checks might use them */
8553 java_layout_seen_class_methods ();
8554 java_parse_abort_on_error ();
8557 /* Expand all methods in all registered classes. */
8560 java_complete_expand_methods ()
8564 do_not_fold
= flag_emit_xref
;
8566 for (current
= ctxp
->class_list
; current
; current
= TREE_CHAIN (current
))
8569 tree class_type
= CLASS_TO_HANDLE_TYPE (TREE_TYPE (current
));
8572 current_class
= TREE_TYPE (current
);
8573 is_interface
= CLASS_INTERFACE (TYPE_NAME (current_class
));
8575 /* Initialize a new constant pool */
8576 init_outgoing_cpool ();
8578 /* We want <clinit> (if any) to be processed first. */
8579 decl
= tree_last (TYPE_METHODS (class_type
));
8580 if (IS_CLINIT (decl
))
8582 tree fbody
= DECL_FUNCTION_BODY (decl
);
8584 if (fbody
!= NULL_TREE
)
8586 /* First check if we can ignore empty <clinit> */
8587 tree block_body
= BLOCK_EXPR_BODY (fbody
);
8589 current_this
= NULL_TREE
;
8590 current_function_decl
= decl
;
8591 if (block_body
!= NULL_TREE
)
8593 /* Prevent the use of `this' inside <clinit> */
8594 ctxp
->explicit_constructor_p
= 1;
8596 block_body
= java_complete_tree (block_body
);
8597 ctxp
->explicit_constructor_p
= 0;
8598 BLOCK_EXPR_BODY (fbody
) = block_body
;
8599 if (block_body
!= NULL_TREE
8600 && TREE_CODE (block_body
) == BLOCK
8601 && BLOCK_EXPR_BODY (block_body
) == empty_stmt_node
)
8605 list
= nreverse (TREE_CHAIN (nreverse (TYPE_METHODS (class_type
))));
8606 if (decl
!= NULL_TREE
)
8608 TREE_CHAIN (decl
) = list
;
8609 TYPE_METHODS (class_type
) = decl
;
8612 TYPE_METHODS (class_type
) = list
;
8615 for (decl
= TYPE_METHODS (class_type
); decl
; decl
= TREE_CHAIN (decl
))
8617 current_function_decl
= decl
;
8618 /* Don't generate debug info on line zero when expanding a
8619 generated constructor. */
8620 if (DECL_CONSTRUCTOR_P (decl
) && !DECL_FUNCTION_BODY (decl
))
8622 /* If we found errors, it's too dangerous to try to
8623 generate and expand a constructor */
8624 if (!java_error_count
)
8626 restore_line_number_status (1);
8627 java_complete_expand_method (decl
);
8628 restore_line_number_status (0);
8631 else if (METHOD_ABSTRACT (decl
) || METHOD_NATIVE (decl
))
8634 java_complete_expand_method (decl
);
8637 /* Now verify constructor circularity (stop after the first one
8640 for (decl
= TYPE_METHODS (class_type
); decl
; decl
= TREE_CHAIN (decl
))
8641 if (DECL_CONSTRUCTOR_P (decl
) &&
8642 verify_constructor_circularity (decl
, decl
))
8645 /* Make the class data, register it and run the rest of decl
8646 compilation on it */
8647 if (!java_error_count
)
8649 if (flag_emit_class_files
)
8650 write_classfile (current_class
);
8652 expand_xref (current_class
);
8653 else if (! flag_syntax_only
)
8659 /* Hold a list of catch clauses list. The first element of this list is
8660 the list of the catch clauses of the currently analysed try block. */
8661 static tree currently_caught_type_list
;
8663 /* Complete and expand a method. */
8666 java_complete_expand_method (mdecl
)
8669 /* Fix constructors before expanding them */
8670 if (DECL_CONSTRUCTOR_P (mdecl
))
8671 fix_constructors (mdecl
);
8673 /* Expand functions that have a body */
8674 if (DECL_FUNCTION_BODY (mdecl
))
8676 tree fbody
= DECL_FUNCTION_BODY (mdecl
);
8677 tree block_body
= BLOCK_EXPR_BODY (fbody
);
8678 tree exception_copy
= NULL_TREE
;
8679 expand_start_java_method (mdecl
);
8680 build_result_decl (mdecl
);
8683 = (!METHOD_STATIC (mdecl
) ?
8684 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl
)) : NULL_TREE
);
8686 /* Purge the `throws' list of unchecked exceptions. If we're
8687 doing xref, save a copy of the list and re-install it
8690 exception_copy
= copy_list (DECL_FUNCTION_THROWS (mdecl
));
8692 purge_unchecked_exceptions (mdecl
);
8694 /* Install exceptions thrown with `throws' */
8695 PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl
));
8697 if (block_body
!= NULL_TREE
)
8699 block_body
= java_complete_tree (block_body
);
8700 if (!flag_emit_xref
)
8701 check_for_initialization (block_body
);
8702 ctxp
->explicit_constructor_p
= 0;
8704 BLOCK_EXPR_BODY (fbody
) = block_body
;
8706 if ((block_body
== NULL_TREE
|| CAN_COMPLETE_NORMALLY (block_body
))
8707 && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl
))) != VOID_TYPE
8709 missing_return_error (current_function_decl
);
8711 complete_start_java_method (mdecl
);
8713 /* Don't go any further if we've found error(s) during the
8715 if (!java_error_count
)
8716 source_end_java_method ();
8719 pushdecl_force_head (DECL_ARGUMENTS (mdecl
));
8723 /* Pop the exceptions and sanity check */
8725 if (currently_caught_type_list
)
8726 fatal ("Exception list non empty - java_complete_expand_method");
8729 DECL_FUNCTION_THROWS (mdecl
) = exception_copy
;
8733 /* Craft a body for default constructor. Patch existing constructor
8734 bodies with call to super() and field initialization statements if
8738 fix_constructors (mdecl
)
8741 tree body
= DECL_FUNCTION_BODY (mdecl
);
8745 /* The constructor body must be crafted by hand. It's the
8746 constructor we defined when we realize we didn't have the
8747 CLASSNAME() constructor */
8751 /* It is an error for the compiler to generate a default
8752 constructor if the superclass doesn't have a constructor that
8753 takes no argument */
8754 if (verify_constructor_super ())
8756 tree sclass_decl
= TYPE_NAME (CLASSTYPE_SUPER (current_class
));
8757 const char *n
= IDENTIFIER_POINTER (DECL_NAME (sclass_decl
));
8758 parse_error_context (lookup_cl (TYPE_NAME (current_class
)),
8759 "No constructor matching `%s()' found in "
8760 "class `%s'", n
, n
);
8763 start_artificial_method_body (mdecl
);
8765 /* We don't generate a super constructor invocation if we're
8766 compiling java.lang.Object. build_super_invocation takes care
8768 compound
= java_method_add_stmt (mdecl
, build_super_invocation ());
8770 end_artificial_method_body (mdecl
);
8772 /* Search for an explicit constructor invocation */
8776 tree main_block
= BLOCK_EXPR_BODY (body
);
8777 tree compound
= NULL_TREE
;
8780 switch (TREE_CODE (body
))
8783 found
= CALL_EXPLICIT_CONSTRUCTOR_P (body
);
8787 case EXPR_WITH_FILE_LOCATION
:
8788 body
= TREE_OPERAND (body
, 0);
8791 body
= BLOCK_EXPR_BODY (body
);
8797 /* The constructor is missing an invocation of super() */
8799 compound
= add_stmt_to_compound (compound
, NULL_TREE
,
8800 build_super_invocation ());
8802 /* Fix the constructor main block if we're adding extra stmts */
8805 compound
= add_stmt_to_compound (compound
, NULL_TREE
,
8806 BLOCK_EXPR_BODY (main_block
));
8807 BLOCK_EXPR_BODY (main_block
) = compound
;
8812 /* Browse constructors in the super class, searching for a constructor
8813 that doesn't take any argument. Return 0 if one is found, 1
8817 verify_constructor_super ()
8819 tree
class = CLASSTYPE_SUPER (current_class
);
8826 for (mdecl
= TYPE_METHODS (class); mdecl
; mdecl
= TREE_CHAIN (mdecl
))
8828 if (DECL_CONSTRUCTOR_P (mdecl
)
8829 && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl
)))
8837 /* Expand finals. */
8840 java_expand_finals ()
8844 /* Generate code for all context remembered for code generation. */
8847 java_expand_classes ()
8849 int save_error_count
= 0;
8850 java_parse_abort_on_error ();
8851 if (!(ctxp
= ctxp_for_generation
))
8853 java_layout_classes ();
8854 java_parse_abort_on_error ();
8856 for (; ctxp_for_generation
; ctxp_for_generation
= ctxp_for_generation
->next
)
8858 ctxp
= ctxp_for_generation
;
8859 lang_init_source (2); /* Error msgs have method prototypes */
8860 java_complete_expand_methods (); /* Complete and expand method bodies */
8861 java_parse_abort_on_error ();
8862 java_expand_finals (); /* Expand and check the finals */
8863 java_parse_abort_on_error ();
8864 java_check_final (); /* Check unitialized final */
8865 java_parse_abort_on_error ();
8869 /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
8870 a tree list node containing RIGHT. Fore coming RIGHTs will be
8871 chained to this hook. LOCATION contains the location of the
8872 separating `.' operator. */
8875 make_qualified_primary (primary
, right
, location
)
8876 tree primary
, right
;
8881 /* We want to process THIS . xxx symbolicaly, to keep it consistent
8882 with the way we're processing SUPER. A THIS from a primary as a
8883 different form than a SUPER. Turn THIS into something symbolic */
8884 if (TREE_CODE (primary
) == THIS_EXPR
)
8886 wfl
= build_wfl_node (this_identifier_node
);
8887 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (primary
);
8888 wfl
= make_qualified_name (wfl
, right
, location
);
8889 PRIMARY_P (wfl
) = 1;
8892 /* Other non WFL node are wrapped around a WFL */
8893 else if (TREE_CODE (primary
) != EXPR_WITH_FILE_LOCATION
)
8895 wfl
= build_expr_wfl (NULL_TREE
, ctxp
->filename
, 0, 0);
8896 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (primary
);
8897 EXPR_WFL_QUALIFICATION (wfl
) = build_tree_list (primary
, NULL_TREE
);
8902 if (!EXPR_WFL_QUALIFICATION (primary
))
8903 EXPR_WFL_QUALIFICATION (primary
) =
8904 build_tree_list (primary
, NULL_TREE
);
8907 EXPR_WFL_LINECOL (right
) = location
;
8908 chainon (EXPR_WFL_QUALIFICATION (wfl
), build_tree_list (right
, NULL_TREE
));
8909 PRIMARY_P (wfl
) = 1;
8913 /* Simple merge of two name separated by a `.' */
8916 merge_qualified_name (left
, right
)
8920 obstack_grow (&temporary_obstack
, IDENTIFIER_POINTER (left
),
8921 IDENTIFIER_LENGTH (left
));
8922 obstack_1grow (&temporary_obstack
, '.');
8923 obstack_grow0 (&temporary_obstack
, IDENTIFIER_POINTER (right
),
8924 IDENTIFIER_LENGTH (right
));
8925 node
= get_identifier (obstack_base (&temporary_obstack
));
8926 obstack_free (&temporary_obstack
, obstack_base (&temporary_obstack
));
8927 QUALIFIED_P (node
) = 1;
8931 /* Merge the two parts of a qualified name into LEFT. Set the
8932 location information of the resulting node to LOCATION, usually
8933 inherited from the location information of the `.' operator. */
8936 make_qualified_name (left
, right
, location
)
8940 #ifdef USE_COMPONENT_REF
8941 tree node
= build (COMPONENT_REF
, NULL_TREE
, left
, right
);
8942 EXPR_WFL_LINECOL (node
) = location
;
8945 tree left_id
= EXPR_WFL_NODE (left
);
8946 tree right_id
= EXPR_WFL_NODE (right
);
8949 merge
= merge_qualified_name (left_id
, right_id
);
8951 /* Left wasn't qualified and is now qualified */
8952 if (!QUALIFIED_P (left_id
))
8954 tree wfl
= build_expr_wfl (left_id
, ctxp
->filename
, 0, 0);
8955 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (left
);
8956 EXPR_WFL_QUALIFICATION (left
) = build_tree_list (wfl
, NULL_TREE
);
8959 wfl
= build_expr_wfl (right_id
, ctxp
->filename
, 0, 0);
8960 EXPR_WFL_LINECOL (wfl
) = location
;
8961 chainon (EXPR_WFL_QUALIFICATION (left
), build_tree_list (wfl
, NULL_TREE
));
8963 EXPR_WFL_NODE (left
) = merge
;
8968 /* Extract the last identifier component of the qualified in WFL. The
8969 last identifier is removed from the linked list */
8972 cut_identifier_in_qualified (wfl
)
8976 tree previous
= NULL_TREE
;
8977 for (q
= EXPR_WFL_QUALIFICATION (wfl
); ; previous
= q
, q
= TREE_CHAIN (q
))
8978 if (!TREE_CHAIN (q
))
8981 fatal ("Operating on a non qualified qualified WFL - "
8982 "cut_identifier_in_qualified");
8983 TREE_CHAIN (previous
) = NULL_TREE
;
8984 return TREE_PURPOSE (q
);
8988 /* Resolve the expression name NAME. Return its decl. */
8991 resolve_expression_name (id
, orig
)
8995 tree name
= EXPR_WFL_NODE (id
);
8998 /* 6.5.5.1: Simple expression names */
8999 if (!PRIMARY_P (id
) && !QUALIFIED_P (name
))
9001 /* 15.13.1: NAME can appear within the scope of a local variable
9003 if ((decl
= IDENTIFIER_LOCAL_VALUE (name
)))
9006 /* 15.13.1: NAME can appear within a class declaration */
9009 decl
= lookup_field_wrapper (current_class
, name
);
9012 int fs
= FIELD_STATIC (decl
);
9013 /* Instance variable (8.3.1.1) can't appear within
9014 static method, static initializer or initializer for
9015 a static variable. */
9016 if (!fs
&& METHOD_STATIC (current_function_decl
))
9018 static_ref_err (id
, name
, current_class
);
9019 return error_mark_node
;
9021 /* Instance variables can't appear as an argument of
9022 an explicit constructor invocation */
9023 if (!fs
&& ctxp
->explicit_constructor_p
)
9026 (id
, "Can't reference `%s' before the superclass "
9027 "constructor has been called", IDENTIFIER_POINTER (name
));
9028 return error_mark_node
;
9031 /* Otherwise build what it takes to access the field */
9032 decl
= build_field_ref ((fs
? NULL_TREE
: current_this
),
9033 DECL_CONTEXT (decl
), name
);
9034 if (fs
&& !flag_emit_class_files
&& !flag_emit_xref
)
9035 decl
= build_class_init (DECL_CONTEXT (decl
), decl
);
9036 /* We may be asked to save the real field access node */
9039 /* And we return what we got */
9042 /* Fall down to error report on undefined variable */
9045 /* 6.5.5.2 Qualified Expression Names */
9050 qualify_ambiguous_name (id
);
9051 /* 15.10.1 Field Access Using a Primary and/or Expression Name */
9052 /* 15.10.2: Accessing Superclass Members using super */
9053 return resolve_field_access (id
, NULL
, NULL
);
9056 /* We've got an error here */
9057 parse_error_context (id
, "Undefined variable `%s'",
9058 IDENTIFIER_POINTER (name
));
9060 return error_mark_node
;
9064 static_ref_err (wfl
, field_id
, class_type
)
9065 tree wfl
, field_id
, class_type
;
9069 "Can't make a static reference to nonstatic variable `%s' in class `%s'",
9070 IDENTIFIER_POINTER (field_id
),
9071 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type
))));
9074 /* 15.10.1 Field Acess Using a Primary and/or Expression Name.
9075 We return something suitable to generate the field access. We also
9076 return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
9077 recipient's address can be null. */
9080 resolve_field_access (qual_wfl
, field_decl
, field_type
)
9082 tree
*field_decl
, *field_type
;
9086 tree decl
, where_found
, type_found
;
9088 if (resolve_qualified_expression_name (qual_wfl
, &decl
,
9089 &where_found
, &type_found
))
9090 return error_mark_node
;
9092 /* Resolve the LENGTH field of an array here */
9093 if (DECL_NAME (decl
) == length_identifier_node
&& TYPE_ARRAY_P (type_found
)
9094 && ! flag_emit_class_files
&& ! flag_emit_xref
)
9096 tree length
= build_java_array_length_access (where_found
);
9098 build_java_arraynull_check (type_found
, length
, int_type_node
);
9100 /* We might have been trying to resolve field.method(). In which
9101 case, the resolution is over and decl is the answer */
9102 else if (JDECL_P (decl
) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl
)) == decl
)
9104 else if (JDECL_P (decl
))
9106 int static_final_found
= 0;
9108 type_found
= DECL_CONTEXT (decl
);
9109 is_static
= JDECL_P (decl
) && FIELD_STATIC (decl
);
9110 if (FIELD_FINAL (decl
)
9111 && JPRIMITIVE_TYPE_P (TREE_TYPE (decl
))
9112 && DECL_LANG_SPECIFIC (decl
)
9113 && DECL_INITIAL (decl
))
9115 field_ref
= DECL_INITIAL (decl
);
9116 static_final_found
= 1;
9119 field_ref
= build_field_ref ((is_static
&& !flag_emit_xref
?
9120 NULL_TREE
: where_found
),
9121 type_found
, DECL_NAME (decl
));
9122 if (field_ref
== error_mark_node
)
9123 return error_mark_node
;
9124 if (is_static
&& !static_final_found
9125 && !flag_emit_class_files
&& !flag_emit_xref
)
9127 field_ref
= build_class_init (type_found
, field_ref
);
9128 /* If the static field was identified by an expression that
9129 needs to be generated, make the field access a compound
9130 expression whose first part is the evaluation of the
9131 field selector part. */
9132 if (where_found
&& TREE_CODE (where_found
) != TYPE_DECL
9133 && TREE_CODE (where_found
) != RECORD_TYPE
)
9135 tree type
= QUAL_DECL_TYPE (field_ref
);
9136 if (TREE_CODE (type
) == RECORD_TYPE
)
9137 type
= build_pointer_type (type
);
9138 field_ref
= build (COMPOUND_EXPR
, type
, where_found
, field_ref
);
9148 *field_type
= (QUAL_DECL_TYPE (decl
) ?
9149 QUAL_DECL_TYPE (decl
) : TREE_TYPE (decl
));
9153 /* If NODE is an access to f static field, strip out the class
9154 initialization part and return the field decl, otherwise, return
9158 strip_out_static_field_access_decl (node
)
9161 if (TREE_CODE (node
) == COMPOUND_EXPR
)
9163 tree op1
= TREE_OPERAND (node
, 1);
9164 if (TREE_CODE (op1
) == COMPOUND_EXPR
)
9166 tree call
= TREE_OPERAND (op1
, 0);
9167 if (TREE_CODE (call
) == CALL_EXPR
9168 && TREE_CODE (TREE_OPERAND (call
, 0)) == ADDR_EXPR
9169 && TREE_OPERAND (TREE_OPERAND (call
, 0), 0)
9170 == soft_initclass_node
)
9171 return TREE_OPERAND (op1
, 1);
9173 else if (JDECL_P (op1
))
9179 /* 6.5.5.2: Qualified Expression Names */
9182 resolve_qualified_expression_name (wfl
, found_decl
, where_found
, type_found
)
9184 tree
*found_decl
, *type_found
, *where_found
;
9186 int from_type
= 0; /* Field search initiated from a type */
9187 int from_super
= 0, from_cast
= 0;
9188 int previous_call_static
= 0;
9190 tree decl
= NULL_TREE
, type
= NULL_TREE
, q
;
9191 *type_found
= *where_found
= NULL_TREE
;
9193 for (q
= EXPR_WFL_QUALIFICATION (wfl
); q
; q
= TREE_CHAIN (q
))
9195 tree qual_wfl
= QUAL_WFL (q
);
9196 tree ret_decl
; /* for EH checking */
9197 int location
; /* for EH checking */
9199 /* 15.10.1 Field Access Using a Primary */
9200 switch (TREE_CODE (qual_wfl
))
9203 case NEW_CLASS_EXPR
:
9204 /* If the access to the function call is a non static field,
9205 build the code to access it. */
9206 if (JDECL_P (decl
) && !FIELD_STATIC (decl
))
9208 decl
= maybe_access_field (decl
, *where_found
,
9209 DECL_CONTEXT (decl
));
9210 if (decl
== error_mark_node
)
9213 /* And code for the function call */
9214 if (complete_function_arguments (qual_wfl
))
9217 if (from_super
&& TREE_CODE (qual_wfl
) == CALL_EXPR
)
9218 CALL_USING_SUPER (qual_wfl
) = 1;
9219 location
= (TREE_CODE (qual_wfl
) == CALL_EXPR
?
9220 EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl
, 0)) : 0);
9221 *where_found
= patch_method_invocation (qual_wfl
, decl
, type
,
9222 &is_static
, &ret_decl
);
9223 if (*where_found
== error_mark_node
)
9225 *type_found
= type
= QUAL_DECL_TYPE (*where_found
);
9229 check_thrown_exceptions (location
, ret_decl
);
9231 /* If the previous call was static and this one is too,
9232 build a compound expression to hold the two (because in
9233 that case, previous function calls aren't transported as
9234 forcoming function's argument. */
9235 if (previous_call_static
&& is_static
)
9237 decl
= build (COMPOUND_EXPR
, type
, decl
, *where_found
);
9238 TREE_SIDE_EFFECTS (decl
) = 1;
9242 previous_call_static
= is_static
;
9243 decl
= *where_found
;
9247 case NEW_ARRAY_EXPR
:
9248 *where_found
= decl
= java_complete_tree (qual_wfl
);
9249 if (decl
== error_mark_node
)
9251 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9252 CLASS_LOADED_P (type
) = 1;
9256 *where_found
= decl
= java_complete_tree (qual_wfl
);
9257 if (decl
== error_mark_node
)
9259 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9263 case CONDITIONAL_EXPR
:
9266 *where_found
= decl
= java_complete_tree (qual_wfl
);
9267 if (decl
== error_mark_node
)
9269 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9273 /* If the access to the function call is a non static field,
9274 build the code to access it. */
9275 if (JDECL_P (decl
) && !FIELD_STATIC (decl
))
9277 decl
= maybe_access_field (decl
, *where_found
, type
);
9278 if (decl
== error_mark_node
)
9281 /* And code for the array reference expression */
9282 decl
= java_complete_tree (qual_wfl
);
9283 if (decl
== error_mark_node
)
9285 type
= QUAL_DECL_TYPE (decl
);
9289 /* Fix for -Wall Just go to the next statement. Don't
9294 /* If we fall here, we weren't processing a (static) function call. */
9295 previous_call_static
= 0;
9297 /* It can be the keyword THIS */
9298 if (EXPR_WFL_NODE (qual_wfl
) == this_identifier_node
)
9303 (wfl
, "Keyword `this' used outside allowed context");
9306 /* We have to generate code for intermediate acess */
9307 *where_found
= decl
= current_this
;
9308 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9312 /* 15.10.2 Accessing Superclass Members using SUPER */
9313 if (EXPR_WFL_NODE (qual_wfl
) == super_identifier_node
)
9316 /* Check on the restricted use of SUPER */
9317 if (METHOD_STATIC (current_function_decl
)
9318 || current_class
== object_type_node
)
9321 (wfl
, "Keyword `super' used outside allowed context");
9324 /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
9325 node
= build_cast (EXPR_WFL_LINECOL (qual_wfl
),
9326 CLASSTYPE_SUPER (current_class
),
9327 build_this (EXPR_WFL_LINECOL (qual_wfl
)));
9328 *where_found
= decl
= java_complete_tree (node
);
9329 if (decl
== error_mark_node
)
9331 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9332 from_super
= from_type
= 1;
9336 /* 15.13.1: Can't search for field name in packages, so we
9337 assume a variable/class name was meant. */
9338 if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
9340 tree name
= resolve_package (wfl
, &q
);
9343 *where_found
= decl
= resolve_no_layout (name
, qual_wfl
);
9344 /* We wan't to be absolutely that the class is laid
9345 out. We're going to search something inside it. */
9346 *type_found
= type
= TREE_TYPE (decl
);
9347 layout_class (type
);
9349 /* Should be a list, really. FIXME */
9350 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q
))) = 1;
9351 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q
))) = 0;
9355 if (from_super
|| from_cast
)
9357 ((from_cast
? qual_wfl
: wfl
),
9358 "No variable `%s' defined in class `%s'",
9359 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9360 lang_printable_name (type
, 0));
9363 (qual_wfl
, "Undefined variable or class name: `%s'",
9364 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)));
9369 /* We have a type name. It's been already resolved when the
9370 expression was qualified. */
9371 else if (RESOLVE_TYPE_NAME_P (qual_wfl
))
9373 if (!(decl
= QUAL_RESOLUTION (q
)))
9374 return 1; /* Error reported already */
9376 if (not_accessible_p (TREE_TYPE (decl
), decl
, 0))
9379 (qual_wfl
, "Can't access %s field `%s.%s' from `%s'",
9380 java_accstring_lookup (get_access_flags_from_decl (decl
)),
9381 GET_TYPE_NAME (type
),
9382 IDENTIFIER_POINTER (DECL_NAME (decl
)),
9383 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))));
9386 check_deprecation (qual_wfl
, decl
);
9388 type
= TREE_TYPE (decl
);
9391 /* We resolve and expression name */
9394 tree field_decl
= NULL_TREE
;
9396 /* If there exists an early resolution, use it. That occurs
9397 only once and we know that there are more things to
9398 come. Don't do that when processing something after SUPER
9399 (we need more thing to be put in place below */
9400 if (!from_super
&& QUAL_RESOLUTION (q
))
9402 decl
= QUAL_RESOLUTION (q
);
9405 if (TREE_CODE (decl
) == FIELD_DECL
&& !FIELD_STATIC (decl
))
9408 *where_found
= current_this
;
9411 static_ref_err (qual_wfl
, DECL_NAME (decl
),
9418 *where_found
= TREE_TYPE (decl
);
9419 if (TREE_CODE (*where_found
) == POINTER_TYPE
)
9420 *where_found
= TREE_TYPE (*where_found
);
9425 /* We have to search for a field, knowing the type of its
9426 container. The flag FROM_TYPE indicates that we resolved
9427 the last member of the expression as a type name, which
9428 means that for the resolution of this field, we'll look
9429 for other errors than if it was resolved as a member of
9434 tree field_decl_type
; /* For layout */
9436 if (!from_type
&& !JREFERENCE_TYPE_P (type
))
9439 (qual_wfl
, "Attempt to reference field `%s' in `%s %s'",
9440 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9441 lang_printable_name (type
, 0),
9442 IDENTIFIER_POINTER (DECL_NAME (field_decl
)));
9446 field_decl
= lookup_field_wrapper (type
,
9447 EXPR_WFL_NODE (qual_wfl
));
9448 if (field_decl
== NULL_TREE
)
9451 (qual_wfl
, "No variable `%s' defined in type `%s'",
9452 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9453 GET_TYPE_NAME (type
));
9456 if (field_decl
== error_mark_node
)
9459 /* Layout the type of field_decl, since we may need
9460 it. Don't do primitive types or loaded classes. The
9461 situation of non primitive arrays may not handled
9462 properly here. FIXME */
9463 if (TREE_CODE (TREE_TYPE (field_decl
)) == POINTER_TYPE
)
9464 field_decl_type
= TREE_TYPE (TREE_TYPE (field_decl
));
9466 field_decl_type
= TREE_TYPE (field_decl
);
9467 if (!JPRIMITIVE_TYPE_P (field_decl_type
)
9468 && !CLASS_LOADED_P (field_decl_type
)
9469 && !TYPE_ARRAY_P (field_decl_type
))
9470 resolve_and_layout (field_decl_type
, NULL_TREE
);
9471 if (TYPE_ARRAY_P (field_decl_type
))
9472 CLASS_LOADED_P (field_decl_type
) = 1;
9474 /* Check on accessibility here */
9475 if (not_accessible_p (type
, field_decl
, from_super
))
9479 "Can't access %s field `%s.%s' from `%s'",
9480 java_accstring_lookup
9481 (get_access_flags_from_decl (field_decl
)),
9482 GET_TYPE_NAME (type
),
9483 IDENTIFIER_POINTER (DECL_NAME (field_decl
)),
9485 (DECL_NAME (TYPE_NAME (current_class
))));
9488 check_deprecation (qual_wfl
, field_decl
);
9490 /* There are things to check when fields are accessed
9491 from type. There are no restrictions on a static
9492 declaration of the field when it is accessed from an
9494 is_static
= FIELD_STATIC (field_decl
);
9495 if (!from_super
&& from_type
9496 && !TYPE_INTERFACE_P (type
) && !is_static
)
9498 static_ref_err (qual_wfl
, EXPR_WFL_NODE (qual_wfl
), type
);
9501 from_cast
= from_super
= 0;
9503 /* If we need to generate something to get a proper
9504 handle on what this field is accessed from, do it
9508 decl
= maybe_access_field (decl
, *where_found
, *type_found
);
9509 if (decl
== error_mark_node
)
9513 /* We want to keep the location were found it, and the type
9515 *where_found
= decl
;
9518 /* This is the decl found and eventually the next one to
9523 type
= QUAL_DECL_TYPE (decl
);
9530 /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
9531 can't be accessed from REFERENCE (a record type). */
9534 not_accessible_p (reference
, member
, from_super
)
9535 tree reference
, member
;
9538 int access_flag
= get_access_flags_from_decl (member
);
9540 /* Access always granted for members declared public */
9541 if (access_flag
& ACC_PUBLIC
)
9544 /* Check access on protected members */
9545 if (access_flag
& ACC_PROTECTED
)
9547 /* Access granted if it occurs from within the package
9548 containing the class in which the protected member is
9550 if (class_in_current_package (DECL_CONTEXT (member
)))
9553 /* If accessed with the form `super.member', then access is granted */
9557 /* Otherwise, access is granted if occuring from the class where
9558 member is declared or a subclass of it */
9559 if (inherits_from_p (reference
, current_class
))
9564 /* Check access on private members. Access is granted only if it
9565 occurs from within the class in witch it is declared */
9566 if (access_flag
& ACC_PRIVATE
)
9567 return (current_class
== DECL_CONTEXT (member
) ? 0 : 1);
9569 /* Default access are permitted only when occuring within the
9570 package in which the type (REFERENCE) is declared. In other words,
9571 REFERENCE is defined in the current package */
9573 return !class_in_current_package (reference
);
9575 /* Otherwise, access is granted */
9579 /* Test deprecated decl access. */
9581 check_deprecation (wfl
, decl
)
9584 const char *file
= DECL_SOURCE_FILE (decl
);
9585 /* Complain if the field is deprecated and the file it was defined
9586 in isn't compiled at the same time the file which contains its
9588 if (DECL_DEPRECATED (decl
)
9589 && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file
)))
9592 switch (TREE_CODE (decl
))
9595 strcpy (the
, "method");
9598 strcpy (the
, "field");
9601 strcpy (the
, "class");
9604 fatal ("unexpected DECL code - check_deprecation");
9606 parse_warning_context
9607 (wfl
, "The %s `%s' in class `%s' has been deprecated",
9608 the
, lang_printable_name (decl
, 0),
9609 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl
)))));
9613 /* Returns 1 if class was declared in the current package, 0 otherwise */
9616 class_in_current_package (class)
9619 static tree cache
= NULL_TREE
;
9626 qualified_flag
= QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
9628 /* If the current package is empty and the name of CLASS is
9629 qualified, class isn't in the current package. If there is a
9630 current package and the name of the CLASS is not qualified, class
9631 isn't in the current package */
9632 if ((!ctxp
->package
&& qualified_flag
) || (ctxp
->package
&& !qualified_flag
))
9635 /* If there is not package and the name of CLASS isn't qualified,
9636 they belong to the same unnamed package */
9637 if (!ctxp
->package
&& !qualified_flag
)
9640 /* Compare the left part of the name of CLASS with the package name */
9641 breakdown_qualified (&left
, NULL
, DECL_NAME (TYPE_NAME (class)));
9642 if (ctxp
->package
== left
)
9650 /* This function may generate code to access DECL from WHERE. This is
9651 done only if certain conditions meet. */
9654 maybe_access_field (decl
, where
, type
)
9655 tree decl
, where
, type
;
9657 if (TREE_CODE (decl
) == FIELD_DECL
&& decl
!= current_this
9658 && !FIELD_STATIC (decl
))
9659 decl
= build_field_ref (where
? where
: current_this
,
9660 (type
? type
: DECL_CONTEXT (decl
)),
9665 /* Build a method invocation, by patching PATCH. If non NULL
9666 and according to the situation, PRIMARY and WHERE may be
9667 used. IS_STATIC is set to 1 if the invoked function is static. */
9670 patch_method_invocation (patch
, primary
, where
, is_static
, ret_decl
)
9671 tree patch
, primary
, where
;
9675 tree wfl
= TREE_OPERAND (patch
, 0);
9676 tree args
= TREE_OPERAND (patch
, 1);
9677 tree name
= EXPR_WFL_NODE (wfl
);
9679 int is_static_flag
= 0;
9680 int is_super_init
= 0;
9681 tree this_arg
= NULL_TREE
;
9683 /* Should be overriden if everything goes well. Otherwise, if
9684 something fails, it should keep this value. It stop the
9685 evaluation of a bogus assignment. See java_complete_tree,
9686 MODIFY_EXPR: for the reasons why we sometimes want to keep on
9687 evaluating an assignment */
9688 TREE_TYPE (patch
) = error_mark_node
;
9690 /* Since lookup functions are messing with line numbers, save the
9692 java_parser_context_save_global ();
9694 /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
9696 /* Resolution of qualified name, excluding constructors */
9697 if (QUALIFIED_P (name
) && !CALL_CONSTRUCTOR_P (patch
))
9699 tree class_decl
, identifier
, identifier_wfl
;
9700 /* Extract the last IDENTIFIER of the qualified
9701 expression. This is a wfl and we will use it's location
9702 data during error report. */
9703 identifier_wfl
= cut_identifier_in_qualified (wfl
);
9704 identifier
= EXPR_WFL_NODE (identifier_wfl
);
9706 /* Given the context, IDENTIFIER is syntactically qualified
9707 as a MethodName. We need to qualify what's before */
9708 qualify_ambiguous_name (wfl
);
9710 /* Package resolution */
9711 if (RESOLVE_PACKAGE_NAME_P (wfl
))
9713 tree next
, decl
, name
= resolve_package (wfl
, &next
);
9718 breakdown_qualified (&remainder
, NULL
, EXPR_WFL_NODE (wfl
));
9719 parse_error_context (wfl
, "Can't search method `%s' in package "
9720 "`%s'",IDENTIFIER_POINTER (identifier
),
9721 IDENTIFIER_POINTER (remainder
));
9722 PATCH_METHOD_RETURN_ERROR ();
9724 RESOLVE_PACKAGE_NAME_P (wfl
) = 0;
9725 if ((decl
= resolve_no_layout (name
, QUAL_WFL (next
))))
9727 QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl
)) = decl
;
9728 RESOLVE_EXPRESSION_NAME_P (wfl
) = 0;
9729 RESOLVE_TYPE_NAME_P (wfl
) = 1;
9733 RESOLVE_EXPRESSION_NAME_P (wfl
) = 1;
9734 RESOLVE_TYPE_NAME_P (wfl
) = 0;
9738 /* We're resolving a call from a type */
9739 if (RESOLVE_TYPE_NAME_P (wfl
))
9741 tree decl
= QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl
));
9742 tree name
= DECL_NAME (decl
);
9745 class_decl
= resolve_and_layout (name
, wfl
);
9746 if (CLASS_INTERFACE (decl
))
9749 (identifier_wfl
, "Can't make static reference to method "
9750 "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier
),
9751 IDENTIFIER_POINTER (name
));
9752 PATCH_METHOD_RETURN_ERROR ();
9754 /* Look the method up in the type selector. The method ought
9756 type
= TREE_TYPE (class_decl
);
9757 list
= lookup_method_invoke (0, wfl
, type
, identifier
, args
);
9758 if (list
&& !METHOD_STATIC (list
))
9760 char *fct_name
= xstrdup (lang_printable_name (list
, 0));
9763 "Can't make static reference to method `%s %s' in class `%s'",
9764 lang_printable_name (TREE_TYPE (TREE_TYPE (list
)), 0),
9765 fct_name
, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type
))));
9767 PATCH_METHOD_RETURN_ERROR ();
9769 args
= nreverse (args
);
9771 /* We're resolving an expression name */
9776 /* 1- Find the field to which the call applies */
9777 field
= resolve_field_access (wfl
, NULL
, &type
);
9778 if (field
== error_mark_node
)
9779 PATCH_METHOD_RETURN_ERROR ();
9780 /* field is used in lieu of a primary. It alows us not to
9781 report errors on erroneous use of `this' in
9785 /* 2- Do the layout of the class where the last field
9786 was found, so we can search it. */
9787 class_decl
= resolve_and_layout (type
, NULL_TREE
);
9788 if (class_decl
!= NULL_TREE
)
9789 type
= TREE_TYPE (class_decl
);
9791 /* 3- Retrieve a filtered list of method matches, Refine
9792 if necessary. In any cases, point out errors. */
9793 list
= lookup_method_invoke (0, identifier_wfl
, type
,
9796 /* 4- Add the field as an argument */
9797 args
= nreverse (args
);
9801 /* IDENTIFIER_WFL will be used to report any problem further */
9802 wfl
= identifier_wfl
;
9804 /* Resolution of simple names, names generated after a primary: or
9808 tree class_to_search
= NULL_TREE
;
9809 int lc
; /* Looking for Constructor */
9811 /* We search constructor in their target class */
9812 if (CALL_CONSTRUCTOR_P (patch
))
9814 if (TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9815 class_to_search
= EXPR_WFL_NODE (wfl
);
9816 else if (EXPR_WFL_NODE (TREE_OPERAND (patch
, 0)) ==
9817 this_identifier_node
)
9818 class_to_search
= NULL_TREE
;
9819 else if (EXPR_WFL_NODE (TREE_OPERAND (patch
, 0)) ==
9820 super_identifier_node
)
9823 if (CLASSTYPE_SUPER (current_class
))
9825 DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class
)));
9828 parse_error_context (wfl
, "Can't invoke super constructor "
9829 "on java.lang.Object");
9830 PATCH_METHOD_RETURN_ERROR ();
9834 /* Class to search is NULL if we're searching the current one */
9835 if (class_to_search
)
9837 class_to_search
= resolve_and_layout (class_to_search
,
9839 if (!class_to_search
)
9842 (wfl
, "Class `%s' not found in type declaration",
9843 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
9844 PATCH_METHOD_RETURN_ERROR ();
9847 /* Can't instantiate an abstract class, but we can
9848 invoke it's constructor. It's use within the `new'
9849 context is denied here. */
9850 if (CLASS_ABSTRACT (class_to_search
)
9851 && TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9854 (wfl
, "Class `%s' is an abstract class. It can't be "
9855 "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
9856 PATCH_METHOD_RETURN_ERROR ();
9858 class_to_search
= TREE_TYPE (class_to_search
);
9861 class_to_search
= current_class
;
9864 /* This is a regular search in the local class, unless an
9865 alternate class is specified. */
9868 class_to_search
= (where
? where
: current_class
);
9872 /* NAME is a simple identifier or comes from a primary. Search
9873 in the class whose declaration contain the method being
9875 resolve_and_layout (class_to_search
, NULL_TREE
);
9876 list
= lookup_method_invoke (lc
, wfl
, class_to_search
, name
, args
);
9878 /* Don't continue if no method were found, as the next statement
9879 can't be executed then. */
9881 PATCH_METHOD_RETURN_ERROR ();
9883 /* Check for static reference if non static methods */
9884 if (check_for_static_method_reference (wfl
, patch
, list
,
9885 class_to_search
, primary
))
9886 PATCH_METHOD_RETURN_ERROR ();
9888 /* Non static methods are called with the current object extra
9889 argument. If patch a `new TYPE()', the argument is the value
9890 returned by the object allocator. If method is resolved as a
9891 primary, use the primary otherwise use the current THIS. */
9892 args
= nreverse (args
);
9893 if (TREE_CODE (patch
) != NEW_CLASS_EXPR
)
9894 this_arg
= primary
? primary
: current_this
;
9897 /* Merge point of all resolution schemes. If we have nothing, this
9898 is an error, already signaled */
9900 PATCH_METHOD_RETURN_ERROR ();
9902 /* Check accessibility, position the is_static flag, build and
9904 if (not_accessible_p (DECL_CONTEXT (current_function_decl
), list
, 0))
9906 char *fct_name
= xstrdup (lang_printable_name (list
, 0));
9908 (wfl
, "Can't access %s method `%s %s.%s' from `%s'",
9909 java_accstring_lookup (get_access_flags_from_decl (list
)),
9910 lang_printable_name (TREE_TYPE (TREE_TYPE (list
)), 0),
9911 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list
)))),
9912 fct_name
, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))));
9914 PATCH_METHOD_RETURN_ERROR ();
9916 check_deprecation (wfl
, list
);
9918 is_static_flag
= METHOD_STATIC (list
);
9919 if (! METHOD_STATIC (list
) && this_arg
!= NULL_TREE
)
9920 args
= tree_cons (NULL_TREE
, this_arg
, args
);
9922 /* In the context of an explicit constructor invocation, we can't
9923 invoke any method relying on `this'. Exceptions are: we're
9924 invoking a static function, primary exists and is not the current
9925 this, we're creating a new object. */
9926 if (ctxp
->explicit_constructor_p
9928 && (!primary
|| primary
== current_this
)
9929 && (TREE_CODE (patch
) != NEW_CLASS_EXPR
))
9932 (wfl
, "Can't reference `this' before the superclass constructor has "
9934 PATCH_METHOD_RETURN_ERROR ();
9936 java_parser_context_restore_global ();
9938 *is_static
= is_static_flag
;
9939 /* Sometimes, we want the decl of the selected method. Such as for
9943 patch
= patch_invoke (patch
, list
, args
);
9944 if (is_super_init
&& CLASS_HAS_FINIT_P (current_class
))
9946 /* Generate the code used to initialize fields declared with an
9947 initialization statement. For now, it returns a call the the
9948 artificial function $finit$, if required. */
9951 build_method_invocation (build_expr_wfl (finit_identifier_node
,
9952 input_filename
, 0, 0),
9954 patch
= build (COMPOUND_EXPR
, void_type_node
, patch
,
9955 java_complete_tree (finit_call
));
9956 CAN_COMPLETE_NORMALLY (patch
) = 1;
9961 /* Check that we're not trying to do a static reference to a method in
9962 non static method. Return 1 if it's the case, 0 otherwise. */
9965 check_for_static_method_reference (wfl
, node
, method
, where
, primary
)
9966 tree wfl
, node
, method
, where
, primary
;
9968 if (METHOD_STATIC (current_function_decl
)
9969 && !METHOD_STATIC (method
) && !primary
&& !CALL_CONSTRUCTOR_P (node
))
9971 char *fct_name
= xstrdup (lang_printable_name (method
, 0));
9973 (wfl
, "Can't make static reference to method `%s %s' in class `%s'",
9974 lang_printable_name (TREE_TYPE (TREE_TYPE (method
)), 0), fct_name
,
9975 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where
))));
9982 /* Patch an invoke expression METHOD and ARGS, based on its invocation
9986 patch_invoke (patch
, method
, args
)
9987 tree patch
, method
, args
;
9990 tree original_call
, t
, ta
;
9992 /* Last step for args: convert build-in types. If we're dealing with
9993 a new TYPE() type call, the first argument to the constructor
9994 isn't found in the incomming argument list, but delivered by
9996 t
= TYPE_ARG_TYPES (TREE_TYPE (method
));
9997 if (TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9999 for (ta
= args
; t
!= end_params_node
&& ta
;
10000 t
= TREE_CHAIN (t
), ta
= TREE_CHAIN (ta
))
10001 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta
))) &&
10002 TREE_TYPE (TREE_VALUE (ta
)) != TREE_VALUE (t
))
10003 TREE_VALUE (ta
) = convert (TREE_VALUE (t
), TREE_VALUE (ta
));
10005 /* Resolve unresolved returned type isses */
10006 t
= TREE_TYPE (TREE_TYPE (method
));
10007 if (TREE_CODE (t
) == POINTER_TYPE
&& !CLASS_LOADED_P (TREE_TYPE (t
)))
10008 resolve_and_layout (TREE_TYPE (t
), NULL
);
10010 if (flag_emit_class_files
|| flag_emit_xref
)
10014 tree signature
= build_java_signature (TREE_TYPE (method
));
10015 switch (invocation_mode (method
, CALL_USING_SUPER (patch
)))
10017 case INVOKE_VIRTUAL
:
10018 dtable
= invoke_build_dtable (0, args
);
10019 func
= build_invokevirtual (dtable
, method
);
10023 case INVOKE_STATIC
:
10024 func
= build_known_method_ref (method
, TREE_TYPE (method
),
10025 DECL_CONTEXT (method
),
10029 case INVOKE_INTERFACE
:
10030 dtable
= invoke_build_dtable (1, args
);
10031 func
= build_invokeinterface (dtable
, DECL_NAME (method
), signature
);
10035 fatal ("internal error - unknown invocation_mode result");
10038 /* Ensure self_type is initialized, (invokestatic). FIXME */
10039 func
= build1 (NOP_EXPR
, build_pointer_type (TREE_TYPE (method
)), func
);
10042 TREE_TYPE (patch
) = TREE_TYPE (TREE_TYPE (method
));
10043 TREE_OPERAND (patch
, 0) = func
;
10044 TREE_OPERAND (patch
, 1) = args
;
10045 original_call
= patch
;
10047 /* We're processing a `new TYPE ()' form. New is called an its
10048 returned value is the first argument to the constructor. We build
10049 a COMPOUND_EXPR and use saved expression so that the overall NEW
10050 expression value is a pointer to a newly created and initialized
10052 if (TREE_CODE (original_call
) == NEW_CLASS_EXPR
)
10054 tree
class = DECL_CONTEXT (method
);
10055 tree c1
, saved_new
, size
, new;
10056 if (flag_emit_class_files
|| flag_emit_xref
)
10058 TREE_TYPE (patch
) = build_pointer_type (class);
10061 if (!TYPE_SIZE (class))
10062 safe_layout_class (class);
10063 size
= size_in_bytes (class);
10064 new = build (CALL_EXPR
, promote_type (class),
10065 build_address_of (alloc_object_node
),
10066 tree_cons (NULL_TREE
, build_class_ref (class),
10067 build_tree_list (NULL_TREE
,
10068 size_in_bytes (class))),
10070 saved_new
= save_expr (new);
10071 c1
= build_tree_list (NULL_TREE
, saved_new
);
10072 TREE_CHAIN (c1
) = TREE_OPERAND (original_call
, 1);
10073 TREE_OPERAND (original_call
, 1) = c1
;
10074 TREE_SET_CODE (original_call
, CALL_EXPR
);
10075 patch
= build (COMPOUND_EXPR
, TREE_TYPE (new), patch
, saved_new
);
10081 invocation_mode (method
, super
)
10085 int access
= get_access_flags_from_decl (method
);
10088 return INVOKE_SUPER
;
10090 if (access
& ACC_STATIC
|| access
& ACC_FINAL
|| access
& ACC_PRIVATE
)
10091 return INVOKE_STATIC
;
10093 if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method
))))
10094 return INVOKE_STATIC
;
10096 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method
))))
10097 return INVOKE_INTERFACE
;
10099 if (DECL_CONSTRUCTOR_P (method
))
10100 return INVOKE_STATIC
;
10102 return INVOKE_VIRTUAL
;
10105 /* Retrieve a refined list of matching methods. It covers the step
10106 15.11.2 (Compile-Time Step 2) */
10109 lookup_method_invoke (lc
, cl
, class, name
, arg_list
)
10112 tree
class, name
, arg_list
;
10114 tree atl
= end_params_node
; /* Arg Type List */
10115 tree method
, signature
, list
, node
;
10116 const char *candidates
; /* Used for error report */
10118 /* Fix the arguments */
10119 for (node
= arg_list
; node
; node
= TREE_CHAIN (node
))
10121 tree current_arg
= TREE_TYPE (TREE_VALUE (node
));
10122 /* Non primitive type may have to be resolved */
10123 if (!JPRIMITIVE_TYPE_P (current_arg
))
10124 resolve_and_layout (current_arg
, NULL_TREE
);
10126 if (TREE_CODE (current_arg
) == RECORD_TYPE
)
10127 current_arg
= promote_type (current_arg
);
10128 atl
= tree_cons (NULL_TREE
, current_arg
, atl
);
10131 /* Find all candidates and then refine the list, searching for the
10132 most specific method. */
10133 list
= find_applicable_accessible_methods_list (lc
, class, name
, atl
);
10134 list
= find_most_specific_methods_list (list
);
10135 if (list
&& !TREE_CHAIN (list
))
10136 return TREE_VALUE (list
);
10138 /* Issue an error. List candidates if any. Candidates are listed
10139 only if accessible (non accessible methods may end-up here for
10140 the sake of a better error report). */
10145 obstack_grow (&temporary_obstack
, ". Candidates are:\n", 18);
10146 for (current
= list
; current
; current
= TREE_CHAIN (current
))
10148 tree cm
= TREE_VALUE (current
);
10149 char string
[4096];
10150 if (!cm
|| not_accessible_p (class, cm
, 0))
10153 (string
, " `%s' in `%s'%s",
10154 get_printable_method_name (cm
),
10155 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm
)))),
10156 (TREE_CHAIN (current
) ? "\n" : ""));
10157 obstack_grow (&temporary_obstack
, string
, strlen (string
));
10159 obstack_1grow (&temporary_obstack
, '\0');
10160 candidates
= obstack_finish (&temporary_obstack
);
10162 /* Issue the error message */
10163 method
= make_node (FUNCTION_TYPE
);
10164 TYPE_ARG_TYPES (method
) = atl
;
10165 signature
= build_java_argument_signature (method
);
10166 parse_error_context (cl
, "Can't find %s `%s(%s)' in class `%s'%s",
10167 (lc
? "constructor" : "method"),
10169 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))) :
10170 IDENTIFIER_POINTER (name
)),
10171 IDENTIFIER_POINTER (signature
),
10172 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
10173 (candidates
? candidates
: ""));
10177 /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
10178 when we're looking for a constructor. */
10181 find_applicable_accessible_methods_list (lc
, class, name
, arglist
)
10183 tree
class, name
, arglist
;
10185 tree list
= NULL_TREE
, all_list
= NULL_TREE
;
10187 /* Search interfaces */
10188 if (CLASS_INTERFACE (TYPE_NAME (class))
10189 || CLASS_ABSTRACT (TYPE_NAME (class)))
10191 static tree searched_interfaces
= NULL_TREE
;
10192 static int search_not_done
= 0;
10194 tree basetype_vec
= TYPE_BINFO_BASETYPES (class);
10196 /* Have we searched this interface already? */
10197 if (searched_interfaces
)
10200 for (current
= searched_interfaces
;
10201 current
; current
= TREE_CHAIN (current
))
10202 if (TREE_VALUE (current
) == class)
10205 searched_interfaces
= tree_cons (NULL_TREE
, class, searched_interfaces
);
10207 search_applicable_methods_list
10208 (lc
, TYPE_METHODS (class), name
, arglist
, &list
, &all_list
);
10210 n
= TREE_VEC_LENGTH (basetype_vec
);
10211 for (i
= 0; i
< n
; i
++)
10213 tree t
= BINFO_TYPE (TREE_VEC_ELT (basetype_vec
, i
));
10216 /* Skip java.lang.Object (we'll search it once later.) */
10217 if (t
== object_type_node
)
10221 rlist
= find_applicable_accessible_methods_list (lc
, t
, name
,
10223 all_list
= chainon (rlist
, (list
? list
: all_list
));
10227 /* We're done. Reset the searched interfaces list and finally search
10228 java.lang.Object */
10229 if (!search_not_done
)
10231 searched_interfaces
= NULL_TREE
;
10232 search_applicable_methods_list (lc
, TYPE_METHODS (object_type_node
),
10233 name
, arglist
, &list
, &all_list
);
10236 /* Search classes */
10238 while (class != NULL_TREE
)
10240 search_applicable_methods_list
10241 (lc
, TYPE_METHODS (class), name
, arglist
, &list
, &all_list
);
10242 class = (lc
? NULL_TREE
: CLASSTYPE_SUPER (class));
10245 /* Either return the list obtained or all selected (but
10246 inaccessible) methods for better error report. */
10247 return (!list
? all_list
: list
);
10250 /* Effectively search for the approriate method in method */
10253 search_applicable_methods_list(lc
, method
, name
, arglist
, list
, all_list
)
10255 tree method
, name
, arglist
;
10256 tree
*list
, *all_list
;
10258 for (; method
; method
= TREE_CHAIN (method
))
10260 /* When dealing with constructor, stop here, otherwise search
10262 if (lc
&& !DECL_CONSTRUCTOR_P (method
))
10264 else if (!lc
&& (DECL_CONSTRUCTOR_P (method
)
10265 || (GET_METHOD_NAME (method
) != name
)))
10268 if (argument_types_convertible (method
, arglist
))
10270 /* Retain accessible methods only */
10271 if (!not_accessible_p (DECL_CONTEXT (current_function_decl
),
10273 *list
= tree_cons (NULL_TREE
, method
, *list
);
10275 /* Also retain all selected method here */
10276 *all_list
= tree_cons (NULL_TREE
, method
, *list
);
10281 /* 15.11.2.2 Choose the Most Specific Method */
10284 find_most_specific_methods_list (list
)
10288 tree current
, new_list
= NULL_TREE
;
10289 for (current
= list
; current
; current
= TREE_CHAIN (current
))
10292 DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) = 0;
10294 for (method
= list
; method
; method
= TREE_CHAIN (method
))
10296 /* Don't test a method against itself */
10297 if (method
== current
)
10300 /* Compare arguments and location where method where declared */
10301 if (argument_types_convertible (TREE_VALUE (method
),
10302 TREE_VALUE (current
))
10303 && valid_method_invocation_conversion_p
10304 (DECL_CONTEXT (TREE_VALUE (method
)),
10305 DECL_CONTEXT (TREE_VALUE (current
))))
10307 int v
= ++DECL_SPECIFIC_COUNT (TREE_VALUE (current
));
10308 max
= (v
> max
? v
: max
);
10313 /* Review the list and select the maximally specific methods */
10314 for (current
= list
; current
; current
= TREE_CHAIN (current
))
10315 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) == max
)
10316 new_list
= tree_cons (NULL_TREE
, TREE_VALUE (current
), new_list
);
10318 /* If we can't find one, lower expectations and try to gather multiple
10319 maximally specific methods */
10324 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) == max
)
10325 new_list
= tree_cons (NULL_TREE
, TREE_VALUE (current
), new_list
);
10333 /* Make sure that the type of each M2_OR_ARGLIST arguments can be
10334 converted by method invocation conversion (5.3) to the type of the
10335 corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
10336 to change less often than M1. */
10339 argument_types_convertible (m1
, m2_or_arglist
)
10340 tree m1
, m2_or_arglist
;
10342 static tree m2_arg_value
= NULL_TREE
;
10343 static tree m2_arg_cache
= NULL_TREE
;
10345 register tree m1_arg
, m2_arg
;
10347 m1_arg
= TYPE_ARG_TYPES (TREE_TYPE (m1
));
10348 if (!METHOD_STATIC (m1
))
10349 m1_arg
= TREE_CHAIN (m1_arg
);
10351 if (m2_arg_value
== m2_or_arglist
)
10352 m2_arg
= m2_arg_cache
;
10355 /* M2_OR_ARGLIST can be a function DECL or a raw list of
10357 if (m2_or_arglist
&& TREE_CODE (m2_or_arglist
) == FUNCTION_DECL
)
10359 m2_arg
= TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist
));
10360 if (!METHOD_STATIC (m2_or_arglist
))
10361 m2_arg
= TREE_CHAIN (m2_arg
);
10364 m2_arg
= m2_or_arglist
;
10366 m2_arg_value
= m2_or_arglist
;
10367 m2_arg_cache
= m2_arg
;
10370 while (m1_arg
!= end_params_node
&& m2_arg
!= end_params_node
)
10372 resolve_and_layout (TREE_VALUE (m1_arg
), NULL_TREE
);
10373 if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg
),
10374 TREE_VALUE (m2_arg
)))
10376 m1_arg
= TREE_CHAIN (m1_arg
);
10377 m2_arg
= TREE_CHAIN (m2_arg
);
10379 return m1_arg
== end_params_node
&& m2_arg
== end_params_node
;
10382 /* Qualification routines */
10385 qualify_ambiguous_name (id
)
10388 tree qual
, qual_wfl
, name
= NULL_TREE
, decl
, ptr_type
= NULL_TREE
,
10389 saved_current_class
;
10390 int again
, super_found
= 0, this_found
= 0, new_array_found
= 0;
10393 /* We first qualify the first element, then derive qualification of
10394 others based on the first one. If the first element is qualified
10395 by a resolution (field or type), this resolution is stored in the
10396 QUAL_RESOLUTION of the qual element being examined. We need to
10397 save the current_class since the use of SUPER might change the
10399 saved_current_class
= current_class
;
10400 qual
= EXPR_WFL_QUALIFICATION (id
);
10403 /* Simple qualified expression feature a qual_wfl that is a
10404 WFL. Expression derived from a primary feature more complicated
10405 things like a CALL_EXPR. Expression from primary need to be
10406 worked out to extract the part on which the qualification will
10408 qual_wfl
= QUAL_WFL (qual
);
10409 switch (TREE_CODE (qual_wfl
))
10412 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
10413 if (TREE_CODE (qual_wfl
) != EXPR_WITH_FILE_LOCATION
)
10415 qual
= EXPR_WFL_QUALIFICATION (qual_wfl
);
10416 qual_wfl
= QUAL_WFL (qual
);
10419 case NEW_ARRAY_EXPR
:
10420 qual
= TREE_CHAIN (qual
);
10421 again
= new_array_found
= 1;
10423 case NEW_CLASS_EXPR
:
10425 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
10428 while (TREE_CODE (qual_wfl
) == ARRAY_REF
)
10429 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
10432 qual
= TREE_CHAIN (qual
);
10433 qual_wfl
= QUAL_WFL (qual
);
10436 /* Fix for -Wall. Just break doing nothing */
10440 ptr_type
= current_class
;
10442 code
= TREE_CODE (qual_wfl
);
10444 /* Pos evaluation: non WFL leading expression nodes */
10445 if (code
== CONVERT_EXPR
10446 && TREE_CODE (TREE_TYPE (qual_wfl
)) == EXPR_WITH_FILE_LOCATION
)
10447 name
= EXPR_WFL_NODE (TREE_TYPE (qual_wfl
));
10449 else if ((code
== ARRAY_REF
|| code
== CALL_EXPR
|| code
== MODIFY_EXPR
) &&
10450 TREE_CODE (TREE_OPERAND (qual_wfl
, 0)) == EXPR_WITH_FILE_LOCATION
)
10451 name
= EXPR_WFL_NODE (TREE_OPERAND (qual_wfl
, 0));
10453 else if (code
== STRING_CST
|| code
== CONDITIONAL_EXPR
)
10455 qual
= TREE_CHAIN (qual
);
10456 qual_wfl
= QUAL_WFL (qual
);
10461 name
= EXPR_WFL_NODE (qual_wfl
);
10464 qual
= EXPR_WFL_QUALIFICATION (qual_wfl
);
10469 /* If we have a THIS (from a primary), we set the context accordingly */
10470 if (name
== this_identifier_node
)
10472 qual
= TREE_CHAIN (qual
);
10473 qual_wfl
= QUAL_WFL (qual
);
10474 if (TREE_CODE (qual_wfl
) == CALL_EXPR
)
10477 name
= EXPR_WFL_NODE (qual_wfl
);
10480 /* If we have a SUPER, we set the context accordingly */
10481 if (name
== super_identifier_node
)
10483 current_class
= CLASSTYPE_SUPER (ptr_type
);
10484 /* Check that there is such a thing as a super class. If not,
10485 return. The error will be caught later on, during the
10487 if (!current_class
)
10489 current_class
= saved_current_class
;
10492 qual
= TREE_CHAIN (qual
);
10493 /* Do one more interation to set things up */
10494 super_found
= again
= 1;
10498 /* If name appears within the scope of a location variable
10499 declaration or parameter declaration, then it is an expression
10500 name. We don't carry this test out if we're in the context of the
10501 use of SUPER or THIS */
10502 if (!this_found
&& !super_found
&&
10503 TREE_CODE (name
) != STRING_CST
&& (decl
= IDENTIFIER_LOCAL_VALUE (name
)))
10505 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
10506 QUAL_RESOLUTION (qual
) = decl
;
10509 /* If within the class/interface NAME was found to be used there
10510 exists a (possibly inherited) field named NAME, then this is an
10511 expression name. If we saw a NEW_ARRAY_EXPR before and want to
10512 address length, it is OK. */
10513 else if ((decl
= lookup_field_wrapper (ptr_type
, name
))
10514 || (new_array_found
&& name
== length_identifier_node
))
10516 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
10517 QUAL_RESOLUTION (qual
) = (new_array_found
? NULL_TREE
: decl
);
10520 /* We reclassify NAME as yielding to a type name resolution if:
10521 - NAME is a class/interface declared within the compilation
10522 unit containing NAME,
10523 - NAME is imported via a single-type-import declaration,
10524 - NAME is declared in an another compilation unit of the package
10525 of the compilation unit containing NAME,
10526 - NAME is declared by exactly on type-import-on-demand declaration
10527 of the compilation unit containing NAME.
10528 - NAME is actually a STRING_CST. */
10529 else if (TREE_CODE (name
) == STRING_CST
||
10530 (decl
= resolve_and_layout (name
, NULL_TREE
)))
10532 RESOLVE_TYPE_NAME_P (qual_wfl
) = 1;
10533 QUAL_RESOLUTION (qual
) = decl
;
10536 /* Method call are expression name */
10537 else if (TREE_CODE (QUAL_WFL (qual
)) == CALL_EXPR
10538 || TREE_CODE (QUAL_WFL (qual
)) == ARRAY_REF
10539 || TREE_CODE (QUAL_WFL (qual
)) == CONVERT_EXPR
)
10540 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
10542 /* Check here that NAME isn't declared by more than one
10543 type-import-on-demand declaration of the compilation unit
10544 containing NAME. FIXME */
10546 /* Otherwise, NAME is reclassified as a package name */
10548 RESOLVE_PACKAGE_NAME_P (qual_wfl
) = 1;
10550 /* Propagate the qualification accross other components of the
10552 for (qual
= TREE_CHAIN (qual
); qual
;
10553 qual_wfl
= QUAL_WFL (qual
), qual
= TREE_CHAIN (qual
))
10555 if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
10556 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual
)) = 1;
10558 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual
)) = 1;
10561 /* Store the global qualification for the ambiguous part of ID back
10563 if (RESOLVE_EXPRESSION_NAME_P (qual_wfl
))
10564 RESOLVE_EXPRESSION_NAME_P (id
) = 1;
10565 else if (RESOLVE_TYPE_NAME_P (qual_wfl
))
10566 RESOLVE_TYPE_NAME_P (id
) = 1;
10567 else if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
10568 RESOLVE_PACKAGE_NAME_P (id
) = 1;
10570 /* Restore the current class */
10571 current_class
= saved_current_class
;
10575 breakdown_qualified (left
, right
, source
)
10576 tree
*left
, *right
, source
;
10578 char *p
= IDENTIFIER_POINTER (source
), *base
;
10579 int l
= IDENTIFIER_LENGTH (source
);
10581 /* Breakdown NAME into REMAINDER . IDENTIFIER */
10584 while (*p
!= '.' && p
!= base
)
10587 /* We didn't find a '.'. Return an error */
10593 *right
= get_identifier (p
+1);
10594 *left
= get_identifier (IDENTIFIER_POINTER (source
));
10600 /* Patch tree nodes in a function body. When a BLOCK is found, push
10601 local variable decls if present.
10602 Same as java_complete_lhs, but does resolve static finals to values. */
10605 java_complete_tree (node
)
10608 node
= java_complete_lhs (node
);
10609 if (TREE_CODE (node
) == VAR_DECL
&& FIELD_STATIC (node
)
10610 && FIELD_FINAL (node
) && DECL_INITIAL (node
) != NULL_TREE
10611 && !flag_emit_xref
)
10613 tree value
= DECL_INITIAL (node
);
10614 DECL_INITIAL (node
) = NULL_TREE
;
10615 push_obstacks (&permanent_obstack
, &permanent_obstack
);
10616 value
= fold_constant_for_init (value
, node
);
10618 DECL_INITIAL (node
) = value
;
10619 if (value
!= NULL_TREE
)
10626 java_stabilize_reference (node
)
10629 if (TREE_CODE (node
) == COMPOUND_EXPR
)
10631 tree op0
= TREE_OPERAND (node
, 0);
10632 tree op1
= TREE_OPERAND (node
, 1);
10633 TREE_OPERAND (node
, 0) = save_expr (op0
);
10634 TREE_OPERAND (node
, 1) = java_stabilize_reference (op1
);
10637 return stabilize_reference (node
);
10640 /* Patch tree nodes in a function body. When a BLOCK is found, push
10641 local variable decls if present.
10642 Same as java_complete_tree, but does not resolve static finals to values. */
10645 java_complete_lhs (node
)
10648 tree nn
, cn
, wfl_op1
, wfl_op2
, wfl_op3
;
10651 /* CONVERT_EXPR always has its type set, even though it needs to be
10653 if (TREE_TYPE (node
) && TREE_CODE (node
) != CONVERT_EXPR
)
10656 /* The switch block implements cases processing container nodes
10657 first. Contained nodes are always written back. Leaves come
10658 next and return a value. */
10659 switch (TREE_CODE (node
))
10663 /* 1- Block section.
10664 Set the local values on decl names so we can identify them
10665 faster when they're referenced. At that stage, identifiers
10666 are legal so we don't check for declaration errors. */
10667 for (cn
= BLOCK_EXPR_DECLS (node
); cn
; cn
= TREE_CHAIN (cn
))
10669 DECL_CONTEXT (cn
) = current_function_decl
;
10670 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn
)) = cn
;
10672 if (BLOCK_EXPR_BODY (node
) == NULL_TREE
)
10673 CAN_COMPLETE_NORMALLY (node
) = 1;
10676 tree stmt
= BLOCK_EXPR_BODY (node
);
10678 int error_seen
= 0;
10679 if (TREE_CODE (stmt
) == COMPOUND_EXPR
)
10681 /* Re-order from (((A; B); C); ...; Z) to
10682 (A; (B; (C ; (...; Z)))).
10683 This makes it easier to scan the statements left-to-right
10684 without using recursion (which might overflow the stack
10685 if the block has many statements. */
10688 tree left
= TREE_OPERAND (stmt
, 0);
10689 if (TREE_CODE (left
) != COMPOUND_EXPR
)
10691 TREE_OPERAND (stmt
, 0) = TREE_OPERAND (left
, 1);
10692 TREE_OPERAND (left
, 1) = stmt
;
10695 BLOCK_EXPR_BODY (node
) = stmt
;
10698 /* Now do the actual complete, without deep recursion for
10700 ptr
= &BLOCK_EXPR_BODY (node
);
10701 while (TREE_CODE (*ptr
) == COMPOUND_EXPR
10702 && TREE_OPERAND (*ptr
, 1) != empty_stmt_node
)
10704 tree cur
= java_complete_tree (TREE_OPERAND (*ptr
, 0));
10705 tree
*next
= &TREE_OPERAND (*ptr
, 1);
10706 TREE_OPERAND (*ptr
, 0) = cur
;
10707 if (cur
== empty_stmt_node
)
10709 /* Optimization; makes it easier to detect empty bodies.
10710 Most useful for <clinit> with all-constant initializer. */
10714 if (TREE_CODE (cur
) == ERROR_MARK
)
10716 else if (! CAN_COMPLETE_NORMALLY (cur
))
10721 if (TREE_CODE (wfl_op2
) == BLOCK
)
10722 wfl_op2
= BLOCK_EXPR_BODY (wfl_op2
);
10723 else if (TREE_CODE (wfl_op2
) == COMPOUND_EXPR
)
10724 wfl_op2
= TREE_OPERAND (wfl_op2
, 0);
10728 if (TREE_CODE (wfl_op2
) != CASE_EXPR
10729 && TREE_CODE (wfl_op2
) != DEFAULT_EXPR
)
10730 unreachable_stmt_error (*ptr
);
10734 *ptr
= java_complete_tree (*ptr
);
10736 if (TREE_CODE (*ptr
) == ERROR_MARK
|| error_seen
> 0)
10737 return error_mark_node
;
10738 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (*ptr
);
10740 /* Turn local bindings to null */
10741 for (cn
= BLOCK_EXPR_DECLS (node
); cn
; cn
= TREE_CHAIN (cn
))
10742 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn
)) = NULL_TREE
;
10744 TREE_TYPE (node
) = void_type_node
;
10747 /* 2- They are expressions but ultimately deal with statements */
10750 wfl_op1
= TREE_OPERAND (node
, 0);
10751 COMPLETE_CHECK_OP_0 (node
);
10752 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10753 return patch_throw_statement (node
, wfl_op1
);
10755 case SYNCHRONIZED_EXPR
:
10756 wfl_op1
= TREE_OPERAND (node
, 0);
10757 return patch_synchronized_statement (node
, wfl_op1
);
10760 return patch_try_statement (node
);
10762 case TRY_FINALLY_EXPR
:
10763 COMPLETE_CHECK_OP_0 (node
);
10764 COMPLETE_CHECK_OP_1 (node
);
10765 CAN_COMPLETE_NORMALLY (node
)
10766 = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 0))
10767 && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1)));
10768 TREE_TYPE (node
) = TREE_TYPE (TREE_OPERAND (node
, 0));
10771 case CLEANUP_POINT_EXPR
:
10772 COMPLETE_CHECK_OP_0 (node
);
10773 TREE_TYPE (node
) = void_type_node
;
10774 CAN_COMPLETE_NORMALLY (node
) =
10775 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 0));
10778 case WITH_CLEANUP_EXPR
:
10779 COMPLETE_CHECK_OP_0 (node
);
10780 COMPLETE_CHECK_OP_2 (node
);
10781 CAN_COMPLETE_NORMALLY (node
) =
10782 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 0));
10783 TREE_TYPE (node
) = void_type_node
;
10786 case LABELED_BLOCK_EXPR
:
10787 PUSH_LABELED_BLOCK (node
);
10788 if (LABELED_BLOCK_BODY (node
))
10789 COMPLETE_CHECK_OP_1 (node
);
10790 TREE_TYPE (node
) = void_type_node
;
10791 POP_LABELED_BLOCK ();
10793 if (LABELED_BLOCK_BODY (node
) == empty_stmt_node
)
10795 LABELED_BLOCK_BODY (node
) = NULL_TREE
;
10796 CAN_COMPLETE_NORMALLY (node
) = 1;
10798 else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node
)))
10799 CAN_COMPLETE_NORMALLY (node
) = 1;
10802 case EXIT_BLOCK_EXPR
:
10803 /* We don't complete operand 1, because it's the return value of
10804 the EXIT_BLOCK_EXPR which doesn't exist it Java */
10805 return patch_bc_statement (node
);
10808 cn
= java_complete_tree (TREE_OPERAND (node
, 0));
10809 if (cn
== error_mark_node
)
10812 /* First, the case expression must be constant. Values of final
10813 fields are accepted. */
10815 if ((TREE_CODE (cn
) == COMPOUND_EXPR
|| TREE_CODE (cn
) == COMPONENT_REF
)
10816 && JDECL_P (TREE_OPERAND (cn
, 1))
10817 && FIELD_FINAL (TREE_OPERAND (cn
, 1))
10818 && DECL_INITIAL (TREE_OPERAND (cn
, 1)))
10820 push_obstacks (&permanent_obstack
, &permanent_obstack
);
10821 cn
= fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn
, 1)),
10822 TREE_OPERAND (cn
, 1));
10826 if (!TREE_CONSTANT (cn
) && !flag_emit_xref
)
10828 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10829 parse_error_context (node
, "Constant expression required");
10830 return error_mark_node
;
10833 nn
= ctxp
->current_loop
;
10835 /* It must be assignable to the type of the switch expression. */
10836 if (!try_builtin_assignconv (NULL_TREE
,
10837 TREE_TYPE (TREE_OPERAND (nn
, 0)), cn
))
10839 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10840 parse_error_context
10842 "Incompatible type for case. Can't convert `%s' to `int'",
10843 lang_printable_name (TREE_TYPE (cn
), 0));
10844 return error_mark_node
;
10847 cn
= fold (convert (int_type_node
, cn
));
10849 /* Multiple instance of a case label bearing the same
10850 value is checked during code generation. The case
10851 expression is allright so far. */
10852 TREE_OPERAND (node
, 0) = cn
;
10853 TREE_TYPE (node
) = void_type_node
;
10854 CAN_COMPLETE_NORMALLY (node
) = 1;
10855 TREE_SIDE_EFFECTS (node
) = 1;
10859 nn
= ctxp
->current_loop
;
10860 /* Only one default label is allowed per switch statement */
10861 if (SWITCH_HAS_DEFAULT (nn
))
10863 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10864 parse_error_context (wfl_operator
,
10865 "Duplicate case label: `default'");
10866 return error_mark_node
;
10869 SWITCH_HAS_DEFAULT (nn
) = 1;
10870 TREE_TYPE (node
) = void_type_node
;
10871 TREE_SIDE_EFFECTS (node
) = 1;
10872 CAN_COMPLETE_NORMALLY (node
) = 1;
10878 /* Check whether the loop was enclosed in a labeled
10879 statement. If not, create one, insert the loop in it and
10881 nn
= patch_loop_statement (node
);
10883 /* Anyways, walk the body of the loop */
10884 if (TREE_CODE (node
) == LOOP_EXPR
)
10885 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10886 /* Switch statement: walk the switch expression and the cases */
10888 node
= patch_switch_statement (node
);
10890 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10891 nn
= error_mark_node
;
10894 TREE_TYPE (nn
) = TREE_TYPE (node
) = void_type_node
;
10895 /* If we returned something different, that's because we
10896 inserted a label. Pop the label too. */
10899 if (CAN_COMPLETE_NORMALLY (node
))
10900 CAN_COMPLETE_NORMALLY (nn
) = 1;
10901 POP_LABELED_BLOCK ();
10908 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10909 return patch_exit_expr (node
);
10913 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10914 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10915 return error_mark_node
;
10916 /* then-else branches */
10917 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
10918 if (TREE_OPERAND (node
, 1) == error_mark_node
)
10919 return error_mark_node
;
10920 TREE_OPERAND (node
, 2) = java_complete_tree (TREE_OPERAND (node
, 2));
10921 if (TREE_OPERAND (node
, 2) == error_mark_node
)
10922 return error_mark_node
;
10923 return patch_if_else_statement (node
);
10926 case CONDITIONAL_EXPR
:
10928 wfl_op1
= TREE_OPERAND (node
, 0);
10929 COMPLETE_CHECK_OP_0 (node
);
10930 wfl_op2
= TREE_OPERAND (node
, 1);
10931 COMPLETE_CHECK_OP_1 (node
);
10932 wfl_op3
= TREE_OPERAND (node
, 2);
10933 COMPLETE_CHECK_OP_2 (node
);
10934 return patch_conditional_expr (node
, wfl_op1
, wfl_op2
);
10936 /* 3- Expression section */
10937 case COMPOUND_EXPR
:
10938 wfl_op2
= TREE_OPERAND (node
, 1);
10939 TREE_OPERAND (node
, 0) = nn
=
10940 java_complete_tree (TREE_OPERAND (node
, 0));
10941 if (wfl_op2
== empty_stmt_node
)
10942 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (nn
);
10945 if (! CAN_COMPLETE_NORMALLY (nn
) && TREE_CODE (nn
) != ERROR_MARK
)
10947 /* An unreachable condition in a do-while statement
10948 is *not* (technically) an unreachable statement. */
10950 if (TREE_CODE (nn
) == EXPR_WITH_FILE_LOCATION
)
10951 nn
= EXPR_WFL_NODE (nn
);
10952 if (TREE_CODE (nn
) != EXIT_EXPR
)
10954 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op2
);
10955 parse_error_context (wfl_operator
, "Unreachable statement");
10958 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
10959 if (TREE_OPERAND (node
, 1) == error_mark_node
)
10960 return error_mark_node
;
10961 CAN_COMPLETE_NORMALLY (node
)
10962 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1));
10964 TREE_TYPE (node
) = TREE_TYPE (TREE_OPERAND (node
, 1));
10968 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10969 return patch_return (node
);
10971 case EXPR_WITH_FILE_LOCATION
:
10972 if (!EXPR_WFL_NODE (node
) /* Or a PRIMARY flag ? */
10973 || TREE_CODE (EXPR_WFL_NODE (node
)) == IDENTIFIER_NODE
)
10976 node
= resolve_expression_name (node
, NULL
);
10977 if (node
== error_mark_node
)
10979 /* Keep line number information somewhere were it doesn't
10980 disrupt the completion process. */
10981 if (flag_emit_xref
&& TREE_CODE (node
) != CALL_EXPR
)
10983 EXPR_WFL_NODE (wfl
) = TREE_OPERAND (node
, 1);
10984 TREE_OPERAND (node
, 1) = wfl
;
10986 CAN_COMPLETE_NORMALLY (node
) = 1;
10991 int save_lineno
= lineno
;
10992 lineno
= EXPR_WFL_LINENO (node
);
10993 body
= java_complete_tree (EXPR_WFL_NODE (node
));
10994 lineno
= save_lineno
;
10995 EXPR_WFL_NODE (node
) = body
;
10996 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (body
);
10997 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (body
);
10998 if (body
== empty_stmt_node
)
11000 /* Optimization; makes it easier to detect empty bodies. */
11003 if (body
== error_mark_node
)
11005 /* Its important for the evaluation of assignment that
11006 this mark on the TREE_TYPE is propagated. */
11007 TREE_TYPE (node
) = error_mark_node
;
11008 return error_mark_node
;
11011 TREE_TYPE (node
) = TREE_TYPE (EXPR_WFL_NODE (node
));
11016 case NEW_ARRAY_EXPR
:
11017 /* Patch all the dimensions */
11019 for (cn
= TREE_OPERAND (node
, 1); cn
; cn
= TREE_CHAIN (cn
))
11021 int location
= EXPR_WFL_LINECOL (TREE_VALUE (cn
));
11022 tree dim
= java_complete_tree (TREE_VALUE (cn
));
11023 if (dim
== error_mark_node
)
11030 TREE_VALUE (cn
) = dim
;
11031 /* Setup the location of the current dimension, for
11032 later error report. */
11033 TREE_PURPOSE (cn
) =
11034 build_expr_wfl (NULL_TREE
, input_filename
, 0, 0);
11035 EXPR_WFL_LINECOL (TREE_PURPOSE (cn
)) = location
;
11038 /* They complete the array creation expression, if no errors
11040 CAN_COMPLETE_NORMALLY (node
) = 1;
11041 return (flag
? error_mark_node
11042 : force_evaluation_order (patch_newarray (node
)));
11044 case NEW_CLASS_EXPR
:
11046 /* Complete function's argument(s) first */
11047 if (complete_function_arguments (node
))
11048 return error_mark_node
;
11051 tree decl
, wfl
= TREE_OPERAND (node
, 0);
11052 int in_this
= CALL_THIS_CONSTRUCTOR_P (node
);
11054 node
= patch_method_invocation (node
, NULL_TREE
,
11055 NULL_TREE
, 0, &decl
);
11056 if (node
== error_mark_node
)
11057 return error_mark_node
;
11059 check_thrown_exceptions (EXPR_WFL_LINECOL (node
), decl
);
11060 /* If we call this(...), register signature and positions */
11062 DECL_CONSTRUCTOR_CALLS (current_function_decl
) =
11063 tree_cons (wfl
, decl
,
11064 DECL_CONSTRUCTOR_CALLS (current_function_decl
));
11065 CAN_COMPLETE_NORMALLY (node
) = 1;
11066 return force_evaluation_order (node
);
11070 /* Save potential wfls */
11071 wfl_op1
= TREE_OPERAND (node
, 0);
11072 TREE_OPERAND (node
, 0) = nn
= java_complete_lhs (wfl_op1
);
11073 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node
)
11074 && TREE_CODE (nn
) == VAR_DECL
&& TREE_STATIC (nn
)
11075 && DECL_INITIAL (nn
) != NULL_TREE
)
11079 push_obstacks (&permanent_obstack
, &permanent_obstack
);
11080 value
= fold_constant_for_init (nn
, nn
);
11082 if (value
!= NULL_TREE
)
11084 tree type
= TREE_TYPE (value
);
11085 if (JPRIMITIVE_TYPE_P (type
) || type
== string_ptr_type_node
)
11086 return empty_stmt_node
;
11088 DECL_INITIAL (nn
) = NULL_TREE
;
11090 wfl_op2
= TREE_OPERAND (node
, 1);
11092 if (TREE_OPERAND (node
, 0) == error_mark_node
)
11093 return error_mark_node
;
11095 flag
= COMPOUND_ASSIGN_P (wfl_op2
);
11098 tree lvalue
= java_stabilize_reference (TREE_OPERAND (node
, 0));
11100 /* Hand stablize the lhs on both places */
11101 TREE_OPERAND (node
, 0) = lvalue
;
11102 TREE_OPERAND (TREE_OPERAND (node
, 1), 0) =
11103 (flag_emit_class_files
? lvalue
: save_expr (lvalue
));
11105 /* 15.25.2.a: Left hand is not an array access. FIXME */
11106 /* Now complete the RHS. We write it back later on. */
11107 nn
= java_complete_tree (TREE_OPERAND (node
, 1));
11109 if ((cn
= patch_string (nn
)))
11112 /* The last part of the rewrite for E1 op= E2 is to have
11113 E1 = (T)(E1 op E2), with T being the type of E1. */
11114 nn
= java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2
),
11115 TREE_TYPE (lvalue
), nn
));
11117 /* 15.25.2.b: Left hand is an array access. FIXME */
11120 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
11121 function to complete this RHS */
11122 else if (TREE_CODE (wfl_op2
) == NEW_ARRAY_INIT
)
11123 nn
= patch_new_array_init (TREE_TYPE (TREE_OPERAND (node
, 0)),
11124 TREE_OPERAND (node
, 1));
11125 /* Otherwise we simply complete the RHS */
11127 nn
= java_complete_tree (TREE_OPERAND (node
, 1));
11129 if (nn
== error_mark_node
)
11130 return error_mark_node
;
11132 /* Write back the RHS as we evaluated it. */
11133 TREE_OPERAND (node
, 1) = nn
;
11135 /* In case we're handling = with a String as a RHS, we need to
11136 produce a String out of the RHS (it might still be a
11137 STRING_CST or a StringBuffer at this stage */
11138 if ((nn
= patch_string (TREE_OPERAND (node
, 1))))
11139 TREE_OPERAND (node
, 1) = nn
;
11140 node
= patch_assignment (node
, wfl_op1
, wfl_op2
);
11141 /* Reorganize the tree if necessary. */
11142 if (flag
&& (!JREFERENCE_TYPE_P (TREE_TYPE (node
))
11143 || JSTRING_P (TREE_TYPE (node
))))
11144 node
= java_refold (node
);
11145 CAN_COMPLETE_NORMALLY (node
) = 1;
11157 case TRUNC_MOD_EXPR
:
11159 case TRUTH_ANDIF_EXPR
:
11160 case TRUTH_ORIF_EXPR
:
11167 /* Operands 0 and 1 are WFL in certain cases only. patch_binop
11168 knows how to handle those cases. */
11169 wfl_op1
= TREE_OPERAND (node
, 0);
11170 wfl_op2
= TREE_OPERAND (node
, 1);
11172 CAN_COMPLETE_NORMALLY (node
) = 1;
11173 /* Don't complete string nodes if dealing with the PLUS operand. */
11174 if (TREE_CODE (node
) != PLUS_EXPR
|| !JSTRING_P (wfl_op1
))
11176 nn
= java_complete_tree (wfl_op1
);
11177 if (nn
== error_mark_node
)
11178 return error_mark_node
;
11179 if ((cn
= patch_string (nn
)))
11181 TREE_OPERAND (node
, 0) = nn
;
11183 if (TREE_CODE (node
) != PLUS_EXPR
|| !JSTRING_P (wfl_op2
))
11185 nn
= java_complete_tree (wfl_op2
);
11186 if (nn
== error_mark_node
)
11187 return error_mark_node
;
11188 if ((cn
= patch_string (nn
)))
11190 TREE_OPERAND (node
, 1) = nn
;
11192 return force_evaluation_order (patch_binop (node
, wfl_op1
, wfl_op2
));
11194 case INSTANCEOF_EXPR
:
11195 wfl_op1
= TREE_OPERAND (node
, 0);
11196 COMPLETE_CHECK_OP_0 (node
);
11197 if (flag_emit_xref
)
11199 TREE_TYPE (node
) = boolean_type_node
;
11202 return patch_binop (node
, wfl_op1
, TREE_OPERAND (node
, 1));
11204 case UNARY_PLUS_EXPR
:
11206 case TRUTH_NOT_EXPR
:
11208 case PREDECREMENT_EXPR
:
11209 case PREINCREMENT_EXPR
:
11210 case POSTDECREMENT_EXPR
:
11211 case POSTINCREMENT_EXPR
:
11213 /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
11214 how to handle those cases. */
11215 wfl_op1
= TREE_OPERAND (node
, 0);
11216 CAN_COMPLETE_NORMALLY (node
) = 1;
11217 TREE_OPERAND (node
, 0) = java_complete_tree (wfl_op1
);
11218 if (TREE_OPERAND (node
, 0) == error_mark_node
)
11219 return error_mark_node
;
11220 node
= patch_unaryop (node
, wfl_op1
);
11221 CAN_COMPLETE_NORMALLY (node
) = 1;
11225 /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
11226 how to handle those cases. */
11227 wfl_op1
= TREE_OPERAND (node
, 0);
11228 TREE_OPERAND (node
, 0) = java_complete_tree (wfl_op1
);
11229 if (TREE_OPERAND (node
, 0) == error_mark_node
)
11230 return error_mark_node
;
11231 if (!flag_emit_class_files
&& !flag_emit_xref
)
11232 TREE_OPERAND (node
, 0) = save_expr (TREE_OPERAND (node
, 0));
11233 /* The same applies to wfl_op2 */
11234 wfl_op2
= TREE_OPERAND (node
, 1);
11235 TREE_OPERAND (node
, 1) = java_complete_tree (wfl_op2
);
11236 if (TREE_OPERAND (node
, 1) == error_mark_node
)
11237 return error_mark_node
;
11238 if (!flag_emit_class_files
&& !flag_emit_xref
)
11239 TREE_OPERAND (node
, 1) = save_expr (TREE_OPERAND (node
, 1));
11240 return patch_array_ref (node
);
11245 case COMPONENT_REF
:
11246 /* The first step in the re-write of qualified name handling. FIXME.
11247 So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
11248 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
11249 if (TREE_CODE (TREE_OPERAND (node
, 0)) == RECORD_TYPE
)
11251 tree name
= TREE_OPERAND (node
, 1);
11252 tree field
= lookup_field_wrapper (TREE_OPERAND (node
, 0), name
);
11253 if (field
== NULL_TREE
)
11255 error ("missing static field `%s'", IDENTIFIER_POINTER (name
));
11256 return error_mark_node
;
11258 if (! FIELD_STATIC (field
))
11260 error ("not a static field `%s'", IDENTIFIER_POINTER (name
));
11261 return error_mark_node
;
11266 fatal ("unimplemented java_complete_tree for COMPONENT_REF");
11270 /* Can't use THIS in a static environment */
11273 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11274 parse_error_context (wfl_operator
, "Keyword `this' used outside "
11275 "allowed context");
11276 TREE_TYPE (node
) = error_mark_node
;
11277 return error_mark_node
;
11279 if (ctxp
->explicit_constructor_p
)
11281 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11282 parse_error_context
11283 (wfl_operator
, "Can't reference `this' or `super' before the "
11284 "superclass constructor has been called");
11285 TREE_TYPE (node
) = error_mark_node
;
11286 return error_mark_node
;
11288 return current_this
;
11291 CAN_COMPLETE_NORMALLY (node
) = 1;
11292 /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
11293 and it's time to turn it into the appropriate String object
11295 if ((node
= patch_string (node
)))
11297 fatal ("No case for tree code `%s' - java_complete_tree\n",
11298 tree_code_name
[TREE_CODE (node
)]);
11303 /* Complete function call's argument. Return a non zero value is an
11304 error was found. */
11307 complete_function_arguments (node
)
11313 ctxp
->explicit_constructor_p
+= (CALL_THIS_CONSTRUCTOR_P (node
) ? 1 : 0);
11314 for (cn
= TREE_OPERAND (node
, 1); cn
; cn
= TREE_CHAIN (cn
))
11316 tree wfl
= TREE_VALUE (cn
), parm
, temp
;
11317 parm
= java_complete_tree (wfl
);
11318 if (parm
== error_mark_node
)
11323 /* If have a string literal that we haven't transformed yet or a
11324 crafted string buffer, as a result of use of the the String
11325 `+' operator. Build `parm.toString()' and expand it. */
11326 if ((temp
= patch_string (parm
)))
11328 /* Inline PRIMTYPE.TYPE read access */
11329 parm
= maybe_build_primttype_type_ref (parm
, wfl
);
11331 TREE_VALUE (cn
) = parm
;
11333 ctxp
->explicit_constructor_p
-= (CALL_THIS_CONSTRUCTOR_P (node
) ? 1 : 0);
11337 /* Sometimes (for loops and variable initialized during their
11338 declaration), we want to wrap a statement around a WFL and turn it
11342 build_debugable_stmt (location
, stmt
)
11346 if (TREE_CODE (stmt
) != EXPR_WITH_FILE_LOCATION
)
11348 stmt
= build_expr_wfl (stmt
, input_filename
, 0, 0);
11349 EXPR_WFL_LINECOL (stmt
) = location
;
11351 JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt
);
11356 build_expr_block (body
, decls
)
11359 tree node
= make_node (BLOCK
);
11360 BLOCK_EXPR_DECLS (node
) = decls
;
11361 BLOCK_EXPR_BODY (node
) = body
;
11363 TREE_TYPE (node
) = TREE_TYPE (body
);
11364 TREE_SIDE_EFFECTS (node
) = 1;
11368 /* Create a new function block and link it approriately to current
11369 function block chain */
11374 return (enter_a_block (build_expr_block (NULL_TREE
, NULL_TREE
)));
11377 /* Link block B supercontext to the previous block. The current
11378 function DECL is used as supercontext when enter_a_block is called
11379 for the first time for a given function. The current function body
11380 (DECL_FUNCTION_BODY) is set to be block B. */
11386 tree fndecl
= current_function_decl
;
11389 BLOCK_SUPERCONTEXT (b
) = current_static_block
;
11390 current_static_block
= b
;
11393 else if (!DECL_FUNCTION_BODY (fndecl
))
11395 BLOCK_SUPERCONTEXT (b
) = fndecl
;
11396 DECL_FUNCTION_BODY (fndecl
) = b
;
11400 BLOCK_SUPERCONTEXT (b
) = DECL_FUNCTION_BODY (fndecl
);
11401 DECL_FUNCTION_BODY (fndecl
) = b
;
11406 /* Exit a block by changing the current function body
11407 (DECL_FUNCTION_BODY) to the current block super context, only if
11408 the block being exited isn't the method's top level one. */
11414 if (current_function_decl
)
11416 b
= DECL_FUNCTION_BODY (current_function_decl
);
11417 if (BLOCK_SUPERCONTEXT (b
) != current_function_decl
)
11418 DECL_FUNCTION_BODY (current_function_decl
) = BLOCK_SUPERCONTEXT (b
);
11422 b
= current_static_block
;
11424 if (BLOCK_SUPERCONTEXT (b
))
11425 current_static_block
= BLOCK_SUPERCONTEXT (b
);
11430 /* Lookup for NAME in the nested function's blocks, all the way up to
11431 the current toplevel one. It complies with Java's local variable
11435 lookup_name_in_blocks (name
)
11438 tree b
= GET_CURRENT_BLOCK (current_function_decl
);
11440 while (b
!= current_function_decl
)
11444 /* Paranoid sanity check. To be removed */
11445 if (TREE_CODE (b
) != BLOCK
)
11446 fatal ("non block expr function body - lookup_name_in_blocks");
11448 for (current
= BLOCK_EXPR_DECLS (b
); current
;
11449 current
= TREE_CHAIN (current
))
11450 if (DECL_NAME (current
) == name
)
11452 b
= BLOCK_SUPERCONTEXT (b
);
11458 maybe_absorb_scoping_blocks ()
11460 while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl
)))
11462 tree b
= exit_block ();
11463 java_method_add_stmt (current_function_decl
, b
);
11464 SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno
));
11469 /* This section of the source is reserved to build_* functions that
11470 are building incomplete tree nodes and the patch_* functions that
11471 are completing them. */
11473 /* Build a super() constructor invocation. Returns empty_stmt_node if
11474 we're currently dealing with the class java.lang.Object. */
11477 build_super_invocation ()
11479 if (current_class
== object_type_node
)
11480 return empty_stmt_node
;
11483 tree super_wfl
= build_wfl_node (super_identifier_node
);
11484 return build_method_invocation (super_wfl
, NULL_TREE
);
11488 /* Build a SUPER/THIS qualified method invocation. */
11491 build_this_super_qualified_invocation (use_this
, name
, args
, lloc
, rloc
)
11499 build_wfl_node (use_this
? this_identifier_node
: super_identifier_node
);
11500 EXPR_WFL_LINECOL (wfl
) = lloc
;
11501 invok
= build_method_invocation (name
, args
);
11502 return make_qualified_primary (wfl
, invok
, rloc
);
11505 /* Build an incomplete CALL_EXPR node. */
11508 build_method_invocation (name
, args
)
11512 tree call
= build (CALL_EXPR
, NULL_TREE
, name
, args
, NULL_TREE
);
11513 TREE_SIDE_EFFECTS (call
) = 1;
11514 EXPR_WFL_LINECOL (call
) = EXPR_WFL_LINECOL (name
);
11518 /* Build an incomplete new xxx(...) node. */
11521 build_new_invocation (name
, args
)
11524 tree call
= build (NEW_CLASS_EXPR
, NULL_TREE
, name
, args
, NULL_TREE
);
11525 TREE_SIDE_EFFECTS (call
) = 1;
11526 EXPR_WFL_LINECOL (call
) = EXPR_WFL_LINECOL (name
);
11530 /* Build an incomplete assignment expression. */
11533 build_assignment (op
, op_location
, lhs
, rhs
)
11534 int op
, op_location
;
11538 /* Build the corresponding binop if we deal with a Compound
11539 Assignment operator. Mark the binop sub-tree as part of a
11540 Compound Assignment expression */
11541 if (op
!= ASSIGN_TK
)
11543 rhs
= build_binop (BINOP_LOOKUP (op
), op_location
, lhs
, rhs
);
11544 COMPOUND_ASSIGN_P (rhs
) = 1;
11546 assignment
= build (MODIFY_EXPR
, NULL_TREE
, lhs
, rhs
);
11547 TREE_SIDE_EFFECTS (assignment
) = 1;
11548 EXPR_WFL_LINECOL (assignment
) = op_location
;
11552 /* Print an INTEGER_CST node in a static buffer, and return the buffer. */
11555 print_int_node (node
)
11558 static char buffer
[80];
11559 if (TREE_CONSTANT_OVERFLOW (node
))
11560 sprintf (buffer
, "<overflow>");
11562 if (TREE_INT_CST_HIGH (node
) == 0)
11563 sprintf (buffer
, HOST_WIDE_INT_PRINT_UNSIGNED
,
11564 TREE_INT_CST_LOW (node
));
11565 else if (TREE_INT_CST_HIGH (node
) == -1
11566 && TREE_INT_CST_LOW (node
) != 0)
11569 sprintf (&buffer
[1], HOST_WIDE_INT_PRINT_UNSIGNED
,
11570 -TREE_INT_CST_LOW (node
));
11573 sprintf (buffer
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
11574 TREE_INT_CST_HIGH (node
), TREE_INT_CST_LOW (node
));
11579 /* Return 1 if an assignment to a FINAL is attempted in a non suitable
11583 check_final_assignment (lvalue
, wfl
)
11586 if (JDECL_P (lvalue
)
11587 && FIELD_FINAL (lvalue
) && !IS_CLINIT (current_function_decl
))
11589 parse_error_context
11590 (wfl
, "Can't assign a value to the final variable `%s'",
11591 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
11597 /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
11598 read. This is needed to avoid circularities in the implementation
11599 of these fields in libjava. */
11602 maybe_build_primttype_type_ref (rhs
, wfl
)
11605 tree to_return
= NULL_TREE
;
11606 tree rhs_type
= TREE_TYPE (rhs
);
11607 if (TREE_CODE (rhs
) == COMPOUND_EXPR
)
11609 tree n
= TREE_OPERAND (rhs
, 1);
11610 if (TREE_CODE (n
) == VAR_DECL
11611 && DECL_NAME (n
) == TYPE_identifier_node
11612 && rhs_type
== class_ptr_type
)
11614 const char *self_name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
));
11615 if (!strncmp (self_name
, "java.lang.", 10))
11616 to_return
= build_primtype_type_ref (self_name
);
11619 return (to_return
? to_return
: rhs
);
11622 /* 15.25 Assignment operators. */
11625 patch_assignment (node
, wfl_op1
, wfl_op2
)
11630 tree rhs
= TREE_OPERAND (node
, 1);
11631 tree lvalue
= TREE_OPERAND (node
, 0), llvalue
;
11632 tree lhs_type
= NULL_TREE
, rhs_type
, new_rhs
= NULL_TREE
;
11633 int error_found
= 0;
11634 int lvalue_from_array
= 0;
11636 /* Can't assign to a final. */
11637 if (check_final_assignment (lvalue
, wfl_op1
))
11640 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11642 /* Lhs can be a named variable */
11643 if (JDECL_P (lvalue
))
11645 lhs_type
= TREE_TYPE (lvalue
);
11647 /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
11648 comment on reason why */
11649 else if (TREE_CODE (wfl_op1
) == ARRAY_REF
)
11651 lhs_type
= TREE_TYPE (lvalue
);
11652 lvalue_from_array
= 1;
11654 /* Or a field access */
11655 else if (TREE_CODE (lvalue
) == COMPONENT_REF
)
11656 lhs_type
= TREE_TYPE (lvalue
);
11657 /* Or a function return slot */
11658 else if (TREE_CODE (lvalue
) == RESULT_DECL
)
11659 lhs_type
= TREE_TYPE (lvalue
);
11660 /* Otherwise, we might want to try to write into an optimized static
11661 final, this is an of a different nature, reported further on. */
11662 else if (TREE_CODE (wfl_op1
) == EXPR_WITH_FILE_LOCATION
11663 && resolve_expression_name (wfl_op1
, &llvalue
))
11665 if (check_final_assignment (llvalue
, wfl_op1
))
11667 /* What we should do instead is resetting the all the flags
11668 previously set, exchange lvalue for llvalue and continue. */
11670 return error_mark_node
;
11673 lhs_type
= TREE_TYPE (lvalue
);
11677 parse_error_context (wfl_op1
, "Invalid left hand side of assignment");
11681 rhs_type
= TREE_TYPE (rhs
);
11682 /* 5.1 Try the assignment conversion for builtin type. */
11683 new_rhs
= try_builtin_assignconv (wfl_op1
, lhs_type
, rhs
);
11685 /* 5.2 If it failed, try a reference conversion */
11686 if (!new_rhs
&& (new_rhs
= try_reference_assignconv (lhs_type
, rhs
)))
11687 lhs_type
= promote_type (rhs_type
);
11689 /* 15.25.2 If we have a compound assignment, convert RHS into the
11691 else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node
, 1)))
11692 new_rhs
= convert (lhs_type
, rhs
);
11694 /* Explicit cast required. This is an error */
11697 char *t1
= xstrdup (lang_printable_name (TREE_TYPE (rhs
), 0));
11698 char *t2
= xstrdup (lang_printable_name (lhs_type
, 0));
11700 char operation
[32]; /* Max size known */
11702 /* If the assignment is part of a declaration, we use the WFL of
11703 the declared variable to point out the error and call it a
11704 declaration problem. If the assignment is a genuine =
11705 operator, we call is a operator `=' problem, otherwise we
11706 call it an assignment problem. In both of these last cases,
11707 we use the WFL of the operator to indicate the error. */
11709 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node
))
11712 strcpy (operation
, "declaration");
11716 wfl
= wfl_operator
;
11717 if (COMPOUND_ASSIGN_P (TREE_OPERAND (node
, 1)))
11718 strcpy (operation
, "assignment");
11719 else if (TREE_CODE (TREE_OPERAND (node
, 0)) == RESULT_DECL
)
11720 strcpy (operation
, "`return'");
11722 strcpy (operation
, "`='");
11725 if (!valid_cast_to_p (rhs_type
, lhs_type
))
11726 parse_error_context (wfl
, "Incompatible type for %s. "
11727 "Can't convert `%s' to `%s'",
11728 operation
, t1
, t2
);
11730 parse_error_context (wfl
, "Incompatible type for %s. "
11731 "Explicit cast needed to convert `%s' to `%s'",
11732 operation
, t1
, t2
);
11733 free (t1
); free (t2
);
11737 /* Inline read access to java.lang.PRIMTYPE.TYPE */
11739 new_rhs
= maybe_build_primttype_type_ref (new_rhs
, wfl_op2
);
11742 return error_mark_node
;
11744 /* 10.10: Array Store Exception runtime check */
11745 if (!flag_emit_class_files
11747 && lvalue_from_array
11748 && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type
))
11749 && !CLASS_FINAL (TYPE_NAME (GET_SKIP_TYPE (rhs_type
))))
11752 tree base
= lvalue
;
11754 /* We need to retrieve the right argument for _Jv_CheckArrayStore */
11755 if (TREE_CODE (lvalue
) == COMPOUND_EXPR
)
11756 base
= TREE_OPERAND (lvalue
, 0);
11759 if (flag_bounds_check
)
11760 base
= TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base
, 0), 1), 0);
11762 base
= TREE_OPERAND (TREE_OPERAND (base
, 0), 0);
11765 /* Build the invocation of _Jv_CheckArrayStore */
11766 new_rhs
= save_expr (new_rhs
);
11767 check
= build (CALL_EXPR
, void_type_node
,
11768 build_address_of (soft_checkarraystore_node
),
11769 tree_cons (NULL_TREE
, base
,
11770 build_tree_list (NULL_TREE
, new_rhs
)),
11772 TREE_SIDE_EFFECTS (check
) = 1;
11774 /* We have to decide on an insertion point */
11775 if (TREE_CODE (lvalue
) == COMPOUND_EXPR
)
11778 if (flag_bounds_check
)
11780 t
= TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue
, 1), 0), 0);
11781 TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue
, 1), 0), 0) =
11782 build (COMPOUND_EXPR
, void_type_node
, t
, check
);
11785 TREE_OPERAND (lvalue
, 1) = build (COMPOUND_EXPR
, lhs_type
,
11786 check
, TREE_OPERAND (lvalue
, 1));
11790 /* Make sure the bound check will happen before the store check */
11791 if (flag_bounds_check
)
11792 TREE_OPERAND (TREE_OPERAND (lvalue
, 0), 0) =
11793 build (COMPOUND_EXPR
, void_type_node
,
11794 TREE_OPERAND (TREE_OPERAND (lvalue
, 0), 0), check
);
11796 lvalue
= build (COMPOUND_EXPR
, lhs_type
, check
, lvalue
);
11800 TREE_OPERAND (node
, 0) = lvalue
;
11801 TREE_OPERAND (node
, 1) = new_rhs
;
11802 TREE_TYPE (node
) = lhs_type
;
11806 /* Check that type SOURCE can be cast into type DEST. If the cast
11807 can't occur at all, return 0 otherwise 1. This function is used to
11808 produce accurate error messages on the reasons why an assignment
11812 try_reference_assignconv (lhs_type
, rhs
)
11813 tree lhs_type
, rhs
;
11815 tree new_rhs
= NULL_TREE
;
11816 tree rhs_type
= TREE_TYPE (rhs
);
11818 if (!JPRIMITIVE_TYPE_P (rhs_type
) && JREFERENCE_TYPE_P (lhs_type
))
11820 /* `null' may be assigned to any reference type */
11821 if (rhs
== null_pointer_node
)
11822 new_rhs
= null_pointer_node
;
11823 /* Try the reference assignment conversion */
11824 else if (valid_ref_assignconv_cast_p (rhs_type
, lhs_type
, 0))
11826 /* This is a magic assignment that we process differently */
11827 else if (rhs
== soft_exceptioninfo_call_node
)
11833 /* Check that RHS can be converted into LHS_TYPE by the assignment
11834 conversion (5.2), for the cases of RHS being a builtin type. Return
11835 NULL_TREE if the conversion fails or if because RHS isn't of a
11836 builtin type. Return a converted RHS if the conversion is possible. */
11839 try_builtin_assignconv (wfl_op1
, lhs_type
, rhs
)
11840 tree wfl_op1
, lhs_type
, rhs
;
11842 tree new_rhs
= NULL_TREE
;
11843 tree rhs_type
= TREE_TYPE (rhs
);
11845 /* Zero accepted everywhere */
11846 if (TREE_CODE (rhs
) == INTEGER_CST
11847 && TREE_INT_CST_HIGH (rhs
) == 0 && TREE_INT_CST_LOW (rhs
) == 0
11848 && JPRIMITIVE_TYPE_P (rhs_type
))
11849 new_rhs
= convert (lhs_type
, rhs
);
11851 /* 5.1.1 Try Identity Conversion,
11852 5.1.2 Try Widening Primitive Conversion */
11853 else if (valid_builtin_assignconv_identity_widening_p (lhs_type
, rhs_type
))
11854 new_rhs
= convert (lhs_type
, rhs
);
11856 /* Try a narrowing primitive conversion (5.1.3):
11857 - expression is a constant expression of type int AND
11858 - variable is byte, short or char AND
11859 - The value of the expression is representable in the type of the
11861 else if (rhs_type
== int_type_node
&& TREE_CONSTANT (rhs
)
11862 && (lhs_type
== byte_type_node
|| lhs_type
== char_type_node
11863 || lhs_type
== short_type_node
))
11865 if (int_fits_type_p (rhs
, lhs_type
))
11866 new_rhs
= convert (lhs_type
, rhs
);
11867 else if (wfl_op1
) /* Might be called with a NULL */
11868 parse_warning_context
11869 (wfl_op1
, "Constant expression `%s' to wide for narrowing "
11870 "primitive conversion to `%s'",
11871 print_int_node (rhs
), lang_printable_name (lhs_type
, 0));
11872 /* Reported a warning that will turn into an error further
11873 down, so we don't return */
11879 /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
11880 conversion (5.1.1) or widening primitve conversion (5.1.2). Return
11881 0 is the conversion test fails. This implements parts the method
11882 invocation convertion (5.3). */
11885 valid_builtin_assignconv_identity_widening_p (lhs_type
, rhs_type
)
11886 tree lhs_type
, rhs_type
;
11888 /* 5.1.1: This is the identity conversion part. */
11889 if (lhs_type
== rhs_type
)
11892 /* Reject non primitive types */
11893 if (!JPRIMITIVE_TYPE_P (lhs_type
) || !JPRIMITIVE_TYPE_P (rhs_type
))
11896 /* 5.1.2: widening primitive conversion. byte, even if it's smaller
11897 than a char can't be converted into a char. Short can't too, but
11898 the < test below takes care of that */
11899 if (lhs_type
== char_type_node
&& rhs_type
== byte_type_node
)
11902 /* Accept all promoted type here. Note, we can't use <= in the test
11903 below, because we still need to bounce out assignments of short
11904 to char and the likes */
11905 if (lhs_type
== int_type_node
11906 && (rhs_type
== promoted_byte_type_node
11907 || rhs_type
== promoted_short_type_node
11908 || rhs_type
== promoted_char_type_node
11909 || rhs_type
== promoted_boolean_type_node
))
11912 /* From here, an integral is widened if its precision is smaller
11913 than the precision of the LHS or if the LHS is a floating point
11914 type, or the RHS is a float and the RHS a double. */
11915 if ((JINTEGRAL_TYPE_P (rhs_type
) && JINTEGRAL_TYPE_P (lhs_type
)
11916 && (TYPE_PRECISION (rhs_type
) < TYPE_PRECISION (lhs_type
)))
11917 || (JINTEGRAL_TYPE_P (rhs_type
) && JFLOAT_TYPE_P (lhs_type
))
11918 || (rhs_type
== float_type_node
&& lhs_type
== double_type_node
))
11924 /* Check that something of SOURCE type can be assigned or cast to
11925 something of DEST type at runtime. Return 1 if the operation is
11926 valid, 0 otherwise. If CAST is set to 1, we're treating the case
11927 were SOURCE is cast into DEST, which borrows a lot of the
11928 assignment check. */
11931 valid_ref_assignconv_cast_p (source
, dest
, cast
)
11936 /* SOURCE or DEST might be null if not from a declared entity. */
11937 if (!source
|| !dest
)
11939 if (JNULLP_TYPE_P (source
))
11941 if (TREE_CODE (source
) == POINTER_TYPE
)
11942 source
= TREE_TYPE (source
);
11943 if (TREE_CODE (dest
) == POINTER_TYPE
)
11944 dest
= TREE_TYPE (dest
);
11945 /* Case where SOURCE is a class type */
11946 if (TYPE_CLASS_P (source
))
11948 if (TYPE_CLASS_P (dest
))
11949 return source
== dest
|| inherits_from_p (source
, dest
)
11950 || (cast
&& inherits_from_p (dest
, source
));
11951 if (TYPE_INTERFACE_P (dest
))
11953 /* If doing a cast and SOURCE is final, the operation is
11954 always correct a compile time (because even if SOURCE
11955 does not implement DEST, a subclass of SOURCE might). */
11956 if (cast
&& !CLASS_FINAL (TYPE_NAME (source
)))
11958 /* Otherwise, SOURCE must implement DEST */
11959 return interface_of_p (dest
, source
);
11961 /* DEST is an array, cast permited if SOURCE is of Object type */
11962 return (cast
&& source
== object_type_node
? 1 : 0);
11964 if (TYPE_INTERFACE_P (source
))
11966 if (TYPE_CLASS_P (dest
))
11968 /* If not casting, DEST must be the Object type */
11970 return dest
== object_type_node
;
11971 /* We're doing a cast. The cast is always valid is class
11972 DEST is not final, otherwise, DEST must implement SOURCE */
11973 else if (!CLASS_FINAL (TYPE_NAME (dest
)))
11976 return interface_of_p (source
, dest
);
11978 if (TYPE_INTERFACE_P (dest
))
11980 /* If doing a cast, then if SOURCE and DEST contain method
11981 with the same signature but different return type, then
11982 this is a (compile time) error */
11985 tree method_source
, method_dest
;
11989 for (method_source
= TYPE_METHODS (source
); method_source
;
11990 method_source
= TREE_CHAIN (method_source
))
11993 build_java_argument_signature (TREE_TYPE (method_source
));
11994 source_type
= TREE_TYPE (TREE_TYPE (method_source
));
11995 source_name
= DECL_NAME (method_source
);
11996 for (method_dest
= TYPE_METHODS (dest
);
11997 method_dest
; method_dest
= TREE_CHAIN (method_dest
))
11999 build_java_argument_signature (TREE_TYPE (method_dest
))
12000 && source_name
== DECL_NAME (method_dest
)
12001 && source_type
!= TREE_TYPE (TREE_TYPE (method_dest
)))
12007 return source
== dest
|| interface_of_p (dest
, source
);
12011 (DECL_NAME (TYPE_NAME (source
)) == java_lang_cloneable
) : 0);
12013 if (TYPE_ARRAY_P (source
))
12015 if (TYPE_CLASS_P (dest
))
12016 return dest
== object_type_node
;
12017 /* Can't cast an array to an interface unless the interface is
12018 java.lang.Cloneable */
12019 if (TYPE_INTERFACE_P (dest
))
12020 return (DECL_NAME (TYPE_NAME (dest
)) == java_lang_cloneable
? 1 : 0);
12023 tree source_element_type
= TYPE_ARRAY_ELEMENT (source
);
12024 tree dest_element_type
= TYPE_ARRAY_ELEMENT (dest
);
12026 /* In case of severe errors, they turn out null */
12027 if (!dest_element_type
|| !source_element_type
)
12029 if (source_element_type
== dest_element_type
)
12031 return valid_ref_assignconv_cast_p (source_element_type
,
12032 dest_element_type
, cast
);
12040 valid_cast_to_p (source
, dest
)
12044 if (TREE_CODE (source
) == POINTER_TYPE
)
12045 source
= TREE_TYPE (source
);
12046 if (TREE_CODE (dest
) == POINTER_TYPE
)
12047 dest
= TREE_TYPE (dest
);
12049 if (TREE_CODE (source
) == RECORD_TYPE
&& TREE_CODE (dest
) == RECORD_TYPE
)
12050 return valid_ref_assignconv_cast_p (source
, dest
, 1);
12052 else if (JNUMERIC_TYPE_P (source
) && JNUMERIC_TYPE_P (dest
))
12058 /* Method invocation conversion test. Return 1 if type SOURCE can be
12059 converted to type DEST through the methond invocation conversion
12063 do_unary_numeric_promotion (arg
)
12066 tree type
= TREE_TYPE (arg
);
12067 if (TREE_CODE (type
) == INTEGER_TYPE
? TYPE_PRECISION (type
) < 32
12068 : TREE_CODE (type
) == CHAR_TYPE
)
12069 arg
= convert (int_type_node
, arg
);
12073 /* Return a non zero value if SOURCE can be converted into DEST using
12074 the method invocation conversion rule (5.3). */
12076 valid_method_invocation_conversion_p (dest
, source
)
12079 return ((JPRIMITIVE_TYPE_P (source
) && JPRIMITIVE_TYPE_P (dest
)
12080 && valid_builtin_assignconv_identity_widening_p (dest
, source
))
12081 || ((JREFERENCE_TYPE_P (source
) || JNULLP_TYPE_P (source
))
12082 && (JREFERENCE_TYPE_P (dest
) || JNULLP_TYPE_P (dest
))
12083 && valid_ref_assignconv_cast_p (source
, dest
, 0)));
12086 /* Build an incomplete binop expression. */
12089 build_binop (op
, op_location
, op1
, op2
)
12094 tree binop
= build (op
, NULL_TREE
, op1
, op2
);
12095 TREE_SIDE_EFFECTS (binop
) = 1;
12096 /* Store the location of the operator, for better error report. The
12097 string of the operator will be rebuild based on the OP value. */
12098 EXPR_WFL_LINECOL (binop
) = op_location
;
12102 /* Build the string of the operator retained by NODE. If NODE is part
12103 of a compound expression, add an '=' at the end of the string. This
12104 function is called when an error needs to be reported on an
12105 operator. The string is returned as a pointer to a static character
12109 operator_string (node
)
12112 #define BUILD_OPERATOR_STRING(S) \
12114 sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
12118 static char buffer
[10];
12119 switch (TREE_CODE (node
))
12121 case MULT_EXPR
: BUILD_OPERATOR_STRING ("*");
12122 case RDIV_EXPR
: BUILD_OPERATOR_STRING ("/");
12123 case TRUNC_MOD_EXPR
: BUILD_OPERATOR_STRING ("%");
12124 case PLUS_EXPR
: BUILD_OPERATOR_STRING ("+");
12125 case MINUS_EXPR
: BUILD_OPERATOR_STRING ("-");
12126 case LSHIFT_EXPR
: BUILD_OPERATOR_STRING ("<<");
12127 case RSHIFT_EXPR
: BUILD_OPERATOR_STRING (">>");
12128 case URSHIFT_EXPR
: BUILD_OPERATOR_STRING (">>>");
12129 case BIT_AND_EXPR
: BUILD_OPERATOR_STRING ("&");
12130 case BIT_XOR_EXPR
: BUILD_OPERATOR_STRING ("^");
12131 case BIT_IOR_EXPR
: BUILD_OPERATOR_STRING ("|");
12132 case TRUTH_ANDIF_EXPR
: BUILD_OPERATOR_STRING ("&&");
12133 case TRUTH_ORIF_EXPR
: BUILD_OPERATOR_STRING ("||");
12134 case EQ_EXPR
: BUILD_OPERATOR_STRING ("==");
12135 case NE_EXPR
: BUILD_OPERATOR_STRING ("!=");
12136 case GT_EXPR
: BUILD_OPERATOR_STRING (">");
12137 case GE_EXPR
: BUILD_OPERATOR_STRING (">=");
12138 case LT_EXPR
: BUILD_OPERATOR_STRING ("<");
12139 case LE_EXPR
: BUILD_OPERATOR_STRING ("<=");
12140 case UNARY_PLUS_EXPR
: BUILD_OPERATOR_STRING ("+");
12141 case NEGATE_EXPR
: BUILD_OPERATOR_STRING ("-");
12142 case TRUTH_NOT_EXPR
: BUILD_OPERATOR_STRING ("!");
12143 case BIT_NOT_EXPR
: BUILD_OPERATOR_STRING ("~");
12144 case PREINCREMENT_EXPR
: /* Fall through */
12145 case POSTINCREMENT_EXPR
: BUILD_OPERATOR_STRING ("++");
12146 case PREDECREMENT_EXPR
: /* Fall through */
12147 case POSTDECREMENT_EXPR
: BUILD_OPERATOR_STRING ("--");
12149 fatal ("unregistered operator %s - operator_string",
12150 tree_code_name
[TREE_CODE (node
)]);
12153 #undef BUILD_OPERATOR_STRING
12156 /* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
12159 java_decl_equiv (var_acc1
, var_acc2
)
12160 tree var_acc1
, var_acc2
;
12162 if (JDECL_P (var_acc1
))
12163 return (var_acc1
== var_acc2
);
12165 return (TREE_CODE (var_acc1
) == COMPONENT_REF
12166 && TREE_CODE (var_acc2
) == COMPONENT_REF
12167 && TREE_OPERAND (TREE_OPERAND (var_acc1
, 0), 0)
12168 == TREE_OPERAND (TREE_OPERAND (var_acc2
, 0), 0)
12169 && TREE_OPERAND (var_acc1
, 1) == TREE_OPERAND (var_acc2
, 1));
12172 /* Return a non zero value if CODE is one of the operators that can be
12173 used in conjunction with the `=' operator in a compound assignment. */
12176 binop_compound_p (code
)
12177 enum tree_code code
;
12180 for (i
= 0; i
< BINOP_COMPOUND_CANDIDATES
; i
++)
12181 if (binop_lookup
[i
] == code
)
12184 return i
< BINOP_COMPOUND_CANDIDATES
;
12187 /* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
12193 tree c
, b
, ns
, decl
;
12195 if (TREE_CODE (t
) != MODIFY_EXPR
)
12198 c
= TREE_OPERAND (t
, 1);
12199 if (! (c
&& TREE_CODE (c
) == COMPOUND_EXPR
12200 && TREE_CODE (TREE_OPERAND (c
, 0)) == MODIFY_EXPR
12201 && binop_compound_p (TREE_CODE (TREE_OPERAND (c
, 1)))))
12204 /* Now the left branch of the binary operator. */
12205 b
= TREE_OPERAND (TREE_OPERAND (c
, 1), 0);
12206 if (! (b
&& TREE_CODE (b
) == NOP_EXPR
12207 && TREE_CODE (TREE_OPERAND (b
, 0)) == SAVE_EXPR
))
12210 ns
= TREE_OPERAND (TREE_OPERAND (b
, 0), 0);
12211 if (! (ns
&& TREE_CODE (ns
) == NOP_EXPR
12212 && TREE_CODE (TREE_OPERAND (ns
, 0)) == SAVE_EXPR
))
12215 decl
= TREE_OPERAND (TREE_OPERAND (ns
, 0), 0);
12216 if ((JDECL_P (decl
) || TREE_CODE (decl
) == COMPONENT_REF
)
12217 /* It's got to be the an equivalent decl */
12218 && java_decl_equiv (decl
, TREE_OPERAND (TREE_OPERAND (c
, 0), 0)))
12220 /* Shorten the NOP_EXPR/SAVE_EXPR path. */
12221 TREE_OPERAND (TREE_OPERAND (c
, 1), 0) = TREE_OPERAND (ns
, 0);
12222 /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
12223 TREE_OPERAND (t
, 1) = TREE_OPERAND (c
, 1);
12224 /* Change the right part of the BINOP_EXPR */
12225 TREE_OPERAND (TREE_OPERAND (t
, 1), 1) = TREE_OPERAND (c
, 0);
12231 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
12232 errors but we modify NODE so that it contains the type computed
12233 according to the expression, when it's fixed. Otherwise, we write
12234 error_mark_node as the type. It allows us to further the analysis
12235 of remaining nodes and detects more errors in certain cases. */
12238 patch_binop (node
, wfl_op1
, wfl_op2
)
12243 tree op1
= TREE_OPERAND (node
, 0);
12244 tree op2
= TREE_OPERAND (node
, 1);
12245 tree op1_type
= TREE_TYPE (op1
);
12246 tree op2_type
= TREE_TYPE (op2
);
12247 tree prom_type
= NULL_TREE
;
12248 int code
= TREE_CODE (node
);
12250 /* If 1, tell the routine that we have to return error_mark_node
12251 after checking for the initialization of the RHS */
12252 int error_found
= 0;
12254 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12258 /* 15.16 Multiplicative operators */
12259 case MULT_EXPR
: /* 15.16.1 Multiplication Operator * */
12260 case RDIV_EXPR
: /* 15.16.2 Division Operator / */
12261 case TRUNC_MOD_EXPR
: /* 15.16.3 Remainder operator % */
12262 if (!JPRIMITIVE_TYPE_P (op1_type
) || !JPRIMITIVE_TYPE_P (op2_type
))
12264 if (!JPRIMITIVE_TYPE_P (op1_type
))
12265 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
12266 if (!JPRIMITIVE_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12267 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
12268 TREE_TYPE (node
) = error_mark_node
;
12272 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12273 /* Change the division operator if necessary */
12274 if (code
== RDIV_EXPR
&& TREE_CODE (prom_type
) == INTEGER_TYPE
)
12275 TREE_SET_CODE (node
, TRUNC_DIV_EXPR
);
12277 if (TREE_CODE (prom_type
) == INTEGER_TYPE
12278 && flag_use_divide_subroutine
12279 && ! flag_emit_class_files
12280 && (code
== RDIV_EXPR
|| code
== TRUNC_MOD_EXPR
))
12281 return build_java_soft_divmod (TREE_CODE (node
), prom_type
, op1
, op2
);
12283 /* This one is more complicated. FLOATs are processed by a
12284 function call to soft_fmod. Duplicate the value of the
12285 COMPOUND_ASSIGN_P flag. */
12286 if (code
== TRUNC_MOD_EXPR
)
12288 tree mod
= build_java_binop (TRUNC_MOD_EXPR
, prom_type
, op1
, op2
);
12289 COMPOUND_ASSIGN_P (mod
) = COMPOUND_ASSIGN_P (node
);
12290 TREE_SIDE_EFFECTS (mod
)
12291 = TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12296 /* 15.17 Additive Operators */
12297 case PLUS_EXPR
: /* 15.17.1 String Concatenation Operator + */
12299 /* Operation is valid if either one argument is a string
12300 constant, a String object or a StringBuffer crafted for the
12301 purpose of the a previous usage of the String concatenation
12304 if (TREE_CODE (op1
) == STRING_CST
12305 || TREE_CODE (op2
) == STRING_CST
12306 || JSTRING_TYPE_P (op1_type
)
12307 || JSTRING_TYPE_P (op2_type
)
12308 || IS_CRAFTED_STRING_BUFFER_P (op1
)
12309 || IS_CRAFTED_STRING_BUFFER_P (op2
))
12310 return build_string_concatenation (op1
, op2
);
12312 case MINUS_EXPR
: /* 15.17.2 Additive Operators (+ and -) for
12314 if (!JPRIMITIVE_TYPE_P (op1_type
) || !JPRIMITIVE_TYPE_P (op2_type
))
12316 if (!JPRIMITIVE_TYPE_P (op1_type
))
12317 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
12318 if (!JPRIMITIVE_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12319 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
12320 TREE_TYPE (node
) = error_mark_node
;
12324 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12327 /* 15.18 Shift Operators */
12331 if (!JINTEGRAL_TYPE_P (op1_type
) || !JINTEGRAL_TYPE_P (op2_type
))
12333 if (!JINTEGRAL_TYPE_P (op1_type
))
12334 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op1_type
);
12337 if (JPRIMITIVE_TYPE_P (op2_type
))
12338 parse_error_context (wfl_operator
,
12339 "Incompatible type for `%s'. "
12340 "Explicit cast needed to convert "
12341 "shift distance from `%s' to integral",
12342 operator_string (node
),
12343 lang_printable_name (op2_type
, 0));
12345 parse_error_context (wfl_operator
, "Incompatible type for `%s'."
12346 " Can't convert shift distance from "
12347 "`%s' to integral",
12348 operator_string (node
),
12349 lang_printable_name (op2_type
, 0));
12351 TREE_TYPE (node
) = error_mark_node
;
12356 /* Unary numeric promotion (5.6.1) is performed on each operand
12358 op1
= do_unary_numeric_promotion (op1
);
12359 op2
= do_unary_numeric_promotion (op2
);
12361 /* The type of the shift expression is the type of the promoted
12362 type of the left-hand operand */
12363 prom_type
= TREE_TYPE (op1
);
12365 /* Shift int only up to 0x1f and long up to 0x3f */
12366 if (prom_type
== int_type_node
)
12367 op2
= fold (build (BIT_AND_EXPR
, int_type_node
, op2
,
12368 build_int_2 (0x1f, 0)));
12370 op2
= fold (build (BIT_AND_EXPR
, int_type_node
, op2
,
12371 build_int_2 (0x3f, 0)));
12373 /* The >>> operator is a >> operating on unsigned quantities */
12374 if (code
== URSHIFT_EXPR
&& ! flag_emit_class_files
)
12377 tree utype
= unsigned_type (prom_type
);
12378 op1
= convert (utype
, op1
);
12379 TREE_SET_CODE (node
, RSHIFT_EXPR
);
12380 TREE_OPERAND (node
, 0) = op1
;
12381 TREE_OPERAND (node
, 1) = op2
;
12382 TREE_TYPE (node
) = utype
;
12383 to_return
= convert (prom_type
, node
);
12384 /* Copy the original value of the COMPOUND_ASSIGN_P flag */
12385 COMPOUND_ASSIGN_P (to_return
) = COMPOUND_ASSIGN_P (node
);
12386 TREE_SIDE_EFFECTS (to_return
)
12387 = TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12392 /* 15.19.1 Type Comparison Operator instaceof */
12393 case INSTANCEOF_EXPR
:
12395 TREE_TYPE (node
) = boolean_type_node
;
12397 if (!(op2_type
= resolve_type_during_patch (op2
)))
12398 return error_mark_node
;
12400 /* The first operand must be a reference type or the null type */
12401 if (!JREFERENCE_TYPE_P (op1_type
) && op1
!= null_pointer_node
)
12402 error_found
= 1; /* Error reported further below */
12404 /* The second operand must be a reference type */
12405 if (!JREFERENCE_TYPE_P (op2_type
))
12407 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op2
);
12408 parse_error_context
12409 (wfl_operator
, "Invalid argument `%s' for `instanceof'",
12410 lang_printable_name (op2_type
, 0));
12414 if (!error_found
&& valid_ref_assignconv_cast_p (op1_type
, op2_type
, 1))
12416 /* If the first operand is null, the result is always false */
12417 if (op1
== null_pointer_node
)
12418 return boolean_false_node
;
12419 else if (flag_emit_class_files
)
12421 TREE_OPERAND (node
, 1) = op2_type
;
12422 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (op1
);
12425 /* Otherwise we have to invoke instance of to figure it out */
12429 build (CALL_EXPR
, boolean_type_node
,
12430 build_address_of (soft_instanceof_node
),
12433 build_tree_list (NULL_TREE
,
12434 build_class_ref (op2_type
))),
12436 TREE_SIDE_EFFECTS (call
) = TREE_SIDE_EFFECTS (op1
);
12440 /* There is no way the expression operand can be an instance of
12441 the type operand. This is a compile time error. */
12444 char *t1
= xstrdup (lang_printable_name (op1_type
, 0));
12445 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
12446 parse_error_context
12447 (wfl_operator
, "Impossible for `%s' to be instance of `%s'",
12448 t1
, lang_printable_name (op2_type
, 0));
12455 /* 15.21 Bitwise and Logical Operators */
12459 if (JINTEGRAL_TYPE_P (op1_type
) && JINTEGRAL_TYPE_P (op2_type
))
12460 /* Binary numeric promotion is performed on both operand and the
12461 expression retain that type */
12462 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12464 else if (TREE_CODE (op1_type
) == BOOLEAN_TYPE
12465 && TREE_CODE (op1_type
) == BOOLEAN_TYPE
)
12466 /* The type of the bitwise operator expression is BOOLEAN */
12467 prom_type
= boolean_type_node
;
12470 if (!JINTEGRAL_TYPE_P (op1_type
))
12471 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op1_type
);
12472 if (!JINTEGRAL_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12473 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op2_type
);
12474 TREE_TYPE (node
) = error_mark_node
;
12476 /* Insert a break here if adding thing before the switch's
12477 break for this case */
12481 /* 15.22 Conditional-And Operator */
12482 case TRUTH_ANDIF_EXPR
:
12483 /* 15.23 Conditional-Or Operator */
12484 case TRUTH_ORIF_EXPR
:
12485 /* Operands must be of BOOLEAN type */
12486 if (TREE_CODE (op1_type
) != BOOLEAN_TYPE
||
12487 TREE_CODE (op2_type
) != BOOLEAN_TYPE
)
12489 if (TREE_CODE (op1_type
) != BOOLEAN_TYPE
)
12490 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op1_type
);
12491 if (TREE_CODE (op2_type
) != BOOLEAN_TYPE
&& (op1_type
!= op2_type
))
12492 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op2_type
);
12493 TREE_TYPE (node
) = boolean_type_node
;
12497 /* The type of the conditional operators is BOOLEAN */
12498 prom_type
= boolean_type_node
;
12501 /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
12506 /* The type of each of the operands must be a primitive numeric
12508 if (!JNUMERIC_TYPE_P (op1_type
) || ! JNUMERIC_TYPE_P (op2_type
))
12510 if (!JNUMERIC_TYPE_P (op1_type
))
12511 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
12512 if (!JNUMERIC_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12513 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
12514 TREE_TYPE (node
) = boolean_type_node
;
12518 /* Binary numeric promotion is performed on the operands */
12519 binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12520 /* The type of the relation expression is always BOOLEAN */
12521 prom_type
= boolean_type_node
;
12524 /* 15.20 Equality Operator */
12527 /* 15.20.1 Numerical Equality Operators == and != */
12528 /* Binary numeric promotion is performed on the operands */
12529 if (JNUMERIC_TYPE_P (op1_type
) && JNUMERIC_TYPE_P (op2_type
))
12530 binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12532 /* 15.20.2 Boolean Equality Operators == and != */
12533 else if (TREE_CODE (op1_type
) == BOOLEAN_TYPE
&&
12534 TREE_CODE (op2_type
) == BOOLEAN_TYPE
)
12535 ; /* Nothing to do here */
12537 /* 15.20.3 Reference Equality Operators == and != */
12538 /* Types have to be either references or the null type. If
12539 they're references, it must be possible to convert either
12540 type to the other by casting conversion. */
12541 else if (op1
== null_pointer_node
|| op2
== null_pointer_node
12542 || (JREFERENCE_TYPE_P (op1_type
) && JREFERENCE_TYPE_P (op2_type
)
12543 && (valid_ref_assignconv_cast_p (op1_type
, op2_type
, 1)
12544 || valid_ref_assignconv_cast_p (op2_type
,
12546 ; /* Nothing to do here */
12548 /* Else we have an error figure what can't be converted into
12549 what and report the error */
12553 t1
= xstrdup (lang_printable_name (op1_type
, 0));
12554 parse_error_context
12555 (wfl_operator
, "Incompatible type for `%s'. Can't convert `%s' "
12556 "to `%s'", operator_string (node
), t1
,
12557 lang_printable_name (op2_type
, 0));
12559 TREE_TYPE (node
) = boolean_type_node
;
12563 prom_type
= boolean_type_node
;
12568 return error_mark_node
;
12570 TREE_OPERAND (node
, 0) = op1
;
12571 TREE_OPERAND (node
, 1) = op2
;
12572 TREE_TYPE (node
) = prom_type
;
12573 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12575 if (flag_emit_xref
)
12578 /* fold does not respect side-effect order as required for Java but not C.
12579 * Also, it sometimes create SAVE_EXPRs which are bad when emitting
12582 if (flag_emit_class_files
? (TREE_CONSTANT (op1
) && TREE_CONSTANT (op2
))
12583 : ! TREE_SIDE_EFFECTS (node
))
12584 node
= fold (node
);
12588 /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
12589 zero value, the value of CSTE comes after the valude of STRING */
12592 do_merge_string_cste (cste
, string
, string_len
, after
)
12594 const char *string
;
12595 int string_len
, after
;
12597 int len
= TREE_STRING_LENGTH (cste
) + string_len
;
12598 const char *old
= TREE_STRING_POINTER (cste
);
12599 TREE_STRING_LENGTH (cste
) = len
;
12600 TREE_STRING_POINTER (cste
) = obstack_alloc (expression_obstack
, len
+1);
12603 strcpy (TREE_STRING_POINTER (cste
), string
);
12604 strcat (TREE_STRING_POINTER (cste
), old
);
12608 strcpy (TREE_STRING_POINTER (cste
), old
);
12609 strcat (TREE_STRING_POINTER (cste
), string
);
12614 /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
12615 new STRING_CST on success, NULL_TREE on failure */
12618 merge_string_cste (op1
, op2
, after
)
12622 /* Handle two string constants right away */
12623 if (TREE_CODE (op2
) == STRING_CST
)
12624 return do_merge_string_cste (op1
, TREE_STRING_POINTER (op2
),
12625 TREE_STRING_LENGTH (op2
), after
);
12627 /* Reasonable integer constant can be treated right away */
12628 if (TREE_CODE (op2
) == INTEGER_CST
&& !TREE_CONSTANT_OVERFLOW (op2
))
12630 static const char *boolean_true
= "true";
12631 static const char *boolean_false
= "false";
12632 static const char *null_pointer
= "null";
12634 const char *string
;
12636 if (op2
== boolean_true_node
)
12637 string
= boolean_true
;
12638 else if (op2
== boolean_false_node
)
12639 string
= boolean_false
;
12640 else if (op2
== null_pointer_node
)
12641 string
= null_pointer
;
12642 else if (TREE_TYPE (op2
) == char_type_node
)
12644 ch
[0] = (char )TREE_INT_CST_LOW (op2
);
12649 string
= print_int_node (op2
);
12651 return do_merge_string_cste (op1
, string
, strlen (string
), after
);
12656 /* Tries to statically concatenate OP1 and OP2 if possible. Either one
12657 has to be a STRING_CST and the other part must be a STRING_CST or a
12658 INTEGRAL constant. Return a new STRING_CST if the operation
12659 succeed, NULL_TREE otherwise.
12661 If the case we want to optimize for space, we might want to return
12662 NULL_TREE for each invocation of this routine. FIXME */
12665 string_constant_concatenation (op1
, op2
)
12668 if (TREE_CODE (op1
) == STRING_CST
|| (TREE_CODE (op2
) == STRING_CST
))
12673 string
= (TREE_CODE (op1
) == STRING_CST
? op1
: op2
);
12674 rest
= (string
== op1
? op2
: op1
);
12675 invert
= (string
== op1
? 0 : 1 );
12677 /* Walk REST, only if it looks reasonable */
12678 if (TREE_CODE (rest
) != STRING_CST
12679 && !IS_CRAFTED_STRING_BUFFER_P (rest
)
12680 && !JSTRING_TYPE_P (TREE_TYPE (rest
))
12681 && TREE_CODE (rest
) == EXPR_WITH_FILE_LOCATION
)
12683 rest
= java_complete_tree (rest
);
12684 if (rest
== error_mark_node
)
12685 return error_mark_node
;
12686 rest
= fold (rest
);
12688 return merge_string_cste (string
, rest
, invert
);
12693 /* Implement the `+' operator. Does static optimization if possible,
12694 otherwise create (if necessary) and append elements to a
12695 StringBuffer. The StringBuffer will be carried around until it is
12696 used for a function call or an assignment. Then toString() will be
12697 called on it to turn it into a String object. */
12700 build_string_concatenation (op1
, op2
)
12704 int side_effects
= TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12706 if (flag_emit_xref
)
12707 return build (PLUS_EXPR
, string_type_node
, op1
, op2
);
12709 /* Try to do some static optimization */
12710 if ((result
= string_constant_concatenation (op1
, op2
)))
12713 /* Discard empty strings on either side of the expression */
12714 if (TREE_CODE (op1
) == STRING_CST
&& TREE_STRING_LENGTH (op1
) == 0)
12719 else if (TREE_CODE (op2
) == STRING_CST
&& TREE_STRING_LENGTH (op2
) == 0)
12722 /* If operands are string constant, turn then into object references */
12723 if (TREE_CODE (op1
) == STRING_CST
)
12724 op1
= patch_string_cst (op1
);
12725 if (op2
&& TREE_CODE (op2
) == STRING_CST
)
12726 op2
= patch_string_cst (op2
);
12728 /* If either one of the constant is null and the other non null
12729 operand is a String object, return it. */
12730 if (JSTRING_TYPE_P (TREE_TYPE (op1
)) && !op2
)
12733 /* If OP1 isn't already a StringBuffer, create and
12734 initialize a new one */
12735 if (!IS_CRAFTED_STRING_BUFFER_P (op1
))
12737 /* Two solutions here:
12738 1) OP1 is a string reference, we call new StringBuffer(OP1)
12739 2) OP1 is something else, we call new StringBuffer().append(OP1). */
12740 if (JSTRING_TYPE_P (TREE_TYPE (op1
)))
12741 op1
= BUILD_STRING_BUFFER (op1
);
12744 tree aNew
= BUILD_STRING_BUFFER (NULL_TREE
);
12745 op1
= make_qualified_primary (aNew
, BUILD_APPEND (op1
), 0);
12751 /* OP1 is no longer the last node holding a crafted StringBuffer */
12752 IS_CRAFTED_STRING_BUFFER_P (op1
) = 0;
12753 /* Create a node for `{new...,xxx}.append (op2)' */
12755 op1
= make_qualified_primary (op1
, BUILD_APPEND (op2
), 0);
12758 /* Mark the last node holding a crafted StringBuffer */
12759 IS_CRAFTED_STRING_BUFFER_P (op1
) = 1;
12761 TREE_SIDE_EFFECTS (op1
) = side_effects
;
12765 /* Patch the string node NODE. NODE can be a STRING_CST of a crafted
12766 StringBuffer. If no string were found to be patched, return
12770 patch_string (node
)
12773 if (node
== error_mark_node
)
12774 return error_mark_node
;
12775 if (TREE_CODE (node
) == STRING_CST
)
12776 return patch_string_cst (node
);
12777 else if (IS_CRAFTED_STRING_BUFFER_P (node
))
12779 int saved
= ctxp
->explicit_constructor_p
;
12780 tree invoke
= build_method_invocation (wfl_to_string
, NULL_TREE
);
12782 /* Temporary disable forbid the use of `this'. */
12783 ctxp
->explicit_constructor_p
= 0;
12784 ret
= java_complete_tree (make_qualified_primary (node
, invoke
, 0));
12785 /* Restore it at its previous value */
12786 ctxp
->explicit_constructor_p
= saved
;
12792 /* Build the internal representation of a string constant. */
12795 patch_string_cst (node
)
12799 if (! flag_emit_class_files
)
12801 push_obstacks (&permanent_obstack
, &permanent_obstack
);
12802 node
= get_identifier (TREE_STRING_POINTER (node
));
12803 location
= alloc_name_constant (CONSTANT_String
, node
);
12804 node
= build_ref_from_constant_pool (location
);
12806 TREE_TYPE (node
) = string_ptr_type_node
;
12807 TREE_CONSTANT (node
) = 1;
12811 /* Build an incomplete unary operator expression. */
12814 build_unaryop (op_token
, op_location
, op1
)
12815 int op_token
, op_location
;
12822 case PLUS_TK
: op
= UNARY_PLUS_EXPR
; break;
12823 case MINUS_TK
: op
= NEGATE_EXPR
; break;
12824 case NEG_TK
: op
= TRUTH_NOT_EXPR
; break;
12825 case NOT_TK
: op
= BIT_NOT_EXPR
; break;
12826 default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
12830 unaryop
= build1 (op
, NULL_TREE
, op1
);
12831 TREE_SIDE_EFFECTS (unaryop
) = 1;
12832 /* Store the location of the operator, for better error report. The
12833 string of the operator will be rebuild based on the OP value. */
12834 EXPR_WFL_LINECOL (unaryop
) = op_location
;
12838 /* Special case for the ++/-- operators, since they require an extra
12839 argument to build, which is set to NULL and patched
12840 later. IS_POST_P is 1 if the operator, 0 otherwise. */
12843 build_incdec (op_token
, op_location
, op1
, is_post_p
)
12844 int op_token
, op_location
;
12848 static enum tree_code lookup
[2][2] =
12850 { PREDECREMENT_EXPR
, PREINCREMENT_EXPR
, },
12851 { POSTDECREMENT_EXPR
, POSTINCREMENT_EXPR
, },
12853 tree node
= build (lookup
[is_post_p
][(op_token
- DECR_TK
)],
12854 NULL_TREE
, op1
, NULL_TREE
);
12855 TREE_SIDE_EFFECTS (node
) = 1;
12856 /* Store the location of the operator, for better error report. The
12857 string of the operator will be rebuild based on the OP value. */
12858 EXPR_WFL_LINECOL (node
) = op_location
;
12862 /* Build an incomplete cast operator, based on the use of the
12863 CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
12864 set. java_complete_tree is trained to walk a CONVERT_EXPR even
12865 though its type is already set. */
12868 build_cast (location
, type
, exp
)
12872 tree node
= build1 (CONVERT_EXPR
, type
, exp
);
12873 EXPR_WFL_LINECOL (node
) = location
;
12877 /* 15.14 Unary operators. We return error_mark_node in case of error,
12878 but preserve the type of NODE if the type is fixed. */
12881 patch_unaryop (node
, wfl_op
)
12885 tree op
= TREE_OPERAND (node
, 0);
12886 tree op_type
= TREE_TYPE (op
);
12887 tree prom_type
= NULL_TREE
, value
, decl
;
12888 int code
= TREE_CODE (node
);
12889 int error_found
= 0;
12891 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12895 /* 15.13.2 Postfix Increment Operator ++ */
12896 case POSTINCREMENT_EXPR
:
12897 /* 15.13.3 Postfix Increment Operator -- */
12898 case POSTDECREMENT_EXPR
:
12899 /* 15.14.1 Prefix Increment Operator ++ */
12900 case PREINCREMENT_EXPR
:
12901 /* 15.14.2 Prefix Decrement Operator -- */
12902 case PREDECREMENT_EXPR
:
12903 op
= decl
= strip_out_static_field_access_decl (op
);
12904 /* We really should have a JAVA_ARRAY_EXPR to avoid this */
12905 if (!JDECL_P (decl
)
12906 && TREE_CODE (decl
) != COMPONENT_REF
12907 && !(flag_emit_class_files
&& TREE_CODE (decl
) == ARRAY_REF
)
12908 && TREE_CODE (decl
) != INDIRECT_REF
12909 && !(TREE_CODE (decl
) == COMPOUND_EXPR
12910 && TREE_OPERAND (decl
, 1)
12911 && (TREE_CODE (TREE_OPERAND (decl
, 1)) == INDIRECT_REF
)))
12914 /* Before screaming, check that we're not in fact trying to
12915 increment a optimized static final access, in which case
12916 we issue an different error message. */
12917 if (!(TREE_CODE (wfl_op
) == EXPR_WITH_FILE_LOCATION
12918 && resolve_expression_name (wfl_op
, &lvalue
)
12919 && check_final_assignment (lvalue
, wfl_op
)))
12920 parse_error_context (wfl_operator
, "Invalid argument to `%s'",
12921 operator_string (node
));
12922 TREE_TYPE (node
) = error_mark_node
;
12925 else if (check_final_assignment (op
, wfl_op
))
12928 /* From now on, we know that op if a variable and that it has a
12929 valid wfl. We use wfl_op to locate errors related to the
12931 else if (!JNUMERIC_TYPE_P (op_type
))
12933 parse_error_context
12934 (wfl_op
, "Invalid argument type `%s' to `%s'",
12935 lang_printable_name (op_type
, 0), operator_string (node
));
12936 TREE_TYPE (node
) = error_mark_node
;
12941 /* Before the addition, binary numeric promotion is performed on
12942 both operands, if really necessary */
12943 if (JINTEGRAL_TYPE_P (op_type
))
12945 value
= build_int_2 (1, 0);
12946 TREE_TYPE (value
) = TREE_TYPE (node
) = op_type
;
12950 value
= build_int_2 (1, 0);
12952 binary_numeric_promotion (op_type
,
12953 TREE_TYPE (value
), &op
, &value
);
12955 /* And write back into the node. */
12956 TREE_OPERAND (node
, 0) = op
;
12957 TREE_OPERAND (node
, 1) = value
;
12958 /* Convert the overall back into its original type, if
12959 necessary, and return */
12960 if (JINTEGRAL_TYPE_P (op_type
))
12961 return fold (node
);
12963 return fold (convert (op_type
, node
));
12967 /* 15.14.3 Unary Plus Operator + */
12968 case UNARY_PLUS_EXPR
:
12969 /* 15.14.4 Unary Minus Operator - */
12971 if (!JNUMERIC_TYPE_P (op_type
))
12973 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op_type
);
12974 TREE_TYPE (node
) = error_mark_node
;
12977 /* Unary numeric promotion is performed on operand */
12980 op
= do_unary_numeric_promotion (op
);
12981 prom_type
= TREE_TYPE (op
);
12982 if (code
== UNARY_PLUS_EXPR
)
12987 /* 15.14.5 Bitwise Complement Operator ~ */
12989 if (!JINTEGRAL_TYPE_P (op_type
))
12991 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op_type
);
12992 TREE_TYPE (node
) = error_mark_node
;
12997 op
= do_unary_numeric_promotion (op
);
12998 prom_type
= TREE_TYPE (op
);
13002 /* 15.14.6 Logical Complement Operator ! */
13003 case TRUTH_NOT_EXPR
:
13004 if (TREE_CODE (op_type
) != BOOLEAN_TYPE
)
13006 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op_type
);
13007 /* But the type is known. We will report an error if further
13008 attempt of a assignment is made with this rhs */
13009 TREE_TYPE (node
) = boolean_type_node
;
13013 prom_type
= boolean_type_node
;
13016 /* 15.15 Cast Expression */
13018 value
= patch_cast (node
, wfl_operator
);
13019 if (value
== error_mark_node
)
13021 /* If this cast is part of an assignment, we tell the code
13022 that deals with it not to complain about a mismatch,
13023 because things have been cast, anyways */
13024 TREE_TYPE (node
) = error_mark_node
;
13029 value
= fold (value
);
13030 TREE_SIDE_EFFECTS (value
) = TREE_SIDE_EFFECTS (op
);
13037 return error_mark_node
;
13039 /* There are cases where node has been replaced by something else
13040 and we don't end up returning here: UNARY_PLUS_EXPR,
13041 CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
13042 TREE_OPERAND (node
, 0) = fold (op
);
13043 TREE_TYPE (node
) = prom_type
;
13044 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (op
);
13045 return fold (node
);
13048 /* Generic type resolution that sometimes takes place during node
13049 patching. Returned the resolved type or generate an error
13050 message. Return the resolved type or NULL_TREE. */
13053 resolve_type_during_patch (type
)
13056 if (unresolved_type_p (type
, NULL
))
13058 tree type_decl
= resolve_no_layout (EXPR_WFL_NODE (type
), NULL_TREE
);
13061 parse_error_context (type
,
13062 "Class `%s' not found in type declaration",
13063 IDENTIFIER_POINTER (EXPR_WFL_NODE (type
)));
13068 CLASS_LOADED_P (TREE_TYPE (type_decl
)) = 1;
13069 return TREE_TYPE (type_decl
);
13074 /* 5.5 Casting Conversion. error_mark_node is returned if an error is
13075 found. Otherwise NODE or something meant to replace it is returned. */
13078 patch_cast (node
, wfl_operator
)
13082 tree op
= TREE_OPERAND (node
, 0);
13083 tree op_type
= TREE_TYPE (op
);
13084 tree cast_type
= TREE_TYPE (node
);
13087 /* First resolve OP_TYPE if unresolved */
13088 if (!(cast_type
= resolve_type_during_patch (cast_type
)))
13089 return error_mark_node
;
13091 /* Check on cast that are proven correct at compile time */
13092 if (JNUMERIC_TYPE_P (cast_type
) && JNUMERIC_TYPE_P (op_type
))
13095 if (cast_type
== op_type
)
13098 /* float and double type are converted to the original type main
13099 variant and then to the target type. */
13100 if (JFLOAT_TYPE_P (op_type
) && TREE_CODE (cast_type
) == CHAR_TYPE
)
13101 op
= convert (integer_type_node
, op
);
13103 /* Try widening/narowwing convertion. Potentially, things need
13104 to be worked out in gcc so we implement the extreme cases
13105 correctly. fold_convert() needs to be fixed. */
13106 return convert (cast_type
, op
);
13109 /* It's also valid to cast a boolean into a boolean */
13110 if (op_type
== boolean_type_node
&& cast_type
== boolean_type_node
)
13113 /* null can be casted to references */
13114 if (op
== null_pointer_node
&& JREFERENCE_TYPE_P (cast_type
))
13115 return build_null_of_type (cast_type
);
13117 /* The remaining legal casts involve conversion between reference
13118 types. Check for their compile time correctness. */
13119 if (JREFERENCE_TYPE_P (op_type
) && JREFERENCE_TYPE_P (cast_type
)
13120 && valid_ref_assignconv_cast_p (op_type
, cast_type
, 1))
13122 TREE_TYPE (node
) = promote_type (cast_type
);
13123 /* Now, the case can be determined correct at compile time if
13124 OP_TYPE can be converted into CAST_TYPE by assignment
13125 conversion (5.2) */
13127 if (valid_ref_assignconv_cast_p (op_type
, cast_type
, 0))
13129 TREE_SET_CODE (node
, NOP_EXPR
);
13133 if (flag_emit_class_files
)
13135 TREE_SET_CODE (node
, CONVERT_EXPR
);
13139 /* The cast requires a run-time check */
13140 return build (CALL_EXPR
, promote_type (cast_type
),
13141 build_address_of (soft_checkcast_node
),
13142 tree_cons (NULL_TREE
, build_class_ref (cast_type
),
13143 build_tree_list (NULL_TREE
, op
)),
13147 /* Any other casts are proven incorrect at compile time */
13148 t1
= xstrdup (lang_printable_name (op_type
, 0));
13149 parse_error_context (wfl_operator
, "Invalid cast from `%s' to `%s'",
13150 t1
, lang_printable_name (cast_type
, 0));
13152 return error_mark_node
;
13155 /* Build a null constant and give it the type TYPE. */
13158 build_null_of_type (type
)
13161 tree node
= build_int_2 (0, 0);
13162 TREE_TYPE (node
) = promote_type (type
);
13166 /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
13167 a list of indices. */
13169 build_array_ref (location
, array
, index
)
13173 tree node
= build (ARRAY_REF
, NULL_TREE
, array
, index
);
13174 EXPR_WFL_LINECOL (node
) = location
;
13178 /* 15.12 Array Access Expression */
13181 patch_array_ref (node
)
13184 tree array
= TREE_OPERAND (node
, 0);
13185 tree array_type
= TREE_TYPE (array
);
13186 tree index
= TREE_OPERAND (node
, 1);
13187 tree index_type
= TREE_TYPE (index
);
13188 int error_found
= 0;
13190 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13192 if (TREE_CODE (array_type
) == POINTER_TYPE
)
13193 array_type
= TREE_TYPE (array_type
);
13195 /* The array reference must be an array */
13196 if (!TYPE_ARRAY_P (array_type
))
13198 parse_error_context
13199 (wfl_operator
, "`[]' can only be applied to arrays. It can't be "
13200 "applied to `%s'", lang_printable_name (array_type
, 0));
13201 TREE_TYPE (node
) = error_mark_node
;
13205 /* The array index underdoes unary numeric promotion. The promoted
13206 type must be int */
13207 index
= do_unary_numeric_promotion (index
);
13208 if (TREE_TYPE (index
) != int_type_node
)
13210 if (valid_cast_to_p (index_type
, int_type_node
))
13211 parse_error_context (wfl_operator
, "Incompatible type for `[]'. "
13212 "Explicit cast needed to convert `%s' to `int'",
13213 lang_printable_name (index_type
, 0));
13215 parse_error_context (wfl_operator
, "Incompatible type for `[]'. "
13216 "Can't convert `%s' to `int'",
13217 lang_printable_name (index_type
, 0));
13218 TREE_TYPE (node
) = error_mark_node
;
13223 return error_mark_node
;
13225 array_type
= TYPE_ARRAY_ELEMENT (array_type
);
13227 if (flag_emit_class_files
|| flag_emit_xref
)
13229 TREE_OPERAND (node
, 0) = array
;
13230 TREE_OPERAND (node
, 1) = index
;
13234 /* The save_expr is for correct evaluation order. It would be cleaner
13235 to use force_evaluation_order (see comment there), but that is
13236 difficult when we also have to deal with bounds checking. */
13237 if (TREE_SIDE_EFFECTS (index
))
13238 array
= save_expr (array
);
13239 node
= build_java_arrayaccess (array
, array_type
, index
);
13240 if (TREE_SIDE_EFFECTS (index
))
13241 node
= build (COMPOUND_EXPR
, array_type
, array
, node
);
13243 TREE_TYPE (node
) = array_type
;
13247 /* 15.9 Array Creation Expressions */
13250 build_newarray_node (type
, dims
, extra_dims
)
13256 build (NEW_ARRAY_EXPR
, NULL_TREE
, type
, nreverse (dims
),
13257 build_int_2 (extra_dims
, 0));
13262 patch_newarray (node
)
13265 tree type
= TREE_OPERAND (node
, 0);
13266 tree dims
= TREE_OPERAND (node
, 1);
13267 tree cdim
, array_type
;
13268 int error_found
= 0;
13270 int xdims
= TREE_INT_CST_LOW (TREE_OPERAND (node
, 2));
13272 /* Dimension types are verified. It's better for the types to be
13273 verified in order. */
13274 for (cdim
= dims
, ndims
= 0; cdim
; cdim
= TREE_CHAIN (cdim
), ndims
++ )
13277 tree dim
= TREE_VALUE (cdim
);
13279 /* Dim might have been saved during its evaluation */
13280 dim
= (TREE_CODE (dim
) == SAVE_EXPR
? dim
= TREE_OPERAND (dim
, 0) : dim
);
13282 /* The type of each specified dimension must be an integral type. */
13283 if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim
)))
13286 /* Each expression undergoes an unary numeric promotion (5.6.1) and the
13287 promoted type must be int. */
13290 dim
= do_unary_numeric_promotion (dim
);
13291 if (TREE_TYPE (dim
) != int_type_node
)
13295 /* Report errors on types here */
13298 parse_error_context
13299 (TREE_PURPOSE (cdim
),
13300 "Incompatible type for dimension in array creation expression. "
13301 "%s convert `%s' to `int'",
13302 (valid_cast_to_p (TREE_TYPE (dim
), int_type_node
) ?
13303 "Explicit cast needed to" : "Can't"),
13304 lang_printable_name (TREE_TYPE (dim
), 0));
13308 TREE_PURPOSE (cdim
) = NULL_TREE
;
13311 /* Resolve array base type if unresolved */
13312 if (!(type
= resolve_type_during_patch (type
)))
13317 /* We don't want further evaluation of this bogus array creation
13319 TREE_TYPE (node
) = error_mark_node
;
13320 return error_mark_node
;
13323 /* Set array_type to the actual (promoted) array type of the result. */
13324 if (TREE_CODE (type
) == RECORD_TYPE
)
13325 type
= build_pointer_type (type
);
13326 while (--xdims
>= 0)
13328 type
= promote_type (build_java_array_type (type
, -1));
13330 dims
= nreverse (dims
);
13332 for (cdim
= dims
; cdim
; cdim
= TREE_CHAIN (cdim
))
13335 array_type
= build_java_array_type (type
,
13336 TREE_CODE (cdim
) == INTEGER_CST
?
13337 TREE_INT_CST_LOW (cdim
) : -1);
13338 array_type
= promote_type (array_type
);
13340 dims
= nreverse (dims
);
13342 /* The node is transformed into a function call. Things are done
13343 differently according to the number of dimensions. If the number
13344 of dimension is equal to 1, then the nature of the base type
13345 (primitive or not) matters. */
13347 return build_new_array (type
, TREE_VALUE (dims
));
13349 /* Can't reuse what's already written in expr.c because it uses the
13350 JVM stack representation. Provide a build_multianewarray. FIXME */
13351 return build (CALL_EXPR
, array_type
,
13352 build_address_of (soft_multianewarray_node
),
13353 tree_cons (NULL_TREE
, build_class_ref (TREE_TYPE (array_type
)),
13354 tree_cons (NULL_TREE
,
13355 build_int_2 (ndims
, 0), dims
)),
13359 /* 10.6 Array initializer. */
13361 /* Build a wfl for array element that don't have one, so we can
13362 pin-point errors. */
13365 maybe_build_array_element_wfl (node
)
13368 if (TREE_CODE (node
) != EXPR_WITH_FILE_LOCATION
)
13369 return build_expr_wfl (NULL_TREE
, ctxp
->filename
,
13370 ctxp
->elc
.line
, ctxp
->elc
.prev_col
);
13375 /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
13376 identification of initialized arrays easier to detect during walk
13380 build_new_array_init (location
, values
)
13384 tree constructor
= build (CONSTRUCTOR
, NULL_TREE
, NULL_TREE
, values
);
13385 tree to_return
= build1 (NEW_ARRAY_INIT
, NULL_TREE
, constructor
);
13386 EXPR_WFL_LINECOL (to_return
) = location
;
13390 /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
13391 occurred. Otherwise return NODE after having set its type
13395 patch_new_array_init (type
, node
)
13398 int error_seen
= 0;
13399 tree current
, element_type
;
13400 HOST_WIDE_INT length
;
13401 int all_constant
= 1;
13402 tree init
= TREE_OPERAND (node
, 0);
13404 if (TREE_CODE (type
) != POINTER_TYPE
|| ! TYPE_ARRAY_P (TREE_TYPE (type
)))
13406 parse_error_context (node
,
13407 "Invalid array initializer for non-array type `%s'",
13408 lang_printable_name (type
, 1));
13409 return error_mark_node
;
13411 type
= TREE_TYPE (type
);
13412 element_type
= TYPE_ARRAY_ELEMENT (type
);
13414 CONSTRUCTOR_ELTS (init
) = nreverse (CONSTRUCTOR_ELTS (init
));
13416 for (length
= 0, current
= CONSTRUCTOR_ELTS (init
);
13417 current
; length
++, current
= TREE_CHAIN (current
))
13419 tree elt
= TREE_VALUE (current
);
13420 if (elt
== NULL_TREE
|| TREE_CODE (elt
) != NEW_ARRAY_INIT
)
13422 error_seen
|= array_constructor_check_entry (element_type
, current
);
13423 elt
= TREE_VALUE (current
);
13424 /* When compiling to native code, STRING_CST is converted to
13425 INDIRECT_REF, but still with a TREE_CONSTANT flag. */
13426 if (! TREE_CONSTANT (elt
) || TREE_CODE (elt
) == INDIRECT_REF
)
13431 TREE_VALUE (current
) = patch_new_array_init (element_type
, elt
);
13432 TREE_PURPOSE (current
) = NULL_TREE
;
13435 if (elt
&& TREE_VALUE (elt
) == error_mark_node
)
13440 return error_mark_node
;
13442 /* Create a new type. We can't reuse the one we have here by
13443 patching its dimension because it originally is of dimension -1
13444 hence reused by gcc. This would prevent triangular arrays. */
13445 type
= build_java_array_type (element_type
, length
);
13446 TREE_TYPE (init
) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type
))));
13447 TREE_TYPE (node
) = promote_type (type
);
13448 TREE_CONSTANT (init
) = all_constant
;
13449 TREE_CONSTANT (node
) = all_constant
;
13453 /* Verify that one entry of the initializer element list can be
13454 assigned to the array base type. Report 1 if an error occurred, 0
13458 array_constructor_check_entry (type
, entry
)
13461 char *array_type_string
= NULL
; /* For error reports */
13462 tree value
, type_value
, new_value
, wfl_value
, patched
;
13463 int error_seen
= 0;
13465 new_value
= NULL_TREE
;
13466 wfl_value
= TREE_VALUE (entry
);
13468 push_obstacks (&permanent_obstack
, &permanent_obstack
);
13469 value
= java_complete_tree (TREE_VALUE (entry
));
13470 /* patch_string return error_mark_node if arg is error_mark_node */
13471 if ((patched
= patch_string (value
)))
13473 if (value
== error_mark_node
)
13476 type_value
= TREE_TYPE (value
);
13478 /* At anytime, try_builtin_assignconv can report a warning on
13479 constant overflow during narrowing. */
13480 SET_WFL_OPERATOR (wfl_operator
, TREE_PURPOSE (entry
), wfl_value
);
13481 new_value
= try_builtin_assignconv (wfl_operator
, type
, value
);
13482 if (!new_value
&& (new_value
= try_reference_assignconv (type
, value
)))
13483 type_value
= promote_type (type
);
13486 /* Check and report errors */
13489 const char *msg
= (!valid_cast_to_p (type_value
, type
) ?
13490 "Can't" : "Explicit cast needed to");
13491 if (!array_type_string
)
13492 array_type_string
= xstrdup (lang_printable_name (type
, 1));
13493 parse_error_context
13494 (wfl_operator
, "Incompatible type for array. %s convert `%s' to `%s'",
13495 msg
, lang_printable_name (type_value
, 1), array_type_string
);
13501 new_value
= maybe_build_primttype_type_ref (new_value
, wfl_operator
);
13502 TREE_VALUE (entry
) = new_value
;
13505 if (array_type_string
)
13506 free (array_type_string
);
13508 TREE_PURPOSE (entry
) = NULL_TREE
;
13513 build_this (location
)
13516 tree node
= build_wfl_node (this_identifier_node
);
13517 TREE_SET_CODE (node
, THIS_EXPR
);
13518 EXPR_WFL_LINECOL (node
) = location
;
13522 /* 14.15 The return statement. It builds a modify expression that
13523 assigns the returned value to the RESULT_DECL that hold the value
13527 build_return (location
, op
)
13531 tree node
= build1 (RETURN_EXPR
, NULL_TREE
, op
);
13532 EXPR_WFL_LINECOL (node
) = location
;
13533 node
= build_debugable_stmt (location
, node
);
13538 patch_return (node
)
13541 tree return_exp
= TREE_OPERAND (node
, 0);
13542 tree meth
= current_function_decl
;
13543 tree mtype
= TREE_TYPE (TREE_TYPE (current_function_decl
));
13544 int error_found
= 0;
13546 TREE_TYPE (node
) = error_mark_node
;
13547 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13549 /* It's invalid to have a return value within a function that is
13550 declared with the keyword void or that is a constructor */
13551 if (return_exp
&& (mtype
== void_type_node
|| DECL_CONSTRUCTOR_P (meth
)))
13554 /* It's invalid to use a return statement in a static block */
13555 if (IS_CLINIT (current_function_decl
))
13558 /* It's invalid to have a no return value within a function that
13559 isn't declared with the keyword `void' */
13560 if (!return_exp
&& (mtype
!= void_type_node
&& !DECL_CONSTRUCTOR_P (meth
)))
13565 if (IS_CLINIT (current_function_decl
))
13566 parse_error_context (wfl_operator
,
13567 "`return' inside static initializer.");
13569 else if (!DECL_CONSTRUCTOR_P (meth
))
13571 char *t
= xstrdup (lang_printable_name (mtype
, 0));
13572 parse_error_context (wfl_operator
,
13573 "`return' with%s value from `%s %s'",
13574 (error_found
== 1 ? "" : "out"),
13575 t
, lang_printable_name (meth
, 0));
13579 parse_error_context (wfl_operator
,
13580 "`return' with value from constructor `%s'",
13581 lang_printable_name (meth
, 0));
13582 return error_mark_node
;
13585 /* If we have a return_exp, build a modify expression and expand
13586 it. Note: at that point, the assignment is declared valid, but we
13587 may want to carry some more hacks */
13590 tree exp
= java_complete_tree (return_exp
);
13591 tree modify
, patched
;
13593 /* If the function returned value and EXP are booleans, EXP has
13594 to be converted into the type of DECL_RESULT, which is integer
13595 (see complete_start_java_method) */
13596 if (TREE_TYPE (exp
) == boolean_type_node
&&
13597 TREE_TYPE (TREE_TYPE (meth
)) == boolean_type_node
)
13598 exp
= convert_to_integer (TREE_TYPE (DECL_RESULT (meth
)), exp
);
13600 /* `null' can be assigned to a function returning a reference */
13601 if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth
))) &&
13602 exp
== null_pointer_node
)
13603 exp
= build_null_of_type (TREE_TYPE (TREE_TYPE (meth
)));
13605 if ((patched
= patch_string (exp
)))
13608 modify
= build (MODIFY_EXPR
, NULL_TREE
, DECL_RESULT (meth
), exp
);
13609 EXPR_WFL_LINECOL (modify
) = EXPR_WFL_LINECOL (node
);
13610 modify
= java_complete_tree (modify
);
13612 if (modify
!= error_mark_node
)
13614 TREE_SIDE_EFFECTS (modify
) = 1;
13615 TREE_OPERAND (node
, 0) = modify
;
13618 return error_mark_node
;
13620 TREE_TYPE (node
) = void_type_node
;
13621 TREE_SIDE_EFFECTS (node
) = 1;
13625 /* 14.8 The if Statement */
13628 build_if_else_statement (location
, expression
, if_body
, else_body
)
13630 tree expression
, if_body
, else_body
;
13634 else_body
= empty_stmt_node
;
13635 node
= build (COND_EXPR
, NULL_TREE
, expression
, if_body
, else_body
);
13636 EXPR_WFL_LINECOL (node
) = location
;
13637 node
= build_debugable_stmt (location
, node
);
13642 patch_if_else_statement (node
)
13645 tree expression
= TREE_OPERAND (node
, 0);
13647 TREE_TYPE (node
) = error_mark_node
;
13648 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13650 /* The type of expression must be boolean */
13651 if (TREE_TYPE (expression
) != boolean_type_node
13652 && TREE_TYPE (expression
) != promoted_boolean_type_node
)
13654 parse_error_context
13656 "Incompatible type for `if'. Can't convert `%s' to `boolean'",
13657 lang_printable_name (TREE_TYPE (expression
), 0));
13658 return error_mark_node
;
13661 TREE_TYPE (node
) = void_type_node
;
13662 TREE_SIDE_EFFECTS (node
) = 1;
13663 CAN_COMPLETE_NORMALLY (node
)
13664 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1))
13665 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 2));
13669 /* 14.6 Labeled Statements */
13671 /* Action taken when a lableled statement is parsed. a new
13672 LABELED_BLOCK_EXPR is created. No statement is attached to the
13673 label, yet. LABEL can be NULL_TREE for artificially-generated blocks. */
13676 build_labeled_block (location
, label
)
13681 tree label_decl
, node
;
13682 if (label
== NULL_TREE
|| label
== continue_identifier_node
)
13683 label_name
= label
;
13686 label_name
= merge_qualified_name (label_id
, label
);
13687 /* Issue an error if we try to reuse a label that was previously
13689 if (IDENTIFIER_LOCAL_VALUE (label_name
))
13691 EXPR_WFL_LINECOL (wfl_operator
) = location
;
13692 parse_error_context (wfl_operator
, "Declaration of `%s' shadows "
13693 "a previous label declaration",
13694 IDENTIFIER_POINTER (label
));
13695 EXPR_WFL_LINECOL (wfl_operator
) =
13696 EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name
));
13697 parse_error_context (wfl_operator
, "This is the location of the "
13698 "previous declaration of label `%s'",
13699 IDENTIFIER_POINTER (label
));
13700 java_error_count
--;
13704 label_decl
= create_label_decl (label_name
);
13705 node
= build (LABELED_BLOCK_EXPR
, NULL_TREE
, label_decl
, NULL_TREE
);
13706 EXPR_WFL_LINECOL (node
) = location
;
13707 TREE_SIDE_EFFECTS (node
) = 1;
13711 /* A labeled statement LBE is attached a statement. */
13714 finish_labeled_statement (lbe
, statement
)
13715 tree lbe
; /* Labeled block expr */
13718 /* In anyways, tie the loop to its statement */
13719 LABELED_BLOCK_BODY (lbe
) = statement
;
13720 pop_labeled_block ();
13721 POP_LABELED_BLOCK ();
13725 /* 14.10, 14.11, 14.12 Loop Statements */
13727 /* Create an empty LOOP_EXPR and make it the last in the nested loop
13731 build_new_loop (loop_body
)
13734 tree loop
= build (LOOP_EXPR
, NULL_TREE
, loop_body
);
13735 TREE_SIDE_EFFECTS (loop
) = 1;
13740 /* Create a loop body according to the following structure:
13742 COMPOUND_EXPR (loop main body)
13743 EXIT_EXPR (this order is for while/for loops.
13744 LABELED_BLOCK_EXPR the order is reversed for do loops)
13745 LABEL_DECL (a continue occuring here branches at the
13746 BODY end of this labeled block)
13749 REVERSED, if non zero, tells that the loop condition expr comes
13750 after the body, like in the do-while loop.
13752 To obtain a loop, the loop body structure described above is
13753 encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
13756 LABEL_DECL (use this label to exit the loop)
13758 <structure described above> */
13761 build_loop_body (location
, condition
, reversed
)
13766 tree first
, second
, body
;
13768 condition
= build (EXIT_EXPR
, NULL_TREE
, condition
); /* Force walk */
13769 EXPR_WFL_LINECOL (condition
) = location
; /* For accurate error report */
13770 condition
= build_debugable_stmt (location
, condition
);
13771 TREE_SIDE_EFFECTS (condition
) = 1;
13773 body
= build_labeled_block (0, continue_identifier_node
);
13774 first
= (reversed
? body
: condition
);
13775 second
= (reversed
? condition
: body
);
13777 build (COMPOUND_EXPR
, NULL_TREE
,
13778 build (COMPOUND_EXPR
, NULL_TREE
, first
, second
), empty_stmt_node
);
13781 /* Install CONDITION (if any) and loop BODY (using REVERSED to tell
13782 their order) on the current loop. Unlink the current loop from the
13786 finish_loop_body (location
, condition
, body
, reversed
)
13788 tree condition
, body
;
13791 tree to_return
= ctxp
->current_loop
;
13792 tree loop_body
= LOOP_EXPR_BODY (to_return
);
13795 tree cnode
= LOOP_EXPR_BODY_CONDITION_EXPR (loop_body
, reversed
);
13796 /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
13797 The real EXIT_EXPR is one operand further. */
13798 EXPR_WFL_LINECOL (cnode
) = location
;
13799 /* This one is for accurate error reports */
13800 EXPR_WFL_LINECOL (TREE_OPERAND (cnode
, 0)) = location
;
13801 TREE_OPERAND (TREE_OPERAND (cnode
, 0), 0) = condition
;
13803 LOOP_EXPR_BODY_BODY_EXPR (loop_body
, reversed
) = body
;
13808 /* Tailored version of finish_loop_body for FOR loops, when FOR
13809 loops feature the condition part */
13812 finish_for_loop (location
, condition
, update
, body
)
13814 tree condition
, update
, body
;
13816 /* Put the condition and the loop body in place */
13817 tree loop
= finish_loop_body (location
, condition
, body
, 0);
13818 /* LOOP is the current loop which has been now popped of the loop
13819 stack. Install the update block */
13820 LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop
)) = update
;
13824 /* Try to find the loop a block might be related to. This comprises
13825 the case where the LOOP_EXPR is found as the second operand of a
13826 COMPOUND_EXPR, because the loop happens to have an initialization
13827 part, then expressed as the first operand of the COMPOUND_EXPR. If
13828 the search finds something, 1 is returned. Otherwise, 0 is
13829 returned. The search is assumed to start from a
13830 LABELED_BLOCK_EXPR's block. */
13833 search_loop (statement
)
13836 if (TREE_CODE (statement
) == LOOP_EXPR
)
13839 if (TREE_CODE (statement
) == BLOCK
)
13840 statement
= BLOCK_SUBBLOCKS (statement
);
13844 if (statement
&& TREE_CODE (statement
) == COMPOUND_EXPR
)
13845 while (statement
&& TREE_CODE (statement
) == COMPOUND_EXPR
)
13846 statement
= TREE_OPERAND (statement
, 1);
13848 return (TREE_CODE (statement
) == LOOP_EXPR
13849 && IS_FOR_LOOP_P (statement
) ? statement
: NULL_TREE
);
13852 /* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
13853 returned otherwise. */
13856 labeled_block_contains_loop_p (block
, loop
)
13862 if (LABELED_BLOCK_BODY (block
) == loop
)
13865 if (IS_FOR_LOOP_P (loop
)
13866 && search_loop (LABELED_BLOCK_BODY (block
)) == loop
)
13872 /* If the loop isn't surrounded by a labeled statement, create one and
13873 insert LOOP as its body. */
13876 patch_loop_statement (loop
)
13881 TREE_TYPE (loop
) = void_type_node
;
13882 if (labeled_block_contains_loop_p (ctxp
->current_labeled_block
, loop
))
13885 loop_label
= build_labeled_block (0, NULL_TREE
);
13886 /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
13887 that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
13888 LABELED_BLOCK_BODY (loop_label
) = loop
;
13889 PUSH_LABELED_BLOCK (loop_label
);
13893 /* 14.13, 14.14: break and continue Statements */
13895 /* Build a break or a continue statement. a null NAME indicates an
13896 unlabeled break/continue statement. */
13899 build_bc_statement (location
, is_break
, name
)
13900 int location
, is_break
;
13903 tree break_continue
, label_block_expr
= NULL_TREE
;
13907 if (!(label_block_expr
= IDENTIFIER_LOCAL_VALUE
13908 (merge_qualified_name (label_id
, EXPR_WFL_NODE (name
)))))
13909 /* Null means that we don't have a target for this named
13910 break/continue. In this case, we make the target to be the
13911 label name, so that the error can be reported accuratly in
13912 patch_bc_statement. */
13913 label_block_expr
= EXPR_WFL_NODE (name
);
13915 /* Unlabeled break/continue will be handled during the
13916 break/continue patch operation */
13918 = build (EXIT_BLOCK_EXPR
, NULL_TREE
, label_block_expr
, NULL_TREE
);
13920 IS_BREAK_STMT_P (break_continue
) = is_break
;
13921 TREE_SIDE_EFFECTS (break_continue
) = 1;
13922 EXPR_WFL_LINECOL (break_continue
) = location
;
13923 break_continue
= build_debugable_stmt (location
, break_continue
);
13924 return break_continue
;
13927 /* Verification of a break/continue statement. */
13930 patch_bc_statement (node
)
13933 tree bc_label
= EXIT_BLOCK_LABELED_BLOCK (node
), target_stmt
;
13934 tree labeled_block
= ctxp
->current_labeled_block
;
13935 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13937 /* Having an identifier here means that the target is unknown. */
13938 if (bc_label
!= NULL_TREE
&& TREE_CODE (bc_label
) == IDENTIFIER_NODE
)
13940 parse_error_context (wfl_operator
, "No label definition found for `%s'",
13941 IDENTIFIER_POINTER (bc_label
));
13942 return error_mark_node
;
13944 if (! IS_BREAK_STMT_P (node
))
13946 /* It's a continue statement. */
13947 for (;; labeled_block
= TREE_CHAIN (labeled_block
))
13949 if (labeled_block
== NULL_TREE
)
13951 if (bc_label
== NULL_TREE
)
13952 parse_error_context (wfl_operator
,
13953 "`continue' must be in loop");
13955 parse_error_context
13956 (wfl_operator
, "continue label `%s' does not name a loop",
13957 IDENTIFIER_POINTER (bc_label
));
13958 return error_mark_node
;
13960 if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block
))
13961 == continue_identifier_node
)
13962 && (bc_label
== NULL_TREE
13963 || TREE_CHAIN (labeled_block
) == bc_label
))
13965 bc_label
= labeled_block
;
13970 else if (!bc_label
)
13972 for (;; labeled_block
= TREE_CHAIN (labeled_block
))
13974 if (labeled_block
== NULL_TREE
)
13976 parse_error_context (wfl_operator
,
13977 "`break' must be in loop or switch");
13978 return error_mark_node
;
13980 target_stmt
= LABELED_BLOCK_BODY (labeled_block
);
13981 if (TREE_CODE (target_stmt
) == SWITCH_EXPR
13982 || search_loop (target_stmt
))
13984 bc_label
= labeled_block
;
13990 EXIT_BLOCK_LABELED_BLOCK (node
) = bc_label
;
13991 CAN_COMPLETE_NORMALLY (bc_label
) = 1;
13993 /* Our break/continue don't return values. */
13994 TREE_TYPE (node
) = void_type_node
;
13995 /* Encapsulate the break within a compound statement so that it's
13996 expanded all the times by expand_expr (and not clobbered
13997 sometimes, like after a if statement) */
13998 node
= add_stmt_to_compound (NULL_TREE
, void_type_node
, node
);
13999 TREE_SIDE_EFFECTS (node
) = 1;
14003 /* Process the exit expression belonging to a loop. Its type must be
14007 patch_exit_expr (node
)
14010 tree expression
= TREE_OPERAND (node
, 0);
14011 TREE_TYPE (node
) = error_mark_node
;
14012 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
14014 /* The type of expression must be boolean */
14015 if (TREE_TYPE (expression
) != boolean_type_node
)
14017 parse_error_context
14019 "Incompatible type for loop conditional. Can't convert `%s' to "
14021 lang_printable_name (TREE_TYPE (expression
), 0));
14022 return error_mark_node
;
14024 /* Now we know things are allright, invert the condition, fold and
14026 TREE_OPERAND (node
, 0) =
14027 fold (build1 (TRUTH_NOT_EXPR
, boolean_type_node
, expression
));
14029 if (! integer_zerop (TREE_OPERAND (node
, 0))
14030 && ctxp
->current_loop
!= NULL_TREE
14031 && TREE_CODE (ctxp
->current_loop
) == LOOP_EXPR
)
14032 CAN_COMPLETE_NORMALLY (ctxp
->current_loop
) = 1;
14033 if (! integer_onep (TREE_OPERAND (node
, 0)))
14034 CAN_COMPLETE_NORMALLY (node
) = 1;
14037 TREE_TYPE (node
) = void_type_node
;
14041 /* 14.9 Switch statement */
14044 patch_switch_statement (node
)
14047 tree se
= TREE_OPERAND (node
, 0), se_type
;
14049 /* Complete the switch expression */
14050 se
= TREE_OPERAND (node
, 0) = java_complete_tree (se
);
14051 se_type
= TREE_TYPE (se
);
14052 /* The type of the switch expression must be char, byte, short or
14054 if (!JINTEGRAL_TYPE_P (se_type
))
14056 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
14057 parse_error_context (wfl_operator
, "Incompatible type for `switch'. "
14058 "Can't convert `%s' to `int'",
14059 lang_printable_name (se_type
, 0));
14060 /* This is what java_complete_tree will check */
14061 TREE_OPERAND (node
, 0) = error_mark_node
;
14062 return error_mark_node
;
14065 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
14067 /* Ready to return */
14068 if (TREE_CODE (TREE_OPERAND (node
, 1)) == ERROR_MARK
)
14070 TREE_TYPE (node
) = error_mark_node
;
14071 return error_mark_node
;
14073 TREE_TYPE (node
) = void_type_node
;
14074 TREE_SIDE_EFFECTS (node
) = 1;
14075 CAN_COMPLETE_NORMALLY (node
)
14076 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1))
14077 || ! SWITCH_HAS_DEFAULT (node
);
14081 /* 14.18 The try statement */
14084 build_try_statement (location
, try_block
, catches
)
14086 tree try_block
, catches
;
14088 tree node
= build (TRY_EXPR
, NULL_TREE
, try_block
, catches
);
14089 EXPR_WFL_LINECOL (node
) = location
;
14094 build_try_finally_statement (location
, try_block
, finally
)
14096 tree try_block
, finally
;
14098 tree node
= build (TRY_FINALLY_EXPR
, NULL_TREE
, try_block
, finally
);
14099 EXPR_WFL_LINECOL (node
) = location
;
14104 patch_try_statement (node
)
14107 int error_found
= 0;
14108 tree
try = TREE_OPERAND (node
, 0);
14109 /* Exception handlers are considered in left to right order */
14110 tree
catch = nreverse (TREE_OPERAND (node
, 1));
14111 tree current
, caught_type_list
= NULL_TREE
;
14113 /* Check catch clauses, if any. Every time we find an error, we try
14114 to process the next catch clause. We process the catch clause before
14115 the try block so that when processing the try block we can check thrown
14116 exceptions againts the caught type list. */
14117 for (current
= catch; current
; current
= TREE_CHAIN (current
))
14119 tree carg_decl
, carg_type
;
14120 tree sub_current
, catch_block
, catch_clause
;
14123 /* At this point, the structure of the catch clause is
14124 CATCH_EXPR (catch node)
14125 BLOCK (with the decl of the parameter)
14127 MODIFY_EXPR (assignment of the catch parameter)
14128 BLOCK (catch clause block)
14130 catch_clause
= TREE_OPERAND (current
, 0);
14131 carg_decl
= BLOCK_EXPR_DECLS (catch_clause
);
14132 carg_type
= TREE_TYPE (TREE_TYPE (carg_decl
));
14134 /* Catch clauses can't have more than one parameter declared,
14135 but it's already enforced by the grammar. Make sure that the
14136 only parameter of the clause statement in of class Throwable
14137 or a subclass of Throwable, but that was done earlier. The
14138 catch clause parameter type has also been resolved. */
14140 /* Just make sure that the catch clause parameter type inherits
14141 from java.lang.Throwable */
14142 if (!inherits_from_p (carg_type
, throwable_type_node
))
14144 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (current
);
14145 parse_error_context (wfl_operator
,
14146 "Can't catch class `%s'. Catch clause "
14147 "parameter type must be a subclass of "
14148 "class `java.lang.Throwable'",
14149 lang_printable_name (carg_type
, 0));
14154 /* Partial check for unreachable catch statement: The catch
14155 clause is reachable iff is no earlier catch block A in
14156 the try statement such that the type of the catch
14157 clause's parameter is the same as or a subclass of the
14158 type of A's parameter */
14160 for (sub_current
= catch;
14161 sub_current
!= current
; sub_current
= TREE_CHAIN (sub_current
))
14163 tree sub_catch_clause
, decl
;
14164 sub_catch_clause
= TREE_OPERAND (sub_current
, 0);
14165 decl
= BLOCK_EXPR_DECLS (sub_catch_clause
);
14167 if (inherits_from_p (carg_type
, TREE_TYPE (TREE_TYPE (decl
))))
14169 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (current
);
14170 parse_error_context
14171 (wfl_operator
, "`catch' not reached because of the catch "
14172 "clause at line %d", EXPR_WFL_LINENO (sub_current
));
14173 unreachable
= error_found
= 1;
14177 /* Complete the catch clause block */
14178 catch_block
= java_complete_tree (TREE_OPERAND (current
, 0));
14179 if (catch_block
== error_mark_node
)
14184 if (CAN_COMPLETE_NORMALLY (catch_block
))
14185 CAN_COMPLETE_NORMALLY (node
) = 1;
14186 TREE_OPERAND (current
, 0) = catch_block
;
14191 /* Things to do here: the exception must be thrown */
14193 /* Link this type to the caught type list */
14194 caught_type_list
= tree_cons (NULL_TREE
, carg_type
, caught_type_list
);
14197 PUSH_EXCEPTIONS (caught_type_list
);
14198 if ((try = java_complete_tree (try)) == error_mark_node
)
14200 if (CAN_COMPLETE_NORMALLY (try))
14201 CAN_COMPLETE_NORMALLY (node
) = 1;
14204 /* Verification ends here */
14206 return error_mark_node
;
14208 TREE_OPERAND (node
, 0) = try;
14209 TREE_OPERAND (node
, 1) = catch;
14210 TREE_TYPE (node
) = void_type_node
;
14214 /* 14.17 The synchronized Statement */
14217 patch_synchronized_statement (node
, wfl_op1
)
14218 tree node
, wfl_op1
;
14220 tree expr
= java_complete_tree (TREE_OPERAND (node
, 0));
14221 tree block
= TREE_OPERAND (node
, 1);
14223 tree enter
, exit
, expr_decl
, assignment
;
14225 if (expr
== error_mark_node
)
14227 block
= java_complete_tree (block
);
14231 /* The TYPE of expr must be a reference type */
14232 if (!JREFERENCE_TYPE_P (TREE_TYPE (expr
)))
14234 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14235 parse_error_context (wfl_operator
, "Incompatible type for `synchronized'"
14236 ". Can't convert `%s' to `java.lang.Object'",
14237 lang_printable_name (TREE_TYPE (expr
), 0));
14238 return error_mark_node
;
14241 if (flag_emit_xref
)
14243 TREE_OPERAND (node
, 0) = expr
;
14244 TREE_OPERAND (node
, 1) = java_complete_tree (block
);
14245 CAN_COMPLETE_NORMALLY (node
) = 1;
14249 /* Generate a try-finally for the synchronized statement, except
14250 that the handler that catches all throw exception calls
14251 _Jv_MonitorExit and then rethrow the exception.
14252 The synchronized statement is then implemented as:
14255 _Jv_MonitorEnter (expression)
14257 _Jv_MonitorExit (expression)
14261 e = _Jv_exception_info ();
14262 _Jv_MonitorExit (expression)
14266 expr_decl
= build_decl (VAR_DECL
, generate_name (), TREE_TYPE (expr
));
14267 BUILD_MONITOR_ENTER (enter
, expr_decl
);
14268 BUILD_MONITOR_EXIT (exit
, expr_decl
);
14269 CAN_COMPLETE_NORMALLY (enter
) = 1;
14270 CAN_COMPLETE_NORMALLY (exit
) = 1;
14271 assignment
= build (MODIFY_EXPR
, NULL_TREE
, expr_decl
, expr
);
14272 TREE_SIDE_EFFECTS (assignment
) = 1;
14273 node
= build1 (CLEANUP_POINT_EXPR
, NULL_TREE
,
14274 build (COMPOUND_EXPR
, NULL_TREE
,
14275 build (WITH_CLEANUP_EXPR
, NULL_TREE
,
14276 build (COMPOUND_EXPR
, NULL_TREE
,
14277 assignment
, enter
),
14280 node
= build_expr_block (node
, expr_decl
);
14282 return java_complete_tree (node
);
14285 /* 14.16 The throw Statement */
14288 patch_throw_statement (node
, wfl_op1
)
14289 tree node
, wfl_op1
;
14291 tree expr
= TREE_OPERAND (node
, 0);
14292 tree type
= TREE_TYPE (expr
);
14293 int unchecked_ok
= 0, tryblock_throws_ok
= 0;
14295 /* Thrown expression must be assignable to java.lang.Throwable */
14296 if (!try_reference_assignconv (throwable_type_node
, expr
))
14298 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14299 parse_error_context (wfl_operator
, "Can't throw `%s'; it must be a "
14300 "subclass of class `java.lang.Throwable'",
14301 lang_printable_name (type
, 0));
14302 /* If the thrown expression was a reference, we further the
14303 compile-time check. */
14304 if (!JREFERENCE_TYPE_P (type
))
14305 return error_mark_node
;
14308 /* At least one of the following must be true */
14310 /* The type of the throw expression is a not checked exception,
14311 i.e. is a unchecked expression. */
14312 unchecked_ok
= IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type
));
14314 /* Throw is contained in a try statement and at least one catch
14315 clause can receive the thrown expression or the current method is
14316 declared to throw such an exception. Or, the throw statement is
14317 contained in a method or constructor declaration and the type of
14318 the Expression is assignable to at least one type listed in the
14319 throws clause the declaration. */
14320 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14322 tryblock_throws_ok
= check_thrown_exceptions_do (TREE_TYPE (expr
));
14323 if (!(unchecked_ok
|| tryblock_throws_ok
))
14325 /* If there is a surrounding try block that has no matching
14326 clatch clause, report it first. A surrounding try block exits
14327 only if there is something after the list of checked
14328 exception thrown by the current function (if any). */
14329 if (IN_TRY_BLOCK_P ())
14330 parse_error_context (wfl_operator
, "Checked exception `%s' can't be "
14331 "caught by any of the catch clause(s) "
14332 "of the surrounding `try' block",
14333 lang_printable_name (type
, 0));
14334 /* If we have no surrounding try statement and the method doesn't have
14335 any throws, report it now. FIXME */
14337 /* We report that the exception can't be throw from a try block
14338 in all circumstances but when the `throw' is inside a static
14340 else if (!EXCEPTIONS_P (currently_caught_type_list
)
14341 && !tryblock_throws_ok
)
14343 if (IS_CLINIT (current_function_decl
))
14344 parse_error_context (wfl_operator
, "Checked exception `%s' can't "
14345 "be thrown in initializer",
14346 lang_printable_name (type
, 0));
14348 parse_error_context (wfl_operator
, "Checked exception `%s' isn't "
14349 "thrown from a `try' block",
14350 lang_printable_name (type
, 0));
14352 /* Otherwise, the current method doesn't have the appropriate
14353 throws declaration */
14355 parse_error_context (wfl_operator
, "Checked exception `%s' doesn't "
14356 "match any of current method's `throws' "
14358 lang_printable_name (type
, 0));
14359 return error_mark_node
;
14362 if (! flag_emit_class_files
&& ! flag_emit_xref
)
14363 BUILD_THROW (node
, expr
);
14365 /* If doing xrefs, keep the location where the `throw' was seen. */
14366 if (flag_emit_xref
)
14367 EXPR_WFL_LINECOL (node
) = EXPR_WFL_LINECOL (wfl_op1
);
14371 /* Check that exception said to be thrown by method DECL can be
14372 effectively caught from where DECL is invoked. */
14375 check_thrown_exceptions (location
, decl
)
14380 /* For all the unchecked exceptions thrown by DECL */
14381 for (throws
= DECL_FUNCTION_THROWS (decl
); throws
;
14382 throws
= TREE_CHAIN (throws
))
14383 if (!check_thrown_exceptions_do (TREE_VALUE (throws
)))
14386 /* Temporary hack to suppresses errors about cloning arrays. FIXME */
14387 if (DECL_NAME (decl
) == get_identifier ("clone"))
14390 EXPR_WFL_LINECOL (wfl_operator
) = location
;
14391 if (DECL_NAME (current_function_decl
) == finit_identifier_node
)
14392 parse_error_context
14393 (wfl_operator
, "Exception `%s' can't be thrown in initializer",
14394 lang_printable_name (TREE_VALUE (throws
), 0));
14397 parse_error_context
14398 (wfl_operator
, "Exception `%s' must be caught, or it must be "
14399 "declared in the `throws' clause of `%s'",
14400 lang_printable_name (TREE_VALUE (throws
), 0),
14401 (DECL_NAME (current_function_decl
) == init_identifier_node
?
14402 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))) :
14403 IDENTIFIER_POINTER (DECL_NAME (current_function_decl
))));
14408 /* Return 1 if checked EXCEPTION is caught at the current nesting level of
14409 try-catch blocks, OR is listed in the `throws' clause of the
14413 check_thrown_exceptions_do (exception
)
14416 tree list
= currently_caught_type_list
;
14417 resolve_and_layout (exception
, NULL_TREE
);
14418 /* First, all the nested try-catch-finally at that stage. The
14419 last element contains `throws' clause exceptions, if any. */
14420 if (IS_UNCHECKED_EXCEPTION_P (exception
))
14425 for (caught
= TREE_VALUE (list
); caught
; caught
= TREE_CHAIN (caught
))
14426 if (valid_ref_assignconv_cast_p (exception
, TREE_VALUE (caught
), 0))
14428 list
= TREE_CHAIN (list
);
14434 purge_unchecked_exceptions (mdecl
)
14437 tree throws
= DECL_FUNCTION_THROWS (mdecl
);
14438 tree
new = NULL_TREE
;
14442 tree next
= TREE_CHAIN (throws
);
14443 if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws
)))
14445 TREE_CHAIN (throws
) = new;
14450 /* List is inverted here, but it doesn't matter */
14451 DECL_FUNCTION_THROWS (mdecl
) = new;
14454 /* 15.24 Conditional Operator ?: */
14457 patch_conditional_expr (node
, wfl_cond
, wfl_op1
)
14458 tree node
, wfl_cond
, wfl_op1
;
14460 tree cond
= TREE_OPERAND (node
, 0);
14461 tree op1
= TREE_OPERAND (node
, 1);
14462 tree op2
= TREE_OPERAND (node
, 2);
14463 tree resulting_type
= NULL_TREE
;
14464 tree t1
, t2
, patched
;
14465 int error_found
= 0;
14467 /* Operands of ?: might be StringBuffers crafted as a result of a
14468 string concatenation. Obtain a descent operand here. */
14469 if ((patched
= patch_string (op1
)))
14470 TREE_OPERAND (node
, 1) = op1
= patched
;
14471 if ((patched
= patch_string (op2
)))
14472 TREE_OPERAND (node
, 2) = op2
= patched
;
14474 t1
= TREE_TYPE (op1
);
14475 t2
= TREE_TYPE (op2
);
14477 /* The first expression must be a boolean */
14478 if (TREE_TYPE (cond
) != boolean_type_node
)
14480 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_cond
);
14481 parse_error_context (wfl_operator
, "Incompatible type for `?:'. Can't "
14482 "convert `%s' to `boolean'",
14483 lang_printable_name (TREE_TYPE (cond
), 0));
14487 /* Second and third can be numeric, boolean (i.e. primitive),
14488 references or null. Anything else results in an error */
14489 if (!((JNUMERIC_TYPE_P (t1
) && JNUMERIC_TYPE_P (t2
))
14490 || ((JREFERENCE_TYPE_P (t1
) || op1
== null_pointer_node
)
14491 && (JREFERENCE_TYPE_P (t2
) || op2
== null_pointer_node
))
14492 || (t1
== boolean_type_node
&& t2
== boolean_type_node
)))
14495 /* Determine the type of the conditional expression. Same types are
14496 easy to deal with */
14498 resulting_type
= t1
;
14500 /* There are different rules for numeric types */
14501 else if (JNUMERIC_TYPE_P (t1
))
14503 /* if byte/short found, the resulting type is short */
14504 if ((t1
== byte_type_node
&& t2
== short_type_node
)
14505 || (t1
== short_type_node
&& t2
== byte_type_node
))
14506 resulting_type
= short_type_node
;
14508 /* If t1 is a constant int and t2 is of type byte, short or char
14509 and t1's value fits in t2, then the resulting type is t2 */
14510 else if ((t1
== int_type_node
&& TREE_CONSTANT (TREE_OPERAND (node
, 1)))
14511 && JBSC_TYPE_P (t2
) && int_fits_type_p (TREE_OPERAND (node
, 1), t2
))
14512 resulting_type
= t2
;
14514 /* If t2 is a constant int and t1 is of type byte, short or char
14515 and t2's value fits in t1, then the resulting type is t1 */
14516 else if ((t2
== int_type_node
&& TREE_CONSTANT (TREE_OPERAND (node
, 2)))
14517 && JBSC_TYPE_P (t1
) && int_fits_type_p (TREE_OPERAND (node
, 2), t1
))
14518 resulting_type
= t1
;
14520 /* Otherwise, binary numeric promotion is applied and the
14521 resulting type is the promoted type of operand 1 and 2 */
14523 resulting_type
= binary_numeric_promotion (t1
, t2
,
14524 &TREE_OPERAND (node
, 1),
14525 &TREE_OPERAND (node
, 2));
14528 /* Cases of a reference and a null type */
14529 else if (JREFERENCE_TYPE_P (t1
) && op2
== null_pointer_node
)
14530 resulting_type
= t1
;
14532 else if (JREFERENCE_TYPE_P (t2
) && op1
== null_pointer_node
)
14533 resulting_type
= t2
;
14535 /* Last case: different reference types. If a type can be converted
14536 into the other one by assignment conversion, the latter
14537 determines the type of the expression */
14538 else if ((resulting_type
= try_reference_assignconv (t1
, op2
)))
14539 resulting_type
= promote_type (t1
);
14541 else if ((resulting_type
= try_reference_assignconv (t2
, op1
)))
14542 resulting_type
= promote_type (t2
);
14544 /* If we don't have any resulting type, we're in trouble */
14545 if (!resulting_type
)
14547 char *t
= xstrdup (lang_printable_name (t1
, 0));
14548 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14549 parse_error_context (wfl_operator
, "Incompatible type for `?:'. Can't "
14550 "convert `%s' to `%s'", t
,
14551 lang_printable_name (t2
, 0));
14558 TREE_TYPE (node
) = error_mark_node
;
14559 return error_mark_node
;
14562 TREE_TYPE (node
) = resulting_type
;
14563 TREE_SET_CODE (node
, COND_EXPR
);
14564 CAN_COMPLETE_NORMALLY (node
) = 1;
14568 /* Try to constant fold NODE.
14569 If NODE is not a constant expression, return NULL_EXPR.
14570 CONTEXT is a static final VAR_DECL whose initializer we are folding. */
14573 fold_constant_for_init (node
, context
)
14577 tree op0
, op1
, val
;
14578 enum tree_code code
= TREE_CODE (node
);
14580 if (code
== STRING_CST
)
14583 if (code
== INTEGER_CST
|| code
== REAL_CST
)
14584 return convert (TREE_TYPE (context
), node
);
14585 if (TREE_TYPE (node
) != NULL_TREE
&& code
!= VAR_DECL
&& code
!= FIELD_DECL
)
14593 case TRUNC_MOD_EXPR
:
14601 case TRUTH_ANDIF_EXPR
:
14602 case TRUTH_ORIF_EXPR
:
14609 op0
= TREE_OPERAND (node
, 0);
14610 op1
= TREE_OPERAND (node
, 1);
14611 val
= fold_constant_for_init (op0
, context
);
14612 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14614 TREE_OPERAND (node
, 0) = val
;
14615 val
= fold_constant_for_init (op1
, context
);
14616 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14618 TREE_OPERAND (node
, 1) = val
;
14619 return patch_binop (node
, op0
, op1
);
14621 case UNARY_PLUS_EXPR
:
14623 case TRUTH_NOT_EXPR
:
14626 op0
= TREE_OPERAND (node
, 0);
14627 val
= fold_constant_for_init (op0
, context
);
14628 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14630 TREE_OPERAND (node
, 0) = val
;
14631 return patch_unaryop (node
, op0
);
14635 val
= fold_constant_for_init (TREE_OPERAND (node
, 0), context
);
14636 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14638 TREE_OPERAND (node
, 0) = val
;
14639 val
= fold_constant_for_init (TREE_OPERAND (node
, 1), context
);
14640 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14642 TREE_OPERAND (node
, 1) = val
;
14643 val
= fold_constant_for_init (TREE_OPERAND (node
, 2), context
);
14644 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14646 TREE_OPERAND (node
, 2) = val
;
14647 return integer_zerop (TREE_OPERAND (node
, 0)) ? TREE_OPERAND (node
, 1)
14648 : TREE_OPERAND (node
, 2);
14652 if (! FIELD_FINAL (node
)
14653 || DECL_INITIAL (node
) == NULL_TREE
)
14655 val
= DECL_INITIAL (node
);
14656 /* Guard against infinite recursion. */
14657 DECL_INITIAL (node
) = NULL_TREE
;
14658 val
= fold_constant_for_init (val
, node
);
14659 DECL_INITIAL (node
) = val
;
14662 case EXPR_WITH_FILE_LOCATION
:
14663 /* Compare java_complete_tree and resolve_expression_name. */
14664 if (!EXPR_WFL_NODE (node
) /* Or a PRIMARY flag ? */
14665 || TREE_CODE (EXPR_WFL_NODE (node
)) == IDENTIFIER_NODE
)
14667 tree name
= EXPR_WFL_NODE (node
);
14669 if (PRIMARY_P (node
))
14671 else if (! QUALIFIED_P (name
))
14673 decl
= lookup_field_wrapper (DECL_CONTEXT (context
), name
);
14674 if (decl
== NULL_TREE
14675 || (! FIELD_STATIC (decl
) && ! FIELD_FINAL (decl
)))
14677 return fold_constant_for_init (decl
, decl
);
14681 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
14682 qualify_ambiguous_name (node
);
14683 if (resolve_field_access (node
, &decl
, NULL
)
14684 && decl
!= NULL_TREE
)
14685 return fold_constant_for_init (decl
, decl
);
14691 op0
= TREE_OPERAND (node
, 0);
14692 val
= fold_constant_for_init (op0
, context
);
14693 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14695 TREE_OPERAND (node
, 0) = val
;
14699 #ifdef USE_COMPONENT_REF
14701 case COMPONENT_REF
:
14710 #ifdef USE_COMPONENT_REF
14711 /* Context is 'T' for TypeName, 'P' for PackageName,
14712 'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */
14715 resolve_simple_name (name
, context
)
14722 resolve_qualified_name (name
, context
)