]>
Commit | Line | Data |
---|---|---|
8b27f225 | 1 | |
257fafbb | 2 | /* A Bison parser, made from ./parse.y |
8b27f225 PB |
3 | by GNU Bison version 1.25 |
4 | */ | |
5 | ||
6 | #define YYBISON 1 /* Identify Bison output. */ | |
7 | ||
8 | #define yyparse java_parse | |
9 | #define yylex java_lex | |
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 | |
15 | #define PLUS_TK 258 | |
16 | #define MINUS_TK 259 | |
17 | #define MULT_TK 260 | |
18 | #define DIV_TK 261 | |
19 | #define REM_TK 262 | |
20 | #define LS_TK 263 | |
21 | #define SRS_TK 264 | |
22 | #define ZRS_TK 265 | |
23 | #define AND_TK 266 | |
24 | #define XOR_TK 267 | |
25 | #define OR_TK 268 | |
26 | #define BOOL_AND_TK 269 | |
27 | #define BOOL_OR_TK 270 | |
28 | #define EQ_TK 271 | |
29 | #define NEQ_TK 272 | |
30 | #define GT_TK 273 | |
31 | #define GTE_TK 274 | |
32 | #define LT_TK 275 | |
33 | #define LTE_TK 276 | |
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 | |
45 | #define PUBLIC_TK 288 | |
46 | #define PRIVATE_TK 289 | |
47 | #define PROTECTED_TK 290 | |
48 | #define STATIC_TK 291 | |
49 | #define FINAL_TK 292 | |
50 | #define SYNCHRONIZED_TK 293 | |
51 | #define VOLATILE_TK 294 | |
52 | #define TRANSIENT_TK 295 | |
53 | #define NATIVE_TK 296 | |
54 | #define PAD_TK 297 | |
55 | #define ABSTRACT_TK 298 | |
56 | #define MODIFIER_TK 299 | |
57 | #define DECR_TK 300 | |
58 | #define INCR_TK 301 | |
59 | #define DEFAULT_TK 302 | |
60 | #define IF_TK 303 | |
61 | #define THROW_TK 304 | |
62 | #define BOOLEAN_TK 305 | |
63 | #define DO_TK 306 | |
64 | #define IMPLEMENTS_TK 307 | |
65 | #define THROWS_TK 308 | |
66 | #define BREAK_TK 309 | |
67 | #define IMPORT_TK 310 | |
68 | #define ELSE_TK 311 | |
69 | #define INSTANCEOF_TK 312 | |
70 | #define RETURN_TK 313 | |
71 | #define VOID_TK 314 | |
72 | #define CATCH_TK 315 | |
73 | #define INTERFACE_TK 316 | |
74 | #define CASE_TK 317 | |
75 | #define EXTENDS_TK 318 | |
76 | #define FINALLY_TK 319 | |
77 | #define SUPER_TK 320 | |
78 | #define WHILE_TK 321 | |
79 | #define CLASS_TK 322 | |
80 | #define SWITCH_TK 323 | |
81 | #define CONST_TK 324 | |
82 | #define TRY_TK 325 | |
83 | #define FOR_TK 326 | |
84 | #define NEW_TK 327 | |
85 | #define CONTINUE_TK 328 | |
86 | #define GOTO_TK 329 | |
87 | #define PACKAGE_TK 330 | |
88 | #define THIS_TK 331 | |
89 | #define BYTE_TK 332 | |
90 | #define SHORT_TK 333 | |
91 | #define INT_TK 334 | |
92 | #define LONG_TK 335 | |
93 | #define CHAR_TK 336 | |
94 | #define INTEGRAL_TK 337 | |
95 | #define FLOAT_TK 338 | |
96 | #define DOUBLE_TK 339 | |
97 | #define FP_TK 340 | |
98 | #define ID_TK 341 | |
99 | #define REL_QM_TK 342 | |
100 | #define REL_CL_TK 343 | |
101 | #define NOT_TK 344 | |
102 | #define NEG_TK 345 | |
103 | #define ASSIGN_ANY_TK 346 | |
104 | #define ASSIGN_TK 347 | |
105 | #define OP_TK 348 | |
106 | #define CP_TK 349 | |
107 | #define OCB_TK 350 | |
108 | #define CCB_TK 351 | |
109 | #define OSB_TK 352 | |
110 | #define CSB_TK 353 | |
111 | #define SC_TK 354 | |
112 | #define C_TK 355 | |
113 | #define DOT_TK 356 | |
114 | #define STRING_LIT_TK 357 | |
115 | #define CHAR_LIT_TK 358 | |
116 | #define INT_LIT_TK 359 | |
117 | #define FP_LIT_TK 360 | |
118 | #define TRUE_TK 361 | |
119 | #define FALSE_TK 362 | |
120 | #define BOOL_LIT_TK 363 | |
121 | #define NULL_TK 364 | |
122 | ||
22eed1e6 | 123 | #line 48 "./parse.y" |
8b27f225 PB |
124 | |
125 | #include <stdio.h> | |
126 | #include <stdlib.h> | |
127 | #include <string.h> | |
128 | #include <dirent.h> | |
129 | #ifdef __STDC__ | |
130 | #include <stdarg.h> | |
131 | #else | |
132 | #include <varargs.h> | |
133 | #endif | |
134 | ||
135 | #include "config.h" | |
136 | #include "tree.h" | |
137 | #include "rtl.h" | |
138 | #include "obstack.h" | |
139 | #include "toplev.h" | |
140 | #include "flags.h" | |
141 | #include "java-tree.h" | |
142 | #include "jcf.h" | |
143 | #include "lex.h" | |
144 | #include "parse.h" | |
145 | #include "zipfile.h" | |
5e942c50 | 146 | #include "convert.h" |
63a212ed | 147 | #include "buffer.h" |
8b27f225 | 148 | |
82371d41 APB |
149 | /* Local function prototypes */ |
150 | static char *java_accstring_lookup PROTO ((int)); | |
151 | static void classitf_redefinition_error PROTO ((char *,tree, tree, tree)); | |
152 | static void variable_redefinition_error PROTO ((tree, tree, tree, int)); | |
153 | static void check_modifiers PROTO ((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 VPROTO ((tree cl, char *msg, ...)); | |
170 | static void issue_warning_error_from_context PROTO ((tree, char *msg, va_list)); | |
171 | static tree parse_jdk1_1_error PROTO ((char *)); | |
172 | static void complete_class_report_errors PROTO ((jdep *)); | |
173 | static int process_imports PROTO ((void)); | |
174 | static void read_import_dir PROTO ((tree)); | |
175 | static int find_in_imports_on_demand PROTO ((tree)); | |
176 | static int find_in_imports PROTO ((tree)); | |
177 | static int check_pkg_class_access PROTO ((tree, tree)); | |
178 | static tree resolve_package PROTO ((tree, tree *)); | |
179 | static tree lookup_package_type PROTO ((char *, int)); | |
180 | static tree resolve_class PROTO ((tree, tree, tree)); | |
181 | static tree do_resolve_class PROTO ((tree, tree, tree)); | |
182 | static void declare_local_variables PROTO ((int, tree, tree)); | |
183 | static void source_start_java_method PROTO ((tree)); | |
184 | static void source_end_java_method PROTO ((void)); | |
185 | static void expand_start_java_method PROTO ((tree)); | |
186 | static tree find_name_in_single_imports PROTO ((tree)); | |
187 | static void check_abstract_method_header PROTO ((tree)); | |
188 | static tree lookup_java_interface_method2 PROTO ((tree, tree)); | |
189 | static tree resolve_expression_name PROTO ((tree, tree *)); | |
190 | static tree maybe_create_class_interface_decl PROTO ((tree, tree, tree)); | |
191 | static int check_class_interface_creation PROTO ((int, int, tree, | |
192 | tree, tree, tree)); | |
193 | static tree patch_method_invocation PROTO ((tree, tree, tree, | |
ac825856 | 194 | int *, tree *)); |
82371d41 APB |
195 | static int breakdown_qualified PROTO ((tree *, tree *, tree)); |
196 | static tree resolve_and_layout PROTO ((tree, tree)); | |
197 | static tree resolve_no_layout PROTO ((tree, tree)); | |
198 | static int invocation_mode PROTO ((tree, int)); | |
199 | static tree find_applicable_accessible_methods_list PROTO ((int, tree, | |
200 | tree, tree)); | |
201 | static tree find_most_specific_methods_list PROTO ((tree)); | |
202 | static int argument_types_convertible PROTO ((tree, tree)); | |
ac825856 | 203 | static tree patch_invoke PROTO ((tree, tree, tree)); |
82371d41 APB |
204 | static tree lookup_method_invoke PROTO ((int, tree, tree, tree, tree)); |
205 | static tree register_incomplete_type PROTO ((int, tree, tree, tree)); | |
206 | static tree obtain_incomplete_type PROTO ((tree)); | |
5b09b33e | 207 | static tree java_complete_lhs PROTO ((tree)); |
82371d41 APB |
208 | static tree java_complete_tree PROTO ((tree)); |
209 | static void java_complete_expand_method PROTO ((tree)); | |
210 | static int unresolved_type_p PROTO ((tree, tree *)); | |
211 | static void create_jdep_list PROTO ((struct parser_ctxt *)); | |
212 | static tree build_expr_block PROTO ((tree, tree)); | |
213 | static tree enter_block PROTO ((void)); | |
214 | static tree enter_a_block PROTO ((tree)); | |
215 | static tree exit_block PROTO ((void)); | |
216 | static tree lookup_name_in_blocks PROTO ((tree)); | |
217 | static void maybe_absorb_scoping_blocks PROTO ((void)); | |
218 | static tree build_method_invocation PROTO ((tree, tree)); | |
219 | static tree build_new_invocation PROTO ((tree, tree)); | |
220 | static tree build_assignment PROTO ((int, int, tree, tree)); | |
221 | static tree build_binop PROTO ((enum tree_code, int, tree, tree)); | |
222 | static int check_final_assignment PROTO ((tree ,tree)); | |
223 | static tree patch_assignment PROTO ((tree, tree, tree )); | |
224 | static tree patch_binop PROTO ((tree, tree, tree)); | |
225 | static tree build_unaryop PROTO ((int, int, tree)); | |
226 | static tree build_incdec PROTO ((int, int, tree, int)); | |
227 | static tree patch_unaryop PROTO ((tree, tree)); | |
228 | static tree build_cast PROTO ((int, tree, tree)); | |
229 | static tree build_null_of_type PROTO ((tree)); | |
230 | static tree patch_cast PROTO ((tree, tree)); | |
231 | static int valid_ref_assignconv_cast_p PROTO ((tree, tree, int)); | |
232 | static int valid_builtin_assignconv_identity_widening_p PROTO ((tree, tree)); | |
233 | static int valid_cast_to_p PROTO ((tree, tree)); | |
234 | static int valid_method_invocation_conversion_p PROTO ((tree, tree)); | |
235 | static tree try_builtin_assignconv PROTO ((tree, tree, tree)); | |
236 | static tree try_reference_assignconv PROTO ((tree, tree)); | |
237 | static tree build_unresolved_array_type PROTO ((tree)); | |
238 | static tree build_array_from_name PROTO ((tree, tree, tree, tree *)); | |
239 | static tree build_array_ref PROTO ((int, tree, tree)); | |
240 | static tree patch_array_ref PROTO ((tree)); | |
241 | static tree make_qualified_name PROTO ((tree, tree, int)); | |
242 | static tree merge_qualified_name PROTO ((tree, tree)); | |
243 | static tree make_qualified_primary PROTO ((tree, tree, int)); | |
244 | static int resolve_qualified_expression_name PROTO ((tree, tree *, | |
245 | tree *, tree *)); | |
246 | static void qualify_ambiguous_name PROTO ((tree)); | |
247 | static void maybe_generate_clinit PROTO ((void)); | |
248 | static tree resolve_field_access PROTO ((tree, tree *, tree *)); | |
249 | static tree build_newarray_node PROTO ((tree, tree, int)); | |
250 | static tree patch_newarray PROTO ((tree)); | |
251 | static tree resolve_type_during_patch PROTO ((tree)); | |
252 | static tree build_this PROTO ((int)); | |
253 | static tree build_return PROTO ((int, tree)); | |
254 | static tree patch_return PROTO ((tree)); | |
255 | static tree maybe_access_field PROTO ((tree, tree, tree)); | |
256 | static int complete_function_arguments PROTO ((tree)); | |
257 | static int check_for_static_method_reference PROTO ((tree, tree, tree, tree, tree)); | |
258 | static int not_accessible_p PROTO ((tree, tree, int)); | |
259 | static void check_deprecation PROTO ((tree, tree)); | |
260 | static int class_in_current_package PROTO ((tree)); | |
261 | static tree build_if_else_statement PROTO ((int, tree, tree, tree)); | |
262 | static tree patch_if_else_statement PROTO ((tree)); | |
263 | static tree add_stmt_to_compound PROTO ((tree, tree, tree)); | |
264 | static tree add_stmt_to_block PROTO ((tree, tree, tree)); | |
265 | static tree patch_exit_expr PROTO ((tree)); | |
266 | static tree build_labeled_block PROTO ((int, tree)); | |
267 | static tree generate_labeled_block PROTO (()); | |
268 | static tree complete_labeled_statement PROTO ((tree, tree)); | |
269 | static tree build_bc_statement PROTO ((int, int, tree)); | |
270 | static tree patch_bc_statement PROTO ((tree)); | |
271 | static tree patch_loop_statement PROTO ((tree)); | |
272 | static tree build_new_loop PROTO ((tree)); | |
273 | static tree build_loop_body PROTO ((int, tree, int)); | |
274 | static tree complete_loop_body PROTO ((int, tree, tree, int)); | |
275 | static tree build_debugable_stmt PROTO ((int, tree)); | |
276 | static tree complete_for_loop PROTO ((int, tree, tree, tree)); | |
277 | static tree patch_switch_statement PROTO ((tree)); | |
278 | static tree string_constant_concatenation PROTO ((tree, tree)); | |
279 | static tree build_string_concatenation PROTO ((tree, tree)); | |
280 | static tree patch_string_cst PROTO ((tree)); | |
281 | static tree patch_string PROTO ((tree)); | |
282 | static tree build_jump_to_finally PROTO ((tree, tree, tree, tree)); | |
283 | static tree build_try_statement PROTO ((int, tree, tree, tree)); | |
284 | static tree patch_try_statement PROTO ((tree)); | |
285 | static tree patch_synchronized_statement PROTO ((tree, tree)); | |
286 | static tree patch_throw_statement PROTO ((tree, tree)); | |
287 | static void check_thrown_exceptions PROTO ((int, tree)); | |
288 | static int check_thrown_exceptions_do PROTO ((tree)); | |
289 | static void purge_unchecked_exceptions PROTO ((tree)); | |
290 | static void check_throws_clauses PROTO ((tree, tree, tree)); | |
291 | static void complete_method_declaration PROTO ((tree)); | |
292 | static tree build_super_invocation PROTO (()); | |
293 | static int verify_constructor_circularity PROTO ((tree, tree)); | |
294 | static char *constructor_circularity_msg PROTO ((tree, tree)); | |
295 | static tree build_this_super_qualified_invocation PROTO ((int, tree, tree, | |
296 | int, int)); | |
297 | static char *get_printable_method_name PROTO ((tree)); | |
298 | static tree patch_conditional_expr PROTO ((tree, tree, tree)); | |
299 | static void maybe_generate_finit PROTO (()); | |
300 | static void fix_constructors PROTO ((tree)); | |
301 | static int verify_constructor_super PROTO (()); | |
302 | static tree create_artificial_method PROTO ((tree, int, tree, tree, tree)); | |
303 | static void start_artificial_method_body PROTO ((tree)); | |
304 | static void end_artificial_method_body PROTO ((tree)); | |
82371d41 APB |
305 | static int check_method_redefinition PROTO ((tree, tree)); |
306 | static int reset_method_name PROTO ((tree)); | |
307 | static void java_check_regular_methods PROTO ((tree)); | |
308 | static void java_check_abstract_methods PROTO ((tree)); | |
309 | static tree maybe_build_primttype_type_ref PROTO ((tree, tree)); | |
310 | static void unreachable_stmt_error PROTO ((tree)); | |
311 | static tree find_expr_with_wfl PROTO ((tree)); | |
312 | static void missing_return_error PROTO ((tree)); | |
f8976021 APB |
313 | static tree build_new_array_init PROTO ((int, tree)); |
314 | static tree patch_new_array_init PROTO ((tree, tree)); | |
f8976021 APB |
315 | static tree maybe_build_array_element_wfl PROTO ((tree)); |
316 | static int array_constructor_check_entry PROTO ((tree, tree)); | |
4a5f66c3 | 317 | static char *purify_type_name PROTO ((char *)); |
63a212ed | 318 | static tree patch_initialized_static_field PROTO ((tree)); |
5b09b33e | 319 | static tree fold_constant_for_init PROTO ((tree, tree)); |
82371d41 | 320 | |
8b27f225 PB |
321 | /* Number of error found so far. */ |
322 | int java_error_count; | |
323 | /* Number of warning found so far. */ | |
324 | int java_warning_count; | |
325 | ||
326 | /* The current parser context */ | |
327 | static struct parser_ctxt *ctxp; | |
328 | ||
b351b287 APB |
329 | /* List of things that were anlyzed for which code will be generated */ |
330 | static struct parser_ctxt *ctxp_for_generation = NULL; | |
331 | ||
8b27f225 PB |
332 | /* binop_lookup maps token to tree_code. It is used where binary |
333 | operations are involved and required by the parser. RDIV_EXPR | |
334 | covers both integral/floating point division. The code is changed | |
335 | once the type of both operator is worked out. */ | |
336 | ||
337 | static enum tree_code binop_lookup[19] = | |
338 | { | |
339 | PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR, | |
340 | LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR, | |
341 | BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR, | |
342 | TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, | |
343 | EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR, | |
344 | }; | |
345 | #define BINOP_LOOKUP(VALUE) \ | |
346 | binop_lookup [((VALUE) - PLUS_TK)% \ | |
347 | (sizeof (binop_lookup) / sizeof (binop_lookup[0]))] | |
348 | ||
349 | /* Fake WFL used to report error message. It is initialized once if | |
350 | needed and reused with it's location information is overriden. */ | |
12472854 | 351 | tree wfl_operator = NULL_TREE; |
8b27f225 PB |
352 | |
353 | /* The "$L" identifier we use to create labels. */ | |
354 | static tree label_id = NULL_TREE; | |
355 | ||
356 | /* The "StringBuffer" identifier used for the String `+' operator. */ | |
357 | static tree wfl_string_buffer = NULL_TREE; | |
358 | ||
359 | /* The "append" identifier used for String `+' operator. */ | |
360 | static tree wfl_append = NULL_TREE; | |
361 | ||
362 | /* The "toString" identifier used for String `+' operator. */ | |
363 | static tree wfl_to_string = NULL_TREE; | |
364 | ||
5b09b33e | 365 | #line 290 "./parse.y" |
8b27f225 PB |
366 | typedef union { |
367 | tree node; | |
368 | int sub_token; | |
369 | struct { | |
370 | int token; | |
371 | int location; | |
372 | } operator; | |
373 | int value; | |
374 | } YYSTYPE; | |
375 | #ifndef YYDEBUG | |
376 | #define YYDEBUG 1 | |
377 | #endif | |
378 | ||
379 | #include <stdio.h> | |
380 | ||
381 | #ifndef __cplusplus | |
382 | #ifndef __STDC__ | |
383 | #define const | |
384 | #endif | |
385 | #endif | |
386 | ||
387 | ||
388 | ||
1179ebc2 | 389 | #define YYFINAL 774 |
8b27f225 PB |
390 | #define YYFLAG -32768 |
391 | #define YYNTBASE 110 | |
392 | ||
22eed1e6 | 393 | #define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 265) |
8b27f225 PB |
394 | |
395 | static const char yytranslate[] = { 0, | |
396 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
397 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
398 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
399 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
400 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
401 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
402 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
403 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
404 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
405 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
406 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
407 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
408 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
409 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
410 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
411 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
412 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
413 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
414 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
415 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
416 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
417 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
418 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
419 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
420 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
421 | 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, | |
422 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | |
423 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, | |
424 | 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, | |
425 | 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, | |
426 | 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, | |
427 | 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, | |
428 | 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, | |
429 | 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, | |
430 | 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, | |
431 | 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, | |
432 | 106, 107, 108, 109 | |
433 | }; | |
434 | ||
435 | #if YYDEBUG != 0 | |
436 | static const short yyprhs[] = { 0, | |
437 | 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, | |
438 | 20, 22, 24, 26, 28, 30, 32, 34, 38, 42, | |
439 | 46, 50, 54, 56, 58, 60, 64, 66, 67, 69, | |
440 | 71, 73, 76, 79, 82, 86, 88, 91, 93, 96, | |
441 | 100, 103, 107, 109, 111, 115, 118, 122, 128, 133, | |
442 | 139, 141, 143, 145, 147, 149, 152, 153, 161, 162, | |
443 | 169, 173, 176, 180, 185, 186, 189, 193, 196, 197, | |
444 | 200, 203, 205, 209, 213, 216, 220, 222, 225, 227, | |
445 | 229, 231, 233, 235, 237, 239, 241, 245, 250, 252, | |
446 | 256, 260, 262, 266, 270, 275, 277, 281, 284, 288, | |
447 | 292, 294, 296, 297, 301, 304, 308, 312, 317, 322, | |
448 | 325, 329, 332, 336, 339, 343, 348, 352, 356, 360, | |
449 | 362, 366, 370, 373, 377, 380, 384, 385, 388, 391, | |
22eed1e6 APB |
450 | 393, 397, 401, 403, 406, 408, 411, 415, 417, 418, |
451 | 422, 425, 429, 433, 438, 441, 445, 449, 454, 459, | |
452 | 465, 473, 480, 482, 484, 485, 490, 491, 497, 498, | |
453 | 504, 505, 512, 516, 521, 524, 528, 531, 535, 538, | |
454 | 542, 544, 547, 549, 551, 553, 555, 557, 560, 563, | |
1179ebc2 APB |
455 | 566, 570, 575, 577, 581, 585, 588, 592, 594, 596, |
456 | 598, 601, 603, 605, 607, 610, 613, 617, 619, 621, | |
457 | 623, 625, 627, 629, 631, 633, 635, 637, 639, 641, | |
458 | 643, 645, 647, 649, 651, 653, 655, 657, 659, 661, | |
459 | 663, 666, 669, 672, 675, 678, 681, 684, 687, 691, | |
460 | 696, 701, 707, 712, 718, 725, 733, 740, 742, 744, | |
461 | 746, 748, 750, 752, 754, 760, 763, 767, 772, 780, | |
462 | 788, 789, 793, 798, 801, 805, 811, 814, 818, 822, | |
463 | 827, 829, 832, 835, 837, 840, 844, 847, 850, 854, | |
464 | 857, 862, 865, 868, 872, 877, 880, 882, 890, 898, | |
465 | 905, 909, 915, 920, 928, 935, 938, 941, 945, 948, | |
466 | 949, 951, 953, 956, 957, 959, 961, 965, 969, 972, | |
467 | 976, 979, 983, 986, 990, 993, 997, 1000, 1004, 1007, | |
468 | 1011, 1015, 1018, 1022, 1028, 1034, 1037, 1042, 1046, 1048, | |
469 | 1052, 1056, 1061, 1064, 1066, 1069, 1072, 1077, 1080, 1084, | |
470 | 1089, 1092, 1095, 1097, 1099, 1101, 1103, 1107, 1109, 1111, | |
471 | 1113, 1115, 1119, 1123, 1127, 1131, 1135, 1139, 1143, 1147, | |
472 | 1153, 1158, 1165, 1171, 1176, 1182, 1188, 1195, 1199, 1203, | |
473 | 1208, 1214, 1217, 1221, 1225, 1229, 1231, 1235, 1239, 1243, | |
474 | 1247, 1252, 1257, 1262, 1267, 1271, 1275, 1277, 1280, 1284, | |
475 | 1288, 1291, 1294, 1298, 1302, 1306, 1310, 1313, 1317, 1322, | |
476 | 1328, 1335, 1341, 1348, 1353, 1358, 1363, 1368, 1372, 1377, | |
477 | 1381, 1386, 1388, 1390, 1392, 1394, 1397, 1400, 1402, 1404, | |
478 | 1407, 1410, 1412, 1415, 1418, 1421, 1424, 1427, 1430, 1432, | |
479 | 1435, 1438, 1440, 1443, 1446, 1452, 1457, 1462, 1468, 1473, | |
480 | 1476, 1482, 1487, 1493, 1495, 1499, 1503, 1507, 1511, 1515, | |
481 | 1519, 1521, 1525, 1529, 1533, 1537, 1539, 1543, 1547, 1551, | |
482 | 1555, 1559, 1563, 1565, 1569, 1573, 1577, 1581, 1585, 1589, | |
483 | 1593, 1597, 1601, 1605, 1607, 1611, 1615, 1619, 1623, 1625, | |
484 | 1629, 1633, 1635, 1639, 1643, 1645, 1649, 1653, 1655, 1659, | |
485 | 1663, 1665, 1669, 1673, 1675, 1681, 1686, 1690, 1696, 1698, | |
486 | 1700, 1704, 1708, 1710, 1712, 1714, 1716, 1718, 1720 | |
8b27f225 PB |
487 | }; |
488 | ||
489 | static const short yyrhs[] = { 123, | |
490 | 0, 104, 0, 105, 0, 108, 0, 103, 0, 102, | |
491 | 0, 109, 0, 113, 0, 114, 0, 82, 0, 85, | |
492 | 0, 50, 0, 115, 0, 118, 0, 119, 0, 115, | |
493 | 0, 115, 0, 113, 97, 98, 0, 119, 97, 98, | |
494 | 0, 118, 97, 98, 0, 113, 97, 1, 0, 118, | |
495 | 97, 1, 0, 120, 0, 121, 0, 122, 0, 119, | |
496 | 101, 122, 0, 86, 0, 0, 126, 0, 124, 0, | |
497 | 125, 0, 126, 124, 0, 126, 125, 0, 124, 125, | |
498 | 0, 126, 124, 125, 0, 127, 0, 124, 127, 0, | |
499 | 130, 0, 125, 130, 0, 75, 119, 99, 0, 75, | |
500 | 1, 0, 75, 119, 1, 0, 128, 0, 129, 0, | |
501 | 55, 119, 99, 0, 55, 1, 0, 55, 119, 1, | |
502 | 0, 55, 119, 101, 5, 99, 0, 55, 119, 101, | |
503 | 1, 0, 55, 119, 101, 5, 1, 0, 132, 0, | |
22eed1e6 | 504 | 165, 0, 99, 0, 1, 0, 44, 0, 131, 44, |
8b27f225 PB |
505 | 0, 0, 131, 67, 122, 135, 136, 133, 138, 0, |
506 | 0, 67, 122, 135, 136, 134, 138, 0, 131, 67, | |
507 | 1, 0, 67, 1, 0, 67, 122, 1, 0, 131, | |
508 | 67, 122, 1, 0, 0, 63, 116, 0, 63, 116, | |
509 | 1, 0, 63, 1, 0, 0, 52, 137, 0, 52, | |
510 | 1, 0, 117, 0, 137, 100, 117, 0, 137, 100, | |
511 | 1, 0, 95, 96, 0, 95, 139, 96, 0, 140, | |
512 | 0, 139, 140, 0, 141, 0, 156, 0, 158, 0, | |
22eed1e6 | 513 | 178, 0, 142, 0, 147, 0, 132, 0, 165, 0, |
8b27f225 PB |
514 | 112, 143, 99, 0, 131, 112, 143, 99, 0, 144, |
515 | 0, 143, 100, 144, 0, 143, 100, 1, 0, 145, | |
516 | 0, 145, 92, 146, 0, 145, 92, 1, 0, 145, | |
517 | 92, 146, 1, 0, 122, 0, 145, 97, 98, 0, | |
518 | 122, 1, 0, 145, 97, 1, 0, 145, 98, 1, | |
22eed1e6 | 519 | 0, 263, 0, 176, 0, 0, 149, 148, 155, 0, |
8b27f225 PB |
520 | 149, 1, 0, 112, 150, 153, 0, 59, 150, 153, |
521 | 0, 131, 112, 150, 153, 0, 131, 59, 150, 153, | |
522 | 0, 112, 1, 0, 131, 112, 1, 0, 59, 1, | |
523 | 0, 131, 59, 1, 0, 131, 1, 0, 122, 93, | |
524 | 94, 0, 122, 93, 151, 94, 0, 150, 97, 98, | |
525 | 0, 122, 93, 1, 0, 150, 97, 1, 0, 152, | |
526 | 0, 151, 100, 152, 0, 151, 100, 1, 0, 112, | |
527 | 145, 0, 131, 112, 145, 0, 112, 1, 0, 131, | |
528 | 112, 1, 0, 0, 53, 154, 0, 53, 1, 0, | |
529 | 116, 0, 154, 100, 116, 0, 154, 100, 1, 0, | |
22eed1e6 APB |
530 | 178, 0, 178, 99, 0, 99, 0, 157, 178, 0, |
531 | 157, 178, 99, 0, 44, 0, 0, 160, 159, 162, | |
532 | 0, 161, 153, 0, 131, 161, 153, 0, 120, 93, | |
533 | 94, 0, 120, 93, 151, 94, 0, 179, 180, 0, | |
534 | 179, 163, 180, 0, 179, 181, 180, 0, 179, 163, | |
535 | 181, 180, 0, 164, 93, 94, 99, 0, 164, 93, | |
536 | 232, 94, 99, 0, 119, 101, 65, 93, 232, 94, | |
537 | 99, 0, 119, 101, 65, 93, 94, 99, 0, 76, | |
538 | 0, 65, 0, 0, 61, 122, 166, 171, 0, 0, | |
539 | 131, 61, 122, 167, 171, 0, 0, 61, 122, 170, | |
540 | 168, 171, 0, 0, 131, 61, 122, 170, 169, 171, | |
541 | 0, 61, 122, 1, 0, 131, 61, 122, 1, 0, | |
542 | 63, 117, 0, 170, 100, 117, 0, 63, 1, 0, | |
543 | 170, 100, 1, 0, 95, 96, 0, 95, 172, 96, | |
544 | 0, 173, 0, 172, 173, 0, 174, 0, 175, 0, | |
545 | 132, 0, 165, 0, 142, 0, 149, 99, 0, 149, | |
546 | 1, 0, 95, 96, 0, 95, 177, 96, 0, 95, | |
1179ebc2 APB |
547 | 177, 100, 96, 0, 146, 0, 177, 100, 146, 0, |
548 | 177, 100, 1, 0, 95, 96, 0, 179, 181, 180, | |
549 | 0, 95, 0, 96, 0, 182, 0, 181, 182, 0, | |
550 | 183, 0, 185, 0, 132, 0, 184, 99, 0, 112, | |
551 | 143, 0, 131, 112, 143, 0, 187, 0, 190, 0, | |
552 | 194, 0, 195, 0, 206, 0, 210, 0, 187, 0, | |
553 | 191, 0, 196, 0, 207, 0, 211, 0, 178, 0, | |
554 | 188, 0, 192, 0, 197, 0, 209, 0, 217, 0, | |
555 | 218, 0, 219, 0, 221, 0, 220, 0, 223, 0, | |
556 | 99, 0, 122, 88, 0, 189, 185, 0, 122, 1, | |
557 | 0, 189, 186, 0, 193, 99, 0, 1, 99, 0, | |
558 | 1, 95, 0, 1, 96, 0, 164, 93, 1, 0, | |
559 | 164, 93, 94, 1, 0, 164, 93, 232, 1, 0, | |
560 | 164, 93, 232, 94, 1, 0, 119, 101, 65, 1, | |
561 | 0, 119, 101, 65, 93, 1, 0, 119, 101, 65, | |
562 | 93, 232, 1, 0, 119, 101, 65, 93, 232, 94, | |
563 | 1, 0, 119, 101, 65, 93, 94, 1, 0, 260, | |
564 | 0, 244, 0, 245, 0, 241, 0, 242, 0, 238, | |
565 | 0, 230, 0, 48, 93, 263, 94, 185, 0, 48, | |
566 | 1, 0, 48, 93, 1, 0, 48, 93, 263, 1, | |
567 | 0, 48, 93, 263, 94, 186, 56, 185, 0, 48, | |
568 | 93, 263, 94, 186, 56, 186, 0, 0, 199, 198, | |
569 | 200, 0, 68, 93, 263, 94, 0, 68, 1, 0, | |
570 | 68, 93, 1, 0, 68, 93, 263, 94, 1, 0, | |
571 | 95, 96, 0, 95, 203, 96, 0, 95, 201, 96, | |
572 | 0, 95, 201, 203, 96, 0, 202, 0, 201, 202, | |
573 | 0, 203, 181, 0, 204, 0, 203, 204, 0, 62, | |
574 | 264, 88, 0, 47, 88, 0, 62, 1, 0, 62, | |
575 | 264, 1, 0, 47, 1, 0, 66, 93, 263, 94, | |
576 | 0, 205, 185, 0, 66, 1, 0, 66, 93, 1, | |
577 | 0, 66, 93, 263, 1, 0, 205, 186, 0, 51, | |
578 | 0, 208, 185, 66, 93, 263, 94, 99, 0, 213, | |
579 | 99, 263, 99, 215, 94, 185, 0, 213, 99, 99, | |
580 | 215, 94, 185, 0, 213, 99, 1, 0, 213, 99, | |
581 | 263, 99, 1, 0, 213, 99, 99, 1, 0, 213, | |
582 | 99, 263, 99, 215, 94, 186, 0, 213, 99, 99, | |
583 | 215, 94, 186, 0, 71, 93, 0, 71, 1, 0, | |
584 | 71, 93, 1, 0, 212, 214, 0, 0, 216, 0, | |
585 | 184, 0, 216, 1, 0, 0, 216, 0, 193, 0, | |
586 | 216, 100, 193, 0, 216, 100, 1, 0, 54, 99, | |
587 | 0, 54, 122, 99, 0, 54, 1, 0, 54, 122, | |
588 | 1, 0, 73, 99, 0, 73, 122, 99, 0, 73, | |
589 | 1, 0, 73, 122, 1, 0, 58, 99, 0, 58, | |
590 | 263, 99, 0, 58, 1, 0, 58, 263, 1, 0, | |
591 | 49, 263, 99, 0, 49, 1, 0, 49, 263, 1, | |
592 | 0, 222, 93, 263, 94, 178, 0, 222, 93, 263, | |
593 | 94, 1, 0, 222, 1, 0, 222, 93, 1, 94, | |
594 | 0, 222, 93, 1, 0, 44, 0, 70, 178, 224, | |
595 | 0, 70, 178, 227, 0, 70, 178, 224, 227, 0, | |
596 | 70, 1, 0, 225, 0, 224, 225, 0, 226, 178, | |
597 | 0, 60, 93, 152, 94, 0, 60, 1, 0, 60, | |
598 | 93, 1, 0, 60, 93, 1, 94, 0, 64, 178, | |
599 | 0, 64, 1, 0, 229, 0, 233, 0, 111, 0, | |
600 | 76, 0, 93, 263, 94, 0, 230, 0, 237, 0, | |
601 | 238, 0, 239, 0, 119, 101, 67, 0, 113, 101, | |
602 | 67, 0, 59, 101, 67, 0, 119, 101, 76, 0, | |
603 | 93, 263, 1, 0, 119, 101, 1, 0, 113, 101, | |
604 | 1, 0, 59, 101, 1, 0, 72, 116, 93, 232, | |
605 | 94, 0, 72, 116, 93, 94, 0, 72, 116, 93, | |
606 | 232, 94, 138, 0, 72, 116, 93, 94, 138, 0, | |
607 | 231, 122, 93, 94, 0, 231, 122, 93, 94, 138, | |
608 | 0, 231, 122, 93, 232, 94, 0, 231, 122, 93, | |
609 | 232, 94, 138, 0, 72, 1, 99, 0, 72, 116, | |
610 | 1, 0, 72, 116, 93, 1, 0, 72, 116, 93, | |
611 | 232, 1, 0, 231, 1, 0, 231, 122, 1, 0, | |
612 | 119, 101, 72, 0, 228, 101, 72, 0, 263, 0, | |
613 | 232, 100, 263, 0, 232, 100, 1, 0, 72, 113, | |
614 | 234, 0, 72, 115, 234, 0, 72, 113, 234, 236, | |
615 | 0, 72, 115, 234, 236, 0, 72, 115, 236, 176, | |
616 | 0, 72, 113, 236, 176, 0, 72, 1, 98, 0, | |
617 | 72, 1, 97, 0, 235, 0, 234, 235, 0, 97, | |
618 | 263, 98, 0, 97, 263, 1, 0, 97, 1, 0, | |
619 | 97, 98, 0, 236, 97, 98, 0, 236, 97, 1, | |
620 | 0, 228, 101, 122, 0, 65, 101, 122, 0, 65, | |
621 | 1, 0, 119, 93, 94, 0, 119, 93, 232, 94, | |
622 | 0, 228, 101, 122, 93, 94, 0, 228, 101, 122, | |
623 | 93, 232, 94, 0, 65, 101, 122, 93, 94, 0, | |
624 | 65, 101, 122, 93, 232, 94, 0, 65, 101, 1, | |
625 | 94, 0, 65, 101, 1, 101, 0, 119, 97, 263, | |
626 | 98, 0, 229, 97, 263, 98, 0, 119, 97, 1, | |
627 | 0, 119, 97, 263, 1, 0, 229, 97, 1, 0, | |
628 | 229, 97, 263, 1, 0, 228, 0, 119, 0, 241, | |
629 | 0, 242, 0, 240, 46, 0, 240, 45, 0, 244, | |
630 | 0, 245, 0, 3, 243, 0, 4, 243, 0, 246, | |
631 | 0, 3, 1, 0, 4, 1, 0, 46, 243, 0, | |
632 | 46, 1, 0, 45, 243, 0, 45, 1, 0, 240, | |
633 | 0, 89, 243, 0, 90, 243, 0, 247, 0, 89, | |
634 | 1, 0, 90, 1, 0, 93, 113, 236, 94, 243, | |
635 | 0, 93, 113, 94, 243, 0, 93, 263, 94, 246, | |
636 | 0, 93, 119, 236, 94, 246, 0, 93, 113, 97, | |
637 | 1, 0, 93, 1, 0, 93, 113, 236, 94, 1, | |
638 | 0, 93, 113, 94, 1, 0, 93, 119, 236, 94, | |
639 | 1, 0, 243, 0, 248, 5, 243, 0, 248, 6, | |
640 | 243, 0, 248, 7, 243, 0, 248, 5, 1, 0, | |
641 | 248, 6, 1, 0, 248, 7, 1, 0, 248, 0, | |
642 | 249, 3, 248, 0, 249, 4, 248, 0, 249, 3, | |
643 | 1, 0, 249, 4, 1, 0, 249, 0, 250, 8, | |
644 | 249, 0, 250, 9, 249, 0, 250, 10, 249, 0, | |
645 | 250, 8, 1, 0, 250, 9, 1, 0, 250, 10, | |
646 | 1, 0, 250, 0, 251, 20, 250, 0, 251, 18, | |
647 | 250, 0, 251, 21, 250, 0, 251, 19, 250, 0, | |
648 | 251, 57, 114, 0, 251, 20, 1, 0, 251, 18, | |
649 | 1, 0, 251, 21, 1, 0, 251, 19, 1, 0, | |
650 | 251, 57, 1, 0, 251, 0, 252, 16, 251, 0, | |
651 | 252, 17, 251, 0, 252, 16, 1, 0, 252, 17, | |
652 | 1, 0, 252, 0, 253, 11, 252, 0, 253, 11, | |
653 | 1, 0, 253, 0, 254, 12, 253, 0, 254, 12, | |
654 | 1, 0, 254, 0, 255, 13, 254, 0, 255, 13, | |
655 | 1, 0, 255, 0, 256, 14, 255, 0, 256, 14, | |
656 | 1, 0, 256, 0, 257, 15, 256, 0, 257, 15, | |
657 | 1, 0, 257, 0, 257, 87, 263, 88, 258, 0, | |
658 | 257, 87, 88, 1, 0, 257, 87, 1, 0, 257, | |
659 | 87, 263, 88, 1, 0, 258, 0, 260, 0, 261, | |
660 | 262, 259, 0, 261, 262, 1, 0, 119, 0, 237, | |
661 | 0, 239, 0, 91, 0, 92, 0, 259, 0, 263, | |
662 | 0 | |
8b27f225 PB |
663 | }; |
664 | ||
665 | #endif | |
666 | ||
667 | #if YYDEBUG != 0 | |
668 | static const short yyrline[] = { 0, | |
5b09b33e PB |
669 | 440, 446, 448, 449, 450, 451, 452, 456, 458, 461, |
670 | 463, 464, 467, 469, 472, 476, 480, 484, 490, 492, | |
671 | 494, 496, 501, 503, 506, 510, 515, 520, 522, 523, | |
672 | 524, 525, 526, 527, 528, 531, 536, 542, 544, 547, | |
673 | 550, 552, 556, 558, 561, 588, 590, 594, 603, 605, | |
674 | 609, 616, 617, 619, 629, 634, 649, 653, 656, 659, | |
675 | 662, 664, 666, 668, 672, 674, 676, 678, 682, 684, | |
676 | 686, 693, 699, 704, 708, 711, 715, 717, 720, 722, | |
677 | 723, 724, 728, 730, 731, 733, 738, 741, 751, 754, | |
678 | 756, 760, 763, 770, 776, 784, 786, 788, 790, 792, | |
679 | 796, 798, 802, 809, 810, 814, 817, 819, 821, 823, | |
680 | 825, 827, 829, 831, 838, 841, 843, 852, 854, 858, | |
681 | 863, 868, 872, 877, 879, 881, 888, 890, 892, 896, | |
682 | 899, 901, 905, 907, 908, 913, 918, 924, 932, 939, | |
683 | 942, 945, 949, 952, 956, 965, 967, 969, 974, 981, | |
684 | 989, 991, 995, 1003, 1014, 1018, 1021, 1024, 1027, 1030, | |
685 | 1033, 1036, 1039, 1041, 1045, 1051, 1056, 1058, 1062, 1065, | |
686 | 1069, 1071, 1074, 1076, 1077, 1079, 1083, 1087, 1093, 1098, | |
687 | 1101, 1103, 1107, 1113, 1117, 1122, 1125, 1129, 1134, 1142, | |
688 | 1144, 1147, 1149, 1151, 1155, 1159, 1162, 1166, 1168, 1169, | |
689 | 1170, 1171, 1172, 1182, 1184, 1185, 1186, 1187, 1190, 1192, | |
690 | 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1204, | |
691 | 1209, 1220, 1227, 1231, 1242, 1252, 1258, 1264, 1270, 1272, | |
692 | 1278, 1280, 1286, 1288, 1290, 1292, 1294, 1298, 1300, 1301, | |
693 | 1302, 1303, 1304, 1305, 1308, 1311, 1313, 1315, 1319, 1324, | |
694 | 1329, 1335, 1345, 1351, 1353, 1355, 1362, 1365, 1367, 1369, | |
695 | 1373, 1375, 1378, 1382, 1384, 1387, 1394, 1400, 1402, 1404, | |
696 | 1408, 1416, 1419, 1421, 1423, 1427, 1432, 1441, 1446, 1449, | |
697 | 1456, 1458, 1460, 1464, 1467, 1476, 1483, 1485, 1489, 1502, | |
698 | 1504, 1510, 1516, 1520, 1522, 1526, 1529, 1531, 1535, 1538, | |
699 | 1540, 1542, 1546, 1549, 1551, 1553, 1557, 1560, 1562, 1564, | |
700 | 1568, 1574, 1576, 1580, 1587, 1589, 1591, 1593, 1597, 1605, | |
701 | 1608, 1610, 1612, 1616, 1618, 1625, 1633, 1650, 1652, 1654, | |
702 | 1658, 1664, 1669, 1671, 1674, 1676, 1678, 1680, 1681, 1682, | |
703 | 1683, 1687, 1689, 1691, 1696, 1698, 1700, 1702, 1704, 1708, | |
704 | 1711, 1716, 1718, 1723, 1724, 1725, 1726, 1727, 1729, 1731, | |
705 | 1733, 1735, 1737, 1741, 1743, 1746, 1752, 1757, 1761, 1764, | |
706 | 1766, 1768, 1772, 1774, 1776, 1778, 1782, 1785, 1789, 1795, | |
707 | 1797, 1805, 1808, 1810, 1814, 1819, 1827, 1831, 1834, 1836, | |
708 | 1847, 1858, 1863, 1872, 1874, 1878, 1881, 1883, 1888, 1893, | |
709 | 1898, 1905, 1907, 1908, 1909, 1912, 1917, 1922, 1924, 1925, | |
710 | 1927, 1929, 1930, 1932, 1936, 1939, 1943, 1946, 1950, 1952, | |
711 | 1954, 1956, 1957, 1959, 1963, 1971, 1973, 1975, 1987, 1989, | |
712 | 1995, 1997, 1999, 2003, 2005, 2010, 2015, 2020, 2022, 2024, | |
713 | 2028, 2030, 2035, 2040, 2042, 2046, 2048, 2053, 2058, 2063, | |
714 | 2065, 2067, 2071, 2073, 2078, 2083, 2088, 2093, 2095, 2097, | |
715 | 2099, 2101, 2103, 2107, 2109, 2114, 2119, 2121, 2125, 2127, | |
716 | 2132, 2136, 2138, 2143, 2147, 2149, 2154, 2158, 2160, 2165, | |
717 | 2169, 2171, 2176, 2180, 2182, 2187, 2193, 2195, 2199, 2201, | |
718 | 2204, 2207, 2215, 2217, 2218, 2221, 2223, 2226, 2230 | |
8b27f225 PB |
719 | }; |
720 | #endif | |
721 | ||
722 | ||
723 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) | |
724 | ||
725 | static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK", | |
726 | "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK", | |
727 | "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK", | |
728 | "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK", | |
729 | "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK", | |
730 | "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK", | |
731 | "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK", | |
732 | "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK", | |
733 | "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK", | |
734 | "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK", | |
735 | "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK", | |
736 | "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK", | |
737 | "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK", | |
738 | "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK", | |
739 | "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK", | |
740 | "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK", | |
741 | "goal","literal","type","primitive_type","reference_type","class_or_interface_type", | |
742 | "class_type","interface_type","array_type","name","simple_name","qualified_name", | |
743 | "identifier","compilation_unit","import_declarations","type_declarations","package_declaration", | |
744 | "import_declaration","single_type_import_declaration","type_import_on_demand_declaration", | |
745 | "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces", | |
746 | "interface_type_list","class_body","class_body_declarations","class_body_declaration", | |
747 | "class_member_declaration","field_declaration","variable_declarators","variable_declarator", | |
748 | "variable_declarator_id","variable_initializer","method_declaration","@3","method_header", | |
749 | "method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list", | |
22eed1e6 APB |
750 | "method_body","static_initializer","static","constructor_declaration","@4","constructor_header", |
751 | "constructor_declarator","constructor_body","explicit_constructor_invocation", | |
752 | "this_or_super","interface_declaration","@5","@6","@7","@8","extends_interfaces", | |
753 | "interface_body","interface_member_declarations","interface_member_declaration", | |
754 | "constant_declaration","abstract_method_declaration","array_initializer","variable_initializers", | |
755 | "block","block_begin","block_end","block_statements","block_statement","local_variable_declaration_statement", | |
756 | "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement", | |
757 | "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement", | |
8b27f225 | 758 | "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi", |
12472854 PB |
759 | "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups", |
760 | "switch_block_statement_group","switch_labels","switch_label","while_expression", | |
761 | "while_statement","while_statement_nsi","do_statement_begin","do_statement", | |
762 | "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update", | |
763 | "statement_expression_list","break_statement","continue_statement","return_statement", | |
764 | "throw_statement","synchronized_statement","synchronized","try_statement","catches", | |
765 | "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array", | |
766 | "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression", | |
767 | "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access", | |
768 | "postfix_expression","post_increment_expression","post_decrement_expression", | |
769 | "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus", | |
770 | "cast_expression","multiplicative_expression","additive_expression","shift_expression", | |
771 | "relational_expression","equality_expression","and_expression","exclusive_or_expression", | |
772 | "inclusive_or_expression","conditional_and_expression","conditional_or_expression", | |
773 | "conditional_expression","assignment_expression","assignment","left_hand_side", | |
774 | "assignment_operator","expression","constant_expression", NULL | |
8b27f225 PB |
775 | }; |
776 | #endif | |
777 | ||
778 | static const short yyr1[] = { 0, | |
779 | 110, 111, 111, 111, 111, 111, 111, 112, 112, 113, | |
780 | 113, 113, 114, 114, 115, 116, 117, 118, 118, 118, | |
781 | 118, 118, 119, 119, 120, 121, 122, 123, 123, 123, | |
782 | 123, 123, 123, 123, 123, 124, 124, 125, 125, 126, | |
783 | 126, 126, 127, 127, 128, 128, 128, 129, 129, 129, | |
784 | 130, 130, 130, 130, 131, 131, 133, 132, 134, 132, | |
785 | 132, 132, 132, 132, 135, 135, 135, 135, 136, 136, | |
786 | 136, 137, 137, 137, 138, 138, 139, 139, 140, 140, | |
787 | 140, 140, 141, 141, 141, 141, 142, 142, 143, 143, | |
788 | 143, 144, 144, 144, 144, 145, 145, 145, 145, 145, | |
789 | 146, 146, 148, 147, 147, 149, 149, 149, 149, 149, | |
790 | 149, 149, 149, 149, 150, 150, 150, 150, 150, 151, | |
791 | 151, 151, 152, 152, 152, 152, 153, 153, 153, 154, | |
22eed1e6 APB |
792 | 154, 154, 155, 155, 155, 156, 156, 157, 159, 158, |
793 | 160, 160, 161, 161, 162, 162, 162, 162, 163, 163, | |
794 | 163, 163, 164, 164, 166, 165, 167, 165, 168, 165, | |
795 | 169, 165, 165, 165, 170, 170, 170, 170, 171, 171, | |
796 | 172, 172, 173, 173, 173, 173, 174, 175, 175, 176, | |
1179ebc2 APB |
797 | 176, 176, 177, 177, 177, 178, 178, 179, 180, 181, |
798 | 181, 182, 182, 182, 183, 184, 184, 185, 185, 185, | |
799 | 185, 185, 185, 186, 186, 186, 186, 186, 187, 187, | |
800 | 187, 187, 187, 187, 187, 187, 187, 187, 187, 188, | |
801 | 189, 190, 190, 191, 192, 192, 192, 192, 192, 192, | |
802 | 192, 192, 192, 192, 192, 192, 192, 193, 193, 193, | |
803 | 193, 193, 193, 193, 194, 194, 194, 194, 195, 196, | |
804 | 198, 197, 199, 199, 199, 199, 200, 200, 200, 200, | |
805 | 201, 201, 202, 203, 203, 204, 204, 204, 204, 204, | |
806 | 205, 206, 206, 206, 206, 207, 208, 209, 210, 210, | |
807 | 210, 210, 210, 211, 211, 212, 212, 212, 213, 214, | |
808 | 214, 214, 214, 215, 215, 216, 216, 216, 217, 217, | |
809 | 217, 217, 218, 218, 218, 218, 219, 219, 219, 219, | |
810 | 220, 220, 220, 221, 221, 221, 221, 221, 222, 223, | |
811 | 223, 223, 223, 224, 224, 225, 226, 226, 226, 226, | |
812 | 227, 227, 228, 228, 229, 229, 229, 229, 229, 229, | |
813 | 229, 229, 229, 229, 229, 229, 229, 229, 229, 230, | |
22eed1e6 | 814 | 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, |
1179ebc2 APB |
815 | 230, 230, 230, 231, 231, 232, 232, 232, 233, 233, |
816 | 233, 233, 233, 233, 233, 233, 234, 234, 235, 235, | |
817 | 235, 236, 236, 236, 237, 237, 237, 238, 238, 238, | |
818 | 238, 238, 238, 238, 238, 239, 239, 239, 239, 239, | |
819 | 239, 240, 240, 240, 240, 241, 242, 243, 243, 243, | |
820 | 243, 243, 243, 243, 244, 244, 245, 245, 246, 246, | |
821 | 246, 246, 246, 246, 247, 247, 247, 247, 247, 247, | |
822 | 247, 247, 247, 248, 248, 248, 248, 248, 248, 248, | |
823 | 249, 249, 249, 249, 249, 250, 250, 250, 250, 250, | |
824 | 250, 250, 251, 251, 251, 251, 251, 251, 251, 251, | |
825 | 251, 251, 251, 252, 252, 252, 252, 252, 253, 253, | |
826 | 253, 254, 254, 254, 255, 255, 255, 256, 256, 256, | |
827 | 257, 257, 257, 258, 258, 258, 258, 258, 259, 259, | |
828 | 260, 260, 261, 261, 261, 262, 262, 263, 264 | |
8b27f225 PB |
829 | }; |
830 | ||
831 | static const short yyr2[] = { 0, | |
832 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
833 | 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, | |
834 | 3, 3, 1, 1, 1, 3, 1, 0, 1, 1, | |
835 | 1, 2, 2, 2, 3, 1, 2, 1, 2, 3, | |
836 | 2, 3, 1, 1, 3, 2, 3, 5, 4, 5, | |
837 | 1, 1, 1, 1, 1, 2, 0, 7, 0, 6, | |
838 | 3, 2, 3, 4, 0, 2, 3, 2, 0, 2, | |
839 | 2, 1, 3, 3, 2, 3, 1, 2, 1, 1, | |
840 | 1, 1, 1, 1, 1, 1, 3, 4, 1, 3, | |
841 | 3, 1, 3, 3, 4, 1, 3, 2, 3, 3, | |
842 | 1, 1, 0, 3, 2, 3, 3, 4, 4, 2, | |
843 | 3, 2, 3, 2, 3, 4, 3, 3, 3, 1, | |
844 | 3, 3, 2, 3, 2, 3, 0, 2, 2, 1, | |
22eed1e6 APB |
845 | 3, 3, 1, 2, 1, 2, 3, 1, 0, 3, |
846 | 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, | |
8b27f225 PB |
847 | 7, 6, 1, 1, 0, 4, 0, 5, 0, 5, |
848 | 0, 6, 3, 4, 2, 3, 2, 3, 2, 3, | |
849 | 1, 2, 1, 1, 1, 1, 1, 2, 2, 2, | |
1179ebc2 APB |
850 | 3, 4, 1, 3, 3, 2, 3, 1, 1, 1, |
851 | 2, 1, 1, 1, 2, 2, 3, 1, 1, 1, | |
8b27f225 PB |
852 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
853 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
1179ebc2 APB |
854 | 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, |
855 | 4, 5, 4, 5, 6, 7, 6, 1, 1, 1, | |
856 | 1, 1, 1, 1, 5, 2, 3, 4, 7, 7, | |
857 | 0, 3, 4, 2, 3, 5, 2, 3, 3, 4, | |
858 | 1, 2, 2, 1, 2, 3, 2, 2, 3, 2, | |
859 | 4, 2, 2, 3, 4, 2, 1, 7, 7, 6, | |
860 | 3, 5, 4, 7, 6, 2, 2, 3, 2, 0, | |
861 | 1, 1, 2, 0, 1, 1, 3, 3, 2, 3, | |
862 | 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, | |
863 | 3, 2, 3, 5, 5, 2, 4, 3, 1, 3, | |
864 | 3, 4, 2, 1, 2, 2, 4, 2, 3, 4, | |
865 | 2, 2, 1, 1, 1, 1, 3, 1, 1, 1, | |
866 | 1, 3, 3, 3, 3, 3, 3, 3, 3, 5, | |
867 | 4, 6, 5, 4, 5, 5, 6, 3, 3, 4, | |
868 | 5, 2, 3, 3, 3, 1, 3, 3, 3, 3, | |
869 | 4, 4, 4, 4, 3, 3, 1, 2, 3, 3, | |
870 | 2, 2, 3, 3, 3, 3, 2, 3, 4, 5, | |
871 | 6, 5, 6, 4, 4, 4, 4, 3, 4, 3, | |
872 | 4, 1, 1, 1, 1, 2, 2, 1, 1, 2, | |
873 | 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, | |
874 | 2, 1, 2, 2, 5, 4, 4, 5, 4, 2, | |
875 | 5, 4, 5, 1, 3, 3, 3, 3, 3, 3, | |
876 | 1, 3, 3, 3, 3, 1, 3, 3, 3, 3, | |
877 | 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, | |
878 | 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, | |
879 | 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, | |
880 | 1, 3, 3, 1, 5, 4, 3, 5, 1, 1, | |
881 | 3, 3, 1, 1, 1, 1, 1, 1, 1 | |
8b27f225 PB |
882 | }; |
883 | ||
884 | static const short yydefact[] = { 0, | |
885 | 54, 55, 0, 0, 0, 0, 53, 1, 0, 0, | |
886 | 0, 36, 43, 44, 38, 0, 51, 52, 46, 27, | |
887 | 0, 23, 24, 25, 0, 62, 0, 41, 0, 0, | |
888 | 37, 39, 0, 0, 56, 0, 0, 47, 45, 0, | |
889 | 163, 0, 0, 159, 63, 0, 69, 42, 40, 0, | |
890 | 0, 0, 61, 0, 49, 0, 26, 167, 17, 165, | |
891 | 15, 0, 156, 0, 0, 68, 16, 0, 0, 59, | |
892 | 164, 0, 161, 64, 69, 50, 48, 12, 0, 10, | |
893 | 11, 169, 0, 8, 9, 13, 14, 15, 0, 175, | |
894 | 177, 0, 176, 0, 171, 173, 174, 168, 166, 160, | |
895 | 67, 71, 72, 70, 0, 158, 0, 57, 112, 0, | |
896 | 127, 110, 0, 0, 89, 92, 127, 0, 0, 0, | |
897 | 114, 0, 0, 179, 178, 170, 172, 0, 0, 60, | |
898 | 162, 0, 0, 0, 0, 107, 98, 87, 0, 0, | |
899 | 0, 0, 106, 21, 18, 22, 20, 19, 113, 127, | |
1179ebc2 | 900 | 111, 0, 127, 74, 73, 55, 188, 75, 23, 0, |
8b27f225 | 901 | 85, 0, 77, 79, 83, 84, 0, 80, 0, 81, |
22eed1e6 APB |
902 | 139, 127, 86, 82, 0, 58, 118, 115, 0, 0, |
903 | 0, 120, 129, 130, 128, 119, 117, 91, 0, 90, | |
1179ebc2 APB |
904 | 94, 0, 0, 0, 0, 0, 0, 0, 336, 0, |
905 | 0, 0, 0, 6, 5, 2, 3, 4, 7, 335, | |
906 | 0, 403, 0, 102, 402, 333, 338, 0, 334, 339, | |
907 | 340, 341, 419, 404, 405, 434, 408, 409, 412, 422, | |
908 | 441, 446, 453, 464, 469, 472, 475, 478, 481, 484, | |
909 | 489, 498, 490, 0, 101, 99, 97, 100, 109, 88, | |
910 | 108, 186, 0, 127, 76, 78, 105, 0, 136, 0, | |
911 | 141, 0, 55, 0, 0, 277, 0, 0, 0, 0, | |
912 | 0, 0, 0, 0, 336, 0, 220, 0, 8, 403, | |
913 | 0, 0, 194, 0, 209, 0, 190, 192, 0, 193, | |
914 | 198, 210, 0, 199, 211, 0, 200, 201, 212, 251, | |
915 | 0, 202, 0, 213, 203, 290, 0, 214, 215, 216, | |
916 | 218, 217, 0, 219, 244, 243, 0, 241, 242, 239, | |
917 | 240, 238, 125, 123, 0, 116, 0, 0, 413, 403, | |
918 | 339, 341, 410, 414, 411, 418, 417, 416, 415, 0, | |
919 | 387, 0, 0, 0, 16, 0, 423, 420, 424, 421, | |
920 | 430, 0, 403, 0, 180, 183, 0, 0, 0, 0, | |
921 | 0, 95, 0, 0, 362, 0, 407, 406, 0, 0, | |
8b27f225 | 922 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
1179ebc2 APB |
923 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 496, |
924 | 497, 0, 143, 0, 142, 135, 104, 133, 137, 188, | |
925 | 140, 0, 227, 228, 226, 246, 0, 312, 0, 301, | |
926 | 299, 0, 309, 307, 0, 273, 0, 254, 0, 323, | |
927 | 0, 287, 0, 305, 303, 0, 0, 196, 0, 0, | |
928 | 223, 221, 0, 0, 189, 187, 191, 195, 319, 403, | |
929 | 222, 225, 0, 272, 0, 403, 0, 292, 296, 289, | |
930 | 0, 0, 316, 0, 126, 124, 122, 121, 132, 131, | |
931 | 349, 344, 0, 386, 376, 375, 358, 0, 369, 377, | |
932 | 0, 370, 0, 359, 0, 0, 0, 0, 0, 0, | |
933 | 346, 337, 181, 0, 348, 343, 388, 0, 366, 398, | |
934 | 0, 347, 342, 364, 345, 365, 385, 400, 0, 363, | |
935 | 0, 438, 435, 439, 436, 440, 437, 444, 442, 445, | |
936 | 443, 450, 447, 451, 448, 452, 449, 460, 455, 462, | |
937 | 457, 459, 454, 461, 456, 463, 0, 458, 467, 465, | |
938 | 468, 466, 471, 470, 474, 473, 477, 476, 480, 479, | |
939 | 483, 482, 487, 0, 0, 492, 491, 144, 134, 403, | |
940 | 0, 0, 145, 0, 247, 0, 313, 311, 302, 300, | |
941 | 310, 308, 274, 0, 255, 0, 0, 0, 320, 324, | |
942 | 0, 321, 288, 306, 304, 337, 0, 197, 229, 0, | |
943 | 0, 0, 252, 0, 293, 0, 281, 0, 0, 318, | |
944 | 0, 394, 395, 0, 381, 382, 0, 378, 371, 0, | |
945 | 374, 372, 373, 360, 351, 0, 432, 426, 429, 0, | |
946 | 0, 427, 185, 182, 184, 389, 0, 399, 396, 0, | |
947 | 401, 397, 354, 0, 486, 0, 0, 146, 0, 0, | |
948 | 147, 248, 0, 275, 271, 0, 328, 0, 332, 331, | |
949 | 325, 322, 326, 233, 0, 230, 231, 0, 0, 0, | |
950 | 257, 0, 261, 0, 264, 0, 298, 297, 283, 0, | |
951 | 295, 0, 317, 0, 392, 0, 380, 379, 384, 383, | |
952 | 353, 361, 350, 431, 425, 433, 428, 368, 367, 390, | |
953 | 0, 355, 356, 488, 485, 0, 148, 0, 0, 0, | |
954 | 245, 0, 198, 0, 205, 206, 0, 207, 208, 0, | |
955 | 256, 329, 0, 234, 0, 0, 232, 270, 267, 268, | |
956 | 499, 0, 259, 262, 0, 258, 0, 265, 0, 0, | |
957 | 282, 0, 315, 314, 393, 352, 391, 357, 0, 149, | |
958 | 0, 0, 0, 224, 276, 0, 330, 327, 237, 235, | |
959 | 0, 269, 266, 260, 0, 280, 0, 0, 0, 150, | |
960 | 0, 249, 0, 0, 236, 278, 279, 152, 0, 0, | |
961 | 0, 0, 151, 0, 0, 0, 0, 285, 0, 250, | |
962 | 284, 0, 0, 0 | |
8b27f225 PB |
963 | }; |
964 | ||
1179ebc2 | 965 | static const short yydefgoto[] = { 772, |
22eed1e6 | 966 | 210, 278, 211, 85, 86, 68, 60, 87, 212, 22, |
8b27f225 | 967 | 23, 24, 8, 9, 10, 11, 12, 13, 14, 15, |
12472854 | 968 | 282, 283, 132, 105, 47, 70, 104, 130, 162, 163, |
22eed1e6 | 969 | 164, 91, 114, 115, 116, 213, 166, 258, 92, 111, |
1179ebc2 APB |
970 | 181, 182, 136, 185, 397, 168, 169, 170, 260, 171, |
971 | 172, 401, 551, 284, 18, 43, 72, 65, 107, 44, | |
972 | 63, 94, 95, 96, 97, 214, 357, 285, 175, 436, | |
973 | 717, 287, 288, 289, 290, 692, 291, 292, 293, 294, | |
974 | 695, 295, 296, 297, 298, 696, 299, 443, 300, 583, | |
975 | 652, 653, 654, 655, 301, 302, 698, 303, 304, 305, | |
976 | 699, 306, 307, 450, 660, 661, 308, 309, 310, 311, | |
977 | 312, 313, 314, 569, 570, 571, 572, 215, 216, 217, | |
978 | 218, 488, 219, 469, 470, 471, 220, 221, 222, 223, | |
22eed1e6 APB |
979 | 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, |
980 | 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, | |
1179ebc2 | 981 | 244, 392, 489, 712 |
8b27f225 PB |
982 | }; |
983 | ||
1179ebc2 APB |
984 | static const short yypact[] = { 456, |
985 | -32768,-32768, 92, -32, 361, 363,-32768,-32768, 208, 445, | |
986 | 525,-32768,-32768,-32768,-32768, 617,-32768,-32768,-32768,-32768, | |
987 | 18,-32768,-32768,-32768, 45,-32768, 293,-32768, 22, 558, | |
988 | -32768,-32768, 538, 571,-32768, -32, 405,-32768,-32768, 479, | |
989 | -32768, 421, 11, 164,-32768, 432, 182,-32768,-32768, -32, | |
990 | 643, 329,-32768, 341,-32768, 59,-32768,-32768,-32768,-32768, | |
991 | 194, 968,-32768, 468, 11,-32768,-32768, 20, 471,-32768, | |
992 | -32768, 11, 164,-32768, 182,-32768,-32768,-32768, 476,-32768, | |
993 | -32768,-32768, 504, 373,-32768,-32768, 419, -79, 779,-32768, | |
994 | -32768, 61,-32768, 988,-32768,-32768,-32768,-32768,-32768,-32768, | |
995 | -32768,-32768,-32768, 440, 466,-32768, 11,-32768,-32768, 473, | |
996 | 4,-32768, 143, -25,-32768, 722, 4, 39, 77, 475, | |
997 | -32768, 518, 520,-32768,-32768,-32768,-32768, 526, 860,-32768, | |
998 | -32768, 466, 615, 531, 84,-32768,-32768,-32768, 562, 2071, | |
999 | 87, 582,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 4, | |
1000 | -32768, 362, 4,-32768,-32768, 519, 502,-32768, 529, 779, | |
1001 | -32768, 872,-32768,-32768,-32768,-32768, 19,-32768, 536,-32768, | |
1002 | -32768, 670,-32768,-32768, 1798,-32768,-32768,-32768, 583, 893, | |
1003 | 10,-32768,-32768,-32768, 634,-32768,-32768,-32768, 317,-32768, | |
1004 | -32768, 2818, 2883, 2934, 2999, 645, 34, 586,-32768, 3050, | |
1005 | 3115, 3166, 5306,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | |
1006 | 652, 795, 29,-32768, 655, 661,-32768, 587,-32768, 461, | |
1007 | -32768, 694, 833,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | |
1008 | 946, 887, 962, 806, 897, 767, 784, 786, 799, 596, | |
1009 | -32768,-32768,-32768, 832,-32768,-32768,-32768,-32768,-32768,-32768, | |
1010 | -32768,-32768, 826, 670,-32768,-32768,-32768, 150, 718, 727, | |
1011 | -32768, 773, 246, 304, 3231,-32768, 186, 2122, 23, 320, | |
1012 | 336, 93, 345, 230, 742, 5603,-32768, -32, 385, 843, | |
1013 | 714, 990,-32768, 746,-32768, 1730,-32768,-32768, 751,-32768, | |
1014 | -32768,-32768, 1866,-32768,-32768, 754,-32768,-32768,-32768,-32768, | |
1015 | 1866,-32768, 1866,-32768,-32768, 5654, 761,-32768,-32768,-32768, | |
1016 | -32768,-32768, 347,-32768, 758, 788, 833, 920, 928,-32768, | |
1017 | -32768,-32768,-32768, 898, 588,-32768, 697, 590,-32768, 606, | |
1018 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 217, | |
1019 | -32768, 595, 883, 745, 745, 349,-32768,-32768,-32768,-32768, | |
1020 | -32768, 747, 989, 260,-32768,-32768, 625, 291, 5371, 3282, | |
1021 | 780,-32768, 442, 3347,-32768, 388,-32768,-32768, 3398, 3463, | |
1022 | 3514, 3579, 3630, 3695, 3746, 3811, 3862, 3927, 3978, 4043, | |
1023 | 688, 4094, 4159, 4210, 4275, 4326, 4391, 4442, 2187,-32768, | |
1024 | -32768, 4507,-32768, 253,-32768,-32768,-32768, 763,-32768,-32768, | |
1025 | -32768, 1730,-32768,-32768,-32768,-32768, 4558,-32768, 66,-32768, | |
1026 | -32768, 95,-32768,-32768, 97,-32768, 4623,-32768, 4674,-32768, | |
1027 | 711,-32768, 5088,-32768,-32768, 104, 261, 757, 2238, 457, | |
1028 | -32768,-32768, -32, 2303,-32768,-32768,-32768,-32768,-32768, 1007, | |
1029 | -32768,-32768, 750,-32768, 805, 901, 893,-32768,-32768,-32768, | |
1030 | 111, 2354,-32768, 4739,-32768, 898,-32768,-32768,-32768,-32768, | |
1031 | -32768,-32768, -38, 781,-32768,-32768,-32768, 2419, 745,-32768, | |
1032 | 557, 745, 557,-32768, 2470, 4790, 179, 614, 2535, 642, | |
1033 | -32768, 5679,-32768, 2006,-32768,-32768,-32768, 556,-32768,-32768, | |
1034 | 219,-32768,-32768,-32768,-32768,-32768, 790,-32768, 229,-32768, | |
1035 | 5422,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 946,-32768, | |
1036 | 946,-32768, 887,-32768, 887,-32768, 887,-32768, 962,-32768, | |
1037 | 962,-32768, 962,-32768, 962,-32768, 373,-32768,-32768, 806, | |
1038 | -32768, 806,-32768, 897,-32768, 767,-32768, 784,-32768, 786, | |
1039 | -32768, 799,-32768, 894, 809,-32768,-32768,-32768,-32768, 924, | |
1040 | 1730, 807,-32768, 1730,-32768, 265,-32768,-32768,-32768,-32768, | |
1041 | -32768,-32768,-32768, 301,-32768, 808, 390, 215, 711,-32768, | |
1042 | 536,-32768,-32768,-32768,-32768,-32768, 401, 757,-32768, 904, | |
1043 | 47, 532,-32768, 814,-32768, 5222,-32768, 5113, 810, 824, | |
1044 | 836,-32768,-32768, 5487,-32768,-32768, 243,-32768, 829, 245, | |
1045 | -32768, 829,-32768,-32768, 466, 69,-32768,-32768,-32768, 4855, | |
1046 | 5264,-32768,-32768,-32768,-32768,-32768, 4906,-32768,-32768, 5538, | |
1047 | -32768,-32768, 466, 602,-32768, 4971, 657,-32768, 1730, 2586, | |
1048 | -32768,-32768, 1932,-32768,-32768, 224,-32768, 705,-32768,-32768, | |
1049 | -32768,-32768,-32768,-32768, 2651,-32768,-32768, 931, 333, 5022, | |
1050 | -32768, 669,-32768, 1507,-32768, 5603,-32768,-32768,-32768, 869, | |
1051 | 890, 5155,-32768, 225,-32768, 619,-32768,-32768,-32768,-32768, | |
1052 | -32768,-32768, 466,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | |
1053 | 743,-32768, 466,-32768,-32768, 409,-32768, 133, 112, 417, | |
1054 | -32768, 927, 945, 1932,-32768,-32768, 1932,-32768,-32768, 906, | |
1055 | -32768, 914, 925,-32768, 1013, 154,-32768,-32768,-32768,-32768, | |
1056 | -32768, 360,-32768,-32768, 1580,-32768, 1654,-32768, 936, 1866, | |
1057 | -32768, 937,-32768,-32768,-32768,-32768,-32768,-32768, 2702,-32768, | |
1058 | 200, 4558, 1866,-32768,-32768, 2767,-32768,-32768,-32768,-32768, | |
1059 | 1036,-32768,-32768,-32768, 940,-32768, 1866, 223, 214,-32768, | |
1060 | 332,-32768, 5113, 949,-32768,-32768,-32768,-32768, 227, 1932, | |
1061 | 950, 5155,-32768, 995, 1932, 958, 1932,-32768, 1932,-32768, | |
1062 | -32768, 1056, 1061,-32768 | |
8b27f225 PB |
1063 | }; |
1064 | ||
1065 | static const short yypgoto[] = {-32768, | |
1179ebc2 APB |
1066 | -32768, -60, -53, 681, -31, -121, 565,-32768, -3, 566, |
1067 | -32768, 134,-32768, 1054, 630,-32768, 218,-32768,-32768, 759, | |
1068 | 17, 441,-32768,-32768, 1024, 1008,-32768, -127,-32768, 930, | |
1069 | -32768, 331, -122, 948, -173, -191,-32768,-32768, 379, 498, | |
1070 | 840, -323, -101,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | |
1071 | 935,-32768,-32768, 695, -30,-32768,-32768,-32768,-32768, 1050, | |
1072 | 503,-32768, 1011,-32768,-32768, 14,-32768, -104, 846, -349, | |
1073 | -165, -278,-32768, 803, -15, 115, -546,-32768, -429,-32768, | |
1074 | -32768,-32768, -299,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | |
1075 | -32768, 458, 459, -623, -362,-32768,-32768,-32768,-32768,-32768, | |
1076 | -32768,-32768, -337,-32768, -620, 811,-32768,-32768,-32768,-32768, | |
1077 | -32768,-32768,-32768,-32768, 543,-32768, 544,-32768,-32768, -120, | |
1078 | -32768, -339,-32768, 769, 279, -308, 1141, 244, 1161, 374, | |
1079 | 434, 491, -111, 515, 683, -468,-32768, 627, 684, 570, | |
1080 | 641, 731, 733, 730, 732, 734,-32768, 497, 737, 740, | |
1081 | -32768,-32768, 36,-32768 | |
8b27f225 PB |
1082 | }; |
1083 | ||
1084 | ||
1179ebc2 | 1085 | #define YYLAST 5788 |
8b27f225 PB |
1086 | |
1087 | ||
1088 | static const short yytable[] = { 21, | |
1179ebc2 APB |
1089 | 152, 83, 29, 458, 176, 324, 449, 437, 84, 286, |
1090 | 59, 356, 184, 612, 67, 143, 16, 120, 38, 257, | |
1091 | 101, 50, 48, 341, 174, 16, 16, 16, 123, 362, | |
1092 | 718, 93, 59, 83, 341, 84, 473, 59, 61, 144, | |
1093 | 84, 722, 61, 478, 480, 41, 16, 647, 249, 16, | |
1094 | 16, 251, 553, 20, 315, 592, 134, 174, 88, 76, | |
1095 | 61, 124, 593, 93, 259, 61, 557, 16, 83, 672, | |
1096 | 261, -66, 179, 138, 139, 84, 346, 146, 89, 84, | |
1097 | 333, 335, 337, 339, 186, 88, 693, 246, 348, 350, | |
1098 | 88, 718, 19, 420, 581, 559, 59, 561, 173, 123, | |
1099 | 135, 83, 67, 326, 574, 62, 84, 42, 84, 327, | |
1100 | 89, 585, 647, -103, -66, -154, 39, -103, 40, 325, | |
1101 | 49, 279, 50, 342, 61, 88, 84, -93, -93, 88, | |
1102 | 61, 173, 761, 646, 342, 606, 145, 25, 27, -155, | |
1103 | 648, 766, 677, 137, 344, 160, 617, 693, 352, 180, | |
1104 | 693, 456, 395, 398, 740, 428, 88, 77, 88, 125, | |
1105 | 599, 624, 673, 602, 558, 315, 345, 421, 617, 52, | |
1106 | 54, 280, 315, 57, 147, 245, 88, 20, 160, 609, | |
1107 | 315, 187, 315, 57, 247, 315, 410, 157, 330, 330, | |
1108 | 330, 330, 179, 560, 61, 562, 330, 330, 353, 84, | |
1109 | 707, 628, 575, 694, 631, 731, 460, -30, 1, -291, | |
1110 | 586, 617, 110, 693, 740, 639, 113, 461, 693, 618, | |
1111 | 693, 433, 693, 739, 701, 723, 31, 755, 84, 621, | |
1112 | 424, 730, 279, 69, -96, 133, 554, 354, 245, -96, | |
1113 | -96, -96, -96, 667, 157, 669, -319, 741, 396, 88, | |
1114 | 31, 2, 279, 617, 666, 110, 113, 503, 505, 507, | |
1115 | 481, 481, 3, 64, 694, 632, 179, 694, 4, 180, | |
1116 | 697, 20, 189, 84, 5, 437, 596, 441, 88, 687, | |
1117 | 681, 315, 280, 462, 411, 444, 658, 445, 449, 440, | |
1118 | 689, 485, 615, 45, 50, 700, 67, 440, 750, 440, | |
1119 | 409, 634, 446, 415, 406, 706, 7, 759, 281, 157, | |
1120 | 578, 427, 189, 617, 703, 20, 619, 137, -253, 157, | |
1121 | 416, 758, 447, 88, 61, 763, 622, 527, 425, 71, | |
1122 | 694, 697, 632, 708, 697, 694, 418, 694, -319, 694, | |
1123 | 668, 74, 670, 180, -65, 422, 548, 453, 279, 474, | |
1124 | 437, 366, 327, 482, 576, 46, 700, 486, 633, 700, | |
1125 | 742, 26, 449, 28, 608, 330, 330, 330, 330, 330, | |
1126 | 330, 330, 330, 330, 330, 330, 330, 88, 330, 330, | |
1127 | 330, 330, 330, 330, 330, 629, 433, -65, 500, 749, | |
1128 | 637, 42, -65, 84, 635, 491, 407, 697, 550, 499, | |
1129 | 412, 644, 697, 46, 697, 53, 697, 426, -96, 644, | |
1130 | -96, 189, 417, -96, -96, -96, -96, 406, 316, 281, | |
1131 | 709, 58, 700, -157, 545, 760, 281, 700, 419, 700, | |
1132 | 315, 700, 66, 315, 281, -65, 281, 423, 437, 454, | |
1133 | 17, 475, 556, 88, -31, 1, 20, 743, 20, 17, | |
1134 | 17, 17, 564, 449, 566, -28, 1, 492, 189, 165, | |
1135 | 250, 139, 449, 640, 491, 315, 643, 315, 98, 118, | |
1136 | 17, 102, 330, 17, 17, 464, 109, 671, 330, 55, | |
1137 | 501, 118, 638, 56, 601, 358, 603, 589, 2, 591, | |
1138 | 20, 17, 165, 645, 57, 682, 497, 279, 675, 2, | |
1139 | 279, 729, 90, 597, 112, 4, 20, 167, 315, 732, | |
1140 | 3, 5, 315, 496, 491, 119, 4, 20, 149, 245, | |
1141 | 151, 577, 5, 493, -29, 1, 154, 20, 494, 316, | |
1142 | 6, 183, 495, 315, 90, 281, 316, -32, 1, 128, | |
1143 | 167, 315, 20, 7, 316, 726, 316, 280, 317, 316, | |
1144 | 280, -494, -494, 20, 7, 728, 20, -34, 1, 724, | |
1145 | 129, 20, 188, 57, 20, 133, 189, 100, 2, 161, | |
1146 | -33, 1, 148, 315, 106, 279, 315, 179, 649, 3, | |
1147 | 117, 2, 248, 323, 84, 4, 343, 365, 455, 20, | |
1148 | 459, 5, 3, 650, 315, 463, 315, 252, 4, 315, | |
1149 | 279, 2, 161, 20, 5, 20, 330, 330, 318, 131, | |
1150 | 388, 20, 315, -138, 2, 177, 20, 691, 4, 150, | |
1151 | 153, 253, 330, 7, 5, 280, 315, 651, 99, 440, | |
1152 | 157, 4, 315, 103, 88, 78, 7, 5, 30, 315, | |
1153 | 34, 315, -35, 1, 315, 316, 315, 20, 315, 616, | |
1154 | 280, 203, 679, 600, 180, 617, 7, 492, 2, 317, | |
1155 | 35, 279, 51, 279, 78, 319, 317, 80, 20, 7, | |
1156 | 81, 20, 20, 20, 317, 20, 317, 36, 441, 317, | |
1157 | 20, 444, 389, 37, 281, 711, 2, 281, 526, 320, | |
1158 | 440, 719, 155, 440, 159, 683, 80, 457, 359, 81, | |
1159 | 20, 617, 360, 4, 746, 702, 361, 610, 178, 5, | |
1160 | 600, 280, 725, 280, 431, 649, 440, 752, 617, 318, | |
1161 | 483, 686, 134, 493, 484, 159, 318, 159, 494, 440, | |
1162 | 650, 757, 495, 328, 318, 611, 318, 78, 600, 318, | |
1163 | 2, 7, 20, 440, 691, 340, 78, 598, 2, 746, | |
1164 | 598, 752, 358, 757, 78, 363, 440, 364, -25, -25, | |
1165 | 57, 440, 281, 440, 713, 440, 281, 751, 32, 80, | |
1166 | 567, 754, 81, 20, 568, 317, 319, 384, 80, 121, | |
1167 | 492, 81, 20, 319, -495, -495, 80, 281, 32, 81, | |
1168 | 20, 319, 32, 319, 316, 385, 319, 316, 386, -25, | |
1169 | 320, 432, -338, -338, -25, -25, -25, 320, 734, 32, | |
1170 | -25, 735, 387, 140, -25, 320, 399, 320, 141, 142, | |
1171 | 320, 400, 35, 377, 378, 379, 380, 281, 78, 316, | |
1172 | 281, 316, -340, -340, -153, 318, 727, 122, 434, 36, | |
1173 | 476, 468, 617, 477, 582, 37, 493, 358, 281, 438, | |
1174 | 281, 494, 442, 281, -338, 495, 139, 321, -338, 452, | |
1175 | 80, 549, 381, 81, 20, 20, 281, 403, 404, 2, | |
1176 | 584, 405, 316, 594, 764, 78, 316, 367, 368, 768, | |
1177 | 281, 770, 620, 771, -340, -493, -493, 359, -340, 372, | |
1178 | 373, 360, 319, 281, 625, 361, 626, 316, 281, 630, | |
1179 | 281, 636, 281, 156, 646, 316, 656, 80, 662, 78, | |
1180 | 81, 20, 382, 383, 322, 156, 320, 663, 79, 393, | |
1181 | 4, 78, 390, 391, 317, 600, 5, 317, -15, 664, | |
1182 | 79, 707, 4, -493, -493, 359, 35, 316, 5, 429, | |
1183 | 316, 80, 78, 430, 81, 20, 519, 521, 523, 525, | |
1184 | 369, 370, 371, 80, 157, 158, 81, 20, 316, 317, | |
1185 | 316, 317, 720, 316, -404, -404, 157, 255, 321, 374, | |
1186 | 375, 376, -405, -405, 80, 321, 316, 81, 20, 465, | |
1187 | 466, 467, 733, 321, 318, 321, -15, 318, 321, 586, | |
1188 | 316, -493, -493, 359, 141, 142, 316, 429, 509, 511, | |
1189 | -204, 361, 317, 316, 736, 316, 317, 737, 316, -15, | |
1190 | 316, 2, 316, 739, -493, -493, 359, 78, 738, 318, | |
1191 | 429, 318, 530, 532, 627, 322, 79, 317, 4, 745, | |
1192 | 747, 2, 322, 35, 5, 317, 755, 78, 756, 78, | |
1193 | 322, 319, 322, 765, 319, 322, 79, 762, 4, 80, | |
1194 | 767, 769, 81, 20, 5, 773, 37, 513, 515, 517, | |
1195 | 774, 528, 318, 82, 33, 320, 318, 317, 320, 80, | |
1196 | 317, 80, 81, 20, 81, 20, 319, 75, 319, -493, | |
1197 | -493, 359, 108, 126, 321, 479, 190, 318, 317, 361, | |
1198 | 317, 256, 394, 317, 254, 318, 552, -493, -493, 359, | |
1199 | 320, 73, 320, 360, 127, 402, 317, 430, 448, 714, | |
1200 | 715, 641, 642, 472, 534, 538, 451, 536, 540, 319, | |
1201 | 317, 542, 685, 319, 0, 0, 317, 318, 547, 0, | |
1202 | 318, 0, 0, 317, 0, 317, 0, 0, 317, 0, | |
1203 | 317, 322, 317, 320, 319, 0, 0, 320, 318, 0, | |
1204 | 318, 0, 319, 318, 0, 0, 0, 0, 0, 0, | |
1205 | 0, 0, 0, 0, 0, 0, 318, 0, 320, 0, | |
1206 | 0, 0, 0, 0, 0, 0, 320, 0, 0, 0, | |
1207 | 318, 0, 0, 0, 319, 0, 318, 319, 0, 0, | |
1208 | 0, 0, 0, 318, 0, 318, 0, 0, 318, 0, | |
1209 | 318, 0, 318, 0, 0, 319, 0, 319, 320, 0, | |
1210 | 319, 320, 0, 0, 0, 0, 0, 0, 0, 0, | |
1211 | 0, 0, 0, 319, 0, 0, 0, 0, 0, 320, | |
1212 | 0, 320, 0, 321, 320, 0, 321, 319, 0, 0, | |
1213 | 0, 0, 0, 319, 0, 0, 0, 320, 0, 0, | |
1214 | 319, 0, 319, 0, 0, 319, 0, 319, 0, 319, | |
1215 | 0, 320, 0, 0, 0, 0, 0, 320, 321, 0, | |
1216 | 321, 0, 0, 0, 320, 0, 320, 0, 0, 320, | |
1217 | 0, 320, 0, 320, 0, 0, 0, 0, 0, 0, | |
1218 | 322, 0, 0, 322, 0, 0, 0, 0, 0, 0, | |
22eed1e6 | 1219 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
1179ebc2 APB |
1220 | 0, 321, 0, 0, 0, 321, 0, 0, 0, 0, |
1221 | 0, 0, 0, 0, 0, 322, 0, 322, 0, 0, | |
1222 | 0, 0, 331, 331, 331, 331, 321, 0, 0, 0, | |
1223 | 331, 331, 0, 0, 321, 0, 0, 0, 0, 0, | |
1224 | 0, 0, 332, 332, 332, 332, 0, 0, 0, 0, | |
1225 | 332, 332, 0, 0, 0, 0, 0, 0, 322, 0, | |
1226 | 0, 0, 322, 0, 0, 0, 321, 0, 0, 321, | |
12472854 | 1227 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
1179ebc2 APB |
1228 | 0, 0, 0, 322, 0, 0, 0, 321, 0, 321, |
1229 | 0, 322, 321, 0, 0, 0, 0, 0, 0, 0, | |
1230 | 0, 0, 0, 0, 0, 321, 0, 0, 0, 0, | |
1231 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, | |
1232 | 0, 0, 0, 322, 0, 321, 322, 0, 0, 0, | |
1233 | 0, 0, 321, 0, 321, 0, 0, 321, 0, 321, | |
1234 | 0, 321, 0, 0, 322, 0, 322, 0, 0, 322, | |
12472854 | 1235 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
1179ebc2 APB |
1236 | 0, 0, 322, 0, 0, 0, 0, 0, 0, 0, |
1237 | 0, 0, 0, 0, 0, 0, 322, 0, 0, 0, | |
1238 | 0, 0, 322, 0, 0, 0, 0, 0, 0, 322, | |
1239 | 0, 322, 0, 0, 322, 0, 322, 262, 322, 331, | |
1240 | 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, | |
1241 | 331, 0, 331, 331, 331, 331, 331, 331, 331, 332, | |
1242 | 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, | |
1243 | 332, 0, 332, 332, 332, 332, 332, 332, 332, 0, | |
1244 | 263, 194, 195, 649, 264, 265, 78, 266, 0, 0, | |
1245 | 267, 0, 0, 0, 268, 196, 0, 0, 650, 0, | |
1246 | 0, 269, 270, 5, 271, 0, 272, 273, 198, 274, | |
1247 | 262, 0, 275, 0, 0, 0, 0, 0, 80, 0, | |
12472854 | 1248 | 0, 81, 20, 0, 0, 0, 0, 0, 0, 276, |
1179ebc2 APB |
1249 | 0, 157, 716, 0, 0, 277, 0, 0, 204, 205, |
1250 | 206, 207, 0, 0, 208, 209, 331, 0, 0, 0, | |
1251 | 0, 0, 331, 263, 194, 195, 649, 264, 265, 78, | |
1252 | 266, 0, 0, 267, 0, 0, 332, 268, 196, 0, | |
1253 | 0, 650, 332, 0, 269, 270, 5, 271, 0, 272, | |
1254 | 273, 198, 274, 0, 262, 275, 0, 0, 0, 0, | |
1255 | 0, 80, 0, 0, 81, 20, 0, 0, 0, 0, | |
1256 | 0, 0, 276, 0, 157, 744, 0, 0, 277, 0, | |
1257 | 0, 204, 205, 206, 207, 0, 0, 208, 209, 0, | |
1258 | 0, 0, 0, 0, 0, 0, 0, 263, 194, 195, | |
1259 | -263, 264, 265, 78, 266, 0, 0, 267, 0, 0, | |
1260 | 0, 268, 196, 0, 0, -263, 0, 0, 269, 270, | |
1261 | 5, 271, 0, 272, 273, 198, 274, 0, 0, 275, | |
1262 | 262, 0, 0, 0, 0, 80, 0, 0, 81, 20, | |
1263 | 0, 0, 0, 0, 0, 0, 276, 0, 157, -263, | |
1264 | 331, 331, 277, 0, 0, 204, 205, 206, 207, 0, | |
1265 | 0, 208, 209, 0, 0, 0, 331, 0, 0, 0, | |
1266 | 332, 332, 0, 263, 194, 195, 0, 264, 265, 78, | |
1267 | 266, 0, 0, 267, 0, 0, 332, 268, 196, 0, | |
1268 | 0, 0, 0, 0, 269, 270, 5, 271, 262, 272, | |
1269 | 273, 198, 274, 0, 0, 275, 0, 0, 0, 0, | |
1270 | 0, 80, 0, 0, 81, 20, 0, 0, 0, 0, | |
1271 | 0, 0, 276, 0, 157, 435, 0, 0, 277, 0, | |
1272 | 0, 204, 205, 206, 207, 0, 0, 208, 209, 0, | |
1273 | 0, 263, 194, 195, 0, 264, 265, 78, 266, 0, | |
1274 | 0, 267, 0, 0, 0, 268, 196, 0, 0, 0, | |
1275 | 0, 0, 269, 270, 5, 271, 262, 272, 273, 198, | |
1276 | 274, 0, 0, 275, 0, 0, 0, 0, 0, 80, | |
1277 | 0, 0, 81, 20, 0, 0, 0, 0, 0, 0, | |
1278 | 276, 0, 157, 0, 0, 0, 277, 0, 0, 204, | |
1279 | 205, 206, 207, 0, 0, 208, 209, 0, 0, 439, | |
1280 | 194, 195, 0, 264, 265, 78, 266, 0, 0, 267, | |
1281 | 0, 0, 0, 268, 196, 0, 0, 0, 0, 0, | |
1282 | 269, 270, 262, 271, 0, 272, 273, 198, 274, 0, | |
1283 | 0, 275, 0, 0, 0, 0, 0, 80, 0, 0, | |
1284 | 81, 20, 0, 0, 0, 0, 0, 0, 276, 0, | |
1285 | 157, 0, 0, 0, 277, 0, 0, 204, 205, 206, | |
1286 | 207, 0, 0, 208, 209, 439, 194, 195, 0, 690, | |
1287 | 265, 78, 266, 0, 0, 267, 0, 0, 0, 268, | |
1288 | 196, 0, 0, 0, 0, 0, 269, 270, 0, 271, | |
1289 | 0, 272, 273, 198, 274, 0, 613, 275, 192, 193, | |
1290 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1291 | 0, 0, 0, 0, 276, 0, 157, 0, 0, 0, | |
1292 | 277, 0, 0, 204, 205, 206, 207, 0, 0, 208, | |
1293 | 209, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1294 | 194, 195, 0, 0, 0, 78, 0, 0, 0, 0, | |
1295 | 0, 0, 0, 0, 196, 0, 0, 0, 0, 0, | |
1296 | 197, 191, 0, 192, 193, 0, 0, 198, 0, 0, | |
12472854 PB |
1297 | 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, |
1298 | 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, | |
1179ebc2 | 1299 | 203, 614, 0, 0, 0, 0, 0, 204, 205, 206, |
12472854 | 1300 | 207, 0, 0, 208, 209, 194, 195, 0, 0, 0, |
1179ebc2 | 1301 | 78, 0, 413, 0, 192, 193, 0, 0, 0, 196, |
12472854 PB |
1302 | 0, 0, 0, 0, 0, 197, 0, 0, 0, 0, |
1303 | 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, | |
1179ebc2 APB |
1304 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, |
1305 | 201, 0, 0, 202, 0, 203, 194, 195, 0, 0, | |
12472854 | 1306 | 0, 78, 204, 205, 206, 207, 0, 0, 208, 209, |
1179ebc2 | 1307 | 196, 0, 0, 0, 0, 0, 197, 543, 0, 192, |
12472854 PB |
1308 | 193, 0, 0, 198, 0, 0, 0, 199, 0, 0, |
1309 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1179ebc2 APB |
1310 | 200, 201, 0, 0, 202, 0, 0, 0, 0, 0, |
1311 | 414, 0, 0, 204, 205, 206, 207, 0, 0, 208, | |
1312 | 209, 194, 195, 0, 0, 0, 78, 0, 490, 0, | |
12472854 PB |
1313 | 192, 193, 0, 0, 0, 196, 0, 0, 0, 0, |
1314 | 0, 197, 0, 0, 0, 0, 0, 0, 198, 0, | |
1315 | 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, | |
1179ebc2 APB |
1316 | 0, 81, 20, 0, 544, 200, 201, 0, 0, 202, |
1317 | 0, 0, 194, 195, 0, 0, 0, 78, 204, 205, | |
12472854 | 1318 | 206, 207, 0, 0, 208, 209, 196, 0, 0, 0, |
1179ebc2 | 1319 | 0, 0, 197, 579, 0, 192, 193, 0, 0, 198, |
22eed1e6 APB |
1320 | 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, |
1321 | 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, | |
1179ebc2 | 1322 | 202, 0, 0, 0, 0, 148, 0, 0, 0, 204, |
12472854 | 1323 | 205, 206, 207, 0, 0, 208, 209, 194, 195, 0, |
1179ebc2 | 1324 | 0, 0, 78, 0, 587, 0, 192, 193, 0, 0, |
12472854 PB |
1325 | 0, 196, 0, 0, 0, 0, 0, 197, 0, 0, |
1326 | 0, 0, 0, 0, 198, 0, 0, 0, 199, 0, | |
1327 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, | |
1179ebc2 APB |
1328 | 0, 200, 201, 0, 0, 202, 580, 0, 194, 195, |
1329 | 0, 0, 0, 78, 204, 205, 206, 207, 0, 0, | |
1330 | 208, 209, 196, 0, 0, 0, 0, 0, 197, 595, | |
12472854 PB |
1331 | 0, 192, 193, 0, 0, 198, 0, 0, 0, 199, |
1332 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, | |
1179ebc2 APB |
1333 | 0, 0, 200, 201, 0, 0, 202, 0, 0, 0, |
1334 | 0, 0, 588, 0, 0, 204, 205, 206, 207, 0, | |
12472854 | 1335 | 0, 208, 209, 194, 195, 0, 0, 0, 78, 0, |
1179ebc2 | 1336 | 604, 0, 192, 193, 0, 0, 0, 196, 0, 0, |
12472854 | 1337 | 0, 0, 0, 197, 0, 0, 0, 0, 0, 0, |
22eed1e6 APB |
1338 | 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, |
1339 | 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, | |
1179ebc2 | 1340 | 0, 202, 0, 0, 194, 195, 596, 0, 0, 78, |
12472854 | 1341 | 204, 205, 206, 207, 0, 0, 208, 209, 196, 0, |
1179ebc2 | 1342 | 0, 0, 0, 0, 197, 490, 0, 192, 193, 0, |
22eed1e6 APB |
1343 | 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, |
1344 | 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, | |
1179ebc2 | 1345 | 0, 0, 202, 605, 0, 0, 0, 0, 0, 0, |
12472854 | 1346 | 0, 204, 205, 206, 207, 0, 0, 208, 209, 194, |
1179ebc2 | 1347 | 195, 0, 0, 0, 78, 0, 579, 0, 192, 193, |
12472854 PB |
1348 | 0, 0, 0, 196, 0, 0, 0, 0, 0, 197, |
1349 | 0, 0, 0, 0, 0, 0, 198, 0, 0, 0, | |
1350 | 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, | |
1179ebc2 APB |
1351 | 20, 0, 0, 200, 201, 0, 0, 202, 0, 0, |
1352 | 194, 195, 596, 0, 0, 78, 204, 205, 206, 207, | |
12472854 | 1353 | 0, 0, 208, 209, 196, 0, 0, 0, 0, 0, |
1179ebc2 | 1354 | 197, 704, 0, 192, 193, 0, 0, 198, 0, 0, |
12472854 | 1355 | 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, |
1179ebc2 | 1356 | 81, 20, 0, 0, 200, 201, 0, 0, 202, 688, |
12472854 PB |
1357 | 0, 0, 0, 0, 0, 0, 0, 204, 205, 206, |
1358 | 207, 0, 0, 208, 209, 194, 195, 0, 0, 0, | |
1179ebc2 | 1359 | 78, 0, 704, 0, 192, 193, 0, 0, 0, 196, |
12472854 | 1360 | 0, 0, 0, 0, 0, 197, 0, 0, 0, 0, |
22eed1e6 APB |
1361 | 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, |
1362 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, | |
1179ebc2 | 1363 | 201, 0, 0, 202, 705, 0, 194, 195, 0, 0, |
12472854 | 1364 | 0, 78, 204, 205, 206, 207, 0, 0, 208, 209, |
1179ebc2 | 1365 | 196, 0, 0, 0, 0, 0, 197, 587, 0, 192, |
12472854 PB |
1366 | 193, 0, 0, 198, 0, 0, 0, 199, 0, 0, |
1367 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1179ebc2 | 1368 | 200, 201, 0, 0, 202, 748, 0, 0, 0, 0, |
12472854 | 1369 | 0, 0, 0, 204, 205, 206, 207, 0, 0, 208, |
1179ebc2 | 1370 | 209, 194, 195, 0, 0, 0, 78, 0, 329, 0, |
12472854 PB |
1371 | 192, 193, 0, 0, 0, 196, 0, 0, 0, 0, |
1372 | 0, 197, 0, 0, 0, 0, 0, 0, 198, 0, | |
22eed1e6 APB |
1373 | 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, |
1374 | 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, | |
1179ebc2 | 1375 | 0, 0, 194, 195, 0, 753, 0, 78, 204, 205, |
12472854 | 1376 | 206, 207, 0, 0, 208, 209, 196, 0, 0, 0, |
1179ebc2 | 1377 | 0, 0, 197, 334, 0, 192, 193, 0, 0, 198, |
22eed1e6 APB |
1378 | 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, |
1379 | 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, | |
12472854 PB |
1380 | 202, 0, 0, 0, 0, 0, 0, 0, 0, 204, |
1381 | 205, 206, 207, 0, 0, 208, 209, 194, 195, 0, | |
1179ebc2 | 1382 | 0, 0, 78, 0, 336, 0, 192, 193, 0, 0, |
12472854 PB |
1383 | 0, 196, 0, 0, 0, 0, 0, 197, 0, 0, |
1384 | 0, 0, 0, 0, 198, 0, 0, 0, 199, 0, | |
1385 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, | |
1386 | 0, 200, 201, 0, 0, 202, 0, 0, 194, 195, | |
1387 | 0, 0, 0, 78, 204, 205, 206, 207, 0, 0, | |
1179ebc2 | 1388 | 208, 209, 196, 0, 0, 0, 0, 0, 197, 338, |
12472854 PB |
1389 | 0, 192, 193, 0, 0, 198, 0, 0, 0, 199, |
1390 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, | |
1391 | 0, 0, 200, 201, 0, 0, 202, 0, 0, 0, | |
1392 | 0, 0, 0, 0, 0, 204, 205, 206, 207, 0, | |
1393 | 0, 208, 209, 194, 195, 0, 0, 0, 78, 0, | |
1179ebc2 | 1394 | 347, 0, 192, 193, 0, 0, 0, 196, 0, 0, |
12472854 | 1395 | 0, 0, 0, 197, 0, 0, 0, 0, 0, 0, |
22eed1e6 APB |
1396 | 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, |
1397 | 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, | |
12472854 PB |
1398 | 0, 202, 0, 0, 194, 195, 0, 0, 0, 78, |
1399 | 204, 205, 206, 207, 0, 0, 208, 209, 196, 0, | |
1179ebc2 | 1400 | 0, 0, 0, 0, 197, 349, 0, 192, 193, 0, |
22eed1e6 APB |
1401 | 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, |
1402 | 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, | |
12472854 PB |
1403 | 0, 0, 202, 0, 0, 0, 0, 0, 0, 0, |
1404 | 0, 204, 205, 206, 207, 0, 0, 208, 209, 194, | |
1179ebc2 | 1405 | 195, 0, 0, 0, 78, 0, 351, 0, 192, 193, |
12472854 PB |
1406 | 0, 0, 0, 196, 0, 0, 0, 0, 0, 197, |
1407 | 0, 0, 0, 0, 0, 0, 198, 0, 0, 0, | |
1408 | 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, | |
1409 | 20, 0, 0, 200, 201, 0, 0, 202, 0, 0, | |
1410 | 194, 195, 0, 0, 0, 78, 204, 205, 206, 207, | |
1411 | 0, 0, 208, 209, 196, 0, 0, 0, 0, 0, | |
1179ebc2 | 1412 | 197, 408, 0, 192, 193, 0, 0, 198, 0, 0, |
22eed1e6 APB |
1413 | 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, |
1414 | 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, | |
12472854 PB |
1415 | 0, 0, 0, 0, 0, 0, 0, 204, 205, 206, |
1416 | 207, 0, 0, 208, 209, 194, 195, 0, 0, 0, | |
1179ebc2 | 1417 | 78, 0, 490, 0, 192, 193, 0, 0, 0, 196, |
12472854 PB |
1418 | 0, 0, 0, 0, 0, 197, 0, 0, 0, 0, |
1419 | 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, | |
1420 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, | |
1421 | 201, 0, 0, 202, 0, 0, 194, 195, 0, 0, | |
1422 | 0, 78, 204, 205, 206, 207, 0, 0, 208, 209, | |
1179ebc2 | 1423 | 196, 0, 0, 0, 0, 0, 197, 498, 0, 192, |
12472854 PB |
1424 | 193, 0, 0, 198, 0, 0, 0, 199, 0, 0, |
1425 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1426 | 200, 201, 0, 0, 202, 0, 0, 0, 0, 0, | |
1427 | 0, 0, 0, 204, 205, 206, 207, 0, 0, 208, | |
1179ebc2 | 1428 | 209, 194, 195, 0, 0, 0, 78, 0, 502, 0, |
12472854 PB |
1429 | 192, 193, 0, 0, 0, 196, 0, 0, 0, 0, |
1430 | 0, 197, 0, 0, 0, 0, 0, 0, 198, 0, | |
22eed1e6 APB |
1431 | 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, |
1432 | 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, | |
12472854 PB |
1433 | 0, 0, 194, 195, 0, 0, 0, 78, 204, 205, |
1434 | 206, 207, 0, 0, 208, 209, 196, 0, 0, 0, | |
1179ebc2 | 1435 | 0, 0, 197, 504, 0, 192, 193, 0, 0, 198, |
22eed1e6 APB |
1436 | 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, |
1437 | 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, | |
12472854 PB |
1438 | 202, 0, 0, 0, 0, 0, 0, 0, 0, 204, |
1439 | 205, 206, 207, 0, 0, 208, 209, 194, 195, 0, | |
1179ebc2 | 1440 | 0, 0, 78, 0, 506, 0, 192, 193, 0, 0, |
12472854 PB |
1441 | 0, 196, 0, 0, 0, 0, 0, 197, 0, 0, |
1442 | 0, 0, 0, 0, 198, 0, 0, 0, 199, 0, | |
1443 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, | |
1444 | 0, 200, 201, 0, 0, 202, 0, 0, 194, 195, | |
1445 | 0, 0, 0, 78, 204, 205, 206, 207, 0, 0, | |
1179ebc2 | 1446 | 208, 209, 196, 0, 0, 0, 0, 0, 197, 508, |
12472854 PB |
1447 | 0, 192, 193, 0, 0, 198, 0, 0, 0, 199, |
1448 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, | |
1449 | 0, 0, 200, 201, 0, 0, 202, 0, 0, 0, | |
1450 | 0, 0, 0, 0, 0, 204, 205, 206, 207, 0, | |
1451 | 0, 208, 209, 194, 195, 0, 0, 0, 78, 0, | |
1179ebc2 | 1452 | 510, 0, 192, 193, 0, 0, 0, 196, 0, 0, |
12472854 | 1453 | 0, 0, 0, 197, 0, 0, 0, 0, 0, 0, |
22eed1e6 APB |
1454 | 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, |
1455 | 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, | |
12472854 PB |
1456 | 0, 202, 0, 0, 194, 195, 0, 0, 0, 78, |
1457 | 204, 205, 206, 207, 0, 0, 208, 209, 196, 0, | |
1179ebc2 | 1458 | 0, 0, 0, 0, 197, 512, 0, 192, 193, 0, |
22eed1e6 APB |
1459 | 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, |
1460 | 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, | |
12472854 PB |
1461 | 0, 0, 202, 0, 0, 0, 0, 0, 0, 0, |
1462 | 0, 204, 205, 206, 207, 0, 0, 208, 209, 194, | |
1179ebc2 | 1463 | 195, 0, 0, 0, 78, 0, 514, 0, 192, 193, |
12472854 PB |
1464 | 0, 0, 0, 196, 0, 0, 0, 0, 0, 197, |
1465 | 0, 0, 0, 0, 0, 0, 198, 0, 0, 0, | |
1466 | 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, | |
1467 | 20, 0, 0, 200, 201, 0, 0, 202, 0, 0, | |
1468 | 194, 195, 0, 0, 0, 78, 204, 205, 206, 207, | |
1469 | 0, 0, 208, 209, 196, 0, 0, 0, 0, 0, | |
1179ebc2 | 1470 | 197, 516, 0, 192, 193, 0, 0, 198, 0, 0, |
22eed1e6 APB |
1471 | 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, |
1472 | 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, | |
12472854 PB |
1473 | 0, 0, 0, 0, 0, 0, 0, 204, 205, 206, |
1474 | 207, 0, 0, 208, 209, 194, 195, 0, 0, 0, | |
1179ebc2 | 1475 | 78, 0, 518, 0, 192, 193, 0, 0, 0, 196, |
12472854 PB |
1476 | 0, 0, 0, 0, 0, 197, 0, 0, 0, 0, |
1477 | 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, | |
1478 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, | |
1479 | 201, 0, 0, 202, 0, 0, 194, 195, 0, 0, | |
1480 | 0, 78, 204, 205, 206, 207, 0, 0, 208, 209, | |
1179ebc2 | 1481 | 196, 0, 0, 0, 0, 0, 197, 520, 0, 192, |
12472854 PB |
1482 | 193, 0, 0, 198, 0, 0, 0, 199, 0, 0, |
1483 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1484 | 200, 201, 0, 0, 202, 0, 0, 0, 0, 0, | |
1485 | 0, 0, 0, 204, 205, 206, 207, 0, 0, 208, | |
1179ebc2 | 1486 | 209, 194, 195, 0, 0, 0, 78, 0, 522, 0, |
12472854 PB |
1487 | 192, 193, 0, 0, 0, 196, 0, 0, 0, 0, |
1488 | 0, 197, 0, 0, 0, 0, 0, 0, 198, 0, | |
22eed1e6 APB |
1489 | 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, |
1490 | 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, | |
12472854 PB |
1491 | 0, 0, 194, 195, 0, 0, 0, 78, 204, 205, |
1492 | 206, 207, 0, 0, 208, 209, 196, 0, 0, 0, | |
1179ebc2 | 1493 | 0, 0, 197, 524, 0, 192, 193, 0, 0, 198, |
22eed1e6 APB |
1494 | 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, |
1495 | 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, | |
12472854 PB |
1496 | 202, 0, 0, 0, 0, 0, 0, 0, 0, 204, |
1497 | 205, 206, 207, 0, 0, 208, 209, 194, 195, 0, | |
1179ebc2 | 1498 | 0, 0, 78, 0, 529, 0, 192, 193, 0, 0, |
12472854 PB |
1499 | 0, 196, 0, 0, 0, 0, 0, 197, 0, 0, |
1500 | 0, 0, 0, 0, 198, 0, 0, 0, 199, 0, | |
1501 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, | |
1502 | 0, 200, 201, 0, 0, 202, 0, 0, 194, 195, | |
1503 | 0, 0, 0, 78, 204, 205, 206, 207, 0, 0, | |
1179ebc2 | 1504 | 208, 209, 196, 0, 0, 0, 0, 0, 197, 531, |
12472854 PB |
1505 | 0, 192, 193, 0, 0, 198, 0, 0, 0, 199, |
1506 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, | |
1507 | 0, 0, 200, 201, 0, 0, 202, 0, 0, 0, | |
1508 | 0, 0, 0, 0, 0, 204, 205, 206, 207, 0, | |
1509 | 0, 208, 209, 194, 195, 0, 0, 0, 78, 0, | |
1179ebc2 | 1510 | 533, 0, 192, 193, 0, 0, 0, 196, 0, 0, |
12472854 | 1511 | 0, 0, 0, 197, 0, 0, 0, 0, 0, 0, |
22eed1e6 APB |
1512 | 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, |
1513 | 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, | |
12472854 PB |
1514 | 0, 202, 0, 0, 194, 195, 0, 0, 0, 78, |
1515 | 204, 205, 206, 207, 0, 0, 208, 209, 196, 0, | |
1179ebc2 | 1516 | 0, 0, 0, 0, 197, 535, 0, 192, 193, 0, |
22eed1e6 APB |
1517 | 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, |
1518 | 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, | |
12472854 PB |
1519 | 0, 0, 202, 0, 0, 0, 0, 0, 0, 0, |
1520 | 0, 204, 205, 206, 207, 0, 0, 208, 209, 194, | |
1179ebc2 | 1521 | 195, 0, 0, 0, 78, 0, 537, 0, 192, 193, |
12472854 PB |
1522 | 0, 0, 0, 196, 0, 0, 0, 0, 0, 197, |
1523 | 0, 0, 0, 0, 0, 0, 198, 0, 0, 0, | |
1524 | 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, | |
1525 | 20, 0, 0, 200, 201, 0, 0, 202, 0, 0, | |
1526 | 194, 195, 0, 0, 0, 78, 204, 205, 206, 207, | |
1527 | 0, 0, 208, 209, 196, 0, 0, 0, 0, 0, | |
1179ebc2 | 1528 | 197, 539, 0, 192, 193, 0, 0, 198, 0, 0, |
22eed1e6 APB |
1529 | 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, |
1530 | 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, | |
12472854 PB |
1531 | 0, 0, 0, 0, 0, 0, 0, 204, 205, 206, |
1532 | 207, 0, 0, 208, 209, 194, 195, 0, 0, 0, | |
1179ebc2 | 1533 | 78, 0, 541, 0, 192, 193, 0, 0, 0, 196, |
12472854 PB |
1534 | 0, 0, 0, 0, 0, 197, 0, 0, 0, 0, |
1535 | 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, | |
1536 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, | |
1537 | 201, 0, 0, 202, 0, 0, 194, 195, 0, 0, | |
1538 | 0, 78, 204, 205, 206, 207, 0, 0, 208, 209, | |
1179ebc2 | 1539 | 196, 0, 0, 0, 0, 0, 197, 546, 0, 192, |
12472854 PB |
1540 | 193, 0, 0, 198, 0, 0, 0, 199, 0, 0, |
1541 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1542 | 200, 201, 0, 0, 202, 0, 0, 0, 0, 0, | |
1543 | 0, 0, 0, 204, 205, 206, 207, 0, 0, 208, | |
1179ebc2 | 1544 | 209, 194, 195, 0, 0, 0, 78, 0, 555, 0, |
12472854 PB |
1545 | 192, 193, 0, 0, 0, 196, 0, 0, 0, 0, |
1546 | 0, 197, 0, 0, 0, 0, 0, 0, 198, 0, | |
22eed1e6 APB |
1547 | 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, |
1548 | 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, | |
12472854 PB |
1549 | 0, 0, 194, 195, 0, 0, 0, 78, 204, 205, |
1550 | 206, 207, 0, 0, 208, 209, 196, 0, 0, 0, | |
1179ebc2 | 1551 | 0, 0, 197, 563, 0, 192, 193, 0, 0, 198, |
22eed1e6 APB |
1552 | 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, |
1553 | 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, | |
12472854 PB |
1554 | 202, 0, 0, 0, 0, 0, 0, 0, 0, 204, |
1555 | 205, 206, 207, 0, 0, 208, 209, 194, 195, 0, | |
1179ebc2 | 1556 | 0, 0, 78, 0, 565, 0, 192, 193, 0, 0, |
12472854 PB |
1557 | 0, 196, 0, 0, 0, 0, 0, 197, 0, 0, |
1558 | 0, 0, 0, 0, 198, 0, 0, 0, 199, 0, | |
1559 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, | |
1560 | 0, 200, 201, 0, 0, 202, 0, 0, 194, 195, | |
1561 | 0, 0, 0, 78, 204, 205, 206, 207, 0, 0, | |
1179ebc2 | 1562 | 208, 209, 196, 0, 0, 0, 0, 0, 197, 590, |
12472854 PB |
1563 | 0, 192, 193, 0, 0, 198, 0, 0, 0, 199, |
1564 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, | |
1565 | 0, 0, 200, 201, 0, 0, 202, 0, 0, 0, | |
1566 | 0, 0, 0, 0, 0, 204, 205, 206, 207, 0, | |
1567 | 0, 208, 209, 194, 195, 0, 0, 0, 78, 0, | |
1179ebc2 | 1568 | 607, 0, 192, 193, 0, 0, 0, 196, 0, 0, |
12472854 | 1569 | 0, 0, 0, 197, 0, 0, 0, 0, 0, 0, |
22eed1e6 APB |
1570 | 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, |
1571 | 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, | |
12472854 PB |
1572 | 0, 202, 0, 0, 194, 195, 0, 0, 0, 78, |
1573 | 204, 205, 206, 207, 0, 0, 208, 209, 196, 0, | |
1179ebc2 | 1574 | 0, 0, 0, 0, 197, 674, 0, 192, 193, 0, |
22eed1e6 APB |
1575 | 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, |
1576 | 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, | |
12472854 PB |
1577 | 0, 0, 202, 0, 0, 0, 0, 0, 0, 0, |
1578 | 0, 204, 205, 206, 207, 0, 0, 208, 209, 194, | |
1179ebc2 | 1579 | 195, 0, 0, 0, 78, 0, 678, 0, 192, 193, |
12472854 PB |
1580 | 0, 0, 0, 196, 0, 0, 0, 0, 0, 197, |
1581 | 0, 0, 0, 0, 0, 0, 198, 0, 0, 0, | |
1582 | 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, | |
1179ebc2 | 1583 | 20, 0, 0, 200, 201, 0, 0, 202, 0, 0, |
12472854 PB |
1584 | 194, 195, 0, 0, 0, 78, 204, 205, 206, 207, |
1585 | 0, 0, 208, 209, 196, 0, 0, 0, 0, 0, | |
1179ebc2 | 1586 | 197, 684, 0, 192, 193, 0, 0, 198, 0, 0, |
22eed1e6 | 1587 | 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, |
1179ebc2 APB |
1588 | 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, |
1589 | 0, 0, 0, 0, 0, 0, 0, 204, 205, 206, | |
1590 | 207, 0, 0, 208, 209, 194, 195, 0, 0, 0, | |
1591 | 78, 0, 710, 0, 192, 193, 0, 0, 0, 196, | |
1592 | 0, 0, 0, 0, 0, 197, 0, 0, 0, 0, | |
1593 | 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, | |
1594 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, | |
1595 | 201, 0, 0, 202, 0, 0, 194, 195, 0, 0, | |
1596 | 0, 78, 204, 205, 206, 207, 0, 0, 208, 209, | |
1597 | 196, 0, 0, 0, 0, 0, 197, 0, 573, 0, | |
1598 | 0, 0, 0, 198, 0, 0, 0, 199, 0, 0, | |
1599 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1600 | 200, 201, 0, 659, 202, 0, 0, 0, 0, 0, | |
1601 | 0, 0, 0, 204, 205, 206, 207, 0, 0, 208, | |
1602 | 209, -286, -286, -286, 0, 0, 0, -286, 0, 0, | |
1603 | 0, 0, 0, 0, 0, 0, -286, 0, 0, 0, | |
1604 | 0, 0, -286, 0, 0, 721, 0, 194, 195, -286, | |
1605 | 0, 0, 78, -286, 0, 0, 0, 0, 0, -286, | |
1606 | 0, 196, -286, -286, 0, 0, 0, 197, 0, 0, | |
1607 | -286, 0, 0, 0, 198, 0, -286, 0, 199, -286, | |
1608 | -286, -286, -286, 0, 80, -286, -286, 81, 20, 194, | |
1609 | 195, 0, 0, 0, 78, 276, -294, 0, 0, 0, | |
12472854 | 1610 | 0, 0, 0, 196, 204, 205, 206, 207, 0, 197, |
1179ebc2 | 1611 | 208, 209, 657, 0, 0, 0, 198, 0, 0, 0, |
12472854 | 1612 | 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, |
1179ebc2 APB |
1613 | 20, 0, 0, 0, 0, 0, 0, 276, -294, 0, |
1614 | 0, 0, 0, 0, 0, 0, 204, 205, 206, 207, | |
1615 | 0, 0, 208, 209, 676, 0, 194, 195, 0, 0, | |
1616 | 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, | |
1617 | 196, 0, 0, 0, 0, 0, 197, 0, 0, 0, | |
1618 | 0, 0, 0, 198, 0, 0, 0, 199, 0, 0, | |
1619 | 0, 0, 0, 80, 0, 0, 81, 20, 192, 193, | |
1620 | 0, 0, 0, 78, 276, 0, 0, 0, 0, 0, | |
1621 | 0, 0, 196, 204, 205, 206, 207, 0, 197, 208, | |
1622 | 209, 0, 0, 0, 0, 198, 0, 0, 0, 199, | |
1623 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, | |
1624 | 194, 195, 200, 201, 0, 78, 202, 0, 0, 0, | |
1625 | 0, 0, 0, 0, 196, 204, 205, 206, 207, 0, | |
1626 | 197, 208, 209, 192, 193, 0, 0, 198, 0, 0, | |
1627 | 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, | |
1628 | 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, | |
1629 | 203, 355, 0, 0, 0, 0, 0, 204, 205, 206, | |
1630 | 207, 0, 0, 208, 209, 194, 195, 0, 0, 0, | |
1631 | 78, 0, 0, 0, 192, 193, 0, 0, 0, 196, | |
1632 | 0, 0, 0, 0, 0, 197, 0, 0, 0, 0, | |
1633 | 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, | |
1634 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, | |
1635 | 201, 0, 0, 202, 487, 0, 194, 195, 0, 0, | |
1636 | 0, 78, 204, 205, 206, 207, 0, 0, 208, 209, | |
1637 | 196, 0, 0, 0, 0, 0, 197, 0, 0, 192, | |
12472854 PB |
1638 | 193, 0, 0, 198, 0, 0, 0, 199, 0, 0, |
1639 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1179ebc2 | 1640 | 200, 201, 0, 0, 202, 623, 0, 0, 0, 0, |
12472854 PB |
1641 | 0, 0, 0, 204, 205, 206, 207, 0, 0, 208, |
1642 | 209, 194, 195, 0, 0, 0, 78, 0, 0, 0, | |
1179ebc2 APB |
1643 | 192, 193, 0, 0, 0, 196, 0, 0, 0, 0, |
1644 | 0, 197, 0, 0, 0, 0, 0, 0, 198, 0, | |
22eed1e6 APB |
1645 | 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, |
1646 | 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, | |
1179ebc2 APB |
1647 | 665, 0, 194, 195, 0, 0, 0, 78, 204, 205, |
1648 | 206, 207, 0, 0, 208, 209, 196, 0, 0, 0, | |
1649 | 0, 0, 197, 0, 0, 192, 193, 0, 0, 198, | |
22eed1e6 APB |
1650 | 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, |
1651 | 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, | |
1179ebc2 APB |
1652 | 202, 680, 0, 0, 0, 0, 0, 0, 0, 204, |
1653 | 205, 206, 207, 0, 0, 208, 209, 194, 195, 0, | |
1654 | 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, | |
1655 | 0, 196, 0, 0, 0, 0, 0, 197, 0, 0, | |
1656 | 0, 0, 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, 0, 2, 194, 195, | |
1659 | 0, 0, 0, 78, 204, 205, 206, 207, 0, 0, | |
1660 | 208, 209, 196, 0, 0, 0, 0, 0, 197, 0, | |
1661 | 0, 0, 0, 0, 0, 198, 0, 0, 78, 199, | |
1662 | 0, 0, 0, 0, 0, 80, 0, 196, 81, 20, | |
1663 | 0, 0, 0, 197, 0, 0, 276, 0, 0, 0, | |
1664 | 198, 0, 0, 0, 199, 204, 205, 206, 207, 0, | |
1665 | 80, 208, 209, 81, 20, 0, 0, 200, 201, 0, | |
1666 | 0, 202, 0, 0, 0, 0, 0, 0, 0, 0, | |
1667 | 204, 205, 206, 207, 0, 0, 208, 209 | |
8b27f225 PB |
1668 | }; |
1669 | ||
1670 | static const short yycheck[] = { 3, | |
1179ebc2 APB |
1671 | 123, 62, 6, 327, 132, 179, 306, 286, 62, 175, |
1672 | 42, 203, 134, 482, 46, 117, 0, 97, 1, 1, | |
1673 | 1, 101, 1, 1, 129, 9, 10, 11, 89, 1, | |
1674 | 654, 62, 64, 94, 1, 89, 345, 69, 42, 1, | |
1675 | 94, 662, 46, 352, 353, 1, 30, 1, 150, 33, | |
1676 | 34, 153, 402, 86, 175, 94, 53, 162, 62, 1, | |
1677 | 64, 1, 101, 94, 169, 69, 1, 51, 129, 1, | |
1678 | 172, 52, 133, 99, 100, 129, 198, 1, 62, 133, | |
1679 | 192, 193, 194, 195, 1, 89, 633, 1, 200, 201, | |
1680 | 94, 715, 1, 1, 434, 1, 128, 1, 129, 160, | |
1681 | 97, 162, 134, 94, 1, 95, 160, 63, 162, 100, | |
1682 | 94, 1, 1, 95, 95, 93, 99, 99, 101, 180, | |
1683 | 99, 175, 101, 101, 128, 129, 180, 99, 100, 133, | |
1684 | 134, 162, 753, 1, 101, 475, 98, 4, 5, 95, | |
1685 | 94, 762, 611, 1, 198, 129, 100, 694, 202, 133, | |
1686 | 697, 325, 254, 258, 1, 278, 160, 99, 162, 99, | |
1687 | 469, 501, 94, 472, 99, 286, 198, 272, 100, 36, | |
1688 | 37, 175, 293, 40, 98, 140, 180, 86, 162, 1, | |
1689 | 301, 98, 303, 50, 98, 306, 1, 95, 192, 193, | |
1690 | 194, 195, 253, 99, 198, 99, 200, 201, 202, 253, | |
1691 | 1, 551, 99, 633, 554, 94, 328, 0, 1, 99, | |
1692 | 100, 100, 79, 760, 1, 1, 83, 1, 765, 1, | |
1693 | 767, 282, 769, 1, 1, 1, 9, 1, 282, 1, | |
1694 | 1, 99, 286, 52, 92, 93, 402, 202, 203, 97, | |
1695 | 98, 99, 100, 1, 95, 1, 1, 94, 99, 253, | |
1696 | 33, 44, 306, 100, 594, 122, 123, 369, 370, 371, | |
1697 | 1, 1, 55, 100, 694, 1, 327, 697, 61, 253, | |
1698 | 633, 86, 139, 327, 67, 554, 98, 293, 282, 629, | |
1699 | 620, 402, 286, 67, 99, 301, 586, 303, 588, 293, | |
1700 | 630, 1, 484, 1, 101, 633, 328, 301, 99, 303, | |
1701 | 265, 1, 306, 268, 1, 645, 99, 94, 175, 95, | |
1702 | 433, 276, 179, 100, 638, 86, 98, 1, 95, 95, | |
1703 | 1, 99, 306, 327, 328, 99, 98, 381, 99, 1, | |
1704 | 760, 694, 1, 1, 697, 765, 1, 767, 93, 769, | |
1705 | 98, 1, 98, 327, 52, 1, 94, 1, 402, 1, | |
1706 | 629, 218, 100, 94, 94, 63, 694, 67, 94, 697, | |
1707 | 1, 1, 662, 1, 476, 369, 370, 371, 372, 373, | |
22eed1e6 | 1708 | 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, |
1179ebc2 APB |
1709 | 384, 385, 386, 387, 388, 551, 447, 95, 1, 729, |
1710 | 1, 63, 52, 447, 94, 360, 93, 760, 402, 364, | |
1711 | 267, 1, 765, 63, 767, 1, 769, 274, 92, 1, | |
1712 | 94, 278, 93, 97, 98, 99, 100, 1, 175, 286, | |
1713 | 88, 1, 760, 95, 389, 94, 293, 765, 93, 767, | |
1714 | 551, 769, 1, 554, 301, 95, 303, 93, 717, 93, | |
1715 | 0, 93, 407, 447, 0, 1, 86, 88, 86, 9, | |
1716 | 10, 11, 417, 753, 419, 0, 1, 1, 325, 129, | |
1717 | 99, 100, 762, 568, 429, 586, 571, 588, 1, 97, | |
1718 | 30, 1, 476, 33, 34, 342, 1, 605, 482, 1, | |
1719 | 93, 97, 93, 5, 471, 101, 473, 452, 44, 454, | |
1720 | 86, 51, 162, 93, 361, 623, 363, 551, 610, 44, | |
1721 | 554, 93, 62, 468, 1, 61, 86, 129, 629, 93, | |
1722 | 55, 67, 633, 72, 479, 97, 61, 86, 1, 484, | |
1723 | 1, 65, 67, 67, 0, 1, 1, 86, 72, 286, | |
1724 | 75, 1, 76, 654, 94, 402, 293, 0, 1, 100, | |
1725 | 162, 662, 86, 99, 301, 673, 303, 551, 175, 306, | |
1726 | 554, 91, 92, 86, 99, 683, 86, 0, 1, 664, | |
1727 | 95, 86, 1, 430, 86, 93, 433, 65, 44, 129, | |
1728 | 0, 1, 98, 694, 72, 629, 697, 638, 47, 55, | |
1729 | 83, 44, 1, 1, 638, 61, 1, 1, 1, 86, | |
1730 | 1, 67, 55, 62, 715, 1, 717, 96, 61, 720, | |
1731 | 654, 44, 162, 86, 67, 86, 610, 611, 175, 107, | |
1732 | 15, 86, 733, 95, 44, 1, 86, 633, 61, 122, | |
1733 | 123, 93, 626, 99, 67, 629, 747, 96, 64, 633, | |
1734 | 95, 61, 753, 69, 638, 50, 99, 67, 9, 760, | |
1735 | 11, 762, 0, 1, 765, 402, 767, 86, 769, 94, | |
1736 | 654, 95, 617, 97, 638, 100, 99, 1, 44, 286, | |
1737 | 44, 715, 33, 717, 50, 175, 293, 82, 86, 99, | |
1738 | 85, 86, 86, 86, 301, 86, 303, 61, 694, 306, | |
1739 | 86, 697, 87, 67, 551, 650, 44, 554, 1, 175, | |
1740 | 694, 656, 128, 697, 129, 94, 82, 1, 93, 85, | |
1741 | 86, 100, 97, 61, 720, 1, 101, 94, 94, 67, | |
1742 | 97, 715, 94, 717, 1, 47, 720, 733, 100, 286, | |
1743 | 96, 65, 53, 67, 100, 160, 293, 162, 72, 733, | |
1744 | 62, 747, 76, 100, 301, 94, 303, 50, 97, 306, | |
1745 | 44, 99, 86, 747, 760, 101, 50, 469, 44, 765, | |
1746 | 472, 767, 101, 769, 50, 101, 760, 97, 45, 46, | |
1747 | 627, 765, 629, 767, 96, 769, 633, 732, 10, 82, | |
1748 | 60, 736, 85, 86, 64, 402, 286, 11, 82, 1, | |
1749 | 1, 85, 86, 293, 91, 92, 82, 654, 30, 85, | |
1750 | 86, 301, 34, 303, 551, 12, 306, 554, 13, 86, | |
1751 | 286, 88, 45, 46, 91, 92, 93, 293, 694, 51, | |
1752 | 97, 697, 14, 92, 101, 301, 99, 303, 97, 98, | |
1753 | 306, 95, 44, 18, 19, 20, 21, 694, 50, 586, | |
1754 | 697, 588, 45, 46, 93, 402, 94, 59, 93, 61, | |
1755 | 94, 97, 100, 97, 95, 67, 67, 101, 715, 99, | |
1756 | 717, 72, 99, 720, 97, 76, 100, 175, 101, 99, | |
1757 | 82, 99, 57, 85, 86, 86, 733, 95, 96, 44, | |
1758 | 66, 99, 629, 93, 760, 50, 633, 45, 46, 765, | |
1759 | 747, 767, 93, 769, 97, 91, 92, 93, 101, 3, | |
1760 | 4, 97, 402, 760, 1, 101, 88, 654, 765, 93, | |
1761 | 767, 94, 769, 44, 1, 662, 93, 82, 99, 50, | |
1762 | 85, 86, 16, 17, 175, 44, 402, 94, 59, 94, | |
1763 | 61, 50, 91, 92, 551, 97, 67, 554, 86, 94, | |
1764 | 59, 1, 61, 91, 92, 93, 44, 694, 67, 97, | |
1765 | 697, 82, 50, 101, 85, 86, 377, 378, 379, 380, | |
1766 | 5, 6, 7, 82, 95, 96, 85, 86, 715, 586, | |
1767 | 717, 588, 94, 720, 45, 46, 95, 96, 286, 8, | |
1768 | 9, 10, 45, 46, 82, 293, 733, 85, 86, 97, | |
1769 | 98, 99, 56, 301, 551, 303, 86, 554, 306, 100, | |
1770 | 747, 91, 92, 93, 97, 98, 753, 97, 372, 373, | |
1771 | 56, 101, 629, 760, 99, 762, 633, 94, 765, 86, | |
1772 | 767, 44, 769, 1, 91, 92, 93, 50, 94, 586, | |
1773 | 97, 588, 382, 383, 101, 286, 59, 654, 61, 94, | |
1774 | 94, 44, 293, 44, 67, 662, 1, 50, 99, 50, | |
1775 | 301, 551, 303, 94, 554, 306, 59, 99, 61, 82, | |
1776 | 56, 94, 85, 86, 67, 0, 67, 374, 375, 376, | |
1777 | 0, 381, 629, 96, 11, 551, 633, 694, 554, 82, | |
1778 | 697, 82, 85, 86, 85, 86, 586, 54, 588, 91, | |
1779 | 92, 93, 75, 96, 402, 97, 139, 654, 715, 101, | |
1780 | 717, 162, 253, 720, 160, 662, 402, 91, 92, 93, | |
1781 | 586, 52, 588, 97, 94, 260, 733, 101, 306, 652, | |
1782 | 652, 569, 569, 345, 384, 386, 306, 385, 387, 629, | |
1783 | 747, 388, 626, 633, -1, -1, 753, 694, 392, -1, | |
1784 | 697, -1, -1, 760, -1, 762, -1, -1, 765, -1, | |
1785 | 767, 402, 769, 629, 654, -1, -1, 633, 715, -1, | |
1786 | 717, -1, 662, 720, -1, -1, -1, -1, -1, -1, | |
1787 | -1, -1, -1, -1, -1, -1, 733, -1, 654, -1, | |
1788 | -1, -1, -1, -1, -1, -1, 662, -1, -1, -1, | |
1789 | 747, -1, -1, -1, 694, -1, 753, 697, -1, -1, | |
1790 | -1, -1, -1, 760, -1, 762, -1, -1, 765, -1, | |
1791 | 767, -1, 769, -1, -1, 715, -1, 717, 694, -1, | |
1792 | 720, 697, -1, -1, -1, -1, -1, -1, -1, -1, | |
1793 | -1, -1, -1, 733, -1, -1, -1, -1, -1, 715, | |
1794 | -1, 717, -1, 551, 720, -1, 554, 747, -1, -1, | |
1795 | -1, -1, -1, 753, -1, -1, -1, 733, -1, -1, | |
1796 | 760, -1, 762, -1, -1, 765, -1, 767, -1, 769, | |
1797 | -1, 747, -1, -1, -1, -1, -1, 753, 586, -1, | |
1798 | 588, -1, -1, -1, 760, -1, 762, -1, -1, 765, | |
1799 | -1, 767, -1, 769, -1, -1, -1, -1, -1, -1, | |
1800 | 551, -1, -1, 554, -1, -1, -1, -1, -1, -1, | |
22eed1e6 | 1801 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
1179ebc2 APB |
1802 | -1, 629, -1, -1, -1, 633, -1, -1, -1, -1, |
1803 | -1, -1, -1, -1, -1, 586, -1, 588, -1, -1, | |
1804 | -1, -1, 192, 193, 194, 195, 654, -1, -1, -1, | |
1805 | 200, 201, -1, -1, 662, -1, -1, -1, -1, -1, | |
1806 | -1, -1, 192, 193, 194, 195, -1, -1, -1, -1, | |
1807 | 200, 201, -1, -1, -1, -1, -1, -1, 629, -1, | |
1808 | -1, -1, 633, -1, -1, -1, 694, -1, -1, 697, | |
12472854 | 1809 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
1179ebc2 APB |
1810 | -1, -1, -1, 654, -1, -1, -1, 715, -1, 717, |
1811 | -1, 662, 720, -1, -1, -1, -1, -1, -1, -1, | |
1812 | -1, -1, -1, -1, -1, 733, -1, -1, -1, -1, | |
1813 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 747, | |
1814 | -1, -1, -1, 694, -1, 753, 697, -1, -1, -1, | |
1815 | -1, -1, 760, -1, 762, -1, -1, 765, -1, 767, | |
1816 | -1, 769, -1, -1, 715, -1, 717, -1, -1, 720, | |
12472854 | 1817 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
1179ebc2 APB |
1818 | -1, -1, 733, -1, -1, -1, -1, -1, -1, -1, |
1819 | -1, -1, -1, -1, -1, -1, 747, -1, -1, -1, | |
1820 | -1, -1, 753, -1, -1, -1, -1, -1, -1, 760, | |
1821 | -1, 762, -1, -1, 765, -1, 767, 1, 769, 369, | |
1822 | 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, | |
1823 | 380, -1, 382, 383, 384, 385, 386, 387, 388, 369, | |
1824 | 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, | |
1825 | 380, -1, 382, 383, 384, 385, 386, 387, 388, -1, | |
1826 | 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, | |
1827 | 54, -1, -1, -1, 58, 59, -1, -1, 62, -1, | |
1828 | -1, 65, 66, 67, 68, -1, 70, 71, 72, 73, | |
1829 | 1, -1, 76, -1, -1, -1, -1, -1, 82, -1, | |
12472854 | 1830 | -1, 85, 86, -1, -1, -1, -1, -1, -1, 93, |
1179ebc2 APB |
1831 | -1, 95, 96, -1, -1, 99, -1, -1, 102, 103, |
1832 | 104, 105, -1, -1, 108, 109, 476, -1, -1, -1, | |
1833 | -1, -1, 482, 44, 45, 46, 47, 48, 49, 50, | |
1834 | 51, -1, -1, 54, -1, -1, 476, 58, 59, -1, | |
1835 | -1, 62, 482, -1, 65, 66, 67, 68, -1, 70, | |
1836 | 71, 72, 73, -1, 1, 76, -1, -1, -1, -1, | |
1837 | -1, 82, -1, -1, 85, 86, -1, -1, -1, -1, | |
1838 | -1, -1, 93, -1, 95, 96, -1, -1, 99, -1, | |
1839 | -1, 102, 103, 104, 105, -1, -1, 108, 109, -1, | |
1840 | -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, | |
1841 | 47, 48, 49, 50, 51, -1, -1, 54, -1, -1, | |
1842 | -1, 58, 59, -1, -1, 62, -1, -1, 65, 66, | |
1843 | 67, 68, -1, 70, 71, 72, 73, -1, -1, 76, | |
1844 | 1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
1845 | -1, -1, -1, -1, -1, -1, 93, -1, 95, 96, | |
1846 | 610, 611, 99, -1, -1, 102, 103, 104, 105, -1, | |
1847 | -1, 108, 109, -1, -1, -1, 626, -1, -1, -1, | |
1848 | 610, 611, -1, 44, 45, 46, -1, 48, 49, 50, | |
1849 | 51, -1, -1, 54, -1, -1, 626, 58, 59, -1, | |
1850 | -1, -1, -1, -1, 65, 66, 67, 68, 1, 70, | |
1851 | 71, 72, 73, -1, -1, 76, -1, -1, -1, -1, | |
1852 | -1, 82, -1, -1, 85, 86, -1, -1, -1, -1, | |
1853 | -1, -1, 93, -1, 95, 96, -1, -1, 99, -1, | |
1854 | -1, 102, 103, 104, 105, -1, -1, 108, 109, -1, | |
1855 | -1, 44, 45, 46, -1, 48, 49, 50, 51, -1, | |
1856 | -1, 54, -1, -1, -1, 58, 59, -1, -1, -1, | |
1857 | -1, -1, 65, 66, 67, 68, 1, 70, 71, 72, | |
1858 | 73, -1, -1, 76, -1, -1, -1, -1, -1, 82, | |
1859 | -1, -1, 85, 86, -1, -1, -1, -1, -1, -1, | |
1860 | 93, -1, 95, -1, -1, -1, 99, -1, -1, 102, | |
1861 | 103, 104, 105, -1, -1, 108, 109, -1, -1, 44, | |
1862 | 45, 46, -1, 48, 49, 50, 51, -1, -1, 54, | |
1863 | -1, -1, -1, 58, 59, -1, -1, -1, -1, -1, | |
1864 | 65, 66, 1, 68, -1, 70, 71, 72, 73, -1, | |
1865 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
1866 | 85, 86, -1, -1, -1, -1, -1, -1, 93, -1, | |
1867 | 95, -1, -1, -1, 99, -1, -1, 102, 103, 104, | |
1868 | 105, -1, -1, 108, 109, 44, 45, 46, -1, 48, | |
1869 | 49, 50, 51, -1, -1, 54, -1, -1, -1, 58, | |
1870 | 59, -1, -1, -1, -1, -1, 65, 66, -1, 68, | |
1871 | -1, 70, 71, 72, 73, -1, 1, 76, 3, 4, | |
1872 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
1873 | -1, -1, -1, -1, 93, -1, 95, -1, -1, -1, | |
1874 | 99, -1, -1, 102, 103, 104, 105, -1, -1, 108, | |
1875 | 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
1876 | 45, 46, -1, -1, -1, 50, -1, -1, -1, -1, | |
1877 | -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, | |
12472854 PB |
1878 | 65, 1, -1, 3, 4, -1, -1, 72, -1, -1, |
1879 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
1880 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, | |
1179ebc2 | 1881 | 95, 96, -1, -1, -1, -1, -1, 102, 103, 104, |
12472854 PB |
1882 | 105, -1, -1, 108, 109, 45, 46, -1, -1, -1, |
1883 | 50, -1, 1, -1, 3, 4, -1, -1, -1, 59, | |
1884 | -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, | |
1885 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, | |
1179ebc2 APB |
1886 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, |
1887 | 90, -1, -1, 93, -1, 95, 45, 46, -1, -1, | |
12472854 PB |
1888 | -1, 50, 102, 103, 104, 105, -1, -1, 108, 109, |
1889 | 59, -1, -1, -1, -1, -1, 65, 1, -1, 3, | |
1890 | 4, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
1891 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
1179ebc2 APB |
1892 | 89, 90, -1, -1, 93, -1, -1, -1, -1, -1, |
1893 | 99, -1, -1, 102, 103, 104, 105, -1, -1, 108, | |
12472854 PB |
1894 | 109, 45, 46, -1, -1, -1, 50, -1, 1, -1, |
1895 | 3, 4, -1, -1, -1, 59, -1, -1, -1, -1, | |
1896 | -1, 65, -1, -1, -1, -1, -1, -1, 72, -1, | |
1897 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, | |
1179ebc2 APB |
1898 | -1, 85, 86, -1, 88, 89, 90, -1, -1, 93, |
1899 | -1, -1, 45, 46, -1, -1, -1, 50, 102, 103, | |
12472854 PB |
1900 | 104, 105, -1, -1, 108, 109, 59, -1, -1, -1, |
1901 | -1, -1, 65, 1, -1, 3, 4, -1, -1, 72, | |
22eed1e6 APB |
1902 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
1903 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
1179ebc2 | 1904 | 93, -1, -1, -1, -1, 98, -1, -1, -1, 102, |
12472854 PB |
1905 | 103, 104, 105, -1, -1, 108, 109, 45, 46, -1, |
1906 | -1, -1, 50, -1, 1, -1, 3, 4, -1, -1, | |
1907 | -1, 59, -1, -1, -1, -1, -1, 65, -1, -1, | |
1908 | -1, -1, -1, -1, 72, -1, -1, -1, 76, -1, | |
1909 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
1179ebc2 APB |
1910 | -1, 89, 90, -1, -1, 93, 94, -1, 45, 46, |
1911 | -1, -1, -1, 50, 102, 103, 104, 105, -1, -1, | |
12472854 PB |
1912 | 108, 109, 59, -1, -1, -1, -1, -1, 65, 1, |
1913 | -1, 3, 4, -1, -1, 72, -1, -1, -1, 76, | |
1914 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
1179ebc2 APB |
1915 | -1, -1, 89, 90, -1, -1, 93, -1, -1, -1, |
1916 | -1, -1, 99, -1, -1, 102, 103, 104, 105, -1, | |
12472854 PB |
1917 | -1, 108, 109, 45, 46, -1, -1, -1, 50, -1, |
1918 | 1, -1, 3, 4, -1, -1, -1, 59, -1, -1, | |
1919 | -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, | |
8b27f225 PB |
1920 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
1921 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
12472854 PB |
1922 | -1, 93, -1, -1, 45, 46, 98, -1, -1, 50, |
1923 | 102, 103, 104, 105, -1, -1, 108, 109, 59, -1, | |
1924 | -1, -1, -1, -1, 65, 1, -1, 3, 4, -1, | |
22eed1e6 APB |
1925 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, |
1926 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
12472854 PB |
1927 | -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, |
1928 | -1, 102, 103, 104, 105, -1, -1, 108, 109, 45, | |
1929 | 46, -1, -1, -1, 50, -1, 1, -1, 3, 4, | |
1930 | -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, | |
1931 | -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, | |
1932 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, | |
1179ebc2 APB |
1933 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, |
1934 | 45, 46, 98, -1, -1, 50, 102, 103, 104, 105, | |
12472854 PB |
1935 | -1, -1, 108, 109, 59, -1, -1, -1, -1, -1, |
1936 | 65, 1, -1, 3, 4, -1, -1, 72, -1, -1, | |
1937 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
1938 | 85, 86, -1, -1, 89, 90, -1, -1, 93, 94, | |
1939 | -1, -1, -1, -1, -1, -1, -1, 102, 103, 104, | |
1940 | 105, -1, -1, 108, 109, 45, 46, -1, -1, -1, | |
1941 | 50, -1, 1, -1, 3, 4, -1, -1, -1, 59, | |
1942 | -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, | |
8b27f225 PB |
1943 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, |
1944 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
1179ebc2 | 1945 | 90, -1, -1, 93, 94, -1, 45, 46, -1, -1, |
12472854 PB |
1946 | -1, 50, 102, 103, 104, 105, -1, -1, 108, 109, |
1947 | 59, -1, -1, -1, -1, -1, 65, 1, -1, 3, | |
1948 | 4, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
1949 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
1179ebc2 | 1950 | 89, 90, -1, -1, 93, 94, -1, -1, -1, -1, |
12472854 PB |
1951 | -1, -1, -1, 102, 103, 104, 105, -1, -1, 108, |
1952 | 109, 45, 46, -1, -1, -1, 50, -1, 1, -1, | |
1953 | 3, 4, -1, -1, -1, 59, -1, -1, -1, -1, | |
1954 | -1, 65, -1, -1, -1, -1, -1, -1, 72, -1, | |
8b27f225 PB |
1955 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
1956 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, | |
1179ebc2 | 1957 | -1, -1, 45, 46, -1, 99, -1, 50, 102, 103, |
12472854 PB |
1958 | 104, 105, -1, -1, 108, 109, 59, -1, -1, -1, |
1959 | -1, -1, 65, 1, -1, 3, 4, -1, -1, 72, | |
8b27f225 PB |
1960 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
1961 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
12472854 PB |
1962 | 93, -1, -1, -1, -1, -1, -1, -1, -1, 102, |
1963 | 103, 104, 105, -1, -1, 108, 109, 45, 46, -1, | |
1964 | -1, -1, 50, -1, 1, -1, 3, 4, -1, -1, | |
1965 | -1, 59, -1, -1, -1, -1, -1, 65, -1, -1, | |
1966 | -1, -1, -1, -1, 72, -1, -1, -1, 76, -1, | |
1967 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
1968 | -1, 89, 90, -1, -1, 93, -1, -1, 45, 46, | |
1969 | -1, -1, -1, 50, 102, 103, 104, 105, -1, -1, | |
1970 | 108, 109, 59, -1, -1, -1, -1, -1, 65, 1, | |
1971 | -1, 3, 4, -1, -1, 72, -1, -1, -1, 76, | |
1972 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
1973 | -1, -1, 89, 90, -1, -1, 93, -1, -1, -1, | |
1974 | -1, -1, -1, -1, -1, 102, 103, 104, 105, -1, | |
1975 | -1, 108, 109, 45, 46, -1, -1, -1, 50, -1, | |
1976 | 1, -1, 3, 4, -1, -1, -1, 59, -1, -1, | |
1977 | -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, | |
8b27f225 PB |
1978 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
1979 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
12472854 PB |
1980 | -1, 93, -1, -1, 45, 46, -1, -1, -1, 50, |
1981 | 102, 103, 104, 105, -1, -1, 108, 109, 59, -1, | |
1982 | -1, -1, -1, -1, 65, 1, -1, 3, 4, -1, | |
22eed1e6 APB |
1983 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, |
1984 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
12472854 PB |
1985 | -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, |
1986 | -1, 102, 103, 104, 105, -1, -1, 108, 109, 45, | |
1987 | 46, -1, -1, -1, 50, -1, 1, -1, 3, 4, | |
1988 | -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, | |
1989 | -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, | |
1990 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, | |
1991 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, | |
1992 | 45, 46, -1, -1, -1, 50, 102, 103, 104, 105, | |
1993 | -1, -1, 108, 109, 59, -1, -1, -1, -1, -1, | |
1994 | 65, 1, -1, 3, 4, -1, -1, 72, -1, -1, | |
22eed1e6 APB |
1995 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, |
1996 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, | |
12472854 PB |
1997 | -1, -1, -1, -1, -1, -1, -1, 102, 103, 104, |
1998 | 105, -1, -1, 108, 109, 45, 46, -1, -1, -1, | |
1999 | 50, -1, 1, -1, 3, 4, -1, -1, -1, 59, | |
2000 | -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, | |
2001 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, | |
2002 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2003 | 90, -1, -1, 93, -1, -1, 45, 46, -1, -1, | |
2004 | -1, 50, 102, 103, 104, 105, -1, -1, 108, 109, | |
2005 | 59, -1, -1, -1, -1, -1, 65, 1, -1, 3, | |
2006 | 4, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
2007 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
2008 | 89, 90, -1, -1, 93, -1, -1, -1, -1, -1, | |
2009 | -1, -1, -1, 102, 103, 104, 105, -1, -1, 108, | |
2010 | 109, 45, 46, -1, -1, -1, 50, -1, 1, -1, | |
2011 | 3, 4, -1, -1, -1, 59, -1, -1, -1, -1, | |
2012 | -1, 65, -1, -1, -1, -1, -1, -1, 72, -1, | |
8b27f225 PB |
2013 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
2014 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, | |
12472854 PB |
2015 | -1, -1, 45, 46, -1, -1, -1, 50, 102, 103, |
2016 | 104, 105, -1, -1, 108, 109, 59, -1, -1, -1, | |
2017 | -1, -1, 65, 1, -1, 3, 4, -1, -1, 72, | |
8b27f225 PB |
2018 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
2019 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
12472854 PB |
2020 | 93, -1, -1, -1, -1, -1, -1, -1, -1, 102, |
2021 | 103, 104, 105, -1, -1, 108, 109, 45, 46, -1, | |
2022 | -1, -1, 50, -1, 1, -1, 3, 4, -1, -1, | |
2023 | -1, 59, -1, -1, -1, -1, -1, 65, -1, -1, | |
2024 | -1, -1, -1, -1, 72, -1, -1, -1, 76, -1, | |
2025 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
2026 | -1, 89, 90, -1, -1, 93, -1, -1, 45, 46, | |
2027 | -1, -1, -1, 50, 102, 103, 104, 105, -1, -1, | |
2028 | 108, 109, 59, -1, -1, -1, -1, -1, 65, 1, | |
2029 | -1, 3, 4, -1, -1, 72, -1, -1, -1, 76, | |
2030 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
2031 | -1, -1, 89, 90, -1, -1, 93, -1, -1, -1, | |
2032 | -1, -1, -1, -1, -1, 102, 103, 104, 105, -1, | |
2033 | -1, 108, 109, 45, 46, -1, -1, -1, 50, -1, | |
2034 | 1, -1, 3, 4, -1, -1, -1, 59, -1, -1, | |
2035 | -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, | |
8b27f225 PB |
2036 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
2037 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
12472854 PB |
2038 | -1, 93, -1, -1, 45, 46, -1, -1, -1, 50, |
2039 | 102, 103, 104, 105, -1, -1, 108, 109, 59, -1, | |
2040 | -1, -1, -1, -1, 65, 1, -1, 3, 4, -1, | |
22eed1e6 APB |
2041 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, |
2042 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
12472854 PB |
2043 | -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, |
2044 | -1, 102, 103, 104, 105, -1, -1, 108, 109, 45, | |
2045 | 46, -1, -1, -1, 50, -1, 1, -1, 3, 4, | |
2046 | -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, | |
2047 | -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, | |
2048 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, | |
2049 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, | |
2050 | 45, 46, -1, -1, -1, 50, 102, 103, 104, 105, | |
2051 | -1, -1, 108, 109, 59, -1, -1, -1, -1, -1, | |
2052 | 65, 1, -1, 3, 4, -1, -1, 72, -1, -1, | |
22eed1e6 APB |
2053 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, |
2054 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, | |
12472854 PB |
2055 | -1, -1, -1, -1, -1, -1, -1, 102, 103, 104, |
2056 | 105, -1, -1, 108, 109, 45, 46, -1, -1, -1, | |
2057 | 50, -1, 1, -1, 3, 4, -1, -1, -1, 59, | |
2058 | -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, | |
2059 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, | |
2060 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2061 | 90, -1, -1, 93, -1, -1, 45, 46, -1, -1, | |
2062 | -1, 50, 102, 103, 104, 105, -1, -1, 108, 109, | |
2063 | 59, -1, -1, -1, -1, -1, 65, 1, -1, 3, | |
2064 | 4, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
2065 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
2066 | 89, 90, -1, -1, 93, -1, -1, -1, -1, -1, | |
2067 | -1, -1, -1, 102, 103, 104, 105, -1, -1, 108, | |
2068 | 109, 45, 46, -1, -1, -1, 50, -1, 1, -1, | |
2069 | 3, 4, -1, -1, -1, 59, -1, -1, -1, -1, | |
2070 | -1, 65, -1, -1, -1, -1, -1, -1, 72, -1, | |
8b27f225 PB |
2071 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
2072 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, | |
12472854 PB |
2073 | -1, -1, 45, 46, -1, -1, -1, 50, 102, 103, |
2074 | 104, 105, -1, -1, 108, 109, 59, -1, -1, -1, | |
2075 | -1, -1, 65, 1, -1, 3, 4, -1, -1, 72, | |
8b27f225 PB |
2076 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
2077 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
12472854 PB |
2078 | 93, -1, -1, -1, -1, -1, -1, -1, -1, 102, |
2079 | 103, 104, 105, -1, -1, 108, 109, 45, 46, -1, | |
2080 | -1, -1, 50, -1, 1, -1, 3, 4, -1, -1, | |
2081 | -1, 59, -1, -1, -1, -1, -1, 65, -1, -1, | |
2082 | -1, -1, -1, -1, 72, -1, -1, -1, 76, -1, | |
2083 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
2084 | -1, 89, 90, -1, -1, 93, -1, -1, 45, 46, | |
2085 | -1, -1, -1, 50, 102, 103, 104, 105, -1, -1, | |
2086 | 108, 109, 59, -1, -1, -1, -1, -1, 65, 1, | |
2087 | -1, 3, 4, -1, -1, 72, -1, -1, -1, 76, | |
2088 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
2089 | -1, -1, 89, 90, -1, -1, 93, -1, -1, -1, | |
2090 | -1, -1, -1, -1, -1, 102, 103, 104, 105, -1, | |
2091 | -1, 108, 109, 45, 46, -1, -1, -1, 50, -1, | |
2092 | 1, -1, 3, 4, -1, -1, -1, 59, -1, -1, | |
2093 | -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, | |
8b27f225 PB |
2094 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
2095 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
12472854 PB |
2096 | -1, 93, -1, -1, 45, 46, -1, -1, -1, 50, |
2097 | 102, 103, 104, 105, -1, -1, 108, 109, 59, -1, | |
2098 | -1, -1, -1, -1, 65, 1, -1, 3, 4, -1, | |
22eed1e6 APB |
2099 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, |
2100 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
12472854 PB |
2101 | -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, |
2102 | -1, 102, 103, 104, 105, -1, -1, 108, 109, 45, | |
2103 | 46, -1, -1, -1, 50, -1, 1, -1, 3, 4, | |
2104 | -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, | |
2105 | -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, | |
2106 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, | |
2107 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, | |
2108 | 45, 46, -1, -1, -1, 50, 102, 103, 104, 105, | |
2109 | -1, -1, 108, 109, 59, -1, -1, -1, -1, -1, | |
2110 | 65, 1, -1, 3, 4, -1, -1, 72, -1, -1, | |
22eed1e6 APB |
2111 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, |
2112 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, | |
12472854 PB |
2113 | -1, -1, -1, -1, -1, -1, -1, 102, 103, 104, |
2114 | 105, -1, -1, 108, 109, 45, 46, -1, -1, -1, | |
2115 | 50, -1, 1, -1, 3, 4, -1, -1, -1, 59, | |
2116 | -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, | |
2117 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, | |
2118 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2119 | 90, -1, -1, 93, -1, -1, 45, 46, -1, -1, | |
2120 | -1, 50, 102, 103, 104, 105, -1, -1, 108, 109, | |
2121 | 59, -1, -1, -1, -1, -1, 65, 1, -1, 3, | |
2122 | 4, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
2123 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
2124 | 89, 90, -1, -1, 93, -1, -1, -1, -1, -1, | |
2125 | -1, -1, -1, 102, 103, 104, 105, -1, -1, 108, | |
2126 | 109, 45, 46, -1, -1, -1, 50, -1, 1, -1, | |
2127 | 3, 4, -1, -1, -1, 59, -1, -1, -1, -1, | |
2128 | -1, 65, -1, -1, -1, -1, -1, -1, 72, -1, | |
8b27f225 PB |
2129 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
2130 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, | |
12472854 PB |
2131 | -1, -1, 45, 46, -1, -1, -1, 50, 102, 103, |
2132 | 104, 105, -1, -1, 108, 109, 59, -1, -1, -1, | |
2133 | -1, -1, 65, 1, -1, 3, 4, -1, -1, 72, | |
8b27f225 PB |
2134 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
2135 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
12472854 PB |
2136 | 93, -1, -1, -1, -1, -1, -1, -1, -1, 102, |
2137 | 103, 104, 105, -1, -1, 108, 109, 45, 46, -1, | |
2138 | -1, -1, 50, -1, 1, -1, 3, 4, -1, -1, | |
2139 | -1, 59, -1, -1, -1, -1, -1, 65, -1, -1, | |
2140 | -1, -1, -1, -1, 72, -1, -1, -1, 76, -1, | |
2141 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
2142 | -1, 89, 90, -1, -1, 93, -1, -1, 45, 46, | |
2143 | -1, -1, -1, 50, 102, 103, 104, 105, -1, -1, | |
2144 | 108, 109, 59, -1, -1, -1, -1, -1, 65, 1, | |
2145 | -1, 3, 4, -1, -1, 72, -1, -1, -1, 76, | |
2146 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
2147 | -1, -1, 89, 90, -1, -1, 93, -1, -1, -1, | |
2148 | -1, -1, -1, -1, -1, 102, 103, 104, 105, -1, | |
2149 | -1, 108, 109, 45, 46, -1, -1, -1, 50, -1, | |
2150 | 1, -1, 3, 4, -1, -1, -1, 59, -1, -1, | |
2151 | -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, | |
8b27f225 PB |
2152 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
2153 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
12472854 PB |
2154 | -1, 93, -1, -1, 45, 46, -1, -1, -1, 50, |
2155 | 102, 103, 104, 105, -1, -1, 108, 109, 59, -1, | |
2156 | -1, -1, -1, -1, 65, 1, -1, 3, 4, -1, | |
22eed1e6 APB |
2157 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, |
2158 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
12472854 PB |
2159 | -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, |
2160 | -1, 102, 103, 104, 105, -1, -1, 108, 109, 45, | |
2161 | 46, -1, -1, -1, 50, -1, 1, -1, 3, 4, | |
2162 | -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, | |
2163 | -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, | |
2164 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, | |
1179ebc2 | 2165 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, |
12472854 PB |
2166 | 45, 46, -1, -1, -1, 50, 102, 103, 104, 105, |
2167 | -1, -1, 108, 109, 59, -1, -1, -1, -1, -1, | |
1179ebc2 | 2168 | 65, 1, -1, 3, 4, -1, -1, 72, -1, -1, |
22eed1e6 | 2169 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, |
1179ebc2 APB |
2170 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, |
2171 | -1, -1, -1, -1, -1, -1, -1, 102, 103, 104, | |
2172 | 105, -1, -1, 108, 109, 45, 46, -1, -1, -1, | |
2173 | 50, -1, 1, -1, 3, 4, -1, -1, -1, 59, | |
2174 | -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, | |
2175 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, | |
2176 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2177 | 90, -1, -1, 93, -1, -1, 45, 46, -1, -1, | |
2178 | -1, 50, 102, 103, 104, 105, -1, -1, 108, 109, | |
2179 | 59, -1, -1, -1, -1, -1, 65, -1, 1, -1, | |
2180 | -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
2181 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
2182 | 89, 90, -1, 1, 93, -1, -1, -1, -1, -1, | |
2183 | -1, -1, -1, 102, 103, 104, 105, -1, -1, 108, | |
2184 | 109, 44, 45, 46, -1, -1, -1, 50, -1, -1, | |
2185 | -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, | |
2186 | -1, -1, 65, -1, -1, 1, -1, 45, 46, 72, | |
12472854 PB |
2187 | -1, -1, 50, 76, -1, -1, -1, -1, -1, 82, |
2188 | -1, 59, 85, 86, -1, -1, -1, 65, -1, -1, | |
1179ebc2 | 2189 | 93, -1, -1, -1, 72, -1, 99, -1, 76, 102, |
12472854 | 2190 | 103, 104, 105, -1, 82, 108, 109, 85, 86, 45, |
1179ebc2 | 2191 | 46, -1, -1, -1, 50, 93, 94, -1, -1, -1, |
12472854 | 2192 | -1, -1, -1, 59, 102, 103, 104, 105, -1, 65, |
1179ebc2 | 2193 | 108, 109, 1, -1, -1, -1, 72, -1, -1, -1, |
12472854 | 2194 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, |
1179ebc2 APB |
2195 | 86, -1, -1, -1, -1, -1, -1, 93, 94, -1, |
2196 | -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, | |
2197 | -1, -1, 108, 109, 1, -1, 45, 46, -1, -1, | |
2198 | -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, | |
2199 | 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, | |
2200 | -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
2201 | -1, -1, -1, 82, -1, -1, 85, 86, 3, 4, | |
2202 | -1, -1, -1, 50, 93, -1, -1, -1, -1, -1, | |
2203 | -1, -1, 59, 102, 103, 104, 105, -1, 65, 108, | |
2204 | 109, -1, -1, -1, -1, 72, -1, -1, -1, 76, | |
2205 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
2206 | 45, 46, 89, 90, -1, 50, 93, -1, -1, -1, | |
2207 | -1, -1, -1, -1, 59, 102, 103, 104, 105, -1, | |
2208 | 65, 108, 109, 3, 4, -1, -1, 72, -1, -1, | |
2209 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
2210 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, | |
2211 | 95, 96, -1, -1, -1, -1, -1, 102, 103, 104, | |
2212 | 105, -1, -1, 108, 109, 45, 46, -1, -1, -1, | |
2213 | 50, -1, -1, -1, 3, 4, -1, -1, -1, 59, | |
2214 | -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, | |
2215 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, | |
2216 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2217 | 90, -1, -1, 93, 94, -1, 45, 46, -1, -1, | |
2218 | -1, 50, 102, 103, 104, 105, -1, -1, 108, 109, | |
2219 | 59, -1, -1, -1, -1, -1, 65, -1, -1, 3, | |
12472854 PB |
2220 | 4, -1, -1, 72, -1, -1, -1, 76, -1, -1, |
2221 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
1179ebc2 | 2222 | 89, 90, -1, -1, 93, 94, -1, -1, -1, -1, |
12472854 PB |
2223 | -1, -1, -1, 102, 103, 104, 105, -1, -1, 108, |
2224 | 109, 45, 46, -1, -1, -1, 50, -1, -1, -1, | |
1179ebc2 APB |
2225 | 3, 4, -1, -1, -1, 59, -1, -1, -1, -1, |
2226 | -1, 65, -1, -1, -1, -1, -1, -1, 72, -1, | |
8b27f225 PB |
2227 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
2228 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, | |
1179ebc2 APB |
2229 | 94, -1, 45, 46, -1, -1, -1, 50, 102, 103, |
2230 | 104, 105, -1, -1, 108, 109, 59, -1, -1, -1, | |
2231 | -1, -1, 65, -1, -1, 3, 4, -1, -1, 72, | |
22eed1e6 APB |
2232 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
2233 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
1179ebc2 APB |
2234 | 93, 94, -1, -1, -1, -1, -1, -1, -1, 102, |
2235 | 103, 104, 105, -1, -1, 108, 109, 45, 46, -1, | |
2236 | -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, | |
2237 | -1, 59, -1, -1, -1, -1, -1, 65, -1, -1, | |
2238 | -1, -1, -1, -1, 72, -1, -1, -1, 76, -1, | |
2239 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
2240 | -1, 89, 90, -1, -1, 93, -1, 44, 45, 46, | |
2241 | -1, -1, -1, 50, 102, 103, 104, 105, -1, -1, | |
2242 | 108, 109, 59, -1, -1, -1, -1, -1, 65, -1, | |
2243 | -1, -1, -1, -1, -1, 72, -1, -1, 50, 76, | |
2244 | -1, -1, -1, -1, -1, 82, -1, 59, 85, 86, | |
2245 | -1, -1, -1, 65, -1, -1, 93, -1, -1, -1, | |
2246 | 72, -1, -1, -1, 76, 102, 103, 104, 105, -1, | |
2247 | 82, 108, 109, 85, 86, -1, -1, 89, 90, -1, | |
2248 | -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, | |
2249 | 102, 103, 104, 105, -1, -1, 108, 109 | |
8b27f225 PB |
2250 | }; |
2251 | #define YYPURE 1 | |
2252 | ||
2253 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | |
22eed1e6 | 2254 | #line 3 "/usr/cygnus/gnupro-98r1/share/bison.simple" |
8b27f225 PB |
2255 | |
2256 | /* Skeleton output parser for bison, | |
2257 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | |
2258 | ||
2259 | This program is free software; you can redistribute it and/or modify | |
2260 | it under the terms of the GNU General Public License as published by | |
2261 | the Free Software Foundation; either version 2, or (at your option) | |
2262 | any later version. | |
2263 | ||
2264 | This program is distributed in the hope that it will be useful, | |
2265 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
2266 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
2267 | GNU General Public License for more details. | |
2268 | ||
2269 | You should have received a copy of the GNU General Public License | |
2270 | along with this program; if not, write to the Free Software | |
2271 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
2272 | ||
2273 | /* As a special exception, when this file is copied by Bison into a | |
2274 | Bison output file, you may use that output file without restriction. | |
2275 | This special exception was added by the Free Software Foundation | |
2276 | in version 1.24 of Bison. */ | |
2277 | ||
2278 | #ifndef alloca | |
2279 | #ifdef __GNUC__ | |
2280 | #define alloca __builtin_alloca | |
2281 | #else /* not GNU C. */ | |
2282 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) | |
2283 | #include <alloca.h> | |
2284 | #else /* not sparc */ | |
2285 | #if defined (MSDOS) && !defined (__TURBOC__) | |
2286 | #include <malloc.h> | |
2287 | #else /* not MSDOS, or __TURBOC__ */ | |
2288 | #if defined(_AIX) | |
2289 | #include <malloc.h> | |
2290 | #pragma alloca | |
2291 | #else /* not MSDOS, __TURBOC__, or _AIX */ | |
2292 | #ifdef __hpux | |
2293 | #ifdef __cplusplus | |
2294 | extern "C" { | |
2295 | void *alloca (unsigned int); | |
2296 | }; | |
2297 | #else /* not __cplusplus */ | |
2298 | void *alloca (); | |
2299 | #endif /* not __cplusplus */ | |
2300 | #endif /* __hpux */ | |
2301 | #endif /* not _AIX */ | |
2302 | #endif /* not MSDOS, or __TURBOC__ */ | |
2303 | #endif /* not sparc. */ | |
2304 | #endif /* not GNU C. */ | |
2305 | #endif /* alloca not defined. */ | |
2306 | ||
2307 | /* This is the parser code that is written into each bison parser | |
2308 | when the %semantic_parser declaration is not specified in the grammar. | |
2309 | It was written by Richard Stallman by simplifying the hairy parser | |
2310 | used when %semantic_parser is specified. */ | |
2311 | ||
2312 | /* Note: there must be only one dollar sign in this file. | |
2313 | It is replaced by the list of actions, each action | |
2314 | as one case of the switch. */ | |
2315 | ||
2316 | #define yyerrok (yyerrstatus = 0) | |
2317 | #define yyclearin (yychar = YYEMPTY) | |
2318 | #define YYEMPTY -2 | |
2319 | #define YYEOF 0 | |
2320 | #define YYACCEPT return(0) | |
2321 | #define YYABORT return(1) | |
2322 | #define YYERROR goto yyerrlab1 | |
2323 | /* Like YYERROR except do call yyerror. | |
2324 | This remains here temporarily to ease the | |
2325 | transition to the new meaning of YYERROR, for GCC. | |
2326 | Once GCC version 2 has supplanted version 1, this can go. */ | |
2327 | #define YYFAIL goto yyerrlab | |
2328 | #define YYRECOVERING() (!!yyerrstatus) | |
2329 | #define YYBACKUP(token, value) \ | |
2330 | do \ | |
2331 | if (yychar == YYEMPTY && yylen == 1) \ | |
2332 | { yychar = (token), yylval = (value); \ | |
2333 | yychar1 = YYTRANSLATE (yychar); \ | |
2334 | YYPOPSTACK; \ | |
2335 | goto yybackup; \ | |
2336 | } \ | |
2337 | else \ | |
2338 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ | |
2339 | while (0) | |
2340 | ||
2341 | #define YYTERROR 1 | |
2342 | #define YYERRCODE 256 | |
2343 | ||
2344 | #ifndef YYPURE | |
2345 | #define YYLEX yylex() | |
2346 | #endif | |
2347 | ||
2348 | #ifdef YYPURE | |
2349 | #ifdef YYLSP_NEEDED | |
2350 | #ifdef YYLEX_PARAM | |
2351 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) | |
2352 | #else | |
2353 | #define YYLEX yylex(&yylval, &yylloc) | |
2354 | #endif | |
2355 | #else /* not YYLSP_NEEDED */ | |
2356 | #ifdef YYLEX_PARAM | |
2357 | #define YYLEX yylex(&yylval, YYLEX_PARAM) | |
2358 | #else | |
2359 | #define YYLEX yylex(&yylval) | |
2360 | #endif | |
2361 | #endif /* not YYLSP_NEEDED */ | |
2362 | #endif | |
2363 | ||
2364 | /* If nonreentrant, generate the variables here */ | |
2365 | ||
2366 | #ifndef YYPURE | |
2367 | ||
2368 | int yychar; /* the lookahead symbol */ | |
2369 | YYSTYPE yylval; /* the semantic value of the */ | |
2370 | /* lookahead symbol */ | |
2371 | ||
2372 | #ifdef YYLSP_NEEDED | |
2373 | YYLTYPE yylloc; /* location data for the lookahead */ | |
2374 | /* symbol */ | |
2375 | #endif | |
2376 | ||
2377 | int yynerrs; /* number of parse errors so far */ | |
2378 | #endif /* not YYPURE */ | |
2379 | ||
2380 | #if YYDEBUG != 0 | |
2381 | int yydebug; /* nonzero means print parse trace */ | |
2382 | /* Since this is uninitialized, it does not stop multiple parsers | |
2383 | from coexisting. */ | |
2384 | #endif | |
2385 | ||
2386 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ | |
2387 | ||
2388 | #ifndef YYINITDEPTH | |
2389 | #define YYINITDEPTH 200 | |
2390 | #endif | |
2391 | ||
2392 | /* YYMAXDEPTH is the maximum size the stacks can grow to | |
2393 | (effective only if the built-in stack extension method is used). */ | |
2394 | ||
2395 | #if YYMAXDEPTH == 0 | |
2396 | #undef YYMAXDEPTH | |
2397 | #endif | |
2398 | ||
2399 | #ifndef YYMAXDEPTH | |
2400 | #define YYMAXDEPTH 10000 | |
2401 | #endif | |
2402 | ||
2403 | /* Prevent warning if -Wstrict-prototypes. */ | |
2404 | #ifdef __GNUC__ | |
2405 | int yyparse (void); | |
2406 | #endif | |
2407 | \f | |
2408 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ | |
2409 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) | |
2410 | #else /* not GNU C or C++ */ | |
2411 | #ifndef __cplusplus | |
2412 | ||
2413 | /* This is the most reliable way to avoid incompatibilities | |
2414 | in available built-in functions on various systems. */ | |
2415 | static void | |
2416 | __yy_memcpy (to, from, count) | |
2417 | char *to; | |
2418 | char *from; | |
2419 | int count; | |
2420 | { | |
2421 | register char *f = from; | |
2422 | register char *t = to; | |
2423 | register int i = count; | |
2424 | ||
2425 | while (i-- > 0) | |
2426 | *t++ = *f++; | |
2427 | } | |
2428 | ||
2429 | #else /* __cplusplus */ | |
2430 | ||
2431 | /* This is the most reliable way to avoid incompatibilities | |
2432 | in available built-in functions on various systems. */ | |
2433 | static void | |
2434 | __yy_memcpy (char *to, char *from, int count) | |
2435 | { | |
2436 | register char *f = from; | |
2437 | register char *t = to; | |
2438 | register int i = count; | |
2439 | ||
2440 | while (i-- > 0) | |
2441 | *t++ = *f++; | |
2442 | } | |
2443 | ||
2444 | #endif | |
2445 | #endif | |
2446 | \f | |
22eed1e6 | 2447 | #line 196 "/usr/cygnus/gnupro-98r1/share/bison.simple" |
8b27f225 PB |
2448 | |
2449 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
2450 | into yyparse. The argument should have type void *. | |
2451 | It should actually point to an object. | |
2452 | Grammar actions can access the variable by casting it | |
2453 | to the proper pointer type. */ | |
2454 | ||
2455 | #ifdef YYPARSE_PARAM | |
2456 | #ifdef __cplusplus | |
2457 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
2458 | #define YYPARSE_PARAM_DECL | |
2459 | #else /* not __cplusplus */ | |
2460 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM | |
2461 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
2462 | #endif /* not __cplusplus */ | |
2463 | #else /* not YYPARSE_PARAM */ | |
2464 | #define YYPARSE_PARAM_ARG | |
2465 | #define YYPARSE_PARAM_DECL | |
2466 | #endif /* not YYPARSE_PARAM */ | |
2467 | ||
2468 | int | |
2469 | yyparse(YYPARSE_PARAM_ARG) | |
2470 | YYPARSE_PARAM_DECL | |
2471 | { | |
2472 | register int yystate; | |
2473 | register int yyn; | |
2474 | register short *yyssp; | |
2475 | register YYSTYPE *yyvsp; | |
2476 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ | |
2477 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ | |
2478 | ||
2479 | short yyssa[YYINITDEPTH]; /* the state stack */ | |
2480 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ | |
2481 | ||
2482 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ | |
2483 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ | |
2484 | ||
2485 | #ifdef YYLSP_NEEDED | |
2486 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ | |
2487 | YYLTYPE *yyls = yylsa; | |
2488 | YYLTYPE *yylsp; | |
2489 | ||
2490 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | |
2491 | #else | |
2492 | #define YYPOPSTACK (yyvsp--, yyssp--) | |
2493 | #endif | |
2494 | ||
2495 | int yystacksize = YYINITDEPTH; | |
2496 | ||
2497 | #ifdef YYPURE | |
2498 | int yychar; | |
2499 | YYSTYPE yylval; | |
2500 | int yynerrs; | |
2501 | #ifdef YYLSP_NEEDED | |
2502 | YYLTYPE yylloc; | |
2503 | #endif | |
2504 | #endif | |
2505 | ||
2506 | YYSTYPE yyval; /* the variable used to return */ | |
2507 | /* semantic values from the action */ | |
2508 | /* routines */ | |
2509 | ||
2510 | int yylen; | |
2511 | ||
2512 | #if YYDEBUG != 0 | |
2513 | if (yydebug) | |
2514 | fprintf(stderr, "Starting parse\n"); | |
2515 | #endif | |
2516 | ||
2517 | yystate = 0; | |
2518 | yyerrstatus = 0; | |
2519 | yynerrs = 0; | |
2520 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
2521 | ||
2522 | /* Initialize stack pointers. | |
2523 | Waste one element of value and location stack | |
2524 | so that they stay on the same level as the state stack. | |
2525 | The wasted elements are never initialized. */ | |
2526 | ||
2527 | yyssp = yyss - 1; | |
2528 | yyvsp = yyvs; | |
2529 | #ifdef YYLSP_NEEDED | |
2530 | yylsp = yyls; | |
2531 | #endif | |
2532 | ||
2533 | /* Push a new state, which is found in yystate . */ | |
2534 | /* In all cases, when you get here, the value and location stacks | |
2535 | have just been pushed. so pushing a state here evens the stacks. */ | |
2536 | yynewstate: | |
2537 | ||
2538 | *++yyssp = yystate; | |
2539 | ||
2540 | if (yyssp >= yyss + yystacksize - 1) | |
2541 | { | |
2542 | /* Give user a chance to reallocate the stack */ | |
2543 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | |
2544 | YYSTYPE *yyvs1 = yyvs; | |
2545 | short *yyss1 = yyss; | |
2546 | #ifdef YYLSP_NEEDED | |
2547 | YYLTYPE *yyls1 = yyls; | |
2548 | #endif | |
2549 | ||
2550 | /* Get the current used size of the three stacks, in elements. */ | |
2551 | int size = yyssp - yyss + 1; | |
2552 | ||
2553 | #ifdef yyoverflow | |
2554 | /* Each stack pointer address is followed by the size of | |
2555 | the data in use in that stack, in bytes. */ | |
2556 | #ifdef YYLSP_NEEDED | |
2557 | /* This used to be a conditional around just the two extra args, | |
2558 | but that might be undefined if yyoverflow is a macro. */ | |
2559 | yyoverflow("parser stack overflow", | |
2560 | &yyss1, size * sizeof (*yyssp), | |
2561 | &yyvs1, size * sizeof (*yyvsp), | |
2562 | &yyls1, size * sizeof (*yylsp), | |
2563 | &yystacksize); | |
2564 | #else | |
2565 | yyoverflow("parser stack overflow", | |
2566 | &yyss1, size * sizeof (*yyssp), | |
2567 | &yyvs1, size * sizeof (*yyvsp), | |
2568 | &yystacksize); | |
2569 | #endif | |
2570 | ||
2571 | yyss = yyss1; yyvs = yyvs1; | |
2572 | #ifdef YYLSP_NEEDED | |
2573 | yyls = yyls1; | |
2574 | #endif | |
2575 | #else /* no yyoverflow */ | |
2576 | /* Extend the stack our own way. */ | |
2577 | if (yystacksize >= YYMAXDEPTH) | |
2578 | { | |
2579 | yyerror("parser stack overflow"); | |
2580 | return 2; | |
2581 | } | |
2582 | yystacksize *= 2; | |
2583 | if (yystacksize > YYMAXDEPTH) | |
2584 | yystacksize = YYMAXDEPTH; | |
2585 | yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); | |
2586 | __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); | |
2587 | yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); | |
2588 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); | |
2589 | #ifdef YYLSP_NEEDED | |
2590 | yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); | |
2591 | __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); | |
2592 | #endif | |
2593 | #endif /* no yyoverflow */ | |
2594 | ||
2595 | yyssp = yyss + size - 1; | |
2596 | yyvsp = yyvs + size - 1; | |
2597 | #ifdef YYLSP_NEEDED | |
2598 | yylsp = yyls + size - 1; | |
2599 | #endif | |
2600 | ||
2601 | #if YYDEBUG != 0 | |
2602 | if (yydebug) | |
2603 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | |
2604 | #endif | |
2605 | ||
2606 | if (yyssp >= yyss + yystacksize - 1) | |
2607 | YYABORT; | |
2608 | } | |
2609 | ||
2610 | #if YYDEBUG != 0 | |
2611 | if (yydebug) | |
2612 | fprintf(stderr, "Entering state %d\n", yystate); | |
2613 | #endif | |
2614 | ||
2615 | goto yybackup; | |
2616 | yybackup: | |
2617 | ||
2618 | /* Do appropriate processing given the current state. */ | |
2619 | /* Read a lookahead token if we need one and don't already have one. */ | |
2620 | /* yyresume: */ | |
2621 | ||
2622 | /* First try to decide what to do without reference to lookahead token. */ | |
2623 | ||
2624 | yyn = yypact[yystate]; | |
2625 | if (yyn == YYFLAG) | |
2626 | goto yydefault; | |
2627 | ||
2628 | /* Not known => get a lookahead token if don't already have one. */ | |
2629 | ||
2630 | /* yychar is either YYEMPTY or YYEOF | |
2631 | or a valid token in external form. */ | |
2632 | ||
2633 | if (yychar == YYEMPTY) | |
2634 | { | |
2635 | #if YYDEBUG != 0 | |
2636 | if (yydebug) | |
2637 | fprintf(stderr, "Reading a token: "); | |
2638 | #endif | |
2639 | yychar = YYLEX; | |
2640 | } | |
2641 | ||
2642 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
2643 | ||
2644 | if (yychar <= 0) /* This means end of input. */ | |
2645 | { | |
2646 | yychar1 = 0; | |
2647 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
2648 | ||
2649 | #if YYDEBUG != 0 | |
2650 | if (yydebug) | |
2651 | fprintf(stderr, "Now at end of input.\n"); | |
2652 | #endif | |
2653 | } | |
2654 | else | |
2655 | { | |
2656 | yychar1 = YYTRANSLATE(yychar); | |
2657 | ||
2658 | #if YYDEBUG != 0 | |
2659 | if (yydebug) | |
2660 | { | |
2661 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | |
2662 | /* Give the individual parser a way to print the precise meaning | |
2663 | of a token, for further debugging info. */ | |
2664 | #ifdef YYPRINT | |
2665 | YYPRINT (stderr, yychar, yylval); | |
2666 | #endif | |
2667 | fprintf (stderr, ")\n"); | |
2668 | } | |
2669 | #endif | |
2670 | } | |
2671 | ||
2672 | yyn += yychar1; | |
2673 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
2674 | goto yydefault; | |
2675 | ||
2676 | yyn = yytable[yyn]; | |
2677 | ||
2678 | /* yyn is what to do for this token type in this state. | |
2679 | Negative => reduce, -yyn is rule number. | |
2680 | Positive => shift, yyn is new state. | |
2681 | New state is final state => don't bother to shift, | |
2682 | just return success. | |
2683 | 0, or most negative number => error. */ | |
2684 | ||
2685 | if (yyn < 0) | |
2686 | { | |
2687 | if (yyn == YYFLAG) | |
2688 | goto yyerrlab; | |
2689 | yyn = -yyn; | |
2690 | goto yyreduce; | |
2691 | } | |
2692 | else if (yyn == 0) | |
2693 | goto yyerrlab; | |
2694 | ||
2695 | if (yyn == YYFINAL) | |
2696 | YYACCEPT; | |
2697 | ||
2698 | /* Shift the lookahead token. */ | |
2699 | ||
2700 | #if YYDEBUG != 0 | |
2701 | if (yydebug) | |
2702 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | |
2703 | #endif | |
2704 | ||
2705 | /* Discard the token being shifted unless it is eof. */ | |
2706 | if (yychar != YYEOF) | |
2707 | yychar = YYEMPTY; | |
2708 | ||
2709 | *++yyvsp = yylval; | |
2710 | #ifdef YYLSP_NEEDED | |
2711 | *++yylsp = yylloc; | |
2712 | #endif | |
2713 | ||
2714 | /* count tokens shifted since error; after three, turn off error status. */ | |
2715 | if (yyerrstatus) yyerrstatus--; | |
2716 | ||
2717 | yystate = yyn; | |
2718 | goto yynewstate; | |
2719 | ||
2720 | /* Do the default action for the current state. */ | |
2721 | yydefault: | |
2722 | ||
2723 | yyn = yydefact[yystate]; | |
2724 | if (yyn == 0) | |
2725 | goto yyerrlab; | |
2726 | ||
2727 | /* Do a reduction. yyn is the number of a rule to reduce with. */ | |
2728 | yyreduce: | |
2729 | yylen = yyr2[yyn]; | |
2730 | if (yylen > 0) | |
2731 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | |
2732 | ||
2733 | #if YYDEBUG != 0 | |
2734 | if (yydebug) | |
2735 | { | |
2736 | int i; | |
2737 | ||
2738 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
2739 | yyn, yyrline[yyn]); | |
2740 | ||
2741 | /* Print the symbols being reduced, and their result. */ | |
2742 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
2743 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
2744 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
2745 | } | |
2746 | #endif | |
2747 | ||
2748 | ||
2749 | switch (yyn) { | |
2750 | ||
2751 | case 1: | |
5b09b33e | 2752 | #line 442 "./parse.y" |
8b27f225 PB |
2753 | {; |
2754 | break;} | |
2755 | case 18: | |
5b09b33e | 2756 | #line 486 "./parse.y" |
8b27f225 PB |
2757 | { |
2758 | yyval.node = build_java_array_type (yyvsp[-2].node, -1); | |
2759 | CLASS_LOADED_P (yyval.node) = 1; | |
2760 | ; | |
2761 | break;} | |
2762 | case 19: | |
5b09b33e | 2763 | #line 491 "./parse.y" |
8b27f225 PB |
2764 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; |
2765 | break;} | |
2766 | case 20: | |
5b09b33e | 2767 | #line 493 "./parse.y" |
8b27f225 PB |
2768 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; |
2769 | break;} | |
2770 | case 21: | |
5b09b33e | 2771 | #line 495 "./parse.y" |
8b27f225 PB |
2772 | {RULE ("']' expected"); RECOVER;; |
2773 | break;} | |
2774 | case 22: | |
5b09b33e | 2775 | #line 497 "./parse.y" |
8b27f225 PB |
2776 | {RULE ("']' expected"); RECOVER;; |
2777 | break;} | |
2778 | case 26: | |
5b09b33e | 2779 | #line 512 "./parse.y" |
8b27f225 PB |
2780 | { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ; |
2781 | break;} | |
2782 | case 28: | |
5b09b33e | 2783 | #line 521 "./parse.y" |
8b27f225 PB |
2784 | {yyval.node = NULL;; |
2785 | break;} | |
2786 | case 36: | |
5b09b33e | 2787 | #line 533 "./parse.y" |
8b27f225 PB |
2788 | { |
2789 | yyval.node = NULL; | |
2790 | ; | |
2791 | break;} | |
2792 | case 37: | |
5b09b33e | 2793 | #line 537 "./parse.y" |
8b27f225 PB |
2794 | { |
2795 | yyval.node = NULL; | |
2796 | ; | |
2797 | break;} | |
2798 | case 40: | |
5b09b33e | 2799 | #line 549 "./parse.y" |
8b27f225 PB |
2800 | { ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ; |
2801 | break;} | |
2802 | case 41: | |
5b09b33e | 2803 | #line 551 "./parse.y" |
8b27f225 PB |
2804 | {yyerror ("Missing name"); RECOVER;; |
2805 | break;} | |
2806 | case 42: | |
5b09b33e | 2807 | #line 553 "./parse.y" |
8b27f225 PB |
2808 | {yyerror ("';' expected"); RECOVER;; |
2809 | break;} | |
2810 | case 45: | |
5b09b33e | 2811 | #line 563 "./parse.y" |
8b27f225 PB |
2812 | { |
2813 | tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name; | |
2814 | int i = IDENTIFIER_LENGTH (name)-1; | |
2815 | char *last = &IDENTIFIER_POINTER (name)[i]; | |
2816 | while (last != IDENTIFIER_POINTER (name)) | |
2817 | { | |
2818 | if (last [0] == '.') | |
2819 | break; | |
2820 | last--; | |
2821 | } | |
2822 | last_name = get_identifier (++last); | |
2823 | if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name)) | |
2824 | { | |
2825 | tree err = find_name_in_single_imports (last_name); | |
2826 | if (err && err != name) | |
2827 | parse_error_context | |
2828 | (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'", | |
2829 | IDENTIFIER_POINTER (name), | |
2830 | IDENTIFIER_POINTER (err)); | |
5e942c50 APB |
2831 | else |
2832 | REGISTER_IMPORT (yyvsp[-1].node, last_name) | |
8b27f225 PB |
2833 | } |
2834 | else | |
5e942c50 | 2835 | REGISTER_IMPORT (yyvsp[-1].node, last_name); |
8b27f225 PB |
2836 | ; |
2837 | break;} | |
2838 | case 46: | |
5b09b33e | 2839 | #line 589 "./parse.y" |
8b27f225 PB |
2840 | {yyerror ("Missing name"); RECOVER;; |
2841 | break;} | |
2842 | case 47: | |
5b09b33e | 2843 | #line 591 "./parse.y" |
8b27f225 PB |
2844 | {yyerror ("';' expected"); RECOVER;; |
2845 | break;} | |
2846 | case 48: | |
5b09b33e | 2847 | #line 596 "./parse.y" |
8b27f225 PB |
2848 | { |
2849 | tree name = EXPR_WFL_NODE (yyvsp[-3].node); | |
2850 | tree node = build_tree_list (yyvsp[-3].node, NULL_TREE); | |
63a212ed | 2851 | read_import_dir (yyvsp[-3].node); |
8b27f225 PB |
2852 | TREE_CHAIN (node) = ctxp->import_demand_list; |
2853 | ctxp->import_demand_list = node; | |
2854 | ; | |
2855 | break;} | |
2856 | case 49: | |
5b09b33e | 2857 | #line 604 "./parse.y" |
8b27f225 PB |
2858 | {yyerror ("'*' expected"); RECOVER;; |
2859 | break;} | |
2860 | case 50: | |
5b09b33e | 2861 | #line 606 "./parse.y" |
8b27f225 PB |
2862 | {yyerror ("';' expected"); RECOVER;; |
2863 | break;} | |
2864 | case 51: | |
5b09b33e | 2865 | #line 611 "./parse.y" |
8b27f225 | 2866 | { |
22eed1e6 | 2867 | maybe_generate_finit (); |
63a212ed | 2868 | maybe_generate_clinit (); |
8b27f225 PB |
2869 | yyval.node = yyvsp[0].node; |
2870 | ; | |
2871 | break;} | |
2872 | case 53: | |
5b09b33e | 2873 | #line 618 "./parse.y" |
8b27f225 PB |
2874 | { yyval.node = NULL; ; |
2875 | break;} | |
2876 | case 54: | |
5b09b33e | 2877 | #line 620 "./parse.y" |
8b27f225 PB |
2878 | { |
2879 | YYERROR_NOW; | |
2880 | yyerror ("Class or interface declaration expected"); | |
2881 | ; | |
2882 | break;} | |
2883 | case 55: | |
5b09b33e | 2884 | #line 631 "./parse.y" |
8b27f225 PB |
2885 | { |
2886 | yyval.value = (1 << yyvsp[0].value); | |
2887 | ; | |
2888 | break;} | |
2889 | case 56: | |
5b09b33e | 2890 | #line 635 "./parse.y" |
8b27f225 PB |
2891 | { |
2892 | int acc = (1 << yyvsp[0].value); | |
2893 | if (yyval.value & acc) | |
2894 | parse_error_context | |
2895 | (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice", | |
2896 | java_accstring_lookup (acc)); | |
2897 | else | |
2898 | { | |
2899 | yyval.value |= acc; | |
2900 | } | |
2901 | ; | |
2902 | break;} | |
2903 | case 57: | |
5b09b33e | 2904 | #line 651 "./parse.y" |
8b27f225 PB |
2905 | { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; |
2906 | break;} | |
2907 | case 58: | |
5b09b33e | 2908 | #line 653 "./parse.y" |
8b27f225 PB |
2909 | { |
2910 | yyval.node = yyvsp[0].node; | |
2911 | ; | |
2912 | break;} | |
2913 | case 59: | |
5b09b33e | 2914 | #line 657 "./parse.y" |
8b27f225 PB |
2915 | { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; |
2916 | break;} | |
2917 | case 60: | |
5b09b33e | 2918 | #line 659 "./parse.y" |
8b27f225 PB |
2919 | { |
2920 | yyval.node = yyvsp[0].node; | |
2921 | ; | |
2922 | break;} | |
2923 | case 61: | |
5b09b33e | 2924 | #line 663 "./parse.y" |
8b27f225 PB |
2925 | {yyerror ("Missing class name"); RECOVER;; |
2926 | break;} | |
2927 | case 62: | |
5b09b33e | 2928 | #line 665 "./parse.y" |
8b27f225 PB |
2929 | {yyerror ("Missing class name"); RECOVER;; |
2930 | break;} | |
2931 | case 63: | |
5b09b33e | 2932 | #line 667 "./parse.y" |
8b27f225 PB |
2933 | {if (!ctxp->class_err) yyerror ("'{' expected"); DRECOVER(class1);; |
2934 | break;} | |
2935 | case 64: | |
5b09b33e | 2936 | #line 669 "./parse.y" |
8b27f225 PB |
2937 | {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;; |
2938 | break;} | |
2939 | case 65: | |
5b09b33e | 2940 | #line 673 "./parse.y" |
8b27f225 PB |
2941 | { yyval.node = NULL; ; |
2942 | break;} | |
2943 | case 66: | |
5b09b33e | 2944 | #line 675 "./parse.y" |
8b27f225 PB |
2945 | { yyval.node = yyvsp[0].node; ; |
2946 | break;} | |
2947 | case 67: | |
5b09b33e | 2948 | #line 677 "./parse.y" |
8b27f225 PB |
2949 | {yyerror ("'{' expected"); ctxp->class_err=1;; |
2950 | break;} | |
2951 | case 68: | |
5b09b33e | 2952 | #line 679 "./parse.y" |
8b27f225 PB |
2953 | {yyerror ("Missing super class name"); ctxp->class_err=1;; |
2954 | break;} | |
2955 | case 69: | |
5b09b33e | 2956 | #line 683 "./parse.y" |
8b27f225 PB |
2957 | { yyval.node = NULL_TREE; ; |
2958 | break;} | |
2959 | case 70: | |
5b09b33e | 2960 | #line 685 "./parse.y" |
8b27f225 PB |
2961 | { yyval.node = yyvsp[0].node; ; |
2962 | break;} | |
2963 | case 71: | |
5b09b33e | 2964 | #line 687 "./parse.y" |
8b27f225 PB |
2965 | { |
2966 | ctxp->class_err=1; | |
2967 | yyerror ("Missing interface name"); | |
2968 | ; | |
2969 | break;} | |
2970 | case 72: | |
5b09b33e | 2971 | #line 695 "./parse.y" |
8b27f225 PB |
2972 | { |
2973 | ctxp->interface_number = 1; | |
2974 | yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); | |
2975 | ; | |
2976 | break;} | |
2977 | case 73: | |
5b09b33e | 2978 | #line 700 "./parse.y" |
8b27f225 PB |
2979 | { |
2980 | ctxp->interface_number++; | |
2981 | yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); | |
2982 | ; | |
2983 | break;} | |
2984 | case 74: | |
5b09b33e | 2985 | #line 705 "./parse.y" |
8b27f225 PB |
2986 | {yyerror ("Missing interface name"); RECOVER;; |
2987 | break;} | |
2988 | case 75: | |
5b09b33e | 2989 | #line 710 "./parse.y" |
8b27f225 PB |
2990 | { yyval.node = ctxp->current_parsed_class; ; |
2991 | break;} | |
2992 | case 76: | |
5b09b33e | 2993 | #line 712 "./parse.y" |
8b27f225 PB |
2994 | { yyval.node = ctxp->current_parsed_class; ; |
2995 | break;} | |
2996 | case 82: | |
5b09b33e | 2997 | #line 725 "./parse.y" |
8b27f225 PB |
2998 | { yyval.node = parse_jdk1_1_error ("instance initializer"); ; |
2999 | break;} | |
3000 | case 85: | |
5b09b33e | 3001 | #line 732 "./parse.y" |
8b27f225 PB |
3002 | { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ; |
3003 | break;} | |
3004 | case 86: | |
5b09b33e | 3005 | #line 734 "./parse.y" |
8b27f225 PB |
3006 | { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; |
3007 | break;} | |
3008 | case 87: | |
5b09b33e | 3009 | #line 740 "./parse.y" |
8b27f225 PB |
3010 | { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ; |
3011 | break;} | |
3012 | case 88: | |
5b09b33e | 3013 | #line 742 "./parse.y" |
8b27f225 PB |
3014 | { |
3015 | check_modifiers | |
3016 | ("Illegal modifier `%s' for field declaration", | |
3017 | yyvsp[-3].value, FIELD_MODIFIERS); | |
3018 | check_modifiers_consistency (yyvsp[-3].value); | |
3019 | register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node); | |
3020 | ; | |
3021 | break;} | |
3022 | case 90: | |
5b09b33e | 3023 | #line 755 "./parse.y" |
8b27f225 PB |
3024 | { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ; |
3025 | break;} | |
3026 | case 91: | |
5b09b33e | 3027 | #line 757 "./parse.y" |
8b27f225 PB |
3028 | {yyerror ("Missing term"); RECOVER;; |
3029 | break;} | |
3030 | case 92: | |
5b09b33e | 3031 | #line 762 "./parse.y" |
8b27f225 PB |
3032 | { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ; |
3033 | break;} | |
3034 | case 93: | |
5b09b33e | 3035 | #line 764 "./parse.y" |
8b27f225 PB |
3036 | { |
3037 | if (java_error_count) | |
3038 | yyvsp[0].node = NULL_TREE; | |
3039 | yyval.node = build_tree_list | |
3040 | (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node)); | |
3041 | ; | |
3042 | break;} | |
3043 | case 94: | |
5b09b33e | 3044 | #line 771 "./parse.y" |
8b27f225 PB |
3045 | { |
3046 | yyerror ("Missing variable initializer"); | |
3047 | yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE); | |
3048 | RECOVER; | |
3049 | ; | |
3050 | break;} | |
3051 | case 95: | |
5b09b33e | 3052 | #line 777 "./parse.y" |
8b27f225 PB |
3053 | { |
3054 | yyerror ("';' expected"); | |
3055 | yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE); | |
3056 | RECOVER; | |
3057 | ; | |
3058 | break;} | |
3059 | case 97: | |
5b09b33e | 3060 | #line 787 "./parse.y" |
8b27f225 PB |
3061 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; |
3062 | break;} | |
3063 | case 98: | |
5b09b33e | 3064 | #line 789 "./parse.y" |
8b27f225 PB |
3065 | {yyerror ("Invalid declaration"); DRECOVER(vdi);; |
3066 | break;} | |
3067 | case 99: | |
5b09b33e | 3068 | #line 791 "./parse.y" |
8b27f225 PB |
3069 | {yyerror ("']' expected"); DRECOVER(vdi);; |
3070 | break;} | |
3071 | case 100: | |
5b09b33e | 3072 | #line 793 "./parse.y" |
8b27f225 PB |
3073 | {yyerror ("Unbalanced ']'"); DRECOVER(vdi);; |
3074 | break;} | |
8b27f225 | 3075 | case 103: |
5b09b33e | 3076 | #line 804 "./parse.y" |
8b27f225 PB |
3077 | { |
3078 | current_function_decl = yyvsp[0].node; | |
3079 | source_start_java_method (current_function_decl); | |
3080 | ; | |
3081 | break;} | |
3082 | case 104: | |
5b09b33e | 3083 | #line 809 "./parse.y" |
22eed1e6 | 3084 | { complete_method_declaration (yyvsp[0].node); ; |
8b27f225 PB |
3085 | break;} |
3086 | case 105: | |
5b09b33e | 3087 | #line 811 "./parse.y" |
8b27f225 PB |
3088 | {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;; |
3089 | break;} | |
3090 | case 106: | |
5b09b33e | 3091 | #line 816 "./parse.y" |
8b27f225 PB |
3092 | { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; |
3093 | break;} | |
3094 | case 107: | |
5b09b33e | 3095 | #line 818 "./parse.y" |
8b27f225 PB |
3096 | { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ; |
3097 | break;} | |
3098 | case 108: | |
5b09b33e | 3099 | #line 820 "./parse.y" |
8b27f225 PB |
3100 | { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; |
3101 | break;} | |
3102 | case 109: | |
5b09b33e | 3103 | #line 822 "./parse.y" |
8b27f225 PB |
3104 | { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ; |
3105 | break;} | |
3106 | case 110: | |
5b09b33e | 3107 | #line 824 "./parse.y" |
8b27f225 PB |
3108 | {RECOVER;; |
3109 | break;} | |
3110 | case 111: | |
5b09b33e | 3111 | #line 826 "./parse.y" |
8b27f225 PB |
3112 | {RECOVER;; |
3113 | break;} | |
3114 | case 112: | |
5b09b33e | 3115 | #line 828 "./parse.y" |
8b27f225 PB |
3116 | {yyerror ("Identifier expected"); RECOVER;; |
3117 | break;} | |
3118 | case 113: | |
5b09b33e | 3119 | #line 830 "./parse.y" |
8b27f225 PB |
3120 | {yyerror ("Identifier expected"); RECOVER;; |
3121 | break;} | |
3122 | case 114: | |
5b09b33e | 3123 | #line 832 "./parse.y" |
8b27f225 PB |
3124 | { |
3125 | yyerror ("Invalid method declaration, return type required"); | |
3126 | RECOVER; | |
3127 | ; | |
3128 | break;} | |
3129 | case 115: | |
5b09b33e | 3130 | #line 840 "./parse.y" |
8b27f225 PB |
3131 | { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; |
3132 | break;} | |
3133 | case 116: | |
5b09b33e | 3134 | #line 842 "./parse.y" |
8b27f225 PB |
3135 | { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; |
3136 | break;} | |
3137 | case 117: | |
5b09b33e | 3138 | #line 844 "./parse.y" |
8b27f225 | 3139 | { |
1886c9d8 APB |
3140 | EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location; |
3141 | TREE_PURPOSE (yyvsp[-2].node) = | |
3142 | build_unresolved_array_type (TREE_PURPOSE (yyvsp[-2].node)); | |
3143 | parse_warning_context | |
3144 | (wfl_operator, | |
3145 | "Discouraged form of returned type specification"); | |
8b27f225 PB |
3146 | ; |
3147 | break;} | |
3148 | case 118: | |
5b09b33e | 3149 | #line 853 "./parse.y" |
8b27f225 PB |
3150 | {yyerror ("')' expected"); DRECOVER(method_declarator);; |
3151 | break;} | |
3152 | case 119: | |
5b09b33e | 3153 | #line 855 "./parse.y" |
8b27f225 PB |
3154 | {yyerror ("']' expected"); RECOVER;; |
3155 | break;} | |
3156 | case 120: | |
5b09b33e | 3157 | #line 860 "./parse.y" |
8b27f225 PB |
3158 | { |
3159 | ctxp->formal_parameter_number = 1; | |
3160 | ; | |
3161 | break;} | |
3162 | case 121: | |
5b09b33e | 3163 | #line 864 "./parse.y" |
8b27f225 PB |
3164 | { |
3165 | ctxp->formal_parameter_number += 1; | |
3166 | yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); | |
3167 | ; | |
3168 | break;} | |
3169 | case 122: | |
5b09b33e | 3170 | #line 869 "./parse.y" |
8b27f225 PB |
3171 | {yyerror ("Missing formal parameter term"); RECOVER;; |
3172 | break;} | |
3173 | case 123: | |
5b09b33e | 3174 | #line 874 "./parse.y" |
8b27f225 PB |
3175 | { |
3176 | yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node); | |
3177 | ; | |
3178 | break;} | |
3179 | case 124: | |
5b09b33e | 3180 | #line 878 "./parse.y" |
c877974e | 3181 | { yyval.node = parse_jdk1_1_error ("final parameters"); ; |
8b27f225 PB |
3182 | break;} |
3183 | case 125: | |
5b09b33e | 3184 | #line 880 "./parse.y" |
8b27f225 PB |
3185 | {yyerror ("Missing identifier"); RECOVER;; |
3186 | break;} | |
3187 | case 126: | |
5b09b33e | 3188 | #line 882 "./parse.y" |
8b27f225 PB |
3189 | { |
3190 | SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value)); | |
3191 | yyerror ("Missing identifier"); RECOVER; | |
3192 | ; | |
3193 | break;} | |
3194 | case 127: | |
5b09b33e | 3195 | #line 889 "./parse.y" |
8b27f225 PB |
3196 | { yyval.node = NULL_TREE; ; |
3197 | break;} | |
3198 | case 128: | |
5b09b33e | 3199 | #line 891 "./parse.y" |
8b27f225 PB |
3200 | { yyval.node = yyvsp[0].node; ; |
3201 | break;} | |
3202 | case 129: | |
5b09b33e | 3203 | #line 893 "./parse.y" |
8b27f225 PB |
3204 | {yyerror ("Missing class type term"); RECOVER;; |
3205 | break;} | |
3206 | case 130: | |
5b09b33e | 3207 | #line 898 "./parse.y" |
c877974e | 3208 | { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ; |
8b27f225 PB |
3209 | break;} |
3210 | case 131: | |
5b09b33e | 3211 | #line 900 "./parse.y" |
c877974e | 3212 | { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ; |
8b27f225 PB |
3213 | break;} |
3214 | case 132: | |
5b09b33e | 3215 | #line 902 "./parse.y" |
8b27f225 PB |
3216 | {yyerror ("Missing class type term"); RECOVER;; |
3217 | break;} | |
3218 | case 135: | |
5b09b33e | 3219 | #line 909 "./parse.y" |
8b27f225 PB |
3220 | { yyval.node = NULL_TREE; ; |
3221 | break;} | |
3222 | case 136: | |
5b09b33e | 3223 | #line 915 "./parse.y" |
8b27f225 PB |
3224 | { |
3225 | RULE ("STATIC_INITIALIZER"); | |
3226 | ; | |
3227 | break;} | |
3228 | case 137: | |
5b09b33e | 3229 | #line 919 "./parse.y" |
8b27f225 PB |
3230 | { |
3231 | RULE ("STATIC_INITIALIZER"); | |
3232 | ; | |
3233 | break;} | |
3234 | case 138: | |
5b09b33e | 3235 | #line 926 "./parse.y" |
8b27f225 PB |
3236 | { |
3237 | SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value)); | |
3238 | ; | |
3239 | break;} | |
3240 | case 139: | |
5b09b33e | 3241 | #line 934 "./parse.y" |
8b27f225 | 3242 | { |
22eed1e6 APB |
3243 | current_function_decl = yyvsp[0].node; |
3244 | source_start_java_method (current_function_decl); | |
8b27f225 PB |
3245 | ; |
3246 | break;} | |
3247 | case 140: | |
5b09b33e | 3248 | #line 939 "./parse.y" |
22eed1e6 APB |
3249 | { complete_method_declaration (yyvsp[0].node); ; |
3250 | break;} | |
3251 | case 141: | |
5b09b33e | 3252 | #line 944 "./parse.y" |
22eed1e6 APB |
3253 | { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ; |
3254 | break;} | |
3255 | case 142: | |
5b09b33e | 3256 | #line 946 "./parse.y" |
22eed1e6 APB |
3257 | { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ; |
3258 | break;} | |
3259 | case 143: | |
5b09b33e | 3260 | #line 951 "./parse.y" |
22eed1e6 APB |
3261 | { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; |
3262 | break;} | |
3263 | case 144: | |
5b09b33e | 3264 | #line 953 "./parse.y" |
22eed1e6 APB |
3265 | { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; |
3266 | break;} | |
3267 | case 145: | |
5b09b33e | 3268 | #line 961 "./parse.y" |
22eed1e6 | 3269 | { |
c877974e | 3270 | BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node; |
22eed1e6 | 3271 | yyval.node = yyvsp[0].node; |
8b27f225 PB |
3272 | ; |
3273 | break;} | |
22eed1e6 | 3274 | case 146: |
5b09b33e | 3275 | #line 966 "./parse.y" |
22eed1e6 APB |
3276 | { yyval.node = yyvsp[0].node; ; |
3277 | break;} | |
3278 | case 147: | |
5b09b33e | 3279 | #line 968 "./parse.y" |
22eed1e6 APB |
3280 | { yyval.node = yyvsp[0].node; ; |
3281 | break;} | |
3282 | case 148: | |
5b09b33e | 3283 | #line 970 "./parse.y" |
22eed1e6 APB |
3284 | { yyval.node = yyvsp[0].node; ; |
3285 | break;} | |
3286 | case 149: | |
5b09b33e | 3287 | #line 976 "./parse.y" |
22eed1e6 APB |
3288 | { |
3289 | yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE); | |
3290 | yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node); | |
3291 | yyval.node = java_method_add_stmt (current_function_decl, yyval.node); | |
8b27f225 PB |
3292 | ; |
3293 | break;} | |
22eed1e6 | 3294 | case 150: |
5b09b33e | 3295 | #line 982 "./parse.y" |
22eed1e6 APB |
3296 | { |
3297 | yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node); | |
3298 | yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node); | |
3299 | yyval.node = java_method_add_stmt (current_function_decl, yyval.node); | |
8b27f225 PB |
3300 | ; |
3301 | break;} | |
3302 | case 151: | |
5b09b33e | 3303 | #line 990 "./parse.y" |
8b27f225 PB |
3304 | {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; |
3305 | break;} | |
3306 | case 152: | |
5b09b33e | 3307 | #line 992 "./parse.y" |
8b27f225 PB |
3308 | {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; |
3309 | break;} | |
3310 | case 153: | |
5b09b33e | 3311 | #line 997 "./parse.y" |
8b27f225 PB |
3312 | { |
3313 | tree wfl = build_wfl_node (this_identifier_node, | |
3314 | input_filename, 0, 0); | |
3315 | EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; | |
3316 | yyval.node = wfl; | |
3317 | ; | |
3318 | break;} | |
3319 | case 154: | |
5b09b33e | 3320 | #line 1004 "./parse.y" |
8b27f225 PB |
3321 | { |
3322 | tree wfl = build_wfl_node (super_identifier_node, | |
3323 | input_filename, 0, 0); | |
3324 | EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; | |
3325 | yyval.node = wfl; | |
3326 | ; | |
3327 | break;} | |
3328 | case 155: | |
5b09b33e | 3329 | #line 1016 "./parse.y" |
8b27f225 PB |
3330 | { create_interface (0, yyvsp[0].node, NULL_TREE); ; |
3331 | break;} | |
3332 | case 156: | |
5b09b33e | 3333 | #line 1018 "./parse.y" |
8b27f225 PB |
3334 | { |
3335 | yyval.node = yyvsp[0].node; | |
3336 | ; | |
3337 | break;} | |
3338 | case 157: | |
5b09b33e | 3339 | #line 1022 "./parse.y" |
8b27f225 PB |
3340 | { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ; |
3341 | break;} | |
3342 | case 158: | |
5b09b33e | 3343 | #line 1024 "./parse.y" |
8b27f225 PB |
3344 | { |
3345 | yyval.node = yyvsp[0].node; | |
3346 | ; | |
3347 | break;} | |
3348 | case 159: | |
5b09b33e | 3349 | #line 1028 "./parse.y" |
8b27f225 PB |
3350 | { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ; |
3351 | break;} | |
3352 | case 160: | |
5b09b33e | 3353 | #line 1030 "./parse.y" |
8b27f225 PB |
3354 | { |
3355 | yyval.node = yyvsp[0].node; | |
3356 | ; | |
3357 | break;} | |
3358 | case 161: | |
5b09b33e | 3359 | #line 1034 "./parse.y" |
8b27f225 PB |
3360 | { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ; |
3361 | break;} | |
3362 | case 162: | |
5b09b33e | 3363 | #line 1036 "./parse.y" |
8b27f225 PB |
3364 | { |
3365 | yyval.node = yyvsp[0].node; | |
3366 | ; | |
3367 | break;} | |
3368 | case 163: | |
5b09b33e | 3369 | #line 1040 "./parse.y" |
8b27f225 PB |
3370 | {yyerror ("(here)'{' expected"); RECOVER;; |
3371 | break;} | |
3372 | case 164: | |
5b09b33e | 3373 | #line 1042 "./parse.y" |
8b27f225 PB |
3374 | {yyerror ("(there)'{' expected"); RECOVER;; |
3375 | break;} | |
3376 | case 165: | |
5b09b33e | 3377 | #line 1047 "./parse.y" |
8b27f225 PB |
3378 | { |
3379 | ctxp->interface_number = 1; | |
3380 | yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); | |
3381 | ; | |
3382 | break;} | |
3383 | case 166: | |
5b09b33e | 3384 | #line 1052 "./parse.y" |
8b27f225 PB |
3385 | { |
3386 | ctxp->interface_number++; | |
3387 | yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); | |
3388 | ; | |
3389 | break;} | |
3390 | case 167: | |
5b09b33e | 3391 | #line 1057 "./parse.y" |
8b27f225 PB |
3392 | {yyerror ("Invalid interface type"); RECOVER;; |
3393 | break;} | |
3394 | case 168: | |
5b09b33e | 3395 | #line 1059 "./parse.y" |
8b27f225 PB |
3396 | {yyerror ("Missing term"); RECOVER;; |
3397 | break;} | |
3398 | case 169: | |
5b09b33e | 3399 | #line 1064 "./parse.y" |
8b27f225 PB |
3400 | { yyval.node = NULL_TREE; ; |
3401 | break;} | |
3402 | case 170: | |
5b09b33e | 3403 | #line 1066 "./parse.y" |
8b27f225 PB |
3404 | { yyval.node = NULL_TREE; ; |
3405 | break;} | |
3406 | case 175: | |
5b09b33e | 3407 | #line 1078 "./parse.y" |
8b27f225 PB |
3408 | { yyval.node = parse_jdk1_1_error ("inner class declaration"); ; |
3409 | break;} | |
3410 | case 176: | |
5b09b33e | 3411 | #line 1080 "./parse.y" |
8b27f225 PB |
3412 | { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; |
3413 | break;} | |
3414 | case 178: | |
5b09b33e | 3415 | #line 1089 "./parse.y" |
8b27f225 PB |
3416 | { |
3417 | check_abstract_method_header (yyvsp[-1].node); | |
3418 | current_function_decl = NULL_TREE; /* FIXME ? */ | |
3419 | ; | |
3420 | break;} | |
3421 | case 179: | |
5b09b33e | 3422 | #line 1094 "./parse.y" |
8b27f225 PB |
3423 | {yyerror ("';' expected"); RECOVER;; |
3424 | break;} | |
3425 | case 180: | |
5b09b33e | 3426 | #line 1100 "./parse.y" |
1179ebc2 | 3427 | { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ; |
8b27f225 PB |
3428 | break;} |
3429 | case 181: | |
5b09b33e | 3430 | #line 1102 "./parse.y" |
f8976021 | 3431 | { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ; |
8b27f225 PB |
3432 | break;} |
3433 | case 182: | |
5b09b33e | 3434 | #line 1104 "./parse.y" |
f8976021 | 3435 | { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ; |
ac825856 | 3436 | break;} |
1179ebc2 | 3437 | case 183: |
5b09b33e | 3438 | #line 1109 "./parse.y" |
f8976021 APB |
3439 | { |
3440 | yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), | |
3441 | yyvsp[0].node, NULL_TREE); | |
3442 | ; | |
ac825856 | 3443 | break;} |
1179ebc2 | 3444 | case 184: |
5b09b33e | 3445 | #line 1114 "./parse.y" |
1179ebc2 APB |
3446 | { |
3447 | yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node); | |
3448 | ; | |
8b27f225 | 3449 | break;} |
1179ebc2 | 3450 | case 185: |
5b09b33e | 3451 | #line 1118 "./parse.y" |
8b27f225 PB |
3452 | {yyerror ("Missing term"); RECOVER;; |
3453 | break;} | |
1179ebc2 | 3454 | case 186: |
5b09b33e | 3455 | #line 1124 "./parse.y" |
c877974e | 3456 | { yyval.node = empty_stmt_node; ; |
8b27f225 | 3457 | break;} |
1179ebc2 | 3458 | case 187: |
5b09b33e | 3459 | #line 1126 "./parse.y" |
22eed1e6 | 3460 | { yyval.node = yyvsp[0].node; ; |
8b27f225 | 3461 | break;} |
1179ebc2 | 3462 | case 188: |
5b09b33e | 3463 | #line 1131 "./parse.y" |
22eed1e6 APB |
3464 | { enter_block (); ; |
3465 | break;} | |
1179ebc2 | 3466 | case 189: |
5b09b33e | 3467 | #line 1136 "./parse.y" |
8b27f225 PB |
3468 | { |
3469 | maybe_absorb_scoping_blocks (); | |
3470 | yyval.node = exit_block (); | |
3471 | ; | |
3472 | break;} | |
1179ebc2 | 3473 | case 193: |
5b09b33e | 3474 | #line 1150 "./parse.y" |
12472854 | 3475 | { java_method_add_stmt (current_function_decl, yyvsp[0].node); ; |
8b27f225 | 3476 | break;} |
1179ebc2 | 3477 | case 194: |
5b09b33e | 3478 | #line 1152 "./parse.y" |
12472854 | 3479 | { parse_jdk1_1_error ("inner class declaration"); ; |
8b27f225 | 3480 | break;} |
1179ebc2 | 3481 | case 196: |
5b09b33e | 3482 | #line 1161 "./parse.y" |
8b27f225 PB |
3483 | { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ; |
3484 | break;} | |
1179ebc2 | 3485 | case 197: |
5b09b33e | 3486 | #line 1163 "./parse.y" |
8b27f225 PB |
3487 | { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ; |
3488 | break;} | |
1179ebc2 | 3489 | case 203: |
5b09b33e | 3490 | #line 1173 "./parse.y" |
8b27f225 PB |
3491 | { |
3492 | /* If the for loop is unlabeled, we must return the | |
3493 | block it was defined it. It our last chance to | |
3494 | get a hold on it. */ | |
3495 | if (!LOOP_HAS_LABEL_P (yyval.node)) | |
3496 | yyval.node = exit_block (); | |
3497 | ; | |
3498 | break;} | |
1179ebc2 | 3499 | case 220: |
5b09b33e | 3500 | #line 1206 "./parse.y" |
c877974e | 3501 | { yyval.node = empty_stmt_node; ; |
8b27f225 | 3502 | break;} |
1179ebc2 | 3503 | case 221: |
5b09b33e | 3504 | #line 1211 "./parse.y" |
8b27f225 PB |
3505 | { |
3506 | yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node), | |
3507 | EXPR_WFL_NODE (yyvsp[-1].node)); | |
3508 | pushlevel (2); | |
3509 | push_labeled_block (yyval.node); | |
3510 | PUSH_LABELED_BLOCK (yyval.node); | |
3511 | ; | |
3512 | break;} | |
1179ebc2 | 3513 | case 222: |
5b09b33e | 3514 | #line 1222 "./parse.y" |
8b27f225 PB |
3515 | { |
3516 | yyval.node = complete_labeled_statement (yyvsp[-1].node, yyvsp[0].node); | |
3517 | pop_labeled_block (); | |
3518 | POP_LABELED_BLOCK (); | |
3519 | ; | |
3520 | break;} | |
1179ebc2 | 3521 | case 223: |
5b09b33e | 3522 | #line 1228 "./parse.y" |
8b27f225 PB |
3523 | {yyerror ("':' expected"); RECOVER;; |
3524 | break;} | |
1179ebc2 | 3525 | case 224: |
5b09b33e | 3526 | #line 1233 "./parse.y" |
8b27f225 PB |
3527 | { |
3528 | yyval.node = complete_labeled_statement (yyvsp[-1].node, yyvsp[0].node); | |
3529 | pop_labeled_block (); | |
3530 | POP_LABELED_BLOCK (); | |
3531 | ; | |
3532 | break;} | |
1179ebc2 | 3533 | case 225: |
5b09b33e | 3534 | #line 1244 "./parse.y" |
8b27f225 PB |
3535 | { |
3536 | /* We have a statement. Generate a WFL around it so | |
3537 | we can debug it */ | |
3538 | yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0); | |
3539 | /* We know we have a statement, so set the debug | |
3540 | info to be eventually generate here. */ | |
3541 | yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node); | |
3542 | ; | |
3543 | break;} | |
1179ebc2 | 3544 | case 226: |
5b09b33e | 3545 | #line 1253 "./parse.y" |
8b27f225 PB |
3546 | { |
3547 | if (ctxp->prevent_ese != lineno) | |
3548 | yyerror ("Invalid expression statement"); | |
3549 | DRECOVER (expr_stmt); | |
3550 | ; | |
3551 | break;} | |
1179ebc2 | 3552 | case 227: |
5b09b33e | 3553 | #line 1259 "./parse.y" |
8b27f225 PB |
3554 | { |
3555 | if (ctxp->prevent_ese != lineno) | |
3556 | yyerror ("Invalid expression statement"); | |
3557 | DRECOVER (expr_stmt); | |
3558 | ; | |
3559 | break;} | |
1179ebc2 | 3560 | case 228: |
5b09b33e | 3561 | #line 1265 "./parse.y" |
22eed1e6 APB |
3562 | { |
3563 | if (ctxp->prevent_ese != lineno) | |
3564 | yyerror ("Invalid expression statement"); | |
3565 | DRECOVER (expr_stmt); | |
3566 | ; | |
8b27f225 | 3567 | break;} |
1179ebc2 | 3568 | case 229: |
5b09b33e | 3569 | #line 1271 "./parse.y" |
22eed1e6 | 3570 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 | 3571 | break;} |
1179ebc2 | 3572 | case 230: |
5b09b33e | 3573 | #line 1273 "./parse.y" |
22eed1e6 APB |
3574 | { |
3575 | yyerror ("Constructor invocation must be first " | |
3576 | "thing in a constructor"); | |
3577 | RECOVER; | |
3578 | ; | |
8b27f225 | 3579 | break;} |
1179ebc2 | 3580 | case 231: |
5b09b33e | 3581 | #line 1279 "./parse.y" |
22eed1e6 | 3582 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 | 3583 | break;} |
1179ebc2 | 3584 | case 232: |
5b09b33e | 3585 | #line 1281 "./parse.y" |
22eed1e6 APB |
3586 | { |
3587 | yyerror ("Constructor invocation must be first " | |
3588 | "thing in a constructor"); | |
3589 | RECOVER; | |
3590 | ; | |
8b27f225 | 3591 | break;} |
1179ebc2 | 3592 | case 233: |
5b09b33e | 3593 | #line 1287 "./parse.y" |
22eed1e6 | 3594 | {yyerror ("'(' expected"); RECOVER;; |
8b27f225 | 3595 | break;} |
1179ebc2 | 3596 | case 234: |
5b09b33e | 3597 | #line 1289 "./parse.y" |
1179ebc2 APB |
3598 | {yyerror ("')' expected"); RECOVER;; |
3599 | break;} | |
8b27f225 | 3600 | case 235: |
5b09b33e | 3601 | #line 1291 "./parse.y" |
8b27f225 PB |
3602 | {yyerror ("')' expected"); RECOVER;; |
3603 | break;} | |
3604 | case 236: | |
5b09b33e | 3605 | #line 1293 "./parse.y" |
1179ebc2 | 3606 | {yyerror ("';' expected"); RECOVER;; |
8b27f225 PB |
3607 | break;} |
3608 | case 237: | |
5b09b33e | 3609 | #line 1295 "./parse.y" |
8b27f225 PB |
3610 | {yyerror ("';' expected"); RECOVER;; |
3611 | break;} | |
1179ebc2 | 3612 | case 245: |
5b09b33e | 3613 | #line 1310 "./parse.y" |
1179ebc2 | 3614 | { yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node, NULL_TREE); ; |
8b27f225 PB |
3615 | break;} |
3616 | case 246: | |
5b09b33e | 3617 | #line 1312 "./parse.y" |
1179ebc2 | 3618 | {yyerror ("'(' expected"); RECOVER;; |
8b27f225 PB |
3619 | break;} |
3620 | case 247: | |
5b09b33e | 3621 | #line 1314 "./parse.y" |
1179ebc2 | 3622 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 PB |
3623 | break;} |
3624 | case 248: | |
5b09b33e | 3625 | #line 1316 "./parse.y" |
1179ebc2 | 3626 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 PB |
3627 | break;} |
3628 | case 249: | |
5b09b33e | 3629 | #line 1321 "./parse.y" |
1179ebc2 | 3630 | { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; |
8b27f225 PB |
3631 | break;} |
3632 | case 250: | |
5b09b33e | 3633 | #line 1326 "./parse.y" |
8b27f225 PB |
3634 | { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; |
3635 | break;} | |
3636 | case 251: | |
5b09b33e | 3637 | #line 1331 "./parse.y" |
12472854 PB |
3638 | { |
3639 | enter_block (); | |
8b27f225 PB |
3640 | ; |
3641 | break;} | |
1179ebc2 | 3642 | case 252: |
5b09b33e | 3643 | #line 1335 "./parse.y" |
8b27f225 | 3644 | { |
12472854 | 3645 | /* Make into "proper list" of COMPOUND_EXPRs. |
f8976021 APB |
3646 | I.e. make the last statment also have its own |
3647 | COMPOUND_EXPR. */ | |
12472854 PB |
3648 | maybe_absorb_scoping_blocks (); |
3649 | TREE_OPERAND (yyvsp[-2].node, 1) = exit_block (); | |
3650 | yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-2].node), yyvsp[-2].node); | |
8b27f225 PB |
3651 | ; |
3652 | break;} | |
1179ebc2 | 3653 | case 253: |
5b09b33e | 3654 | #line 1347 "./parse.y" |
12472854 PB |
3655 | { |
3656 | yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE); | |
3657 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; | |
3658 | ; | |
8b27f225 | 3659 | break;} |
1179ebc2 | 3660 | case 254: |
5b09b33e | 3661 | #line 1352 "./parse.y" |
12472854 | 3662 | {yyerror ("'(' expected"); RECOVER;; |
8b27f225 | 3663 | break;} |
1179ebc2 | 3664 | case 255: |
5b09b33e | 3665 | #line 1354 "./parse.y" |
12472854 | 3666 | {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);; |
8b27f225 | 3667 | break;} |
1179ebc2 | 3668 | case 256: |
5b09b33e | 3669 | #line 1356 "./parse.y" |
1179ebc2 APB |
3670 | {yyerror ("'{' expected"); RECOVER;; |
3671 | break;} | |
22eed1e6 | 3672 | case 257: |
5b09b33e | 3673 | #line 1364 "./parse.y" |
1179ebc2 | 3674 | { yyval.node = NULL_TREE; ; |
8b27f225 | 3675 | break;} |
f8976021 | 3676 | case 258: |
5b09b33e | 3677 | #line 1366 "./parse.y" |
f8976021 APB |
3678 | { yyval.node = NULL_TREE; ; |
3679 | break;} | |
3680 | case 259: | |
5b09b33e | 3681 | #line 1368 "./parse.y" |
f8976021 APB |
3682 | { yyval.node = NULL_TREE; ; |
3683 | break;} | |
3684 | case 260: | |
5b09b33e | 3685 | #line 1370 "./parse.y" |
f8976021 APB |
3686 | { yyval.node = NULL_TREE; ; |
3687 | break;} | |
1179ebc2 | 3688 | case 266: |
5b09b33e | 3689 | #line 1389 "./parse.y" |
8b27f225 | 3690 | { |
12472854 PB |
3691 | tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node); |
3692 | EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location; | |
3693 | java_method_add_stmt (current_function_decl, lab); | |
8b27f225 PB |
3694 | ; |
3695 | break;} | |
1179ebc2 | 3696 | case 267: |
5b09b33e | 3697 | #line 1395 "./parse.y" |
8b27f225 | 3698 | { |
12472854 PB |
3699 | tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE); |
3700 | EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location; | |
3701 | java_method_add_stmt (current_function_decl, lab); | |
8b27f225 PB |
3702 | ; |
3703 | break;} | |
1179ebc2 | 3704 | case 268: |
5b09b33e | 3705 | #line 1401 "./parse.y" |
22eed1e6 | 3706 | {yyerror ("Missing or invalid constant expression"); RECOVER;; |
8b27f225 | 3707 | break;} |
1179ebc2 | 3708 | case 269: |
5b09b33e | 3709 | #line 1403 "./parse.y" |
8b27f225 PB |
3710 | {yyerror ("':' expected"); RECOVER;; |
3711 | break;} | |
1179ebc2 | 3712 | case 270: |
5b09b33e | 3713 | #line 1405 "./parse.y" |
22eed1e6 APB |
3714 | {yyerror ("':' expected"); RECOVER;; |
3715 | break;} | |
1179ebc2 | 3716 | case 271: |
5b09b33e | 3717 | #line 1410 "./parse.y" |
8b27f225 PB |
3718 | { |
3719 | tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0); | |
3720 | yyval.node = build_new_loop (body); | |
3721 | ; | |
3722 | break;} | |
1179ebc2 | 3723 | case 272: |
5b09b33e | 3724 | #line 1418 "./parse.y" |
8b27f225 PB |
3725 | { yyval.node = complete_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; |
3726 | break;} | |
1179ebc2 | 3727 | case 273: |
5b09b33e | 3728 | #line 1420 "./parse.y" |
8b27f225 PB |
3729 | {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;; |
3730 | break;} | |
1179ebc2 | 3731 | case 274: |
5b09b33e | 3732 | #line 1422 "./parse.y" |
8b27f225 PB |
3733 | {yyerror ("Missing term and ')' expected"); RECOVER;; |
3734 | break;} | |
1179ebc2 | 3735 | case 275: |
5b09b33e | 3736 | #line 1424 "./parse.y" |
8b27f225 PB |
3737 | {yyerror ("')' expected"); RECOVER;; |
3738 | break;} | |
1179ebc2 | 3739 | case 276: |
5b09b33e | 3740 | #line 1429 "./parse.y" |
8b27f225 PB |
3741 | { yyval.node = complete_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; |
3742 | break;} | |
1179ebc2 | 3743 | case 277: |
5b09b33e | 3744 | #line 1434 "./parse.y" |
8b27f225 PB |
3745 | { |
3746 | tree body = build_loop_body (0, NULL_TREE, 1); | |
3747 | yyval.node = build_new_loop (body); | |
3748 | ; | |
3749 | break;} | |
1179ebc2 | 3750 | case 278: |
5b09b33e | 3751 | #line 1443 "./parse.y" |
8b27f225 PB |
3752 | { yyval.node = complete_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ; |
3753 | break;} | |
1179ebc2 | 3754 | case 279: |
5b09b33e | 3755 | #line 1448 "./parse.y" |
8b27f225 PB |
3756 | { yyval.node = complete_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);; |
3757 | break;} | |
1179ebc2 | 3758 | case 280: |
5b09b33e | 3759 | #line 1450 "./parse.y" |
8b27f225 PB |
3760 | { |
3761 | yyval.node = complete_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); | |
3762 | /* We have not condition, so we get rid of the EXIT_EXPR */ | |
3763 | LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) = | |
c877974e | 3764 | empty_stmt_node; |
8b27f225 PB |
3765 | ; |
3766 | break;} | |
1179ebc2 | 3767 | case 281: |
5b09b33e | 3768 | #line 1457 "./parse.y" |
22eed1e6 | 3769 | {yyerror ("Invalid control expression"); RECOVER;; |
8b27f225 | 3770 | break;} |
1179ebc2 | 3771 | case 282: |
5b09b33e | 3772 | #line 1459 "./parse.y" |
8b27f225 PB |
3773 | {yyerror ("Invalid update expression"); RECOVER;; |
3774 | break;} | |
1179ebc2 | 3775 | case 283: |
5b09b33e | 3776 | #line 1461 "./parse.y" |
22eed1e6 | 3777 | {yyerror ("Invalid update expression"); RECOVER;; |
8b27f225 | 3778 | break;} |
1179ebc2 | 3779 | case 284: |
5b09b33e | 3780 | #line 1466 "./parse.y" |
22eed1e6 APB |
3781 | { yyval.node = complete_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);; |
3782 | break;} | |
1179ebc2 | 3783 | case 285: |
5b09b33e | 3784 | #line 1468 "./parse.y" |
8b27f225 PB |
3785 | { |
3786 | yyval.node = complete_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); | |
3787 | /* We have not condition, so we get rid of the EXIT_EXPR */ | |
3788 | LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) = | |
c877974e | 3789 | empty_stmt_node; |
8b27f225 PB |
3790 | ; |
3791 | break;} | |
1179ebc2 | 3792 | case 286: |
5b09b33e | 3793 | #line 1478 "./parse.y" |
8b27f225 PB |
3794 | { |
3795 | /* This scope defined for local variable that may be | |
3796 | defined within the scope of the for loop */ | |
3797 | enter_block (); | |
3798 | ; | |
3799 | break;} | |
1179ebc2 | 3800 | case 287: |
5b09b33e | 3801 | #line 1484 "./parse.y" |
8b27f225 PB |
3802 | {yyerror ("'(' expected"); DRECOVER(for_1);; |
3803 | break;} | |
1179ebc2 | 3804 | case 288: |
5b09b33e | 3805 | #line 1486 "./parse.y" |
8b27f225 PB |
3806 | {yyerror ("Invalid init statement"); RECOVER;; |
3807 | break;} | |
1179ebc2 | 3808 | case 289: |
5b09b33e | 3809 | #line 1491 "./parse.y" |
8b27f225 PB |
3810 | { |
3811 | /* We now declare the loop body. The loop is | |
3812 | declared as a for loop. */ | |
3813 | tree body = build_loop_body (0, NULL_TREE, 0); | |
3814 | yyval.node = build_new_loop (body); | |
3815 | IS_FOR_LOOP_P (yyval.node) = 1; | |
3816 | /* The loop is added to the current block the for | |
3817 | statement is defined within */ | |
3818 | java_method_add_stmt (current_function_decl, yyval.node); | |
3819 | ; | |
3820 | break;} | |
1179ebc2 | 3821 | case 290: |
5b09b33e | 3822 | #line 1503 "./parse.y" |
c877974e | 3823 | { yyval.node = empty_stmt_node; ; |
8b27f225 | 3824 | break;} |
1179ebc2 | 3825 | case 291: |
5b09b33e | 3826 | #line 1505 "./parse.y" |
8b27f225 PB |
3827 | { |
3828 | /* Init statement recorded within the previously | |
3829 | defined block scope */ | |
3830 | yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node); | |
3831 | ; | |
3832 | break;} | |
1179ebc2 | 3833 | case 292: |
5b09b33e | 3834 | #line 1511 "./parse.y" |
8b27f225 PB |
3835 | { |
3836 | /* Local variable are recorded within the previously | |
3837 | defined block scope */ | |
3838 | yyval.node = NULL_TREE; | |
3839 | ; | |
3840 | break;} | |
1179ebc2 | 3841 | case 293: |
5b09b33e | 3842 | #line 1517 "./parse.y" |
8b27f225 PB |
3843 | {yyerror ("';' expected"); DRECOVER(for_init_1);; |
3844 | break;} | |
1179ebc2 | 3845 | case 294: |
5b09b33e | 3846 | #line 1521 "./parse.y" |
c877974e | 3847 | {yyval.node = empty_stmt_node;; |
8b27f225 | 3848 | break;} |
1179ebc2 | 3849 | case 295: |
5b09b33e | 3850 | #line 1523 "./parse.y" |
8b27f225 PB |
3851 | { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ; |
3852 | break;} | |
1179ebc2 | 3853 | case 296: |
5b09b33e | 3854 | #line 1528 "./parse.y" |
8b27f225 PB |
3855 | { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ; |
3856 | break;} | |
1179ebc2 | 3857 | case 297: |
5b09b33e | 3858 | #line 1530 "./parse.y" |
8b27f225 PB |
3859 | { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ; |
3860 | break;} | |
1179ebc2 | 3861 | case 298: |
5b09b33e | 3862 | #line 1532 "./parse.y" |
8b27f225 PB |
3863 | {yyerror ("Missing term"); RECOVER;; |
3864 | break;} | |
1179ebc2 | 3865 | case 299: |
5b09b33e | 3866 | #line 1537 "./parse.y" |
8b27f225 PB |
3867 | { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ; |
3868 | break;} | |
1179ebc2 | 3869 | case 300: |
5b09b33e | 3870 | #line 1539 "./parse.y" |
8b27f225 PB |
3871 | { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ; |
3872 | break;} | |
1179ebc2 | 3873 | case 301: |
5b09b33e | 3874 | #line 1541 "./parse.y" |
8b27f225 PB |
3875 | {yyerror ("Missing term"); RECOVER;; |
3876 | break;} | |
1179ebc2 | 3877 | case 302: |
5b09b33e | 3878 | #line 1543 "./parse.y" |
8b27f225 PB |
3879 | {yyerror ("';' expected"); RECOVER;; |
3880 | break;} | |
1179ebc2 | 3881 | case 303: |
5b09b33e | 3882 | #line 1548 "./parse.y" |
8b27f225 PB |
3883 | { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ; |
3884 | break;} | |
1179ebc2 | 3885 | case 304: |
5b09b33e | 3886 | #line 1550 "./parse.y" |
8b27f225 PB |
3887 | { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ; |
3888 | break;} | |
1179ebc2 | 3889 | case 305: |
5b09b33e | 3890 | #line 1552 "./parse.y" |
8b27f225 PB |
3891 | {yyerror ("Missing term"); RECOVER;; |
3892 | break;} | |
1179ebc2 | 3893 | case 306: |
5b09b33e | 3894 | #line 1554 "./parse.y" |
8b27f225 PB |
3895 | {yyerror ("';' expected"); RECOVER;; |
3896 | break;} | |
1179ebc2 | 3897 | case 307: |
5b09b33e | 3898 | #line 1559 "./parse.y" |
8b27f225 PB |
3899 | { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ; |
3900 | break;} | |
1179ebc2 | 3901 | case 308: |
5b09b33e | 3902 | #line 1561 "./parse.y" |
8b27f225 PB |
3903 | { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ; |
3904 | break;} | |
1179ebc2 | 3905 | case 309: |
5b09b33e | 3906 | #line 1563 "./parse.y" |
8b27f225 PB |
3907 | {yyerror ("Missing term"); RECOVER;; |
3908 | break;} | |
1179ebc2 | 3909 | case 310: |
5b09b33e | 3910 | #line 1565 "./parse.y" |
8b27f225 PB |
3911 | {yyerror ("';' expected"); RECOVER;; |
3912 | break;} | |
1179ebc2 | 3913 | case 311: |
5b09b33e | 3914 | #line 1570 "./parse.y" |
8b27f225 PB |
3915 | { |
3916 | yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node); | |
3917 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; | |
3918 | ; | |
3919 | break;} | |
1179ebc2 | 3920 | case 312: |
5b09b33e | 3921 | #line 1575 "./parse.y" |
8b27f225 PB |
3922 | {yyerror ("Missing term"); RECOVER;; |
3923 | break;} | |
1179ebc2 | 3924 | case 313: |
5b09b33e | 3925 | #line 1577 "./parse.y" |
8b27f225 PB |
3926 | {yyerror ("';' expected"); RECOVER;; |
3927 | break;} | |
1179ebc2 | 3928 | case 314: |
5b09b33e | 3929 | #line 1582 "./parse.y" |
8b27f225 PB |
3930 | { |
3931 | yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); | |
3932 | EXPR_WFL_LINECOL (yyval.node) = | |
3933 | EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK)); | |
3934 | ; | |
3935 | break;} | |
1179ebc2 | 3936 | case 315: |
5b09b33e | 3937 | #line 1588 "./parse.y" |
22eed1e6 | 3938 | {yyerror ("'{' expected"); RECOVER;; |
8b27f225 | 3939 | break;} |
1179ebc2 | 3940 | case 316: |
5b09b33e | 3941 | #line 1590 "./parse.y" |
22eed1e6 | 3942 | {yyerror ("'(' expected"); RECOVER;; |
8b27f225 | 3943 | break;} |
1179ebc2 | 3944 | case 317: |
5b09b33e | 3945 | #line 1592 "./parse.y" |
8b27f225 PB |
3946 | {yyerror ("Missing term"); RECOVER;; |
3947 | break;} | |
1179ebc2 | 3948 | case 318: |
5b09b33e | 3949 | #line 1594 "./parse.y" |
22eed1e6 APB |
3950 | {yyerror ("Missing term"); RECOVER;; |
3951 | break;} | |
1179ebc2 | 3952 | case 319: |
5b09b33e | 3953 | #line 1599 "./parse.y" |
8b27f225 PB |
3954 | { |
3955 | if ((1 << yyvsp[0].value) != ACC_SYNCHRONIZED) | |
3956 | fatal ("synchronized was '%d' - yyparse", (1 << yyvsp[0].value)); | |
3957 | ; | |
3958 | break;} | |
1179ebc2 | 3959 | case 320: |
5b09b33e | 3960 | #line 1607 "./parse.y" |
8b27f225 PB |
3961 | { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node, NULL_TREE); ; |
3962 | break;} | |
1179ebc2 | 3963 | case 321: |
5b09b33e | 3964 | #line 1609 "./parse.y" |
8b27f225 PB |
3965 | { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, NULL_TREE, yyvsp[0].node); ; |
3966 | break;} | |
1179ebc2 | 3967 | case 322: |
5b09b33e | 3968 | #line 1611 "./parse.y" |
8b27f225 PB |
3969 | { yyval.node = build_try_statement (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; |
3970 | break;} | |
1179ebc2 | 3971 | case 323: |
5b09b33e | 3972 | #line 1613 "./parse.y" |
8b27f225 PB |
3973 | {yyerror ("'{' expected"); DRECOVER (try_statement);; |
3974 | break;} | |
1179ebc2 | 3975 | case 325: |
5b09b33e | 3976 | #line 1619 "./parse.y" |
8b27f225 PB |
3977 | { |
3978 | TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node; | |
3979 | yyval.node = yyvsp[0].node; | |
3980 | ; | |
3981 | break;} | |
1179ebc2 | 3982 | case 326: |
5b09b33e | 3983 | #line 1627 "./parse.y" |
8b27f225 PB |
3984 | { |
3985 | java_method_add_stmt (current_function_decl, yyvsp[0].node); | |
3986 | exit_block (); | |
3987 | yyval.node = yyvsp[-1].node; | |
3988 | ; | |
3989 | break;} | |
1179ebc2 | 3990 | case 327: |
5b09b33e | 3991 | #line 1635 "./parse.y" |
8b27f225 PB |
3992 | { |
3993 | /* We add a block to define a scope for | |
3994 | formal_parameter (CCBP). The formal parameter is | |
3995 | declared initialized by the appropriate function | |
3996 | call */ | |
3997 | tree ccpb = enter_block (); | |
c877974e APB |
3998 | tree init = build_assignment (ASSIGN_TK, yyvsp[-2].operator.location, |
3999 | TREE_PURPOSE (yyvsp[-1].node), | |
4000 | soft_exceptioninfo_call_node); | |
8b27f225 PB |
4001 | declare_local_variables (0, TREE_VALUE (yyvsp[-1].node), |
4002 | build_tree_list (TREE_PURPOSE (yyvsp[-1].node), | |
4003 | init)); | |
4004 | yyval.node = build1 (CATCH_EXPR, NULL_TREE, ccpb); | |
4005 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location; | |
4006 | ; | |
4007 | break;} | |
1179ebc2 | 4008 | case 328: |
5b09b33e | 4009 | #line 1651 "./parse.y" |
8b27f225 PB |
4010 | {yyerror ("'(' expected"); RECOVER;; |
4011 | break;} | |
1179ebc2 | 4012 | case 329: |
5b09b33e | 4013 | #line 1653 "./parse.y" |
8b27f225 PB |
4014 | {yyerror ("Missing term or ')' expected"); DRECOVER (2);; |
4015 | break;} | |
1179ebc2 | 4016 | case 330: |
5b09b33e | 4017 | #line 1655 "./parse.y" |
8b27f225 PB |
4018 | {yyerror ("')' expected"); DRECOVER (1);; |
4019 | break;} | |
1179ebc2 | 4020 | case 331: |
5b09b33e | 4021 | #line 1660 "./parse.y" |
8b27f225 PB |
4022 | { |
4023 | yyval.node = build (FINALLY_EXPR, NULL_TREE, | |
4024 | create_label_decl (generate_name ()), yyvsp[0].node); | |
4025 | ; | |
4026 | break;} | |
1179ebc2 | 4027 | case 332: |
5b09b33e | 4028 | #line 1665 "./parse.y" |
8b27f225 PB |
4029 | {yyerror ("'{' expected"); RECOVER; ; |
4030 | break;} | |
1179ebc2 | 4031 | case 336: |
5b09b33e | 4032 | #line 1677 "./parse.y" |
8b27f225 PB |
4033 | { yyval.node = build_this (yyvsp[0].operator.location); ; |
4034 | break;} | |
1179ebc2 | 4035 | case 337: |
5b09b33e | 4036 | #line 1679 "./parse.y" |
8b27f225 PB |
4037 | {yyval.node = yyvsp[-1].node;; |
4038 | break;} | |
1179ebc2 | 4039 | case 342: |
5b09b33e | 4040 | #line 1688 "./parse.y" |
c877974e | 4041 | { yyval.node = parse_jdk1_1_error ("named class literals"); ; |
8b27f225 | 4042 | break;} |
1179ebc2 | 4043 | case 343: |
5b09b33e | 4044 | #line 1690 "./parse.y" |
c877974e | 4045 | { yyval.node = build_class_ref (yyvsp[-2].node); ; |
8b27f225 | 4046 | break;} |
1179ebc2 | 4047 | case 344: |
5b09b33e | 4048 | #line 1692 "./parse.y" |
c877974e | 4049 | { yyval.node = build_class_ref (void_type_node); ; |
8b27f225 | 4050 | break;} |
1179ebc2 | 4051 | case 345: |
5b09b33e | 4052 | #line 1697 "./parse.y" |
22eed1e6 | 4053 | { yyval.node = parse_jdk1_1_error ("class literals"); ; |
8b27f225 | 4054 | break;} |
1179ebc2 | 4055 | case 346: |
5b09b33e | 4056 | #line 1699 "./parse.y" |
22eed1e6 | 4057 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 | 4058 | break;} |
1179ebc2 | 4059 | case 347: |
5b09b33e | 4060 | #line 1701 "./parse.y" |
22eed1e6 | 4061 | {yyerror ("'class' or 'this' expected" ); RECOVER;; |
8b27f225 | 4062 | break;} |
1179ebc2 | 4063 | case 348: |
5b09b33e | 4064 | #line 1703 "./parse.y" |
8b27f225 PB |
4065 | {yyerror ("'class' expected" ); RECOVER;; |
4066 | break;} | |
1179ebc2 | 4067 | case 349: |
5b09b33e | 4068 | #line 1705 "./parse.y" |
22eed1e6 | 4069 | {yyerror ("'class' expected" ); RECOVER;; |
8b27f225 | 4070 | break;} |
1179ebc2 | 4071 | case 350: |
5b09b33e | 4072 | #line 1710 "./parse.y" |
22eed1e6 | 4073 | { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ; |
8b27f225 | 4074 | break;} |
1179ebc2 | 4075 | case 351: |
5b09b33e | 4076 | #line 1712 "./parse.y" |
22eed1e6 | 4077 | { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ; |
8b27f225 | 4078 | break;} |
1179ebc2 | 4079 | case 352: |
5b09b33e | 4080 | #line 1717 "./parse.y" |
8b27f225 PB |
4081 | { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; |
4082 | break;} | |
1179ebc2 | 4083 | case 353: |
5b09b33e | 4084 | #line 1719 "./parse.y" |
22eed1e6 | 4085 | { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; |
8b27f225 | 4086 | break;} |
1179ebc2 | 4087 | case 358: |
5b09b33e | 4088 | #line 1728 "./parse.y" |
22eed1e6 | 4089 | {yyerror ("'(' expected"); DRECOVER(new_1);; |
8b27f225 | 4090 | break;} |
1179ebc2 | 4091 | case 359: |
5b09b33e | 4092 | #line 1730 "./parse.y" |
22eed1e6 | 4093 | {yyerror ("'(' expected"); RECOVER;; |
8b27f225 | 4094 | break;} |
1179ebc2 | 4095 | case 360: |
5b09b33e | 4096 | #line 1732 "./parse.y" |
22eed1e6 | 4097 | {yyerror ("')' or term expected"); RECOVER;; |
8b27f225 | 4098 | break;} |
1179ebc2 | 4099 | case 361: |
5b09b33e | 4100 | #line 1734 "./parse.y" |
22eed1e6 | 4101 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 | 4102 | break;} |
1179ebc2 | 4103 | case 362: |
5b09b33e | 4104 | #line 1736 "./parse.y" |
22eed1e6 APB |
4105 | {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;; |
4106 | break;} | |
1179ebc2 | 4107 | case 363: |
5b09b33e | 4108 | #line 1738 "./parse.y" |
8b27f225 PB |
4109 | {yyerror ("'(' expected"); RECOVER;; |
4110 | break;} | |
1179ebc2 | 4111 | case 366: |
5b09b33e | 4112 | #line 1748 "./parse.y" |
8b27f225 PB |
4113 | { |
4114 | yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE); | |
4115 | ctxp->formal_parameter_number = 1; | |
4116 | ; | |
4117 | break;} | |
1179ebc2 | 4118 | case 367: |
5b09b33e | 4119 | #line 1753 "./parse.y" |
8b27f225 PB |
4120 | { |
4121 | ctxp->formal_parameter_number += 1; | |
4122 | yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node); | |
4123 | ; | |
4124 | break;} | |
1179ebc2 | 4125 | case 368: |
5b09b33e | 4126 | #line 1758 "./parse.y" |
22eed1e6 | 4127 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4128 | break;} |
1179ebc2 | 4129 | case 369: |
5b09b33e | 4130 | #line 1763 "./parse.y" |
1179ebc2 APB |
4131 | { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; |
4132 | break;} | |
8b27f225 | 4133 | case 370: |
5b09b33e | 4134 | #line 1765 "./parse.y" |
8b27f225 PB |
4135 | { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; |
4136 | break;} | |
4137 | case 371: | |
5b09b33e | 4138 | #line 1767 "./parse.y" |
1179ebc2 | 4139 | { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, ctxp->osb_number); ; |
8b27f225 PB |
4140 | break;} |
4141 | case 372: | |
5b09b33e | 4142 | #line 1769 "./parse.y" |
8b27f225 PB |
4143 | { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, ctxp->osb_number); ; |
4144 | break;} | |
4145 | case 373: | |
5b09b33e | 4146 | #line 1773 "./parse.y" |
1179ebc2 | 4147 | { yyval.node = parse_jdk1_1_error ("anonymous array"); ; |
8b27f225 PB |
4148 | break;} |
4149 | case 374: | |
5b09b33e | 4150 | #line 1775 "./parse.y" |
8b27f225 PB |
4151 | { yyval.node = parse_jdk1_1_error ("anonymous array"); ; |
4152 | break;} | |
4153 | case 375: | |
5b09b33e | 4154 | #line 1777 "./parse.y" |
22eed1e6 | 4155 | {yyerror ("'[' expected"); DRECOVER ("]");; |
8b27f225 | 4156 | break;} |
1179ebc2 | 4157 | case 376: |
5b09b33e | 4158 | #line 1779 "./parse.y" |
22eed1e6 | 4159 | {yyerror ("']' expected"); RECOVER;; |
8b27f225 | 4160 | break;} |
1179ebc2 | 4161 | case 377: |
5b09b33e | 4162 | #line 1784 "./parse.y" |
22eed1e6 | 4163 | { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ; |
8b27f225 | 4164 | break;} |
1179ebc2 | 4165 | case 378: |
5b09b33e | 4166 | #line 1786 "./parse.y" |
22eed1e6 APB |
4167 | { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ; |
4168 | break;} | |
1179ebc2 | 4169 | case 379: |
5b09b33e | 4170 | #line 1791 "./parse.y" |
8b27f225 PB |
4171 | { |
4172 | EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location; | |
4173 | yyval.node = yyvsp[-1].node; | |
4174 | ; | |
4175 | break;} | |
1179ebc2 | 4176 | case 380: |
5b09b33e | 4177 | #line 1796 "./parse.y" |
8b27f225 PB |
4178 | {yyerror ("']' expected"); RECOVER;; |
4179 | break;} | |
1179ebc2 | 4180 | case 381: |
5b09b33e | 4181 | #line 1798 "./parse.y" |
8b27f225 PB |
4182 | { |
4183 | yyerror ("Missing term"); | |
4184 | yyerror ("']' expected"); | |
4185 | RECOVER; | |
4186 | ; | |
4187 | break;} | |
1179ebc2 | 4188 | case 382: |
5b09b33e | 4189 | #line 1807 "./parse.y" |
8b27f225 PB |
4190 | { ctxp->osb_number = 1; ; |
4191 | break;} | |
1179ebc2 | 4192 | case 383: |
5b09b33e | 4193 | #line 1809 "./parse.y" |
8b27f225 PB |
4194 | { ctxp->osb_number++; ; |
4195 | break;} | |
1179ebc2 | 4196 | case 384: |
5b09b33e | 4197 | #line 1811 "./parse.y" |
8b27f225 PB |
4198 | { yyerror ("']' expected"); RECOVER;; |
4199 | break;} | |
1179ebc2 | 4200 | case 385: |
5b09b33e | 4201 | #line 1816 "./parse.y" |
8b27f225 PB |
4202 | { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ; |
4203 | break;} | |
1179ebc2 | 4204 | case 386: |
5b09b33e | 4205 | #line 1820 "./parse.y" |
8b27f225 PB |
4206 | { |
4207 | tree super_wfl = | |
4208 | build_wfl_node (super_identifier_node, | |
4209 | input_filename, 0, 0); | |
4210 | EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location; | |
22eed1e6 APB |
4211 | yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location); |
4212 | ; | |
8b27f225 | 4213 | break;} |
1179ebc2 | 4214 | case 387: |
5b09b33e | 4215 | #line 1828 "./parse.y" |
22eed1e6 | 4216 | {yyerror ("Field expected"); DRECOVER (super_field_acces);; |
8b27f225 | 4217 | break;} |
1179ebc2 | 4218 | case 388: |
5b09b33e | 4219 | #line 1833 "./parse.y" |
22eed1e6 | 4220 | { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ; |
8b27f225 | 4221 | break;} |
1179ebc2 | 4222 | case 389: |
5b09b33e | 4223 | #line 1835 "./parse.y" |
22eed1e6 | 4224 | { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ; |
8b27f225 | 4225 | break;} |
1179ebc2 | 4226 | case 390: |
5b09b33e | 4227 | #line 1837 "./parse.y" |
8b27f225 | 4228 | { |
22eed1e6 APB |
4229 | if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR) |
4230 | yyval.node = build_this_super_qualified_invocation | |
4231 | (1, yyvsp[-2].node, NULL_TREE, 0, yyvsp[-3].operator.location); | |
4232 | else | |
4233 | { | |
4234 | tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE); | |
4235 | yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location); | |
4236 | } | |
8b27f225 PB |
4237 | ; |
4238 | break;} | |
1179ebc2 | 4239 | case 391: |
5b09b33e | 4240 | #line 1848 "./parse.y" |
22eed1e6 APB |
4241 | { |
4242 | if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR) | |
4243 | yyval.node = build_this_super_qualified_invocation | |
4244 | (1, yyvsp[-3].node, yyvsp[-1].node, 0, yyvsp[-4].operator.location); | |
4245 | else | |
4246 | { | |
4247 | tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); | |
4248 | yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location); | |
4249 | } | |
8b27f225 PB |
4250 | ; |
4251 | break;} | |
1179ebc2 | 4252 | case 392: |
5b09b33e | 4253 | #line 1859 "./parse.y" |
22eed1e6 APB |
4254 | { |
4255 | yyval.node = build_this_super_qualified_invocation | |
4256 | (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location); | |
8b27f225 PB |
4257 | ; |
4258 | break;} | |
1179ebc2 | 4259 | case 393: |
5b09b33e | 4260 | #line 1864 "./parse.y" |
22eed1e6 APB |
4261 | { |
4262 | yyval.node = build_this_super_qualified_invocation | |
4263 | (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location); | |
4264 | ; | |
8b27f225 | 4265 | break;} |
1179ebc2 | 4266 | case 394: |
5b09b33e | 4267 | #line 1873 "./parse.y" |
1179ebc2 APB |
4268 | { yyerror ("'(' expected"); DRECOVER (method_invocation); ; |
4269 | break;} | |
8b27f225 | 4270 | case 395: |
5b09b33e | 4271 | #line 1875 "./parse.y" |
8b27f225 PB |
4272 | { yyerror ("'(' expected"); DRECOVER (method_invocation); ; |
4273 | break;} | |
4274 | case 396: | |
5b09b33e | 4275 | #line 1880 "./parse.y" |
1179ebc2 | 4276 | { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ; |
8b27f225 PB |
4277 | break;} |
4278 | case 397: | |
5b09b33e | 4279 | #line 1882 "./parse.y" |
8b27f225 PB |
4280 | { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ; |
4281 | break;} | |
4282 | case 398: | |
5b09b33e | 4283 | #line 1884 "./parse.y" |
8b27f225 PB |
4284 | { |
4285 | yyerror ("Missing term and ']' expected"); | |
4286 | DRECOVER(array_access); | |
4287 | ; | |
4288 | break;} | |
1179ebc2 | 4289 | case 399: |
5b09b33e | 4290 | #line 1889 "./parse.y" |
8b27f225 PB |
4291 | { |
4292 | yyerror ("']' expected"); | |
4293 | DRECOVER(array_access); | |
4294 | ; | |
4295 | break;} | |
1179ebc2 | 4296 | case 400: |
5b09b33e | 4297 | #line 1894 "./parse.y" |
8b27f225 PB |
4298 | { |
4299 | yyerror ("Missing term and ']' expected"); | |
4300 | DRECOVER(array_access); | |
4301 | ; | |
4302 | break;} | |
1179ebc2 | 4303 | case 401: |
5b09b33e | 4304 | #line 1899 "./parse.y" |
8b27f225 PB |
4305 | { |
4306 | yyerror ("']' expected"); | |
4307 | DRECOVER(array_access); | |
4308 | ; | |
4309 | break;} | |
1179ebc2 | 4310 | case 406: |
5b09b33e | 4311 | #line 1914 "./parse.y" |
8b27f225 PB |
4312 | { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ; |
4313 | break;} | |
1179ebc2 | 4314 | case 407: |
5b09b33e | 4315 | #line 1919 "./parse.y" |
22eed1e6 | 4316 | { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ; |
8b27f225 | 4317 | break;} |
1179ebc2 | 4318 | case 410: |
5b09b33e | 4319 | #line 1926 "./parse.y" |
8b27f225 PB |
4320 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; |
4321 | break;} | |
1179ebc2 | 4322 | case 411: |
5b09b33e | 4323 | #line 1928 "./parse.y" |
22eed1e6 | 4324 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; |
8b27f225 | 4325 | break;} |
1179ebc2 | 4326 | case 413: |
5b09b33e | 4327 | #line 1931 "./parse.y" |
8b27f225 PB |
4328 | {yyerror ("Missing term"); RECOVER; |
4329 | break;} | |
1179ebc2 | 4330 | case 414: |
5b09b33e | 4331 | #line 1933 "./parse.y" |
22eed1e6 | 4332 | {yyerror ("Missing term"); RECOVER; |
8b27f225 | 4333 | break;} |
1179ebc2 | 4334 | case 415: |
5b09b33e | 4335 | #line 1938 "./parse.y" |
22eed1e6 | 4336 | {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ; |
8b27f225 | 4337 | break;} |
1179ebc2 | 4338 | case 416: |
5b09b33e | 4339 | #line 1940 "./parse.y" |
22eed1e6 | 4340 | {yyerror ("Missing term"); RECOVER; |
8b27f225 | 4341 | break;} |
1179ebc2 | 4342 | case 417: |
5b09b33e | 4343 | #line 1945 "./parse.y" |
22eed1e6 | 4344 | {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ; |
8b27f225 | 4345 | break;} |
1179ebc2 | 4346 | case 418: |
5b09b33e | 4347 | #line 1947 "./parse.y" |
22eed1e6 | 4348 | {yyerror ("Missing term"); RECOVER; |
8b27f225 | 4349 | break;} |
1179ebc2 | 4350 | case 420: |
5b09b33e | 4351 | #line 1953 "./parse.y" |
8b27f225 PB |
4352 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; |
4353 | break;} | |
1179ebc2 | 4354 | case 421: |
5b09b33e | 4355 | #line 1955 "./parse.y" |
22eed1e6 | 4356 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; |
8b27f225 | 4357 | break;} |
1179ebc2 | 4358 | case 423: |
5b09b33e | 4359 | #line 1958 "./parse.y" |
8b27f225 PB |
4360 | {yyerror ("Missing term"); RECOVER; |
4361 | break;} | |
1179ebc2 | 4362 | case 424: |
5b09b33e | 4363 | #line 1960 "./parse.y" |
22eed1e6 APB |
4364 | {yyerror ("Missing term"); RECOVER; |
4365 | break;} | |
1179ebc2 | 4366 | case 425: |
5b09b33e | 4367 | #line 1965 "./parse.y" |
8b27f225 PB |
4368 | { |
4369 | tree type = yyvsp[-3].node; | |
4370 | while (ctxp->osb_number--) | |
4371 | type = build_java_array_type (type, -1); | |
4372 | yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node); | |
4373 | ; | |
4374 | break;} | |
1179ebc2 | 4375 | case 426: |
5b09b33e | 4376 | #line 1972 "./parse.y" |
8b27f225 PB |
4377 | { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ; |
4378 | break;} | |
1179ebc2 | 4379 | case 427: |
5b09b33e | 4380 | #line 1974 "./parse.y" |
22eed1e6 APB |
4381 | { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ; |
4382 | break;} | |
1179ebc2 | 4383 | case 428: |
5b09b33e | 4384 | #line 1976 "./parse.y" |
8b27f225 PB |
4385 | { |
4386 | char *ptr; | |
4387 | while (ctxp->osb_number--) | |
4388 | obstack_1grow (&temporary_obstack, '['); | |
4389 | obstack_grow0 (&temporary_obstack, | |
4390 | IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)), | |
4391 | IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node))); | |
4392 | ptr = obstack_finish (&temporary_obstack); | |
4393 | EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr); | |
4394 | yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node); | |
4395 | ; | |
4396 | break;} | |
1179ebc2 | 4397 | case 429: |
5b09b33e | 4398 | #line 1988 "./parse.y" |
8b27f225 PB |
4399 | {yyerror ("']' expected, invalid type expression");; |
4400 | break;} | |
1179ebc2 | 4401 | case 430: |
5b09b33e | 4402 | #line 1990 "./parse.y" |
8b27f225 PB |
4403 | { |
4404 | if (ctxp->prevent_ese != lineno) | |
4405 | yyerror ("Invalid type expression"); RECOVER; | |
4406 | RECOVER; | |
4407 | ; | |
4408 | break;} | |
1179ebc2 | 4409 | case 431: |
5b09b33e | 4410 | #line 1996 "./parse.y" |
8b27f225 PB |
4411 | {yyerror ("Missing term"); RECOVER;; |
4412 | break;} | |
1179ebc2 | 4413 | case 432: |
5b09b33e | 4414 | #line 1998 "./parse.y" |
8b27f225 PB |
4415 | {yyerror ("Missing term"); RECOVER;; |
4416 | break;} | |
1179ebc2 | 4417 | case 433: |
5b09b33e | 4418 | #line 2000 "./parse.y" |
22eed1e6 APB |
4419 | {yyerror ("Missing term"); RECOVER;; |
4420 | break;} | |
1179ebc2 | 4421 | case 435: |
5b09b33e | 4422 | #line 2006 "./parse.y" |
8b27f225 PB |
4423 | { |
4424 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), | |
4425 | yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); | |
4426 | ; | |
4427 | break;} | |
1179ebc2 | 4428 | case 436: |
5b09b33e | 4429 | #line 2011 "./parse.y" |
8b27f225 PB |
4430 | { |
4431 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4432 | yyvsp[-2].node, yyvsp[0].node); | |
4433 | ; | |
4434 | break;} | |
1179ebc2 | 4435 | case 437: |
5b09b33e | 4436 | #line 2016 "./parse.y" |
8b27f225 PB |
4437 | { |
4438 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4439 | yyvsp[-2].node, yyvsp[0].node); | |
4440 | ; | |
4441 | break;} | |
1179ebc2 | 4442 | case 438: |
5b09b33e | 4443 | #line 2021 "./parse.y" |
8b27f225 PB |
4444 | {yyerror ("Missing term"); RECOVER;; |
4445 | break;} | |
1179ebc2 | 4446 | case 439: |
5b09b33e | 4447 | #line 2023 "./parse.y" |
22eed1e6 APB |
4448 | {yyerror ("Missing term"); RECOVER;; |
4449 | break;} | |
1179ebc2 | 4450 | case 440: |
5b09b33e | 4451 | #line 2025 "./parse.y" |
8b27f225 PB |
4452 | {yyerror ("Missing term"); RECOVER;; |
4453 | break;} | |
1179ebc2 | 4454 | case 442: |
5b09b33e | 4455 | #line 2031 "./parse.y" |
8b27f225 PB |
4456 | { |
4457 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4458 | yyvsp[-2].node, yyvsp[0].node); | |
4459 | ; | |
4460 | break;} | |
1179ebc2 | 4461 | case 443: |
5b09b33e | 4462 | #line 2036 "./parse.y" |
8b27f225 PB |
4463 | { |
4464 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4465 | yyvsp[-2].node, yyvsp[0].node); | |
4466 | ; | |
4467 | break;} | |
1179ebc2 | 4468 | case 444: |
5b09b33e | 4469 | #line 2041 "./parse.y" |
8b27f225 PB |
4470 | {yyerror ("Missing term"); RECOVER;; |
4471 | break;} | |
1179ebc2 | 4472 | case 445: |
5b09b33e | 4473 | #line 2043 "./parse.y" |
8b27f225 PB |
4474 | {yyerror ("Missing term"); RECOVER;; |
4475 | break;} | |
1179ebc2 | 4476 | case 447: |
5b09b33e | 4477 | #line 2049 "./parse.y" |
8b27f225 PB |
4478 | { |
4479 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4480 | yyvsp[-2].node, yyvsp[0].node); | |
4481 | ; | |
4482 | break;} | |
1179ebc2 | 4483 | case 448: |
5b09b33e | 4484 | #line 2054 "./parse.y" |
8b27f225 PB |
4485 | { |
4486 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4487 | yyvsp[-2].node, yyvsp[0].node); | |
4488 | ; | |
4489 | break;} | |
1179ebc2 | 4490 | case 449: |
5b09b33e | 4491 | #line 2059 "./parse.y" |
8b27f225 PB |
4492 | { |
4493 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4494 | yyvsp[-2].node, yyvsp[0].node); | |
4495 | ; | |
4496 | break;} | |
1179ebc2 | 4497 | case 450: |
5b09b33e | 4498 | #line 2064 "./parse.y" |
1179ebc2 APB |
4499 | {yyerror ("Missing term"); RECOVER;; |
4500 | break;} | |
8b27f225 | 4501 | case 451: |
5b09b33e | 4502 | #line 2066 "./parse.y" |
8b27f225 PB |
4503 | {yyerror ("Missing term"); RECOVER;; |
4504 | break;} | |
4505 | case 452: | |
5b09b33e | 4506 | #line 2068 "./parse.y" |
8b27f225 PB |
4507 | {yyerror ("Missing term"); RECOVER;; |
4508 | break;} | |
1179ebc2 | 4509 | case 454: |
5b09b33e | 4510 | #line 2074 "./parse.y" |
1179ebc2 APB |
4511 | { |
4512 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4513 | yyvsp[-2].node, yyvsp[0].node); | |
4514 | ; | |
8b27f225 PB |
4515 | break;} |
4516 | case 455: | |
5b09b33e | 4517 | #line 2079 "./parse.y" |
8b27f225 PB |
4518 | { |
4519 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4520 | yyvsp[-2].node, yyvsp[0].node); | |
4521 | ; | |
4522 | break;} | |
4523 | case 456: | |
5b09b33e | 4524 | #line 2084 "./parse.y" |
8b27f225 PB |
4525 | { |
4526 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4527 | yyvsp[-2].node, yyvsp[0].node); | |
4528 | ; | |
4529 | break;} | |
4530 | case 457: | |
5b09b33e | 4531 | #line 2089 "./parse.y" |
8b27f225 PB |
4532 | { |
4533 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4534 | yyvsp[-2].node, yyvsp[0].node); | |
4535 | ; | |
4536 | break;} | |
22eed1e6 | 4537 | case 458: |
5b09b33e | 4538 | #line 2094 "./parse.y" |
1179ebc2 | 4539 | { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ; |
8b27f225 | 4540 | break;} |
5e942c50 | 4541 | case 459: |
5b09b33e | 4542 | #line 2096 "./parse.y" |
1179ebc2 | 4543 | {yyerror ("Missing term"); RECOVER;; |
5e942c50 | 4544 | break;} |
8b27f225 | 4545 | case 460: |
5b09b33e | 4546 | #line 2098 "./parse.y" |
8b27f225 PB |
4547 | {yyerror ("Missing term"); RECOVER;; |
4548 | break;} | |
4549 | case 461: | |
5b09b33e | 4550 | #line 2100 "./parse.y" |
8b27f225 PB |
4551 | {yyerror ("Missing term"); RECOVER;; |
4552 | break;} | |
4553 | case 462: | |
5b09b33e | 4554 | #line 2102 "./parse.y" |
8b27f225 PB |
4555 | {yyerror ("Missing term"); RECOVER;; |
4556 | break;} | |
4557 | case 463: | |
5b09b33e | 4558 | #line 2104 "./parse.y" |
8b27f225 PB |
4559 | {yyerror ("Invalid reference type"); RECOVER;; |
4560 | break;} | |
1179ebc2 | 4561 | case 465: |
5b09b33e | 4562 | #line 2110 "./parse.y" |
8b27f225 PB |
4563 | { |
4564 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4565 | yyvsp[-2].node, yyvsp[0].node); | |
4566 | ; | |
4567 | break;} | |
1179ebc2 | 4568 | case 466: |
5b09b33e | 4569 | #line 2115 "./parse.y" |
8b27f225 PB |
4570 | { |
4571 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4572 | yyvsp[-2].node, yyvsp[0].node); | |
4573 | ; | |
4574 | break;} | |
1179ebc2 | 4575 | case 467: |
5b09b33e | 4576 | #line 2120 "./parse.y" |
8b27f225 PB |
4577 | {yyerror ("Missing term"); RECOVER;; |
4578 | break;} | |
1179ebc2 | 4579 | case 468: |
5b09b33e | 4580 | #line 2122 "./parse.y" |
8b27f225 PB |
4581 | {yyerror ("Missing term"); RECOVER;; |
4582 | break;} | |
1179ebc2 | 4583 | case 470: |
5b09b33e | 4584 | #line 2128 "./parse.y" |
8b27f225 PB |
4585 | { |
4586 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4587 | yyvsp[-2].node, yyvsp[0].node); | |
4588 | ; | |
4589 | break;} | |
1179ebc2 | 4590 | case 471: |
5b09b33e | 4591 | #line 2133 "./parse.y" |
8b27f225 PB |
4592 | {yyerror ("Missing term"); RECOVER;; |
4593 | break;} | |
1179ebc2 | 4594 | case 473: |
5b09b33e | 4595 | #line 2139 "./parse.y" |
8b27f225 PB |
4596 | { |
4597 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4598 | yyvsp[-2].node, yyvsp[0].node); | |
4599 | ; | |
4600 | break;} | |
1179ebc2 | 4601 | case 474: |
5b09b33e | 4602 | #line 2144 "./parse.y" |
8b27f225 PB |
4603 | {yyerror ("Missing term"); RECOVER;; |
4604 | break;} | |
1179ebc2 | 4605 | case 476: |
5b09b33e | 4606 | #line 2150 "./parse.y" |
8b27f225 PB |
4607 | { |
4608 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4609 | yyvsp[-2].node, yyvsp[0].node); | |
4610 | ; | |
4611 | break;} | |
1179ebc2 | 4612 | case 477: |
5b09b33e | 4613 | #line 2155 "./parse.y" |
8b27f225 PB |
4614 | {yyerror ("Missing term"); RECOVER;; |
4615 | break;} | |
1179ebc2 | 4616 | case 479: |
5b09b33e | 4617 | #line 2161 "./parse.y" |
8b27f225 PB |
4618 | { |
4619 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4620 | yyvsp[-2].node, yyvsp[0].node); | |
4621 | ; | |
4622 | break;} | |
1179ebc2 | 4623 | case 480: |
5b09b33e | 4624 | #line 2166 "./parse.y" |
8b27f225 PB |
4625 | {yyerror ("Missing term"); RECOVER;; |
4626 | break;} | |
1179ebc2 | 4627 | case 482: |
5b09b33e | 4628 | #line 2172 "./parse.y" |
8b27f225 PB |
4629 | { |
4630 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4631 | yyvsp[-2].node, yyvsp[0].node); | |
4632 | ; | |
4633 | break;} | |
1179ebc2 | 4634 | case 483: |
5b09b33e | 4635 | #line 2177 "./parse.y" |
8b27f225 PB |
4636 | {yyerror ("Missing term"); RECOVER;; |
4637 | break;} | |
1179ebc2 | 4638 | case 485: |
5b09b33e | 4639 | #line 2183 "./parse.y" |
22eed1e6 APB |
4640 | { |
4641 | yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); | |
4642 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location; | |
4643 | ; | |
4644 | break;} | |
1179ebc2 | 4645 | case 486: |
5b09b33e | 4646 | #line 2188 "./parse.y" |
8b27f225 PB |
4647 | { |
4648 | YYERROR_NOW; | |
4649 | yyerror ("Missing term"); | |
4650 | DRECOVER (1); | |
4651 | ; | |
4652 | break;} | |
1179ebc2 | 4653 | case 487: |
5b09b33e | 4654 | #line 2194 "./parse.y" |
8b27f225 PB |
4655 | {yyerror ("Missing term"); DRECOVER (2);; |
4656 | break;} | |
1179ebc2 | 4657 | case 488: |
5b09b33e | 4658 | #line 2196 "./parse.y" |
8b27f225 PB |
4659 | {yyerror ("Missing term"); DRECOVER (3);; |
4660 | break;} | |
1179ebc2 | 4661 | case 491: |
5b09b33e | 4662 | #line 2206 "./parse.y" |
8b27f225 PB |
4663 | { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ; |
4664 | break;} | |
1179ebc2 | 4665 | case 492: |
5b09b33e | 4666 | #line 2208 "./parse.y" |
8b27f225 PB |
4667 | { |
4668 | if (ctxp->prevent_ese != lineno) | |
4669 | yyerror ("Missing term"); | |
4670 | DRECOVER (assign); | |
4671 | ; | |
4672 | break;} | |
4673 | } | |
4674 | /* the action file gets copied in in place of this dollarsign */ | |
22eed1e6 | 4675 | #line 498 "/usr/cygnus/gnupro-98r1/share/bison.simple" |
8b27f225 PB |
4676 | \f |
4677 | yyvsp -= yylen; | |
4678 | yyssp -= yylen; | |
4679 | #ifdef YYLSP_NEEDED | |
4680 | yylsp -= yylen; | |
4681 | #endif | |
4682 | ||
4683 | #if YYDEBUG != 0 | |
4684 | if (yydebug) | |
4685 | { | |
4686 | short *ssp1 = yyss - 1; | |
4687 | fprintf (stderr, "state stack now"); | |
4688 | while (ssp1 != yyssp) | |
4689 | fprintf (stderr, " %d", *++ssp1); | |
4690 | fprintf (stderr, "\n"); | |
4691 | } | |
4692 | #endif | |
4693 | ||
4694 | *++yyvsp = yyval; | |
4695 | ||
4696 | #ifdef YYLSP_NEEDED | |
4697 | yylsp++; | |
4698 | if (yylen == 0) | |
4699 | { | |
4700 | yylsp->first_line = yylloc.first_line; | |
4701 | yylsp->first_column = yylloc.first_column; | |
4702 | yylsp->last_line = (yylsp-1)->last_line; | |
4703 | yylsp->last_column = (yylsp-1)->last_column; | |
4704 | yylsp->text = 0; | |
4705 | } | |
4706 | else | |
4707 | { | |
4708 | yylsp->last_line = (yylsp+yylen-1)->last_line; | |
4709 | yylsp->last_column = (yylsp+yylen-1)->last_column; | |
4710 | } | |
4711 | #endif | |
4712 | ||
4713 | /* Now "shift" the result of the reduction. | |
4714 | Determine what state that goes to, | |
4715 | based on the state we popped back to | |
4716 | and the rule number reduced by. */ | |
4717 | ||
4718 | yyn = yyr1[yyn]; | |
4719 | ||
4720 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
4721 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
4722 | yystate = yytable[yystate]; | |
4723 | else | |
4724 | yystate = yydefgoto[yyn - YYNTBASE]; | |
4725 | ||
4726 | goto yynewstate; | |
4727 | ||
4728 | yyerrlab: /* here on detecting error */ | |
4729 | ||
4730 | if (! yyerrstatus) | |
4731 | /* If not already recovering from an error, report this error. */ | |
4732 | { | |
4733 | ++yynerrs; | |
4734 | ||
4735 | #ifdef YYERROR_VERBOSE | |
4736 | yyn = yypact[yystate]; | |
4737 | ||
4738 | if (yyn > YYFLAG && yyn < YYLAST) | |
4739 | { | |
4740 | int size = 0; | |
4741 | char *msg; | |
4742 | int x, count; | |
4743 | ||
4744 | count = 0; | |
4745 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
4746 | for (x = (yyn < 0 ? -yyn : 0); | |
4747 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
4748 | if (yycheck[x + yyn] == x) | |
4749 | size += strlen(yytname[x]) + 15, count++; | |
4750 | msg = (char *) malloc(size + 15); | |
4751 | if (msg != 0) | |
4752 | { | |
4753 | strcpy(msg, "parse error"); | |
4754 | ||
4755 | if (count < 5) | |
4756 | { | |
4757 | count = 0; | |
4758 | for (x = (yyn < 0 ? -yyn : 0); | |
4759 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
4760 | if (yycheck[x + yyn] == x) | |
4761 | { | |
4762 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | |
4763 | strcat(msg, yytname[x]); | |
4764 | strcat(msg, "'"); | |
4765 | count++; | |
4766 | } | |
4767 | } | |
4768 | yyerror(msg); | |
4769 | free(msg); | |
4770 | } | |
4771 | else | |
4772 | yyerror ("parse error; also virtual memory exceeded"); | |
4773 | } | |
4774 | else | |
4775 | #endif /* YYERROR_VERBOSE */ | |
4776 | yyerror("parse error"); | |
4777 | } | |
4778 | ||
4779 | goto yyerrlab1; | |
4780 | yyerrlab1: /* here on error raised explicitly by an action */ | |
4781 | ||
4782 | if (yyerrstatus == 3) | |
4783 | { | |
4784 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ | |
4785 | ||
4786 | /* return failure if at end of input */ | |
4787 | if (yychar == YYEOF) | |
4788 | YYABORT; | |
4789 | ||
4790 | #if YYDEBUG != 0 | |
4791 | if (yydebug) | |
4792 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | |
4793 | #endif | |
4794 | ||
4795 | yychar = YYEMPTY; | |
4796 | } | |
4797 | ||
4798 | /* Else will try to reuse lookahead token | |
4799 | after shifting the error token. */ | |
4800 | ||
4801 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
4802 | ||
4803 | goto yyerrhandle; | |
4804 | ||
4805 | yyerrdefault: /* current state does not do anything special for the error token. */ | |
4806 | ||
4807 | #if 0 | |
4808 | /* This is wrong; only states that explicitly want error tokens | |
4809 | should shift them. */ | |
4810 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ | |
4811 | if (yyn) goto yydefault; | |
4812 | #endif | |
4813 | ||
4814 | yyerrpop: /* pop the current state because it cannot handle the error token */ | |
4815 | ||
4816 | if (yyssp == yyss) YYABORT; | |
4817 | yyvsp--; | |
4818 | yystate = *--yyssp; | |
4819 | #ifdef YYLSP_NEEDED | |
4820 | yylsp--; | |
4821 | #endif | |
4822 | ||
4823 | #if YYDEBUG != 0 | |
4824 | if (yydebug) | |
4825 | { | |
4826 | short *ssp1 = yyss - 1; | |
4827 | fprintf (stderr, "Error: state stack now"); | |
4828 | while (ssp1 != yyssp) | |
4829 | fprintf (stderr, " %d", *++ssp1); | |
4830 | fprintf (stderr, "\n"); | |
4831 | } | |
4832 | #endif | |
4833 | ||
4834 | yyerrhandle: | |
4835 | ||
4836 | yyn = yypact[yystate]; | |
4837 | if (yyn == YYFLAG) | |
4838 | goto yyerrdefault; | |
4839 | ||
4840 | yyn += YYTERROR; | |
4841 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
4842 | goto yyerrdefault; | |
4843 | ||
4844 | yyn = yytable[yyn]; | |
4845 | if (yyn < 0) | |
4846 | { | |
4847 | if (yyn == YYFLAG) | |
4848 | goto yyerrpop; | |
4849 | yyn = -yyn; | |
4850 | goto yyreduce; | |
4851 | } | |
4852 | else if (yyn == 0) | |
4853 | goto yyerrpop; | |
4854 | ||
4855 | if (yyn == YYFINAL) | |
4856 | YYACCEPT; | |
4857 | ||
4858 | #if YYDEBUG != 0 | |
4859 | if (yydebug) | |
4860 | fprintf(stderr, "Shifting error token, "); | |
4861 | #endif | |
4862 | ||
4863 | *++yyvsp = yylval; | |
4864 | #ifdef YYLSP_NEEDED | |
4865 | *++yylsp = yylloc; | |
4866 | #endif | |
4867 | ||
4868 | yystate = yyn; | |
4869 | goto yynewstate; | |
4870 | } | |
5b09b33e | 4871 | #line 2234 "./parse.y" |
8b27f225 PB |
4872 | |
4873 | \f | |
4874 | ||
4875 | #include "lex.c" | |
4876 | ||
4877 | /* Flag for the error report routine to issue the error the first time | |
4878 | it's called (overriding the default behavior which is to drop the | |
4879 | first invocation and honor the second one, taking advantage of a | |
4880 | richer context. */ | |
4881 | static int force_error = 0; | |
4882 | ||
4883 | /* Create a new parser context and make it the current one. */ | |
4884 | ||
4885 | void | |
4886 | java_push_parser_context () | |
4887 | { | |
4888 | struct parser_ctxt *new = | |
23a79c61 | 4889 | (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt)); |
8b27f225 PB |
4890 | |
4891 | bzero (new, sizeof (struct parser_ctxt)); | |
4892 | new->next = ctxp; | |
4893 | ctxp = new; | |
4894 | if (ctxp->next) | |
5e942c50 APB |
4895 | { |
4896 | ctxp->incomplete_class = ctxp->next->incomplete_class; | |
4897 | ctxp->gclass_list = ctxp->next->gclass_list; | |
4898 | } | |
8b27f225 PB |
4899 | } |
4900 | ||
22eed1e6 APB |
4901 | /* If the first file of a file list was a class file, no context |
4902 | exists for a source file to be parsed. This boolean remembers that | |
4903 | java_parser_context_save_global might have created a dummy one, so | |
4904 | that java_parser_context_restore_global can pop it. */ | |
4905 | static int extra_ctxp_pushed_p = 0; | |
4906 | ||
8b27f225 PB |
4907 | void |
4908 | java_parser_context_save_global () | |
4909 | { | |
22eed1e6 APB |
4910 | if (!ctxp) |
4911 | { | |
4912 | java_push_parser_context (); | |
4913 | extra_ctxp_pushed_p = 1; | |
4914 | } | |
8b27f225 PB |
4915 | ctxp->finput = finput; |
4916 | ctxp->lineno = lineno; | |
4917 | ctxp->current_class = current_class; | |
4918 | ctxp->filename = input_filename; | |
4919 | ctxp->current_function_decl = current_function_decl; | |
4920 | } | |
4921 | ||
4922 | void | |
4923 | java_parser_context_restore_global () | |
4924 | { | |
4925 | finput = ctxp->finput; | |
4926 | lineno = ctxp->lineno; | |
4927 | current_class = ctxp->current_class; | |
4928 | input_filename = ctxp->filename; | |
4929 | current_function_decl = ctxp->current_function_decl; | |
23a79c61 | 4930 | if (!ctxp->next && extra_ctxp_pushed_p) |
22eed1e6 APB |
4931 | { |
4932 | java_pop_parser_context (0); | |
4933 | extra_ctxp_pushed_p = 0; | |
4934 | } | |
8b27f225 PB |
4935 | } |
4936 | ||
4937 | void | |
b351b287 APB |
4938 | java_pop_parser_context (generate) |
4939 | int generate; | |
8b27f225 PB |
4940 | { |
4941 | tree current; | |
5e942c50 | 4942 | struct parser_ctxt *toFree, *next; |
8b27f225 | 4943 | |
5e942c50 APB |
4944 | if (!ctxp) |
4945 | return; | |
4946 | ||
4947 | toFree = ctxp; | |
4948 | next = ctxp->next; | |
8b27f225 PB |
4949 | if (next) |
4950 | { | |
4951 | next->incomplete_class = ctxp->incomplete_class; | |
5e942c50 | 4952 | next->gclass_list = ctxp->gclass_list; |
8b27f225 PB |
4953 | lineno = ctxp->lineno; |
4954 | finput = ctxp->finput; | |
4955 | current_class = ctxp->current_class; | |
4956 | } | |
4957 | ||
4958 | /* Set the single import class file flag to 0 for the current list | |
4959 | of imported things */ | |
4960 | for (current = ctxp->import_list; current; current = TREE_CHAIN (current)) | |
4961 | IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0; | |
4962 | ||
4963 | /* And restore those of the previous context */ | |
4964 | if ((ctxp = next)) /* Assignment is really meant here */ | |
4965 | for (current = ctxp->import_list; current; current = TREE_CHAIN (current)) | |
4966 | IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1; | |
4967 | ||
b351b287 APB |
4968 | if (generate) |
4969 | { | |
4970 | toFree->next = ctxp_for_generation; | |
4971 | ctxp_for_generation = toFree; | |
4972 | } | |
4973 | else | |
4974 | free (toFree); | |
8b27f225 PB |
4975 | } |
4976 | ||
4977 | /* Reporting JDK1.1 features not implemented */ | |
4978 | ||
4979 | static tree | |
4980 | parse_jdk1_1_error (msg) | |
4981 | char *msg; | |
4982 | { | |
4983 | sorry (": `%s' JDK1.1(TM) feature", msg); | |
4984 | java_error_count++; | |
c877974e | 4985 | return empty_stmt_node; |
8b27f225 PB |
4986 | } |
4987 | ||
4988 | static int do_warning = 0; | |
4989 | ||
4990 | void | |
4991 | yyerror (msg) | |
4992 | char *msg; | |
4993 | { | |
4994 | static java_lc elc; | |
4995 | static int prev_lineno; | |
4996 | static char *prev_msg; | |
4997 | ||
4998 | int save_lineno; | |
4999 | char *remainder, *code_from_source; | |
5000 | extern struct obstack temporary_obstack; | |
5001 | ||
5002 | if (!force_error && prev_lineno == lineno) | |
5003 | return; | |
5004 | ||
5005 | /* Save current error location but report latter, when the context is | |
5006 | richer. */ | |
5007 | if (ctxp->java_error_flag == 0) | |
5008 | { | |
5009 | ctxp->java_error_flag = 1; | |
5010 | elc = ctxp->elc; | |
5011 | /* Do something to use the previous line if we're reaching the | |
5012 | end of the file... */ | |
5013 | #ifdef VERBOSE_SKELETON | |
5014 | printf ("* Error detected (%s)\n", (msg ? msg : "(null)")); | |
5015 | #endif | |
5016 | return; | |
5017 | } | |
5018 | ||
5019 | /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */ | |
5020 | if (!force_error && msg == prev_msg && prev_lineno == elc.line) | |
5021 | return; | |
5022 | ||
5023 | ctxp->java_error_flag = 0; | |
5024 | if (do_warning) | |
5025 | java_warning_count++; | |
5026 | else | |
5027 | java_error_count++; | |
5028 | ||
5029 | if (elc.col == 0 && msg[1] == ';') | |
5030 | { | |
5031 | elc.col = ctxp->p_line->char_col-1; | |
5032 | elc.line = ctxp->p_line->lineno; | |
5033 | } | |
5034 | ||
5035 | save_lineno = lineno; | |
5036 | prev_lineno = lineno = elc.line; | |
5037 | prev_msg = msg; | |
5038 | ||
5039 | code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col); | |
5040 | obstack_grow0 (&temporary_obstack, | |
5041 | code_from_source, strlen (code_from_source)); | |
5042 | remainder = obstack_finish (&temporary_obstack); | |
5043 | if (do_warning) | |
5044 | warning ("%s.\n%s", msg, remainder); | |
5045 | else | |
5046 | error ("%s.\n%s", msg, remainder); | |
5047 | ||
5048 | /* This allow us to cheaply avoid an extra 'Invalid expression | |
5049 | statement' error report when errors have been already reported on | |
5050 | the same line. This occurs when we report an error but don't have | |
5051 | a synchronization point other than ';', which | |
5052 | expression_statement is the only one to take care of. */ | |
5053 | ctxp->prevent_ese = lineno = save_lineno; | |
5054 | } | |
5055 | ||
5056 | static void | |
12472854 | 5057 | issue_warning_error_from_context (cl, msg, ap) |
5e942c50 APB |
5058 | tree cl; |
5059 | char *msg; | |
12472854 | 5060 | va_list ap; |
5e942c50 | 5061 | { |
1886c9d8 | 5062 | char *saved, *saved_input_filename; |
12472854 PB |
5063 | char buffer [4096]; |
5064 | vsprintf (buffer, msg, ap); | |
5065 | force_error = 1; | |
5e942c50 APB |
5066 | |
5067 | ctxp->elc.line = EXPR_WFL_LINENO (cl); | |
82371d41 APB |
5068 | ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 : |
5069 | (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl))); | |
5e942c50 APB |
5070 | |
5071 | /* We have a CL, that's a good reason for using it if it contains data */ | |
5072 | saved = ctxp->filename; | |
5073 | if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl)) | |
5074 | ctxp->filename = EXPR_WFL_FILENAME (cl); | |
1886c9d8 APB |
5075 | saved_input_filename = input_filename; |
5076 | input_filename = ctxp->filename; | |
12472854 PB |
5077 | java_error (NULL); |
5078 | java_error (buffer); | |
5e942c50 | 5079 | ctxp->filename = saved; |
1886c9d8 | 5080 | input_filename = saved_input_filename; |
12472854 | 5081 | force_error = 0; |
5e942c50 APB |
5082 | } |
5083 | ||
8b27f225 PB |
5084 | /* Issue an error message at a current source line CL */ |
5085 | ||
12472854 | 5086 | void |
8b27f225 PB |
5087 | parse_error_context VPROTO ((tree cl, char *msg, ...)) |
5088 | { | |
5089 | #ifndef __STDC__ | |
5090 | tree cl; | |
5091 | char *msg; | |
5092 | #endif | |
8b27f225 PB |
5093 | va_list ap; |
5094 | ||
5095 | VA_START (ap, msg); | |
5096 | #ifndef __STDC__ | |
5097 | cl = va_arg (ap, tree); | |
5098 | msg = va_arg (ap, char *); | |
5099 | #endif | |
12472854 PB |
5100 | issue_warning_error_from_context (cl, msg, ap); |
5101 | va_end (ap); | |
8b27f225 PB |
5102 | } |
5103 | ||
5104 | /* Issue a warning at a current source line CL */ | |
5105 | ||
5106 | static void | |
5107 | parse_warning_context VPROTO ((tree cl, char *msg, ...)) | |
5108 | { | |
5109 | #ifndef __STDC__ | |
5110 | tree cl; | |
5111 | char *msg; | |
5112 | #endif | |
8b27f225 PB |
5113 | va_list ap; |
5114 | ||
5115 | VA_START (ap, msg); | |
5116 | #ifndef __STDC__ | |
5117 | cl = va_arg (ap, tree); | |
5118 | msg = va_arg (ap, char *); | |
5119 | #endif | |
8b27f225 | 5120 | |
c877974e | 5121 | force_error = do_warning = 1; |
12472854 | 5122 | issue_warning_error_from_context (cl, msg, ap); |
c877974e | 5123 | do_warning = force_error = 0; |
12472854 | 5124 | va_end (ap); |
8b27f225 PB |
5125 | } |
5126 | ||
82371d41 APB |
5127 | static tree |
5128 | find_expr_with_wfl (node) | |
5129 | tree node; | |
5130 | { | |
5131 | while (node) | |
5132 | { | |
5133 | char code; | |
5134 | tree to_return; | |
5135 | ||
5136 | switch (TREE_CODE (node)) | |
5137 | { | |
5138 | case BLOCK: | |
5139 | return find_expr_with_wfl (BLOCK_EXPR_BODY (node)); | |
5140 | ||
5141 | case COMPOUND_EXPR: | |
5142 | to_return = find_expr_with_wfl (TREE_OPERAND (node, 0)); | |
5143 | if (to_return) | |
5144 | return to_return; | |
5145 | to_return = find_expr_with_wfl (TREE_OPERAND (node, 1)); | |
5146 | return to_return; | |
5147 | ||
5148 | case LOOP_EXPR: | |
5149 | return find_expr_with_wfl (TREE_OPERAND (node, 0)); | |
5150 | ||
5151 | case LABELED_BLOCK_EXPR: | |
5152 | return find_expr_with_wfl (TREE_OPERAND (node, 1)); | |
5153 | default: | |
5154 | code = TREE_CODE_CLASS (TREE_CODE (node)); | |
5155 | if (((code == '1') || (code == '2') || (code == 'e')) | |
5156 | && EXPR_WFL_LINECOL (node)) | |
5157 | return node; | |
5158 | } | |
5159 | } | |
5160 | return NULL_TREE; | |
5161 | } | |
5162 | ||
5163 | /* Issue a missing return statement error. Uses METHOD to figure the | |
5164 | last line of the method the error occurs in. */ | |
5165 | ||
5166 | static void | |
5167 | missing_return_error (method) | |
5168 | tree method; | |
5169 | { | |
5170 | EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2); | |
5171 | parse_error_context (wfl_operator, "Missing return statement"); | |
5172 | } | |
5173 | ||
5174 | /* Issue an unreachable statement error. From NODE, find the next | |
5175 | statement to report appropriately. */ | |
5176 | static void | |
5177 | unreachable_stmt_error (node) | |
5178 | tree node; | |
5179 | { | |
5180 | /* Browse node to find the next expression node that has a WFL. Use | |
5181 | the location to report the error */ | |
5182 | if (TREE_CODE (node) == COMPOUND_EXPR) | |
5183 | node = find_expr_with_wfl (TREE_OPERAND (node, 1)); | |
5184 | else | |
5185 | node = find_expr_with_wfl (node); | |
5186 | ||
5187 | if (node) | |
5188 | { | |
5189 | EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2); | |
5190 | parse_error_context (wfl_operator, "Unreachable statement"); | |
5191 | } | |
5192 | else | |
5193 | fatal ("Can't get valid statement - unreachable_stmt_error"); | |
5194 | } | |
5195 | ||
c877974e | 5196 | int |
8b27f225 PB |
5197 | java_report_errors () |
5198 | { | |
5199 | if (java_error_count) | |
5200 | fprintf (stderr, "%d error%s", | |
5201 | java_error_count, (java_error_count == 1 ? "" : "s")); | |
5202 | if (java_warning_count) | |
5203 | fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""), | |
5204 | java_warning_count, (java_warning_count == 1 ? "" : "s")); | |
5205 | if (java_error_count || java_warning_count) | |
5206 | putc ('\n', stderr); | |
c877974e | 5207 | return java_error_count; |
8b27f225 PB |
5208 | } |
5209 | ||
5210 | static char * | |
5211 | java_accstring_lookup (flags) | |
5212 | int flags; | |
5213 | { | |
5214 | static char buffer [80]; | |
5215 | #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;} | |
5216 | ||
5217 | /* Access modifier looked-up first for easier report on forbidden | |
5218 | access. */ | |
5219 | if (flags & ACC_PUBLIC) COPY_RETURN ("public"); | |
5220 | if (flags & ACC_PRIVATE) COPY_RETURN ("private"); | |
5221 | if (flags & ACC_PROTECTED) COPY_RETURN ("protected"); | |
5222 | if (flags & ACC_STATIC) COPY_RETURN ("static"); | |
5223 | if (flags & ACC_FINAL) COPY_RETURN ("final"); | |
5224 | if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized"); | |
5225 | if (flags & ACC_VOLATILE) COPY_RETURN ("volatile"); | |
5226 | if (flags & ACC_TRANSIENT) COPY_RETURN ("transient"); | |
5227 | if (flags & ACC_NATIVE) COPY_RETURN ("native"); | |
5228 | if (flags & ACC_INTERFACE) COPY_RETURN ("interface"); | |
5229 | if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract"); | |
5230 | ||
5231 | buffer [0] = '\0'; | |
5232 | return buffer; | |
5233 | #undef COPY_RETURN | |
5234 | } | |
5235 | ||
5236 | /* Issuing error messages upon redefinition of classes, interfaces or | |
5237 | variables. */ | |
5238 | ||
5239 | static void | |
5240 | classitf_redefinition_error (context, id, decl, cl) | |
5241 | char *context; | |
5242 | tree id, decl, cl; | |
5243 | { | |
5244 | parse_error_context (cl, "%s `%s' already defined in %s:%d", | |
5245 | context, IDENTIFIER_POINTER (id), | |
5246 | DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); | |
5247 | /* Here we should point out where its redefined. It's a unicode. FIXME */ | |
5248 | } | |
5249 | ||
5250 | static void | |
5251 | variable_redefinition_error (context, name, type, line) | |
5252 | tree context, name, type; | |
5253 | int line; | |
5254 | { | |
5255 | char *type_name; | |
5256 | ||
5257 | /* Figure a proper name for type. We might haven't resolved it */ | |
c877974e APB |
5258 | if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type)) |
5259 | type_name = IDENTIFIER_POINTER (TYPE_NAME (type)); | |
8b27f225 PB |
5260 | else |
5261 | type_name = lang_printable_name (type, 0); | |
5262 | ||
5263 | parse_error_context (context, | |
5264 | "Variable `%s' is already defined in this method and " | |
5265 | "was declared `%s %s' at line %d", | |
5266 | IDENTIFIER_POINTER (name), | |
5267 | type_name, IDENTIFIER_POINTER (name), line); | |
5268 | } | |
5269 | ||
5270 | static tree | |
5271 | build_array_from_name (type, type_wfl, name, ret_name) | |
5272 | tree type, type_wfl, name, *ret_name; | |
5273 | { | |
5274 | int more_dims = 0; | |
5275 | char *string; | |
5276 | ||
5277 | /* Eventually get more dims */ | |
5278 | string = IDENTIFIER_POINTER (name); | |
5279 | while (string [more_dims] == '[') | |
5280 | more_dims++; | |
5281 | ||
5282 | /* If we have, then craft a new type for this variable */ | |
5283 | if (more_dims) | |
5284 | { | |
5285 | name = get_identifier (&more_dims [string]); | |
5286 | ||
5287 | /* If type already is a reference on an array, get the base type */ | |
5288 | if ((TREE_CODE (type) == POINTER_TYPE) && | |
5289 | TYPE_ARRAY_P (TREE_TYPE (type))) | |
5290 | type = TREE_TYPE (type); | |
5291 | ||
5292 | /* Building the first dimension of a primitive type uses this | |
5293 | function */ | |
5294 | if (JPRIMITIVE_TYPE_P (type)) | |
5295 | { | |
5296 | type = build_java_array_type (type, -1); | |
22eed1e6 | 5297 | CLASS_LOADED_P (type) = 1; |
8b27f225 PB |
5298 | more_dims--; |
5299 | } | |
5300 | /* Otherwise, if we have a WFL for this type, use it (the type | |
5301 | is already an array on an unresolved type, and we just keep | |
5302 | on adding dimensions) */ | |
5303 | else if (type_wfl) | |
5304 | type = type_wfl; | |
5305 | ||
5306 | /* Add all the dimensions */ | |
5307 | while (more_dims--) | |
5308 | type = build_unresolved_array_type (type); | |
5309 | ||
5310 | /* The type may have been incomplete in the first place */ | |
5311 | if (type_wfl) | |
5312 | type = obtain_incomplete_type (type); | |
5313 | } | |
5314 | ||
5315 | *ret_name = name; | |
5316 | return type; | |
5317 | } | |
5318 | ||
5319 | /* Build something that the type identifier resolver will identify as | |
5320 | being an array to an unresolved type. TYPE_WFL is a WFL on a | |
5321 | identifier. */ | |
5322 | ||
5323 | static tree | |
5324 | build_unresolved_array_type (type_or_wfl) | |
5325 | tree type_or_wfl; | |
5326 | { | |
5327 | char *ptr; | |
5328 | ||
1886c9d8 | 5329 | /* TYPE_OR_WFL might be an array on a resolved type. In this case, |
8b27f225 PB |
5330 | just create a array type */ |
5331 | if (TREE_CODE (type_or_wfl) == RECORD_TYPE) | |
5332 | { | |
5333 | tree type = build_java_array_type (type_or_wfl, -1); | |
5334 | CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl); | |
5335 | return type; | |
5336 | } | |
5337 | ||
5338 | obstack_1grow (&temporary_obstack, '['); | |
5339 | obstack_grow0 (&temporary_obstack, | |
5340 | IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)), | |
5341 | IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl))); | |
5342 | ptr = obstack_finish (&temporary_obstack); | |
5343 | return build_expr_wfl (get_identifier (ptr), | |
5344 | EXPR_WFL_FILENAME (type_or_wfl), | |
5345 | EXPR_WFL_LINENO (type_or_wfl), | |
5346 | EXPR_WFL_COLNO (type_or_wfl)); | |
5347 | } | |
5348 | ||
5349 | /* Check modifiers. If one doesn't fit, retrieve it in its declaration line | |
5350 | and point it out. */ | |
5351 | ||
5352 | static void | |
5353 | check_modifiers (message, value, mask) | |
5354 | char *message; | |
5355 | int value; | |
5356 | int mask; | |
5357 | { | |
5358 | /* Should point out the one that don't fit. ASCII/unicode, | |
5359 | going backward. FIXME */ | |
5360 | if (value & ~mask) | |
5361 | { | |
5362 | int i, remainder = value & ~mask; | |
5363 | for (i = 0; i <= 10; i++) | |
5364 | if ((1 << i) & remainder) | |
5365 | parse_error_context (ctxp->modifier_ctx [i], message, | |
5366 | java_accstring_lookup (1 << i)); | |
5367 | } | |
5368 | } | |
5369 | ||
5370 | static void | |
5371 | parser_add_interface (class_decl, interface_decl, wfl) | |
5372 | tree class_decl, interface_decl, wfl; | |
5373 | { | |
5374 | if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl))) | |
5375 | parse_error_context (wfl, "Interface `%s' repeated", | |
5376 | IDENTIFIER_POINTER (DECL_NAME (interface_decl))); | |
5377 | } | |
5378 | ||
5379 | /* Bulk of common class/interface checks. Return 1 if an error was | |
5380 | encountered. TAG is 0 for a class, 1 for an interface. */ | |
5381 | ||
5382 | static int | |
5383 | check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl) | |
5384 | int is_interface, flags; | |
5385 | tree raw_name, qualified_name, decl, cl; | |
5386 | { | |
5387 | tree node; | |
5388 | ||
5389 | if (!quiet_flag) | |
5390 | fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"), | |
5391 | IDENTIFIER_POINTER (qualified_name)); | |
5392 | ||
5393 | /* Scope of an interface/class type name: | |
5394 | - Can't be imported by a single type import | |
5395 | - Can't already exists in the package */ | |
5396 | if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name) | |
5397 | && (node = find_name_in_single_imports (raw_name))) | |
5398 | { | |
5399 | parse_error_context | |
5400 | (cl, "%s name `%s' clashes with imported type `%s'", | |
5401 | (is_interface ? "Interface" : "Class"), | |
5402 | IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node)); | |
5403 | return 1; | |
5404 | } | |
5405 | if (decl && CLASS_COMPLETE_P (decl)) | |
5406 | { | |
5407 | classitf_redefinition_error ((is_interface ? "Interface" : "Class"), | |
5408 | qualified_name, decl, cl); | |
5409 | return 1; | |
5410 | } | |
5411 | ||
5412 | /* If public, file name should match class/interface name */ | |
5413 | if (flags & ACC_PUBLIC) | |
5414 | { | |
5415 | char *f; | |
5416 | ||
5417 | /* Contains OS dependent assumption on path separator. FIXME */ | |
5418 | for (f = &input_filename [strlen (input_filename)]; | |
5419 | f != input_filename && f[0] != '/'; f--); | |
5420 | if (f[0] == '/') | |
5421 | f++; | |
5422 | if (strncmp (IDENTIFIER_POINTER (raw_name), | |
5423 | f , IDENTIFIER_LENGTH (raw_name)) || | |
5424 | f [IDENTIFIER_LENGTH (raw_name)] != '.') | |
5425 | parse_error_context (cl, "Public %s `%s' must be defined in a file " | |
5426 | "called `%s.java'", | |
5427 | (is_interface ? "interface" : "class"), | |
5428 | IDENTIFIER_POINTER (qualified_name), | |
5429 | IDENTIFIER_POINTER (raw_name)); | |
5430 | } | |
5431 | ||
5432 | check_modifiers ((is_interface ? | |
5433 | "Illegal modifier `%s' for interface declaration" : | |
5434 | "Illegal modifier `%s' for class declaration"), flags, | |
5435 | (is_interface ? INTERFACE_MODIFIERS : CLASS_MODIFIERS)); | |
5436 | return 0; | |
5437 | } | |
5438 | ||
5439 | /* If DECL is NULL, create and push a new DECL, record the current | |
5440 | line CL and do other maintenance things. */ | |
5441 | ||
5442 | static tree | |
5443 | maybe_create_class_interface_decl (decl, qualified_name, cl) | |
5444 | tree decl, qualified_name, cl; | |
5445 | { | |
5e942c50 | 5446 | if (!decl) |
8b27f225 PB |
5447 | decl = push_class (make_class (), qualified_name); |
5448 | ||
5449 | /* Take care of the file and line business */ | |
5450 | DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl); | |
5451 | DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl); | |
5452 | CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1; | |
b351b287 APB |
5453 | CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) = |
5454 | IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl)); | |
8b27f225 PB |
5455 | |
5456 | ctxp->current_parsed_class = decl; | |
5457 | ||
5458 | /* Link the declaration to the already seen ones */ | |
5459 | TREE_CHAIN (decl) = ctxp->class_list; | |
5460 | ctxp->class_list = decl; | |
5e942c50 | 5461 | |
23a79c61 | 5462 | /* Create a new nodes in the global lists */ |
5e942c50 | 5463 | ctxp->gclass_list = tree_cons (NULL_TREE, decl, ctxp->gclass_list); |
23a79c61 | 5464 | all_class_list = tree_cons (NULL_TREE, decl, all_class_list); |
5e942c50 | 5465 | |
8b27f225 PB |
5466 | /* Install a new dependency list element */ |
5467 | create_jdep_list (ctxp); | |
5468 | ||
5469 | SOURCE_FRONTEND_DEBUG (("Defining class/interface %s", | |
5470 | IDENTIFIER_POINTER (qualified_name))); | |
5471 | return decl; | |
5472 | } | |
5473 | ||
5474 | static void | |
5475 | add_superinterfaces (decl, interface_list) | |
5476 | tree decl, interface_list; | |
5477 | { | |
5478 | tree node; | |
5479 | /* Superinterface(s): if present and defined, parser_check_super_interface () | |
5480 | takes care of ensuring that: | |
5481 | - This is an accessible interface type, | |
5482 | - Circularity detection. | |
5483 | parser_add_interface is then called. If present but not defined, | |
5484 | the check operation is delayed until the super interface gets | |
5485 | defined. */ | |
5486 | for (node = interface_list; node; node = TREE_CHAIN (node)) | |
5487 | { | |
5e942c50 APB |
5488 | tree current = TREE_PURPOSE (node); |
5489 | tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current)); | |
5490 | if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl))) | |
8b27f225 | 5491 | { |
5e942c50 APB |
5492 | if (!parser_check_super_interface (idecl, decl, current)) |
5493 | parser_add_interface (decl, idecl, current); | |
8b27f225 PB |
5494 | } |
5495 | else | |
5496 | register_incomplete_type (JDEP_INTERFACE, | |
5497 | current, decl, NULL_TREE); | |
5498 | } | |
5499 | } | |
5500 | ||
5501 | /* Create an interface in pass1 and return its decl. Return the | |
5502 | interface's decl in pass 2. */ | |
5503 | ||
5504 | static tree | |
5505 | create_interface (flags, id, super) | |
5506 | int flags; | |
5507 | tree id, super; | |
5508 | { | |
5509 | tree raw_name = EXPR_WFL_NODE (id); | |
5510 | tree q_name = parser_qualified_classname (id); | |
5511 | tree decl = IDENTIFIER_CLASS_VALUE (q_name); | |
5512 | ||
5513 | EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */ | |
5514 | ||
5515 | /* Basic checks: scope, redefinition, modifiers */ | |
5516 | if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id)) | |
5517 | return NULL_TREE; | |
5518 | ||
5519 | /* Interface modifiers check | |
5520 | - public/abstract allowed (already done at that point) | |
5521 | - abstract is obsolete (comes first, it's a warning, or should be) | |
5522 | - Can't use twice the same (checked in the modifier rule) */ | |
c877974e | 5523 | if ((flags & ACC_ABSTRACT) && flag_redundant) |
8b27f225 PB |
5524 | parse_warning_context |
5525 | (MODIFIER_WFL (ABSTRACT_TK), | |
c877974e | 5526 | "Redundant use of `abstract' modifier. Interface `%s' is implicitely " |
8b27f225 | 5527 | "abstract", IDENTIFIER_POINTER (raw_name)); |
8b27f225 PB |
5528 | |
5529 | /* Create a new decl if DECL is NULL, otherwise fix it */ | |
5530 | decl = maybe_create_class_interface_decl (decl, q_name, id); | |
5531 | ||
5532 | /* Set super info and mark the class a complete */ | |
5533 | set_super_info (ACC_ABSTRACT | ACC_INTERFACE | flags, TREE_TYPE (decl), | |
5534 | object_type_node, ctxp->interface_number); | |
5535 | ctxp->interface_number = 0; | |
5536 | CLASS_COMPLETE_P (decl) = 1; | |
5537 | add_superinterfaces (decl, super); | |
5538 | ||
5539 | return decl; | |
5540 | } | |
5541 | ||
5542 | /* Create an class in pass1 and return its decl. Return class | |
5543 | interface's decl in pass 2. */ | |
5544 | ||
5545 | static tree | |
5546 | create_class (flags, id, super, interfaces) | |
5547 | int flags; | |
5548 | tree id, super, interfaces; | |
5549 | { | |
5550 | tree raw_name = EXPR_WFL_NODE (id); | |
5551 | tree class_id, decl; | |
5552 | tree super_decl = NULL, super_decl_type; | |
5553 | ||
5554 | class_id = parser_qualified_classname (id); | |
5555 | decl = IDENTIFIER_CLASS_VALUE (class_id); | |
5e942c50 | 5556 | ctxp->current_parsed_class_un = EXPR_WFL_NODE (id); |
8b27f225 PB |
5557 | EXPR_WFL_NODE (id) = class_id; |
5558 | ||
5559 | /* Basic check: scope, redefinition, modifiers */ | |
5560 | if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id)) | |
5561 | return NULL_TREE; | |
5562 | ||
5563 | /* Class modifier check: | |
5564 | - Allowed modifier (already done at that point) | |
5565 | - abstract AND final forbidden | |
5566 | - Public classes defined in the correct file */ | |
5567 | if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL)) | |
5568 | parse_error_context (id, "Class `%s' can't be declared both abstract " | |
5569 | "and final", IDENTIFIER_POINTER (raw_name)); | |
5570 | ||
5571 | /* Create a new decl if DECL is NULL, otherwise fix it */ | |
5572 | decl = maybe_create_class_interface_decl (decl, class_id, id); | |
5573 | ||
5574 | /* If SUPER exists, use it, otherwise use Object */ | |
5575 | if (super) | |
5576 | { | |
5577 | /* Can't extend java.lang.Object */ | |
5578 | if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node) | |
5579 | { | |
5580 | parse_error_context (id, "Can't extend `java.lang.Object'"); | |
5581 | return NULL_TREE; | |
5582 | } | |
5583 | ||
5584 | /* The class is known and exists if there is a decl. Otherwise, | |
5585 | postpone the operation and do it later. */ | |
5586 | super_decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (super)); | |
5587 | if (super_decl) | |
5588 | { | |
5589 | parser_check_super (super_decl, decl, id); | |
5590 | super_decl_type = TREE_TYPE (super_decl); | |
5591 | } | |
5592 | else | |
82371d41 | 5593 | super_decl_type = |
8b27f225 PB |
5594 | register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE); |
5595 | } | |
5596 | else if (TREE_TYPE (decl) != object_type_node) | |
5597 | super_decl_type = object_type_node; | |
5598 | /* We're defining java.lang.Object */ | |
5599 | else | |
5600 | super_decl_type = NULL_TREE; | |
5601 | ||
5602 | /* Set super info and mark the class a complete */ | |
5603 | set_super_info (flags, TREE_TYPE (decl), super_decl_type, | |
5604 | ctxp->interface_number); | |
5605 | ctxp->interface_number = 0; | |
5606 | CLASS_COMPLETE_P (decl) = 1; | |
5607 | add_superinterfaces (decl, interfaces); | |
5608 | ||
5e942c50 APB |
5609 | /* Eventually sets the @deprecated tag flag */ |
5610 | CHECK_DEPRECATED (decl); | |
5611 | ||
8b27f225 PB |
5612 | return decl; |
5613 | } | |
5614 | ||
5615 | /* Can't use lookup_field () since we don't want to load the class and | |
5616 | can't set the CLASS_LOADED_P flag */ | |
5617 | ||
5618 | static tree | |
5619 | find_field (class, name) | |
5620 | tree class; | |
5621 | tree name; | |
5622 | { | |
5623 | tree decl; | |
5624 | for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl)) | |
5625 | { | |
5626 | if (DECL_NAME (decl) == name) | |
5627 | return decl; | |
5628 | } | |
5629 | return NULL_TREE; | |
5630 | } | |
5631 | ||
5632 | /* Wrap around lookup_field that doesn't potentially upset the value | |
5633 | of CLASS */ | |
5634 | ||
5635 | static tree | |
5636 | lookup_field_wrapper (class, name) | |
5637 | tree class, name; | |
5638 | { | |
5639 | tree type = class; | |
5b09b33e | 5640 | tree decl; |
c877974e | 5641 | java_parser_context_save_global (); |
5b09b33e | 5642 | decl = lookup_field (&type, name); |
c877974e | 5643 | java_parser_context_restore_global (); |
5b09b33e | 5644 | return decl; |
8b27f225 PB |
5645 | } |
5646 | ||
5647 | /* Find duplicate field within the same class declarations and report | |
5648 | the error. Returns 1 if a duplicated field was found, 0 | |
5649 | otherwise. */ | |
5650 | ||
5651 | static int | |
5652 | duplicate_declaration_error_p (new_field_name, new_type, cl) | |
5653 | tree new_field_name, new_type, cl; | |
5654 | { | |
5655 | /* This might be modified to work with method decl as well */ | |
5656 | tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class), | |
5657 | new_field_name); | |
5658 | if (decl) | |
5659 | { | |
4a5f66c3 APB |
5660 | char *t1 = strdup (purify_type_name |
5661 | ((TREE_CODE (new_type) == POINTER_TYPE | |
5662 | && TREE_TYPE (new_type) == NULL_TREE) ? | |
5663 | IDENTIFIER_POINTER (TYPE_NAME (new_type)) : | |
5664 | lang_printable_name (new_type, 1))); | |
c877974e APB |
5665 | /* The type may not have been completed by the time we report |
5666 | the error */ | |
4a5f66c3 APB |
5667 | char *t2 = strdup (purify_type_name |
5668 | ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE | |
c877974e APB |
5669 | && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ? |
5670 | IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) : | |
5671 | lang_printable_name (TREE_TYPE (decl), 1))); | |
8b27f225 PB |
5672 | parse_error_context |
5673 | (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)", | |
5674 | t1, IDENTIFIER_POINTER (new_field_name), | |
5675 | t2, IDENTIFIER_POINTER (DECL_NAME (decl)), | |
5676 | DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); | |
5677 | free (t1); | |
5678 | free (t2); | |
5679 | return 1; | |
5680 | } | |
5681 | return 0; | |
5682 | } | |
5683 | ||
5684 | /* Field registration routine. If TYPE doesn't exist, field | |
5685 | declarations are linked to the undefined TYPE dependency list, to | |
5686 | be later resolved in java_complete_class () */ | |
5687 | ||
5688 | static void | |
5689 | register_fields (flags, type, variable_list) | |
5690 | int flags; | |
5691 | tree type, variable_list; | |
5692 | { | |
5693 | tree current, saved_type; | |
5694 | tree class_type = TREE_TYPE (ctxp->current_parsed_class); | |
5695 | int saved_lineno = lineno; | |
5696 | int must_chain = 0; | |
5697 | tree wfl = NULL_TREE; | |
5698 | ||
5699 | /* If we're adding fields to interfaces, those fields are public, | |
5700 | static, final */ | |
5701 | if (CLASS_INTERFACE (TYPE_NAME (class_type))) | |
5702 | { | |
5703 | OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), | |
5704 | flags, ACC_PUBLIC, | |
5705 | "%s", "interface field(s)"); | |
5706 | OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK), | |
5707 | flags, ACC_STATIC, | |
5708 | "%s", "interface field(s)"); | |
5709 | OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK), | |
5710 | flags, ACC_FINAL, "%s", "interface field(s)"); | |
5711 | check_modifiers ("Illegal interface member modifier `%s'", flags, | |
5712 | INTERFACE_FIELD_MODIFIERS); | |
5713 | flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL); | |
5714 | } | |
5715 | ||
5716 | /* Obtain a suitable type for resolution, if necessary */ | |
5717 | SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain); | |
5718 | ||
5719 | /* If TYPE is fully resolved and we don't have a reference, make one */ | |
1886c9d8 | 5720 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); |
8b27f225 PB |
5721 | |
5722 | for (current = variable_list, saved_type = type; current; | |
5723 | current = TREE_CHAIN (current), type = saved_type) | |
5724 | { | |
c877974e | 5725 | tree real_type; |
8b27f225 PB |
5726 | tree field_decl; |
5727 | tree cl = TREE_PURPOSE (current); | |
5728 | tree init = TREE_VALUE (current); | |
5729 | tree current_name = EXPR_WFL_NODE (cl); | |
5730 | ||
5731 | /* Process NAME, as it may specify extra dimension(s) for it */ | |
5732 | type = build_array_from_name (type, wfl, current_name, ¤t_name); | |
5733 | ||
8b27f225 PB |
5734 | /* Type adjustment. We may have just readjusted TYPE because |
5735 | the variable specified more dimensions. Make sure we have | |
22eed1e6 APB |
5736 | a reference if we can and don't have one already. Also |
5737 | change the name if we have an init. */ | |
5738 | if (type != saved_type) | |
5739 | { | |
1886c9d8 | 5740 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); |
22eed1e6 APB |
5741 | if (init) |
5742 | EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name; | |
5743 | } | |
8b27f225 | 5744 | |
c877974e APB |
5745 | real_type = GET_REAL_TYPE (type); |
5746 | /* Check for redeclarations */ | |
5747 | if (duplicate_declaration_error_p (current_name, real_type, cl)) | |
5748 | continue; | |
5749 | ||
8b27f225 | 5750 | /* Set lineno to the line the field was found and create a |
5e942c50 | 5751 | declaration for it. Eventually sets the @deprecated tag flag. */ |
8b27f225 | 5752 | lineno = EXPR_WFL_LINENO (cl); |
c877974e | 5753 | field_decl = add_field (class_type, current_name, real_type, flags); |
5e942c50 | 5754 | CHECK_DEPRECATED (field_decl); |
8b27f225 PB |
5755 | |
5756 | /* Check if we must chain. */ | |
5757 | if (must_chain) | |
5758 | register_incomplete_type (JDEP_FIELD, wfl, field_decl, type); | |
5759 | ||
5760 | /* Default value of a static field is 0 and it is considered | |
5761 | initialized. */ | |
5762 | if (flags & ACC_STATIC) | |
5763 | INITIALIZED_P (field_decl) = 1; | |
5764 | ||
5765 | /* If we have an initialization value tied to the field */ | |
5766 | if (init) | |
5767 | { | |
5768 | /* The field is declared static */ | |
5769 | if (flags & ACC_STATIC) | |
5770 | { | |
63a212ed PB |
5771 | /* We include the field and its initialization part into |
5772 | a list used to generate <clinit>. After <clinit> is | |
5773 | walked, fields initialization will be processed and | |
5774 | fields initialized with know constants will be taken | |
5775 | out of <clinit> and have ther DECL_INITIAL set | |
5776 | appropriately. */ | |
5777 | TREE_CHAIN (init) = ctxp->static_initialized; | |
5778 | ctxp->static_initialized = init; | |
5b09b33e | 5779 | DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1); |
8b27f225 | 5780 | } |
5e942c50 APB |
5781 | /* A non-static field declared with an immediate initialization is |
5782 | to be initialized in <init>, if any. This field is remembered | |
5783 | to be processed at the time of the generation of <init>. */ | |
8b27f225 PB |
5784 | else |
5785 | { | |
5786 | TREE_CHAIN (init) = ctxp->non_static_initialized; | |
5787 | ctxp->non_static_initialized = init; | |
5788 | } | |
63a212ed | 5789 | INITIALIZED_P (field_decl) = 1; |
5b09b33e | 5790 | MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1; |
8b27f225 PB |
5791 | } |
5792 | } | |
5793 | lineno = saved_lineno; | |
5794 | } | |
5795 | ||
ac825856 | 5796 | /* Generate the method $finit$ that initializes fields initialized |
22eed1e6 APB |
5797 | upon declaration. */ |
5798 | ||
5799 | static void | |
5800 | maybe_generate_finit () | |
5801 | { | |
5802 | tree mdecl, current; | |
5803 | ||
5804 | if (!ctxp->non_static_initialized || java_error_count) | |
5805 | return; | |
5806 | ||
5807 | mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class), | |
ac825856 | 5808 | ACC_PRIVATE, void_type_node, |
82371d41 | 5809 | finit_identifier_node, end_params_node); |
22eed1e6 APB |
5810 | start_artificial_method_body (mdecl); |
5811 | ||
5812 | ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized); | |
5813 | for (current = ctxp->non_static_initialized; current; | |
5814 | current = TREE_CHAIN (current)) | |
5815 | java_method_add_stmt (mdecl, | |
5816 | build_debugable_stmt (EXPR_WFL_LINECOL (current), | |
5817 | current)); | |
5818 | ||
5819 | end_artificial_method_body (mdecl); | |
5820 | CLASS_HAS_FINIT_P (TREE_TYPE (ctxp->current_parsed_class)) = 1; | |
5821 | ctxp->non_static_initialized = NULL_TREE; | |
5822 | } | |
5823 | ||
8b27f225 PB |
5824 | /* Check whether it is necessary to generate a <clinit> for the class |
5825 | we just parsed. */ | |
5826 | ||
5827 | static void | |
5828 | maybe_generate_clinit () | |
5829 | { | |
22eed1e6 | 5830 | tree mdecl, c; |
8b27f225 PB |
5831 | |
5832 | if (!ctxp->static_initialized || java_error_count) | |
5833 | return; | |
5834 | ||
22eed1e6 APB |
5835 | mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class), |
5836 | ACC_STATIC, void_type_node, | |
82371d41 | 5837 | clinit_identifier_node, end_params_node); |
22eed1e6 | 5838 | start_artificial_method_body (mdecl); |
8b27f225 PB |
5839 | |
5840 | /* Keep initialization in order to enforce 8.5 */ | |
5841 | ctxp->static_initialized = nreverse (ctxp->static_initialized); | |
5842 | ||
5843 | /* We process the list of assignment we produced as the result of | |
5844 | the declaration of initialized static field and add them as | |
5845 | statement to the <clinit> method. */ | |
5846 | for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c)) | |
5847 | { | |
5848 | /* We build the assignment expression that will initialize the | |
5849 | field to its value. There are strict rules on static | |
5850 | initializers (8.5). FIXME */ | |
22eed1e6 APB |
5851 | java_method_add_stmt (mdecl, |
5852 | build_debugable_stmt (EXPR_WFL_LINECOL (c), c)); | |
8b27f225 PB |
5853 | } |
5854 | ||
22eed1e6 | 5855 | end_artificial_method_body (mdecl); |
8b27f225 PB |
5856 | ctxp->static_initialized = NULL_TREE; |
5857 | } | |
5858 | ||
5859 | /* Shared accros method_declarator and method_header to remember the | |
5860 | patch stage that was reached during the declaration of the method. | |
5861 | A method DECL is built differently is there is no patch | |
5862 | (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN) | |
5863 | pending on the currently defined method. */ | |
5864 | ||
5865 | static int patch_stage; | |
5866 | ||
5867 | /* Check the method declaration and add the method to its current | |
5868 | class. If the argument list is known to contain incomplete types, | |
5869 | the method is partially added and the registration will be resume | |
22eed1e6 APB |
5870 | once the method arguments resolved. If TYPE is NULL, we're dealing |
5871 | with a constructor. */ | |
8b27f225 PB |
5872 | |
5873 | static tree | |
5874 | method_header (flags, type, mdecl, throws) | |
5875 | int flags; | |
5876 | tree type, mdecl, throws; | |
5877 | { | |
5878 | tree meth = TREE_VALUE (mdecl); | |
5879 | tree id = TREE_PURPOSE (mdecl); | |
5880 | tree this_class = TREE_TYPE (ctxp->current_parsed_class); | |
1886c9d8 | 5881 | tree type_wfl = NULL_TREE; |
4a5f66c3 | 5882 | tree meth_name = NULL_TREE, current, orig_arg; |
8b27f225 | 5883 | int saved_lineno; |
1886c9d8 | 5884 | int constructor_ok = 0, must_chain; |
8b27f225 PB |
5885 | |
5886 | check_modifiers_consistency (flags); | |
5887 | ||
5888 | /* There are some forbidden modifiers for an abstract method and its | |
5889 | class must be abstract as well. */ | |
22eed1e6 | 5890 | if (type && (flags & ACC_ABSTRACT)) |
8b27f225 PB |
5891 | { |
5892 | ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private"); | |
5893 | ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static"); | |
5894 | ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final"); | |
5895 | ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native"); | |
5896 | ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized"); | |
5897 | if (!CLASS_ABSTRACT (TYPE_NAME (this_class))) | |
5898 | parse_error_context | |
5899 | (id, "Class `%s' must be declared abstract to define abstract " | |
5900 | "method `%s'", | |
5901 | IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)), | |
5902 | IDENTIFIER_POINTER (EXPR_WFL_NODE (id))); | |
5903 | } | |
22eed1e6 APB |
5904 | /* Things to be checked when declaring a constructor */ |
5905 | if (!type) | |
5906 | { | |
5907 | int ec = java_error_count; | |
5908 | /* 8.6: Constructor declarations: we might be trying to define a | |
5909 | method without specifying a return type. */ | |
5e942c50 | 5910 | if (EXPR_WFL_NODE (id) != ctxp->current_parsed_class_un) |
22eed1e6 APB |
5911 | parse_error_context |
5912 | (id, "Invalid method declaration, return type required"); | |
5913 | /* 8.6.3: Constructor modifiers */ | |
5914 | else | |
5915 | { | |
5916 | JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract"); | |
5917 | JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static"); | |
5918 | JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final"); | |
5919 | JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native"); | |
5920 | JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized"); | |
5921 | } | |
5922 | /* If we found error here, we don't consider it's OK to tread | |
5923 | the method definition as a constructor, for the rest of this | |
5924 | function */ | |
5925 | if (ec == java_error_count) | |
5926 | constructor_ok = 1; | |
5927 | } | |
8b27f225 PB |
5928 | |
5929 | /* Method declared within the scope of an interface are implicitly | |
5930 | abstract and public. Conflicts with other erroneously provided | |
5931 | modifiers are check right after. */ | |
5932 | ||
5933 | if (CLASS_INTERFACE (TYPE_NAME (this_class))) | |
5934 | { | |
5935 | /* If FLAGS isn't set because of a modifier, turn the | |
5936 | corresponding modifier WFL to NULL so we issue a warning on | |
5937 | the obsolete use of the modifier */ | |
5938 | if (!(flags & ACC_PUBLIC)) | |
5939 | MODIFIER_WFL (PUBLIC_TK) = NULL; | |
5940 | if (!(flags & ACC_ABSTRACT)) | |
5941 | MODIFIER_WFL (ABSTRACT_TK) = NULL; | |
5942 | flags |= ACC_PUBLIC; | |
5943 | flags |= ACC_ABSTRACT; | |
5944 | } | |
5945 | ||
5946 | /* Modifiers context reset moved up, so abstract method declaration | |
5947 | modifiers can be later checked. */ | |
5948 | ||
22eed1e6 APB |
5949 | /* Set constructor returned type to void and method name to <init>, |
5950 | unless we found an error identifier the constructor (in which | |
5951 | case we retain the original name) */ | |
5952 | if (!type) | |
5953 | { | |
5954 | type = void_type_node; | |
5955 | if (constructor_ok) | |
5956 | meth_name = init_identifier_node; | |
5957 | } | |
5958 | else | |
5959 | meth_name = EXPR_WFL_NODE (id); | |
8b27f225 | 5960 | |
1886c9d8 APB |
5961 | /* Do the returned type resolution and registration if necessary */ |
5962 | SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain); | |
5963 | ||
4a5f66c3 APB |
5964 | if (meth_name) |
5965 | type = build_array_from_name (type, type_wfl, meth_name, &meth_name); | |
1886c9d8 APB |
5966 | EXPR_WFL_NODE (id) = meth_name; |
5967 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); | |
5968 | ||
5969 | if (must_chain) | |
8b27f225 | 5970 | { |
1886c9d8 APB |
5971 | patch_stage = JDEP_METHOD_RETURN; |
5972 | register_incomplete_type (patch_stage, type_wfl, id, type); | |
5973 | TREE_TYPE (meth) = GET_REAL_TYPE (type); | |
8b27f225 | 5974 | } |
5e942c50 | 5975 | else |
1886c9d8 | 5976 | TREE_TYPE (meth) = type; |
8b27f225 PB |
5977 | |
5978 | saved_lineno = lineno; | |
5979 | /* When defining an abstract or interface method, the curly | |
5980 | bracket at level 1 doesn't exist because there is no function | |
5981 | body */ | |
5982 | lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 : | |
5983 | EXPR_WFL_LINENO (id)); | |
5984 | ||
5e942c50 APB |
5985 | /* Remember the original argument list */ |
5986 | orig_arg = TYPE_ARG_TYPES (meth); | |
5987 | ||
8b27f225 PB |
5988 | if (patch_stage) /* includes ret type and/or all args */ |
5989 | { | |
5990 | jdep *jdep; | |
5991 | meth = add_method_1 (this_class, flags, meth_name, meth); | |
5992 | /* Patch for the return type */ | |
5993 | if (patch_stage == JDEP_METHOD_RETURN) | |
5994 | { | |
5995 | jdep = CLASSD_LAST (ctxp->classd_list); | |
5996 | JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth)); | |
5997 | } | |
5998 | /* This is the stop JDEP. METH allows the function's signature | |
5999 | to be computed. */ | |
6000 | register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE); | |
6001 | } | |
6002 | else | |
5e942c50 APB |
6003 | meth = add_method (this_class, flags, meth_name, |
6004 | build_java_signature (meth)); | |
6005 | ||
6006 | /* Fix the method argument list so we have the argument name | |
6007 | information */ | |
6008 | fix_method_argument_names (orig_arg, meth); | |
6009 | ||
6010 | /* Register the parameter number and re-install the current line | |
6011 | number */ | |
8b27f225 PB |
6012 | DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1; |
6013 | lineno = saved_lineno; | |
6014 | ||
6015 | /* Register exception specified by the `throws' keyword for | |
6016 | resolution and set the method decl appropriate field to the list. | |
6017 | Note: the grammar ensures that what we get here are class | |
6018 | types. */ | |
6019 | if (throws) | |
6020 | { | |
6021 | throws = nreverse (throws); | |
6022 | for (current = throws; current; current = TREE_CHAIN (current)) | |
6023 | { | |
6024 | register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current), | |
6025 | NULL_TREE, NULL_TREE); | |
6026 | JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) = | |
6027 | &TREE_VALUE (current); | |
6028 | } | |
22eed1e6 APB |
6029 | DECL_FUNCTION_THROWS (meth) = throws; |
6030 | } | |
6031 | ||
6032 | /* We set the DECL_NAME to ID so we can track the location where | |
6033 | the function was declared. This allow us to report | |
6034 | redefinition error accurately. When method are verified, | |
6035 | DECL_NAME is reinstalled properly (using the content of the | |
6036 | WFL node ID) (see check_method_redefinition). We don't do that | |
6037 | when Object is being defined. Constructor <init> names will be | |
6038 | reinstalled the same way. */ | |
6039 | if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node) | |
6040 | DECL_NAME (meth) = id; | |
6041 | ||
6042 | /* Set the flag if we correctly processed a constructor */ | |
6043 | if (constructor_ok) | |
6044 | DECL_CONSTRUCTOR_P (meth) = 1; | |
6045 | ||
5e942c50 APB |
6046 | /* Eventually set the @deprecated tag flag */ |
6047 | CHECK_DEPRECATED (meth); | |
6048 | ||
22eed1e6 APB |
6049 | return meth; |
6050 | } | |
6051 | ||
5e942c50 APB |
6052 | static void |
6053 | fix_method_argument_names (orig_arg, meth) | |
6054 | tree orig_arg, meth; | |
6055 | { | |
6056 | tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth)); | |
6057 | if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE) | |
6058 | { | |
6059 | TREE_PURPOSE (arg) = this_identifier_node; | |
6060 | arg = TREE_CHAIN (arg); | |
6061 | } | |
82371d41 | 6062 | while (orig_arg != end_params_node) |
5e942c50 APB |
6063 | { |
6064 | TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg); | |
6065 | orig_arg = TREE_CHAIN (orig_arg); | |
6066 | arg = TREE_CHAIN (arg); | |
6067 | } | |
6068 | } | |
6069 | ||
22eed1e6 APB |
6070 | /* Complete the method declaration with METHOD_BODY. */ |
6071 | ||
6072 | static void | |
6073 | complete_method_declaration (method_body) | |
6074 | tree method_body; | |
6075 | { | |
6076 | BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body; | |
6077 | maybe_absorb_scoping_blocks (); | |
6078 | /* Exit function's body */ | |
6079 | exit_block (); | |
6080 | /* Merge last line of the function with first line, directly in the | |
6081 | function decl. It will be used to emit correct debug info. */ | |
6082 | DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1); | |
6083 | } | |
6084 | ||
6085 | /* Build a an error message for constructor circularity errors. */ | |
6086 | ||
6087 | static char * | |
6088 | constructor_circularity_msg (from, to) | |
6089 | tree from, to; | |
6090 | { | |
6091 | static char string [4096]; | |
6092 | char *t = strdup (lang_printable_name (from, 0)); | |
6093 | sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0)); | |
6094 | free (t); | |
6095 | return string; | |
6096 | } | |
6097 | ||
6098 | /* Verify a circular call to METH. Return 1 if an error is found, 0 | |
6099 | otherwise. */ | |
6100 | ||
6101 | static int | |
6102 | verify_constructor_circularity (meth, current) | |
6103 | tree meth, current; | |
6104 | { | |
6105 | static tree list = NULL_TREE; | |
6106 | tree c; | |
6107 | for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c)) | |
6108 | { | |
6109 | if (TREE_VALUE (c) == meth) | |
6110 | { | |
6111 | char *t; | |
6112 | if (list) | |
6113 | { | |
6114 | tree liste; | |
6115 | list = nreverse (list); | |
6116 | for (liste = list; liste; liste = TREE_CHAIN (liste)) | |
6117 | { | |
6118 | parse_error_context | |
6119 | (TREE_PURPOSE (TREE_PURPOSE (liste)), | |
6120 | constructor_circularity_msg | |
6121 | (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); | |
6122 | java_error_count--; | |
6123 | } | |
6124 | } | |
6125 | t = strdup (lang_printable_name (meth, 0)); | |
6126 | parse_error_context (TREE_PURPOSE (c), | |
6127 | "%s: recursive invocation of constructor `%s'", | |
6128 | constructor_circularity_msg (current, meth), t); | |
6129 | free (t); | |
6130 | list = NULL_TREE; | |
6131 | return 1; | |
6132 | } | |
8b27f225 | 6133 | } |
22eed1e6 APB |
6134 | for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c)) |
6135 | { | |
6136 | list = tree_cons (c, current, list); | |
6137 | if (verify_constructor_circularity (meth, TREE_VALUE (c))) | |
6138 | return 1; | |
6139 | list = TREE_CHAIN (list); | |
6140 | } | |
6141 | return 0; | |
8b27f225 PB |
6142 | } |
6143 | ||
6144 | /* Check modifiers that can be declared but exclusively */ | |
6145 | ||
6146 | static void | |
6147 | check_modifiers_consistency (flags) | |
6148 | int flags; | |
6149 | { | |
6150 | int acc_count = 0; | |
6151 | tree cl = NULL_TREE; | |
6152 | ||
6153 | THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl); | |
6154 | THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl); | |
6155 | THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl); | |
6156 | if (acc_count > 1) | |
6157 | parse_error_context | |
6158 | (cl, "Inconsistent member declaration. At most one of `public', " | |
6159 | "`private', or `protected' may be specified"); | |
6160 | } | |
6161 | ||
6162 | /* Check the methode header METH for abstract specifics features */ | |
6163 | ||
6164 | static void | |
6165 | check_abstract_method_header (meth) | |
6166 | tree meth; | |
6167 | { | |
6168 | int flags = get_access_flags_from_decl (meth); | |
6169 | /* DECL_NAME might still be a WFL node */ | |
c877974e | 6170 | tree name = GET_METHOD_NAME (meth); |
8b27f225 PB |
6171 | |
6172 | OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK), flags, | |
6173 | ACC_ABSTRACT, "abstract method `%s'", | |
6174 | IDENTIFIER_POINTER (name)); | |
6175 | OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), flags, | |
6176 | ACC_PUBLIC, "abstract method `%s'", | |
6177 | IDENTIFIER_POINTER (name)); | |
6178 | ||
6179 | check_modifiers ("Illegal modifier `%s' for interface method", | |
6180 | flags, INTERFACE_METHOD_MODIFIERS); | |
6181 | } | |
6182 | ||
6183 | /* Create a FUNCTION_TYPE node and start augmenting it with the | |
6184 | declared function arguments. Arguments type that can't be resolved | |
6185 | are left as they are, but the returned node is marked as containing | |
6186 | incomplete types. */ | |
6187 | ||
6188 | static tree | |
6189 | method_declarator (id, list) | |
6190 | tree id, list; | |
6191 | { | |
6192 | tree arg_types = NULL_TREE, current, node; | |
6193 | tree meth = make_node (FUNCTION_TYPE); | |
6194 | jdep *jdep; | |
6195 | ||
6196 | patch_stage = JDEP_NO_PATCH; | |
6197 | ||
6198 | for (current = list; current; current = TREE_CHAIN (current)) | |
6199 | { | |
6200 | int must_chain = 0; | |
6201 | tree wfl_name = TREE_PURPOSE (current); | |
6202 | tree type = TREE_VALUE (current); | |
6203 | tree name = EXPR_WFL_NODE (wfl_name); | |
6204 | tree already, arg_node; | |
6205 | tree type_wfl = NULL_TREE; | |
23a79c61 | 6206 | tree real_type; |
8b27f225 PB |
6207 | |
6208 | /* Obtain a suitable type for resolution, if necessary */ | |
6209 | SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain); | |
6210 | ||
6211 | /* Process NAME, as it may specify extra dimension(s) for it */ | |
6212 | type = build_array_from_name (type, type_wfl, name, &name); | |
6213 | EXPR_WFL_NODE (wfl_name) = name; | |
6214 | ||
23a79c61 APB |
6215 | real_type = GET_REAL_TYPE (type); |
6216 | if (TREE_CODE (real_type) == RECORD_TYPE) | |
6217 | { | |
6218 | real_type = promote_type (real_type); | |
6219 | if (TREE_CODE (type) == TREE_LIST) | |
6220 | TREE_PURPOSE (type) = real_type; | |
6221 | } | |
5e942c50 | 6222 | |
8b27f225 PB |
6223 | /* Check redefinition */ |
6224 | for (already = arg_types; already; already = TREE_CHAIN (already)) | |
6225 | if (TREE_PURPOSE (already) == name) | |
6226 | { | |
6227 | parse_error_context | |
6228 | (wfl_name, "Variable `%s' is used more than once in the " | |
6229 | "argument list of method `%s'", IDENTIFIER_POINTER (name), | |
6230 | IDENTIFIER_POINTER (EXPR_WFL_NODE (id))); | |
6231 | break; | |
6232 | } | |
6233 | ||
6234 | /* If we've an incomplete argument type, we know there is a location | |
6235 | to patch when the type get resolved, later. */ | |
6236 | jdep = NULL; | |
6237 | if (must_chain) | |
6238 | { | |
6239 | patch_stage = JDEP_METHOD; | |
6240 | type = register_incomplete_type (patch_stage, | |
6241 | type_wfl, wfl_name, type); | |
6242 | jdep = CLASSD_LAST (ctxp->classd_list); | |
6243 | JDEP_MISC (jdep) = id; | |
6244 | } | |
6245 | ||
6246 | /* The argument node: a name and a (possibly) incomplete type */ | |
23a79c61 | 6247 | arg_node = build_tree_list (name, real_type); |
8b27f225 PB |
6248 | if (jdep) |
6249 | JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node); | |
6250 | TREE_CHAIN (arg_node) = arg_types; | |
6251 | arg_types = arg_node; | |
6252 | } | |
82371d41 | 6253 | TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node); |
8b27f225 PB |
6254 | node = build_tree_list (id, meth); |
6255 | return node; | |
6256 | } | |
6257 | ||
6258 | static int | |
6259 | unresolved_type_p (wfl, returned) | |
6260 | tree wfl; | |
6261 | tree *returned; | |
6262 | ||
6263 | { | |
6264 | if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION) | |
6265 | { | |
6266 | tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl)); | |
6267 | if (returned) | |
6268 | *returned = (decl ? TREE_TYPE (decl) : NULL_TREE); | |
6269 | return 1; | |
6270 | } | |
6271 | if (returned) | |
6272 | *returned = wfl; | |
6273 | return 0; | |
6274 | } | |
6275 | ||
6276 | /* From NAME, build a qualified identifier node using the | |
6277 | qualification from the current package definition. */ | |
6278 | ||
6279 | static tree | |
6280 | parser_qualified_classname (name) | |
6281 | tree name; | |
6282 | { | |
6283 | if (ctxp->package) | |
6284 | return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name)); | |
6285 | else | |
6286 | return EXPR_WFL_NODE (name); | |
6287 | } | |
6288 | ||
6289 | /* Called once the type a interface extends is resolved. Returns 0 if | |
6290 | everything is OK. */ | |
6291 | ||
6292 | static int | |
6293 | parser_check_super_interface (super_decl, this_decl, this_wfl) | |
6294 | tree super_decl, this_decl, this_wfl; | |
6295 | { | |
6296 | tree super_type = TREE_TYPE (super_decl); | |
6297 | ||
6298 | /* Has to be an interface */ | |
6299 | if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl)))) | |
6300 | { | |
6301 | parse_error_context | |
6302 | (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'", | |
6303 | (TYPE_ARRAY_P (super_type) ? "array" : "class"), | |
6304 | IDENTIFIER_POINTER (DECL_NAME (super_decl)), | |
6305 | (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ? | |
6306 | "interface" : "class"), | |
6307 | IDENTIFIER_POINTER (DECL_NAME (this_decl))); | |
6308 | return 1; | |
6309 | } | |
6310 | ||
6311 | /* Check scope: same package OK, other package: OK if public */ | |
6312 | if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl))) | |
6313 | return 1; | |
6314 | ||
6315 | SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s", | |
6316 | IDENTIFIER_POINTER (DECL_NAME (this_decl)), | |
6317 | IDENTIFIER_POINTER (DECL_NAME (super_decl)))); | |
6318 | return 0; | |
6319 | } | |
6320 | ||
6321 | /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns | |
6322 | 0 if everthing is OK. */ | |
6323 | ||
6324 | static int | |
6325 | parser_check_super (super_decl, this_decl, wfl) | |
6326 | tree super_decl, this_decl, wfl; | |
6327 | { | |
6328 | tree super_type = TREE_TYPE (super_decl); | |
6329 | ||
6330 | /* SUPER should be a CLASS (neither an array nor an interface) */ | |
6331 | if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type))) | |
6332 | { | |
6333 | parse_error_context | |
6334 | (wfl, "Class `%s' can't subclass %s `%s'", | |
6335 | IDENTIFIER_POINTER (DECL_NAME (this_decl)), | |
6336 | (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"), | |
6337 | IDENTIFIER_POINTER (DECL_NAME (super_decl))); | |
6338 | return 1; | |
6339 | } | |
6340 | ||
6341 | if (CLASS_FINAL (TYPE_NAME (super_type))) | |
6342 | { | |
6343 | parse_error_context (wfl, "Can't subclass final classes: %s", | |
6344 | IDENTIFIER_POINTER (DECL_NAME (super_decl))); | |
6345 | return 1; | |
6346 | } | |
6347 | ||
6348 | /* Check scope: same package OK, other package: OK if public */ | |
6349 | if (check_pkg_class_access (DECL_NAME (super_decl), wfl)) | |
6350 | return 1; | |
6351 | ||
6352 | SOURCE_FRONTEND_DEBUG (("Completing class %s with %s", | |
6353 | IDENTIFIER_POINTER (DECL_NAME (this_decl)), | |
6354 | IDENTIFIER_POINTER (DECL_NAME (super_decl)))); | |
6355 | return 0; | |
6356 | } | |
6357 | ||
6358 | /* Create a new dependency list and link it (in a LIFO manner) to the | |
6359 | CTXP list of type dependency list. */ | |
6360 | ||
6361 | static void | |
6362 | create_jdep_list (ctxp) | |
6363 | struct parser_ctxt *ctxp; | |
6364 | { | |
23a79c61 | 6365 | jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist)); |
8b27f225 PB |
6366 | new->first = new->last = NULL; |
6367 | new->next = ctxp->classd_list; | |
6368 | ctxp->classd_list = new; | |
6369 | } | |
6370 | ||
6371 | static jdeplist * | |
6372 | reverse_jdep_list (ctxp) | |
6373 | struct parser_ctxt *ctxp; | |
6374 | { | |
6375 | register jdeplist *prev = NULL, *current, *next; | |
6376 | for (current = ctxp->classd_list; current; current = next) | |
6377 | { | |
6378 | next = current->next; | |
6379 | current->next = prev; | |
6380 | prev = current; | |
6381 | } | |
6382 | return prev; | |
6383 | } | |
6384 | ||
23a79c61 APB |
6385 | /* Create a fake pointer based on the ID stored in |
6386 | TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be | |
6387 | registered again. */ | |
8b27f225 PB |
6388 | |
6389 | static tree | |
23a79c61 APB |
6390 | obtain_incomplete_type (type_name) |
6391 | tree type_name; | |
8b27f225 | 6392 | { |
23a79c61 APB |
6393 | tree ptr, name; |
6394 | ||
6395 | if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION) | |
6396 | name = EXPR_WFL_NODE (type_name); | |
6397 | else if (INCOMPLETE_TYPE_P (type_name)) | |
6398 | name = TYPE_NAME (type_name); | |
6399 | else | |
6400 | fatal ("invalid type name - obtain_incomplete_type"); | |
8b27f225 PB |
6401 | |
6402 | for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr)) | |
6403 | if (TYPE_NAME (TREE_PURPOSE (ptr)) == name) | |
6404 | break; | |
6405 | ||
6406 | if (!ptr) | |
6407 | { | |
6408 | tree core; | |
6409 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
6410 | BUILD_PTR_FROM_NAME (core, name); | |
c877974e | 6411 | layout_type (core); |
8b27f225 PB |
6412 | ptr = build_tree_list (core, NULL_TREE); |
6413 | pop_obstacks (); | |
6414 | TREE_CHAIN (ptr) = ctxp->incomplete_class; | |
6415 | ctxp->incomplete_class = ptr; | |
6416 | } | |
6417 | ||
6418 | return ptr; | |
6419 | } | |
6420 | ||
6421 | /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is | |
6422 | non NULL instead of computing a new fake type based on WFL. The new | |
6423 | dependency is inserted in the current type dependency list, in FIFO | |
6424 | manner. */ | |
6425 | ||
6426 | static tree | |
6427 | register_incomplete_type (kind, wfl, decl, ptr) | |
6428 | int kind; | |
6429 | tree wfl, decl, ptr; | |
6430 | { | |
23a79c61 | 6431 | jdep *new = (jdep *)xmalloc (sizeof (jdep)); |
8b27f225 | 6432 | |
8b27f225 PB |
6433 | if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */ |
6434 | ptr = obtain_incomplete_type (wfl); | |
6435 | ||
6436 | JDEP_KIND (new) = kind; | |
6437 | JDEP_DECL (new) = decl; | |
6438 | JDEP_SOLV (new) = ptr; | |
6439 | JDEP_WFL (new) = wfl; | |
6440 | JDEP_CHAIN (new) = NULL; | |
6441 | JDEP_MISC (new) = NULL_TREE; | |
6442 | JDEP_GET_PATCH (new) = (tree *)NULL; | |
6443 | ||
6444 | JDEP_INSERT (ctxp->classd_list, new); | |
6445 | ||
6446 | return ptr; | |
6447 | } | |
6448 | ||
6449 | void | |
6450 | java_check_circular_reference () | |
6451 | { | |
6452 | tree current; | |
6453 | for (current = ctxp->class_list; current; current = TREE_CHAIN (current)) | |
6454 | { | |
6455 | tree type = TREE_TYPE (current); | |
6456 | if (CLASS_INTERFACE (TYPE_NAME (type))) | |
6457 | { | |
6458 | /* Check all interfaces this class extends */ | |
6459 | tree basetype_vec = TYPE_BINFO_BASETYPES (type); | |
6460 | int n, i; | |
6461 | ||
6462 | if (!basetype_vec) | |
6463 | return; | |
6464 | n = TREE_VEC_LENGTH (basetype_vec); | |
6465 | for (i = 0; i < n; i++) | |
6466 | { | |
6467 | tree vec_elt = TREE_VEC_ELT (basetype_vec, i); | |
6468 | if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node | |
6469 | && interface_of_p (type, BINFO_TYPE (vec_elt))) | |
6470 | parse_error_context (lookup_cl (current), | |
6471 | "Cyclic interface inheritance"); | |
6472 | } | |
6473 | } | |
6474 | else | |
6475 | if (inherits_from_p (CLASSTYPE_SUPER (type), type)) | |
6476 | parse_error_context (lookup_cl (current), | |
6477 | "Cyclic class inheritance"); | |
6478 | } | |
6479 | } | |
6480 | ||
23a79c61 APB |
6481 | /* safe_layout_class just makes sure that we can load a class without |
6482 | disrupting the current_class, input_file, lineno, etc, information | |
6483 | about the class processed currently. */ | |
6484 | ||
8b27f225 PB |
6485 | void |
6486 | safe_layout_class (class) | |
6487 | tree class; | |
6488 | { | |
6489 | tree save_current_class = current_class; | |
6490 | char *save_input_filename = input_filename; | |
6491 | int save_lineno = lineno; | |
5e942c50 | 6492 | |
8b27f225 | 6493 | push_obstacks (&permanent_obstack, &permanent_obstack); |
5e942c50 | 6494 | |
8b27f225 PB |
6495 | layout_class (class); |
6496 | pop_obstacks (); | |
5e942c50 | 6497 | |
8b27f225 PB |
6498 | current_class = save_current_class; |
6499 | input_filename = save_input_filename; | |
6500 | lineno = save_lineno; | |
6501 | CLASS_LOADED_P (class) = 1; | |
6502 | } | |
6503 | ||
6504 | static tree | |
6505 | jdep_resolve_class (dep) | |
6506 | jdep *dep; | |
6507 | { | |
6508 | tree decl; | |
6509 | ||
23a79c61 APB |
6510 | if (JDEP_RESOLVED_P (dep)) |
6511 | decl = JDEP_RESOLVED_DECL (dep); | |
6512 | else | |
8b27f225 | 6513 | { |
23a79c61 APB |
6514 | decl = resolve_class (JDEP_TO_RESOLVE (dep), |
6515 | JDEP_DECL (dep), JDEP_WFL (dep)); | |
8b27f225 PB |
6516 | JDEP_RESOLVED (dep, decl); |
6517 | } | |
23a79c61 | 6518 | |
8b27f225 | 6519 | if (!decl) |
23a79c61 APB |
6520 | complete_class_report_errors (dep); |
6521 | ||
8b27f225 PB |
6522 | return decl; |
6523 | } | |
6524 | ||
6525 | /* Complete unsatisfied class declaration and their dependencies */ | |
6526 | ||
6527 | void | |
6528 | java_complete_class () | |
6529 | { | |
6530 | tree cclass; | |
6531 | jdeplist *cclassd; | |
6532 | int error_found; | |
6533 | tree type; | |
6534 | ||
6535 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
6536 | ||
6537 | /* Process imports and reverse the import on demand list */ | |
6538 | process_imports (); | |
6539 | if (ctxp->import_demand_list) | |
6540 | ctxp->import_demand_list = nreverse (ctxp->import_demand_list); | |
6541 | ||
6542 | /* Rever things so we have the right order */ | |
6543 | ctxp->class_list = nreverse (ctxp->class_list); | |
6544 | ctxp->classd_list = reverse_jdep_list (ctxp); | |
c877974e | 6545 | |
8b27f225 PB |
6546 | for (cclassd = ctxp->classd_list, cclass = ctxp->class_list; |
6547 | cclass && cclassd; | |
6548 | cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd)) | |
6549 | { | |
6550 | jdep *dep; | |
6551 | for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep)) | |
6552 | { | |
6553 | tree decl; | |
8b27f225 PB |
6554 | if (!(decl = jdep_resolve_class (dep))) |
6555 | continue; | |
6556 | ||
6557 | /* Now it's time to patch */ | |
6558 | switch (JDEP_KIND (dep)) | |
6559 | { | |
6560 | case JDEP_SUPER: | |
6561 | /* Simply patch super */ | |
6562 | if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep))) | |
6563 | continue; | |
6564 | BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO | |
6565 | (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl); | |
6566 | break; | |
6567 | ||
6568 | case JDEP_FIELD: | |
6569 | { | |
6570 | /* We do part of the job done in add_field */ | |
6571 | tree field_decl = JDEP_DECL (dep); | |
6572 | tree field_type = TREE_TYPE (decl); | |
6573 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
6574 | if (TREE_CODE (field_type) == RECORD_TYPE) | |
6575 | field_type = promote_type (field_type); | |
6576 | pop_obstacks (); | |
6577 | TREE_TYPE (field_decl) = field_type; | |
5e942c50 APB |
6578 | DECL_ALIGN (field_decl) = 0; |
6579 | layout_decl (field_decl, 0); | |
8b27f225 PB |
6580 | SOURCE_FRONTEND_DEBUG |
6581 | (("Completed field/var decl `%s' with `%s'", | |
6582 | IDENTIFIER_POINTER (DECL_NAME (field_decl)), | |
6583 | IDENTIFIER_POINTER (DECL_NAME (decl)))); | |
6584 | break; | |
6585 | } | |
6586 | case JDEP_METHOD: /* We start patching a method */ | |
6587 | case JDEP_METHOD_RETURN: | |
6588 | error_found = 0; | |
6589 | while (1) | |
6590 | { | |
6591 | if (decl) | |
6592 | { | |
6593 | type = TREE_TYPE(decl); | |
6594 | if (TREE_CODE (type) == RECORD_TYPE) | |
6595 | type = promote_type (type); | |
6596 | JDEP_APPLY_PATCH (dep, type); | |
6597 | SOURCE_FRONTEND_DEBUG | |
6598 | (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ? | |
6599 | "Completing fct `%s' with ret type `%s'": | |
6600 | "Completing arg `%s' with type `%s'"), | |
6601 | IDENTIFIER_POINTER (EXPR_WFL_NODE | |
6602 | (JDEP_DECL_WFL (dep))), | |
6603 | IDENTIFIER_POINTER (DECL_NAME (decl)))); | |
6604 | } | |
6605 | else | |
6606 | error_found = 1; | |
6607 | dep = JDEP_CHAIN (dep); | |
6608 | if (JDEP_KIND (dep) == JDEP_METHOD_END) | |
6609 | break; | |
6610 | else | |
6611 | decl = jdep_resolve_class (dep); | |
6612 | } | |
6613 | if (!error_found) | |
6614 | { | |
6615 | tree mdecl = JDEP_DECL (dep), signature; | |
6616 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
6617 | /* Recompute and reset the signature */ | |
6618 | signature = build_java_signature (TREE_TYPE (mdecl)); | |
6619 | set_java_signature (TREE_TYPE (mdecl), signature); | |
6620 | pop_obstacks (); | |
6621 | } | |
6622 | else | |
6623 | continue; | |
6624 | break; | |
6625 | ||
6626 | case JDEP_INTERFACE: | |
6627 | if (parser_check_super_interface (decl, JDEP_DECL (dep), | |
6628 | JDEP_WFL (dep))) | |
6629 | continue; | |
6630 | parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep)); | |
6631 | break; | |
6632 | ||
6633 | case JDEP_PARM: | |
6634 | case JDEP_VARIABLE: | |
6635 | type = TREE_TYPE(decl); | |
6636 | if (TREE_CODE (type) == RECORD_TYPE) | |
6637 | type = promote_type (type); | |
6638 | JDEP_APPLY_PATCH (dep, type); | |
6639 | break; | |
6640 | ||
6641 | case JDEP_TYPE: | |
6642 | JDEP_APPLY_PATCH (dep, TREE_TYPE (decl)); | |
6643 | SOURCE_FRONTEND_DEBUG | |
6644 | (("Completing a random type dependency on a '%s' node", | |
6645 | tree_code_name [TREE_CODE (JDEP_DECL (dep))])); | |
6646 | break; | |
6647 | ||
6648 | case JDEP_EXCEPTION: | |
c877974e APB |
6649 | JDEP_APPLY_PATCH (dep, TREE_TYPE (decl)); |
6650 | SOURCE_FRONTEND_DEBUG | |
6651 | (("Completing `%s' `throws' argument node", | |
6652 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))))); | |
8b27f225 PB |
6653 | break; |
6654 | ||
6655 | default: | |
6656 | fatal ("Can't handle patch code %d - java_complete_class", | |
6657 | JDEP_KIND (dep)); | |
6658 | } | |
6659 | } | |
6660 | } | |
6661 | pop_obstacks (); | |
6662 | return; | |
6663 | } | |
6664 | ||
6665 | /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an | |
6666 | array. */ | |
6667 | ||
6668 | static tree | |
6669 | resolve_class (class_type, decl, cl) | |
6670 | tree class_type, decl, cl; | |
6671 | { | |
6672 | char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type)); | |
6673 | char *base = name; | |
6674 | tree resolved_type, resolved_type_decl; | |
6675 | ||
6676 | /* 1- Check to see if we have an array. If true, find what we really | |
6677 | want to resolve */ | |
6678 | while (name[0] == '[') | |
6679 | name++; | |
6680 | if (base != name) | |
6681 | TYPE_NAME (class_type) = get_identifier (name); | |
6682 | ||
6683 | /* 2- Resolve the bare type */ | |
6684 | if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl))) | |
6685 | return NULL_TREE; | |
6686 | resolved_type = TREE_TYPE (resolved_type_decl); | |
6687 | ||
6688 | /* 3- If we have and array, reconstruct the array down to its nesting */ | |
6689 | if (base != name) | |
6690 | { | |
6691 | while (base != name) | |
6692 | { | |
6693 | if (TREE_CODE (resolved_type) == RECORD_TYPE) | |
6694 | resolved_type = promote_type (resolved_type); | |
6695 | resolved_type = build_java_array_type (resolved_type, -1); | |
6696 | CLASS_LOADED_P (resolved_type) = 1; | |
6697 | name--; | |
6698 | } | |
6699 | /* Build a fake decl for this, since this is what is expected to | |
6700 | be returned. */ | |
6701 | resolved_type_decl = | |
6702 | build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type); | |
6703 | /* Figure how those two things are important for error report. FIXME */ | |
6704 | DECL_SOURCE_LINE (resolved_type_decl) = 0; | |
6705 | DECL_SOURCE_FILE (resolved_type_decl) = input_filename; | |
6706 | } | |
6707 | return resolved_type_decl; | |
6708 | } | |
6709 | ||
6710 | /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL | |
6711 | are used to report error messages. */ | |
6712 | ||
6713 | static tree | |
6714 | do_resolve_class (class_type, decl, cl) | |
6715 | tree class_type; | |
6716 | tree decl; | |
6717 | tree cl; | |
6718 | { | |
6719 | tree new_class_decl; | |
6720 | tree original_name = NULL_TREE; | |
6721 | ||
6722 | /* Do not try to replace TYPE_NAME (class_type) by a variable, since | |
6723 | its is changed by find_in_imports{_on_demand} */ | |
6724 | ||
6725 | /* 1- Check for the type in single imports */ | |
6726 | if (find_in_imports (class_type)) | |
6727 | return NULL_TREE; | |
6728 | ||
6729 | /* 2- And check for the type in the current compilation unit. If it fails, | |
6730 | try with a name qualified with the package name if appropriate. */ | |
8b27f225 PB |
6731 | if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) |
6732 | { | |
6733 | if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && | |
6734 | !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl))) | |
6735 | load_class (TYPE_NAME (class_type), 0); | |
6736 | return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
6737 | } | |
6738 | ||
6739 | original_name = TYPE_NAME (class_type); | |
6740 | if (!QUALIFIED_P (TYPE_NAME (class_type)) && ctxp->package) | |
6741 | TYPE_NAME (class_type) = merge_qualified_name (ctxp->package, | |
6742 | TYPE_NAME (class_type)); | |
5e942c50 APB |
6743 | if (!(new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) |
6744 | load_class (TYPE_NAME (class_type), 0); | |
8b27f225 PB |
6745 | if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) |
6746 | { | |
6747 | if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && | |
6748 | !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl))) | |
6749 | load_class (TYPE_NAME (class_type), 0); | |
6750 | return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
6751 | } | |
6752 | TYPE_NAME (class_type) = original_name; | |
6753 | ||
6754 | /* 3- Check an other compilation unit that bears the name of type */ | |
6755 | load_class (TYPE_NAME (class_type), 0); | |
6756 | if (check_pkg_class_access (TYPE_NAME (class_type), | |
6757 | (cl ? cl : lookup_cl (decl)))) | |
6758 | return NULL_TREE; | |
6759 | ||
6760 | if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) | |
6761 | return new_class_decl; | |
6762 | ||
6763 | /* 4- Check the import on demands. Don't allow bar.baz to be | |
6764 | imported from foo.* */ | |
6765 | if (!QUALIFIED_P (TYPE_NAME (class_type))) | |
6766 | if (find_in_imports_on_demand (class_type)) | |
6767 | return NULL_TREE; | |
6768 | ||
6769 | /* 5- Last call for a resolution */ | |
6770 | return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
6771 | } | |
6772 | ||
6773 | /* Resolve NAME and lay it out (if not done and if not the current | |
23a79c61 APB |
6774 | parsed class). Return a decl node. This function is meant to be |
6775 | called when type resolution is necessary during the walk pass. */ | |
8b27f225 PB |
6776 | |
6777 | static tree | |
c877974e APB |
6778 | resolve_and_layout (something, cl) |
6779 | tree something; | |
8b27f225 PB |
6780 | tree cl; |
6781 | { | |
c877974e APB |
6782 | tree decl; |
6783 | ||
23a79c61 APB |
6784 | /* Don't do that on the current class */ |
6785 | if (something == current_class) | |
6786 | return TYPE_NAME (current_class); | |
c877974e | 6787 | |
23a79c61 | 6788 | /* Don't do anything for void and other primitive types */ |
c877974e APB |
6789 | if (JPRIMITIVE_TYPE_P (something) || something == void_type_node) |
6790 | return NULL_TREE; | |
6791 | ||
23a79c61 APB |
6792 | /* Pointer types can be reall pointer types or fake pointers. When |
6793 | finding a real pointer, recheck for primitive types */ | |
6794 | if (TREE_CODE (something) == POINTER_TYPE) | |
6795 | { | |
6796 | if (TREE_TYPE (something)) | |
6797 | { | |
6798 | something = TREE_TYPE (something); | |
6799 | if (JPRIMITIVE_TYPE_P (something) || something == void_type_node) | |
6800 | return NULL_TREE; | |
6801 | } | |
6802 | else | |
6803 | something = TYPE_NAME (something); | |
6804 | } | |
6805 | ||
6806 | /* Don't do anything for arrays of primitive types */ | |
6807 | if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something) | |
6808 | && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something))) | |
6809 | return NULL_TREE; | |
6810 | ||
6811 | /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL | |
6812 | or a real TYPE */ | |
c877974e APB |
6813 | if (TREE_CODE (something) != IDENTIFIER_NODE) |
6814 | something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ? | |
6815 | DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something)); | |
6816 | ||
23a79c61 APB |
6817 | if (!(decl = resolve_no_layout (something, cl))) |
6818 | return NULL_TREE; | |
6819 | ||
6820 | /* Resolve and layout if necessary */ | |
6821 | layout_class_methods (TREE_TYPE (decl)); | |
6822 | if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl))) | |
6823 | CHECK_METHODS (decl); | |
6824 | if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl))) | |
8b27f225 | 6825 | safe_layout_class (TREE_TYPE (decl)); |
23a79c61 | 6826 | |
8b27f225 PB |
6827 | return decl; |
6828 | } | |
6829 | ||
6830 | /* Resolve a class, returns its decl but doesn't perform any | |
6831 | layout. The current parsing context is saved and restored */ | |
6832 | ||
6833 | static tree | |
6834 | resolve_no_layout (name, cl) | |
6835 | tree name, cl; | |
6836 | { | |
6837 | tree ptr, decl; | |
6838 | BUILD_PTR_FROM_NAME (ptr, name); | |
6839 | java_parser_context_save_global (); | |
6840 | decl = resolve_class (ptr, NULL_TREE, cl); | |
6841 | java_parser_context_restore_global (); | |
6842 | ||
6843 | return decl; | |
6844 | } | |
6845 | ||
23a79c61 | 6846 | /* Called when reporting errors. Skip leader '[' in a complex array |
82371d41 | 6847 | type description that failed to be resolved. */ |
8b27f225 PB |
6848 | |
6849 | static char * | |
6850 | purify_type_name (name) | |
6851 | char *name; | |
6852 | { | |
6853 | while (*name && *name == '[') | |
6854 | name++; | |
6855 | return name; | |
6856 | } | |
6857 | ||
6858 | /* The type CURRENT refers to can't be found. We print error messages. */ | |
6859 | ||
6860 | static void | |
6861 | complete_class_report_errors (dep) | |
6862 | jdep *dep; | |
6863 | { | |
23a79c61 APB |
6864 | char *name; |
6865 | ||
6866 | if (!JDEP_WFL (dep)) | |
6867 | return; | |
6868 | ||
6869 | name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))); | |
8b27f225 PB |
6870 | switch (JDEP_KIND (dep)) |
6871 | { | |
6872 | case JDEP_SUPER: | |
6873 | parse_error_context | |
6874 | (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found", | |
23a79c61 | 6875 | purify_type_name (name), |
8b27f225 PB |
6876 | IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); |
6877 | break; | |
6878 | case JDEP_FIELD: | |
6879 | parse_error_context | |
6880 | (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'", | |
23a79c61 | 6881 | purify_type_name (name), |
8b27f225 PB |
6882 | IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); |
6883 | break; | |
6884 | case JDEP_METHOD: /* Covers arguments */ | |
6885 | parse_error_context | |
6886 | (JDEP_WFL (dep), "Type `%s' not found in the declaration of the " | |
6887 | "argument `%s' of method `%s'", | |
23a79c61 | 6888 | purify_type_name (name), |
8b27f225 PB |
6889 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))), |
6890 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep)))); | |
6891 | break; | |
6892 | case JDEP_METHOD_RETURN: /* Covers return type */ | |
6893 | parse_error_context | |
6894 | (JDEP_WFL (dep), "Type `%s' not found in the declaration of the " | |
6895 | "return type of method `%s'", | |
23a79c61 | 6896 | purify_type_name (name), |
8b27f225 PB |
6897 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep)))); |
6898 | break; | |
6899 | case JDEP_INTERFACE: | |
6900 | parse_error_context | |
6901 | (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found", | |
6902 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))), | |
6903 | (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")), | |
6904 | IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); | |
6905 | break; | |
6906 | case JDEP_VARIABLE: | |
6907 | parse_error_context | |
6908 | (JDEP_WFL (dep), "Type `%s' not found in the declaration of the " | |
6909 | "local variable `%s'", | |
6910 | purify_type_name (IDENTIFIER_POINTER | |
6911 | (EXPR_WFL_NODE (JDEP_WFL (dep)))), | |
6912 | IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); | |
6913 | break; | |
6914 | case JDEP_EXCEPTION: /* As specified by `throws' */ | |
6915 | parse_error_context | |
6916 | (JDEP_WFL (dep), "Class `%s' not found in `throws'", | |
6917 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))); | |
6918 | break; | |
6919 | default: | |
6920 | /* Fix for -Wall. Just break doing nothing. The error will be | |
6921 | caught later */ | |
6922 | break; | |
6923 | } | |
6924 | } | |
6925 | ||
6926 | /* Check uninitialized final. */ | |
6927 | ||
6928 | void | |
6929 | java_check_final () | |
6930 | { | |
6931 | } | |
6932 | ||
22eed1e6 APB |
6933 | /* Return a static string containing the DECL prototype string. If |
6934 | DECL is a constructor, use the class name instead of the form | |
6935 | <init> */ | |
6936 | ||
6937 | static char * | |
6938 | get_printable_method_name (decl) | |
6939 | tree decl; | |
6940 | { | |
6941 | char *to_return; | |
6942 | tree name; | |
6943 | ||
6944 | if (DECL_CONSTRUCTOR_P (decl)) | |
6945 | { | |
6946 | name = DECL_NAME (decl); | |
5e942c50 | 6947 | DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))); |
22eed1e6 APB |
6948 | } |
6949 | ||
6950 | to_return = lang_printable_name (decl, 0); | |
6951 | if (DECL_CONSTRUCTOR_P (decl)) | |
6952 | DECL_NAME (decl) = name; | |
6953 | ||
6954 | return to_return; | |
6955 | } | |
6956 | ||
5e942c50 APB |
6957 | /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method |
6958 | nevertheless needs to be verfied, 1 otherwise. */ | |
6959 | ||
6960 | static int | |
6961 | reset_method_name (method) | |
6962 | tree method; | |
6963 | { | |
6964 | if (DECL_NAME (method) != clinit_identifier_node | |
6965 | && DECL_NAME (method) != finit_identifier_node) | |
6966 | { | |
6967 | /* NAME is just the plain name when Object is being defined */ | |
6968 | if (DECL_CONTEXT (method) != object_type_node) | |
c877974e APB |
6969 | DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ? |
6970 | init_identifier_node : GET_METHOD_NAME (method)); | |
5e942c50 APB |
6971 | return 0; |
6972 | } | |
6973 | else | |
6974 | return 1; | |
6975 | } | |
6976 | ||
c877974e APB |
6977 | /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */ |
6978 | ||
6979 | tree | |
6980 | java_get_real_method_name (method_decl) | |
6981 | tree method_decl; | |
6982 | { | |
6983 | tree method_name = DECL_NAME (method_decl); | |
6984 | if (DECL_CONSTRUCTOR_P (method_decl)) | |
6985 | return init_identifier_node; | |
82371d41 APB |
6986 | |
6987 | /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P | |
6988 | and still can be a constructor. FIXME */ | |
6989 | ||
23a79c61 APB |
6990 | /* Don't confuse method only bearing the name of their class as |
6991 | constructors */ | |
82371d41 APB |
6992 | else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl)) |
6993 | && ctxp | |
6994 | && ctxp->current_parsed_class_un == EXPR_WFL_NODE (method_name) | |
23a79c61 APB |
6995 | && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED |
6996 | && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node) | |
c877974e APB |
6997 | return init_identifier_node; |
6998 | else | |
6999 | return EXPR_WFL_NODE (method_name); | |
7000 | } | |
7001 | ||
22eed1e6 APB |
7002 | /* Track method being redefined inside the same class. As a side |
7003 | effect, set DECL_NAME to an IDENTIFIER (prior entering this | |
7004 | function it's a FWL, so we can track errors more accurately */ | |
7005 | ||
8b27f225 PB |
7006 | static int |
7007 | check_method_redefinition (class, method) | |
7008 | tree class, method; | |
7009 | { | |
7010 | tree redef, name; | |
7011 | tree cl = DECL_NAME (method); | |
c3f2a476 | 7012 | tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method)); |
ac825856 | 7013 | /* decl name of artificial <clinit> and $finit$ doesn't need to be fixed and |
8b27f225 | 7014 | checked */ |
5e942c50 APB |
7015 | |
7016 | /* Reset the method name before running the check. If it returns 1, | |
7017 | the method doesn't need to be verified with respect to method | |
7018 | redeclaration and we return 0 */ | |
7019 | if (reset_method_name (method)) | |
8b27f225 | 7020 | return 0; |
5e942c50 APB |
7021 | |
7022 | name = DECL_NAME (method); | |
8b27f225 PB |
7023 | for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef)) |
7024 | { | |
c3f2a476 | 7025 | if (redef == method) |
8b27f225 | 7026 | break; |
c3f2a476 APB |
7027 | if (DECL_NAME (redef) == name |
7028 | && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef))) | |
8b27f225 | 7029 | { |
22eed1e6 APB |
7030 | parse_error_context |
7031 | (cl, "Duplicate %s declaration `%s'", | |
7032 | (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"), | |
7033 | get_printable_method_name (redef)); | |
8b27f225 PB |
7034 | return 1; |
7035 | } | |
7036 | } | |
7037 | return 0; | |
7038 | } | |
7039 | ||
7040 | /* Check all the methods of CLASS. Methods are first completed then | |
7041 | checked according to regular method existance rules. | |
7042 | If no constructor were encountered, then build its declaration. */ | |
7043 | ||
7044 | static void | |
7045 | java_check_regular_methods (class_decl) | |
7046 | tree class_decl; | |
7047 | { | |
5e942c50 | 7048 | int saw_constructor = 0; |
8b27f225 PB |
7049 | tree method; |
7050 | tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl)); | |
7051 | tree super_class = CLASSTYPE_SUPER (class); | |
5e942c50 | 7052 | tree saved_found_wfl = NULL_TREE, found = NULL_TREE; |
c877974e APB |
7053 | tree mthrows; |
7054 | ||
7055 | /* It is not necessary to check methods defined in java.lang.Object */ | |
7056 | if (class == object_type_node) | |
7057 | return; | |
8b27f225 | 7058 | |
23a79c61 APB |
7059 | if (!TYPE_NVIRTUALS (class)) |
7060 | TYPE_METHODS (class) = nreverse (TYPE_METHODS (class)); | |
8b27f225 PB |
7061 | |
7062 | /* Should take interfaces into account. FIXME */ | |
7063 | for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method)) | |
7064 | { | |
5e942c50 | 7065 | tree sig; |
8b27f225 PB |
7066 | tree method_wfl = DECL_NAME (method); |
7067 | int aflags; | |
7068 | ||
5e942c50 APB |
7069 | /* If we previously found something and its name was saved, |
7070 | reinstall it now */ | |
7071 | if (found && saved_found_wfl) | |
7072 | DECL_NAME (found) = saved_found_wfl; | |
7073 | ||
8b27f225 PB |
7074 | /* Check for redefinitions */ |
7075 | if (check_method_redefinition (class, method)) | |
7076 | continue; | |
7077 | ||
22eed1e6 APB |
7078 | /* If we see one constructor a mark so we don't generate the |
7079 | default one. Also skip other verifications: constructors | |
7080 | can't be inherited hence hiden or overriden */ | |
7081 | if (DECL_CONSTRUCTOR_P (method)) | |
7082 | { | |
7083 | saw_constructor = 1; | |
7084 | continue; | |
7085 | } | |
7086 | ||
c877974e APB |
7087 | /* We verify things thrown by the method. They must inherits from |
7088 | java.lang.Throwable */ | |
7089 | for (mthrows = DECL_FUNCTION_THROWS (method); | |
7090 | mthrows; mthrows = TREE_CHAIN (mthrows)) | |
7091 | { | |
7092 | if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node)) | |
7093 | parse_error_context | |
7094 | (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be " | |
7095 | "a subclass of class `java.lang.Throwable'", | |
7096 | IDENTIFIER_POINTER | |
7097 | (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows))))); | |
7098 | } | |
7099 | ||
8b27f225 | 7100 | sig = build_java_argument_signature (TREE_TYPE (method)); |
8b27f225 PB |
7101 | found = lookup_argument_method (super_class, DECL_NAME (method), sig); |
7102 | ||
5e942c50 | 7103 | /* Nothing overrides or it's a private method. */ |
8b27f225 | 7104 | if (!found || (found && METHOD_PRIVATE (found))) |
5e942c50 APB |
7105 | continue; |
7106 | ||
7107 | /* If found wasn't verified, it's DECL_NAME won't be set properly. | |
7108 | We set it temporarily for the sake of the error report. */ | |
7109 | saved_found_wfl = DECL_NAME (found); | |
7110 | reset_method_name (found); | |
7111 | ||
8b27f225 PB |
7112 | /* Can't override a method with the same name and different return |
7113 | types. */ | |
7114 | if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method))) | |
7115 | { | |
7116 | char *t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), | |
7117 | 0)); | |
7118 | parse_error_context | |
7119 | (method_wfl, | |
7120 | "Method `%s' was defined with return type `%s' in class `%s'", | |
7121 | lang_printable_name (found, 0), t, | |
7122 | IDENTIFIER_POINTER | |
7123 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7124 | free (t); | |
7125 | } | |
7126 | ||
7127 | /* Can't override final. Can't override static. */ | |
7128 | if (METHOD_FINAL (found) || METHOD_STATIC (found)) | |
7129 | { | |
7130 | /* Static *can* override static */ | |
7131 | if (METHOD_STATIC (found) && METHOD_STATIC (method)) | |
7132 | continue; | |
7133 | parse_error_context | |
7134 | (method_wfl, | |
7135 | "%s methods can't be overriden. Method `%s' is %s in class `%s'", | |
7136 | (METHOD_FINAL (found) ? "Final" : "Static"), | |
7137 | lang_printable_name (found, 0), | |
7138 | (METHOD_FINAL (found) ? "final" : "static"), | |
7139 | IDENTIFIER_POINTER | |
7140 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7141 | continue; | |
7142 | } | |
7143 | /* Static method can't override instance method. */ | |
7144 | if (METHOD_STATIC (method)) | |
7145 | { | |
7146 | parse_error_context | |
7147 | (method_wfl, | |
7148 | "Instance methods can't be overriden by a static method. Method " | |
7149 | "`%s' is an instance method in class `%s'", | |
7150 | lang_printable_name (found, 0), | |
7151 | IDENTIFIER_POINTER | |
7152 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7153 | continue; | |
7154 | } | |
5e942c50 APB |
7155 | |
7156 | aflags = get_access_flags_from_decl (found); | |
7157 | /* - Overriding/hiding public must be public | |
7158 | - Overriding/hiding protected must be protected or public | |
7159 | - If the overriden or hidden method has default (package) | |
7160 | access, then the overriding or hiding method must not be | |
7161 | private; otherwise, a compile-time error occurs */ | |
7162 | if ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method)) | |
7163 | || (METHOD_PROTECTED (found) | |
7164 | && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method))) | |
7165 | || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC)) | |
7166 | && METHOD_PRIVATE (method))) | |
8b27f225 PB |
7167 | { |
7168 | parse_error_context | |
7169 | (method_wfl, | |
7170 | "Methods can't be overridden to be more private. Method `%s' is " | |
5e942c50 APB |
7171 | "not %s in class `%s'", lang_printable_name (method, 0), |
7172 | (METHOD_PUBLIC (method) ? "public" : | |
7173 | (METHOD_PRIVATE (method) ? "private" : "protected")), | |
7174 | IDENTIFIER_POINTER (DECL_NAME | |
7175 | (TYPE_NAME (DECL_CONTEXT (found))))); | |
8b27f225 PB |
7176 | continue; |
7177 | } | |
7178 | ||
7179 | /* Overriding methods must have compatible `throws' clauses on checked | |
7180 | exceptions, if any */ | |
7181 | check_throws_clauses (method, method_wfl, found); | |
7182 | ||
7183 | /* If the method has default access in an other package, then | |
7184 | issue a warning that the current method doesn't override the | |
5e942c50 APB |
7185 | one that was found elsewhere. Do not issue this warning when |
7186 | the match was found in java.lang.Object. */ | |
7187 | if (DECL_CONTEXT (found) != object_type_node | |
7188 | && (!aflags || (aflags > ACC_PROTECTED)) | |
c877974e APB |
7189 | && !class_in_current_package (DECL_CONTEXT (found)) |
7190 | && flag_not_overriding) | |
8b27f225 PB |
7191 | parse_warning_context |
7192 | (method_wfl, "Method `%s' in class `%s' does not " | |
7193 | "override the corresponding method in class `%s', which is " | |
7194 | "private to a different package", | |
7195 | lang_printable_name (found, 0), | |
7196 | IDENTIFIER_POINTER (DECL_NAME (class_decl)), | |
7197 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7198 | ||
8b27f225 PB |
7199 | /* Inheriting multiple methods with the same signature. FIXME */ |
7200 | } | |
7201 | ||
5e942c50 APB |
7202 | /* Don't forget eventual pending found and saved_found_wfl. Take |
7203 | into account that we might have exited because we saw an | |
7204 | aritifical method as the last entry. */ | |
7205 | ||
7206 | if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl) | |
7207 | DECL_NAME (found) = saved_found_wfl; | |
7208 | ||
23a79c61 APB |
7209 | if (!TYPE_NVIRTUALS (class)) |
7210 | TYPE_METHODS (class) = nreverse (TYPE_METHODS (class)); | |
8b27f225 | 7211 | |
22eed1e6 | 7212 | if (!saw_constructor) |
8b27f225 | 7213 | { |
23a79c61 APB |
7214 | /* No constructor seen, we craft one, at line 0. Since this |
7215 | operation takes place after we laid methods out | |
7216 | (layout_class_methods), we prepare the its DECL | |
7217 | appropriately. */ | |
22eed1e6 APB |
7218 | int flags; |
7219 | tree decl; | |
7220 | ||
7221 | /* If the class is declared PUBLIC, the default constructor is | |
7222 | PUBLIC otherwise it has default access implied by no access | |
7223 | modifiers. */ | |
7224 | flags = (get_access_flags_from_decl (class_decl) & ACC_PUBLIC ? | |
7225 | ACC_PUBLIC : 0); | |
7226 | decl = create_artificial_method (class, flags, void_type_node, | |
82371d41 | 7227 | init_identifier_node, end_params_node); |
8b27f225 | 7228 | DECL_CONSTRUCTOR_P (decl) = 1; |
23a79c61 | 7229 | layout_class_method (TREE_TYPE (class_decl), NULL_TREE, decl, NULL_TREE); |
8b27f225 PB |
7230 | } |
7231 | } | |
7232 | ||
7233 | /* Return a non zero value if the `throws' clause of METHOD (if any) | |
7234 | is incompatible with the `throws' clause of FOUND (if any). */ | |
7235 | ||
7236 | static void | |
7237 | check_throws_clauses (method, method_wfl, found) | |
7238 | tree method, method_wfl, found; | |
7239 | { | |
7240 | tree mthrows, fthrows; | |
7241 | ||
c877974e APB |
7242 | /* Can't check these things with class loaded from bytecode. FIXME */ |
7243 | if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found))) | |
7244 | return; | |
7245 | ||
8b27f225 PB |
7246 | for (mthrows = DECL_FUNCTION_THROWS (method); |
7247 | mthrows; mthrows = TREE_CHAIN (mthrows)) | |
7248 | { | |
7249 | /* We don't verify unchecked expressions */ | |
c877974e | 7250 | if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows))) |
8b27f225 PB |
7251 | continue; |
7252 | /* Checked expression must be compatible */ | |
7253 | for (fthrows = DECL_FUNCTION_THROWS (found); | |
7254 | fthrows; fthrows = TREE_CHAIN (fthrows)) | |
7255 | if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows))) | |
7256 | break; | |
7257 | if (!fthrows) | |
7258 | { | |
7259 | parse_error_context | |
7260 | (method_wfl, "Invalid checked exception class `%s' in " | |
7261 | "`throws' clause. The exception must be a subclass of an " | |
7262 | "exception thrown by `%s' from class `%s'", | |
7263 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))), | |
7264 | lang_printable_name (found, 0), | |
7265 | IDENTIFIER_POINTER | |
7266 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7267 | } | |
7268 | } | |
7269 | } | |
7270 | ||
7271 | /* Check abstract method of interface INTERFACE */ | |
7272 | ||
7273 | static void | |
5e942c50 APB |
7274 | java_check_abstract_methods (interface_decl) |
7275 | tree interface_decl; | |
8b27f225 PB |
7276 | { |
7277 | int i, n; | |
7278 | tree method, basetype_vec, found; | |
5e942c50 | 7279 | tree interface = TREE_TYPE (interface_decl); |
8b27f225 PB |
7280 | |
7281 | for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method)) | |
7282 | { | |
7283 | tree method_wfl = DECL_NAME (method); | |
7284 | ||
7285 | /* 2- Check for double definition inside the defining interface */ | |
7286 | if (check_method_redefinition (interface, method)) | |
7287 | continue; | |
7288 | ||
7289 | /* 3- Overriding is OK as far as we preserve the return type and | |
7290 | the thrown exceptions (FIXME) */ | |
7291 | found = lookup_java_interface_method2 (interface, method); | |
7292 | if (found) | |
7293 | { | |
5e942c50 APB |
7294 | char *t; |
7295 | tree saved_found_wfl = DECL_NAME (found); | |
7296 | reset_method_name (found); | |
7297 | t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0)); | |
8b27f225 PB |
7298 | parse_error_context |
7299 | (method_wfl, | |
5e942c50 | 7300 | "Method `%s' was defined with return type `%s' in class `%s'", |
8b27f225 PB |
7301 | lang_printable_name (found, 0), t, |
7302 | IDENTIFIER_POINTER | |
7303 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7304 | free (t); | |
7305 | continue; | |
5e942c50 APB |
7306 | |
7307 | DECL_NAME (found) = saved_found_wfl; | |
8b27f225 PB |
7308 | } |
7309 | } | |
7310 | ||
7311 | /* 4- Inherited methods can't differ by their returned types */ | |
7312 | if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface))) | |
7313 | return; | |
7314 | n = TREE_VEC_LENGTH (basetype_vec); | |
7315 | for (i = 0; i < n; i++) | |
7316 | { | |
7317 | tree sub_interface_method, sub_interface; | |
7318 | tree vec_elt = TREE_VEC_ELT (basetype_vec, i); | |
7319 | if (!vec_elt) | |
7320 | continue; | |
7321 | sub_interface = BINFO_TYPE (vec_elt); | |
7322 | for (sub_interface_method = TYPE_METHODS (sub_interface); | |
7323 | sub_interface_method; | |
7324 | sub_interface_method = TREE_CHAIN (sub_interface_method)) | |
7325 | { | |
7326 | found = lookup_java_interface_method2 (interface, | |
7327 | sub_interface_method); | |
7328 | if (found && (found != sub_interface_method)) | |
5e942c50 APB |
7329 | { |
7330 | tree saved_found_wfl = DECL_NAME (found); | |
7331 | reset_method_name (found); | |
7332 | parse_error_context | |
7333 | (lookup_cl (sub_interface_method), | |
7334 | "Interface `%s' inherits method `%s' from interface `%s'. " | |
7335 | "This method is redefined with a different return type in " | |
7336 | "interface `%s'", | |
7337 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))), | |
7338 | lang_printable_name (found, 0), | |
7339 | IDENTIFIER_POINTER | |
7340 | (DECL_NAME (TYPE_NAME | |
7341 | (DECL_CONTEXT (sub_interface_method)))), | |
7342 | IDENTIFIER_POINTER | |
7343 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7344 | DECL_NAME (found) = saved_found_wfl; | |
7345 | } | |
8b27f225 PB |
7346 | } |
7347 | } | |
7348 | } | |
7349 | ||
8b27f225 PB |
7350 | /* Lookup methods in interfaces using their name and partial |
7351 | signature. Return a matching method only if their types differ. */ | |
7352 | ||
7353 | static tree | |
7354 | lookup_java_interface_method2 (class, method_decl) | |
7355 | tree class, method_decl; | |
7356 | { | |
7357 | int i, n; | |
7358 | tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return; | |
7359 | ||
7360 | if (!basetype_vec) | |
7361 | return NULL_TREE; | |
7362 | ||
7363 | n = TREE_VEC_LENGTH (basetype_vec); | |
7364 | for (i = 0; i < n; i++) | |
7365 | { | |
7366 | tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return; | |
7367 | if ((BINFO_TYPE (vec_elt) != object_type_node) | |
7368 | && (to_return = | |
7369 | lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1))) | |
7370 | return to_return; | |
7371 | } | |
7372 | for (i = 0; i < n; i++) | |
7373 | { | |
7374 | to_return = lookup_java_interface_method2 | |
7375 | (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl); | |
7376 | if (to_return) | |
7377 | return to_return; | |
7378 | } | |
7379 | ||
7380 | return NULL_TREE; | |
7381 | } | |
7382 | ||
7383 | /* Lookup method using their name and partial signature. Return a | |
7384 | matching method only if their types differ. */ | |
7385 | ||
7386 | static tree | |
7387 | lookup_java_method2 (clas, method_decl, do_interface) | |
7388 | tree clas, method_decl; | |
7389 | int do_interface; | |
7390 | { | |
5e942c50 APB |
7391 | tree method, method_signature, method_name, method_type, name; |
7392 | ||
8b27f225 | 7393 | method_signature = build_java_argument_signature (TREE_TYPE (method_decl)); |
5e942c50 APB |
7394 | name = DECL_NAME (method_decl); |
7395 | method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? | |
7396 | EXPR_WFL_NODE (name) : name); | |
8b27f225 PB |
7397 | method_type = TREE_TYPE (TREE_TYPE (method_decl)); |
7398 | ||
7399 | while (clas != NULL_TREE) | |
7400 | { | |
7401 | for (method = TYPE_METHODS (clas); | |
7402 | method != NULL_TREE; method = TREE_CHAIN (method)) | |
7403 | { | |
7404 | tree method_sig = build_java_argument_signature (TREE_TYPE (method)); | |
5e942c50 APB |
7405 | tree name = DECL_NAME (method); |
7406 | if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? | |
7407 | EXPR_WFL_NODE (name) : name) == method_name | |
8b27f225 PB |
7408 | && method_sig == method_signature |
7409 | && TREE_TYPE (TREE_TYPE (method)) != method_type) | |
5e942c50 | 7410 | return method; |
8b27f225 PB |
7411 | } |
7412 | clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas)); | |
7413 | } | |
7414 | return NULL_TREE; | |
7415 | } | |
7416 | ||
7417 | /* Return the line that matches DECL line number. Used during error | |
7418 | report */ | |
7419 | ||
7420 | static tree | |
7421 | lookup_cl (decl) | |
7422 | tree decl; | |
7423 | { | |
7424 | static tree cl = NULL_TREE; | |
7425 | ||
7426 | if (!decl) | |
7427 | return NULL_TREE; | |
7428 | ||
7429 | if (cl == NULL_TREE) | |
7430 | cl = build_expr_wfl (NULL_TREE, NULL, 0, 0); | |
7431 | ||
7432 | EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl)); | |
7433 | EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1); | |
7434 | ||
7435 | return cl; | |
7436 | } | |
7437 | ||
7438 | /* Look for a simple name in the single-type import list */ | |
7439 | ||
7440 | static tree | |
7441 | find_name_in_single_imports (name) | |
7442 | tree name; | |
7443 | { | |
7444 | tree node; | |
7445 | ||
7446 | for (node = ctxp->import_list; node; node = TREE_CHAIN (node)) | |
7447 | if (TREE_VALUE (node) == name) | |
7448 | return (EXPR_WFL_NODE (TREE_PURPOSE (node))); | |
7449 | ||
7450 | return NULL_TREE; | |
7451 | } | |
7452 | ||
7453 | /* Process all single-type import. */ | |
7454 | ||
7455 | static int | |
7456 | process_imports () | |
7457 | { | |
7458 | tree import; | |
7459 | int error_found; | |
7460 | ||
7461 | for (import = ctxp->import_list; import; import = TREE_CHAIN (import)) | |
7462 | { | |
7463 | tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import)); | |
7464 | ||
7465 | /* Don't load twice something already defined. */ | |
7466 | if (IDENTIFIER_CLASS_VALUE (to_be_found)) | |
7467 | continue; | |
7468 | QUALIFIED_P (to_be_found) = 1; | |
7469 | load_class (to_be_found, 0); | |
7470 | error_found = | |
7471 | check_pkg_class_access (to_be_found, TREE_PURPOSE (import)); | |
7472 | if (!IDENTIFIER_CLASS_VALUE (to_be_found)) | |
7473 | { | |
7474 | parse_error_context (TREE_PURPOSE (import), | |
7475 | "Class or interface `%s' not found in import", | |
7476 | IDENTIFIER_POINTER (to_be_found)); | |
7477 | return 1; | |
7478 | } | |
7479 | if (error_found) | |
7480 | return 1; | |
7481 | } | |
7482 | return 0; | |
7483 | } | |
7484 | ||
7485 | /* Possibly find a class imported by a single-type import statement. Return | |
7486 | 1 if an error occured, 0 otherwise. */ | |
7487 | ||
7488 | static int | |
7489 | find_in_imports (class_type) | |
7490 | tree class_type; | |
7491 | { | |
7492 | tree import; | |
7493 | ||
7494 | for (import = ctxp->import_list; import; import = TREE_CHAIN (import)) | |
7495 | if (TREE_VALUE (import) == TYPE_NAME (class_type)) | |
7496 | { | |
7497 | TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import)); | |
7498 | QUALIFIED_P (TYPE_NAME (class_type)) = 1; | |
8b27f225 PB |
7499 | } |
7500 | return 0; | |
7501 | } | |
7502 | ||
8b27f225 | 7503 | static int |
63a212ed PB |
7504 | note_possible_classname (name, len) |
7505 | char *name; | |
7506 | int len; | |
8b27f225 | 7507 | { |
63a212ed PB |
7508 | tree node; |
7509 | if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0) | |
7510 | len = len - 5; | |
7511 | else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0) | |
7512 | len = len - 6; | |
8b27f225 | 7513 | else |
63a212ed PB |
7514 | return 0; |
7515 | node = ident_subst (name, len, "", '/', '.', ""); | |
7516 | IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */ | |
7517 | QUALIFIED_P (node) = 1; /* As soon as we turn / into . */ | |
7518 | return 1; | |
8b27f225 PB |
7519 | } |
7520 | ||
7521 | /* Read a import directory, gathering potential match for further type | |
7522 | references. Indifferently reads a filesystem or a ZIP archive | |
7523 | directory. */ | |
7524 | ||
7525 | static void | |
7526 | read_import_dir (wfl) | |
7527 | tree wfl; | |
7528 | { | |
63a212ed PB |
7529 | tree package_id = EXPR_WFL_NODE (wfl); |
7530 | char *package_name = IDENTIFIER_POINTER (package_id); | |
7531 | int package_length = IDENTIFIER_LENGTH (package_id); | |
8b27f225 PB |
7532 | DIR *dirp = NULL; |
7533 | JCF jcfr, *jcf, *saved_jcf = current_jcf; | |
8b27f225 | 7534 | |
63a212ed PB |
7535 | int found = 0; |
7536 | int k; | |
7537 | void *entry; | |
7538 | struct buffer filename[1]; | |
7539 | ||
8b27f225 | 7540 | |
63a212ed PB |
7541 | if (IS_AN_IMPORT_ON_DEMAND_P (package_id)) |
7542 | return; | |
7543 | IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1; | |
7544 | ||
7545 | BUFFER_INIT (filename); | |
7546 | buffer_grow (filename, package_length + 100); | |
8b27f225 | 7547 | |
63a212ed PB |
7548 | for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry)) |
7549 | { | |
7550 | char *entry_name = jcf_path_name (entry); | |
7551 | int entry_length = strlen (entry_name); | |
7552 | if (jcf_path_is_zipfile (entry)) | |
7553 | { | |
7554 | ZipFile *zipf; | |
7555 | buffer_grow (filename, entry_length); | |
7556 | memcpy (filename->data, entry_name, entry_length - 1); | |
7557 | filename->data[entry_length-1] = '\0'; | |
7558 | zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry)); | |
7559 | if (zipf == NULL) | |
7560 | error ("malformed .zip archive in CLASSPATH: %s", entry_name); | |
7561 | else | |
7562 | { | |
7563 | ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory; | |
7564 | BUFFER_RESET (filename); | |
7565 | for (k = 0; k < package_length; k++) | |
7566 | { | |
7567 | char ch = package_name[k]; | |
7568 | *filename->ptr++ = ch == '.' ? '/' : ch; | |
7569 | } | |
7570 | *filename->ptr++ = '/'; | |
7571 | ||
7572 | for (; k < zipf->count; k++, zipd = ZIPDIR_NEXT (zipd)) | |
7573 | { | |
7574 | char *current_entry = ZIPDIR_FILENAME (zipd); | |
7575 | int current_entry_len = zipd->filename_length; | |
7576 | ||
7577 | if (strncmp (filename->data, current_entry, | |
7578 | BUFFER_LENGTH (filename)) != 0) | |
7579 | continue; | |
7580 | found += note_possible_classname (current_entry, | |
7581 | current_entry_len); | |
7582 | } | |
7583 | } | |
7584 | } | |
7585 | else | |
7586 | { | |
7587 | BUFFER_RESET (filename); | |
7588 | buffer_grow (filename, entry_length + package_length + 4); | |
7589 | strcpy (filename->data, entry_name); | |
7590 | filename->ptr = filename->data + entry_length; | |
7591 | for (k = 0; k < package_length; k++) | |
7592 | { | |
7593 | char ch = package_name[k]; | |
7594 | *filename->ptr++ = ch == '.' ? '/' : ch; | |
7595 | } | |
7596 | *filename->ptr = '\0'; | |
7597 | ||
7598 | dirp = opendir (filename->data); | |
7599 | if (dirp == NULL) | |
7600 | continue; | |
7601 | *filename->ptr++ = '/'; | |
7602 | for (;;) | |
7603 | { | |
7604 | int java_or_class = 0; | |
7605 | int len; | |
7606 | char *d_name; | |
7607 | struct dirent *direntp = readdir (dirp); | |
7608 | if (!direntp) | |
7609 | break; | |
7610 | d_name = direntp->d_name; | |
7611 | len = strlen (direntp->d_name); | |
7612 | buffer_grow (filename, len+1); | |
7613 | strcpy (filename->ptr, d_name); | |
7614 | found += note_possible_classname (filename->data + entry_length, | |
7615 | package_length+len+1); | |
7616 | } | |
7617 | if (dirp) | |
7618 | closedir (dirp); | |
7619 | } | |
7620 | } | |
7621 | ||
7622 | free (filename->data); | |
7623 | ||
7624 | /* Here we should have a unified way of retrieving an entry, to be | |
7625 | indexed. */ | |
7626 | if (!found) | |
8b27f225 PB |
7627 | { |
7628 | static int first = 1; | |
7629 | if (first) | |
7630 | { | |
7631 | char buffer [256]; | |
7632 | sprintf (buffer, "Can't find default package `%s'. Check " | |
7633 | "the CLASSPATH environment variable and the access to the " | |
63a212ed | 7634 | "archives.", package_name); |
8b27f225 PB |
7635 | error (buffer); |
7636 | java_error_count++; | |
7637 | first = 0; | |
7638 | } | |
7639 | else | |
63a212ed PB |
7640 | parse_error_context (wfl, "Package `%s' not found in import", |
7641 | package_name); | |
8b27f225 PB |
7642 | current_jcf = saved_jcf; |
7643 | return; | |
7644 | } | |
8b27f225 PB |
7645 | current_jcf = saved_jcf; |
7646 | } | |
7647 | ||
7648 | /* Possibly find a type in the import on demands specified | |
7649 | types. Returns 1 if an error occured, 0 otherwise. Run throught the | |
7650 | entire list, to detected potential double definitions. */ | |
7651 | ||
7652 | static int | |
7653 | find_in_imports_on_demand (class_type) | |
7654 | tree class_type; | |
7655 | { | |
7656 | tree node, import, node_to_use; | |
7657 | int seen_once = -1; | |
7658 | tree cl; | |
7659 | ||
7660 | for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import)) | |
7661 | { | |
7662 | char *id_name; | |
7663 | obstack_grow (&temporary_obstack, | |
7664 | IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))), | |
7665 | IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import)))); | |
63a212ed | 7666 | obstack_1grow (&temporary_obstack, '.'); |
8b27f225 PB |
7667 | obstack_grow0 (&temporary_obstack, |
7668 | IDENTIFIER_POINTER (TYPE_NAME (class_type)), | |
7669 | IDENTIFIER_LENGTH (TYPE_NAME (class_type))); | |
7670 | id_name = obstack_finish (&temporary_obstack); | |
7671 | ||
7672 | node = maybe_get_identifier (id_name); | |
7673 | if (node && IS_A_CLASSFILE_NAME (node)) | |
7674 | { | |
7675 | if (seen_once < 0) | |
7676 | { | |
7677 | cl = TREE_PURPOSE (import); | |
7678 | seen_once = 1; | |
7679 | node_to_use = node; | |
7680 | } | |
7681 | else | |
7682 | { | |
7683 | seen_once++; | |
7684 | parse_error_context | |
7685 | (import, "Type `%s' also potentially defined in package `%s'", | |
7686 | IDENTIFIER_POINTER (TYPE_NAME (class_type)), | |
7687 | IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import)))); | |
7688 | } | |
7689 | } | |
7690 | } | |
7691 | ||
7692 | if (seen_once == 1) | |
7693 | { | |
7694 | /* Setup lineno so that it refers to the line of the import (in | |
7695 | case we parse a class file and encounter errors */ | |
7696 | tree decl; | |
7697 | int saved_lineno = lineno; | |
7698 | lineno = EXPR_WFL_LINENO (cl); | |
63a212ed | 7699 | TYPE_NAME (class_type) = node_to_use; |
8b27f225 PB |
7700 | QUALIFIED_P (TYPE_NAME (class_type)) = 1; |
7701 | decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
7702 | /* If there is no DECL set for the class or if the class isn't | |
7703 | loaded and not seen in source yet, the load */ | |
7704 | if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl)) | |
7705 | && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))) | |
7706 | load_class (node_to_use, 0); | |
7707 | lineno = saved_lineno; | |
7708 | return check_pkg_class_access (TYPE_NAME (class_type), cl); | |
7709 | } | |
7710 | else | |
7711 | return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */ | |
7712 | } | |
7713 | ||
5e942c50 APB |
7714 | static tree |
7715 | resolve_package (pkg, next) | |
7716 | tree pkg, *next; | |
7717 | { | |
7718 | tree type_name = NULL_TREE; | |
7719 | char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg)); | |
7720 | ||
7721 | /* The trick is to determine when the package name stops and were | |
7722 | the name of something contained in the package starts. Then we | |
7723 | return a fully qualified name of what we want to get. */ | |
7724 | ||
7725 | /* Do a quick search on well known package names */ | |
7726 | if (!strncmp (name, "java.lang.reflect", 17)) | |
7727 | { | |
7728 | *next = | |
7729 | TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)))); | |
7730 | type_name = lookup_package_type (name, 17); | |
7731 | } | |
7732 | else if (!strncmp (name, "java.lang", 9)) | |
7733 | { | |
7734 | *next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg))); | |
7735 | type_name = lookup_package_type (name, 9); | |
7736 | } | |
7737 | else | |
7738 | return NULL_TREE; /* FIXME, search all imported packages. */ | |
7739 | ||
7740 | return type_name; | |
7741 | } | |
7742 | ||
7743 | static tree | |
7744 | lookup_package_type (name, from) | |
7745 | char *name; | |
7746 | int from; | |
7747 | { | |
7748 | char subname [128]; | |
7749 | char *sub = &name[from+1]; | |
7750 | while (*sub != '.' && *sub) | |
7751 | sub++; | |
7752 | strncpy (subname, name, sub-name); | |
7753 | subname [sub-name] = '\0'; | |
7754 | return get_identifier (subname); | |
7755 | } | |
7756 | ||
8b27f225 PB |
7757 | /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no |
7758 | access violations were found, 1 otherwise. */ | |
7759 | ||
7760 | static int | |
7761 | check_pkg_class_access (class_name, cl) | |
7762 | tree class_name; | |
7763 | tree cl; | |
7764 | { | |
7765 | tree type; | |
7766 | ||
7767 | if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name)) | |
7768 | return 0; | |
7769 | ||
7770 | if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name)))) | |
7771 | return 0; | |
7772 | ||
7773 | if (!CLASS_PUBLIC (TYPE_NAME (type))) | |
7774 | { | |
7775 | parse_error_context | |
7776 | (cl, "Can't access %s `%s'. Only public classes and interfaces in " | |
7777 | "other packages can be accessed", | |
7778 | (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"), | |
7779 | IDENTIFIER_POINTER (class_name)); | |
7780 | return 1; | |
7781 | } | |
7782 | return 0; | |
7783 | } | |
7784 | ||
7785 | /* Local variable declaration. */ | |
7786 | ||
7787 | static void | |
7788 | declare_local_variables (modifier, type, vlist) | |
7789 | int modifier; | |
7790 | tree type; | |
7791 | tree vlist; | |
7792 | { | |
7793 | tree decl, current, saved_type; | |
7794 | tree type_wfl = NULL_TREE; | |
7795 | int must_chain = 0; | |
7796 | ||
7797 | /* Push a new block if statement were seen between the last time we | |
7798 | pushed a block and now. Keep a cound of block to close */ | |
7799 | if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl))) | |
7800 | { | |
7801 | tree body = DECL_FUNCTION_BODY (current_function_decl); | |
7802 | tree b = enter_block (); | |
7803 | BLOCK_EXPR_ORIGIN(b) = body; | |
7804 | } | |
7805 | ||
7806 | if (modifier) | |
7807 | { | |
7808 | int i; | |
7809 | for (i = 0; i <= 10; i++) if (1 << i & modifier) break; | |
c877974e APB |
7810 | if (modifier == ACC_FINAL) |
7811 | { | |
7812 | if (flag_static_local_jdk1_1) | |
7813 | parse_warning_context (ctxp->modifier_ctx [i], | |
7814 | "Unsupported JDK1.1 `final' local variable " | |
7815 | "(treated as non final)"); | |
7816 | } | |
7817 | else | |
7818 | { | |
7819 | parse_error_context | |
7820 | (ctxp->modifier_ctx [i], | |
7821 | "Only `final' is allowed as a local variables modifier"); | |
7822 | return; | |
7823 | } | |
8b27f225 PB |
7824 | } |
7825 | ||
7826 | /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will | |
7827 | hold the TYPE value if a new incomplete has to be created (as | |
7828 | opposed to being found already existing and reused). */ | |
7829 | SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain); | |
7830 | ||
7831 | /* If TYPE is fully resolved and we don't have a reference, make one */ | |
1886c9d8 | 7832 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); |
8b27f225 PB |
7833 | |
7834 | /* Go through all the declared variables */ | |
7835 | for (current = vlist, saved_type = type; current; | |
7836 | current = TREE_CHAIN (current), type = saved_type) | |
7837 | { | |
c877974e | 7838 | tree other, real_type; |
8b27f225 PB |
7839 | tree wfl = TREE_PURPOSE (current); |
7840 | tree name = EXPR_WFL_NODE (wfl); | |
7841 | tree init = TREE_VALUE (current); | |
7842 | ||
7843 | /* Process NAME, as it may specify extra dimension(s) for it */ | |
7844 | type = build_array_from_name (type, type_wfl, name, &name); | |
7845 | ||
7846 | /* Variable redefinition check */ | |
7847 | if ((other = lookup_name_in_blocks (name))) | |
7848 | { | |
7849 | variable_redefinition_error (wfl, name, TREE_TYPE (other), | |
7850 | DECL_SOURCE_LINE (other)); | |
7851 | continue; | |
7852 | } | |
7853 | ||
7854 | /* Type adjustment. We may have just readjusted TYPE because | |
7855 | the variable specified more dimensions. Make sure we have | |
7856 | a reference if we can and don't have one already. */ | |
1886c9d8 | 7857 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); |
c877974e APB |
7858 | |
7859 | real_type = GET_REAL_TYPE (type); | |
8b27f225 PB |
7860 | /* Never layout this decl. This will be done when its scope |
7861 | will be entered */ | |
c877974e | 7862 | decl = build_decl (VAR_DECL, name, real_type); |
8b27f225 PB |
7863 | BLOCK_CHAIN_DECL (decl); |
7864 | ||
7865 | /* Don't try to use an INIT statement when an error was found */ | |
7866 | if (init && java_error_count) | |
7867 | init = NULL_TREE; | |
7868 | ||
7869 | /* Add the initialization function to the current function's code */ | |
7870 | if (init) | |
7871 | { | |
7872 | /* Name might have been readjusted */ | |
7873 | EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name; | |
7874 | MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1; | |
7875 | java_method_add_stmt (current_function_decl, | |
7876 | build_debugable_stmt (EXPR_WFL_LINECOL (init), | |
7877 | init)); | |
7878 | } | |
7879 | ||
7880 | /* Setup dependency the type of the decl */ | |
7881 | if (must_chain) | |
7882 | { | |
7883 | jdep *dep; | |
7884 | register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type); | |
7885 | dep = CLASSD_LAST (ctxp->classd_list); | |
7886 | JDEP_GET_PATCH (dep) = &TREE_TYPE (decl); | |
7887 | } | |
7888 | } | |
7889 | SOURCE_FRONTEND_DEBUG (("Defined locals")); | |
7890 | } | |
7891 | ||
7892 | /* Called during parsing. Build decls from argument list. */ | |
7893 | ||
7894 | static void | |
7895 | source_start_java_method (fndecl) | |
7896 | tree fndecl; | |
7897 | { | |
7898 | tree tem; | |
7899 | tree parm_decl; | |
7900 | int i; | |
7901 | ||
7902 | current_function_decl = fndecl; | |
7903 | ||
7904 | /* New scope for the function */ | |
7905 | enter_block (); | |
7906 | for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0; | |
82371d41 | 7907 | tem != end_params_node; tem = TREE_CHAIN (tem), i++) |
8b27f225 PB |
7908 | { |
7909 | tree type = TREE_VALUE (tem); | |
7910 | tree name = TREE_PURPOSE (tem); | |
7911 | ||
23a79c61 APB |
7912 | /* If type is incomplete. Create an incomplete decl and ask for |
7913 | the decl to be patched later */ | |
8b27f225 PB |
7914 | if (INCOMPLETE_TYPE_P (type)) |
7915 | { | |
7916 | jdep *jdep; | |
c877974e APB |
7917 | tree real_type = GET_REAL_TYPE (type); |
7918 | parm_decl = build_decl (PARM_DECL, name, real_type); | |
23a79c61 | 7919 | type = obtain_incomplete_type (type); |
8b27f225 PB |
7920 | register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type); |
7921 | jdep = CLASSD_LAST (ctxp->classd_list); | |
7922 | JDEP_MISC (jdep) = name; | |
7923 | JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl); | |
7924 | } | |
7925 | else | |
7926 | parm_decl = build_decl (PARM_DECL, name, type); | |
7927 | ||
7928 | BLOCK_CHAIN_DECL (parm_decl); | |
7929 | } | |
7930 | tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)); | |
7931 | BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) = | |
7932 | nreverse (tem); | |
7933 | DECL_ARG_SLOT_COUNT (current_function_decl) = i; | |
7934 | } | |
7935 | ||
22eed1e6 APB |
7936 | /* Called during parsing. Creates an artificial method declaration. */ |
7937 | ||
7938 | static tree | |
7939 | create_artificial_method (class, flags, type, name, args) | |
7940 | tree class; | |
7941 | int flags; | |
7942 | tree type, name, args; | |
7943 | { | |
7944 | int saved_lineno = lineno; | |
7945 | tree mdecl; | |
7946 | ||
7947 | lineno = 0; | |
7948 | mdecl = make_node (FUNCTION_TYPE); | |
7949 | TREE_TYPE (mdecl) = type; | |
7950 | TYPE_ARG_TYPES (mdecl) = args; | |
7951 | mdecl = add_method (class, flags, name, build_java_signature (mdecl)); | |
7952 | lineno = saved_lineno; | |
7953 | DECL_ARTIFICIAL (mdecl) = 1; | |
7954 | return mdecl; | |
7955 | } | |
7956 | ||
7957 | /* Starts the body if an artifical method. */ | |
7958 | ||
7959 | static void | |
7960 | start_artificial_method_body (mdecl) | |
7961 | tree mdecl; | |
7962 | { | |
7963 | DECL_SOURCE_LINE (mdecl) = 1; | |
7964 | DECL_SOURCE_LINE_MERGE (mdecl, 1); | |
7965 | source_start_java_method (mdecl); | |
7966 | enter_block (); | |
7967 | } | |
7968 | ||
7969 | static void | |
7970 | end_artificial_method_body (mdecl) | |
7971 | tree mdecl; | |
7972 | { | |
7973 | BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block (); | |
7974 | exit_block (); | |
7975 | } | |
7976 | ||
8b27f225 PB |
7977 | /* Called during expansion. Push decls formerly built from argument |
7978 | list so they're usable during expansion. */ | |
7979 | ||
7980 | static void | |
7981 | expand_start_java_method (fndecl) | |
7982 | tree fndecl; | |
7983 | { | |
7984 | tree tem, *ptr; | |
7985 | ||
7986 | current_function_decl = fndecl; | |
7987 | ||
7988 | announce_function (fndecl); | |
7989 | pushlevel (1); /* Push parameters */ | |
7990 | ptr = &DECL_ARGUMENTS (fndecl); | |
7991 | tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)); | |
7992 | while (tem) | |
7993 | { | |
7994 | tree next = TREE_CHAIN (tem); | |
7995 | tree type = TREE_TYPE (tem); | |
7996 | #ifdef PROMOTE_PROTOTYPES | |
7997 | if (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node) | |
7998 | && INTEGRAL_TYPE_P (type)) | |
7999 | type = integer_type_node; | |
8000 | #endif | |
8001 | DECL_ARG_TYPE (tem) = type; | |
8002 | layout_decl (tem, 0); | |
8003 | pushdecl (tem); | |
8004 | INITIALIZED_P (tem) = 1; /* Parms are initialized */ | |
8005 | *ptr = tem; | |
8006 | ptr = &TREE_CHAIN (tem); | |
8007 | tem = next; | |
8008 | } | |
8009 | *ptr = NULL_TREE; | |
8010 | pushdecl_force_head (DECL_ARGUMENTS (fndecl)); | |
8011 | lineno = DECL_SOURCE_LINE_FIRST (fndecl); | |
8012 | complete_start_java_method (fndecl); | |
8013 | } | |
8014 | ||
8015 | /* Terminate a function and expand its body. */ | |
8016 | ||
8017 | static void | |
8018 | source_end_java_method () | |
8019 | { | |
8020 | tree fndecl = current_function_decl; | |
8021 | ||
8022 | java_parser_context_save_global (); | |
8023 | lineno = ctxp->last_ccb_indent1; | |
8024 | ||
8025 | /* Set EH language codes */ | |
8026 | java_set_exception_lang_code (); | |
8027 | ||
8028 | /* Generate function's code */ | |
8029 | if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) | |
8030 | && ! flag_emit_class_files) | |
8031 | expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))); | |
8032 | ||
8033 | /* pop out of its parameters */ | |
8034 | pushdecl_force_head (DECL_ARGUMENTS (fndecl)); | |
8035 | poplevel (1, 0, 1); | |
8036 | BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl; | |
8037 | ||
8038 | /* Generate rtl for function exit. */ | |
8039 | if (! flag_emit_class_files) | |
8040 | { | |
8041 | lineno = DECL_SOURCE_LINE_LAST (fndecl); | |
8042 | /* Emit catch-finally clauses */ | |
8043 | emit_handlers (); | |
8044 | expand_function_end (input_filename, lineno, 0); | |
8045 | ||
8046 | /* Run the optimizers and output assembler code for this function. */ | |
8047 | rest_of_compilation (fndecl); | |
8048 | } | |
8049 | ||
8050 | current_function_decl = NULL_TREE; | |
8051 | /* permanent_allocation (1); */ | |
8052 | java_parser_context_restore_global (); | |
8053 | } | |
8054 | ||
8055 | /* Record EXPR in the current function block. Complements compound | |
8056 | expression second operand if necessary. */ | |
8057 | ||
8058 | tree | |
8059 | java_method_add_stmt (fndecl, expr) | |
8060 | tree fndecl, expr; | |
8061 | { | |
8062 | return add_stmt_to_block (DECL_FUNCTION_BODY (fndecl), NULL_TREE, expr); | |
8063 | } | |
8064 | ||
8065 | static tree | |
8066 | add_stmt_to_block (b, type, stmt) | |
8067 | tree b, type, stmt; | |
8068 | { | |
8069 | tree body = BLOCK_EXPR_BODY (b), c; | |
8070 | ||
8071 | if (java_error_count) | |
8072 | return body; | |
8073 | ||
8074 | if ((c = add_stmt_to_compound (body, type, stmt)) == body) | |
8075 | return body; | |
8076 | ||
8077 | BLOCK_EXPR_BODY (b) = c; | |
8078 | TREE_SIDE_EFFECTS (c) = 1; | |
8079 | return c; | |
8080 | } | |
8081 | ||
8082 | /* Add STMT to EXISTING if possible, otherwise create a new | |
8083 | COMPOUND_EXPR and add STMT to it. */ | |
8084 | ||
8085 | static tree | |
8086 | add_stmt_to_compound (existing, type, stmt) | |
8087 | tree existing, type, stmt; | |
8088 | { | |
12472854 PB |
8089 | if (existing) |
8090 | return build (COMPOUND_EXPR, type, existing, stmt); | |
8b27f225 | 8091 | else |
12472854 | 8092 | return stmt; |
8b27f225 PB |
8093 | } |
8094 | ||
8095 | /* Hold THIS for the scope of the current public method decl. */ | |
8096 | static tree current_this; | |
8097 | ||
1886c9d8 APB |
8098 | void java_layout_seen_class_methods () |
8099 | { | |
8100 | tree previous_list = all_class_list; | |
8101 | tree end = NULL_TREE; | |
8102 | tree current; | |
8103 | ||
8104 | while (1) | |
8105 | { | |
8106 | for (current = previous_list; | |
8107 | current != end; current = TREE_CHAIN (current)) | |
8108 | layout_class_methods (TREE_TYPE (TREE_VALUE (current))); | |
8109 | ||
8110 | if (previous_list != all_class_list) | |
8111 | { | |
8112 | end = previous_list; | |
8113 | previous_list = all_class_list; | |
8114 | } | |
8115 | else | |
8116 | break; | |
8117 | } | |
8118 | } | |
8119 | ||
23a79c61 APB |
8120 | /* Layout the methods of all classes loaded in one way on an |
8121 | other. Check methods of source parsed classes. Then reorder the | |
8122 | fields and layout the classes or the type of all source parsed | |
8123 | classes */ | |
8b27f225 PB |
8124 | |
8125 | void | |
8126 | java_layout_classes () | |
8127 | { | |
8128 | tree current; | |
5e942c50 | 8129 | |
23a79c61 | 8130 | /* Layout the methods of all classes seen so far */ |
1886c9d8 | 8131 | java_layout_seen_class_methods (); |
23a79c61 APB |
8132 | java_parse_abort_on_error (); |
8133 | all_class_list = NULL_TREE; | |
8134 | ||
8135 | /* Then check the methods of all parsed classes */ | |
8136 | for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current)) | |
8137 | if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current)))) | |
8138 | CHECK_METHODS (TREE_VALUE (current)); | |
8139 | java_parse_abort_on_error (); | |
8140 | ||
5e942c50 | 8141 | for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current)) |
8b27f225 | 8142 | { |
5e942c50 | 8143 | current_class = TREE_TYPE (TREE_VALUE (current)); |
22eed1e6 | 8144 | |
c877974e APB |
8145 | /* Reverse the fields, but leave the dummy field in front. |
8146 | Fields are already ordered for Object and Class */ | |
8147 | if (TYPE_FIELDS (current_class) && current_class != object_type_node | |
8148 | && current_class != class_type_node) | |
8149 | { | |
23a79c61 APB |
8150 | /* If the dummy field is there, reverse the right fields and |
8151 | just layout the type for proper fields offset */ | |
c877974e APB |
8152 | if (!DECL_NAME (TYPE_FIELDS (current_class))) |
8153 | { | |
8154 | tree fields = TYPE_FIELDS (current_class); | |
8155 | TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields)); | |
8156 | TYPE_SIZE (current_class) = NULL_TREE; | |
8157 | layout_type (current_class); | |
8158 | } | |
23a79c61 APB |
8159 | /* We don't have a dummy field, we need to layout the class, |
8160 | after having reversed the fields */ | |
c877974e APB |
8161 | else |
8162 | { | |
8163 | TYPE_FIELDS (current_class) = | |
8164 | nreverse (TYPE_FIELDS (current_class)); | |
8165 | TYPE_SIZE (current_class) = NULL_TREE; | |
8166 | layout_class (current_class); | |
8167 | } | |
8168 | } | |
23a79c61 APB |
8169 | else |
8170 | layout_class (current_class); | |
5e942c50 | 8171 | |
c877974e APB |
8172 | /* From now on, the class is considered completely loaded */ |
8173 | CLASS_LOADED_P (current_class) = 1; | |
8174 | ||
5e942c50 APB |
8175 | /* Error reported by the caller */ |
8176 | if (java_error_count) | |
8177 | return; | |
8b27f225 | 8178 | } |
23a79c61 APB |
8179 | |
8180 | /* We might have reloaded classes durign the process of laying out | |
8181 | classes for code generation. We must layout the methods of those | |
8182 | late additions, as constructor checks might use them */ | |
1886c9d8 | 8183 | java_layout_seen_class_methods (); |
23a79c61 | 8184 | java_parse_abort_on_error (); |
8b27f225 PB |
8185 | } |
8186 | ||
8187 | /* Expand all methods in all registered classes. */ | |
8188 | ||
8189 | void | |
8190 | java_complete_expand_methods () | |
8191 | { | |
8192 | tree current; | |
8193 | ||
8194 | for (current = ctxp->class_list; current; current = TREE_CHAIN (current)) | |
8195 | { | |
8196 | tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current)); | |
8197 | tree decl; | |
8198 | ||
8199 | current_class = TREE_TYPE (current); | |
8200 | ||
8201 | /* Initialize a new constant pool */ | |
8202 | init_outgoing_cpool (); | |
8203 | ||
63a212ed PB |
8204 | /* We want <clinit> (if any) to be processed first. */ |
8205 | decl = tree_last (TYPE_METHODS (class_type)); | |
8206 | if (decl && DECL_NAME (decl) == clinit_identifier_node) | |
8207 | { | |
8208 | tree list = nreverse (TYPE_METHODS (class_type)); | |
8209 | list = TREE_CHAIN (list); | |
8210 | TREE_CHAIN (decl) = NULL_TREE; | |
8211 | TYPE_METHODS (class_type) = chainon (decl, nreverse (list)); | |
8212 | } | |
8213 | ||
8b27f225 PB |
8214 | /* Don't process function bodies in interfaces */ |
8215 | if (!CLASS_INTERFACE (TYPE_NAME (current_class))) | |
8216 | for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl)) | |
8217 | { | |
8218 | current_function_decl = decl; | |
8219 | /* Don't generate debug info on line zero when expanding a | |
8220 | generated constructor. */ | |
8221 | if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl)) | |
8222 | { | |
8223 | /* If we found errors, it's too dangerous to try to generate | |
8224 | and expand a constructor */ | |
8225 | if (!java_error_count) | |
8226 | { | |
8227 | restore_line_number_status (1); | |
8228 | java_complete_expand_method (decl); | |
8229 | restore_line_number_status (0); | |
8230 | } | |
8231 | } | |
5e942c50 APB |
8232 | else if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl)) |
8233 | continue; | |
8234 | else | |
8b27f225 PB |
8235 | java_complete_expand_method (decl); |
8236 | } | |
8237 | ||
22eed1e6 APB |
8238 | /* Now verify constructor circularity (stop after the first one |
8239 | we find) */ | |
8240 | if (!CLASS_INTERFACE (TYPE_NAME (current_class))) | |
8241 | for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl)) | |
8242 | if (DECL_CONSTRUCTOR_P (decl) && | |
8243 | verify_constructor_circularity (decl, decl)) | |
8244 | break; | |
8245 | ||
8b27f225 PB |
8246 | /* Make the class data, register it and run the rest of decl |
8247 | compilation on it */ | |
63a212ed PB |
8248 | if (!java_error_count) |
8249 | { | |
8250 | if (flag_emit_class_files) | |
8251 | write_classfile (current_class); | |
8252 | else | |
8253 | finish_class (current_class); | |
8254 | } | |
8b27f225 PB |
8255 | } |
8256 | } | |
8257 | ||
8258 | /* Hold a list of catch clauses list. The first element of this list is | |
8259 | the list of the catch clauses of the currently analysed try block. */ | |
8260 | static tree currently_caught_type_list; | |
8261 | ||
8262 | /* Complete and expand a method. */ | |
8263 | ||
8264 | static void | |
8265 | java_complete_expand_method (mdecl) | |
8266 | tree mdecl; | |
8267 | { | |
22eed1e6 APB |
8268 | /* Fix constructors before expanding them */ |
8269 | if (DECL_CONSTRUCTOR_P (mdecl)) | |
8270 | fix_constructors (mdecl); | |
8b27f225 | 8271 | |
22eed1e6 | 8272 | /* Expand functions that have a body */ |
8b27f225 PB |
8273 | if (DECL_FUNCTION_BODY (mdecl)) |
8274 | { | |
c877974e APB |
8275 | tree fbody = DECL_FUNCTION_BODY (mdecl); |
8276 | tree block_body = BLOCK_EXPR_BODY (fbody); | |
8b27f225 PB |
8277 | expand_start_java_method (mdecl); |
8278 | ||
8279 | current_this | |
8280 | = (!METHOD_STATIC (mdecl) ? | |
8281 | BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE); | |
8282 | ||
8283 | /* Purge the `throws' list of unchecked exceptions */ | |
8284 | purge_unchecked_exceptions (mdecl); | |
8285 | ||
8286 | /* Install exceptions thrown with `throws' */ | |
8287 | PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl)); | |
8288 | ||
c877974e APB |
8289 | if (block_body != NULL_TREE) |
8290 | block_body = java_complete_tree (block_body); | |
8291 | BLOCK_EXPR_BODY (fbody) = block_body; | |
5e942c50 | 8292 | |
c877974e APB |
8293 | if ((block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body)) |
8294 | && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE) | |
82371d41 | 8295 | missing_return_error (current_function_decl); |
63a212ed | 8296 | |
8b27f225 PB |
8297 | /* Don't go any further if we've found error(s) during the |
8298 | expansion */ | |
8299 | if (!java_error_count) | |
8300 | source_end_java_method (); | |
22eed1e6 APB |
8301 | else |
8302 | { | |
8303 | pushdecl_force_head (DECL_ARGUMENTS (mdecl)); | |
8304 | poplevel (1, 0, 1); | |
8305 | } | |
8b27f225 PB |
8306 | |
8307 | /* Pop the exceptions and sanity check */ | |
8308 | POP_EXCEPTIONS(); | |
8309 | if (currently_caught_type_list) | |
8310 | fatal ("Exception list non empty - java_complete_expand_method"); | |
8311 | } | |
8312 | } | |
8313 | ||
22eed1e6 APB |
8314 | /* Craft a body for default constructor. Patch existing constructor |
8315 | bodies with call to super() and field initialization statements if | |
8316 | necessary. */ | |
8317 | ||
8318 | static void | |
8319 | fix_constructors (mdecl) | |
8320 | tree mdecl; | |
8321 | { | |
8322 | tree body = DECL_FUNCTION_BODY (mdecl); | |
22eed1e6 | 8323 | |
22eed1e6 APB |
8324 | if (!body) |
8325 | { | |
ac825856 APB |
8326 | /* The constructor body must be crafted by hand. It's the |
8327 | constructor we defined when we realize we didn't have the | |
8328 | CLASSNAME() constructor */ | |
8329 | ||
22eed1e6 APB |
8330 | tree compound; |
8331 | ||
8332 | /* It is an error for the compiler to generate a default | |
8333 | constructor if the superclass doesn't have a constructor that | |
8334 | takes no argument */ | |
8335 | if (verify_constructor_super ()) | |
8336 | { | |
8337 | tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class)); | |
8338 | char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl)); | |
8339 | parse_error_context (lookup_cl (TYPE_NAME (current_class)), | |
8340 | "No constructor matching `%s()' found in " | |
8341 | "class `%s'", n, n); | |
8342 | } | |
8343 | ||
8344 | start_artificial_method_body (mdecl); | |
8345 | ||
8346 | /* We don't generate a super constructor invocation if we're | |
8347 | compiling java.lang.Object. build_super_invocation takes care | |
8348 | of that. */ | |
8349 | compound = java_method_add_stmt (mdecl, build_super_invocation ()); | |
22eed1e6 APB |
8350 | |
8351 | end_artificial_method_body (mdecl); | |
8352 | } | |
8353 | /* Search for an explicit constructor invocation */ | |
8354 | else | |
8355 | { | |
8356 | int found = 0; | |
8357 | tree main_block = BLOCK_EXPR_BODY (body); | |
8358 | tree compound = NULL_TREE; | |
8359 | ||
8360 | while (body) | |
8361 | switch (TREE_CODE (body)) | |
8362 | { | |
8363 | case CALL_EXPR: | |
8364 | found = CALL_EXPLICIT_CONSTRUCTOR_P (body); | |
8365 | body = NULL_TREE; | |
8366 | break; | |
8367 | case COMPOUND_EXPR: | |
8368 | case EXPR_WITH_FILE_LOCATION: | |
8369 | body = TREE_OPERAND (body, 0); | |
8370 | break; | |
8371 | case BLOCK: | |
8372 | body = BLOCK_EXPR_BODY (body); | |
8373 | break; | |
8374 | default: | |
8375 | found = 0; | |
8376 | body = NULL_TREE; | |
8377 | } | |
8378 | /* The constructor is missing an invocation of super() */ | |
8379 | if (!found) | |
8380 | compound = add_stmt_to_compound (compound, NULL_TREE, | |
8381 | build_super_invocation ()); | |
8382 | ||
22eed1e6 APB |
8383 | /* Fix the constructor main block if we're adding extra stmts */ |
8384 | if (compound) | |
8385 | { | |
8386 | compound = add_stmt_to_compound (compound, NULL_TREE, | |
8387 | BLOCK_EXPR_BODY (main_block)); | |
8388 | BLOCK_EXPR_BODY (main_block) = compound; | |
8389 | } | |
8390 | } | |
8391 | } | |
8392 | ||
8393 | /* Browse constructors in the super class, searching for a constructor | |
8394 | that doesn't take any argument. Return 0 if one is found, 1 | |
8395 | otherwise. */ | |
8396 | ||
8397 | static int | |
8398 | verify_constructor_super () | |
8399 | { | |
8400 | tree class = CLASSTYPE_SUPER (current_class); | |
8401 | if (!class) | |
8402 | return 0; | |
8403 | ||
8404 | if (class) | |
8405 | { | |
8406 | tree mdecl; | |
8407 | for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl)) | |
8408 | { | |
8409 | if (DECL_CONSTRUCTOR_P (mdecl) | |
82371d41 | 8410 | && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node) |
22eed1e6 APB |
8411 | return 0; |
8412 | } | |
8413 | } | |
8414 | return 1; | |
8415 | } | |
8416 | ||
8b27f225 PB |
8417 | /* Expand finals. */ |
8418 | ||
8419 | void | |
8420 | java_expand_finals () | |
8421 | { | |
8422 | } | |
8423 | ||
22eed1e6 | 8424 | /* Generate code for all context remembered for code generation. */ |
b351b287 APB |
8425 | |
8426 | void | |
8427 | java_expand_classes () | |
8428 | { | |
23a79c61 APB |
8429 | java_parse_abort_on_error (); |
8430 | if (!(ctxp = ctxp_for_generation)) | |
5e942c50 APB |
8431 | return; |
8432 | java_layout_classes (); | |
8433 | java_parse_abort_on_error (); | |
8434 | ||
b351b287 APB |
8435 | for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next) |
8436 | { | |
8437 | ctxp = ctxp_for_generation; | |
8438 | lang_init_source (2); /* Error msgs have method prototypes */ | |
8439 | java_complete_expand_methods (); /* Complete and expand method bodies */ | |
8440 | java_parse_abort_on_error (); | |
8441 | java_expand_finals (); /* Expand and check the finals */ | |
8442 | java_parse_abort_on_error (); | |
8443 | java_check_final (); /* Check unitialized final */ | |
8444 | java_parse_abort_on_error (); | |
8445 | } | |
b351b287 APB |
8446 | } |
8447 | ||
8b27f225 PB |
8448 | /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to |
8449 | a tree list node containing RIGHT. Fore coming RIGHTs will be | |
8450 | chained to this hook. LOCATION contains the location of the | |
8451 | separating `.' operator. */ | |
8452 | ||
8453 | static tree | |
8454 | make_qualified_primary (primary, right, location) | |
8455 | tree primary, right; | |
8456 | int location; | |
8457 | { | |
8458 | tree wfl; | |
8459 | ||
8460 | /* We want to process THIS . xxx symbolicaly, to keep it consistent | |
8461 | with the way we're processing SUPER. A THIS from a primary as a | |
8462 | different form than a SUPER. Turn THIS into something symbolic */ | |
8463 | if (TREE_CODE (primary) == THIS_EXPR) | |
8464 | { | |
8465 | wfl = build_wfl_node (this_identifier_node, input_filename, 0, 0); | |
8466 | EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary); | |
8467 | wfl = make_qualified_name (wfl, right, location); | |
8468 | PRIMARY_P (wfl) = 1; | |
8469 | return wfl; | |
8470 | } | |
8471 | /* Other non WFL node are wrapped around a WFL */ | |
8472 | else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION) | |
8473 | { | |
8474 | wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0); | |
8475 | EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary); | |
8476 | EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE); | |
8477 | } | |
8478 | else | |
8479 | { | |
8480 | wfl = primary; | |
8481 | if (!EXPR_WFL_QUALIFICATION (primary)) | |
8482 | EXPR_WFL_QUALIFICATION (primary) = | |
8483 | build_tree_list (primary, NULL_TREE); | |
8484 | } | |
8485 | ||
8486 | EXPR_WFL_LINECOL (right) = location; | |
8487 | chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE)); | |
8488 | PRIMARY_P (wfl) = 1; | |
8489 | return wfl; | |
8490 | } | |
8491 | ||
8492 | /* Simple merge of two name separated by a `.' */ | |
8493 | ||
8494 | static tree | |
8495 | merge_qualified_name (left, right) | |
8496 | tree left, right; | |
8497 | { | |
8498 | tree node; | |
8499 | obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left), | |
8500 | IDENTIFIER_LENGTH (left)); | |
8501 | obstack_1grow (&temporary_obstack, '.'); | |
8502 | obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right), | |
8503 | IDENTIFIER_LENGTH (right)); | |
8504 | node = get_identifier (obstack_base (&temporary_obstack)); | |
8505 | obstack_free (&temporary_obstack, obstack_base (&temporary_obstack)); | |
8506 | QUALIFIED_P (node) = 1; | |
8507 | return node; | |
8508 | } | |
8509 | ||
8510 | /* Merge the two parts of a qualified name into LEFT. Set the | |
8511 | location information of the resulting node to LOCATION, usually | |
8512 | inherited from the location information of the `.' operator. */ | |
8513 | ||
8514 | static tree | |
8515 | make_qualified_name (left, right, location) | |
8516 | tree left, right; | |
8517 | int location; | |
8518 | { | |
8519 | tree left_id = EXPR_WFL_NODE (left); | |
8520 | tree right_id = EXPR_WFL_NODE (right); | |
8521 | tree wfl, merge; | |
8522 | ||
8523 | merge = merge_qualified_name (left_id, right_id); | |
8524 | ||
8525 | /* Left wasn't qualified and is now qualified */ | |
8526 | if (!QUALIFIED_P (left_id)) | |
8527 | { | |
8528 | tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0); | |
8529 | EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left); | |
8530 | EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE); | |
8531 | } | |
8532 | ||
8533 | wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0); | |
8534 | EXPR_WFL_LINECOL (wfl) = location; | |
8535 | chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE)); | |
8536 | ||
8537 | EXPR_WFL_NODE (left) = merge; | |
8538 | return left; | |
8539 | } | |
8540 | ||
8541 | /* Extract the last identifier component of the qualified in WFL. The | |
8542 | last identifier is removed from the linked list */ | |
8543 | ||
8544 | static tree | |
8545 | cut_identifier_in_qualified (wfl) | |
8546 | tree wfl; | |
8547 | { | |
8548 | tree q; | |
8549 | tree previous = NULL_TREE; | |
8550 | for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q)) | |
8551 | if (!TREE_CHAIN (q)) | |
8552 | { | |
8553 | if (!previous) | |
8554 | fatal ("Operating on a non qualified qualified WFL - " | |
8555 | "cut_identifier_in_qualified"); | |
8556 | TREE_CHAIN (previous) = NULL_TREE; | |
8557 | return TREE_PURPOSE (q); | |
8558 | } | |
8559 | } | |
8560 | ||
8561 | /* Resolve the expression name NAME. Return its decl. */ | |
8562 | ||
8563 | static tree | |
5e942c50 | 8564 | resolve_expression_name (id, orig) |
8b27f225 | 8565 | tree id; |
5e942c50 | 8566 | tree *orig; |
8b27f225 PB |
8567 | { |
8568 | tree name = EXPR_WFL_NODE (id); | |
8569 | tree decl; | |
8570 | ||
8571 | /* 6.5.5.1: Simple expression names */ | |
8572 | if (!PRIMARY_P (id) && !QUALIFIED_P (name)) | |
8573 | { | |
8574 | /* 15.13.1: NAME can appear within the scope of a local variable | |
8575 | declaration */ | |
8576 | if ((decl = IDENTIFIER_LOCAL_VALUE (name))) | |
8577 | return decl; | |
8578 | ||
8579 | /* 15.13.1: NAME can appear within a class declaration */ | |
8580 | else | |
8581 | { | |
8582 | decl = lookup_field_wrapper (current_class, name); | |
8583 | if (decl) | |
8584 | { | |
8585 | int fs = FIELD_STATIC (decl); | |
8586 | /* Instance variable (8.3.1.1) can't appear within | |
8587 | static method, static initializer or initializer for | |
8588 | a static variable. */ | |
8589 | if (!fs && METHOD_STATIC (current_function_decl)) | |
8590 | { | |
8591 | parse_error_context | |
8592 | (id, "Can't make a static reference to nonstatic variable " | |
8593 | "`%s' in class `%s'", | |
8594 | IDENTIFIER_POINTER (name), | |
8595 | IDENTIFIER_POINTER (DECL_NAME | |
8596 | (TYPE_NAME (current_class)))); | |
8597 | return error_mark_node; | |
8598 | } | |
22eed1e6 APB |
8599 | /* Instance variables can't appear as an argument of |
8600 | an explicit constructor invocation */ | |
8601 | if (!fs && ctxp->explicit_constructor_p) | |
8602 | { | |
8603 | parse_error_context | |
8604 | (id, "Can't reference `%s' before the superclass " | |
8605 | "constructor has been called", IDENTIFIER_POINTER (name)); | |
8606 | return error_mark_node; | |
8607 | } | |
5e942c50 APB |
8608 | |
8609 | /* Otherwise build what it takes to access the field */ | |
8b27f225 PB |
8610 | decl = build_field_ref ((fs ? NULL_TREE : current_this), |
8611 | current_class, name); | |
5e942c50 APB |
8612 | if (fs && !flag_emit_class_files) |
8613 | decl = build_class_init (current_class, decl); | |
8614 | /* We may be asked to save the real field access node */ | |
8615 | if (orig) | |
8616 | *orig = decl; | |
8617 | /* And we return what we got */ | |
5b09b33e | 8618 | return decl; |
8b27f225 PB |
8619 | } |
8620 | /* Fall down to error report on undefined variable */ | |
8621 | } | |
8622 | } | |
8623 | /* 6.5.5.2 Qualified Expression Names */ | |
8624 | else | |
8625 | { | |
5e942c50 APB |
8626 | if (orig) |
8627 | *orig = NULL_TREE; | |
8b27f225 PB |
8628 | qualify_ambiguous_name (id); |
8629 | /* 15.10.1 Field Access Using a Primary and/or Expression Name */ | |
8630 | /* 15.10.2: Accessing Superclass Members using super */ | |
8631 | return resolve_field_access (id, NULL, NULL); | |
8632 | } | |
8633 | ||
8634 | /* We've got an error here */ | |
8635 | parse_error_context (id, "Undefined variable `%s'", | |
8636 | IDENTIFIER_POINTER (name)); | |
8637 | ||
8638 | return error_mark_node; | |
8639 | } | |
8640 | ||
8641 | /* 15.10.1 Field Acess Using a Primary and/or Expression Name. | |
8642 | We return something suitable to generate the field access. We also | |
8643 | return the field decl in FIELD_DECL and its type in FIELD_TYPE. If | |
8644 | recipient's address can be null. */ | |
8645 | ||
8646 | static tree | |
8647 | resolve_field_access (qual_wfl, field_decl, field_type) | |
8648 | tree qual_wfl; | |
8649 | tree *field_decl, *field_type; | |
8650 | { | |
8651 | int is_static = 0; | |
8652 | tree field_ref; | |
8653 | tree decl, where_found, type_found; | |
8654 | ||
8655 | if (resolve_qualified_expression_name (qual_wfl, &decl, | |
8656 | &where_found, &type_found)) | |
8657 | return error_mark_node; | |
8658 | ||
8659 | /* Resolve the LENGTH field of an array here */ | |
8660 | if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found) | |
8661 | && ! flag_emit_class_files) | |
8662 | { | |
8663 | tree length = build_java_array_length_access (where_found); | |
8664 | field_ref = | |
8665 | build_java_arraynull_check (type_found, length, int_type_node); | |
8666 | } | |
8667 | /* We might have been trying to resolve field.method(). In which | |
8668 | case, the resolution is over and decl is the answer */ | |
8669 | else if (DECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl) | |
8670 | field_ref = decl; | |
8671 | else if (DECL_P (decl)) | |
8672 | { | |
5e942c50 APB |
8673 | int static_final_found = 0; |
8674 | if (!type_found) | |
8675 | type_found = DECL_CONTEXT (decl); | |
8b27f225 | 8676 | is_static = DECL_P (decl) && FIELD_STATIC (decl); |
5e942c50 APB |
8677 | if (FIELD_FINAL (decl) |
8678 | && JPRIMITIVE_TYPE_P (TREE_TYPE (decl)) | |
8679 | && DECL_LANG_SPECIFIC (decl) | |
63a212ed | 8680 | && DECL_INITIAL (decl)) |
5e942c50 | 8681 | { |
63a212ed | 8682 | field_ref = DECL_INITIAL (decl); |
5e942c50 APB |
8683 | static_final_found = 1; |
8684 | } | |
8685 | else | |
8686 | field_ref = build_field_ref ((is_static ? NULL_TREE : where_found), | |
8687 | type_found, DECL_NAME (decl)); | |
8b27f225 PB |
8688 | if (field_ref == error_mark_node) |
8689 | return error_mark_node; | |
c877974e | 8690 | if (is_static && !static_final_found && !flag_emit_class_files) |
8b27f225 PB |
8691 | { |
8692 | field_ref = build_class_init (type_found, field_ref); | |
8693 | /* If the static field was identified by an expression that | |
8694 | needs to be generated, make the field access a compound | |
8695 | expression whose first part of the evaluation of the | |
8696 | field selector part. */ | |
c877974e APB |
8697 | if (where_found && TREE_CODE (where_found) != TYPE_DECL |
8698 | && TREE_CODE (where_found) != RECORD_TYPE) | |
8b27f225 PB |
8699 | { |
8700 | tree type = QUAL_DECL_TYPE (field_ref); | |
8701 | field_ref = build (COMPOUND_EXPR, type, where_found, field_ref); | |
8702 | } | |
8703 | } | |
8704 | } | |
8705 | else | |
8706 | field_ref = decl; | |
8707 | ||
8708 | if (field_decl) | |
8709 | *field_decl = decl; | |
8710 | if (field_type) | |
c877974e APB |
8711 | *field_type = (QUAL_DECL_TYPE (decl) ? |
8712 | QUAL_DECL_TYPE (decl) : TREE_TYPE (decl)); | |
8b27f225 PB |
8713 | return field_ref; |
8714 | } | |
8715 | ||
8716 | /* 6.5.5.2: Qualified Expression Names */ | |
8717 | ||
8718 | static int | |
8719 | resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) | |
8720 | tree wfl; | |
8721 | tree *found_decl, *type_found, *where_found; | |
8722 | { | |
8723 | int from_type = 0; /* Field search initiated from a type */ | |
8724 | int from_super = 0, from_cast = 0; | |
8725 | int previous_call_static = 0; | |
8726 | int is_static; | |
8727 | tree decl = NULL_TREE, type = NULL_TREE, q; | |
c877974e | 8728 | *type_found = *where_found = NULL_TREE; |
8b27f225 PB |
8729 | |
8730 | for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q)) | |
8731 | { | |
8732 | tree qual_wfl = QUAL_WFL (q); | |
8733 | ||
8734 | /* 15.10.1 Field Access Using a Primary */ | |
8b27f225 PB |
8735 | switch (TREE_CODE (qual_wfl)) |
8736 | { | |
8737 | case CALL_EXPR: | |
8738 | case NEW_CLASS_EXPR: | |
8739 | /* If the access to the function call is a non static field, | |
8740 | build the code to access it. */ | |
8741 | if (DECL_P (decl) && !FIELD_STATIC (decl)) | |
8742 | { | |
ac825856 APB |
8743 | decl = maybe_access_field (decl, *where_found, |
8744 | DECL_CONTEXT (decl)); | |
8b27f225 PB |
8745 | if (decl == error_mark_node) |
8746 | return 1; | |
8747 | } | |
8748 | /* And code for the function call */ | |
8749 | if (complete_function_arguments (qual_wfl)) | |
8750 | return 1; | |
ac825856 APB |
8751 | if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR) |
8752 | CALL_USING_SUPER (qual_wfl) = 1; | |
8b27f225 | 8753 | *where_found = |
ac825856 | 8754 | patch_method_invocation (qual_wfl, decl, type, &is_static, NULL); |
8b27f225 PB |
8755 | if (*where_found == error_mark_node) |
8756 | return 1; | |
8757 | *type_found = type = QUAL_DECL_TYPE (*where_found); | |
8758 | ||
8759 | /* If the previous call was static and this one is too, | |
8760 | build a compound expression to hold the two (because in | |
8761 | that case, previous function calls aren't transported as | |
8762 | forcoming function's argument. */ | |
8763 | if (previous_call_static && is_static) | |
8764 | { | |
8765 | decl = build (COMPOUND_EXPR, type, decl, *where_found); | |
8766 | TREE_SIDE_EFFECTS (decl) = 1; | |
8767 | } | |
8768 | else | |
8769 | { | |
8770 | previous_call_static = is_static; | |
8771 | decl = *where_found; | |
8772 | } | |
8773 | continue; | |
8774 | ||
8775 | case CONVERT_EXPR: | |
8776 | *where_found = decl = java_complete_tree (qual_wfl); | |
8777 | if (decl == error_mark_node) | |
8778 | return 1; | |
8779 | *type_found = type = QUAL_DECL_TYPE (decl); | |
8780 | from_cast = 1; | |
8781 | continue; | |
8782 | ||
22eed1e6 | 8783 | case CONDITIONAL_EXPR: |
5e942c50 | 8784 | case STRING_CST: |
22eed1e6 APB |
8785 | *where_found = decl = java_complete_tree (qual_wfl); |
8786 | if (decl == error_mark_node) | |
8787 | return 1; | |
8788 | *type_found = type = QUAL_DECL_TYPE (decl); | |
8789 | continue; | |
8790 | ||
8b27f225 PB |
8791 | case ARRAY_REF: |
8792 | /* If the access to the function call is a non static field, | |
8793 | build the code to access it. */ | |
8794 | if (DECL_P (decl) && !FIELD_STATIC (decl)) | |
8795 | { | |
8796 | decl = maybe_access_field (decl, *where_found, type); | |
8797 | if (decl == error_mark_node) | |
8798 | return 1; | |
8799 | } | |
8800 | /* And code for the array reference expression */ | |
8801 | decl = java_complete_tree (qual_wfl); | |
8802 | if (decl == error_mark_node) | |
8803 | return 1; | |
8804 | type = QUAL_DECL_TYPE (decl); | |
8805 | continue; | |
8806 | ||
8807 | default: | |
8808 | /* Fix for -Wall Just go to the next statement. Don't | |
8809 | continue */ | |
8810 | } | |
8811 | ||
8812 | /* If we fall here, we weren't processing a (static) function call. */ | |
8813 | previous_call_static = 0; | |
8814 | ||
8815 | /* It can be the keyword THIS */ | |
8816 | if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node) | |
8817 | { | |
8818 | if (!current_this) | |
8819 | { | |
8820 | parse_error_context | |
8821 | (wfl, "Keyword `this' used outside allowed context"); | |
8822 | return 1; | |
8823 | } | |
8824 | /* We have to generate code for intermediate acess */ | |
8825 | *where_found = decl = current_this; | |
5e942c50 | 8826 | *type_found = type = QUAL_DECL_TYPE (decl); |
8b27f225 PB |
8827 | continue; |
8828 | } | |
8829 | ||
8830 | /* 15.10.2 Accessing Superclass Members using SUPER */ | |
8831 | if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node) | |
8832 | { | |
8833 | tree node; | |
8834 | /* Check on the restricted use of SUPER */ | |
8835 | if (METHOD_STATIC (current_function_decl) | |
8836 | || current_class == object_type_node) | |
8837 | { | |
8838 | parse_error_context | |
8839 | (wfl, "Keyword `super' used outside allowed context"); | |
8840 | return 1; | |
8841 | } | |
8842 | /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */ | |
8843 | node = build_cast (EXPR_WFL_LINECOL (qual_wfl), | |
8844 | CLASSTYPE_SUPER (current_class), | |
8845 | build_this (EXPR_WFL_LINECOL (qual_wfl))); | |
8846 | *where_found = decl = java_complete_tree (node); | |
22eed1e6 APB |
8847 | if (decl == error_mark_node) |
8848 | return 1; | |
8b27f225 PB |
8849 | *type_found = type = QUAL_DECL_TYPE (decl); |
8850 | from_super = from_type = 1; | |
8851 | continue; | |
8852 | } | |
8853 | ||
8854 | /* 15.13.1: Can't search for field name in packages, so we | |
8855 | assume a variable/class name was meant. */ | |
8856 | if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) | |
8857 | { | |
5e942c50 APB |
8858 | tree name = resolve_package (wfl, &q); |
8859 | if (name) | |
8860 | { | |
8861 | *where_found = decl = resolve_no_layout (name, qual_wfl); | |
8862 | /* We wan't to be absolutely that the class is laid | |
8863 | out. We're going to search something inside it. */ | |
8864 | *type_found = type = TREE_TYPE (decl); | |
8865 | layout_class (type); | |
8866 | from_type = 1; | |
8867 | /* Should be a list, really. FIXME */ | |
8868 | RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 1; | |
8869 | RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 0; | |
8870 | } | |
8b27f225 | 8871 | else |
5e942c50 APB |
8872 | { |
8873 | if (from_super || from_cast) | |
8874 | parse_error_context | |
8875 | ((from_cast ? qual_wfl : wfl), | |
8876 | "No variable `%s' defined in class `%s'", | |
8877 | IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), | |
8878 | lang_printable_name (type, 0)); | |
8879 | else | |
8880 | parse_error_context | |
8881 | (qual_wfl, "Undefined variable or class name: `%s'", | |
8882 | IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl))); | |
8883 | return 1; | |
8884 | } | |
8b27f225 PB |
8885 | } |
8886 | ||
8887 | /* We have a type name. It's been already resolved when the | |
8888 | expression was qualified. */ | |
8889 | else if (RESOLVE_TYPE_NAME_P (qual_wfl)) | |
8890 | { | |
8891 | if (!(decl = QUAL_RESOLUTION (q))) | |
8892 | return 1; /* Error reported already */ | |
8893 | ||
8894 | if (not_accessible_p (TREE_TYPE (decl), decl, 0)) | |
8895 | { | |
8896 | parse_error_context | |
8897 | (qual_wfl, "Can't access %s field `%s.%s' from `%s'", | |
8898 | java_accstring_lookup (get_access_flags_from_decl (decl)), | |
8899 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))), | |
8900 | IDENTIFIER_POINTER (DECL_NAME (decl)), | |
8901 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)))); | |
8902 | return 1; | |
8903 | } | |
5e942c50 | 8904 | check_deprecation (qual_wfl, decl); |
8b27f225 PB |
8905 | |
8906 | type = TREE_TYPE (decl); | |
8907 | from_type = 1; | |
8908 | } | |
8909 | /* We resolve and expression name */ | |
8910 | else | |
8911 | { | |
8912 | tree field_decl; | |
8913 | ||
8914 | /* If there exists an early resolution, use it. That occurs | |
8915 | only once and we know that there are more things to | |
8916 | come. Don't do that when processing something after SUPER | |
8917 | (we need more thing to be put in place below */ | |
8918 | if (!from_super && QUAL_RESOLUTION (q)) | |
8919 | { | |
8920 | decl = QUAL_RESOLUTION (q); | |
c877974e | 8921 | if (!type) |
5e942c50 | 8922 | { |
c877974e APB |
8923 | if (!FIELD_STATIC (decl)) |
8924 | *where_found = current_this; | |
8925 | else | |
8926 | { | |
8927 | *where_found = TREE_TYPE (decl); | |
8928 | if (TREE_CODE (*where_found) == POINTER_TYPE) | |
8929 | *where_found = TREE_TYPE (*where_found); | |
8930 | } | |
5e942c50 | 8931 | } |
8b27f225 PB |
8932 | } |
8933 | ||
8934 | /* We have to search for a field, knowing the type of its | |
8935 | container. The flag FROM_TYPE indicates that we resolved | |
8936 | the last member of the expression as a type name, which | |
5e942c50 APB |
8937 | means that for the resolution of this field, we'll look |
8938 | for other errors than if it was resolved as a member of | |
8939 | an other field. */ | |
8b27f225 PB |
8940 | else |
8941 | { | |
8942 | int is_static; | |
5e942c50 APB |
8943 | tree field_decl_type; /* For layout */ |
8944 | ||
8b27f225 PB |
8945 | if (!from_type && !JREFERENCE_TYPE_P (type)) |
8946 | { | |
8947 | parse_error_context | |
8948 | (qual_wfl, "Attempt to reference field `%s' in `%s %s'", | |
8949 | IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), | |
8950 | lang_printable_name (type, 0), | |
8951 | IDENTIFIER_POINTER (DECL_NAME (field_decl))); | |
8952 | return 1; | |
8953 | } | |
8954 | ||
8955 | if (!(field_decl = | |
8956 | lookup_field_wrapper (type, EXPR_WFL_NODE (qual_wfl)))) | |
8957 | { | |
8958 | parse_error_context | |
8959 | (qual_wfl, "No variable `%s' defined in class `%s'", | |
8960 | IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), | |
8961 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))); | |
8962 | return 1; | |
8963 | } | |
5e942c50 APB |
8964 | |
8965 | /* Layout the type of field_decl, since we may need | |
c877974e APB |
8966 | it. Don't do primitive types or loaded classes. The |
8967 | situation of non primitive arrays may not handled | |
8968 | properly here. FIXME */ | |
5e942c50 APB |
8969 | if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE) |
8970 | field_decl_type = TREE_TYPE (TREE_TYPE (field_decl)); | |
8971 | else | |
8972 | field_decl_type = TREE_TYPE (field_decl); | |
8973 | if (!JPRIMITIVE_TYPE_P (field_decl_type) | |
c877974e APB |
8974 | && !CLASS_LOADED_P (field_decl_type) |
8975 | && !TYPE_ARRAY_P (field_decl_type)) | |
8976 | resolve_and_layout (field_decl_type, NULL_TREE); | |
8977 | if (TYPE_ARRAY_P (field_decl_type)) | |
8978 | CLASS_LOADED_P (field_decl_type) = 1; | |
8b27f225 PB |
8979 | |
8980 | /* Check on accessibility here */ | |
8981 | if (not_accessible_p (type, field_decl, from_super)) | |
8982 | { | |
8983 | parse_error_context | |
8984 | (qual_wfl, | |
8985 | "Can't access %s field `%s.%s' from `%s'", | |
8986 | java_accstring_lookup | |
8987 | (get_access_flags_from_decl (field_decl)), | |
8988 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))), | |
8989 | IDENTIFIER_POINTER (DECL_NAME (field_decl)), | |
8990 | IDENTIFIER_POINTER | |
8991 | (DECL_NAME (TYPE_NAME (current_class)))); | |
8992 | return 1; | |
8993 | } | |
5e942c50 | 8994 | check_deprecation (qual_wfl, field_decl); |
8b27f225 PB |
8995 | |
8996 | /* There are things to check when fields are accessed | |
8997 | from type. There are no restrictions on a static | |
8998 | declaration of the field when it is accessed from an | |
8999 | interface */ | |
9000 | is_static = FIELD_STATIC (field_decl); | |
9001 | if (!from_super && from_type | |
9002 | && !TYPE_INTERFACE_P (type) && !is_static) | |
9003 | { | |
9004 | parse_error_context | |
9005 | (qual_wfl, "Can't make a static reference to nonstatic " | |
9006 | "variable `%s' in class `%s'", | |
9007 | IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), | |
9008 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))); | |
9009 | return 1; | |
9010 | } | |
9011 | from_cast = from_super = 0; | |
9012 | ||
5e942c50 APB |
9013 | /* If we need to generate something to get a proper |
9014 | handle on what this field is accessed from, do it | |
9015 | now. */ | |
8b27f225 PB |
9016 | if (!is_static) |
9017 | { | |
9018 | decl = maybe_access_field (decl, *where_found, *type_found); | |
9019 | if (decl == error_mark_node) | |
9020 | return 1; | |
9021 | } | |
9022 | ||
9023 | /* We want to keep the location were found it, and the type | |
9024 | we found. */ | |
9025 | *where_found = decl; | |
9026 | *type_found = type; | |
9027 | ||
9028 | /* This is the decl found and eventually the next one to | |
9029 | search from */ | |
9030 | decl = field_decl; | |
9031 | } | |
9032 | from_type = 0; | |
9033 | type = QUAL_DECL_TYPE (decl); | |
9034 | } | |
9035 | } | |
9036 | *found_decl = decl; | |
9037 | return 0; | |
9038 | } | |
9039 | ||
9040 | /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl) | |
9041 | can't be accessed from REFERENCE (a record type). */ | |
9042 | ||
9043 | int not_accessible_p (reference, member, from_super) | |
9044 | tree reference, member; | |
9045 | int from_super; | |
9046 | { | |
9047 | int access_flag = get_access_flags_from_decl (member); | |
9048 | ||
9049 | /* Access always granted for members declared public */ | |
9050 | if (access_flag & ACC_PUBLIC) | |
9051 | return 0; | |
9052 | ||
9053 | /* Check access on protected members */ | |
9054 | if (access_flag & ACC_PROTECTED) | |
9055 | { | |
9056 | /* Access granted if it occurs from within the package | |
9057 | containing the class in which the protected member is | |
9058 | declared */ | |
9059 | if (class_in_current_package (DECL_CONTEXT (member))) | |
9060 | return 0; | |
9061 | ||
c877974e APB |
9062 | /* If accessed with the form `super.member', then access is granted */ |
9063 | if (from_super) | |
9064 | return 0; | |
8b27f225 | 9065 | |
c877974e APB |
9066 | /* Otherwise, access is granted if occuring from the class where |
9067 | member is declared or a subclass of it */ | |
9068 | if (inherits_from_p (reference, current_class)) | |
9069 | return 0; | |
8b27f225 PB |
9070 | return 1; |
9071 | } | |
9072 | ||
9073 | /* Check access on private members. Access is granted only if it | |
c877974e | 9074 | occurs from within the class in witch it is declared */ |
8b27f225 PB |
9075 | if (access_flag & ACC_PRIVATE) |
9076 | return (current_class == DECL_CONTEXT (member) ? 0 : 1); | |
9077 | ||
9078 | /* Default access are permitted only when occuring within the | |
9079 | package in which the type (REFERENCE) is declared. In other words, | |
9080 | REFERENCE is defined in the current package */ | |
9081 | if (ctxp->package) | |
9082 | return !class_in_current_package (reference); | |
9083 | ||
9084 | /* Otherwise, access is granted */ | |
9085 | return 0; | |
9086 | } | |
9087 | ||
5e942c50 APB |
9088 | /* Test deprecated decl access. */ |
9089 | static void | |
9090 | check_deprecation (wfl, decl) | |
9091 | tree wfl, decl; | |
9092 | { | |
9093 | char *file = DECL_SOURCE_FILE (decl); | |
9094 | /* Complain if the field is deprecated and the file it was defined | |
9095 | in isn't compiled at the same time the file which contains its | |
9096 | use is */ | |
9097 | if (DECL_DEPRECATED (decl) | |
9098 | && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file))) | |
9099 | { | |
9100 | char the [20]; | |
9101 | switch (TREE_CODE (decl)) | |
9102 | { | |
9103 | case FUNCTION_DECL: | |
9104 | strcpy (the, "method"); | |
9105 | break; | |
9106 | case FIELD_DECL: | |
9107 | strcpy (the, "field"); | |
9108 | break; | |
9109 | case TYPE_DECL: | |
9110 | strcpy (the, "class"); | |
9111 | break; | |
9112 | default: | |
9113 | fatal ("unexpected DECL code - check_deprecation"); | |
9114 | } | |
9115 | parse_warning_context | |
9116 | (wfl, "The %s `%s' in class `%s' has been deprecated", | |
9117 | the, lang_printable_name (decl, 0), | |
9118 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))))); | |
9119 | } | |
9120 | } | |
9121 | ||
8b27f225 PB |
9122 | /* Returns 1 if class was declared in the current package, 0 otherwise */ |
9123 | ||
9124 | static int | |
9125 | class_in_current_package (class) | |
9126 | tree class; | |
9127 | { | |
9128 | static tree cache = NULL_TREE; | |
9129 | int qualified_flag; | |
9130 | tree left; | |
9131 | ||
9132 | if (cache == class) | |
9133 | return 1; | |
9134 | ||
9135 | qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class))); | |
9136 | ||
9137 | /* If the current package is empty and the name of CLASS is | |
9138 | qualified, class isn't in the current package. If there is a | |
9139 | current package and the name of the CLASS is not qualified, class | |
9140 | isn't in the current package */ | |
9141 | if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag)) | |
9142 | return 0; | |
9143 | ||
9144 | /* If there is not package and the name of CLASS isn't qualified, | |
9145 | they belong to the same unnamed package */ | |
9146 | if (!ctxp->package && !qualified_flag) | |
9147 | return 1; | |
9148 | ||
9149 | /* Compare the left part of the name of CLASS with the package name */ | |
9150 | breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class))); | |
9151 | if (ctxp->package == left) | |
9152 | { | |
9153 | cache = class; | |
9154 | return 1; | |
9155 | } | |
9156 | return 0; | |
9157 | } | |
9158 | ||
9159 | /* This function may generate code to access DECL from WHERE. This is | |
9160 | done only if certain conditions meet. */ | |
9161 | ||
9162 | static tree | |
9163 | maybe_access_field (decl, where, type) | |
9164 | tree decl, where, type; | |
9165 | { | |
5e942c50 APB |
9166 | if (TREE_CODE (decl) == FIELD_DECL && decl != current_this |
9167 | && !FIELD_STATIC (decl)) | |
8b27f225 PB |
9168 | decl = build_field_ref (where ? where : current_this, |
9169 | (type ? type : DECL_CONTEXT (decl)), | |
9170 | DECL_NAME (decl)); | |
9171 | return decl; | |
9172 | } | |
9173 | ||
12472854 | 9174 | /* Build a method invocation, by patching PATCH. If non NULL |
8b27f225 PB |
9175 | and according to the situation, PRIMARY and WHERE may be |
9176 | used. IS_STATIC is set to 1 if the invoked function is static. */ | |
9177 | ||
9178 | static tree | |
ac825856 | 9179 | patch_method_invocation (patch, primary, where, is_static, ret_decl) |
8b27f225 PB |
9180 | tree patch, primary, where; |
9181 | int *is_static; | |
9182 | tree *ret_decl; | |
9183 | { | |
9184 | tree wfl = TREE_OPERAND (patch, 0); | |
9185 | tree args = TREE_OPERAND (patch, 1); | |
9186 | tree name = EXPR_WFL_NODE (wfl); | |
5e942c50 | 9187 | tree list; |
22eed1e6 | 9188 | int is_static_flag = 0; |
ac825856 | 9189 | int is_super_init = 0; |
8b27f225 PB |
9190 | |
9191 | /* Should be overriden if everything goes well. Otherwise, if | |
9192 | something fails, it should keep this value. It stop the | |
9193 | evaluation of a bogus assignment. See java_complete_tree, | |
9194 | MODIFY_EXPR: for the reasons why we sometimes want to keep on | |
9195 | evaluating an assignment */ | |
9196 | TREE_TYPE (patch) = error_mark_node; | |
9197 | ||
9198 | /* Since lookup functions are messing with line numbers, save the | |
9199 | context now. */ | |
9200 | java_parser_context_save_global (); | |
9201 | ||
9202 | /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */ | |
9203 | ||
9204 | /* Resolution of qualified name, excluding constructors */ | |
9205 | if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch)) | |
9206 | { | |
9207 | tree class_decl, identifier, identifier_wfl; | |
9208 | /* Extract the last IDENTIFIER of the qualified | |
9209 | expression. This is a wfl and we will use it's location | |
9210 | data during error report. */ | |
9211 | identifier_wfl = cut_identifier_in_qualified (wfl); | |
9212 | identifier = EXPR_WFL_NODE (identifier_wfl); | |
9213 | ||
9214 | /* Given the context, IDENTIFIER is syntactically qualified | |
9215 | as a MethodName. We need to qualify what's before */ | |
9216 | qualify_ambiguous_name (wfl); | |
9217 | ||
9218 | /* Package resolution are erroneous */ | |
9219 | if (RESOLVE_PACKAGE_NAME_P (wfl)) | |
9220 | { | |
9221 | tree remainder; | |
9222 | breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl)); | |
9223 | parse_error_context (wfl, "Can't search method `%s' in package " | |
9224 | "`%s'",IDENTIFIER_POINTER (identifier), | |
9225 | IDENTIFIER_POINTER (remainder)); | |
9226 | PATCH_METHOD_RETURN_ERROR (); | |
9227 | } | |
9228 | /* We're resolving a call from a type */ | |
9229 | else if (RESOLVE_TYPE_NAME_P (wfl)) | |
9230 | { | |
9231 | tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)); | |
9232 | tree name = DECL_NAME (decl); | |
9233 | tree type; | |
9234 | ||
9235 | class_decl = resolve_and_layout (name, wfl); | |
9236 | if (CLASS_INTERFACE (decl)) | |
9237 | { | |
9238 | parse_error_context | |
9239 | (identifier_wfl, "Can't make static reference to method " | |
9240 | "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier), | |
9241 | IDENTIFIER_POINTER (name)); | |
9242 | PATCH_METHOD_RETURN_ERROR (); | |
9243 | } | |
9244 | /* Look the method up in the type selector. The method ought | |
9245 | to be static. */ | |
9246 | type = TREE_TYPE (class_decl); | |
9247 | list = lookup_method_invoke (0, wfl, type, identifier, args); | |
9248 | if (list && !METHOD_STATIC (list)) | |
9249 | { | |
9250 | char *fct_name = strdup (lang_printable_name (list, 0)); | |
9251 | parse_error_context | |
9252 | (identifier_wfl, | |
9253 | "Can't make static reference to method `%s %s' in class `%s'", | |
9254 | lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), | |
9255 | fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))); | |
9256 | free (fct_name); | |
9257 | PATCH_METHOD_RETURN_ERROR (); | |
9258 | } | |
5e942c50 | 9259 | args = nreverse (args); |
8b27f225 PB |
9260 | } |
9261 | /* We're resolving an expression name */ | |
9262 | else | |
9263 | { | |
9264 | tree field, type; | |
9265 | ||
9266 | /* 1- Find the field to which the call applies */ | |
9267 | field = resolve_field_access (wfl, NULL, &type); | |
9268 | if (field == error_mark_node) | |
9269 | PATCH_METHOD_RETURN_ERROR (); | |
c3f2a476 APB |
9270 | /* field is used in lieu of a primary. It alows us not to |
9271 | report errors on erroneous use of `this' in | |
9272 | constructors. */ | |
9273 | primary = field; | |
8b27f225 PB |
9274 | |
9275 | /* 2- Do the layout of the class where the last field | |
9276 | was found, so we can search it. */ | |
c877974e | 9277 | class_decl = resolve_and_layout (type, NULL_TREE); |
59e4a38e | 9278 | if (class_decl != NULL_TREE) |
c877974e APB |
9279 | type = TREE_TYPE (class_decl); |
9280 | ||
8b27f225 PB |
9281 | /* 3- Retrieve a filtered list of method matches, Refine |
9282 | if necessary. In any cases, point out errors. */ | |
9283 | list = lookup_method_invoke (0, identifier_wfl, type, | |
9284 | identifier, args); | |
9285 | ||
9286 | /* 4- Add the field as an argument */ | |
9287 | args = tree_cons (NULL_TREE, field, nreverse (args)); | |
9288 | } | |
9289 | ||
5e942c50 | 9290 | /* IDENTIFIER_WFL will be used to report any problem further */ |
8b27f225 PB |
9291 | wfl = identifier_wfl; |
9292 | } | |
9293 | /* Resolution of simple names, names generated after a primary: or | |
9294 | constructors */ | |
9295 | else | |
9296 | { | |
9297 | tree class_to_search; | |
9298 | int lc; /* Looking for Constructor */ | |
9299 | ||
9300 | /* We search constructor in their target class */ | |
9301 | if (CALL_CONSTRUCTOR_P (patch)) | |
9302 | { | |
22eed1e6 APB |
9303 | if (TREE_CODE (patch) == NEW_CLASS_EXPR) |
9304 | class_to_search = EXPR_WFL_NODE (wfl); | |
9305 | else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == | |
9306 | this_identifier_node) | |
9307 | class_to_search = NULL_TREE; | |
9308 | else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == | |
9309 | super_identifier_node) | |
8b27f225 | 9310 | { |
ac825856 | 9311 | is_super_init = 1; |
22eed1e6 APB |
9312 | if (CLASSTYPE_SUPER (current_class)) |
9313 | class_to_search = | |
9314 | DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class))); | |
9315 | else | |
9316 | { | |
9317 | parse_error_context (wfl, "Can't invoke super constructor " | |
9318 | "on java.lang.Object"); | |
9319 | PATCH_METHOD_RETURN_ERROR (); | |
9320 | } | |
8b27f225 | 9321 | } |
22eed1e6 APB |
9322 | |
9323 | /* Class to search is NULL if we're searching the current one */ | |
9324 | if (class_to_search) | |
8b27f225 | 9325 | { |
23a79c61 APB |
9326 | class_to_search = resolve_and_layout (class_to_search, |
9327 | NULL_TREE); | |
22eed1e6 APB |
9328 | if (!class_to_search) |
9329 | { | |
9330 | parse_error_context | |
9331 | (wfl, "Class `%s' not found in type declaration", | |
9332 | IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); | |
9333 | PATCH_METHOD_RETURN_ERROR (); | |
9334 | } | |
9335 | ||
5e942c50 APB |
9336 | /* Can't instantiate an abstract class, but we can |
9337 | invoke it's constructor. It's use within the `new' | |
9338 | context is denied here. */ | |
9339 | if (CLASS_ABSTRACT (class_to_search) | |
9340 | && TREE_CODE (patch) == NEW_CLASS_EXPR) | |
22eed1e6 APB |
9341 | { |
9342 | parse_error_context | |
9343 | (wfl, "Class `%s' is an abstract class. It can't be " | |
9344 | "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); | |
9345 | PATCH_METHOD_RETURN_ERROR (); | |
9346 | } | |
9347 | class_to_search = TREE_TYPE (class_to_search); | |
8b27f225 | 9348 | } |
22eed1e6 APB |
9349 | else |
9350 | class_to_search = current_class; | |
8b27f225 PB |
9351 | lc = 1; |
9352 | } | |
9353 | /* This is a regular search in the local class, unless an | |
9354 | alternate class is specified. */ | |
9355 | else | |
9356 | { | |
9357 | class_to_search = (where ? where : current_class); | |
9358 | lc = 0; | |
9359 | } | |
9360 | ||
9361 | /* NAME is a simple identifier or comes from a primary. Search | |
9362 | in the class whose declaration contain the method being | |
9363 | invoked. */ | |
c877974e | 9364 | resolve_and_layout (class_to_search, NULL_TREE); |
8b27f225 PB |
9365 | list = lookup_method_invoke (lc, wfl, class_to_search, name, args); |
9366 | ||
9367 | /* Don't continue if no method were found, as the next statement | |
9368 | can't be executed then. */ | |
9369 | if (!list) | |
9370 | PATCH_METHOD_RETURN_ERROR (); | |
9371 | ||
9372 | /* Check for static reference if non static methods */ | |
9373 | if (check_for_static_method_reference (wfl, patch, list, | |
9374 | class_to_search, primary)) | |
9375 | PATCH_METHOD_RETURN_ERROR (); | |
9376 | ||
22eed1e6 APB |
9377 | /* Non static methods are called with the current object extra |
9378 | argument. If patch a `new TYPE()', the argument is the value | |
9379 | returned by the object allocator. If method is resolved as a | |
9380 | primary, use the primary otherwise use the current THIS. */ | |
8b27f225 | 9381 | args = nreverse (args); |
22eed1e6 | 9382 | if (!METHOD_STATIC (list) && TREE_CODE (patch) != NEW_CLASS_EXPR) |
8b27f225 | 9383 | args = tree_cons (NULL_TREE, primary ? primary : current_this, args); |
8b27f225 PB |
9384 | } |
9385 | ||
9386 | /* Merge point of all resolution schemes. If we have nothing, this | |
9387 | is an error, already signaled */ | |
9388 | if (!list) | |
9389 | PATCH_METHOD_RETURN_ERROR (); | |
9390 | ||
9391 | /* Check accessibility, position the is_static flag, build and | |
9392 | return the call */ | |
c877974e | 9393 | if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0)) |
8b27f225 PB |
9394 | { |
9395 | char *fct_name = strdup (lang_printable_name (list, 0)); | |
9396 | parse_error_context | |
9397 | (wfl, "Can't access %s method `%s %s.%s' from `%s'", | |
9398 | java_accstring_lookup (get_access_flags_from_decl (list)), | |
9399 | lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), | |
5e942c50 APB |
9400 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list)))), |
9401 | fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)))); | |
8b27f225 PB |
9402 | free (fct_name); |
9403 | PATCH_METHOD_RETURN_ERROR (); | |
9404 | } | |
5e942c50 | 9405 | check_deprecation (wfl, list); |
22eed1e6 APB |
9406 | |
9407 | is_static_flag = METHOD_STATIC (list); | |
9408 | ||
c3f2a476 APB |
9409 | /* In the context of an explicit constructor invocation, we can't |
9410 | invoke any method relying on `this'. Exceptions are: we're | |
9411 | invoking a static function, primary exists and is not the current | |
9412 | this, we're creating a new object. */ | |
22eed1e6 | 9413 | if (ctxp->explicit_constructor_p |
c3f2a476 APB |
9414 | && !is_static_flag |
9415 | && (!primary || primary == current_this) | |
9416 | && (TREE_CODE (patch) != NEW_CLASS_EXPR)) | |
22eed1e6 APB |
9417 | { |
9418 | parse_error_context | |
9419 | (wfl, "Can't reference `this' before the superclass constructor has " | |
9420 | "been called"); | |
9421 | PATCH_METHOD_RETURN_ERROR (); | |
9422 | } | |
8b27f225 | 9423 | java_parser_context_restore_global (); |
22eed1e6 APB |
9424 | if (is_static) |
9425 | *is_static = is_static_flag; | |
8b27f225 PB |
9426 | /* Sometimes, we want the decl of the selected method. Such as for |
9427 | EH checking */ | |
9428 | if (ret_decl) | |
9429 | *ret_decl = list; | |
ac825856 APB |
9430 | patch = patch_invoke (patch, list, args); |
9431 | if (is_super_init && CLASS_HAS_FINIT_P (current_class)) | |
9432 | { | |
9433 | /* Generate the code used to initialize fields declared with an | |
9434 | initialization statement. For now, it returns a call the the | |
9435 | artificial function $finit$, if required. */ | |
9436 | ||
9437 | tree finit_call = | |
9438 | build_method_invocation (build_expr_wfl (finit_identifier_node, | |
9439 | input_filename, 0, 0), | |
9440 | NULL_TREE); | |
9441 | patch = build (COMPOUND_EXPR, void_type_node, patch, | |
9442 | java_complete_tree (finit_call)); | |
9443 | CAN_COMPLETE_NORMALLY (patch) = 1; | |
9444 | } | |
9445 | return patch; | |
8b27f225 PB |
9446 | } |
9447 | ||
9448 | /* Check that we're not trying to do a static reference to a method in | |
9449 | non static method. Return 1 if it's the case, 0 otherwise. */ | |
9450 | ||
9451 | static int | |
9452 | check_for_static_method_reference (wfl, node, method, where, primary) | |
9453 | tree wfl, node, method, where, primary; | |
9454 | { | |
9455 | if (METHOD_STATIC (current_function_decl) | |
9456 | && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node)) | |
9457 | { | |
9458 | char *fct_name = strdup (lang_printable_name (method, 0)); | |
9459 | parse_error_context | |
9460 | (wfl, "Can't make static reference to method `%s %s' in class `%s'", | |
9461 | lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name, | |
9462 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where)))); | |
9463 | free (fct_name); | |
9464 | return 1; | |
9465 | } | |
9466 | return 0; | |
9467 | } | |
9468 | ||
9469 | /* Patch an invoke expression METHOD and ARGS, based on its invocation | |
9470 | mode. */ | |
9471 | ||
9472 | static tree | |
ac825856 | 9473 | patch_invoke (patch, method, args) |
8b27f225 PB |
9474 | tree patch, method, args; |
9475 | { | |
8b27f225 | 9476 | tree dtable, func; |
8b27f225 PB |
9477 | tree original_call, t, ta; |
9478 | ||
5e942c50 APB |
9479 | /* Last step for args: convert build-in types. If we're dealing with |
9480 | a new TYPE() type call, the first argument to the constructor | |
9481 | isn't found in the incomming argument list, but delivered by | |
9482 | `new' */ | |
9483 | t = TYPE_ARG_TYPES (TREE_TYPE (method)); | |
9484 | if (TREE_CODE (patch) == NEW_CLASS_EXPR) | |
9485 | t = TREE_CHAIN (t); | |
ac825856 APB |
9486 | for (ta = args; t != end_params_node && ta; |
9487 | t = TREE_CHAIN (t), ta = TREE_CHAIN (ta)) | |
8b27f225 PB |
9488 | if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) && |
9489 | TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t)) | |
9490 | TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta)); | |
22eed1e6 | 9491 | |
12472854 PB |
9492 | if (flag_emit_class_files) |
9493 | func = method; | |
9494 | else | |
8b27f225 | 9495 | { |
12472854 | 9496 | tree signature = build_java_signature (TREE_TYPE (method)); |
ac825856 | 9497 | switch (invocation_mode (method, CALL_USING_SUPER (patch))) |
12472854 PB |
9498 | { |
9499 | case INVOKE_VIRTUAL: | |
9500 | dtable = invoke_build_dtable (0, args); | |
9501 | func = build_invokevirtual (dtable, method); | |
9502 | break; | |
8b27f225 | 9503 | |
12472854 PB |
9504 | case INVOKE_SUPER: |
9505 | case INVOKE_STATIC: | |
9506 | func = build_known_method_ref (method, TREE_TYPE (method), | |
9507 | DECL_CONTEXT (method), | |
9508 | signature, args); | |
9509 | break; | |
8b27f225 | 9510 | |
12472854 PB |
9511 | case INVOKE_INTERFACE: |
9512 | dtable = invoke_build_dtable (1, args); | |
9513 | func = build_invokeinterface (dtable, DECL_NAME (method), signature); | |
9514 | break; | |
5e942c50 | 9515 | |
12472854 | 9516 | default: |
ac825856 | 9517 | fatal ("internal error - unknown invocation_mode result"); |
12472854 PB |
9518 | } |
9519 | ||
9520 | /* Ensure self_type is initialized, (invokestatic). FIXME */ | |
9521 | func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func); | |
8b27f225 PB |
9522 | } |
9523 | ||
8b27f225 PB |
9524 | TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method)); |
9525 | TREE_OPERAND (patch, 0) = func; | |
9526 | TREE_OPERAND (patch, 1) = args; | |
9527 | original_call = patch; | |
9528 | ||
22eed1e6 APB |
9529 | /* We're processing a `new TYPE ()' form. New is called an its |
9530 | returned value is the first argument to the constructor. We build | |
9531 | a COMPOUND_EXPR and use saved expression so that the overall NEW | |
9532 | expression value is a pointer to a newly created and initialized | |
9533 | class. */ | |
9534 | if (TREE_CODE (original_call) == NEW_CLASS_EXPR) | |
8b27f225 PB |
9535 | { |
9536 | tree class = DECL_CONTEXT (method); | |
9537 | tree c1, saved_new, size, new; | |
12472854 PB |
9538 | if (flag_emit_class_files) |
9539 | { | |
9540 | TREE_TYPE (patch) = build_pointer_type (class); | |
9541 | return patch; | |
9542 | } | |
8b27f225 PB |
9543 | if (!TYPE_SIZE (class)) |
9544 | safe_layout_class (class); | |
9545 | size = size_in_bytes (class); | |
9546 | new = build (CALL_EXPR, promote_type (class), | |
9547 | build_address_of (alloc_object_node), | |
9548 | tree_cons (NULL_TREE, build_class_ref (class), | |
9549 | build_tree_list (NULL_TREE, | |
9550 | size_in_bytes (class))), | |
9551 | NULL_TREE); | |
9552 | saved_new = save_expr (new); | |
9553 | c1 = build_tree_list (NULL_TREE, saved_new); | |
9554 | TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1); | |
9555 | TREE_OPERAND (original_call, 1) = c1; | |
9556 | TREE_SET_CODE (original_call, CALL_EXPR); | |
9557 | patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new); | |
9558 | } | |
9559 | return patch; | |
9560 | } | |
9561 | ||
9562 | static int | |
9563 | invocation_mode (method, super) | |
9564 | tree method; | |
9565 | int super; | |
9566 | { | |
9567 | int access = get_access_flags_from_decl (method); | |
9568 | ||
22eed1e6 APB |
9569 | if (super) |
9570 | return INVOKE_SUPER; | |
9571 | ||
82371d41 | 9572 | if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE) |
8b27f225 PB |
9573 | return INVOKE_STATIC; |
9574 | ||
9575 | if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method)))) | |
9576 | return INVOKE_STATIC; | |
9577 | ||
8b27f225 PB |
9578 | if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method)))) |
9579 | return INVOKE_INTERFACE; | |
9580 | ||
9581 | if (DECL_CONSTRUCTOR_P (method)) | |
9582 | return INVOKE_STATIC; | |
22eed1e6 | 9583 | |
8b27f225 PB |
9584 | return INVOKE_VIRTUAL; |
9585 | } | |
9586 | ||
9587 | /* Retrieve a refined list of matching methods. It covers the step | |
9588 | 15.11.2 (Compile-Time Step 2) */ | |
9589 | ||
9590 | static tree | |
9591 | lookup_method_invoke (lc, cl, class, name, arg_list) | |
9592 | int lc; | |
9593 | tree cl; | |
9594 | tree class, name, arg_list; | |
9595 | { | |
82371d41 | 9596 | tree atl = end_params_node; /* Arg Type List */ |
c877974e | 9597 | tree method, signature, list, node; |
8b27f225 PB |
9598 | char *candidates; /* Used for error report */ |
9599 | ||
5e942c50 | 9600 | /* Fix the arguments */ |
8b27f225 PB |
9601 | for (node = arg_list; node; node = TREE_CHAIN (node)) |
9602 | { | |
c877974e APB |
9603 | tree current_arg = TREE_VALUE (node); |
9604 | /* Integer constant 0 passed as itself, not as a type */ | |
9605 | if (current_arg != integer_zero_node) | |
9606 | current_arg = TREE_TYPE (TREE_VALUE (node)); | |
9607 | /* Non primitive type may have to be resolved */ | |
9608 | if (current_arg != integer_zero_node | |
9609 | && !JPRIMITIVE_TYPE_P (current_arg)) | |
9610 | resolve_and_layout (current_arg, NULL_TREE); | |
9611 | /* And promoted */ | |
8b27f225 | 9612 | if (TREE_CODE (current_arg) == RECORD_TYPE) |
c877974e | 9613 | current_arg = promote_type (current_arg); |
5e942c50 | 9614 | atl = tree_cons (NULL_TREE, current_arg, atl); |
8b27f225 PB |
9615 | } |
9616 | ||
5e942c50 APB |
9617 | /* Find all candidates and then refine the list, searching for the |
9618 | most specific method. */ | |
9619 | list = find_applicable_accessible_methods_list (lc, class, name, atl); | |
9620 | list = find_most_specific_methods_list (list); | |
8b27f225 PB |
9621 | if (list && !TREE_CHAIN (list)) |
9622 | return TREE_VALUE (list); | |
9623 | ||
9624 | /* Issue an error. List candidates if any. Candidates are listed | |
9625 | only if accessible (non accessible methods may end-up here for | |
9626 | the sake of a better error report). */ | |
9627 | candidates = NULL; | |
9628 | if (list) | |
9629 | { | |
9630 | tree current; | |
9631 | obstack_grow (&temporary_obstack, ". Candidates are:\n", 18); | |
9632 | for (current = list; current; current = TREE_CHAIN (current)) | |
9633 | { | |
9634 | tree cm = TREE_VALUE (current); | |
9635 | char string [4096]; | |
9636 | if (!cm || not_accessible_p (class, cm, 0)) | |
9637 | continue; | |
8b27f225 | 9638 | sprintf |
22eed1e6 APB |
9639 | (string, " `%s' in `%s'%s", |
9640 | get_printable_method_name (cm), | |
8b27f225 PB |
9641 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))), |
9642 | (TREE_CHAIN (current) ? "\n" : "")); | |
9643 | obstack_grow (&temporary_obstack, string, strlen (string)); | |
9644 | } | |
9645 | obstack_1grow (&temporary_obstack, '\0'); | |
9646 | candidates = obstack_finish (&temporary_obstack); | |
9647 | } | |
9648 | /* Issue the error message */ | |
c877974e APB |
9649 | for (node = atl; node; node = TREE_CHAIN (node)) |
9650 | if (TREE_VALUE (node) == integer_zero_node) | |
9651 | TREE_VALUE (node) = long_type_node; | |
9652 | method = make_node (FUNCTION_TYPE); | |
9653 | TYPE_ARG_TYPES (method) = atl; | |
8b27f225 | 9654 | signature = build_java_argument_signature (method); |
22eed1e6 APB |
9655 | parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s", |
9656 | (lc ? "constructor" : "method"), | |
9657 | (lc ? | |
9658 | IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) : | |
9659 | IDENTIFIER_POINTER (name)), | |
8b27f225 PB |
9660 | IDENTIFIER_POINTER (signature), |
9661 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))), | |
9662 | (candidates ? candidates : "")); | |
9663 | return NULL_TREE; | |
9664 | } | |
9665 | ||
5e942c50 APB |
9666 | /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1 |
9667 | when we're looking for a constructor. */ | |
8b27f225 PB |
9668 | |
9669 | static tree | |
5e942c50 APB |
9670 | find_applicable_accessible_methods_list (lc, class, name, arglist) |
9671 | int lc; | |
8b27f225 PB |
9672 | tree class, name, arglist; |
9673 | { | |
9674 | tree method; | |
9675 | tree list = NULL_TREE, all_list = NULL_TREE; | |
9676 | ||
9677 | while (class != NULL_TREE) | |
9678 | { | |
9679 | for (method = TYPE_METHODS (class); | |
9680 | method != NULL_TREE; method = TREE_CHAIN (method)) | |
9681 | { | |
5e942c50 | 9682 | if (lc && !DECL_CONSTRUCTOR_P (method)) |
8b27f225 | 9683 | continue; |
5e942c50 | 9684 | else if (!lc && (DECL_CONSTRUCTOR_P (method) |
c877974e | 9685 | || (GET_METHOD_NAME (method) != name))) |
5e942c50 APB |
9686 | continue; |
9687 | ||
8b27f225 PB |
9688 | if (argument_types_convertible (method, arglist)) |
9689 | { | |
9690 | /* Retain accessible methods only */ | |
c877974e APB |
9691 | if (!not_accessible_p (DECL_CONTEXT (current_function_decl), |
9692 | method, 0)) | |
8b27f225 PB |
9693 | list = tree_cons (NULL_TREE, method, list); |
9694 | else | |
9695 | /* Also retain all selected method here */ | |
9696 | all_list = tree_cons (NULL_TREE, method, list); | |
9697 | } | |
9698 | } | |
5e942c50 APB |
9699 | /* When dealing with constructor, stop here, otherwise search |
9700 | other classes */ | |
9701 | class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class)); | |
8b27f225 PB |
9702 | } |
9703 | /* Either return the list obtained or all selected (but | |
9704 | inaccessible) methods for better error report. */ | |
9705 | return (!list ? all_list : list); | |
9706 | } | |
9707 | ||
9708 | /* 15.11.2.2 Choose the Most Specific Method */ | |
9709 | ||
9710 | static tree | |
9711 | find_most_specific_methods_list (list) | |
9712 | tree list; | |
9713 | { | |
9714 | int max = 0; | |
9715 | tree current, new_list = NULL_TREE; | |
9716 | for (current = list; current; current = TREE_CHAIN (current)) | |
9717 | { | |
9718 | tree method; | |
9719 | DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0; | |
9720 | ||
9721 | for (method = list; method; method = TREE_CHAIN (method)) | |
9722 | { | |
9723 | /* Don't test a method against itself */ | |
9724 | if (method == current) | |
9725 | continue; | |
9726 | ||
9727 | /* Compare arguments and location where method where declared */ | |
9728 | if (argument_types_convertible (TREE_VALUE (method), | |
9729 | TREE_VALUE (current)) | |
9730 | && valid_method_invocation_conversion_p | |
9731 | (DECL_CONTEXT (TREE_VALUE (method)), | |
9732 | DECL_CONTEXT (TREE_VALUE (current)))) | |
9733 | { | |
9734 | int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current)); | |
9735 | max = (v > max ? v : max); | |
9736 | } | |
9737 | } | |
9738 | } | |
9739 | ||
9740 | /* Review the list and select the maximally specific methods */ | |
9741 | for (current = list; current; current = TREE_CHAIN (current)) | |
9742 | if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max) | |
9743 | new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list); | |
9744 | ||
9745 | /* If we can't find one, lower expectations and try to gather multiple | |
9746 | maximally specific methods */ | |
9747 | while (!new_list) | |
9748 | { | |
9749 | while (--max > 0) | |
9750 | { | |
9751 | if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max) | |
9752 | new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list); | |
9753 | } | |
9754 | return new_list; | |
9755 | } | |
9756 | ||
9757 | return new_list; | |
9758 | } | |
9759 | ||
9760 | /* Make sure that the type of each M2_OR_ARGLIST arguments can be | |
9761 | converted by method invocation conversion (5.3) to the type of the | |
9762 | corresponding parameter of M1. Implementation expects M2_OR_ARGLIST | |
9763 | to change less often than M1. */ | |
9764 | ||
9765 | static int | |
9766 | argument_types_convertible (m1, m2_or_arglist) | |
9767 | tree m1, m2_or_arglist; | |
9768 | { | |
9769 | static tree m2_arg_value = NULL_TREE; | |
9770 | static tree m2_arg_cache = NULL_TREE; | |
9771 | ||
9772 | register tree m1_arg, m2_arg; | |
9773 | ||
9774 | m1_arg = TYPE_ARG_TYPES (TREE_TYPE (m1)); | |
9775 | if (!METHOD_STATIC (m1)) | |
9776 | m1_arg = TREE_CHAIN (m1_arg); | |
9777 | ||
9778 | if (m2_arg_value == m2_or_arglist) | |
9779 | m2_arg = m2_arg_cache; | |
9780 | else | |
9781 | { | |
9782 | /* M2_OR_ARGLIST can be a function DECL or a raw list of | |
9783 | argument types */ | |
9784 | if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL) | |
9785 | { | |
9786 | m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist)); | |
9787 | if (!METHOD_STATIC (m2_or_arglist)) | |
9788 | m2_arg = TREE_CHAIN (m2_arg); | |
9789 | } | |
9790 | else | |
9791 | m2_arg = m2_or_arglist; | |
9792 | ||
9793 | m2_arg_value = m2_or_arglist; | |
9794 | m2_arg_cache = m2_arg; | |
9795 | } | |
9796 | ||
82371d41 | 9797 | while (m1_arg != end_params_node && m2_arg != end_params_node) |
8b27f225 | 9798 | { |
c877974e | 9799 | resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE); |
8b27f225 PB |
9800 | if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg), |
9801 | TREE_VALUE (m2_arg))) | |
9802 | break; | |
9803 | m1_arg = TREE_CHAIN (m1_arg); | |
9804 | m2_arg = TREE_CHAIN (m2_arg); | |
9805 | } | |
82371d41 | 9806 | return m1_arg == end_params_node && m2_arg == end_params_node; |
8b27f225 PB |
9807 | } |
9808 | ||
9809 | /* Qualification routines */ | |
9810 | ||
9811 | static void | |
9812 | qualify_ambiguous_name (id) | |
9813 | tree id; | |
9814 | { | |
9815 | tree qual, qual_wfl, name, decl, ptr_type, saved_current_class; | |
9816 | int again, super_found = 0, this_found = 0; | |
9817 | ||
9818 | /* We first qualify the first element, then derive qualification of | |
9819 | others based on the first one. If the first element is qualified | |
9820 | by a resolution (field or type), this resolution is stored in the | |
9821 | QUAL_RESOLUTION of the qual element being examined. We need to | |
9822 | save the current_class since the use of SUPER might change the | |
9823 | its value. */ | |
9824 | saved_current_class = current_class; | |
9825 | qual = EXPR_WFL_QUALIFICATION (id); | |
9826 | do { | |
9827 | ||
9828 | /* Simple qualified expression feature a qual_wfl that is a | |
9829 | WFL. Expression derived from a primary feature more complicated | |
9830 | things like a CALL_EXPR. Expression from primary need to be | |
9831 | worked out to extract the part on which the qualification will | |
9832 | take place. */ | |
9833 | qual_wfl = QUAL_WFL (qual); | |
9834 | switch (TREE_CODE (qual_wfl)) | |
9835 | { | |
9836 | case CALL_EXPR: | |
9837 | qual_wfl = TREE_OPERAND (qual_wfl, 0); | |
9838 | if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION) | |
9839 | { | |
9840 | qual = EXPR_WFL_QUALIFICATION (qual_wfl); | |
9841 | qual_wfl = QUAL_WFL (qual); | |
9842 | } | |
9843 | break; | |
9844 | case NEW_CLASS_EXPR: | |
9845 | case CONVERT_EXPR: | |
9846 | qual_wfl = TREE_OPERAND (qual_wfl, 0); | |
9847 | break; | |
9848 | case ARRAY_REF: | |
9849 | while (TREE_CODE (qual_wfl) == ARRAY_REF) | |
9850 | qual_wfl = TREE_OPERAND (qual_wfl, 0); | |
9851 | break; | |
9852 | default: | |
9853 | /* Fix for -Wall. Just break doing nothing */ | |
9854 | break; | |
9855 | } | |
9856 | name = EXPR_WFL_NODE (qual_wfl); | |
9857 | ptr_type = current_class; | |
9858 | again = 0; | |
9859 | /* If we have a THIS (from a primary), we set the context accordingly */ | |
9860 | if (name == this_identifier_node) | |
9861 | { | |
9862 | qual = TREE_CHAIN (qual); | |
9863 | qual_wfl = QUAL_WFL (qual); | |
22eed1e6 APB |
9864 | if (TREE_CODE (qual_wfl) == CALL_EXPR) |
9865 | again = 1; | |
9866 | else | |
9867 | name = EXPR_WFL_NODE (qual_wfl); | |
8b27f225 PB |
9868 | this_found = 1; |
9869 | } | |
9870 | /* If we have a SUPER, we set the context accordingly */ | |
9871 | if (name == super_identifier_node) | |
9872 | { | |
9873 | current_class = CLASSTYPE_SUPER (ptr_type); | |
9874 | /* Check that there is such a thing as a super class. If not, | |
9875 | return. The error will be caught later on, during the | |
9876 | resolution */ | |
9877 | if (!current_class) | |
9878 | { | |
9879 | current_class = saved_current_class; | |
9880 | return; | |
9881 | } | |
9882 | qual = TREE_CHAIN (qual); | |
9883 | /* Do one more interation to set things up */ | |
9884 | super_found = again = 1; | |
9885 | } | |
5e942c50 APB |
9886 | /* Loop one more time if we're dealing with ?: or a string constant */ |
9887 | if (TREE_CODE (qual_wfl) == CONDITIONAL_EXPR | |
9888 | || TREE_CODE (qual_wfl) == STRING_CST) | |
22eed1e6 APB |
9889 | { |
9890 | qual = TREE_CHAIN (qual); | |
9891 | qual_wfl = QUAL_WFL (qual); | |
9892 | again = 1; | |
9893 | } | |
8b27f225 PB |
9894 | } while (again); |
9895 | ||
9896 | /* If name appears within the scope of a location variable | |
9897 | declaration or parameter declaration, then it is an expression | |
9898 | name. We don't carry this test out if we're in the context of the | |
9899 | use of SUPER or THIS */ | |
9900 | ||
9901 | if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name))) | |
9902 | { | |
9903 | RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; | |
9904 | QUAL_RESOLUTION (qual) = decl; | |
9905 | } | |
9906 | ||
9907 | /* If within the class/interface NAME was found to be used there | |
9908 | exists a (possibly inherited) field named NAME, then this is an | |
9909 | expression name. */ | |
9910 | else if ((decl = lookup_field_wrapper (ptr_type, name))) | |
9911 | { | |
9912 | RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; | |
9913 | QUAL_RESOLUTION (qual) = decl; | |
9914 | } | |
9915 | ||
9916 | /* We reclassify NAME as a type name if: | |
9917 | - NAME is a class/interface declared within the compilation | |
9918 | unit containing NAME, | |
9919 | - NAME is imported via a single-type-import declaration, | |
9920 | - NAME is declared in an another compilation unit of the package | |
9921 | of the compilation unit containing NAME, | |
9922 | - NAME is declared by exactly on type-import-on-demand declaration | |
9923 | of the compilation unit containing NAME. */ | |
9924 | else if ((decl = resolve_and_layout (name, NULL_TREE))) | |
9925 | { | |
9926 | RESOLVE_TYPE_NAME_P (qual_wfl) = 1; | |
9927 | QUAL_RESOLUTION (qual) = decl; | |
9928 | } | |
9929 | ||
9930 | /* Method call are expression name */ | |
c877974e APB |
9931 | else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR |
9932 | || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF) | |
8b27f225 PB |
9933 | RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; |
9934 | ||
9935 | /* Check here that NAME isn't declared by more than one | |
9936 | type-import-on-demand declaration of the compilation unit | |
9937 | containing NAME. FIXME */ | |
9938 | ||
9939 | /* Otherwise, NAME is reclassified as a package name */ | |
9940 | else | |
9941 | RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1; | |
9942 | ||
9943 | /* Propagate the qualification accross other components of the | |
9944 | qualified name */ | |
9945 | for (qual = TREE_CHAIN (qual); qual; | |
9946 | qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual)) | |
9947 | { | |
9948 | if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) | |
9949 | RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1; | |
9950 | else | |
9951 | RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1; | |
9952 | } | |
9953 | ||
9954 | /* Store the global qualification for the ambiguous part of ID back | |
9955 | into ID fields */ | |
9956 | if (RESOLVE_EXPRESSION_NAME_P (qual_wfl)) | |
9957 | RESOLVE_EXPRESSION_NAME_P (id) = 1; | |
9958 | else if (RESOLVE_TYPE_NAME_P (qual_wfl)) | |
9959 | RESOLVE_TYPE_NAME_P (id) = 1; | |
9960 | else if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) | |
9961 | RESOLVE_PACKAGE_NAME_P (id) = 1; | |
9962 | ||
9963 | /* Restore the current class */ | |
9964 | current_class = saved_current_class; | |
9965 | } | |
9966 | ||
9967 | static int | |
9968 | breakdown_qualified (left, right, source) | |
9969 | tree *left, *right, source; | |
9970 | { | |
9971 | char *p = IDENTIFIER_POINTER (source), *base; | |
9972 | int l = IDENTIFIER_LENGTH (source); | |
9973 | ||
9974 | /* Breakdown NAME into REMAINDER . IDENTIFIER */ | |
9975 | base = p; | |
9976 | p += (l-1); | |
9977 | while (*p != '.' && p != base) | |
9978 | p--; | |
9979 | ||
9980 | /* We didn't find a '.'. Return an error */ | |
9981 | if (p == base) | |
9982 | return 1; | |
9983 | ||
9984 | *p = '\0'; | |
9985 | if (right) | |
9986 | *right = get_identifier (p+1); | |
9987 | *left = get_identifier (IDENTIFIER_POINTER (source)); | |
9988 | *p = '.'; | |
9989 | ||
9990 | return 0; | |
9991 | } | |
9992 | ||
8b27f225 | 9993 | /* Patch tree nodes in a function body. When a BLOCK is found, push |
5b09b33e PB |
9994 | local variable decls if present. |
9995 | Same as java_complete_lhs, but does resolve static finals to values. */ | |
8b27f225 PB |
9996 | |
9997 | static tree | |
9998 | java_complete_tree (node) | |
9999 | tree node; | |
5b09b33e PB |
10000 | { |
10001 | node = java_complete_lhs (node); | |
10002 | if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node) | |
10003 | && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE) | |
10004 | { | |
10005 | tree value = DECL_INITIAL (node); | |
10006 | DECL_INITIAL (node) = NULL_TREE; | |
10007 | value = fold_constant_for_init (value, node); | |
10008 | DECL_INITIAL (node) = value; | |
10009 | if (value != NULL_TREE) | |
10010 | return value; | |
10011 | } | |
10012 | return node; | |
10013 | } | |
10014 | ||
10015 | /* Patch tree nodes in a function body. When a BLOCK is found, push | |
10016 | local variable decls if present. | |
10017 | Same as java_complete_tree, but does not resolve static finals to values. */ | |
10018 | ||
10019 | static tree | |
10020 | java_complete_lhs (node) | |
10021 | tree node; | |
8b27f225 | 10022 | { |
22eed1e6 | 10023 | tree nn, cn, wfl_op1, wfl_op2, wfl_op3; |
8b27f225 PB |
10024 | int flag; |
10025 | ||
10026 | /* CONVERT_EXPR always has its type set, even though it needs to be | |
10027 | worked out. */ | |
10028 | if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR) | |
10029 | return node; | |
10030 | ||
10031 | /* The switch block implements cases processing container nodes | |
10032 | first. Contained nodes are always written back. Leaves come | |
10033 | next and return a value. */ | |
10034 | switch (TREE_CODE (node)) | |
10035 | { | |
10036 | case BLOCK: | |
10037 | ||
10038 | /* 1- Block section. | |
10039 | Set the local values on decl names so we can identify them | |
10040 | faster when they're referenced. At that stage, identifiers | |
10041 | are legal so we don't check for declaration errors. */ | |
10042 | for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn)) | |
10043 | { | |
10044 | DECL_CONTEXT (cn) = current_function_decl; | |
10045 | IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn; | |
10046 | INITIALIZED_P (cn) = 0; | |
10047 | } | |
12472854 PB |
10048 | if (BLOCK_EXPR_BODY (node) == NULL_TREE) |
10049 | CAN_COMPLETE_NORMALLY (node) = 1; | |
10050 | else | |
8b27f225 | 10051 | { |
12472854 PB |
10052 | tree stmt = BLOCK_EXPR_BODY (node); |
10053 | tree *ptr; | |
10054 | int error_seen = 0; | |
10055 | if (TREE_CODE (stmt) == COMPOUND_EXPR) | |
10056 | { | |
c877974e APB |
10057 | /* Re-order from (((A; B); C); ...; Z) to |
10058 | (A; (B; (C ; (...; Z)))). | |
12472854 PB |
10059 | This makes it easier to scan the statements left-to-right |
10060 | without using recursion (which might overflow the stack | |
10061 | if the block has many statements. */ | |
10062 | for (;;) | |
10063 | { | |
10064 | tree left = TREE_OPERAND (stmt, 0); | |
10065 | if (TREE_CODE (left) != COMPOUND_EXPR) | |
10066 | break; | |
10067 | TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1); | |
10068 | TREE_OPERAND (left, 1) = stmt; | |
10069 | stmt = left; | |
10070 | } | |
10071 | BLOCK_EXPR_BODY (node) = stmt; | |
10072 | } | |
10073 | ||
c877974e APB |
10074 | /* Now do the actual complete, without deep recursion for |
10075 | long blocks. */ | |
12472854 PB |
10076 | ptr = &BLOCK_EXPR_BODY (node); |
10077 | while (TREE_CODE (*ptr) == COMPOUND_EXPR) | |
10078 | { | |
10079 | tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0)); | |
10080 | tree *next = &TREE_OPERAND (*ptr, 1); | |
10081 | TREE_OPERAND (*ptr, 0) = cur; | |
10082 | if (TREE_CODE (cur) == ERROR_MARK) | |
10083 | error_seen++; | |
10084 | else if (! CAN_COMPLETE_NORMALLY (cur)) | |
10085 | { | |
10086 | wfl_op2 = *next; | |
10087 | for (;;) | |
10088 | { | |
10089 | if (TREE_CODE (wfl_op2) == BLOCK) | |
10090 | wfl_op2 = BLOCK_EXPR_BODY (wfl_op2); | |
10091 | else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR) | |
10092 | wfl_op2 = TREE_OPERAND (wfl_op2, 0); | |
10093 | else | |
10094 | break; | |
10095 | } | |
10096 | if (TREE_CODE (wfl_op2) != CASE_EXPR | |
ac825856 APB |
10097 | && TREE_CODE (wfl_op2) != DEFAULT_EXPR |
10098 | && wfl_op2 != empty_stmt_node) | |
82371d41 | 10099 | unreachable_stmt_error (*ptr); |
12472854 PB |
10100 | } |
10101 | ptr = next; | |
10102 | } | |
10103 | *ptr = java_complete_tree (*ptr); | |
10104 | ||
10105 | if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0) | |
8b27f225 | 10106 | return error_mark_node; |
12472854 | 10107 | CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr); |
8b27f225 PB |
10108 | } |
10109 | /* Turn local bindings to null */ | |
10110 | for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn)) | |
10111 | IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE; | |
10112 | ||
10113 | TREE_TYPE (node) = void_type_node; | |
10114 | break; | |
10115 | ||
10116 | /* 2- They are expressions but ultimately deal with statements */ | |
10117 | ||
10118 | case THROW_EXPR: | |
10119 | wfl_op1 = TREE_OPERAND (node, 0); | |
10120 | COMPLETE_CHECK_OP_0 (node); | |
12472854 | 10121 | /* CAN_COMPLETE_NORMALLY (node) = 0; */ |
8b27f225 PB |
10122 | return patch_throw_statement (node, wfl_op1); |
10123 | ||
10124 | case SYNCHRONIZED_EXPR: | |
10125 | wfl_op1 = TREE_OPERAND (node, 0); | |
10126 | COMPLETE_CHECK_OP_0 (node); | |
10127 | COMPLETE_CHECK_OP_1 (node); | |
10128 | return patch_synchronized_statement (node, wfl_op1); | |
10129 | ||
10130 | case TRY_EXPR: | |
10131 | return patch_try_statement (node); | |
10132 | ||
10133 | case LABELED_BLOCK_EXPR: | |
10134 | PUSH_LABELED_BLOCK (node); | |
10135 | if (LABELED_BLOCK_BODY (node)) | |
10136 | COMPLETE_CHECK_OP_1 (node); | |
10137 | TREE_TYPE (node) = void_type_node; | |
10138 | POP_LABELED_BLOCK (); | |
12472854 PB |
10139 | if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node))) |
10140 | CAN_COMPLETE_NORMALLY (node) = 1; | |
8b27f225 PB |
10141 | return node; |
10142 | ||
10143 | case EXIT_BLOCK_EXPR: | |
10144 | /* We don't complete operand 1, because it's the return value of | |
10145 | the EXIT_BLOCK_EXPR which doesn't exist it Java */ | |
10146 | return patch_bc_statement (node); | |
10147 | ||
12472854 PB |
10148 | case CASE_EXPR: |
10149 | cn = java_complete_tree (TREE_OPERAND (node, 0)); | |
10150 | if (cn == error_mark_node) | |
10151 | return cn; | |
10152 | ||
10153 | /* First, the case expression must be constant */ | |
10154 | cn = fold (cn); | |
10155 | ||
10156 | if (!TREE_CONSTANT (cn)) | |
10157 | { | |
10158 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
10159 | parse_error_context (node, "Constant expression required"); | |
10160 | return error_mark_node; | |
10161 | } | |
10162 | ||
10163 | nn = ctxp->current_loop; | |
10164 | ||
10165 | /* It must be assignable to the type of the switch expression. */ | |
c877974e APB |
10166 | if (!try_builtin_assignconv (NULL_TREE, |
10167 | TREE_TYPE (TREE_OPERAND (nn, 0)), cn)) | |
12472854 PB |
10168 | { |
10169 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
10170 | parse_error_context | |
10171 | (wfl_operator, | |
10172 | "Incompatible type for case. Can't convert `%s' to `int'", | |
10173 | lang_printable_name (TREE_TYPE (cn), 0)); | |
10174 | return error_mark_node; | |
10175 | } | |
10176 | ||
10177 | cn = fold (convert (int_type_node, cn)); | |
10178 | ||
10179 | /* Multiple instance of a case label bearing the same | |
10180 | value is checked during code generation. The case | |
10181 | expression is allright so far. */ | |
10182 | TREE_OPERAND (node, 0) = cn; | |
c877974e | 10183 | TREE_TYPE (node) = void_type_node; |
12472854 | 10184 | CAN_COMPLETE_NORMALLY (node) = 1; |
23a79c61 | 10185 | TREE_SIDE_EFFECTS (node) = 1; |
12472854 PB |
10186 | break; |
10187 | ||
10188 | case DEFAULT_EXPR: | |
10189 | nn = ctxp->current_loop; | |
10190 | /* Only one default label is allowed per switch statement */ | |
10191 | if (SWITCH_HAS_DEFAULT (nn)) | |
10192 | { | |
10193 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
10194 | parse_error_context (wfl_operator, | |
10195 | "Duplicate case label: `default'"); | |
10196 | return error_mark_node; | |
10197 | } | |
10198 | else | |
10199 | SWITCH_HAS_DEFAULT (nn) = 1; | |
c877974e | 10200 | TREE_TYPE (node) = void_type_node; |
23a79c61 | 10201 | TREE_SIDE_EFFECTS (node) = 1; |
12472854 PB |
10202 | CAN_COMPLETE_NORMALLY (node) = 1; |
10203 | break; | |
10204 | ||
8b27f225 PB |
10205 | case SWITCH_EXPR: |
10206 | case LOOP_EXPR: | |
10207 | PUSH_LOOP (node); | |
10208 | /* Check whether the loop was enclosed in a labeled | |
10209 | statement. If not, create one, insert the loop in it and | |
10210 | return the node */ | |
10211 | nn = patch_loop_statement (node); | |
10212 | ||
10213 | /* Anyways, walk the body of the loop */ | |
10214 | if (TREE_CODE (node) == LOOP_EXPR) | |
10215 | TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); | |
10216 | /* Switch statement: walk the switch expression and the cases */ | |
10217 | else | |
10218 | node = patch_switch_statement (node); | |
10219 | ||
10220 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
10221 | return error_mark_node; | |
10222 | TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node; | |
10223 | /* If we returned something different, that's because we | |
10224 | inserted a label. Pop the label too. */ | |
10225 | if (nn != node) | |
12472854 PB |
10226 | { |
10227 | if (CAN_COMPLETE_NORMALLY (node)) | |
10228 | CAN_COMPLETE_NORMALLY (nn) = 1; | |
10229 | POP_LABELED_BLOCK (); | |
10230 | } | |
8b27f225 PB |
10231 | POP_LOOP (); |
10232 | return nn; | |
10233 | ||
10234 | case EXIT_EXPR: | |
10235 | TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); | |
10236 | return patch_exit_expr (node); | |
10237 | ||
10238 | case COND_EXPR: | |
10239 | /* Condition */ | |
10240 | TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); | |
10241 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
10242 | return error_mark_node; | |
10243 | /* then-else branches */ | |
10244 | TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1)); | |
10245 | if (TREE_OPERAND (node, 1) == error_mark_node) | |
10246 | return error_mark_node; | |
10247 | TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2)); | |
10248 | if (TREE_OPERAND (node, 2) == error_mark_node) | |
10249 | return error_mark_node; | |
10250 | return patch_if_else_statement (node); | |
10251 | break; | |
10252 | ||
22eed1e6 APB |
10253 | case CONDITIONAL_EXPR: |
10254 | /* Condition */ | |
10255 | wfl_op1 = TREE_OPERAND (node, 0); | |
10256 | COMPLETE_CHECK_OP_0 (node); | |
10257 | wfl_op2 = TREE_OPERAND (node, 1); | |
10258 | COMPLETE_CHECK_OP_1 (node); | |
10259 | wfl_op3 = TREE_OPERAND (node, 2); | |
10260 | COMPLETE_CHECK_OP_2 (node); | |
10261 | return patch_conditional_expr (node, wfl_op1, wfl_op2); | |
10262 | ||
8b27f225 PB |
10263 | /* 3- Expression section */ |
10264 | case COMPOUND_EXPR: | |
12472854 | 10265 | wfl_op2 = TREE_OPERAND (node, 1); |
ac825856 APB |
10266 | TREE_OPERAND (node, 0) = nn = |
10267 | java_complete_tree (TREE_OPERAND (node, 0)); | |
10268 | if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK | |
10269 | && TREE_OPERAND (node, 1) != empty_stmt_node) | |
12472854 PB |
10270 | { |
10271 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op2); | |
10272 | parse_error_context (wfl_operator, "Unreachable statement"); | |
10273 | } | |
8b27f225 PB |
10274 | TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1)); |
10275 | if (TREE_OPERAND (node, 1) == error_mark_node) | |
10276 | return error_mark_node; | |
10277 | TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1)); | |
12472854 PB |
10278 | CAN_COMPLETE_NORMALLY (node) |
10279 | = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)); | |
8b27f225 PB |
10280 | break; |
10281 | ||
10282 | case RETURN_EXPR: | |
12472854 | 10283 | /* CAN_COMPLETE_NORMALLY (node) = 0; */ |
8b27f225 PB |
10284 | return patch_return (node); |
10285 | ||
10286 | case EXPR_WITH_FILE_LOCATION: | |
10287 | if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */ | |
10288 | || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE) | |
12472854 PB |
10289 | { |
10290 | node = resolve_expression_name (node, NULL); | |
10291 | CAN_COMPLETE_NORMALLY (node) = 1; | |
10292 | } | |
8b27f225 PB |
10293 | else |
10294 | { | |
5b09b33e PB |
10295 | tree body; |
10296 | int save_lineno = lineno; | |
10297 | lineno = EXPR_WFL_LINENO (node); | |
10298 | body = java_complete_tree (EXPR_WFL_NODE (node)); | |
10299 | lineno = save_lineno; | |
12472854 | 10300 | EXPR_WFL_NODE (node) = body; |
8b27f225 | 10301 | TREE_SIDE_EFFECTS (node) = 1; |
12472854 | 10302 | CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body); |
8b27f225 PB |
10303 | if (EXPR_WFL_NODE (node) == error_mark_node) |
10304 | { | |
10305 | /* Its important for the evaluation of assignment that | |
10306 | this mark on the TREE_TYPE is propagated. */ | |
10307 | TREE_TYPE (node) = error_mark_node; | |
10308 | return error_mark_node; | |
10309 | } | |
10310 | else | |
10311 | TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node)); | |
12472854 | 10312 | |
8b27f225 PB |
10313 | } |
10314 | break; | |
10315 | ||
10316 | case NEW_ARRAY_EXPR: | |
10317 | /* Patch all the dimensions */ | |
10318 | flag = 0; | |
10319 | for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn)) | |
10320 | { | |
10321 | int location = EXPR_WFL_LINECOL (TREE_VALUE (cn)); | |
10322 | tree dim = java_complete_tree (TREE_VALUE (cn)); | |
10323 | if (dim == error_mark_node) | |
10324 | { | |
10325 | flag = 1; | |
10326 | continue; | |
10327 | } | |
10328 | else | |
10329 | { | |
10330 | TREE_VALUE (cn) = dim; | |
10331 | /* Setup the location of the current dimension, for | |
10332 | later error report. */ | |
10333 | TREE_PURPOSE (cn) = | |
10334 | build_expr_wfl (NULL_TREE, input_filename, 0, 0); | |
10335 | EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location; | |
10336 | } | |
10337 | } | |
10338 | /* They complete the array creation expression, if no errors | |
10339 | were found. */ | |
12472854 | 10340 | CAN_COMPLETE_NORMALLY (node) = 1; |
8b27f225 PB |
10341 | return (flag ? error_mark_node : patch_newarray (node)); |
10342 | ||
10343 | case NEW_CLASS_EXPR: | |
10344 | case CALL_EXPR: | |
10345 | /* Complete function's argument(s) first */ | |
10346 | if (complete_function_arguments (node)) | |
10347 | return error_mark_node; | |
10348 | else | |
10349 | { | |
22eed1e6 APB |
10350 | tree decl, wfl = TREE_OPERAND (node, 0); |
10351 | int in_this = CALL_THIS_CONSTRUCTOR_P (node); | |
10352 | ||
c877974e | 10353 | node = patch_method_invocation (node, NULL_TREE, |
ac825856 | 10354 | NULL_TREE, 0, &decl); |
c877974e APB |
10355 | if (node == error_mark_node) |
10356 | return error_mark_node; | |
10357 | ||
10358 | check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl); | |
10359 | /* If we call this(...), register signature and positions */ | |
10360 | if (in_this) | |
10361 | DECL_CONSTRUCTOR_CALLS (current_function_decl) = | |
10362 | tree_cons (wfl, decl, | |
10363 | DECL_CONSTRUCTOR_CALLS (current_function_decl)); | |
82371d41 | 10364 | CAN_COMPLETE_NORMALLY (node) = 1; |
8b27f225 PB |
10365 | return node; |
10366 | } | |
10367 | ||
10368 | case MODIFY_EXPR: | |
10369 | /* Save potential wfls */ | |
10370 | wfl_op1 = TREE_OPERAND (node, 0); | |
10371 | wfl_op2 = TREE_OPERAND (node, 1); | |
5b09b33e | 10372 | TREE_OPERAND (node, 0) = java_complete_lhs (wfl_op1); |
8b27f225 PB |
10373 | if (TREE_OPERAND (node, 0) == error_mark_node) |
10374 | return error_mark_node; | |
10375 | ||
10376 | if (COMPOUND_ASSIGN_P (wfl_op2)) | |
10377 | { | |
10378 | tree lvalue; | |
10379 | tree other = | |
10380 | java_complete_tree (TREE_OPERAND (wfl_op2, 0)); | |
10381 | ||
10382 | /* Hand stablize the lhs on both places */ | |
10383 | lvalue = stabilize_reference (other); | |
10384 | TREE_OPERAND (node, 0) = lvalue; | |
10385 | TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue; | |
10386 | } | |
10387 | ||
f8976021 APB |
10388 | /* If we're about to patch a NEW_ARRAY_INIT, we call a special |
10389 | function to complete this RHS */ | |
10390 | if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT) | |
63a212ed | 10391 | nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)), |
f8976021 APB |
10392 | TREE_OPERAND (node, 1)); |
10393 | else | |
10394 | nn = java_complete_tree (TREE_OPERAND (node, 1)); | |
10395 | ||
8b27f225 PB |
10396 | /* There are cases where the type of RHS is fixed. In those |
10397 | cases, if the evaluation of the RHS fails, we further the | |
10398 | evaluation of the assignment to detect more errors. */ | |
8b27f225 PB |
10399 | if (nn == error_mark_node) |
10400 | { | |
c877974e APB |
10401 | /* It's hopeless, but we can further things on to discover |
10402 | an error during the assignment. In any cases, the | |
10403 | assignment operation fails. */ | |
10404 | if (TREE_CODE (TREE_OPERAND (node, 1)) != EXPR_WITH_FILE_LOCATION | |
f8976021 | 10405 | && TREE_CODE (TREE_OPERAND (node, 1)) != NEW_ARRAY_INIT |
c877974e APB |
10406 | && TREE_TYPE (TREE_OPERAND (node, 1)) != error_mark_node) |
10407 | patch_assignment (node, wfl_op1, wfl_op2); | |
10408 | ||
8b27f225 PB |
10409 | /* Now, we still mark the lhs as initialized */ |
10410 | if (DECL_P (TREE_OPERAND (node, 0))) | |
10411 | INITIALIZED_P (TREE_OPERAND (node, 0)) = 1; | |
10412 | ||
10413 | return error_mark_node; | |
10414 | } | |
10415 | TREE_OPERAND (node, 1) = nn; | |
10416 | ||
10417 | /* In case we're handling = with a String as a RHS, we need to | |
10418 | produce a String out of the RHS (it might still be a | |
10419 | STRING_CST or a StringBuffer at this stage */ | |
10420 | if ((nn = patch_string (TREE_OPERAND (node, 1)))) | |
10421 | TREE_OPERAND (node, 1) = nn; | |
12472854 PB |
10422 | node = patch_assignment (node, wfl_op1, wfl_op2); |
10423 | CAN_COMPLETE_NORMALLY (node) = 1; | |
63a212ed PB |
10424 | |
10425 | /* Before returning the node, in the context of a static field | |
10426 | assignment in <clinit>, we may want to carray further | |
10427 | optimizations. (VAR_DECL means it's a static field. See | |
10428 | add_field. */ | |
10429 | if (DECL_NAME (current_function_decl) == clinit_identifier_node | |
5b09b33e | 10430 | && MODIFY_EXPR_FROM_INITIALIZATION_P (node) |
63a212ed PB |
10431 | && TREE_CODE (TREE_OPERAND (node, 0)) == VAR_DECL) |
10432 | node = patch_initialized_static_field (node); | |
10433 | ||
12472854 | 10434 | return node; |
8b27f225 PB |
10435 | |
10436 | case MULT_EXPR: | |
10437 | case PLUS_EXPR: | |
10438 | case MINUS_EXPR: | |
10439 | case LSHIFT_EXPR: | |
10440 | case RSHIFT_EXPR: | |
10441 | case URSHIFT_EXPR: | |
10442 | case BIT_AND_EXPR: | |
10443 | case BIT_XOR_EXPR: | |
10444 | case BIT_IOR_EXPR: | |
10445 | case TRUNC_MOD_EXPR: | |
10446 | case RDIV_EXPR: | |
10447 | case TRUTH_ANDIF_EXPR: | |
10448 | case TRUTH_ORIF_EXPR: | |
10449 | case EQ_EXPR: | |
10450 | case NE_EXPR: | |
10451 | case GT_EXPR: | |
10452 | case GE_EXPR: | |
10453 | case LT_EXPR: | |
10454 | case LE_EXPR: | |
10455 | /* Operands 0 and 1 are WFL in certain cases only. patch_binop | |
10456 | knows how to handle those cases. */ | |
10457 | wfl_op1 = TREE_OPERAND (node, 0); | |
10458 | wfl_op2 = TREE_OPERAND (node, 1); | |
10459 | ||
12472854 | 10460 | CAN_COMPLETE_NORMALLY (node) = 1; |
8b27f225 PB |
10461 | /* Don't complete string nodes if dealing with the PLUS operand. */ |
10462 | if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1)) | |
10463 | { | |
10464 | TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1); | |
10465 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
10466 | return error_mark_node; | |
10467 | } | |
10468 | if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2)) | |
10469 | { | |
10470 | TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2); | |
10471 | if (TREE_OPERAND (node, 1) == error_mark_node) | |
10472 | return error_mark_node; | |
10473 | } | |
10474 | return patch_binop (node, wfl_op1, wfl_op2); | |
10475 | ||
5e942c50 APB |
10476 | case INSTANCEOF_EXPR: |
10477 | wfl_op1 = TREE_OPERAND (node, 0); | |
10478 | COMPLETE_CHECK_OP_0 (node); | |
10479 | return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1)); | |
10480 | ||
8b27f225 PB |
10481 | case UNARY_PLUS_EXPR: |
10482 | case NEGATE_EXPR: | |
10483 | case TRUTH_NOT_EXPR: | |
10484 | case BIT_NOT_EXPR: | |
10485 | case PREDECREMENT_EXPR: | |
10486 | case PREINCREMENT_EXPR: | |
10487 | case POSTDECREMENT_EXPR: | |
10488 | case POSTINCREMENT_EXPR: | |
10489 | case CONVERT_EXPR: | |
10490 | /* There are cases were wfl_op1 is a WFL. patch_unaryop knows | |
10491 | how to handle those cases. */ | |
10492 | wfl_op1 = TREE_OPERAND (node, 0); | |
12472854 | 10493 | CAN_COMPLETE_NORMALLY (node) = 1; |
8b27f225 PB |
10494 | TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1); |
10495 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
10496 | return error_mark_node; | |
4a5f66c3 APB |
10497 | node = patch_unaryop (node, wfl_op1); |
10498 | CAN_COMPLETE_NORMALLY (node) = 1; | |
10499 | break; | |
8b27f225 PB |
10500 | |
10501 | case ARRAY_REF: | |
10502 | /* There are cases were wfl_op1 is a WFL. patch_array_ref knows | |
10503 | how to handle those cases. */ | |
10504 | wfl_op1 = TREE_OPERAND (node, 0); | |
10505 | TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1); | |
10506 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
10507 | return error_mark_node; | |
10508 | if (!flag_emit_class_files) | |
10509 | TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0)); | |
10510 | /* The same applies to wfl_op2 */ | |
10511 | wfl_op2 = TREE_OPERAND (node, 1); | |
10512 | TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2); | |
10513 | if (TREE_OPERAND (node, 1) == error_mark_node) | |
10514 | return error_mark_node; | |
22eed1e6 APB |
10515 | if (!flag_emit_class_files) |
10516 | TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1)); | |
c877974e APB |
10517 | return patch_array_ref (node); |
10518 | ||
63a212ed PB |
10519 | case RECORD_TYPE: |
10520 | return node;; | |
10521 | ||
10522 | case COMPONENT_REF: | |
10523 | /* The first step in the re-write of qualified name handling. FIXME. | |
10524 | So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */ | |
c877974e | 10525 | TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); |
63a212ed PB |
10526 | if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE) |
10527 | { | |
10528 | tree name = TREE_OPERAND (node, 1); | |
10529 | tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name); | |
10530 | if (field == NULL_TREE) | |
10531 | { | |
10532 | error ("missing static field `%s'", IDENTIFIER_POINTER (name)); | |
10533 | return error_mark_node; | |
10534 | } | |
10535 | if (! FIELD_STATIC (field)) | |
10536 | { | |
10537 | error ("not a static field `%s'", IDENTIFIER_POINTER (name)); | |
10538 | return error_mark_node; | |
10539 | } | |
10540 | return field; | |
10541 | } | |
10542 | else | |
10543 | fatal ("unimplemented java_complete_tree for COMPONENT_REF"); | |
c877974e | 10544 | break; |
8b27f225 PB |
10545 | |
10546 | case THIS_EXPR: | |
10547 | /* Can't use THIS in a static environment */ | |
10548 | if (!current_this) | |
10549 | { | |
10550 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
10551 | parse_error_context (wfl_operator, "Keyword `this' used outside " | |
10552 | "allowed context"); | |
10553 | TREE_TYPE (node) = error_mark_node; | |
10554 | return error_mark_node; | |
10555 | } | |
22eed1e6 APB |
10556 | if (ctxp->explicit_constructor_p) |
10557 | { | |
10558 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
10559 | parse_error_context | |
10560 | (wfl_operator, "Can't reference `this' or `super' before the " | |
10561 | "superclass constructor has been called"); | |
10562 | TREE_TYPE (node) = error_mark_node; | |
10563 | return error_mark_node; | |
10564 | } | |
8b27f225 PB |
10565 | return current_this; |
10566 | ||
10567 | default: | |
12472854 | 10568 | CAN_COMPLETE_NORMALLY (node) = 1; |
8b27f225 PB |
10569 | /* Ok: may be we have a STRING_CST or a crafted `StringBuffer' |
10570 | and it's time to turn it into the appropriate String object | |
10571 | */ | |
10572 | if ((node = patch_string (node))) | |
10573 | return node; | |
10574 | fatal ("No case for tree code `%s' - java_complete_tree\n", | |
10575 | tree_code_name [TREE_CODE (node)]); | |
10576 | } | |
10577 | return node; | |
10578 | } | |
10579 | ||
10580 | /* Complete function call's argument. Return a non zero value is an | |
10581 | error was found. */ | |
10582 | ||
10583 | static int | |
10584 | complete_function_arguments (node) | |
10585 | tree node; | |
10586 | { | |
10587 | int flag = 0; | |
10588 | tree cn; | |
10589 | ||
22eed1e6 | 10590 | ctxp->explicit_constructor_p += (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0); |
8b27f225 PB |
10591 | for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn)) |
10592 | { | |
10593 | tree wfl = TREE_VALUE (cn), parm, temp; | |
10594 | parm = java_complete_tree (wfl); | |
10595 | if (parm == error_mark_node) | |
10596 | { | |
10597 | flag = 1; | |
10598 | continue; | |
10599 | } | |
10600 | /* If have a string literal that we haven't transformed yet or a | |
10601 | crafted string buffer, as a result of use of the the String | |
10602 | `+' operator. Build `parm.toString()' and expand it. */ | |
10603 | if ((temp = patch_string (parm))) | |
10604 | parm = temp; | |
5e942c50 APB |
10605 | /* Inline PRIMTYPE.TYPE read access */ |
10606 | parm = maybe_build_primttype_type_ref (parm, wfl); | |
8b27f225 | 10607 | |
5e942c50 | 10608 | TREE_VALUE (cn) = parm; |
8b27f225 | 10609 | } |
22eed1e6 | 10610 | ctxp->explicit_constructor_p -= (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0); |
8b27f225 PB |
10611 | return flag; |
10612 | } | |
10613 | ||
10614 | /* Sometimes (for loops and variable initialized during their | |
10615 | declaration), we want to wrap a statement around a WFL and turn it | |
10616 | debugable. */ | |
10617 | ||
10618 | static tree | |
10619 | build_debugable_stmt (location, stmt) | |
10620 | int location; | |
10621 | tree stmt; | |
10622 | { | |
10623 | if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION) | |
10624 | { | |
10625 | stmt = build_expr_wfl (stmt, input_filename, 0, 0); | |
10626 | EXPR_WFL_LINECOL (stmt) = location; | |
10627 | } | |
10628 | JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt); | |
10629 | return stmt; | |
10630 | } | |
10631 | ||
10632 | static tree | |
10633 | build_expr_block (body, decls) | |
10634 | tree body, decls; | |
10635 | { | |
10636 | tree node = make_node (BLOCK); | |
10637 | BLOCK_EXPR_DECLS (node) = decls; | |
10638 | BLOCK_EXPR_BODY (node) = body; | |
10639 | if (body) | |
10640 | TREE_TYPE (node) = TREE_TYPE (body); | |
10641 | TREE_SIDE_EFFECTS (node) = 1; | |
10642 | return node; | |
10643 | } | |
10644 | ||
10645 | /* Create a new function block and link it approriately to current | |
10646 | function block chain */ | |
10647 | ||
10648 | static tree | |
10649 | enter_block () | |
10650 | { | |
10651 | return (enter_a_block (build_expr_block (NULL_TREE, NULL_TREE))); | |
10652 | } | |
10653 | ||
10654 | /* Link block B supercontext to the previous block. The current | |
10655 | function DECL is used as supercontext when enter_a_block is called | |
10656 | for the first time for a given function. The current function body | |
10657 | (DECL_FUNCTION_BODY) is set to be block B. */ | |
10658 | ||
10659 | static tree | |
10660 | enter_a_block (b) | |
10661 | tree b; | |
10662 | { | |
10663 | tree fndecl = current_function_decl; | |
10664 | ||
10665 | if (!DECL_FUNCTION_BODY (fndecl)) | |
10666 | { | |
10667 | BLOCK_SUPERCONTEXT (b) = fndecl; | |
10668 | DECL_FUNCTION_BODY (fndecl) = b; | |
10669 | } | |
10670 | else | |
10671 | { | |
10672 | BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl); | |
10673 | DECL_FUNCTION_BODY (fndecl) = b; | |
10674 | } | |
10675 | return b; | |
10676 | } | |
10677 | ||
10678 | /* Exit a block by changing the current function body | |
10679 | (DECL_FUNCTION_BODY) to the current block super context, only if | |
10680 | the block being exited isn't the method's top level one. */ | |
10681 | ||
10682 | static tree | |
10683 | exit_block () | |
10684 | { | |
10685 | tree b = DECL_FUNCTION_BODY (current_function_decl); | |
10686 | ||
10687 | if (BLOCK_SUPERCONTEXT (b) != current_function_decl) | |
10688 | DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b); | |
10689 | ||
10690 | return b; | |
10691 | } | |
10692 | ||
10693 | /* Lookup for NAME in the nested function's blocks, all the way up to | |
10694 | the current toplevel one. It complies with Java's local variable | |
10695 | scoping rules. */ | |
10696 | ||
10697 | static tree | |
10698 | lookup_name_in_blocks (name) | |
10699 | tree name; | |
10700 | { | |
10701 | tree b = DECL_FUNCTION_BODY (current_function_decl); | |
10702 | ||
10703 | while (b != current_function_decl) | |
10704 | { | |
10705 | tree current; | |
10706 | ||
10707 | /* Paranoid sanity check. To be removed */ | |
10708 | if (TREE_CODE (b) != BLOCK) | |
10709 | fatal ("non block expr function body - lookup_name_in_blocks"); | |
10710 | ||
10711 | for (current = BLOCK_EXPR_DECLS (b); current; | |
10712 | current = TREE_CHAIN (current)) | |
10713 | if (DECL_NAME (current) == name) | |
10714 | return current; | |
10715 | b = BLOCK_SUPERCONTEXT (b); | |
10716 | } | |
10717 | return NULL_TREE; | |
10718 | } | |
10719 | ||
10720 | static void | |
10721 | maybe_absorb_scoping_blocks () | |
10722 | { | |
10723 | while (BLOCK_EXPR_ORIGIN (DECL_FUNCTION_BODY (current_function_decl))) | |
10724 | { | |
10725 | tree b = exit_block (); | |
10726 | java_method_add_stmt (current_function_decl, b); | |
10727 | SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno)); | |
10728 | } | |
10729 | } | |
10730 | ||
10731 | \f | |
10732 | /* This section of the source is reserved to build_* functions that | |
10733 | are building incomplete tree nodes and the patch_* functions that | |
10734 | are completing them. */ | |
10735 | ||
c877974e | 10736 | /* Build a super() constructor invocation. Returns empty_stmt_node if |
22eed1e6 APB |
10737 | we're currently dealing with the class java.lang.Object. */ |
10738 | ||
10739 | static tree | |
10740 | build_super_invocation () | |
10741 | { | |
10742 | if (current_class == object_type_node) | |
c877974e | 10743 | return empty_stmt_node; |
22eed1e6 APB |
10744 | else |
10745 | { | |
10746 | tree super_wfl = build_wfl_node (super_identifier_node, | |
10747 | input_filename, 0, 0); | |
10748 | return build_method_invocation (super_wfl, NULL_TREE); | |
10749 | } | |
10750 | } | |
10751 | ||
10752 | /* Build a SUPER/THIS qualified method invocation. */ | |
10753 | ||
10754 | static tree | |
10755 | build_this_super_qualified_invocation (use_this, name, args, lloc, rloc) | |
10756 | int use_this; | |
10757 | tree name, args; | |
10758 | int lloc, rloc; | |
10759 | ||
10760 | { | |
10761 | tree invok; | |
10762 | tree wfl = | |
10763 | build_wfl_node ((use_this ? this_identifier_node : super_identifier_node), | |
10764 | input_filename, 0, 0); | |
10765 | EXPR_WFL_LINECOL (wfl) = lloc; | |
10766 | invok = build_method_invocation (name, args); | |
10767 | return make_qualified_primary (wfl, invok, rloc); | |
10768 | } | |
10769 | ||
8b27f225 PB |
10770 | /* Build an incomplete CALL_EXPR node. */ |
10771 | ||
10772 | static tree | |
10773 | build_method_invocation (name, args) | |
10774 | tree name; | |
10775 | tree args; | |
10776 | { | |
10777 | tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE); | |
10778 | TREE_SIDE_EFFECTS (call) = 1; | |
10779 | EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name); | |
10780 | return call; | |
10781 | } | |
10782 | ||
10783 | /* Build an incomplete new xxx(...) node. */ | |
10784 | ||
10785 | static tree | |
10786 | build_new_invocation (name, args) | |
10787 | tree name, args; | |
10788 | { | |
10789 | tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE); | |
10790 | TREE_SIDE_EFFECTS (call) = 1; | |
10791 | EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name); | |
10792 | return call; | |
10793 | } | |
10794 | ||
10795 | /* Build an incomplete assignment expression. */ | |
10796 | ||
10797 | static tree | |
10798 | build_assignment (op, op_location, lhs, rhs) | |
10799 | int op, op_location; | |
10800 | tree lhs, rhs; | |
10801 | { | |
10802 | tree assignment; | |
10803 | /* Build the corresponding binop if we deal with a Compound | |
10804 | Assignment operator. Mark the binop sub-tree as part of a | |
10805 | Compound Assignment expression */ | |
10806 | if (op != ASSIGN_TK) | |
10807 | { | |
10808 | rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs); | |
10809 | COMPOUND_ASSIGN_P (rhs) = 1; | |
10810 | } | |
10811 | assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs); | |
10812 | TREE_SIDE_EFFECTS (assignment) = 1; | |
10813 | EXPR_WFL_LINECOL (assignment) = op_location; | |
10814 | return assignment; | |
10815 | } | |
10816 | ||
10817 | /* Print an INTEGER_CST node in a static buffer, and return the buffer. */ | |
10818 | ||
12472854 | 10819 | char * |
8b27f225 PB |
10820 | print_int_node (node) |
10821 | tree node; | |
10822 | { | |
10823 | static char buffer [80]; | |
10824 | if (TREE_CONSTANT_OVERFLOW (node)) | |
10825 | sprintf (buffer, "<overflow>"); | |
10826 | ||
10827 | if (TREE_INT_CST_HIGH (node) == 0) | |
10828 | sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED, | |
10829 | TREE_INT_CST_LOW (node)); | |
10830 | else if (TREE_INT_CST_HIGH (node) == -1 | |
10831 | && TREE_INT_CST_LOW (node) != 0) | |
10832 | { | |
10833 | buffer [0] = '-'; | |
10834 | sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED, | |
10835 | -TREE_INT_CST_LOW (node)); | |
10836 | } | |
10837 | else | |
10838 | sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX, | |
10839 | TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node)); | |
10840 | ||
10841 | return buffer; | |
10842 | } | |
10843 | ||
5e942c50 APB |
10844 | /* Return 1 if you an assignment of a FINAL is attempted */ |
10845 | ||
10846 | static int | |
10847 | check_final_assignment (lvalue, wfl) | |
10848 | tree lvalue, wfl; | |
10849 | { | |
63a212ed PB |
10850 | if (DECL_P (lvalue) && FIELD_FINAL (lvalue) && |
10851 | DECL_NAME (current_function_decl) != clinit_identifier_node) | |
5e942c50 APB |
10852 | { |
10853 | parse_error_context | |
10854 | (wfl, "Can't assign a value to the final variable `%s'", | |
10855 | IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); | |
10856 | return 1; | |
10857 | } | |
10858 | return 0; | |
10859 | } | |
10860 | ||
10861 | /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in | |
10862 | read. This is needed to avoid circularities in the implementation | |
10863 | of these fields in libjava. */ | |
10864 | ||
10865 | static tree | |
10866 | maybe_build_primttype_type_ref (rhs, wfl) | |
10867 | tree rhs, wfl; | |
10868 | { | |
10869 | tree to_return = NULL_TREE; | |
10870 | tree rhs_type = TREE_TYPE (rhs); | |
10871 | if (TREE_CODE (rhs) == COMPOUND_EXPR) | |
10872 | { | |
10873 | tree n = TREE_OPERAND (rhs, 1); | |
10874 | if (TREE_CODE (n) == VAR_DECL | |
10875 | && DECL_NAME (n) == TYPE_identifier_node | |
10876 | && rhs_type == class_ptr_type) | |
10877 | { | |
10878 | char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)); | |
10879 | if (!strncmp (self_name, "java.lang.", 10)) | |
10880 | to_return = build_primtype_type_ref (self_name); | |
10881 | } | |
10882 | } | |
10883 | return (to_return ? to_return : rhs ); | |
10884 | } | |
10885 | ||
8b27f225 PB |
10886 | /* 15.25 Assignment operators. */ |
10887 | ||
10888 | static tree | |
10889 | patch_assignment (node, wfl_op1, wfl_op2) | |
10890 | tree node; | |
10891 | tree wfl_op1; | |
10892 | tree wfl_op2; | |
10893 | { | |
10894 | tree rhs = TREE_OPERAND (node, 1); | |
5e942c50 | 10895 | tree lvalue = TREE_OPERAND (node, 0), llvalue; |
8b27f225 PB |
10896 | tree lhs_type, rhs_type, new_rhs = NULL_TREE; |
10897 | int error_found = 0; | |
10898 | int lvalue_from_array = 0; | |
10899 | ||
10900 | /* Can't assign to a final. */ | |
5e942c50 APB |
10901 | if (check_final_assignment (lvalue, wfl_op1)) |
10902 | error_found = 1; | |
8b27f225 PB |
10903 | |
10904 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
10905 | ||
10906 | /* Lhs can be a named variable */ | |
10907 | if (DECL_P (lvalue)) | |
10908 | { | |
10909 | INITIALIZED_P (lvalue) = 1; | |
10910 | lhs_type = TREE_TYPE (lvalue); | |
10911 | } | |
10912 | /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME + | |
10913 | comment on reason why */ | |
10914 | else if (TREE_CODE (wfl_op1) == ARRAY_REF) | |
10915 | { | |
10916 | lhs_type = TREE_TYPE (lvalue); | |
10917 | lvalue_from_array = 1; | |
10918 | } | |
10919 | /* Or a field access */ | |
10920 | else if (TREE_CODE (lvalue) == COMPONENT_REF) | |
10921 | lhs_type = TREE_TYPE (lvalue); | |
10922 | /* Or a function return slot */ | |
10923 | else if (TREE_CODE (lvalue) == RESULT_DECL) | |
10924 | lhs_type = TREE_TYPE (lvalue); | |
5e942c50 APB |
10925 | /* Otherwise, we might want to try to write into an optimized static |
10926 | final, this is an of a different nature, reported further on. */ | |
10927 | else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION | |
10928 | && resolve_expression_name (wfl_op1, &llvalue) | |
10929 | && check_final_assignment (llvalue, wfl_op1)) | |
10930 | { | |
10931 | error_found = 1; | |
10932 | /* What we should do instead is resetting the all the flags | |
10933 | previously set, exchange lvalue for llvalue and continue. */ | |
10934 | return error_mark_node; | |
10935 | } | |
10936 | else | |
8b27f225 PB |
10937 | { |
10938 | parse_error_context (wfl_op1, "Invalid left hand side of assignment"); | |
10939 | error_found = 1; | |
10940 | } | |
10941 | ||
10942 | rhs_type = TREE_TYPE (rhs); | |
10943 | /* 5.1 Try the assignment conversion for builtin type. */ | |
10944 | new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs); | |
10945 | ||
10946 | /* 5.2 If it failed, try a reference conversion */ | |
10947 | if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs))) | |
10948 | lhs_type = promote_type (rhs_type); | |
10949 | ||
10950 | /* 15.25.2 If we have a compound assignment, convert RHS into the | |
10951 | type of the LHS */ | |
10952 | else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1))) | |
10953 | new_rhs = convert (lhs_type, rhs); | |
10954 | ||
10955 | /* Explicit cast required. This is an error */ | |
10956 | if (!new_rhs) | |
10957 | { | |
10958 | char *t1 = strdup (lang_printable_name (TREE_TYPE (rhs), 0)); | |
10959 | char *t2 = strdup (lang_printable_name (lhs_type, 0)); | |
10960 | tree wfl; | |
10961 | char operation [32]; /* Max size known */ | |
10962 | ||
10963 | /* If the assignment is part of a declaration, we use the WFL of | |
10964 | the declared variable to point out the error and call it a | |
10965 | declaration problem. If the assignment is a genuine = | |
10966 | operator, we call is a operator `=' problem, otherwise we | |
10967 | call it an assignment problem. In both of these last cases, | |
10968 | we use the WFL of the operator to indicate the error. */ | |
10969 | ||
10970 | if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)) | |
10971 | { | |
10972 | wfl = wfl_op1; | |
10973 | strcpy (operation, "declaration"); | |
10974 | } | |
10975 | else | |
10976 | { | |
10977 | wfl = wfl_operator; | |
10978 | if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1))) | |
10979 | strcpy (operation, "assignment"); | |
10980 | else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL) | |
10981 | strcpy (operation, "`return'"); | |
10982 | else | |
10983 | strcpy (operation, "`='"); | |
10984 | } | |
10985 | ||
10986 | parse_error_context | |
10987 | (wfl, (!valid_cast_to_p (rhs_type, lhs_type) ? | |
10988 | "Incompatible type for %s. Can't convert `%s' to `%s'" : | |
10989 | "Incompatible type for %s. Explicit cast " | |
10990 | "needed to convert `%s' to `%s'"), operation, t1, t2); | |
10991 | free (t1); free (t2); | |
10992 | error_found = 1; | |
10993 | } | |
10994 | ||
c877974e APB |
10995 | /* Inline read access to java.lang.PRIMTYPE.TYPE */ |
10996 | if (new_rhs) | |
10997 | new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2); | |
5e942c50 | 10998 | |
8b27f225 PB |
10999 | if (error_found) |
11000 | return error_mark_node; | |
11001 | ||
11002 | /* If we built a compound expression as the result of a reference | |
11003 | assignment into an array element, return it here. */ | |
11004 | if (TREE_CODE (node) == COMPOUND_EXPR) | |
11005 | return node; | |
22eed1e6 | 11006 | |
8b27f225 PB |
11007 | TREE_OPERAND (node, 0) = lvalue; |
11008 | TREE_OPERAND (node, 1) = new_rhs; | |
11009 | TREE_TYPE (node) = lhs_type; | |
11010 | return node; | |
11011 | } | |
11012 | ||
63a212ed PB |
11013 | /* Optimize static (final) field initialized upon declaration. |
11014 | - If the field is static final and is assigned to a primitive | |
11015 | constant type, then set its DECL_INITIAL to the value. | |
11016 | - More to come. */ | |
11017 | ||
11018 | static tree | |
11019 | patch_initialized_static_field (node) | |
11020 | tree node; | |
11021 | { | |
11022 | tree field = TREE_OPERAND (node, 0); | |
11023 | tree value = TREE_OPERAND (node, 1); | |
11024 | ||
5b09b33e | 11025 | if (DECL_INITIAL (field) != NULL_TREE) |
63a212ed | 11026 | { |
5b09b33e PB |
11027 | tree type = TREE_TYPE (value); |
11028 | if (FIELD_FINAL (field) && TREE_CONSTANT (value) | |
11029 | && (JPRIMITIVE_TYPE_P (type) | |
11030 | || (flag_emit_class_files | |
11031 | && TREE_CODE (type) == POINTER_TYPE | |
11032 | && TREE_TYPE (type) == string_type_node))) | |
11033 | { | |
11034 | DECL_INITIAL (field) = value; | |
11035 | return empty_stmt_node; | |
11036 | } | |
11037 | DECL_INITIAL (field) = NULL_TREE; | |
63a212ed PB |
11038 | } |
11039 | return node; | |
11040 | } | |
11041 | ||
8b27f225 PB |
11042 | /* Check that type SOURCE can be cast into type DEST. If the cast |
11043 | can't occur at all, return 0 otherwise 1. This function is used to | |
11044 | produce accurate error messages on the reasons why an assignment | |
11045 | failed. */ | |
11046 | ||
11047 | static tree | |
11048 | try_reference_assignconv (lhs_type, rhs) | |
11049 | tree lhs_type, rhs; | |
11050 | { | |
11051 | tree new_rhs = NULL_TREE; | |
11052 | tree rhs_type = TREE_TYPE (rhs); | |
11053 | ||
11054 | if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type)) | |
11055 | { | |
11056 | /* `null' may be assigned to any reference type */ | |
11057 | if (rhs == null_pointer_node) | |
11058 | new_rhs = null_pointer_node; | |
11059 | /* Try the reference assignment conversion */ | |
11060 | else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0)) | |
11061 | new_rhs = rhs; | |
11062 | /* This is a magic assignment that we process differently */ | |
11063 | else if (rhs == soft_exceptioninfo_call_node) | |
11064 | new_rhs = rhs; | |
11065 | } | |
11066 | return new_rhs; | |
11067 | } | |
11068 | ||
11069 | /* Check that RHS can be converted into LHS_TYPE by the assignment | |
11070 | conversion (5.2), for the cases of RHS being a builtin type. Return | |
11071 | NULL_TREE if the conversion fails or if because RHS isn't of a | |
11072 | builtin type. Return a converted RHS if the conversion is possible. */ | |
11073 | ||
11074 | static tree | |
11075 | try_builtin_assignconv (wfl_op1, lhs_type, rhs) | |
11076 | tree wfl_op1, lhs_type, rhs; | |
11077 | { | |
11078 | tree new_rhs = NULL_TREE; | |
11079 | tree rhs_type = TREE_TYPE (rhs); | |
11080 | ||
5e942c50 APB |
11081 | /* Zero accepted everywhere */ |
11082 | if (TREE_CODE (rhs) == INTEGER_CST | |
11083 | && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0 | |
11084 | && JPRIMITIVE_TYPE_P (rhs_type)) | |
11085 | new_rhs = convert (lhs_type, rhs); | |
11086 | ||
8b27f225 PB |
11087 | /* 5.1.1 Try Identity Conversion, |
11088 | 5.1.2 Try Widening Primitive Conversion */ | |
5e942c50 | 11089 | else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)) |
8b27f225 PB |
11090 | new_rhs = convert (lhs_type, rhs); |
11091 | ||
11092 | /* Try a narrowing primitive conversion (5.1.3): | |
11093 | - expression is a constant expression of type int AND | |
11094 | - variable is byte, short or char AND | |
11095 | - The value of the expression is representable in the type of the | |
11096 | variable */ | |
11097 | else if (rhs_type == int_type_node && TREE_CONSTANT (rhs) | |
11098 | && (lhs_type == byte_type_node || lhs_type == char_type_node | |
11099 | || lhs_type == short_type_node)) | |
11100 | { | |
11101 | if (int_fits_type_p (rhs, lhs_type)) | |
11102 | new_rhs = convert (lhs_type, rhs); | |
11103 | else if (wfl_op1) /* Might be called with a NULL */ | |
11104 | parse_warning_context | |
11105 | (wfl_op1, "Constant expression `%s' to wide for narrowing " | |
11106 | "primitive conversion to `%s'", | |
11107 | print_int_node (rhs), lang_printable_name (lhs_type, 0)); | |
11108 | /* Reported a warning that will turn into an error further | |
11109 | down, so we don't return */ | |
11110 | } | |
11111 | ||
11112 | return new_rhs; | |
11113 | } | |
11114 | ||
11115 | /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity | |
11116 | conversion (5.1.1) or widening primitve conversion (5.1.2). Return | |
11117 | 0 is the conversion test fails. This implements parts the method | |
11118 | invocation convertion (5.3). */ | |
11119 | ||
11120 | static int | |
11121 | valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type) | |
11122 | tree lhs_type, rhs_type; | |
11123 | { | |
5e942c50 APB |
11124 | int all_primitive; |
11125 | ||
11126 | if (lhs_type == rhs_type) | |
11127 | return 1; | |
11128 | ||
c877974e APB |
11129 | /* Sometimes, instead of passing a type, we pass integer_zero_node |
11130 | so we know that an integral type can accomodate it */ | |
11131 | if (JINTEGRAL_TYPE_P (lhs_type) && (rhs_type == integer_zero_node)) | |
11132 | return 1; | |
11133 | ||
5e942c50 | 11134 | all_primitive = |
8b27f225 PB |
11135 | JPRIMITIVE_TYPE_P (lhs_type) && JPRIMITIVE_TYPE_P (rhs_type); |
11136 | ||
11137 | if (!all_primitive) | |
11138 | return 0; | |
11139 | ||
8b27f225 PB |
11140 | /* byte, even if it's smaller than a char can't be converted into a |
11141 | char. Short can't too, but the < test below takes care of that */ | |
11142 | if (lhs_type == char_type_node && rhs_type == byte_type_node) | |
11143 | return 0; | |
11144 | ||
5e942c50 APB |
11145 | /* Accept all promoted type here. Note, we can't use <= in the test |
11146 | below, because we still need to bounce out assignments of short | |
11147 | to char and the likes */ | |
11148 | if (lhs_type == int_type_node | |
11149 | && (rhs_type == promoted_byte_type_node | |
11150 | || rhs_type == promoted_short_type_node | |
11151 | || rhs_type == promoted_char_type_node | |
11152 | || rhs_type == promoted_boolean_type_node)) | |
11153 | return 1; | |
11154 | ||
8b27f225 PB |
11155 | if (JINTEGRAL_TYPE_P (rhs_type) |
11156 | && ((TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)) | |
11157 | || (JFLOAT_TYPE_P (lhs_type) && | |
11158 | TYPE_PRECISION (rhs_type) == TYPE_PRECISION (lhs_type)))) | |
11159 | return 1; | |
11160 | else if (JFLOAT_TYPE_P (rhs_type) | |
11161 | && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type))) | |
11162 | return 1; | |
11163 | ||
11164 | return 0; | |
11165 | } | |
11166 | ||
11167 | /* Check that something of SOURCE type can be assigned or cast to | |
11168 | something of DEST type at runtime. Return 1 if the operation is | |
11169 | valid, 0 otherwise. If CAST is set to 1, we're treating the case | |
11170 | were SOURCE is cast into DEST, which borrows a lot of the | |
11171 | assignment check. */ | |
11172 | ||
11173 | static int | |
11174 | valid_ref_assignconv_cast_p (source, dest, cast) | |
11175 | tree source; | |
11176 | tree dest; | |
11177 | int cast; | |
11178 | { | |
5e942c50 APB |
11179 | if (JNULLP_TYPE_P (source)) |
11180 | return 1; | |
8b27f225 PB |
11181 | if (TREE_CODE (source) == POINTER_TYPE) |
11182 | source = TREE_TYPE (source); | |
11183 | if (TREE_CODE (dest) == POINTER_TYPE) | |
11184 | dest = TREE_TYPE (dest); | |
11185 | /* Case where SOURCE is a class type */ | |
11186 | if (TYPE_CLASS_P (source)) | |
11187 | { | |
11188 | if (TYPE_CLASS_P (dest)) | |
11189 | return source == dest || inherits_from_p (source, dest) | |
11190 | || (cast && inherits_from_p (dest, source)); | |
11191 | if (TYPE_INTERFACE_P (dest)) | |
11192 | { | |
11193 | /* If doing a cast and SOURCE is final, the operation is | |
11194 | always correct a compile time (because even if SOURCE | |
11195 | does not implement DEST, a subclass of SOURCE might). */ | |
11196 | if (cast && !CLASS_FINAL (TYPE_NAME (source))) | |
11197 | return 1; | |
11198 | /* Otherwise, SOURCE must implement DEST */ | |
11199 | return interface_of_p (dest, source); | |
11200 | } | |
11201 | /* DEST is an array, cast permited if SOURCE is of Object type */ | |
11202 | return (cast && source == object_type_node ? 1 : 0); | |
11203 | } | |
11204 | if (TYPE_INTERFACE_P (source)) | |
11205 | { | |
11206 | if (TYPE_CLASS_P (dest)) | |
11207 | { | |
11208 | /* If not casting, DEST must be the Object type */ | |
11209 | if (!cast) | |
11210 | return dest == object_type_node; | |
11211 | /* We're doing a cast. The cast is always valid is class | |
11212 | DEST is not final, otherwise, DEST must implement SOURCE */ | |
11213 | else if (!CLASS_FINAL (TYPE_NAME (dest))) | |
11214 | return 1; | |
11215 | else | |
11216 | return interface_of_p (source, dest); | |
11217 | } | |
11218 | if (TYPE_INTERFACE_P (dest)) | |
11219 | { | |
11220 | /* If doing a cast, then if SOURCE and DEST contain method | |
11221 | with the same signature but different return type, then | |
11222 | this is a (compile time) error */ | |
11223 | if (cast) | |
11224 | { | |
11225 | tree method_source, method_dest; | |
11226 | tree source_type; | |
11227 | tree source_sig; | |
11228 | tree source_name; | |
11229 | for (method_source = TYPE_METHODS (source); method_source; | |
11230 | method_source = TREE_CHAIN (method_source)) | |
11231 | { | |
11232 | source_sig = | |
11233 | build_java_argument_signature (TREE_TYPE (method_source)); | |
11234 | source_type = TREE_TYPE (TREE_TYPE (method_source)); | |
11235 | source_name = DECL_NAME (method_source); | |
11236 | for (method_dest = TYPE_METHODS (dest); | |
11237 | method_dest; method_dest = TREE_CHAIN (method_dest)) | |
11238 | if (source_sig == | |
11239 | build_java_argument_signature (TREE_TYPE (method_dest)) | |
11240 | && source_name == DECL_NAME (method_dest) | |
11241 | && source_type != TREE_TYPE (TREE_TYPE (method_dest))) | |
11242 | return 0; | |
11243 | } | |
11244 | return 1; | |
11245 | } | |
11246 | else | |
11247 | return source == dest || interface_of_p (dest, source); | |
11248 | } | |
11249 | else /* Array */ | |
11250 | return 0; | |
11251 | } | |
11252 | if (TYPE_ARRAY_P (source)) | |
11253 | { | |
11254 | if (TYPE_CLASS_P (dest)) | |
11255 | return dest == object_type_node; | |
11256 | if (TYPE_INTERFACE_P (dest)) | |
11257 | return 0; /* Install test on Clonable. FIXME */ | |
11258 | else /* Arrays */ | |
11259 | { | |
11260 | tree source_element_type = TYPE_ARRAY_ELEMENT (source); | |
11261 | tree dest_element_type = TYPE_ARRAY_ELEMENT (dest); | |
11262 | ||
11263 | /* In case of severe errors, they turn out null */ | |
11264 | if (!dest_element_type || !source_element_type) | |
11265 | return 0; | |
11266 | if (source_element_type == dest_element_type) | |
11267 | return 1; | |
11268 | return valid_ref_assignconv_cast_p (source_element_type, | |
11269 | dest_element_type, cast); | |
11270 | } | |
11271 | return 0; | |
11272 | } | |
11273 | return 0; | |
11274 | } | |
11275 | ||
11276 | static int | |
11277 | valid_cast_to_p (source, dest) | |
11278 | tree source; | |
11279 | tree dest; | |
11280 | { | |
11281 | if (TREE_CODE (source) == POINTER_TYPE) | |
11282 | source = TREE_TYPE (source); | |
11283 | if (TREE_CODE (dest) == POINTER_TYPE) | |
11284 | dest = TREE_TYPE (dest); | |
11285 | ||
11286 | if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE) | |
11287 | return valid_ref_assignconv_cast_p (source, dest, 1); | |
11288 | ||
11289 | else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest)) | |
11290 | return 1; | |
11291 | ||
11292 | return 0; | |
11293 | } | |
11294 | ||
11295 | /* Method invocation conversion test. Return 1 if type SOURCE can be | |
11296 | converted to type DEST through the methond invocation conversion | |
11297 | process (5.3) */ | |
11298 | ||
12472854 PB |
11299 | static tree |
11300 | do_unary_numeric_promotion (arg) | |
11301 | tree arg; | |
11302 | { | |
11303 | tree type = TREE_TYPE (arg); | |
11304 | if (TREE_CODE (type) == INTEGER_TYPE ? TYPE_PRECISION (type) < 32 | |
11305 | : TREE_CODE (type) == CHAR_TYPE) | |
11306 | arg = convert (int_type_node, arg); | |
11307 | return arg; | |
11308 | } | |
11309 | ||
8b27f225 PB |
11310 | static int |
11311 | valid_method_invocation_conversion_p (dest, source) | |
11312 | tree dest, source; | |
11313 | { | |
c877974e | 11314 | return (((JPRIMITIVE_TYPE_P (source) || (source == integer_zero_node)) |
8b27f225 PB |
11315 | && JPRIMITIVE_TYPE_P (dest) |
11316 | && valid_builtin_assignconv_identity_widening_p (dest, source)) | |
5e942c50 APB |
11317 | || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source)) |
11318 | && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest)) | |
8b27f225 PB |
11319 | && valid_ref_assignconv_cast_p (source, dest, 0))); |
11320 | } | |
11321 | ||
11322 | /* Build an incomplete binop expression. */ | |
11323 | ||
11324 | static tree | |
11325 | build_binop (op, op_location, op1, op2) | |
11326 | enum tree_code op; | |
11327 | int op_location; | |
11328 | tree op1, op2; | |
11329 | { | |
5e942c50 | 11330 | tree binop = build (op, NULL_TREE, op1, op2); |
8b27f225 PB |
11331 | TREE_SIDE_EFFECTS (binop) = 1; |
11332 | /* Store the location of the operator, for better error report. The | |
11333 | string of the operator will be rebuild based on the OP value. */ | |
11334 | EXPR_WFL_LINECOL (binop) = op_location; | |
11335 | return binop; | |
11336 | } | |
11337 | ||
11338 | /* Build the string of the operator retained by NODE. If NODE is part | |
11339 | of a compound expression, add an '=' at the end of the string. This | |
11340 | function is called when an error needs to be reported on an | |
11341 | operator. The string is returned as a pointer to a static character | |
11342 | buffer. */ | |
11343 | ||
11344 | static char * | |
11345 | operator_string (node) | |
11346 | tree node; | |
11347 | { | |
11348 | #define BUILD_OPERATOR_STRING(S) \ | |
11349 | { \ | |
11350 | sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \ | |
11351 | return buffer; \ | |
11352 | } | |
11353 | ||
11354 | static char buffer [10]; | |
11355 | switch (TREE_CODE (node)) | |
11356 | { | |
11357 | case MULT_EXPR: BUILD_OPERATOR_STRING ("*"); | |
11358 | case RDIV_EXPR: BUILD_OPERATOR_STRING ("/"); | |
11359 | case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%"); | |
11360 | case PLUS_EXPR: BUILD_OPERATOR_STRING ("+"); | |
11361 | case MINUS_EXPR: BUILD_OPERATOR_STRING ("-"); | |
11362 | case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<"); | |
11363 | case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>"); | |
11364 | case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>"); | |
11365 | case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&"); | |
11366 | case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^"); | |
11367 | case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|"); | |
11368 | case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&"); | |
11369 | case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||"); | |
11370 | case EQ_EXPR: BUILD_OPERATOR_STRING ("=="); | |
11371 | case NE_EXPR: BUILD_OPERATOR_STRING ("!="); | |
11372 | case GT_EXPR: BUILD_OPERATOR_STRING (">"); | |
11373 | case GE_EXPR: BUILD_OPERATOR_STRING (">="); | |
11374 | case LT_EXPR: BUILD_OPERATOR_STRING ("<"); | |
11375 | case LE_EXPR: BUILD_OPERATOR_STRING ("<="); | |
11376 | case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+"); | |
11377 | case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-"); | |
11378 | case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!"); | |
11379 | case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~"); | |
11380 | case PREINCREMENT_EXPR: /* Fall through */ | |
11381 | case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++"); | |
11382 | case PREDECREMENT_EXPR: /* Fall through */ | |
11383 | case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--"); | |
11384 | default: | |
11385 | fatal ("unregistered operator %s - operator_string", | |
11386 | tree_code_name [TREE_CODE (node)]); | |
11387 | } | |
11388 | return NULL; | |
11389 | #undef BUILD_OPERATOR_STRING | |
11390 | } | |
11391 | ||
11392 | /* Binary operators (15.16 up to 15.18). We return error_mark_node on | |
11393 | errors but we modify NODE so that it contains the type computed | |
11394 | according to the expression, when it's fixed. Otherwise, we write | |
11395 | error_mark_node as the type. It allows us to further the analysis | |
11396 | of remaining nodes and detects more errors in certain cases. */ | |
11397 | ||
11398 | static tree | |
11399 | patch_binop (node, wfl_op1, wfl_op2) | |
11400 | tree node; | |
11401 | tree wfl_op1; | |
11402 | tree wfl_op2; | |
11403 | { | |
11404 | tree op1 = TREE_OPERAND (node, 0); | |
11405 | tree op2 = TREE_OPERAND (node, 1); | |
11406 | tree op1_type = TREE_TYPE (op1); | |
11407 | tree op2_type = TREE_TYPE (op2); | |
11408 | tree prom_type; | |
11409 | int code = TREE_CODE (node); | |
11410 | ||
11411 | /* If 1, tell the routine that we have to return error_mark_node | |
11412 | after checking for the initialization of the RHS */ | |
11413 | int error_found = 0; | |
11414 | ||
8b27f225 PB |
11415 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); |
11416 | ||
8b27f225 PB |
11417 | switch (code) |
11418 | { | |
11419 | /* 15.16 Multiplicative operators */ | |
11420 | case MULT_EXPR: /* 15.16.1 Multiplication Operator * */ | |
11421 | case RDIV_EXPR: /* 15.16.2 Division Operator / */ | |
11422 | case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */ | |
11423 | if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type)) | |
11424 | { | |
11425 | if (!JPRIMITIVE_TYPE_P (op1_type)) | |
11426 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type); | |
11427 | if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type)) | |
11428 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type); | |
11429 | TREE_TYPE (node) = error_mark_node; | |
11430 | error_found = 1; | |
11431 | break; | |
11432 | } | |
11433 | prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); | |
11434 | /* Change the division operator if necessary */ | |
11435 | if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE) | |
11436 | TREE_SET_CODE (node, TRUNC_DIV_EXPR); | |
11437 | /* This one is more complicated. FLOATs are processed by a function | |
11438 | call to soft_fmod. */ | |
11439 | if (code == TRUNC_MOD_EXPR) | |
11440 | return build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2); | |
11441 | break; | |
11442 | ||
11443 | /* 15.17 Additive Operators */ | |
11444 | case PLUS_EXPR: /* 15.17.1 String Concatenation Operator + */ | |
11445 | ||
11446 | /* Operation is valid if either one argument is a string | |
11447 | constant, a String object or a StringBuffer crafted for the | |
11448 | purpose of the a previous usage of the String concatenation | |
11449 | operator */ | |
11450 | ||
11451 | if (TREE_CODE (op1) == STRING_CST | |
11452 | || TREE_CODE (op2) == STRING_CST | |
11453 | || JSTRING_TYPE_P (op1_type) | |
11454 | || JSTRING_TYPE_P (op2_type) | |
11455 | || IS_CRAFTED_STRING_BUFFER_P (op1) | |
11456 | || IS_CRAFTED_STRING_BUFFER_P (op2)) | |
11457 | return build_string_concatenation (op1, op2); | |
11458 | ||
11459 | case MINUS_EXPR: /* 15.17.2 Additive Operators (+ and -) for | |
11460 | Numeric Types */ | |
11461 | if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type)) | |
11462 | { | |
11463 | if (!JPRIMITIVE_TYPE_P (op1_type)) | |
11464 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type); | |
11465 | if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type)) | |
11466 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type); | |
11467 | TREE_TYPE (node) = error_mark_node; | |
11468 | error_found = 1; | |
11469 | break; | |
11470 | } | |
11471 | prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); | |
11472 | break; | |
11473 | ||
11474 | /* 15.18 Shift Operators */ | |
11475 | case LSHIFT_EXPR: | |
11476 | case RSHIFT_EXPR: | |
11477 | case URSHIFT_EXPR: | |
11478 | if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type)) | |
11479 | { | |
11480 | if (!JINTEGRAL_TYPE_P (op1_type)) | |
11481 | ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type); | |
11482 | else | |
11483 | parse_error_context | |
11484 | (wfl_operator, (JPRIMITIVE_TYPE_P (op2_type) ? | |
11485 | "Incompatible type for `%s'. Explicit cast needed to convert " | |
11486 | "shift distance from `%s' to integral" : | |
11487 | "Incompatible type for `%s'. Can't convert shift distance from " | |
11488 | "`%s' to integral"), | |
11489 | operator_string (node), lang_printable_name (op2_type, 0)); | |
11490 | TREE_TYPE (node) = error_mark_node; | |
11491 | error_found = 1; | |
11492 | break; | |
11493 | } | |
11494 | ||
11495 | /* Unary numeric promotion (5.6.1) is performed on each operand | |
11496 | separatly */ | |
12472854 PB |
11497 | op1 = do_unary_numeric_promotion (op1); |
11498 | op2 = do_unary_numeric_promotion (op2); | |
8b27f225 PB |
11499 | |
11500 | /* The type of the shift expression is the type of the promoted | |
11501 | type of the left-hand operand */ | |
11502 | prom_type = TREE_TYPE (op1); | |
11503 | ||
11504 | /* Shift int only up to 0x1f and long up to 0x3f */ | |
11505 | if (prom_type == int_type_node) | |
11506 | op2 = fold (build (BIT_AND_EXPR, int_type_node, op2, | |
11507 | build_int_2 (0x1f, 0))); | |
11508 | else | |
11509 | op2 = fold (build (BIT_AND_EXPR, int_type_node, op2, | |
11510 | build_int_2 (0x3f, 0))); | |
11511 | ||
11512 | /* The >>> operator is a >> operating on unsigned quantities */ | |
12472854 | 11513 | if (code == URSHIFT_EXPR && ! flag_emit_class_files) |
8b27f225 PB |
11514 | { |
11515 | op1 = convert (unsigned_type (prom_type), op1); | |
11516 | TREE_SET_CODE (node, RSHIFT_EXPR); | |
11517 | } | |
11518 | break; | |
5e942c50 APB |
11519 | |
11520 | /* 15.19.1 Type Comparison Operator instaceof */ | |
11521 | case INSTANCEOF_EXPR: | |
11522 | ||
11523 | TREE_TYPE (node) = boolean_type_node; | |
11524 | ||
11525 | if (!(op2_type = resolve_type_during_patch (op2))) | |
11526 | return error_mark_node; | |
11527 | ||
11528 | /* The first operand must be a reference type or the null type */ | |
11529 | if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node) | |
11530 | error_found = 1; /* Error reported further below */ | |
11531 | ||
11532 | /* The second operand must be a reference type */ | |
11533 | if (!JREFERENCE_TYPE_P (op2_type)) | |
11534 | { | |
11535 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op2); | |
11536 | parse_error_context | |
11537 | (wfl_operator, "Invalid argument `%s' for `instanceof'", | |
11538 | lang_printable_name (op2_type, 0)); | |
11539 | error_found = 1; | |
11540 | } | |
11541 | ||
11542 | if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1)) | |
11543 | { | |
11544 | /* If the first operand is null, the result is always false */ | |
11545 | if (op1 == null_pointer_node) | |
11546 | return boolean_false_node; | |
12472854 PB |
11547 | else if (flag_emit_class_files) |
11548 | { | |
11549 | TREE_OPERAND (node, 1) = op2_type; | |
11550 | return node; | |
11551 | } | |
5e942c50 APB |
11552 | /* Otherwise we have to invoke instance of to figure it out */ |
11553 | else | |
11554 | { | |
11555 | tree call = | |
11556 | build (CALL_EXPR, boolean_type_node, | |
11557 | build_address_of (soft_instanceof_node), | |
11558 | tree_cons | |
11559 | (NULL_TREE, op1, | |
11560 | build_tree_list (NULL_TREE, | |
11561 | build_class_ref (op2_type))), | |
11562 | NULL_TREE); | |
11563 | TREE_SIDE_EFFECTS (call) = 1; | |
11564 | return call; | |
11565 | } | |
11566 | } | |
11567 | /* There is no way the expression operand can be an instance of | |
11568 | the type operand. This is a compile time error. */ | |
11569 | else | |
11570 | { | |
11571 | char *t1 = strdup (lang_printable_name (op1_type, 0)); | |
11572 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); | |
11573 | parse_error_context | |
11574 | (wfl_operator, "Impossible for `%s' to be instance of `%s'", | |
11575 | t1, lang_printable_name (op2_type, 0)); | |
11576 | free (t1); | |
11577 | error_found = 1; | |
11578 | } | |
8b27f225 | 11579 | |
5e942c50 | 11580 | break; |
8b27f225 PB |
11581 | |
11582 | /* 15.21 Bitwise and Logical Operators */ | |
11583 | case BIT_AND_EXPR: | |
11584 | case BIT_XOR_EXPR: | |
11585 | case BIT_IOR_EXPR: | |
11586 | if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type)) | |
11587 | /* Binary numeric promotion is performed on both operand and the | |
11588 | expression retain that type */ | |
11589 | prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); | |
11590 | ||
11591 | else if (TREE_CODE (op1_type) == BOOLEAN_TYPE | |
11592 | && TREE_CODE (op1_type) == BOOLEAN_TYPE) | |
11593 | /* The type of the bitwise operator expression is BOOLEAN */ | |
11594 | prom_type = boolean_type_node; | |
11595 | else | |
11596 | { | |
11597 | if (!JINTEGRAL_TYPE_P (op1_type)) | |
11598 | ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type); | |
11599 | if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type)) | |
11600 | ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type); | |
11601 | TREE_TYPE (node) = error_mark_node; | |
11602 | error_found = 1; | |
11603 | /* Insert a break here if adding thing before the switch's | |
11604 | break for this case */ | |
11605 | } | |
11606 | break; | |
11607 | ||
11608 | /* 15.22 Conditional-And Operator */ | |
11609 | case TRUTH_ANDIF_EXPR: | |
11610 | /* 15.23 Conditional-Or Operator */ | |
11611 | case TRUTH_ORIF_EXPR: | |
11612 | /* Operands must be of BOOLEAN type */ | |
11613 | if (TREE_CODE (op1_type) != BOOLEAN_TYPE || | |
11614 | TREE_CODE (op2_type) != BOOLEAN_TYPE) | |
11615 | { | |
11616 | if (TREE_CODE (op1_type) != BOOLEAN_TYPE) | |
11617 | ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type); | |
11618 | if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type)) | |
11619 | ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type); | |
11620 | TREE_TYPE (node) = boolean_type_node; | |
11621 | error_found = 1; | |
11622 | break; | |
11623 | } | |
11624 | /* The type of the conditional operators is BOOLEAN */ | |
11625 | prom_type = boolean_type_node; | |
11626 | break; | |
11627 | ||
11628 | /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */ | |
11629 | case LT_EXPR: | |
11630 | case GT_EXPR: | |
11631 | case LE_EXPR: | |
11632 | case GE_EXPR: | |
11633 | /* The type of each of the operands must be a primitive numeric | |
11634 | type */ | |
11635 | if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type)) | |
11636 | { | |
11637 | if (!JNUMERIC_TYPE_P (op1_type)) | |
11638 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type); | |
11639 | if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type)) | |
11640 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type); | |
11641 | TREE_TYPE (node) = boolean_type_node; | |
11642 | error_found = 1; | |
11643 | break; | |
11644 | } | |
11645 | /* Binary numeric promotion is performed on the operands */ | |
11646 | binary_numeric_promotion (op1_type, op2_type, &op1, &op2); | |
11647 | /* The type of the relation expression is always BOOLEAN */ | |
11648 | prom_type = boolean_type_node; | |
11649 | break; | |
11650 | ||
11651 | /* 15.20 Equality Operator */ | |
11652 | case EQ_EXPR: | |
11653 | case NE_EXPR: | |
11654 | /* 15.20.1 Numerical Equality Operators == and != */ | |
11655 | /* Binary numeric promotion is performed on the operands */ | |
5e942c50 | 11656 | if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type)) |
8b27f225 PB |
11657 | binary_numeric_promotion (op1_type, op2_type, &op1, &op2); |
11658 | ||
11659 | /* 15.20.2 Boolean Equality Operators == and != */ | |
11660 | else if (TREE_CODE (op1_type) == BOOLEAN_TYPE && | |
11661 | TREE_CODE (op2_type) == BOOLEAN_TYPE) | |
11662 | ; /* Nothing to do here */ | |
11663 | ||
11664 | /* 15.20.3 Reference Equality Operators == and != */ | |
5e942c50 APB |
11665 | /* Types have to be either references or the null type. If |
11666 | they're references, it must be possible to convert either | |
11667 | type to the other by casting conversion. */ | |
8b27f225 PB |
11668 | else if (op1 == null_pointer_node || op2 == null_pointer_node |
11669 | || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type) | |
5e942c50 APB |
11670 | && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1) |
11671 | || valid_ref_assignconv_cast_p (op2_type, | |
11672 | op1_type, 1)))) | |
8b27f225 PB |
11673 | ; /* Nothing to do here */ |
11674 | ||
11675 | /* Else we have an error figure what can't be converted into | |
11676 | what and report the error */ | |
11677 | else | |
11678 | { | |
11679 | char *t1; | |
11680 | t1 = strdup (lang_printable_name (op1_type, 0)); | |
11681 | parse_error_context | |
11682 | (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' " | |
11683 | "to `%s'", operator_string (node), t1, | |
11684 | lang_printable_name (op2_type, 0)); | |
11685 | free (t1); | |
11686 | TREE_TYPE (node) = boolean_type_node; | |
11687 | error_found = 1; | |
11688 | break; | |
11689 | } | |
11690 | prom_type = boolean_type_node; | |
11691 | break; | |
11692 | } | |
11693 | ||
8b27f225 PB |
11694 | if (error_found) |
11695 | return error_mark_node; | |
11696 | ||
11697 | TREE_OPERAND (node, 0) = op1; | |
11698 | TREE_OPERAND (node, 1) = op2; | |
11699 | TREE_TYPE (node) = prom_type; | |
11700 | return fold (node); | |
11701 | } | |
11702 | ||
11703 | /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non | |
11704 | zero value, the value of CSTE comes after the valude of STRING */ | |
11705 | ||
11706 | static tree | |
11707 | do_merge_string_cste (cste, string, string_len, after) | |
11708 | tree cste; | |
11709 | char *string; | |
11710 | int string_len, after; | |
11711 | { | |
11712 | int len = TREE_STRING_LENGTH (cste) + string_len; | |
11713 | char *old = TREE_STRING_POINTER (cste); | |
11714 | TREE_STRING_LENGTH (cste) = len; | |
11715 | TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1); | |
11716 | if (after) | |
11717 | { | |
11718 | strcpy (TREE_STRING_POINTER (cste), string); | |
11719 | strcat (TREE_STRING_POINTER (cste), old); | |
11720 | } | |
11721 | else | |
11722 | { | |
11723 | strcpy (TREE_STRING_POINTER (cste), old); | |
11724 | strcat (TREE_STRING_POINTER (cste), string); | |
11725 | } | |
11726 | return cste; | |
11727 | } | |
11728 | ||
11729 | /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a | |
11730 | new STRING_CST on success, NULL_TREE on failure */ | |
11731 | ||
11732 | static tree | |
11733 | merge_string_cste (op1, op2, after) | |
11734 | tree op1, op2; | |
11735 | int after; | |
11736 | { | |
11737 | /* Handle two string constants right away */ | |
11738 | if (TREE_CODE (op2) == STRING_CST) | |
11739 | return do_merge_string_cste (op1, TREE_STRING_POINTER (op2), | |
11740 | TREE_STRING_LENGTH (op2), after); | |
11741 | ||
11742 | /* Reasonable integer constant can be treated right away */ | |
11743 | if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2)) | |
11744 | { | |
11745 | static char *boolean_true = "true"; | |
11746 | static char *boolean_false = "false"; | |
11747 | static char *null_pointer = "null"; | |
11748 | char ch[3]; | |
11749 | char *string; | |
11750 | ||
11751 | if (op2 == boolean_true_node) | |
11752 | string = boolean_true; | |
11753 | else if (op2 == boolean_false_node) | |
11754 | string = boolean_false; | |
11755 | else if (op2 == null_pointer_node) | |
11756 | string = null_pointer; | |
11757 | else if (TREE_TYPE (op2) == char_type_node) | |
11758 | { | |
11759 | ch[0] = (char )TREE_INT_CST_LOW (op2); | |
11760 | ch[1] = '\0'; | |
11761 | string = ch; | |
11762 | } | |
11763 | else | |
11764 | string = print_int_node (op2); | |
11765 | ||
11766 | return do_merge_string_cste (op1, string, strlen (string), after); | |
11767 | } | |
11768 | return NULL_TREE; | |
11769 | } | |
11770 | ||
11771 | /* Tries to statically concatenate OP1 and OP2 if possible. Either one | |
11772 | has to be a STRING_CST and the other part must be a STRING_CST or a | |
11773 | INTEGRAL constant. Return a new STRING_CST if the operation | |
11774 | succeed, NULL_TREE otherwise. | |
11775 | ||
11776 | If the case we want to optimize for space, we might want to return | |
11777 | NULL_TREE for each invocation of this routine. FIXME */ | |
11778 | ||
11779 | static tree | |
11780 | string_constant_concatenation (op1, op2) | |
11781 | tree op1, op2; | |
11782 | { | |
11783 | if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST)) | |
11784 | { | |
11785 | tree string, rest; | |
11786 | int invert; | |
11787 | ||
11788 | string = (TREE_CODE (op1) == STRING_CST ? op1 : op2); | |
11789 | rest = (string == op1 ? op2 : op1); | |
11790 | invert = (string == op1 ? 0 : 1 ); | |
11791 | ||
11792 | /* Walk REST, only if it looks reasonable */ | |
11793 | if (TREE_CODE (rest) != STRING_CST | |
11794 | && !IS_CRAFTED_STRING_BUFFER_P (rest) | |
11795 | && !JSTRING_TYPE_P (TREE_TYPE (rest)) | |
11796 | && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION) | |
11797 | { | |
11798 | rest = java_complete_tree (rest); | |
11799 | if (rest == error_mark_node) | |
11800 | return error_mark_node; | |
11801 | rest = fold (rest); | |
11802 | } | |
11803 | return merge_string_cste (string, rest, invert); | |
11804 | } | |
11805 | return NULL_TREE; | |
11806 | } | |
11807 | ||
11808 | /* Implement the `+' operator. Does static optimization if possible, | |
11809 | otherwise create (if necessary) and append elements to a | |
11810 | StringBuffer. The StringBuffer will be carried around until it is | |
11811 | used for a function call or an assignment. Then toString() will be | |
11812 | called on it to turn it into a String object. */ | |
11813 | ||
11814 | static tree | |
11815 | build_string_concatenation (op1, op2) | |
11816 | tree op1, op2; | |
11817 | { | |
11818 | tree result; | |
11819 | ||
11820 | /* Try to do some static optimization */ | |
11821 | if ((result = string_constant_concatenation (op1, op2))) | |
11822 | return result; | |
11823 | ||
11824 | /* If operands are string constant, turn then into object references */ | |
11825 | ||
11826 | if (TREE_CODE (op1) == STRING_CST) | |
11827 | op1 = patch_string_cst (op1); | |
11828 | if (TREE_CODE (op2) == STRING_CST) | |
11829 | op2 = patch_string_cst (op2); | |
11830 | ||
11831 | /* If OP1 isn't already a StringBuffer, create and | |
11832 | initialize a new one */ | |
11833 | if (!IS_CRAFTED_STRING_BUFFER_P (op1)) | |
11834 | { | |
11835 | /* Two solutions here: | |
11836 | 1) OP1 is a string reference, we call new StringBuffer(OP1) | |
11837 | 2) Op2 is something else, we call new StringBuffer().append(OP1). */ | |
11838 | if (JSTRING_TYPE_P (TREE_TYPE (op1))) | |
11839 | op1 = BUILD_STRING_BUFFER (op1); | |
11840 | else | |
11841 | { | |
11842 | tree aNew = BUILD_STRING_BUFFER (NULL_TREE); | |
11843 | op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0); | |
11844 | } | |
11845 | } | |
11846 | ||
11847 | /* No longer the last node holding a crafted StringBuffer */ | |
11848 | IS_CRAFTED_STRING_BUFFER_P (op1) = 0; | |
11849 | /* Create a node for `{new...,xxx}.append (op2)' */ | |
11850 | op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0); | |
11851 | /* Mark the last node holding a crafted StringBuffer */ | |
11852 | IS_CRAFTED_STRING_BUFFER_P (op1) = 1; | |
11853 | ||
11854 | return op1; | |
11855 | } | |
11856 | ||
11857 | /* Patch the string node NODE. NODE can be a STRING_CST of a crafted | |
11858 | StringBuffer. If no string were found to be patched, return | |
11859 | NULL. */ | |
11860 | ||
11861 | static tree | |
11862 | patch_string (node) | |
11863 | tree node; | |
11864 | { | |
1179ebc2 APB |
11865 | if (node == error_mark_node) |
11866 | return error_mark_node; | |
8b27f225 PB |
11867 | if (TREE_CODE (node) == STRING_CST) |
11868 | return patch_string_cst (node); | |
11869 | else if (IS_CRAFTED_STRING_BUFFER_P (node)) | |
11870 | { | |
c877974e | 11871 | int saved = ctxp->explicit_constructor_p; |
8b27f225 | 11872 | tree invoke = build_method_invocation (wfl_to_string, NULL_TREE); |
c877974e APB |
11873 | tree ret; |
11874 | /* Temporary disable forbid the use of `this'. */ | |
11875 | ctxp->explicit_constructor_p = 0; | |
11876 | ret = java_complete_tree (make_qualified_primary (node, invoke, 0)); | |
11877 | /* Restore it at its previous value */ | |
11878 | ctxp->explicit_constructor_p = saved; | |
11879 | return ret; | |
8b27f225 PB |
11880 | } |
11881 | return NULL_TREE; | |
11882 | } | |
11883 | ||
11884 | /* Build the internal representation of a string constant. */ | |
11885 | ||
11886 | static tree | |
11887 | patch_string_cst (node) | |
11888 | tree node; | |
11889 | { | |
11890 | int location; | |
12472854 PB |
11891 | if (! flag_emit_class_files) |
11892 | { | |
11893 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
11894 | node = get_identifier (TREE_STRING_POINTER (node)); | |
11895 | location = alloc_name_constant (CONSTANT_String, node); | |
11896 | node = build_ref_from_constant_pool (location); | |
11897 | } | |
8b27f225 PB |
11898 | TREE_TYPE (node) = promote_type (string_type_node); |
11899 | TREE_CONSTANT (node) = 1; | |
11900 | return node; | |
11901 | } | |
11902 | ||
11903 | /* Build an incomplete unary operator expression. */ | |
11904 | ||
11905 | static tree | |
11906 | build_unaryop (op_token, op_location, op1) | |
11907 | int op_token, op_location; | |
11908 | tree op1; | |
11909 | { | |
11910 | enum tree_code op; | |
11911 | tree unaryop; | |
11912 | switch (op_token) | |
11913 | { | |
11914 | case PLUS_TK: op = UNARY_PLUS_EXPR; break; | |
11915 | case MINUS_TK: op = NEGATE_EXPR; break; | |
11916 | case NEG_TK: op = TRUTH_NOT_EXPR; break; | |
11917 | case NOT_TK: op = BIT_NOT_EXPR; break; | |
11918 | default: fatal ("Unknown token `%d' for unary operator - build_unaryop", | |
11919 | op_token); | |
11920 | } | |
11921 | ||
11922 | unaryop = build1 (op, NULL_TREE, op1); | |
11923 | TREE_SIDE_EFFECTS (unaryop) = 1; | |
11924 | /* Store the location of the operator, for better error report. The | |
11925 | string of the operator will be rebuild based on the OP value. */ | |
11926 | EXPR_WFL_LINECOL (unaryop) = op_location; | |
11927 | return unaryop; | |
11928 | } | |
11929 | ||
11930 | /* Special case for the ++/-- operators, since they require an extra | |
11931 | argument to build, which is set to NULL and patched | |
11932 | later. IS_POST_P is 1 if the operator, 0 otherwise. */ | |
11933 | ||
11934 | static tree | |
11935 | build_incdec (op_token, op_location, op1, is_post_p) | |
11936 | int op_token, op_location; | |
11937 | tree op1; | |
11938 | int is_post_p; | |
11939 | { | |
11940 | static enum tree_code lookup [2][2] = | |
11941 | { | |
11942 | { PREDECREMENT_EXPR, PREINCREMENT_EXPR, }, | |
11943 | { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, }, | |
11944 | }; | |
11945 | tree node = build (lookup [is_post_p][(op_token - DECR_TK)], | |
11946 | NULL_TREE, op1, NULL_TREE); | |
11947 | TREE_SIDE_EFFECTS (node) = 1; | |
11948 | /* Store the location of the operator, for better error report. The | |
11949 | string of the operator will be rebuild based on the OP value. */ | |
11950 | EXPR_WFL_LINECOL (node) = op_location; | |
11951 | return node; | |
11952 | } | |
11953 | ||
11954 | /* Build an incomplete cast operator, based on the use of the | |
11955 | CONVERT_EXPR. Note that TREE_TYPE of the constructed node is | |
11956 | set. java_complete_tree is trained to walk a CONVERT_EXPR even | |
11957 | though its type is already set. */ | |
11958 | ||
11959 | static tree | |
11960 | build_cast (location, type, exp) | |
11961 | int location; | |
11962 | tree type, exp; | |
11963 | { | |
11964 | tree node = build1 (CONVERT_EXPR, type, exp); | |
11965 | EXPR_WFL_LINECOL (node) = location; | |
11966 | return node; | |
11967 | } | |
11968 | ||
11969 | /* 15.14 Unary operators. We return error_mark_node in case of error, | |
11970 | but preserve the type of NODE if the type is fixed. */ | |
11971 | ||
11972 | static tree | |
11973 | patch_unaryop (node, wfl_op) | |
11974 | tree node; | |
11975 | tree wfl_op; | |
11976 | { | |
11977 | tree op = TREE_OPERAND (node, 0); | |
11978 | tree op_type = TREE_TYPE (op); | |
11979 | tree prom_type, value; | |
11980 | int code = TREE_CODE (node); | |
11981 | int error_found = 0; | |
11982 | ||
11983 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
11984 | ||
11985 | switch (code) | |
11986 | { | |
11987 | /* 15.13.2 Postfix Increment Operator ++ */ | |
11988 | case POSTINCREMENT_EXPR: | |
11989 | /* 15.13.3 Postfix Increment Operator -- */ | |
11990 | case POSTDECREMENT_EXPR: | |
11991 | /* 15.14.1 Prefix Increment Operator ++ */ | |
11992 | case PREINCREMENT_EXPR: | |
11993 | /* 15.14.2 Prefix Decrement Operator -- */ | |
11994 | case PREDECREMENT_EXPR: | |
5e942c50 APB |
11995 | if (!DECL_P (op) && !((TREE_CODE (op) == INDIRECT_REF |
11996 | || TREE_CODE (op) == COMPONENT_REF) | |
8b27f225 PB |
11997 | && JPRIMITIVE_TYPE_P (TREE_TYPE (op)))) |
11998 | { | |
5e942c50 APB |
11999 | tree lvalue; |
12000 | /* Before screaming, check that we're not in fact trying to | |
12001 | increment a optimized static final access, in which case | |
12002 | we issue an different error message. */ | |
12003 | if (!(TREE_CODE (wfl_op) == EXPR_WITH_FILE_LOCATION | |
12004 | && resolve_expression_name (wfl_op, &lvalue) | |
12005 | && check_final_assignment (lvalue, wfl_op))) | |
12006 | parse_error_context (wfl_operator, "Invalid argument to `%s'", | |
12007 | operator_string (node)); | |
8b27f225 PB |
12008 | TREE_TYPE (node) = error_mark_node; |
12009 | error_found = 1; | |
12010 | } | |
5e942c50 APB |
12011 | else if (check_final_assignment (op, wfl_op)) |
12012 | error_found = 1; | |
12013 | ||
8b27f225 PB |
12014 | /* From now on, we know that op if a variable and that it has a |
12015 | valid wfl. We use wfl_op to locate errors related to the | |
12016 | ++/-- operand. */ | |
12017 | else if (!JNUMERIC_TYPE_P (op_type)) | |
12018 | { | |
12019 | parse_error_context | |
12020 | (wfl_op, "Invalid argument type `%s' to `%s'", | |
12021 | lang_printable_name (op_type, 0), operator_string (node)); | |
12022 | TREE_TYPE (node) = error_mark_node; | |
12023 | error_found = 1; | |
12024 | } | |
12025 | else | |
12026 | { | |
4a5f66c3 | 12027 | /* Before the addition, binary numeric promotion is performed on |
8b27f225 | 12028 | both operands */ |
4a5f66c3 APB |
12029 | value = build_int_2 (1, 0); |
12030 | TREE_TYPE (node) = | |
12031 | binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value); | |
12032 | /* And write the promoted incremented and increment */ | |
12033 | TREE_OPERAND (node, 0) = op; | |
8b27f225 | 12034 | TREE_OPERAND (node, 1) = value; |
4a5f66c3 APB |
12035 | /* Convert the overall back into its original type. */ |
12036 | return fold (convert (op_type, node)); | |
8b27f225 PB |
12037 | } |
12038 | break; | |
12039 | ||
12040 | /* 15.14.3 Unary Plus Operator + */ | |
12041 | case UNARY_PLUS_EXPR: | |
12042 | /* 15.14.4 Unary Minus Operator - */ | |
12043 | case NEGATE_EXPR: | |
12044 | if (!JNUMERIC_TYPE_P (op_type)) | |
12045 | { | |
12046 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type); | |
12047 | TREE_TYPE (node) = error_mark_node; | |
12048 | error_found = 1; | |
12049 | } | |
12050 | /* Unary numeric promotion is performed on operand */ | |
12051 | else | |
12052 | { | |
12472854 PB |
12053 | op = do_unary_numeric_promotion (op); |
12054 | prom_type = TREE_TYPE (op); | |
8b27f225 | 12055 | if (code == UNARY_PLUS_EXPR) |
4a5f66c3 | 12056 | return fold (op); |
8b27f225 PB |
12057 | } |
12058 | break; | |
12059 | ||
12060 | /* 15.14.5 Bitwise Complement Operator ~ */ | |
12061 | case BIT_NOT_EXPR: | |
12062 | if (!JINTEGRAL_TYPE_P (op_type)) | |
12063 | { | |
12064 | ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type); | |
12065 | TREE_TYPE (node) = error_mark_node; | |
12066 | error_found = 1; | |
12067 | } | |
12068 | else | |
12069 | { | |
12472854 PB |
12070 | op = do_unary_numeric_promotion (op); |
12071 | prom_type = TREE_TYPE (op); | |
8b27f225 PB |
12072 | } |
12073 | break; | |
12074 | ||
12075 | /* 15.14.6 Logical Complement Operator ! */ | |
12076 | case TRUTH_NOT_EXPR: | |
12077 | if (TREE_CODE (op_type) != BOOLEAN_TYPE) | |
12078 | { | |
12079 | ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type); | |
c877974e APB |
12080 | /* But the type is known. We will report an error if further |
12081 | attempt of a assignment is made with this rhs */ | |
8b27f225 PB |
12082 | TREE_TYPE (node) = boolean_type_node; |
12083 | error_found = 1; | |
12084 | } | |
12085 | else | |
12086 | prom_type = boolean_type_node; | |
12087 | break; | |
12088 | ||
12089 | /* 15.15 Cast Expression */ | |
12090 | case CONVERT_EXPR: | |
12091 | value = patch_cast (node, wfl_operator); | |
12092 | if (value == error_mark_node) | |
c877974e APB |
12093 | { |
12094 | /* If this cast is part of an assignment, we tell the code | |
12095 | that deals with it not to complain about a mismatch, | |
12096 | because things have been cast, anyways */ | |
12097 | TREE_TYPE (node) = error_mark_node; | |
12098 | error_found = 1; | |
12099 | } | |
12100 | else | |
4a5f66c3 | 12101 | return fold (value); |
8b27f225 PB |
12102 | break; |
12103 | } | |
12104 | ||
8b27f225 PB |
12105 | if (error_found) |
12106 | return error_mark_node; | |
4a5f66c3 APB |
12107 | |
12108 | /* There are cases where node has been replaced by something else | |
12109 | and we don't end up returning here: UNARY_PLUS_EXPR, | |
12110 | CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */ | |
63a212ed | 12111 | TREE_OPERAND (node, 0) = fold (op); |
4a5f66c3 | 12112 | TREE_TYPE (node) = prom_type; |
8b27f225 PB |
12113 | return fold (node); |
12114 | } | |
12115 | ||
12116 | /* Generic type resolution that sometimes takes place during node | |
12117 | patching. Returned the resolved type or generate an error | |
12118 | message. Return the resolved type or NULL_TREE. */ | |
12119 | ||
12120 | static tree | |
12121 | resolve_type_during_patch (type) | |
12122 | tree type; | |
12123 | { | |
12124 | if (unresolved_type_p (type, NULL)) | |
12125 | { | |
12126 | tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE); | |
12127 | if (!type_decl) | |
12128 | { | |
12129 | parse_error_context (type, | |
12130 | "Class `%s' not found in type declaration", | |
12131 | IDENTIFIER_POINTER (EXPR_WFL_NODE (type))); | |
12132 | return NULL_TREE; | |
12133 | } | |
12134 | else | |
5e942c50 APB |
12135 | { |
12136 | CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1; | |
12137 | return TREE_TYPE (type_decl); | |
12138 | } | |
8b27f225 PB |
12139 | } |
12140 | return type; | |
12141 | } | |
12142 | /* 5.5 Casting Conversion. error_mark_node is returned if an error is | |
12143 | found. Otherwise NODE or something meant to replace it is returned. */ | |
12144 | ||
12145 | static tree | |
12146 | patch_cast (node, wfl_operator) | |
12147 | tree node; | |
12148 | tree wfl_operator; | |
12149 | { | |
12150 | tree op = TREE_OPERAND (node, 0); | |
12151 | tree op_type = TREE_TYPE (op); | |
12152 | tree cast_type = TREE_TYPE (node); | |
12153 | char *t1; | |
12154 | ||
12155 | /* First resolve OP_TYPE if unresolved */ | |
12156 | if (!(cast_type = resolve_type_during_patch (cast_type))) | |
12157 | return error_mark_node; | |
12158 | ||
12159 | /* Check on cast that are proven correct at compile time */ | |
12160 | if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type)) | |
12161 | { | |
12162 | static tree convert_narrow (); | |
12163 | /* Same type */ | |
12164 | if (cast_type == op_type) | |
12165 | return node; | |
12166 | ||
12167 | /* Try widening/narowwing convertion. Potentially, things need | |
12168 | to be worked out in gcc so we implement the extreme cases | |
12169 | correctly. fold_convert() needs to be fixed. */ | |
12170 | return convert (cast_type, op); | |
12171 | } | |
12172 | ||
5e942c50 APB |
12173 | /* null can be casted to references */ |
12174 | if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type)) | |
12175 | return build_null_of_type (cast_type); | |
12176 | ||
8b27f225 PB |
12177 | /* The remaining legal casts involve conversion between reference |
12178 | types. Check for their compile time correctness. */ | |
12179 | if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type) | |
12180 | && valid_ref_assignconv_cast_p (cast_type, op_type, 1)) | |
12181 | { | |
12182 | TREE_TYPE (node) = promote_type (cast_type); | |
12183 | /* Now, the case can be determined correct at compile time if | |
12184 | OP_TYPE can be converted into CAST_TYPE by assignment | |
12185 | conversion (5.2) */ | |
12186 | ||
12187 | if (valid_ref_assignconv_cast_p (op_type, cast_type, 0)) | |
12472854 PB |
12188 | { |
12189 | TREE_SET_CODE (node, NOP_EXPR); | |
12190 | return node; | |
12191 | } | |
12192 | ||
12193 | if (flag_emit_class_files) | |
12194 | { | |
12195 | TREE_SET_CODE (node, CONVERT_EXPR); | |
12196 | return node; | |
12197 | } | |
8b27f225 PB |
12198 | |
12199 | /* The cast requires a run-time check */ | |
12200 | return build (CALL_EXPR, promote_type (cast_type), | |
12201 | build_address_of (soft_checkcast_node), | |
12202 | tree_cons (NULL_TREE, build_class_ref (cast_type), | |
12203 | build_tree_list (NULL_TREE, op)), | |
12204 | NULL_TREE); | |
12205 | } | |
12206 | ||
12207 | /* Any other casts are proven incorrect at compile time */ | |
12208 | t1 = strdup (lang_printable_name (op_type, 0)); | |
12209 | parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'", | |
12210 | t1, lang_printable_name (cast_type, 0)); | |
12211 | free (t1); | |
12212 | return error_mark_node; | |
12213 | } | |
12214 | ||
5e942c50 APB |
12215 | /* Build a null constant and give it the type TYPE. */ |
12216 | ||
12217 | static tree | |
12218 | build_null_of_type (type) | |
12219 | tree type; | |
12220 | { | |
12221 | tree node = build_int_2 (0, 0); | |
12222 | TREE_TYPE (node) = promote_type (type); | |
12223 | return node; | |
12224 | } | |
12225 | ||
8b27f225 PB |
12226 | /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't |
12227 | a list of indices. */ | |
12228 | static tree | |
12229 | build_array_ref (location, array, index) | |
12230 | int location; | |
12231 | tree array, index; | |
12232 | { | |
12233 | tree node = build (ARRAY_REF, NULL_TREE, array, index); | |
12234 | EXPR_WFL_LINECOL (node) = location; | |
12235 | return node; | |
12236 | } | |
12237 | ||
12238 | /* 15.12 Array Access Expression */ | |
12239 | ||
12240 | static tree | |
c877974e APB |
12241 | patch_array_ref (node) |
12242 | tree node; | |
8b27f225 PB |
12243 | { |
12244 | tree array = TREE_OPERAND (node, 0); | |
12245 | tree array_type = TREE_TYPE (array); | |
12246 | tree index = TREE_OPERAND (node, 1); | |
12247 | tree index_type = TREE_TYPE (index); | |
8b27f225 PB |
12248 | int error_found = 0; |
12249 | ||
12250 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
12251 | ||
8b27f225 PB |
12252 | if (TREE_CODE (array_type) == POINTER_TYPE) |
12253 | array_type = TREE_TYPE (array_type); | |
12254 | ||
12255 | /* The array reference must be an array */ | |
12256 | if (!TYPE_ARRAY_P (array_type)) | |
12257 | { | |
12258 | parse_error_context | |
12259 | (wfl_operator, "`[]' can only be applied to arrays. It can't be " | |
12260 | "applied to `%s'", lang_printable_name (array_type, 0)); | |
12261 | TREE_TYPE (node) = error_mark_node; | |
12262 | error_found = 1; | |
12263 | } | |
12264 | ||
12265 | /* The array index underdoes unary numeric promotion. The promoted | |
12266 | type must be int */ | |
12472854 PB |
12267 | index = do_unary_numeric_promotion (index); |
12268 | if (TREE_TYPE (index) != int_type_node) | |
8b27f225 PB |
12269 | { |
12270 | int could_cast = valid_cast_to_p (index_type, int_type_node); | |
12271 | parse_error_context | |
12272 | (wfl_operator, | |
12273 | (could_cast ? "Incompatible type for `[]'. Explicit cast needed to " | |
12274 | "convert `%s' to `int'" : "Incompatible type for `[]'. " | |
12275 | "Can't convert `%s' to `int'"), | |
12276 | lang_printable_name (index_type, 0)); | |
12277 | TREE_TYPE (node) = error_mark_node; | |
12278 | error_found = 1; | |
12279 | } | |
12280 | ||
8b27f225 PB |
12281 | if (error_found) |
12282 | return error_mark_node; | |
8b27f225 | 12283 | |
5e942c50 | 12284 | array_type = TYPE_ARRAY_ELEMENT (array_type); |
5e942c50 | 12285 | |
8b27f225 PB |
12286 | if (flag_emit_class_files) |
12287 | { | |
12472854 PB |
12288 | TREE_OPERAND (node, 0) = array; |
12289 | TREE_OPERAND (node, 1) = index; | |
8b27f225 PB |
12290 | } |
12291 | else | |
12292 | node = build_java_arrayaccess (array, array_type, index); | |
12293 | TREE_TYPE (node) = array_type; | |
12294 | return node; | |
12295 | } | |
12296 | ||
12297 | /* 15.9 Array Creation Expressions */ | |
12298 | ||
12299 | static tree | |
12300 | build_newarray_node (type, dims, extra_dims) | |
12301 | tree type; | |
12302 | tree dims; | |
12303 | int extra_dims; | |
12304 | { | |
12305 | tree node = | |
12306 | build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims), | |
12307 | build_int_2 (extra_dims, 0)); | |
12308 | return node; | |
12309 | } | |
12310 | ||
12311 | static tree | |
12312 | patch_newarray (node) | |
12313 | tree node; | |
12314 | { | |
12315 | tree type = TREE_OPERAND (node, 0); | |
12316 | tree dims = TREE_OPERAND (node, 1); | |
12317 | tree cdim, array_type; | |
12318 | int error_found = 0; | |
12319 | int ndims = 0; | |
12320 | int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2)); | |
8b27f225 PB |
12321 | |
12322 | /* Dimension types are verified. It's better for the types to be | |
12323 | verified in order. */ | |
12324 | for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ ) | |
12325 | { | |
12326 | int dim_error = 0; | |
12327 | tree dim = TREE_VALUE (cdim); | |
12328 | ||
12329 | /* Dim might have been saved during its evaluation */ | |
12330 | dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim); | |
12331 | ||
12332 | /* The type of each specified dimension must be an integral type. */ | |
12333 | if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim))) | |
12334 | dim_error = 1; | |
12335 | ||
12336 | /* Each expression undergoes an unary numeric promotion (5.6.1) and the | |
12337 | promoted type must be int. */ | |
12338 | else | |
12339 | { | |
12472854 | 12340 | dim = do_unary_numeric_promotion (dim); |
8b27f225 PB |
12341 | if (TREE_TYPE (dim) != int_type_node) |
12342 | dim_error = 1; | |
12343 | } | |
12344 | ||
12345 | /* Report errors on types here */ | |
12346 | if (dim_error) | |
12347 | { | |
12348 | parse_error_context | |
12349 | (TREE_PURPOSE (cdim), | |
12350 | "Incompatible type for dimension in array creation expression. " | |
12351 | "%s convert `%s' to `int'", | |
12352 | (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ? | |
12353 | "Explicit cast needed to" : "Can't"), | |
12354 | lang_printable_name (TREE_TYPE (dim), 0)); | |
12355 | error_found = 1; | |
12356 | } | |
12357 | ||
8b27f225 PB |
12358 | TREE_PURPOSE (cdim) = NULL_TREE; |
12359 | } | |
12360 | ||
12361 | /* Resolve array base type if unresolved */ | |
12362 | if (!(type = resolve_type_during_patch (type))) | |
12363 | error_found = 1; | |
12364 | ||
12365 | if (error_found) | |
12366 | { | |
12367 | /* We don't want further evaluation of this bogus array creation | |
12368 | operation */ | |
12369 | TREE_TYPE (node) = error_mark_node; | |
12370 | return error_mark_node; | |
12371 | } | |
12372 | ||
12472854 PB |
12373 | /* Set array_type to the actual (promoted) array type of the result. */ |
12374 | if (TREE_CODE (type) == RECORD_TYPE) | |
12375 | type = build_pointer_type (type); | |
12376 | while (--xdims >= 0) | |
12377 | { | |
12378 | type = promote_type (build_java_array_type (type, -1)); | |
12379 | } | |
12380 | dims = nreverse (dims); | |
12381 | array_type = type; | |
12382 | for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim)) | |
12383 | { | |
12384 | type = array_type; | |
12385 | array_type = build_java_array_type (type, | |
12386 | TREE_CODE (cdim) == INTEGER_CST ? | |
12387 | TREE_INT_CST_LOW (cdim) : -1); | |
12388 | array_type = promote_type (array_type); | |
12389 | } | |
12390 | dims = nreverse (dims); | |
12391 | ||
8b27f225 PB |
12392 | /* The node is transformed into a function call. Things are done |
12393 | differently according to the number of dimensions. If the number | |
12394 | of dimension is equal to 1, then the nature of the base type | |
12395 | (primitive or not) matters. */ | |
12472854 | 12396 | if (ndims == 1) |
63a212ed | 12397 | return build_new_array (type, TREE_VALUE (dims)); |
8b27f225 | 12398 | |
8b27f225 PB |
12399 | /* Can't reuse what's already written in expr.c because it uses the |
12400 | JVM stack representation. Provide a build_multianewarray. FIXME */ | |
12472854 | 12401 | return build (CALL_EXPR, array_type, |
8b27f225 | 12402 | build_address_of (soft_multianewarray_node), |
12472854 | 12403 | tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)), |
8b27f225 | 12404 | tree_cons (NULL_TREE, |
12472854 | 12405 | build_int_2 (ndims, 0), dims )), |
8b27f225 PB |
12406 | NULL_TREE); |
12407 | } | |
12408 | ||
f8976021 APB |
12409 | /* 10.6 Array initializer. */ |
12410 | ||
12411 | /* Build a wfl for array element that don't have one, so we can | |
12412 | pin-point errors. */ | |
12413 | ||
12414 | static tree | |
12415 | maybe_build_array_element_wfl (node) | |
12416 | tree node; | |
12417 | { | |
12418 | if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION) | |
12419 | return build_expr_wfl (NULL_TREE, ctxp->filename, | |
12420 | ctxp->elc.line, ctxp->elc.prev_col); | |
12421 | else | |
12422 | return NULL_TREE; | |
12423 | } | |
12424 | ||
12425 | /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes | |
12426 | identification of initialized arrays easier to detect during walk | |
12427 | and expansion. */ | |
12428 | ||
12429 | static tree | |
12430 | build_new_array_init (location, values) | |
12431 | int location; | |
12432 | tree values; | |
12433 | { | |
12434 | tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values); | |
12435 | tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor); | |
12436 | EXPR_WFL_LINECOL (to_return) = EXPR_WFL_LINECOL (constructor) = location; | |
12437 | return to_return; | |
12438 | } | |
12439 | ||
12440 | /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error | |
12441 | occurred. Otherwise return NODE after having set its type | |
12442 | appropriately. */ | |
12443 | ||
12444 | static tree | |
12445 | patch_new_array_init (type, node) | |
12446 | tree type, node; | |
f8976021 APB |
12447 | { |
12448 | int error_seen = 0; | |
63a212ed | 12449 | tree current, element_type; |
f8976021 | 12450 | HOST_WIDE_INT length; |
63a212ed PB |
12451 | int all_constant = 1; |
12452 | tree init = TREE_OPERAND (node, 0); | |
f8976021 | 12453 | |
63a212ed PB |
12454 | if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type))) |
12455 | { | |
12456 | parse_error_context (node, | |
12457 | "Invalid array initializer for non-array type `%s'", | |
12458 | lang_printable_name (type, 1)); | |
12459 | return error_mark_node; | |
12460 | } | |
12461 | type = TREE_TYPE (type); | |
12462 | element_type = TYPE_ARRAY_ELEMENT (type); | |
12463 | ||
12464 | CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init)); | |
f8976021 | 12465 | |
63a212ed PB |
12466 | for (length = 0, current = CONSTRUCTOR_ELTS (init); |
12467 | current; length++, current = TREE_CHAIN (current)) | |
f8976021 | 12468 | { |
63a212ed PB |
12469 | tree elt = TREE_VALUE (current); |
12470 | if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT) | |
f8976021 | 12471 | { |
63a212ed PB |
12472 | error_seen |= array_constructor_check_entry (element_type, current); |
12473 | if (! TREE_CONSTANT (TREE_VALUE (current))) | |
12474 | all_constant = 0; | |
f8976021 | 12475 | } |
63a212ed PB |
12476 | else |
12477 | { | |
12478 | TREE_VALUE (current) = patch_new_array_init (element_type, elt); | |
12479 | TREE_PURPOSE (current) = NULL_TREE; | |
12480 | all_constant = 0; | |
12481 | } | |
12482 | if (elt && TREE_VALUE (elt) == error_mark_node) | |
12483 | error_seen = 1; | |
f8976021 APB |
12484 | } |
12485 | ||
12486 | if (error_seen) | |
12487 | return error_mark_node; | |
12488 | ||
12489 | /* Create a new type. We can't reuse the one we have here by | |
12490 | patching its dimension because it originally is of dimension -1 | |
12491 | hence reused by gcc. This would prevent triangular arrays. */ | |
63a212ed PB |
12492 | type = build_java_array_type (element_type, length); |
12493 | TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type)))); | |
12494 | TREE_TYPE (node) = promote_type (type); | |
12495 | TREE_CONSTANT (init) = all_constant; | |
f8976021 APB |
12496 | return node; |
12497 | } | |
12498 | ||
12499 | /* Verify that one entry of the initializer element list can be | |
12500 | assigned to the array base type. Report 1 if an error occurred, 0 | |
12501 | otherwise. */ | |
12502 | ||
12503 | static int | |
12504 | array_constructor_check_entry (type, entry) | |
12505 | tree type, entry; | |
12506 | { | |
12507 | char *array_type_string = NULL; /* For error reports */ | |
12508 | tree value, type_value, new_value, wfl_value, patched; | |
12509 | int error_seen = 0; | |
12510 | ||
12511 | new_value = NULL_TREE; | |
12512 | wfl_value = TREE_VALUE (entry); | |
12513 | ||
f8976021 | 12514 | value = java_complete_tree (TREE_VALUE (entry)); |
1179ebc2 | 12515 | /* patch_string return error_mark_node if arg is error_mark_node */ |
f8976021 APB |
12516 | if ((patched = patch_string (value))) |
12517 | value = patched; | |
1179ebc2 APB |
12518 | if (value == error_mark_node) |
12519 | return 1; | |
f8976021 | 12520 | |
f8976021 APB |
12521 | type_value = TREE_TYPE (value); |
12522 | ||
1179ebc2 | 12523 | /* At anytime, try_builtin_assignconv can report a warning on |
f8976021 APB |
12524 | constant overflow during narrowing. */ |
12525 | SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value); | |
12526 | new_value = try_builtin_assignconv (wfl_operator, type, value); | |
12527 | if (!new_value && (new_value = try_reference_assignconv (type, value))) | |
12528 | type_value = promote_type (type); | |
12529 | ||
12530 | /* Check and report errors */ | |
12531 | if (!new_value) | |
12532 | { | |
12533 | char *msg = (!valid_cast_to_p (type_value, type) ? | |
12534 | "Can't" : "Explicit cast needed to"); | |
12535 | if (!array_type_string) | |
12536 | array_type_string = strdup (lang_printable_name (type, 1)); | |
12537 | parse_error_context | |
12538 | (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'", | |
12539 | msg, lang_printable_name (type_value, 1), array_type_string); | |
12540 | error_seen = 1; | |
12541 | } | |
12542 | ||
12543 | if (new_value) | |
12544 | { | |
12545 | new_value = maybe_build_primttype_type_ref (new_value, wfl_operator); | |
12546 | TREE_VALUE (entry) = new_value; | |
12547 | } | |
12548 | ||
12549 | if (array_type_string) | |
12550 | free (array_type_string); | |
1179ebc2 APB |
12551 | |
12552 | TREE_PURPOSE (entry) = NULL_TREE; | |
f8976021 APB |
12553 | return error_seen; |
12554 | } | |
12555 | ||
8b27f225 PB |
12556 | static tree |
12557 | build_this (location) | |
12558 | int location; | |
12559 | { | |
12560 | tree node = build_wfl_node (this_identifier_node, input_filename, 0, 0); | |
12561 | TREE_SET_CODE (node, THIS_EXPR); | |
12562 | EXPR_WFL_LINECOL (node) = location; | |
12563 | return node; | |
12564 | } | |
12565 | ||
12566 | /* 14.15 The return statement. It builds a modify expression that | |
12567 | assigns the returned value to the RESULT_DECL that hold the value | |
12568 | to be returned. */ | |
12569 | ||
12570 | static tree | |
12571 | build_return (location, op) | |
12572 | int location; | |
12573 | tree op; | |
12574 | { | |
12575 | tree node = build1 (RETURN_EXPR, NULL_TREE, op); | |
12576 | EXPR_WFL_LINECOL (node) = location; | |
12577 | node = build_debugable_stmt (location, node); | |
12578 | return node; | |
12579 | } | |
12580 | ||
12581 | static tree | |
12582 | patch_return (node) | |
12583 | tree node; | |
12584 | { | |
12585 | tree return_exp = TREE_OPERAND (node, 0); | |
12586 | tree meth = current_function_decl; | |
12587 | tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl)); | |
8b27f225 PB |
12588 | int error_found = 0; |
12589 | ||
12590 | TREE_TYPE (node) = error_mark_node; | |
12591 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
12592 | ||
12593 | /* It's invalid to have a return value within a function that is | |
12594 | declared with the keyword void or that is a constructor */ | |
12595 | if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth))) | |
12596 | error_found = 1; | |
12597 | ||
12598 | /* It's invalid to have a no return value within a function that | |
12599 | isn't declared with the keyword `void' */ | |
12600 | if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth))) | |
12601 | error_found = 2; | |
12602 | ||
12603 | if (error_found) | |
12604 | { | |
22eed1e6 APB |
12605 | if (!DECL_CONSTRUCTOR_P (meth)) |
12606 | { | |
12607 | char *t = strdup (lang_printable_name (mtype, 0)); | |
12608 | parse_error_context (wfl_operator, | |
12609 | "`return' with%s value from `%s %s'", | |
12610 | (error_found == 1 ? "" : "out"), | |
12611 | t, lang_printable_name (meth, 0)); | |
12612 | free (t); | |
12613 | } | |
12614 | else | |
12615 | parse_error_context (wfl_operator, | |
12616 | "`return' with value from constructor `%s'", | |
12617 | lang_printable_name (meth, 0)); | |
8b27f225 PB |
12618 | return error_mark_node; |
12619 | } | |
12620 | ||
5e942c50 APB |
12621 | /* If we have a return_exp, build a modify expression and expand |
12622 | it. Note: at that point, the assignment is declared valid, but we | |
12623 | may want to carry some more hacks */ | |
8b27f225 PB |
12624 | if (return_exp) |
12625 | { | |
5e942c50 APB |
12626 | tree exp = java_complete_tree (return_exp); |
12627 | tree modify, patched; | |
12628 | ||
12629 | /* If the function returned value and EXP are booleans, EXP has | |
12630 | to be converted into the type of DECL_RESULT, which is integer | |
12631 | (see complete_start_java_method) */ | |
12632 | if (TREE_TYPE (exp) == boolean_type_node && | |
12633 | TREE_TYPE (TREE_TYPE (meth)) == boolean_type_node) | |
12634 | exp = convert_to_integer (TREE_TYPE (DECL_RESULT (meth)), exp); | |
12635 | ||
12636 | /* `null' can be assigned to a function returning a reference */ | |
12637 | if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth))) && | |
12638 | exp == null_pointer_node) | |
12639 | exp = build_null_of_type (TREE_TYPE (TREE_TYPE (meth))); | |
12640 | ||
12641 | if ((patched = patch_string (exp))) | |
12642 | exp = patched; | |
12643 | ||
12644 | modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp); | |
8b27f225 PB |
12645 | EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node); |
12646 | modify = java_complete_tree (modify); | |
5e942c50 | 12647 | |
8b27f225 PB |
12648 | if (modify != error_mark_node) |
12649 | { | |
12650 | TREE_SIDE_EFFECTS (modify) = 1; | |
12651 | TREE_OPERAND (node, 0) = modify; | |
12652 | } | |
12653 | else | |
12654 | return error_mark_node; | |
12655 | } | |
12656 | TREE_TYPE (node) = void_type_node; | |
12657 | TREE_SIDE_EFFECTS (node) = 1; | |
12658 | return node; | |
12659 | } | |
12660 | ||
12661 | /* 14.8 The if Statement */ | |
12662 | ||
12663 | static tree | |
12664 | build_if_else_statement (location, expression, if_body, else_body) | |
12665 | int location; | |
12666 | tree expression, if_body, else_body; | |
12667 | { | |
12668 | tree node; | |
8b27f225 | 12669 | if (!else_body) |
c877974e | 12670 | else_body = empty_stmt_node; |
8b27f225 PB |
12671 | node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body); |
12672 | EXPR_WFL_LINECOL (node) = location; | |
12673 | node = build_debugable_stmt (location, node); | |
12674 | return node; | |
12675 | } | |
12676 | ||
12677 | static tree | |
12678 | patch_if_else_statement (node) | |
12679 | tree node; | |
12680 | { | |
12681 | tree expression = TREE_OPERAND (node, 0); | |
12682 | ||
12683 | TREE_TYPE (node) = error_mark_node; | |
12684 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
12685 | ||
12686 | /* The type of expression must be boolean */ | |
12687 | if (TREE_TYPE (expression) != boolean_type_node | |
12688 | && TREE_TYPE (expression) != promoted_boolean_type_node) | |
12689 | { | |
12690 | parse_error_context | |
12691 | (wfl_operator, | |
12692 | "Incompatible type for `if'. Can't convert `%s' to `boolean'", | |
12693 | lang_printable_name (TREE_TYPE (expression), 0)); | |
12694 | return error_mark_node; | |
12695 | } | |
12696 | ||
12697 | TREE_TYPE (node) = void_type_node; | |
12698 | TREE_SIDE_EFFECTS (node) = 1; | |
12472854 | 12699 | CAN_COMPLETE_NORMALLY (node) |
c877974e APB |
12700 | = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)) |
12701 | | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2)); | |
8b27f225 PB |
12702 | return node; |
12703 | } | |
12704 | ||
12705 | /* 14.6 Labeled Statements */ | |
12706 | ||
12707 | /* Action taken when a lableled statement is parsed. a new | |
12708 | LABELED_BLOCK_EXPR is created. No statement is attached to the | |
12709 | label, yet. */ | |
12710 | ||
12711 | static tree | |
12712 | build_labeled_block (location, label) | |
12713 | int location; | |
12714 | tree label; | |
12715 | { | |
12716 | tree label_name = merge_qualified_name (label_id, label); | |
12717 | tree label_decl, node; | |
12718 | ||
ac825856 | 12719 | /* Issue an error if we try to reuse a label that was previously |
8b27f225 PB |
12720 | declared */ |
12721 | if (IDENTIFIER_LOCAL_VALUE (label_name)) | |
12722 | { | |
12723 | EXPR_WFL_LINECOL (wfl_operator) = location; | |
ac825856 APB |
12724 | parse_error_context (wfl_operator, "Declaration of `%s' shadows " |
12725 | "a previous label declaration", | |
8b27f225 PB |
12726 | IDENTIFIER_POINTER (label)); |
12727 | EXPR_WFL_LINECOL (wfl_operator) = | |
12728 | EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name)); | |
ac825856 APB |
12729 | parse_error_context (wfl_operator, "This is the location of the " |
12730 | "previous declaration of label `%s'", | |
12731 | IDENTIFIER_POINTER (label)); | |
12732 | java_error_count--; | |
8b27f225 PB |
12733 | } |
12734 | ||
12735 | label_decl = create_label_decl (label_name); | |
12736 | node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE); | |
12737 | EXPR_WFL_LINECOL (node) = location; | |
12738 | TREE_SIDE_EFFECTS (node) = 1; | |
12739 | return node; | |
12740 | } | |
12741 | ||
12742 | /* Generate a label crafting a unique name for it. This is used to | |
12743 | implicitely label loops that aren't the body part of labeled | |
12744 | statement. */ | |
12745 | ||
12746 | static tree | |
12747 | generate_labeled_block () | |
12748 | { | |
12749 | return build_labeled_block (0, generate_name ()); | |
12750 | } | |
12751 | ||
12752 | /* A labeled statement LBE is attached a statement. */ | |
12753 | ||
12754 | static tree | |
12755 | complete_labeled_statement (lbe, statement) | |
12756 | tree lbe; /* Labeled block expr */ | |
12757 | tree statement; | |
12758 | { | |
12759 | /* In anyways, tie the loop to its statement */ | |
12760 | LABELED_BLOCK_BODY (lbe) = statement; | |
12761 | ||
12762 | /* Ok, if statement is a for loop, we have to attach the labeled | |
12763 | statement to the block the for loop belongs to and return the | |
12764 | block instead */ | |
12765 | if (TREE_CODE (statement) == LOOP_EXPR && IS_FOR_LOOP_P (statement)) | |
12766 | { | |
12767 | java_method_add_stmt (current_function_decl, lbe); | |
12768 | return exit_block (); | |
12769 | } | |
12770 | ||
12771 | return lbe; | |
12772 | } | |
12773 | ||
12774 | /* 14.10, 14.11, 14.12 Loop Statements */ | |
12775 | ||
12776 | /* Create an empty LOOP_EXPR and make it the last in the nested loop | |
12777 | list. */ | |
12778 | ||
12779 | static tree | |
12780 | build_new_loop (loop_body) | |
12781 | tree loop_body; | |
12782 | { | |
12783 | tree loop = build (LOOP_EXPR, NULL_TREE, loop_body); | |
12784 | TREE_SIDE_EFFECTS (loop) = 1; | |
12785 | PUSH_LOOP (loop); | |
12786 | return loop; | |
12787 | } | |
12788 | ||
12789 | /* Create a loop body according to the following structure: | |
12790 | COMPOUND_EXPR | |
12791 | COMPOUND_EXPR (loop main body) | |
12792 | EXIT_EXPR (this order is for while/for loops. | |
12793 | LABELED_BLOCK_EXPR the order is reversed for do loops) | |
12794 | LABEL_DECL (continue occurding here branche at the | |
12795 | BODY end of this labeled block) | |
12796 | INCREMENT (if any) | |
12797 | ||
12798 | REVERSED, if non zero, tells that the loop condition expr comes | |
12799 | after the body, like in the do-while loop. | |
12800 | ||
12801 | To obtain a loop, the loop body structure described above is | |
12802 | encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR: | |
12803 | ||
12804 | LABELED_BLOCK_EXPR | |
12805 | LABEL_DECL (use this label to exit the loop) | |
12806 | LOOP_EXPR | |
12807 | <structure described above> */ | |
12808 | ||
12809 | static tree | |
12810 | build_loop_body (location, condition, reversed) | |
12811 | int location; | |
12812 | tree condition; | |
12813 | int reversed; | |
12814 | { | |
12815 | tree first, second, body; | |
12816 | ||
12817 | condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */ | |
12818 | EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */ | |
12819 | condition = build_debugable_stmt (location, condition); | |
12820 | TREE_SIDE_EFFECTS (condition) = 1; | |
12821 | ||
12822 | body = generate_labeled_block (); | |
12823 | first = (reversed ? body : condition); | |
12824 | second = (reversed ? condition : body); | |
12825 | return | |
12826 | build (COMPOUND_EXPR, NULL_TREE, | |
c877974e | 12827 | build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node); |
8b27f225 PB |
12828 | } |
12829 | ||
12830 | /* Install CONDITION (if any) and loop BODY (using REVERSED to tell | |
12831 | their order) on the current loop. Unlink the current loop from the | |
12832 | loop list. */ | |
12833 | ||
12834 | static tree | |
12835 | complete_loop_body (location, condition, body, reversed) | |
12836 | int location; | |
12837 | tree condition, body; | |
12838 | int reversed; | |
12839 | { | |
12840 | tree to_return = ctxp->current_loop; | |
12841 | tree loop_body = LOOP_EXPR_BODY (to_return); | |
12842 | if (condition) | |
12843 | { | |
12844 | tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed); | |
12845 | /* We wrapped the EXIT_EXPR around a WFL so we can debug it. | |
12846 | The real EXIT_EXPR is one operand further. */ | |
12847 | EXPR_WFL_LINECOL (cnode) = location; | |
12848 | /* This one is for accurate error reports */ | |
12849 | EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location; | |
12850 | TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition; | |
12851 | } | |
12852 | LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body; | |
12853 | POP_LOOP (); | |
12854 | return to_return; | |
12855 | } | |
12856 | ||
12857 | /* Tailored version of complete_loop_body for FOR loops, when FOR | |
12858 | loops feature the condition part */ | |
12859 | ||
12860 | static tree | |
12861 | complete_for_loop (location, condition, update, body) | |
12862 | int location; | |
12863 | tree condition, update, body; | |
12864 | { | |
12865 | /* Put the condition and the loop body in place */ | |
12866 | tree loop = complete_loop_body (location, condition, body, 0); | |
12867 | /* LOOP is the current loop which has been now popped of the loop | |
12868 | stack. Install the update block */ | |
12869 | LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update; | |
12870 | return loop; | |
12871 | } | |
12872 | ||
12873 | /* If the loop isn't surrounded by a labeled statement, create one and | |
12874 | insert LOOP as it's body. */ | |
12875 | ||
12876 | static tree | |
12877 | patch_loop_statement (loop) | |
12878 | tree loop; | |
12879 | { | |
12880 | tree loop_label, to_return_as_loop; | |
12881 | ||
12882 | if (LOOP_HAS_LABEL_P (loop)) | |
12883 | { | |
12884 | loop_label = ctxp->current_labeled_block; | |
12885 | to_return_as_loop = loop; | |
12886 | } | |
12887 | else | |
12888 | { | |
12889 | loop_label = generate_labeled_block (); | |
12890 | LABELED_BLOCK_BODY (loop_label) = loop; | |
12891 | PUSH_LABELED_BLOCK (loop_label); | |
12892 | to_return_as_loop = loop_label; | |
12893 | } | |
12894 | TREE_TYPE (to_return_as_loop) = void_type_node; | |
12895 | return to_return_as_loop; | |
12896 | } | |
12897 | ||
12898 | /* 14.13, 14.14: break and continue Statements */ | |
12899 | ||
12900 | /* Build a break or a continue statement. a null NAME indicates an | |
12901 | unlabeled break/continue statement. */ | |
12902 | ||
12903 | static tree | |
12904 | build_bc_statement (location, is_break, name) | |
12905 | int location, is_break; | |
12906 | tree name; | |
12907 | { | |
12908 | tree break_continue, label_block_expr = NULL_TREE; | |
12909 | ||
12910 | if (name) | |
12911 | { | |
12912 | if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE | |
12913 | (merge_qualified_name (label_id, EXPR_WFL_NODE (name))))) | |
12914 | /* Null means that we don't have a target for this named | |
12915 | break/continue. In this case, we make the target to be the | |
12916 | label name, so that the error can be reported accuratly in | |
12917 | patch_bc_statement. */ | |
12918 | label_block_expr = EXPR_WFL_NODE (name); | |
12919 | } | |
12920 | /* Unlabeled break/continue will be handled during the | |
12921 | break/continue patch operation */ | |
12922 | break_continue | |
12923 | = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE); | |
12924 | ||
12925 | IS_BREAK_STMT_P (break_continue) = is_break; | |
12926 | TREE_SIDE_EFFECTS (break_continue) = 1; | |
12927 | EXPR_WFL_LINECOL (break_continue) = location; | |
12928 | break_continue = build_debugable_stmt (location, break_continue); | |
12929 | return break_continue; | |
12930 | } | |
12931 | ||
12932 | /* Verification of a break/continue statement. */ | |
12933 | ||
12934 | static tree | |
12935 | patch_bc_statement (node) | |
12936 | tree node; | |
12937 | { | |
12938 | tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt; | |
12939 | int is_unlabeled = 0; | |
12940 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
12941 | ||
12942 | /* Not having a target means that the break/continue statement is | |
12943 | unlabeled. We try to find a decent label for it */ | |
12944 | if (!bc_label) | |
12945 | { | |
12946 | is_unlabeled = 1; | |
12947 | /* There should be a loop/switch to branch to */ | |
12948 | if (ctxp->current_loop) | |
12949 | { | |
12950 | if (TREE_CODE (ctxp->current_loop) == LOOP_EXPR) | |
12951 | { | |
12952 | /* At that stage, we're in the loop body, which is | |
12953 | encapsulated around a LABELED_BLOCK_EXPR. So searching | |
12954 | the current loop label requires us to consider the | |
12955 | labeled block before the current one. */ | |
12956 | if (!LOOP_HAS_LABEL_SKIP_P (ctxp->current_loop)) | |
12957 | fatal ("unlabeled loop has no installed label -- " | |
12958 | "patch_bc_statement"); | |
12959 | bc_label = TREE_CHAIN (ctxp->current_labeled_block); | |
12960 | } | |
12961 | /* For a SWITCH statement, this is the current one */ | |
12962 | else | |
12963 | bc_label = ctxp->current_labeled_block; | |
12964 | } | |
12965 | /* Not having a loop to break/continue to is an error */ | |
12966 | else | |
12967 | { | |
12968 | parse_error_context (wfl_operator, "`%s' must be in loop%s", | |
12969 | (IS_BREAK_STMT_P (node) ? "break" : "continue"), | |
12970 | (IS_BREAK_STMT_P (node) ? " or switch" : "")); | |
12971 | return error_mark_node; | |
12972 | } | |
12973 | } | |
12974 | /* Having an identifier here means that the target is unknown. */ | |
12975 | else if (TREE_CODE (bc_label) == IDENTIFIER_NODE) | |
12976 | { | |
12977 | parse_error_context (wfl_operator, "No label definition found for `%s'", | |
12978 | IDENTIFIER_POINTER (bc_label)); | |
12979 | return error_mark_node; | |
12980 | } | |
12981 | ||
12982 | /* Find the statement we're targeting. */ | |
12983 | target_stmt = LABELED_BLOCK_BODY (bc_label); | |
12984 | ||
12985 | /* 14.13 The break Statement */ | |
12986 | if (IS_BREAK_STMT_P (node)) | |
12987 | { | |
12988 | /* Named break are always fine, as far as they have a target | |
12989 | (already verified). Anonymous break need to target | |
12990 | while/do/for/switch */ | |
12991 | if (is_unlabeled && | |
12992 | !(TREE_CODE (target_stmt) == LOOP_EXPR /* do/while/for */ | |
12993 | || TREE_CODE (target_stmt) == SWITCH_EXPR)) /* switch FIXME */ | |
12994 | { | |
12995 | parse_error_context (wfl_operator, | |
12996 | "`break' must be in loop or switch"); | |
12997 | return error_mark_node; | |
12998 | } | |
12999 | /* If previously unlabeled, install the new found label */ | |
13000 | if (is_unlabeled) | |
13001 | EXIT_BLOCK_LABELED_BLOCK (node) = bc_label; | |
13002 | } | |
13003 | /* 14.14 The continue Statement */ | |
13004 | /* The continue statement must always target a loop */ | |
13005 | else | |
13006 | { | |
13007 | if (TREE_CODE (target_stmt) != LOOP_EXPR) /* do/while/for */ | |
13008 | { | |
13009 | parse_error_context (wfl_operator, "`continue' must be in loop"); | |
13010 | return error_mark_node; | |
13011 | } | |
13012 | /* Everything looks good. We can fix the `continue' jump to go | |
13013 | at the place in the loop were the continue is. The continue | |
13014 | is the current labeled block, by construction. */ | |
12472854 | 13015 | EXIT_BLOCK_LABELED_BLOCK (node) = bc_label = ctxp->current_labeled_block; |
8b27f225 PB |
13016 | } |
13017 | ||
12472854 PB |
13018 | CAN_COMPLETE_NORMALLY (bc_label) = 1; |
13019 | ||
8b27f225 PB |
13020 | /* Our break/continue don't return values. */ |
13021 | TREE_TYPE (node) = void_type_node; | |
13022 | /* Encapsulate the break within a compound statement so that it's | |
13023 | expanded all the times by expand_expr (and not clobered | |
13024 | sometimes, like after a if statement) */ | |
13025 | node = add_stmt_to_compound (NULL_TREE, void_type_node, node); | |
13026 | TREE_SIDE_EFFECTS (node) = 1; | |
13027 | return node; | |
13028 | } | |
13029 | ||
13030 | /* Process the exit expression belonging to a loop. Its type must be | |
13031 | boolean. */ | |
13032 | ||
13033 | static tree | |
13034 | patch_exit_expr (node) | |
13035 | tree node; | |
13036 | { | |
13037 | tree expression = TREE_OPERAND (node, 0); | |
13038 | TREE_TYPE (node) = error_mark_node; | |
13039 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
13040 | ||
13041 | /* The type of expression must be boolean */ | |
13042 | if (TREE_TYPE (expression) != boolean_type_node) | |
13043 | { | |
13044 | parse_error_context | |
13045 | (wfl_operator, | |
13046 | "Incompatible type for loop conditional. Can't convert `%s' to " | |
13047 | "`boolean'", | |
13048 | lang_printable_name (TREE_TYPE (expression), 0)); | |
13049 | return error_mark_node; | |
13050 | } | |
13051 | /* Now we know things are allright, invert the condition, fold and | |
13052 | return */ | |
13053 | TREE_OPERAND (node, 0) = | |
13054 | fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression)); | |
12472854 PB |
13055 | |
13056 | if (! integer_zerop (TREE_OPERAND (node, 0)) | |
13057 | && ctxp->current_loop != NULL_TREE | |
13058 | && TREE_CODE (ctxp->current_loop) == LOOP_EXPR) | |
13059 | CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1; | |
13060 | if (! integer_onep (TREE_OPERAND (node, 0))) | |
13061 | CAN_COMPLETE_NORMALLY (node) = 1; | |
13062 | ||
13063 | ||
8b27f225 PB |
13064 | TREE_TYPE (node) = void_type_node; |
13065 | return node; | |
13066 | } | |
13067 | ||
13068 | /* 14.9 Switch statement */ | |
13069 | ||
13070 | static tree | |
13071 | patch_switch_statement (node) | |
13072 | tree node; | |
13073 | { | |
c877974e | 13074 | tree se = TREE_OPERAND (node, 0), se_type; |
8b27f225 PB |
13075 | |
13076 | /* Complete the switch expression */ | |
13077 | se = TREE_OPERAND (node, 0) = java_complete_tree (se); | |
13078 | se_type = TREE_TYPE (se); | |
13079 | /* The type of the switch expression must be char, byte, short or | |
13080 | int */ | |
13081 | if (!JINTEGRAL_TYPE_P (se_type)) | |
13082 | { | |
13083 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
13084 | parse_error_context (wfl_operator, "Incompatible type for `switch'. " | |
13085 | "Can't convert `%s' to `int'", | |
13086 | lang_printable_name (se_type, 0)); | |
13087 | /* This is what java_complete_tree will check */ | |
13088 | TREE_OPERAND (node, 0) = error_mark_node; | |
13089 | return error_mark_node; | |
13090 | } | |
13091 | ||
12472854 | 13092 | TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1)); |
8b27f225 PB |
13093 | |
13094 | /* Ready to return */ | |
12472854 | 13095 | if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK) |
8b27f225 PB |
13096 | { |
13097 | TREE_TYPE (node) = error_mark_node; | |
13098 | return error_mark_node; | |
13099 | } | |
13100 | TREE_TYPE (node) = void_type_node; | |
13101 | TREE_SIDE_EFFECTS (node) = 1; | |
12472854 | 13102 | CAN_COMPLETE_NORMALLY (node) |
c877974e APB |
13103 | = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)) |
13104 | || ! SWITCH_HAS_DEFAULT (node); | |
8b27f225 PB |
13105 | return node; |
13106 | } | |
13107 | ||
8b27f225 PB |
13108 | /* 14.18 The try statement */ |
13109 | ||
13110 | /* Wrap BLOCK around a LABELED_BLOCK, set DECL to the newly generated | |
13111 | exit labeld and issue a jump to FINALLY_LABEL: | |
13112 | ||
13113 | LABELED_BLOCK | |
13114 | BLOCK | |
13115 | <orignal_statments> | |
13116 | DECL = &LABEL_DECL | |
13117 | GOTO_EXPR | |
13118 | FINALLY_LABEL | |
13119 | LABEL_DECL */ | |
13120 | ||
13121 | static tree | |
13122 | build_jump_to_finally (block, decl, finally_label, type) | |
13123 | tree block, decl, finally_label, type; | |
13124 | { | |
13125 | tree stmt; | |
13126 | tree new_block = build (LABELED_BLOCK_EXPR, type, | |
13127 | create_label_decl (generate_name ()), block); | |
13128 | ||
13129 | stmt = build (MODIFY_EXPR, void_type_node, decl, | |
13130 | build_address_of (LABELED_BLOCK_LABEL (new_block))); | |
13131 | TREE_SIDE_EFFECTS (stmt) = 1; | |
82371d41 | 13132 | CAN_COMPLETE_NORMALLY (stmt) = 1; |
8b27f225 PB |
13133 | add_stmt_to_block (block, type, stmt); |
13134 | stmt = build (GOTO_EXPR, void_type_node, finally_label); | |
13135 | TREE_SIDE_EFFECTS (stmt) = 1; | |
13136 | add_stmt_to_block (block, type, stmt); | |
13137 | return new_block; | |
13138 | } | |
13139 | ||
13140 | static tree | |
13141 | build_try_statement (location, try_block, catches, finally) | |
13142 | int location; | |
13143 | tree try_block, catches, finally; | |
13144 | { | |
13145 | tree node, rff; | |
13146 | ||
12472854 | 13147 | if (finally && ! flag_emit_class_files) |
8b27f225 PB |
13148 | { |
13149 | /* This block defines a scope for the entire try[-catch]-finally | |
13150 | sequence. It hold a local variable used to return from the | |
13151 | finally using a computed goto. We call it | |
13152 | return_from_finally (RFF). */ | |
c877974e | 13153 | rff = build_decl (VAR_DECL, generate_name (), return_address_type_node); |
8b27f225 PB |
13154 | |
13155 | /* Modification of the try block. */ | |
13156 | try_block = build_jump_to_finally (try_block, rff, | |
13157 | FINALLY_EXPR_LABEL (finally), | |
13158 | NULL_TREE); | |
13159 | ||
13160 | /* To the finally block: add the computed goto */ | |
13161 | add_stmt_to_block (FINALLY_EXPR_BLOCK (finally), NULL_TREE, | |
13162 | build (GOTO_EXPR, void_type_node, rff)); | |
13163 | ||
13164 | /* Modification of each catch blocks, if any */ | |
13165 | if (catches) | |
13166 | { | |
13167 | tree catch, catch_decl, catch_block, stmt; | |
13168 | ||
13169 | for (catch = catches; catch; catch = TREE_CHAIN (catch)) | |
13170 | TREE_OPERAND (catch, 0) = | |
13171 | build_jump_to_finally (TREE_OPERAND (catch, 0), rff, | |
13172 | FINALLY_EXPR_LABEL (finally), | |
13173 | NULL_TREE); | |
13174 | ||
13175 | /* Plus, at the end of the list, we add the catch clause that | |
13176 | will catch an uncaught exception, call finally and rethrow it: | |
13177 | BLOCK | |
13178 | void *exception_parameter; (catch_decl) | |
13179 | LABELED_BLOCK | |
13180 | BLOCK | |
13181 | exception_parameter = _Jv_exception_info (); | |
13182 | RFF = &LABEL_DECL; | |
13183 | goto finally; | |
13184 | LABEL_DECL; | |
13185 | CALL_EXPR | |
13186 | Jv_ReThrow | |
13187 | exception_parameter */ | |
c877974e | 13188 | catch_decl = build_decl (VAR_DECL, generate_name (), ptr_type_node); |
8b27f225 PB |
13189 | BUILD_ASSIGN_EXCEPTION_INFO (stmt, catch_decl); |
13190 | catch_block = build_expr_block (stmt, NULL_TREE); | |
13191 | catch_block = build_jump_to_finally (catch_block, rff, | |
13192 | FINALLY_EXPR_LABEL (finally), | |
13193 | void_type_node); | |
13194 | BUILD_THROW (stmt, catch_decl); | |
13195 | catch_block = build_expr_block (catch_block, catch_decl); | |
13196 | add_stmt_to_block (catch_block, void_type_node, stmt); | |
13197 | ||
13198 | /* Link the new handler to the existing list as the first | |
13199 | entry. It will be the last one to be generated. */ | |
13200 | catch = build1 (CATCH_EXPR, void_type_node, catch_block); | |
13201 | TREE_CHAIN (catch) = catches; | |
13202 | catches = catch; | |
13203 | } | |
13204 | } | |
13205 | ||
13206 | node = build (TRY_EXPR, NULL_TREE, try_block, catches, finally); | |
13207 | EXPR_WFL_LINECOL (node) = location; | |
13208 | ||
13209 | /* If we have a finally, surround this whole thing by a block where | |
13210 | the RFF local variable is defined. */ | |
13211 | ||
12472854 PB |
13212 | return (finally && ! flag_emit_class_files ? build_expr_block (node, rff) |
13213 | : node); | |
8b27f225 PB |
13214 | } |
13215 | ||
13216 | /* Get the catch clause block from an element of the catch clause | |
13217 | list. If depends on whether a finally clause exists or node (in | |
13218 | which case the original catch clause was surrounded by a | |
13219 | LABELED_BLOCK_EXPR. */ | |
13220 | ||
13221 | tree | |
13222 | java_get_catch_block (node, finally_present_p) | |
13223 | tree node; | |
13224 | int finally_present_p; | |
13225 | { | |
13226 | return (CATCH_EXPR_GET_EXPR (TREE_OPERAND (node, 0), finally_present_p)); | |
13227 | } | |
13228 | ||
13229 | static tree | |
13230 | patch_try_statement (node) | |
13231 | tree node; | |
13232 | { | |
13233 | int error_found = 0; | |
13234 | tree try = TREE_OPERAND (node, 0); | |
13235 | /* Exception handlers are considered in left to right order */ | |
13236 | tree catch = nreverse (TREE_OPERAND (node, 1)); | |
13237 | tree finally = TREE_OPERAND (node, 2); | |
13238 | int finally_p = (finally ? 1 : 0); | |
13239 | tree current, caught_type_list = NULL_TREE; | |
13240 | ||
13241 | /* Check catch clauses, if any. Every time we find an error, we try | |
13242 | to process the next catch clause. We process the catch clause before | |
13243 | the try block so that when processing the try block we can check thrown | |
13244 | exceptions againts the caught type list. */ | |
13245 | for (current = catch; current; current = TREE_CHAIN (current)) | |
13246 | { | |
13247 | tree carg_decl, carg_type; | |
13248 | tree sub_current, catch_block, catch_clause; | |
13249 | int unreachable; | |
13250 | ||
13251 | /* Always detect the last catch clause if a finally is | |
13252 | present. This is the catch-all handler and it just needs to | |
13253 | be walked. */ | |
13254 | if (!TREE_CHAIN (current) && finally) | |
13255 | { | |
13256 | TREE_OPERAND (current, 0) = | |
13257 | java_complete_tree (TREE_OPERAND (current, 0)); | |
13258 | continue; | |
13259 | } | |
13260 | ||
13261 | /* At this point, the structure of the catch clause is | |
13262 | LABELED_BLOCK_EXPR (if we have a finally) | |
13263 | CATCH_EXPR (catch node) | |
13264 | BLOCK (with the decl of the parameter) | |
13265 | COMPOUND_EXPR | |
63a212ed | 13266 | MODIFY_EXPR (assignment of the catch parameter) |
8b27f225 PB |
13267 | BLOCK (catch clause block) |
13268 | LABEL_DECL (where to return after finally (if any)) | |
13269 | ||
13270 | Since the structure of the catch clause depends on the | |
13271 | presence of a finally, we use a function call to get to the | |
13272 | cath clause */ | |
13273 | catch_clause = java_get_catch_block (current, finally_p); | |
13274 | carg_decl = BLOCK_EXPR_DECLS (catch_clause); | |
13275 | carg_type = TREE_TYPE (TREE_TYPE (carg_decl)); | |
13276 | ||
13277 | /* Catch clauses can't have more than one parameter declared, | |
13278 | but it's already enforced by the grammar. Make sure that the | |
13279 | only parameter of the clause statement in of class Throwable | |
13280 | or a subclass of Throwable, but that was done earlier. The | |
13281 | catch clause parameter type has also been resolved. */ | |
13282 | ||
13283 | /* Just make sure that the catch clause parameter type inherits | |
13284 | from java.lang.Throwable */ | |
13285 | if (!inherits_from_p (carg_type, throwable_type_node)) | |
13286 | { | |
13287 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current); | |
13288 | parse_error_context (wfl_operator, | |
13289 | "Can't catch class `%s'. Catch clause " | |
13290 | "parameter type must be a subclass of " | |
13291 | "class `java.lang.Throwable'", | |
13292 | lang_printable_name (carg_type, 0)); | |
13293 | error_found = 1; | |
13294 | continue; | |
13295 | } | |
13296 | ||
13297 | /* Partial check for unreachable catch statement: The catch | |
13298 | clause is reachable iff is no earlier catch block A in | |
13299 | the try statement such that the type of the catch | |
13300 | clause's parameter is the same as or a subclass of the | |
13301 | type of A's parameter */ | |
13302 | unreachable = 0; | |
13303 | for (sub_current = catch; | |
13304 | sub_current != current; sub_current = TREE_CHAIN (sub_current)) | |
13305 | { | |
13306 | tree sub_catch_clause, decl; | |
13307 | sub_catch_clause = java_get_catch_block (sub_current, finally_p); | |
13308 | decl = BLOCK_EXPR_DECLS (sub_catch_clause); | |
13309 | ||
13310 | if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl)))) | |
13311 | { | |
13312 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current); | |
13313 | parse_error_context | |
13314 | (wfl_operator, "`catch' not reached because of the catch " | |
13315 | "clause at line %d", EXPR_WFL_LINENO (sub_current)); | |
13316 | unreachable = error_found = 1; | |
13317 | break; | |
13318 | } | |
13319 | } | |
8b27f225 PB |
13320 | /* Complete the catch clause block */ |
13321 | catch_block = java_complete_tree (TREE_OPERAND (current, 0)); | |
13322 | if (catch_block == error_mark_node) | |
13323 | { | |
13324 | error_found = 1; | |
13325 | continue; | |
13326 | } | |
12472854 PB |
13327 | if (CAN_COMPLETE_NORMALLY (catch_block)) |
13328 | CAN_COMPLETE_NORMALLY (node) = 1; | |
8b27f225 | 13329 | TREE_OPERAND (current, 0) = catch_block; |
12472854 PB |
13330 | |
13331 | if (unreachable) | |
13332 | continue; | |
13333 | ||
13334 | /* Things to do here: the exception must be thrown */ | |
13335 | ||
13336 | /* Link this type to the caught type list */ | |
13337 | caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list); | |
8b27f225 PB |
13338 | } |
13339 | ||
13340 | PUSH_EXCEPTIONS (caught_type_list); | |
13341 | if ((try = java_complete_tree (try)) == error_mark_node) | |
13342 | error_found = 1; | |
12472854 PB |
13343 | if (CAN_COMPLETE_NORMALLY (try)) |
13344 | CAN_COMPLETE_NORMALLY (node) = 1; | |
8b27f225 PB |
13345 | POP_EXCEPTIONS (); |
13346 | ||
13347 | /* Process finally */ | |
13348 | if (finally) | |
13349 | { | |
12472854 PB |
13350 | current = java_complete_tree (FINALLY_EXPR_BLOCK (finally)); |
13351 | FINALLY_EXPR_BLOCK (finally) = current; | |
13352 | if (current == error_mark_node) | |
8b27f225 | 13353 | error_found = 1; |
12472854 PB |
13354 | if (! CAN_COMPLETE_NORMALLY (current)) |
13355 | CAN_COMPLETE_NORMALLY (node) = 0; | |
8b27f225 PB |
13356 | } |
13357 | ||
13358 | /* Verification ends here */ | |
13359 | if (error_found) | |
13360 | return error_mark_node; | |
13361 | ||
13362 | TREE_OPERAND (node, 0) = try; | |
13363 | TREE_OPERAND (node, 1) = catch; | |
13364 | TREE_OPERAND (node, 2) = finally; | |
13365 | TREE_TYPE (node) = void_type_node; | |
13366 | return node; | |
13367 | } | |
13368 | ||
13369 | /* 14.17 The synchronized Statement */ | |
13370 | ||
13371 | static tree | |
13372 | patch_synchronized_statement (node, wfl_op1) | |
13373 | tree node, wfl_op1; | |
13374 | { | |
13375 | tree expr = TREE_OPERAND (node, 0); | |
13376 | tree block = TREE_OPERAND (node, 1); | |
13377 | tree try_block, catch_all, stmt, compound, decl; | |
13378 | ||
13379 | /* The TYPE of expr must be a reference type */ | |
13380 | if (!JREFERENCE_TYPE_P (TREE_TYPE (TREE_OPERAND (node, 0)))) | |
13381 | { | |
13382 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); | |
13383 | parse_error_context (wfl_operator, "Incompatible type for `synchronized'" | |
13384 | ". Can't convert `%s' to `java.lang.Object'", | |
13385 | lang_printable_name (TREE_TYPE (expr), 0)); | |
13386 | return error_mark_node; | |
13387 | } | |
13388 | ||
13389 | /* Generate a try-finally for the synchronized statement, except | |
13390 | that the handler that catches all throw exception calls | |
13391 | _Jv_MonitorExit and then rethrow the exception. | |
13392 | The synchronized statement is then implemented as: | |
13393 | TRY | |
13394 | { | |
13395 | _Jv_MonitorEnter (expression) | |
13396 | synchronized_block | |
13397 | _Jv_MonitorExit (expression) | |
13398 | } | |
13399 | CATCH_ALL | |
13400 | { | |
13401 | e = _Jv_exception_info (); | |
13402 | _Jv_MonitorExit (expression) | |
13403 | Throw (e); | |
13404 | } */ | |
13405 | ||
13406 | /* TRY block */ | |
13407 | BUILD_MONITOR_ENTER (stmt, expr); | |
13408 | compound = add_stmt_to_compound (NULL_TREE, int_type_node, stmt); | |
13409 | compound = add_stmt_to_compound (compound, void_type_node, block); | |
63a212ed PB |
13410 | if (CAN_COMPLETE_NORMALLY (block)) |
13411 | { | |
13412 | BUILD_MONITOR_EXIT (stmt, expr); | |
13413 | compound = add_stmt_to_compound (compound, int_type_node, stmt); | |
13414 | } | |
8b27f225 | 13415 | try_block = build_expr_block (compound, NULL_TREE); |
63a212ed | 13416 | CAN_COMPLETE_NORMALLY (try_block) = CAN_COMPLETE_NORMALLY (block); |
8b27f225 PB |
13417 | |
13418 | /* CATCH_ALL block */ | |
c877974e | 13419 | decl = build_decl (VAR_DECL, generate_name (), ptr_type_node); |
8b27f225 PB |
13420 | BUILD_ASSIGN_EXCEPTION_INFO (stmt, decl); |
13421 | compound = add_stmt_to_compound (NULL_TREE, void_type_node, stmt); | |
13422 | BUILD_MONITOR_EXIT (stmt, expr); | |
13423 | compound = add_stmt_to_compound (compound, int_type_node, stmt); | |
13424 | BUILD_THROW (stmt, decl); | |
13425 | compound = add_stmt_to_compound (compound, void_type_node, stmt); | |
13426 | catch_all = build_expr_block (compound, decl); | |
13427 | catch_all = build_expr_block (catch_all, NULL_TREE); | |
13428 | catch_all = build1 (CATCH_EXPR, void_type_node, catch_all); | |
13429 | ||
13430 | /* TRY-CATCH statement */ | |
1886c9d8 | 13431 | compound = build (TRY_EXPR, void_type_node, try_block, catch_all, NULL_TREE); |
63a212ed | 13432 | CAN_COMPLETE_NORMALLY (compound) = CAN_COMPLETE_NORMALLY (try_block); |
1886c9d8 | 13433 | return compound; |
8b27f225 PB |
13434 | } |
13435 | ||
13436 | /* 14.16 The throw Statement */ | |
13437 | ||
13438 | static tree | |
13439 | patch_throw_statement (node, wfl_op1) | |
13440 | tree node, wfl_op1; | |
13441 | { | |
13442 | tree expr = TREE_OPERAND (node, 0); | |
13443 | tree type = TREE_TYPE (expr); | |
13444 | int unchecked_ok = 0, tryblock_throws_ok = 0; | |
13445 | ||
13446 | /* Thrown expression must be assignable to java.lang.Throwable */ | |
13447 | if (!try_reference_assignconv (throwable_type_node, expr)) | |
13448 | { | |
13449 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); | |
13450 | parse_error_context (wfl_operator, "Can't throw `%s'; it must be a " | |
13451 | "subclass of class `java.lang.Throwable'", | |
13452 | lang_printable_name (type, 0)); | |
13453 | /* If the thrown expression was a reference, we further the | |
13454 | compile-time check. */ | |
13455 | if (!JREFERENCE_TYPE_P (type)) | |
13456 | return error_mark_node; | |
13457 | } | |
13458 | ||
13459 | /* At least one of the following must be true */ | |
13460 | ||
13461 | /* The type of the throw expression is a not checked exception, | |
13462 | i.e. is a unchecked expression. */ | |
c877974e | 13463 | unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type)); |
8b27f225 PB |
13464 | |
13465 | /* Throw is contained in a try statement and at least one catch | |
13466 | clause can receive the thrown expression or the current method is | |
13467 | declared to throw such an exception. Or, the throw statement is | |
13468 | contained in a method or constructor declaration and the type of | |
13469 | the Expression is assignable to at least one type listed in the | |
13470 | throws clause the declaration. */ | |
13471 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); | |
13472 | if (!unchecked_ok) | |
13473 | tryblock_throws_ok = | |
13474 | check_thrown_exceptions_do (TREE_TYPE (expr)); | |
13475 | if (!(unchecked_ok || tryblock_throws_ok)) | |
13476 | { | |
13477 | /* If there is a surrounding try block that has no matching | |
13478 | clatch clause, report it first. A surrounding try block exits | |
13479 | only if there is something after the list of checked | |
13480 | exception thrown by the current function (if any). */ | |
13481 | if (IN_TRY_BLOCK_P ()) | |
13482 | parse_error_context (wfl_operator, "Checked exception `%s' can't be " | |
13483 | "caught by any of the catch clause(s) " | |
13484 | "of the surrounding `try' block", | |
13485 | lang_printable_name (type, 0)); | |
13486 | /* If we have no surrounding try statement and the method doesn't have | |
13487 | any throws, report it now. FIXME */ | |
13488 | else if (!EXCEPTIONS_P (currently_caught_type_list) | |
13489 | && !tryblock_throws_ok) | |
13490 | parse_error_context (wfl_operator, "Checked exception `%s' isn't " | |
13491 | "thrown from a `try' block", | |
13492 | lang_printable_name (type, 0)); | |
13493 | /* Otherwise, the current method doesn't have the appropriate | |
13494 | throws declaration */ | |
13495 | else | |
13496 | parse_error_context (wfl_operator, "Checked exception `%s' doesn't " | |
13497 | "match any of current method's `throws' " | |
13498 | "declaration(s)", | |
13499 | lang_printable_name (type, 0)); | |
13500 | return error_mark_node; | |
13501 | } | |
13502 | ||
13503 | /* If a throw statement is contained in a static initializer, then a | |
13504 | compile-time check ensures that either its value is always an | |
13505 | unchecked exception or its value is always caught by some try | |
13506 | statement that contains it. FIXME, static initializer. */ | |
13507 | ||
12472854 PB |
13508 | if (! flag_emit_class_files) |
13509 | BUILD_THROW (node, expr); | |
8b27f225 PB |
13510 | return node; |
13511 | } | |
13512 | ||
13513 | /* Check that exception said to be thrown by method DECL can be | |
13514 | effectively caught from where DECL is invoked. */ | |
13515 | ||
13516 | static void | |
13517 | check_thrown_exceptions (location, decl) | |
13518 | int location; | |
13519 | tree decl; | |
13520 | { | |
13521 | tree throws; | |
13522 | /* For all the unchecked exceptions thrown by DECL */ | |
13523 | for (throws = DECL_FUNCTION_THROWS (decl); throws; | |
13524 | throws = TREE_CHAIN (throws)) | |
13525 | if (!check_thrown_exceptions_do (TREE_VALUE (throws))) | |
13526 | { | |
59e4a38e PB |
13527 | #if 1 |
13528 | /* Temporary hack to suppresses errors about cloning arrays. FIXME */ | |
13529 | if (DECL_NAME (decl) == get_identifier ("clone")) | |
13530 | continue; | |
13531 | #endif | |
8b27f225 PB |
13532 | EXPR_WFL_LINECOL (wfl_operator) = location; |
13533 | parse_error_context | |
13534 | (wfl_operator, "Exception `%s' must be caught, or it must be " | |
13535 | "declared in the `throws' clause of `%s'", | |
13536 | lang_printable_name (TREE_VALUE (throws), 0), | |
13537 | IDENTIFIER_POINTER (DECL_NAME (current_function_decl))); | |
13538 | } | |
13539 | } | |
13540 | ||
c877974e | 13541 | /* Return 1 if checked EXCEPTION is caught at the current nesting level of |
8b27f225 PB |
13542 | try-catch blocks, OR is listed in the `throws' clause of the |
13543 | current method. */ | |
13544 | ||
13545 | static int | |
13546 | check_thrown_exceptions_do (exception) | |
13547 | tree exception; | |
13548 | { | |
13549 | tree list = currently_caught_type_list; | |
c877974e | 13550 | resolve_and_layout (exception, NULL_TREE); |
8b27f225 PB |
13551 | /* First, all the nested try-catch-finally at that stage. The |
13552 | last element contains `throws' clause exceptions, if any. */ | |
c877974e APB |
13553 | if (IS_UNCHECKED_EXCEPTION_P (exception)) |
13554 | return 1; | |
8b27f225 PB |
13555 | while (list) |
13556 | { | |
13557 | tree caught; | |
13558 | for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught)) | |
13559 | if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0)) | |
13560 | return 1; | |
13561 | list = TREE_CHAIN (list); | |
13562 | } | |
13563 | return 0; | |
13564 | } | |
13565 | ||
13566 | static void | |
13567 | purge_unchecked_exceptions (mdecl) | |
13568 | tree mdecl; | |
13569 | { | |
13570 | tree throws = DECL_FUNCTION_THROWS (mdecl); | |
13571 | tree new = NULL_TREE; | |
13572 | ||
13573 | while (throws) | |
13574 | { | |
13575 | tree next = TREE_CHAIN (throws); | |
c877974e | 13576 | if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws))) |
8b27f225 PB |
13577 | { |
13578 | TREE_CHAIN (throws) = new; | |
13579 | new = throws; | |
13580 | } | |
13581 | throws = next; | |
13582 | } | |
13583 | /* List is inverted here, but it doesn't matter */ | |
13584 | DECL_FUNCTION_THROWS (mdecl) = new; | |
13585 | } | |
22eed1e6 APB |
13586 | |
13587 | /* 15.24 Conditional Operator ?: */ | |
13588 | ||
13589 | static tree | |
13590 | patch_conditional_expr (node, wfl_cond, wfl_op1) | |
13591 | tree node, wfl_cond, wfl_op1; | |
13592 | { | |
13593 | tree cond = TREE_OPERAND (node, 0); | |
13594 | tree op1 = TREE_OPERAND (node, 1); | |
13595 | tree op2 = TREE_OPERAND (node, 2); | |
22eed1e6 | 13596 | tree resulting_type = NULL_TREE; |
ac825856 | 13597 | tree t1, t2, patched; |
22eed1e6 APB |
13598 | int error_found = 0; |
13599 | ||
ac825856 APB |
13600 | /* Operands of ?: might be StringBuffers crafted as a result of a |
13601 | string concatenation. Obtain a descent operand here. */ | |
13602 | if ((patched = patch_string (op1))) | |
13603 | TREE_OPERAND (node, 1) = op1 = patched; | |
13604 | if ((patched = patch_string (op2))) | |
13605 | TREE_OPERAND (node, 2) = op2 = patched; | |
13606 | ||
13607 | t1 = TREE_TYPE (op1); | |
13608 | t2 = TREE_TYPE (op2); | |
13609 | ||
22eed1e6 APB |
13610 | /* The first expression must be a boolean */ |
13611 | if (TREE_TYPE (cond) != boolean_type_node) | |
13612 | { | |
13613 | SET_WFL_OPERATOR (wfl_operator, node, wfl_cond); | |
13614 | parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't " | |
13615 | "convert `%s' to `boolean'", | |
13616 | lang_printable_name (TREE_TYPE (cond), 0)); | |
13617 | error_found = 1; | |
13618 | } | |
13619 | ||
13620 | /* Second and third can be numeric, boolean (i.e. primitive), | |
13621 | references or null. Anything else results in an error */ | |
13622 | if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2)) | |
13623 | || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node) | |
13624 | && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node)) | |
13625 | || (t1 == boolean_type_node && t2 == boolean_type_node))) | |
13626 | error_found = 1; | |
13627 | ||
13628 | /* Determine the type of the conditional expression. Same types are | |
13629 | easy to deal with */ | |
13630 | else if (t1 == t2) | |
13631 | resulting_type = t1; | |
13632 | ||
13633 | /* There are different rules for numeric types */ | |
13634 | else if (JNUMERIC_TYPE_P (t1)) | |
13635 | { | |
13636 | /* if byte/short found, the resulting type is short */ | |
13637 | if ((t1 == byte_type_node && t2 == short_type_node) | |
13638 | || (t1 == short_type_node && t2 == byte_type_node)) | |
13639 | resulting_type = short_type_node; | |
13640 | ||
13641 | /* If t1 is a constant int and t2 is of type byte, short or char | |
13642 | and t1's value fits in t2, then the resulting type is t2 */ | |
13643 | else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1))) | |
13644 | && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2)) | |
13645 | resulting_type = t2; | |
13646 | ||
13647 | /* If t2 is a constant int and t1 is of type byte, short or char | |
13648 | and t2's value fits in t1, then the resulting type is t1 */ | |
13649 | else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2))) | |
13650 | && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1)) | |
13651 | resulting_type = t1; | |
13652 | ||
13653 | /* Otherwise, binary numeric promotion is applied and the | |
13654 | resulting type is the promoted type of operand 1 and 2 */ | |
13655 | else | |
13656 | resulting_type = binary_numeric_promotion (t2, t2, | |
13657 | &TREE_OPERAND (node, 1), | |
13658 | &TREE_OPERAND (node, 2)); | |
13659 | } | |
13660 | ||
13661 | /* Cases of a reference and a null type */ | |
13662 | else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node) | |
13663 | resulting_type = t1; | |
13664 | ||
13665 | else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node) | |
13666 | resulting_type = t2; | |
13667 | ||
13668 | /* Last case: different reference types. If a type can be converted | |
13669 | into the other one by assignment conversion, the latter | |
13670 | determines the type of the expression */ | |
13671 | else if ((resulting_type = try_reference_assignconv (t1, op2))) | |
13672 | resulting_type = promote_type (t1); | |
13673 | ||
13674 | else if ((resulting_type = try_reference_assignconv (t2, op1))) | |
13675 | resulting_type = promote_type (t2); | |
13676 | ||
13677 | /* If we don't have any resulting type, we're in trouble */ | |
13678 | if (!resulting_type) | |
13679 | { | |
13680 | char *t = strdup (lang_printable_name (t1, 0)); | |
13681 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); | |
13682 | parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't " | |
13683 | "convert `%s' to `%s'", t, | |
13684 | lang_printable_name (t2, 0)); | |
13685 | free (t); | |
13686 | error_found = 1; | |
13687 | } | |
13688 | ||
13689 | if (error_found) | |
13690 | { | |
13691 | TREE_TYPE (node) = error_mark_node; | |
13692 | return error_mark_node; | |
13693 | } | |
13694 | ||
13695 | TREE_TYPE (node) = resulting_type; | |
13696 | TREE_SET_CODE (node, COND_EXPR); | |
12472854 | 13697 | CAN_COMPLETE_NORMALLY (node) = 1; |
22eed1e6 APB |
13698 | return node; |
13699 | } | |
ac825856 | 13700 | |
5b09b33e PB |
13701 | /* Try to constant fold NODE. |
13702 | If NODE is not a constant expression, return NULL_EXPR. | |
13703 | CONTEXT is a static final VAR_DECL whose initializer we are folding. */ | |
13704 | ||
13705 | static tree | |
13706 | fold_constant_for_init (node, context) | |
13707 | tree node; | |
13708 | tree context; | |
13709 | { | |
13710 | tree op0, op1, val; | |
13711 | enum tree_code code = TREE_CODE (node); | |
13712 | ||
13713 | if (code == INTEGER_CST || code == REAL_CST || code == STRING_CST) | |
13714 | return node; | |
13715 | if (TREE_TYPE (node) != NULL_TREE) | |
13716 | return NULL_TREE; | |
13717 | ||
13718 | switch (code) | |
13719 | { | |
13720 | case MULT_EXPR: | |
13721 | case PLUS_EXPR: | |
13722 | case MINUS_EXPR: | |
13723 | case LSHIFT_EXPR: | |
13724 | case RSHIFT_EXPR: | |
13725 | case URSHIFT_EXPR: | |
13726 | case BIT_AND_EXPR: | |
13727 | case BIT_XOR_EXPR: | |
13728 | case BIT_IOR_EXPR: | |
13729 | case TRUNC_MOD_EXPR: | |
13730 | case RDIV_EXPR: | |
13731 | case TRUTH_ANDIF_EXPR: | |
13732 | case TRUTH_ORIF_EXPR: | |
13733 | case EQ_EXPR: | |
13734 | case NE_EXPR: | |
13735 | case GT_EXPR: | |
13736 | case GE_EXPR: | |
13737 | case LT_EXPR: | |
13738 | case LE_EXPR: | |
13739 | op0 = TREE_OPERAND (node, 0); | |
13740 | op1 = TREE_OPERAND (node, 1); | |
13741 | val = fold_constant_for_init (op0, context); | |
13742 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
13743 | return NULL_TREE; | |
13744 | TREE_OPERAND (node, 0) = val; | |
13745 | val = fold_constant_for_init (op1, context); | |
13746 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
13747 | return NULL_TREE; | |
13748 | TREE_OPERAND (node, 1) = val; | |
13749 | return patch_binop (node, op0, op1); | |
13750 | ||
13751 | case UNARY_PLUS_EXPR: | |
13752 | case NEGATE_EXPR: | |
13753 | case TRUTH_NOT_EXPR: | |
13754 | case BIT_NOT_EXPR: | |
13755 | case CONVERT_EXPR: | |
13756 | op0 = TREE_OPERAND (node, 0); | |
13757 | val = fold_constant_for_init (op0, context); | |
13758 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
13759 | return NULL_TREE; | |
13760 | TREE_OPERAND (node, 0) = val; | |
13761 | node = patch_unaryop (node, op0); | |
13762 | break; | |
13763 | ||
13764 | case COND_EXPR: | |
13765 | val = fold_constant_for_init (TREE_OPERAND (node, 0), context); | |
13766 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
13767 | return NULL_TREE; | |
13768 | TREE_OPERAND (node, 0) = val; | |
13769 | val = fold_constant_for_init (TREE_OPERAND (node, 1), context); | |
13770 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
13771 | return NULL_TREE; | |
13772 | TREE_OPERAND (node, 1) = val; | |
13773 | val = fold_constant_for_init (TREE_OPERAND (node, 2), context); | |
13774 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
13775 | return NULL_TREE; | |
13776 | TREE_OPERAND (node, 2) = val; | |
13777 | return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1) | |
13778 | : TREE_OPERAND (node, 2); | |
13779 | ||
13780 | case VAR_DECL: | |
13781 | if (! FIELD_STATIC (node) || ! FIELD_FINAL (node) | |
13782 | || DECL_INITIAL (node) == NULL_TREE) | |
13783 | return NULL_TREE; | |
13784 | val = DECL_INITIAL (node); | |
13785 | /* Guard against infinite recursion. */ | |
13786 | DECL_INITIAL (node) = NULL_TREE; | |
13787 | val = fold_constant_for_init (val, DECL_CONTEXT (node)); | |
13788 | DECL_INITIAL (node) = val; | |
13789 | return val; | |
13790 | ||
13791 | case EXPR_WITH_FILE_LOCATION: | |
13792 | /* Compare java_complete_tree and resolve_expression_name. */ | |
13793 | if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */ | |
13794 | || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE) | |
13795 | { | |
13796 | tree name = EXPR_WFL_NODE (node); | |
13797 | tree decl; | |
13798 | if (PRIMARY_P (node)) | |
13799 | return NULL_TREE; | |
13800 | else if (! QUALIFIED_P (name)) | |
13801 | { | |
13802 | decl = lookup_field_wrapper (DECL_CONTEXT (context), name); | |
13803 | if (! FIELD_STATIC (decl)) | |
13804 | return NULL_TREE; | |
13805 | return fold_constant_for_init (decl, decl); | |
13806 | } | |
13807 | else | |
13808 | { | |
13809 | #if 0 | |
13810 | /* Wait until the USE_COMPONENT_REF re-write. FIXME. */ | |
13811 | qualify_ambiguous_name (node); | |
13812 | if (resolve_field_access (node, &decl, NULL) | |
13813 | && decl != NULL_TREE) | |
13814 | return fold_constant_for_init (decl, decl); | |
13815 | #endif | |
13816 | return NULL_TREE; | |
13817 | } | |
13818 | } | |
13819 | else | |
13820 | { | |
13821 | op0 = TREE_OPERAND (node, 0); | |
13822 | val = fold_constant_for_init (op0, context); | |
13823 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
13824 | return NULL_TREE; | |
13825 | TREE_OPERAND (node, 0) = val; | |
13826 | return val; | |
13827 | } | |
13828 | ||
13829 | default: | |
13830 | return NULL_TREE; | |
13831 | } | |
13832 | } |