The following modifications were brought to the original grammar:
method_body: added the rule '| block SC_TK'
-static_initializer: added the rule 'static block SC_TK'.
+static_initializer: added the rule 'static block SC_TK'.
Note: All the extra rules described above should go away when the
empty_statement rule will work.
static tree lookup_java_interface_method2 PARAMS ((tree, tree));
static tree resolve_expression_name PARAMS ((tree, tree *));
static tree maybe_create_class_interface_decl PARAMS ((tree, tree, tree, tree));
-static int check_class_interface_creation PARAMS ((int, int, tree,
+static int check_class_interface_creation PARAMS ((int, int, tree,
tree, tree, tree));
static tree patch_method_invocation PARAMS ((tree, tree, tree, int,
int *, tree *));
static tree qualify_and_find PARAMS ((tree, tree, tree));
static tree resolve_no_layout PARAMS ((tree, tree));
static int invocation_mode PARAMS ((tree, int));
-static tree find_applicable_accessible_methods_list PARAMS ((int, tree,
+static tree find_applicable_accessible_methods_list PARAMS ((int, tree,
tree, tree));
-static void search_applicable_methods_list PARAMS ((int, tree, tree, tree,
+static void search_applicable_methods_list PARAMS ((int, tree, tree, tree,
tree *, tree *));
static tree find_most_specific_methods_list PARAMS ((tree));
static int argument_types_convertible PARAMS ((tree, tree));
static tree make_qualified_name PARAMS ((tree, tree, int));
static tree merge_qualified_name PARAMS ((tree, tree));
static tree make_qualified_primary PARAMS ((tree, tree, int));
-static int resolve_qualified_expression_name PARAMS ((tree, tree *,
+static int resolve_qualified_expression_name PARAMS ((tree, tree *,
tree *, tree *));
static void qualify_ambiguous_name PARAMS ((tree));
static tree resolve_field_access PARAMS ((tree, tree *, tree *));
static tree patch_return PARAMS ((tree));
static tree maybe_access_field PARAMS ((tree, tree, tree));
static int complete_function_arguments PARAMS ((tree));
-static int check_for_static_method_reference PARAMS ((tree, tree, tree,
+static int check_for_static_method_reference PARAMS ((tree, tree, tree,
tree, tree));
static int not_accessible_p PARAMS ((tree, tree, tree, int));
static void check_deprecation PARAMS ((tree, tree));
static tree build_outer_field_access PARAMS ((tree, tree));
static tree build_outer_field_access_methods PARAMS ((tree));
-static tree build_outer_field_access_expr PARAMS ((int, tree, tree,
+static tree build_outer_field_access_expr PARAMS ((int, tree, tree,
tree, tree));
static tree build_outer_method_access_method PARAMS ((tree));
static tree build_new_access_id PARAMS ((void));
tree, tree));
static int outer_field_access_p PARAMS ((tree, tree));
-static int outer_field_expanded_access_p PARAMS ((tree, tree *,
+static int outer_field_expanded_access_p PARAMS ((tree, tree *,
tree *, tree *));
static tree outer_field_access_fix PARAMS ((tree, tree, tree));
static tree build_incomplete_class_ref PARAMS ((int, tree));
static char *string_convert_int_cst PARAMS ((tree));
/* Number of error found so far. */
-int java_error_count;
+int java_error_count;
/* Number of warning found so far. */
int java_warning_count;
/* Tell when not to fold, when doing xrefs */
int do_not_fold;
/* Cyclic inheritance report, as it can be set by layout_class */
const char *cyclic_inheritance_report;
-
+
/* The current parser context */
struct parser_ctxt *ctxp;
covers both integral/floating point division. The code is changed
once the type of both operator is worked out. */
-static const enum tree_code binop_lookup[19] =
- {
+static const enum tree_code binop_lookup[19] =
+ {
PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR,
- LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR,
+ LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR,
BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR,
TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR,
EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR,
static GTY(()) tree label_id;
/* The "StringBuffer" identifier used for the String `+' operator. */
-static GTY(()) tree wfl_string_buffer;
+static GTY(()) tree wfl_string_buffer;
/* The "append" identifier used for String `+' operator. */
static GTY(()) tree wfl_append;
static GTY(()) tree java_lang_cloneable;
/* The "java.io.Serializable" qualified name. */
-static GTY(()) tree java_io_serializable;
+static GTY(()) tree java_io_serializable;
/* Context and flag for static blocks */
static GTY(()) tree current_static_block;
/* The list of all packages we've seen so far */
static GTY(()) tree package_list;
-
+
/* Hold THIS for the scope of the current method decl. */
static GTY(()) tree current_this;
are duplicate labels. FIXME: probably this should just be attached
to the switch itself; then it could be referenced via
`ctxp->current_loop'. */
-static GTY(()) tree case_label_list;
+static GTY(()) tree case_label_list;
/* Anonymous class counter. Will be reset to 1 every time a non
anonymous class gets created. */
%token PLUS_TK MINUS_TK MULT_TK DIV_TK REM_TK
%token LS_TK SRS_TK ZRS_TK
%token AND_TK XOR_TK OR_TK
-%token BOOL_AND_TK BOOL_OR_TK
+%token BOOL_AND_TK BOOL_OR_TK
%token EQ_TK NEQ_TK GT_TK GTE_TK LT_TK LTE_TK
/* This maps to the same binop_lookup entry than the token above */
%token PLUS_ASSIGN_TK MINUS_ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK
-%token REM_ASSIGN_TK
+%token REM_ASSIGN_TK
%token LS_ASSIGN_TK SRS_ASSIGN_TK ZRS_ASSIGN_TK
%token AND_ASSIGN_TK XOR_ASSIGN_TK OR_ASSIGN_TK
%token DEFAULT_TK IF_TK THROW_TK
%token BOOLEAN_TK DO_TK IMPLEMENTS_TK
-%token THROWS_TK BREAK_TK IMPORT_TK
+%token THROWS_TK BREAK_TK IMPORT_TK
%token ELSE_TK INSTANCEOF_TK RETURN_TK
%token VOID_TK CATCH_TK INTERFACE_TK
%token CASE_TK EXTENDS_TK FINALLY_TK
%type <node> type_declaration compilation_unit
field_declaration method_declaration extends_interfaces
interfaces interface_type_list
- class_member_declaration
- import_declarations package_declaration
+ import_declarations package_declaration
type_declarations interface_body
interface_member_declaration constant_declaration
interface_member_declarations interface_type
- abstract_method_declaration interface_type_list
+ abstract_method_declaration
%type <node> class_body_declaration class_member_declaration
static_initializer constructor_declaration block
%type <node> class_body_declarations constructor_header
array_creation_expression array_type
class_instance_creation_expression field_access
method_invocation array_access something_dot_new
- argument_list postfix_expression while_expression
+ argument_list postfix_expression while_expression
post_increment_expression post_decrement_expression
unary_expression_not_plus_minus unary_expression
pre_increment_expression pre_decrement_expression
- unary_expression_not_plus_minus cast_expression
+ cast_expression
multiplicative_expression additive_expression
- shift_expression relational_expression
- equality_expression and_expression
+ shift_expression relational_expression
+ equality_expression and_expression
exclusive_or_expression inclusive_or_expression
conditional_and_expression conditional_or_expression
conditional_expression assignment_expression
anonymous_class_creation trap_overflow_corner_case
%type <node> return_statement break_statement continue_statement
-%type <operator> ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK
+%type <operator> ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK
%type <operator> REM_ASSIGN_TK PLUS_ASSIGN_TK MINUS_ASSIGN_TK
%type <operator> LS_ASSIGN_TK SRS_ASSIGN_TK ZRS_ASSIGN_TK
%type <operator> AND_ASSIGN_TK XOR_ASSIGN_TK OR_ASSIGN_TK
%type <operator> ASSIGN_ANY_TK assignment_operator
-%token <operator> EQ_TK GTE_TK ZRS_TK SRS_TK GT_TK LTE_TK LS_TK
+%token <operator> EQ_TK GTE_TK ZRS_TK SRS_TK GT_TK LTE_TK LS_TK
%token <operator> BOOL_AND_TK AND_TK BOOL_OR_TK OR_TK INCR_TK PLUS_TK
%token <operator> DECR_TK MINUS_TK MULT_TK DIV_TK XOR_TK REM_TK NEQ_TK
%token <operator> NEG_TK REL_QM_TK REL_CL_TK NOT_TK LT_TK OCB_TK CCB_TK
%token <operator> OP_TK OSB_TK DOT_TK THROW_TK INSTANCEOF_TK
-%type <operator> THIS_TK SUPER_TK RETURN_TK BREAK_TK CONTINUE_TK
+%type <operator> THIS_TK SUPER_TK RETURN_TK BREAK_TK CONTINUE_TK
%type <operator> CASE_TK DEFAULT_TK TRY_TK CATCH_TK SYNCHRONIZED_TK
%type <operator> NEW_TK
-%type <node> method_body
-
+%type <node> method_body
+
%type <node> literal INT_LIT_TK FP_LIT_TK BOOL_LIT_TK CHAR_LIT_TK
STRING_LIT_TK NULL_TK VOID_TK
%type <node> formal_parameter_list formal_parameter
method_declarator method_header
-%type <node> primitive_type reference_type type
+%type <node> primitive_type reference_type type
BOOLEAN_TK INTEGRAL_TK FP_TK
/* Added or modified JDK 1.1 rule types */
{
/* Register static variables with the garbage
collector. */
- ggc_add_root (&ctxp, 1,
+ ggc_add_root (&ctxp, 1,
sizeof (struct parser_ctxt *),
mark_parser_ctxt);
- ggc_add_root (&ctxp_for_generation, 1,
+ ggc_add_root (&ctxp_for_generation, 1,
sizeof (struct parser_ctxt *),
mark_parser_ctxt);
}
array_type:
primitive_type dims
- {
+ {
int osb = pop_current_osb (ctxp);
tree t = build_java_array_type (($1), -1);
while (--osb)
$$ = t;
}
| name dims
- {
+ {
int osb = pop_current_osb (ctxp);
tree t = $1;
while (osb--)
package_declaration:
PACKAGE_TK name SC_TK
- {
+ {
ctxp->package = EXPR_WFL_NODE ($2);
register_package (ctxp->package);
}
if (err && err != name)
parse_error_context
($2, "Ambiguous class: `%s' and `%s'",
- IDENTIFIER_POINTER (name),
+ IDENTIFIER_POINTER (name),
IDENTIFIER_POINTER (err));
else
REGISTER_IMPORT ($2, last_name);
if (! it)
{
read_import_dir ($2);
- ctxp->import_demand_list =
+ ctxp->import_demand_list =
chainon (ctxp->import_demand_list,
build_tree_list ($2, NULL_TREE));
}
{
int acc = (1 << $2);
if ($$ & acc)
- parse_error_context
+ parse_error_context
(ctxp->modifier_ctx [$2], "Modifier `%s' declared twice",
java_accstring_lookup (acc));
else
modifiers CLASS_TK identifier super interfaces
{ create_class ($1, $3, $4, $5); }
class_body
-| CLASS_TK identifier super interfaces
+| CLASS_TK identifier super interfaces
{ create_class (0, $2, $3, $4); }
class_body
| modifiers CLASS_TK error
{yyerror ("Missing class name"); RECOVER;}
| CLASS_TK identifier error
{
- if (!ctxp->class_err) yyerror ("'{' expected");
+ if (!ctxp->class_err) yyerror ("'{' expected");
DRECOVER(class1);
}
| modifiers CLASS_TK identifier error
| IMPLEMENTS_TK error
{
ctxp->class_err=1;
- yyerror ("Missing interface name");
+ yyerror ("Missing interface name");
}
;
interface_type_list:
interface_type
- {
+ {
ctxp->interface_number = 1;
$$ = build_tree_list ($1, NULL_TREE);
}
| interface_type_list C_TK interface_type
- {
+ {
ctxp->interface_number++;
$$ = chainon ($1, build_tree_list ($3, NULL_TREE));
}
class_body:
OCB_TK CCB_TK
- {
+ {
/* Store the location of the `}' when doing xrefs */
if (flag_emit_xref)
- DECL_END_SOURCE_LINE (GET_CPC ()) =
+ DECL_END_SOURCE_LINE (GET_CPC ()) =
EXPR_WFL_ADD_COL ($2.location, 1);
$$ = GET_CPC ();
}
| OCB_TK class_body_declarations CCB_TK
- {
+ {
/* Store the location of the `}' when doing xrefs */
if (flag_emit_xref)
- DECL_END_SOURCE_LINE (GET_CPC ()) =
+ DECL_END_SOURCE_LINE (GET_CPC ()) =
EXPR_WFL_ADD_COL ($3.location, 1);
$$ = GET_CPC ();
}
{ register_fields (0, $1, $2); }
| modifiers type variable_declarators SC_TK
{
- check_modifiers
+ check_modifiers
("Illegal modifier `%s' for field declaration",
$1, FIELD_MODIFIERS);
check_modifiers_consistency ($1);
variable_declarator_id
{ $$ = build_tree_list ($1, NULL_TREE); }
| variable_declarator_id ASSIGN_TK variable_initializer
- {
+ {
if (java_error_count)
$3 = NULL_TREE;
- $$ = build_tree_list
+ $$ = build_tree_list
($1, build_assignment ($2.token, $2.location, $1, $3));
}
| variable_declarator_id ASSIGN_TK error
| identifier error
{yyerror ("Invalid declaration"); DRECOVER(vdi);}
| variable_declarator_id OSB_TK error
- {
+ {
tree node = java_lval.node;
if (node && (TREE_CODE (node) == INTEGER_CST
|| TREE_CODE (node) == EXPR_WITH_FILE_LOCATION))
/* 19.8.3 Productions from 8.4: Method Declarations */
method_declaration:
- method_header
+ method_header
{
current_function_decl = $1;
if (current_function_decl
{YYNOT_TWICE yyerror ("'{' expected"); RECOVER;}
;
-method_header:
+method_header:
type method_declarator throws
{ $$ = method_header (0, $1, $2, $3); }
| VOID_TK method_declarator throws
method_declarator:
identifier OP_TK CP_TK
- {
+ {
ctxp->formal_parameter_number = 0;
$$ = method_declarator ($1, NULL_TREE);
}
| method_declarator OSB_TK CSB_TK
{
EXPR_WFL_LINECOL (wfl_operator) = $2.location;
- TREE_PURPOSE ($1) =
+ TREE_PURPOSE ($1) =
build_unresolved_array_type (TREE_PURPOSE ($1));
- parse_warning_context
- (wfl_operator,
+ parse_warning_context
+ (wfl_operator,
"Discouraged form of returned type specification");
}
| identifier OP_TK error
$$ = build_tree_list ($2, $1);
}
| final type variable_declarator_id /* Added, JDK1.1 final parms */
- {
+ {
$$ = build_tree_list ($3, $2);
ARG_FINAL_P ($$) = 1;
}
/* Can't have a static initializer in an innerclass */
if ($1 | ACC_STATIC &&
GET_CPC_LIST () && !TOPLEVEL_CLASS_DECL_P (GET_CPC ()))
- parse_error_context
+ parse_error_context
(MODIFIER_WFL (STATIC_TK),
"Can't define static initializer in class `%s'. Static initializer can only be defined in top-level classes",
IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())));
constructor_declarator:
simple_name OP_TK CP_TK
- {
- ctxp->formal_parameter_number = 0;
+ {
+ ctxp->formal_parameter_number = 0;
$$ = method_declarator ($1, NULL_TREE);
}
| simple_name OP_TK formal_parameter_list CP_TK
body so we can safely perform all the required code
addition (super invocation and field initialization) */
block_begin constructor_block_end
- {
+ {
BLOCK_EXPR_BODY ($2) = empty_stmt_node;
$$ = $2;
}
/* Error recovery for that rule moved down expression_statement: rule. */
explicit_constructor_invocation:
this_or_super OP_TK CP_TK SC_TK
- {
- $$ = build_method_invocation ($1, NULL_TREE);
+ {
+ $$ = build_method_invocation ($1, NULL_TREE);
$$ = build_debugable_stmt (EXPR_WFL_LINECOL ($1), $$);
$$ = java_method_add_stmt (current_function_decl, $$);
}
| this_or_super OP_TK argument_list CP_TK SC_TK
- {
- $$ = build_method_invocation ($1, $3);
+ {
+ $$ = build_method_invocation ($1, $3);
$$ = build_debugable_stmt (EXPR_WFL_LINECOL ($1), $$);
$$ = java_method_add_stmt (current_function_decl, $$);
}
extends_interfaces:
EXTENDS_TK interface_type
- {
+ {
ctxp->interface_number = 1;
$$ = build_tree_list ($2, NULL_TREE);
}
| extends_interfaces C_TK interface_type
- {
+ {
ctxp->interface_number++;
$$ = chainon ($1, build_tree_list ($3, NULL_TREE));
}
abstract_method_declaration:
method_header SC_TK
- {
+ {
check_abstract_method_header ($1);
current_function_decl = NULL_TREE; /* FIXME ? */
}
variable_initializers:
variable_initializer
- {
- $$ = tree_cons (maybe_build_array_element_wfl ($1),
+ {
+ $$ = tree_cons (maybe_build_array_element_wfl ($1),
$1, NULL_TREE);
}
| variable_initializers C_TK variable_initializer
/* 19.11 Production from 14: Blocks and Statements */
block:
OCB_TK CCB_TK
- {
+ {
/* Store the location of the `}' when doing xrefs */
if (current_function_decl && flag_emit_xref)
- DECL_END_SOURCE_LINE (current_function_decl) =
+ DECL_END_SOURCE_LINE (current_function_decl) =
EXPR_WFL_ADD_COL ($2.location, 1);
- $$ = empty_stmt_node;
+ $$ = empty_stmt_node;
}
| block_begin block_statements block_end
{ $$ = $3; }
block_end:
CCB_TK
- {
+ {
maybe_absorb_scoping_blocks ();
/* Store the location of the `}' when doing xrefs */
if (current_function_decl && flag_emit_xref)
- DECL_END_SOURCE_LINE (current_function_decl) =
- EXPR_WFL_ADD_COL ($1.location, 1);
+ DECL_END_SOURCE_LINE (current_function_decl) =
+ EXPR_WFL_ADD_COL ($1.location, 1);
$$ = exit_block ();
if (!BLOCK_SUBBLOCKS ($$))
BLOCK_SUBBLOCKS ($$) = empty_stmt_node;
| statement
{ java_method_add_stmt (current_function_decl, $1); }
| class_declaration /* Added, JDK1.1 local classes */
- {
+ {
LOCAL_CLASS_P (TREE_TYPE (GET_CPC ())) = 1;
end_class_declaration (1);
}
empty_statement:
SC_TK
- {
- if (flag_extraneous_semicolon
- && ! current_static_block
- && (! current_function_decl ||
+ {
+ if (flag_extraneous_semicolon
+ && ! current_static_block
+ && (! current_function_decl ||
/* Verify we're not in a inner class declaration */
(GET_CPC () != TYPE_NAME
(DECL_CONTEXT (current_function_decl)))))
-
+
{
EXPR_WFL_SET_LINECOL (wfl_operator, lineno, -1);
parse_warning_context (wfl_operator, "An empty declaration is a deprecated feature that should not be used");
label_decl:
identifier REL_CL_TK
{
- $$ = build_labeled_block (EXPR_WFL_LINECOL ($1),
+ $$ = build_labeled_block (EXPR_WFL_LINECOL ($1),
EXPR_WFL_NODE ($1));
pushlevel (2);
push_labeled_block ($$);
info to be eventually generate here. */
$$ = JAVA_MAYBE_GENERATE_DEBUG_INFO ($$);
}
-| error SC_TK
+| error SC_TK
{
YYNOT_TWICE yyerror ("Invalid expression statement");
DRECOVER (expr_stmt);
{yyerror ("';' expected"); RECOVER;}
;
-statement_expression:
+statement_expression:
assignment
| pre_increment_expression
| pre_decrement_expression
if_then_statement:
IF_TK OP_TK expression CP_TK statement
- {
- $$ = build_if_else_statement ($2.location, $3,
+ {
+ $$ = build_if_else_statement ($2.location, $3,
$5, NULL_TREE);
}
| IF_TK error
enter_block ();
}
switch_block
- {
+ {
/* Make into "proper list" of COMPOUND_EXPRs.
I.e. make the last statement also have its own
COMPOUND_EXPR. */
switch_expression:
SWITCH_TK OP_TK expression CP_TK
- {
+ {
$$ = build (SWITCH_EXPR, NULL_TREE, $3, NULL_TREE);
EXPR_WFL_LINECOL ($$) = $2.location;
}
{ $$ = NULL_TREE; }
;
-switch_block_statement_groups:
+switch_block_statement_groups:
switch_block_statement_group
| switch_block_statement_groups switch_block_statement_group
;
switch_label:
CASE_TK constant_expression REL_CL_TK
- {
+ {
tree lab = build1 (CASE_EXPR, NULL_TREE, $2);
EXPR_WFL_LINECOL (lab) = $1.location;
java_method_add_stmt (current_function_decl, lab);
}
| DEFAULT_TK REL_CL_TK
- {
+ {
tree lab = build (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
EXPR_WFL_LINECOL (lab) = $1.location;
java_method_add_stmt (current_function_decl, lab);
while_expression:
WHILE_TK OP_TK expression CP_TK
- {
+ {
tree body = build_loop_body ($2.location, $3, 0);
$$ = build_new_loop (body);
}
do_statement_begin:
DO_TK
- {
+ {
tree body = build_loop_body (0, NULL_TREE, 1);
$$ = build_new_loop (body);
}
/* Need error handing here. FIXME */
;
-do_statement:
+do_statement:
do_statement_begin statement WHILE_TK OP_TK expression CP_TK SC_TK
{ $$ = finish_loop_body ($4.location, $5, $2, 1); }
;
$$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7);
}
| for_begin SC_TK SC_TK for_update CP_TK statement
- {
+ {
$$ = finish_for_loop (0, NULL_TREE, $4, $6);
/* We have not condition, so we get rid of the EXIT_EXPR */
- LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) =
+ LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) =
empty_stmt_node;
}
| for_begin SC_TK error
for_begin SC_TK expression SC_TK for_update CP_TK statement_nsi
{ $$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7);}
| for_begin SC_TK SC_TK for_update CP_TK statement_nsi
- {
+ {
$$ = finish_for_loop (0, NULL_TREE, $4, $6);
/* We have not condition, so we get rid of the EXIT_EXPR */
- LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) =
+ LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) =
empty_stmt_node;
}
;
for_header:
FOR_TK OP_TK
- {
+ {
/* This scope defined for local variable that may be
defined within the scope of the for loop */
- enter_block ();
+ enter_block ();
}
| FOR_TK error
{yyerror ("'(' expected"); DRECOVER(for_1);}
for_begin:
for_header for_init
- {
+ {
/* We now declare the loop body. The loop is
declared as a for loop. */
tree body = build_loop_body (0, NULL_TREE, 0);
for_init: /* Can be empty */
{ $$ = empty_stmt_node; }
| statement_expression_list
- {
+ {
/* Init statement recorded within the previously
defined block scope */
$$ = java_method_add_stmt (current_function_decl, $1);
}
| local_variable_declaration
- {
+ {
/* Local variable are recorded within the previously
defined block scope */
$$ = NULL_TREE;
throw_statement:
THROW_TK expression SC_TK
- {
+ {
$$ = build1 (THROW_EXPR, NULL_TREE, $2);
EXPR_WFL_LINECOL ($$) = $1.location;
}
synchronized_statement:
synchronized OP_TK expression CP_TK block
- {
+ {
$$ = build (SYNCHRONIZED_EXPR, NULL_TREE, $3, $5);
- EXPR_WFL_LINECOL ($$) =
+ EXPR_WFL_LINECOL ($$) =
EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));
}
| synchronized OP_TK expression CP_TK error
"Illegal modifier `%s'. Only `synchronized' was expected here",
$1, ACC_SYNCHRONIZED);
if ($1 != ACC_SYNCHRONIZED)
- MODIFIER_WFL (SYNCHRONIZED_TK) =
+ MODIFIER_WFL (SYNCHRONIZED_TK) =
build_wfl_node (NULL_TREE);
}
;
| TRY_TK block finally
{ $$ = build_try_finally_statement ($1.location, $2, $3); }
| TRY_TK block catches finally
- { $$ = build_try_finally_statement
+ { $$ = build_try_finally_statement
($1.location, build_try_statement ($1.location,
$2, $3), $4);
}
catches:
catch_clause
| catches catch_clause
- {
+ {
TREE_CHAIN ($2) = $1;
$$ = $2;
}
catch_clause:
catch_clause_parameter block
- {
+ {
java_method_add_stmt (current_function_decl, $2);
exit_block ();
$$ = $1;
catch_clause_parameter:
CATCH_TK OP_TK formal_parameter CP_TK
- {
+ {
/* We add a block to define a scope for
formal_parameter (CCBP). The formal parameter is
declared initialized by the appropriate function
call */
tree ccpb = enter_block ();
tree init = build_assignment
- (ASSIGN_TK, $2.location, TREE_PURPOSE ($3),
+ (ASSIGN_TK, $2.location, TREE_PURPOSE ($3),
build (JAVA_EXC_OBJ_EXPR, ptr_type_node));
declare_local_variables (0, TREE_VALUE ($3),
build_tree_list (TREE_PURPOSE ($3),
}
| CATCH_TK error
{yyerror ("'(' expected"); RECOVER; $$ = NULL_TREE;}
-| CATCH_TK OP_TK error
+| CATCH_TK OP_TK error
{
- yyerror ("Missing term or ')' expected");
+ yyerror ("Missing term or ')' expected");
RECOVER; $$ = NULL_TREE;
}
| CATCH_TK OP_TK error CP_TK /* That's for () */
refering to a 'ClassName' (class_name) rule that doesn't
exist. Used name: instead. */
| name DOT_TK THIS_TK
- {
+ {
tree wfl = build_wfl_node (this_identifier_node);
$$ = make_qualified_primary ($1, wfl, EXPR_WFL_LINECOL ($1));
}
-| OP_TK expression error
+| OP_TK expression error
{yyerror ("')' expected"); RECOVER;}
| name DOT_TK error
{yyerror ("'class' or 'this' expected" ); RECOVER;}
| primitive_type DOT_TK CLASS_TK
{ $$ = build_incomplete_class_ref ($2.location, $1); }
| VOID_TK DOT_TK CLASS_TK
- {
+ {
$$ = build_incomplete_class_ref ($2.location,
void_type_node);
}
primary instead of primary solely which couldn't work in
all situations. */
| something_dot_new identifier OP_TK CP_TK
- {
+ {
tree ctor = build_new_invocation ($2, NULL_TREE);
- $$ = make_qualified_primary ($1, ctor,
+ $$ = make_qualified_primary ($1, ctor,
EXPR_WFL_LINECOL ($1));
}
| something_dot_new identifier OP_TK CP_TK class_body
| something_dot_new identifier OP_TK argument_list CP_TK
- {
+ {
tree ctor = build_new_invocation ($2, $4);
- $$ = make_qualified_primary ($1, ctor,
+ $$ = make_qualified_primary ($1, ctor,
EXPR_WFL_LINECOL ($1));
}
| something_dot_new identifier OP_TK argument_list CP_TK class_body
-| NEW_TK error SC_TK
+| NEW_TK error SC_TK
{yyerror ("'(' expected"); DRECOVER(new_1);}
| NEW_TK class_type error
{yyerror ("'(' expected"); RECOVER;}
in the documentation but doesn't exist. */
anonymous_class_creation:
- NEW_TK class_type OP_TK argument_list CP_TK
+ NEW_TK class_type OP_TK argument_list CP_TK
{ create_anonymous_class ($1.location, $2); }
class_body
- {
+ {
tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL ($2);
must be generated following the hints provided by
the `new' expression. Whether a super constructor
of that nature exists or not is to be verified
- later on in verify_constructor_super.
+ later on in verify_constructor_super.
It's during the expansion of a `new' statement
refering to an anonymous class that a ctor will
right arguments. */
}
-| NEW_TK class_type OP_TK CP_TK
+| NEW_TK class_type OP_TK CP_TK
{ create_anonymous_class ($1.location, $2); }
- class_body
- {
+ class_body
+ {
tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL ($2);
argument_list:
expression
- {
+ {
$$ = tree_cons (NULL_TREE, $1, NULL_TREE);
- ctxp->formal_parameter_number = 1;
+ ctxp->formal_parameter_number = 1;
}
| argument_list C_TK expression
{
$2, get_identifier (sig), $4);
}
| NEW_TK primitive_type dims array_initializer
- {
+ {
int osb = pop_current_osb (ctxp);
tree type = $2;
while (osb--)
type = build_java_array_type (type, -1);
- $$ = build (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE,
+ $$ = build (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE,
build_pointer_type (type), NULL_TREE, $4);
}
| NEW_TK error CSB_TK
dim_expr:
OSB_TK expression CSB_TK
- {
+ {
if (JNUMERIC_TYPE_P (TREE_TYPE ($2)))
{
$2 = build_wfl_node ($2);
}
;
-dims:
+dims:
OSB_TK CSB_TK
- {
+ {
int allocate = 0;
/* If not initialized, allocate memory for the osb
numbers stack */
/* If capacity overflown, reallocate a bigger chunk */
else if (ctxp->osb_depth+1 == ctxp->osb_limit)
allocate = ctxp->osb_limit << 1;
-
+
if (allocate)
{
allocate *= sizeof (int);
field_access:
primary DOT_TK identifier
{ $$ = make_qualified_primary ($1, $3, $2.location); }
- /* FIXME - REWRITE TO:
+ /* FIXME - REWRITE TO:
{ $$ = build_binop (COMPONENT_REF, $2.location, $1, $3); } */
| SUPER_TK DOT_TK identifier
{
| name OP_TK argument_list CP_TK
{ $$ = build_method_invocation ($1, $3); }
| primary DOT_TK identifier OP_TK CP_TK
- {
+ {
if (TREE_CODE ($1) == THIS_EXPR)
- $$ = build_this_super_qualified_invocation
+ $$ = build_this_super_qualified_invocation
(1, $3, NULL_TREE, 0, $2.location);
else
{
}
}
| primary DOT_TK identifier OP_TK argument_list CP_TK
- {
+ {
if (TREE_CODE ($1) == THIS_EXPR)
- $$ = build_this_super_qualified_invocation
+ $$ = build_this_super_qualified_invocation
(1, $3, $5, 0, $2.location);
else
{
}
}
| SUPER_TK DOT_TK identifier OP_TK CP_TK
- {
- $$ = build_this_super_qualified_invocation
+ {
+ $$ = build_this_super_qualified_invocation
(0, $3, NULL_TREE, $1.location, $2.location);
}
| SUPER_TK DOT_TK identifier OP_TK argument_list CP_TK
{
- $$ = build_this_super_qualified_invocation
+ $$ = build_this_super_qualified_invocation
(0, $3, $5, $1.location, $2.location);
}
/* Screws up thing. I let it here until I'm convinced it can
cast_expression: /* Error handling here is potentially weak */
OP_TK primitive_type dims CP_TK unary_expression
- {
+ {
tree type = $2;
int osb = pop_current_osb (ctxp);
while (osb--)
type = build_java_array_type (type, -1);
- $$ = build_cast ($1.location, type, $5);
+ $$ = build_cast ($1.location, type, $5);
}
| OP_TK primitive_type CP_TK unary_expression
{ $$ = build_cast ($1.location, $2, $4); }
| OP_TK expression CP_TK unary_expression_not_plus_minus
{ $$ = build_cast ($1.location, $2, $4); }
| OP_TK name dims CP_TK unary_expression_not_plus_minus
- {
+ {
const char *ptr;
- int osb = pop_current_osb (ctxp);
- obstack_grow (&temporary_obstack,
+ int osb = pop_current_osb (ctxp);
+ obstack_grow (&temporary_obstack,
IDENTIFIER_POINTER (EXPR_WFL_NODE ($2)),
IDENTIFIER_LENGTH (EXPR_WFL_NODE ($2)));
while (osb--)
multiplicative_expression:
unary_expression
| multiplicative_expression MULT_TK unary_expression
- {
- $$ = build_binop (BINOP_LOOKUP ($2.token),
+ {
+ $$ = build_binop (BINOP_LOOKUP ($2.token),
$2.location, $1, $3);
}
| multiplicative_expression DIV_TK unary_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| multiplicative_expression REM_TK unary_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| multiplicative_expression MULT_TK error
{yyerror ("Missing term"); RECOVER;}
| additive_expression PLUS_TK multiplicative_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| additive_expression MINUS_TK multiplicative_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| additive_expression PLUS_TK error
{yyerror ("Missing term"); RECOVER;}
| shift_expression LS_TK additive_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| shift_expression SRS_TK additive_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| shift_expression ZRS_TK additive_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| shift_expression LS_TK error
{yyerror ("Missing term"); RECOVER;}
| relational_expression LT_TK shift_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| relational_expression GT_TK shift_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| relational_expression LTE_TK shift_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| relational_expression GTE_TK shift_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| relational_expression INSTANCEOF_TK reference_type
{ $$ = build_binop (INSTANCEOF_EXPR, $2.location, $1, $3); }
| equality_expression EQ_TK relational_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| equality_expression NEQ_TK relational_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| equality_expression EQ_TK error
{yyerror ("Missing term"); RECOVER;}
| and_expression AND_TK equality_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| and_expression AND_TK error
{yyerror ("Missing term"); RECOVER;}
| exclusive_or_expression XOR_TK and_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| exclusive_or_expression XOR_TK error
{yyerror ("Missing term"); RECOVER;}
| inclusive_or_expression OR_TK exclusive_or_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| inclusive_or_expression OR_TK error
{yyerror ("Missing term"); RECOVER;}
| conditional_and_expression BOOL_AND_TK inclusive_or_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| conditional_and_expression BOOL_AND_TK error
{yyerror ("Missing term"); RECOVER;}
| conditional_or_expression BOOL_OR_TK conditional_and_expression
{
$$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,
- $1, $3);
+ $1, $3);
}
| conditional_or_expression BOOL_OR_TK error
{yyerror ("Missing term"); RECOVER;}
if (ctxp->osb_depth < 0)
abort ();
-
+
to_return = CURRENT_OSB (ctxp);
ctxp->osb_depth--;
-
+
return to_return;
}
}
else
memset ((PTR) new, 0, sizeof (struct parser_ctxt));
-
+
new->next = ctxp;
ctxp = new;
}
java_push_parser_context ()
{
create_new_parser_context (0);
-}
+}
-void
+void
java_pop_parser_context (generate)
int generate;
{
if ((ctxp = next)) /* Assignment is really meant here */
for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_VALUE (current)) = 1;
-
+
/* If we pushed a context to parse a class intended to be generated,
we keep it so we can remember the class. What we could actually
do is to just update a list of class names. */
ctxp = restored;
/* Re-installed the data for the parsing to carry on */
- memcpy (&ctxp->marker_begining, &old->marker_begining,
+ memcpy (&ctxp->marker_begining, &old->marker_begining,
(size_t)(&ctxp->marker_end - &ctxp->marker_begining));
/* Buffer context can now be discarded */
if (CPC_STATIC_INITIALIZER_LIST (ctxp))
{
stmts = CPC_STATIC_INITIALIZER_STMT (ctxp);
- CPC_STATIC_INITIALIZER_LIST (ctxp) =
+ CPC_STATIC_INITIALIZER_LIST (ctxp) =
TREE_CHAIN (CPC_STATIC_INITIALIZER_LIST (ctxp));
/* Keep initialization in order to enforce 8.5 */
if (stmts && !java_error_count)
if (CPC_INSTANCE_INITIALIZER_LIST (ctxp))
{
stmts = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
- CPC_INSTANCE_INITIALIZER_LIST (ctxp) =
+ CPC_INSTANCE_INITIALIZER_LIST (ctxp) =
TREE_CHAIN (CPC_INSTANCE_INITIALIZER_LIST (ctxp));
if (stmts && !java_error_count)
TYPE_II_STMT_LIST (class_type) = nreverse (stmts);
keep them in lexical order. */
tree marker, previous = NULL_TREE;
for (marker = list; marker; previous = marker, marker = TREE_CHAIN (marker))
- if (TREE_CODE (marker) == TREE_LIST
+ if (TREE_CODE (marker) == TREE_LIST
&& !TREE_VALUE (marker) && !TREE_PURPOSE (marker))
break;
-
+
/* No static initialized, the list is fine as is */
if (!previous)
list = TREE_CHAIN (marker);
fprintf (stderr, "lineno: %d\n", copy->lineno);
TAB_CONTEXT (tab);
fprintf (stderr, "package: %s\n",
- (copy->package ?
+ (copy->package ?
IDENTIFIER_POINTER (copy->package) : "<none>"));
TAB_CONTEXT (tab);
fprintf (stderr, "context for saving: %d\n", copy->saved_data_ctx);
parse_ctor_invocation_error ()
{
if (DECL_CONSTRUCTOR_P (current_function_decl))
- yyerror ("Constructor invocation must be first thing in a constructor");
+ yyerror ("Constructor invocation must be first thing in a constructor");
else
yyerror ("Only constructors can invoke constructors");
}
int save_lineno;
char *remainder, *code_from_source;
-
+
if (!force_error && prev_lineno == lineno)
return;
java_warning_count++;
else
java_error_count++;
-
+
if (elc.col == 0 && msg && msg[1] == ';')
{
elc.col = ctxp->p_line->char_col-1;
prev_msg = msg;
code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col);
- obstack_grow0 (&temporary_obstack,
+ obstack_grow0 (&temporary_obstack,
code_from_source, strlen (code_from_source));
remainder = obstack_finish (&temporary_obstack);
if (do_warning)
force_error = 1;
ctxp->elc.line = EXPR_WFL_LINENO (cl);
- ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 :
+ ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 :
(EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl)));
/* We have a CL, that's a good reason for using it if it contains data */
case LOOP_EXPR:
node = TREE_OPERAND (node, 0);
continue;
-
+
case LABELED_BLOCK_EXPR:
node = TREE_OPERAND (node, 1);
continue;
java_report_errors ()
{
if (java_error_count)
- fprintf (stderr, "%d error%s",
+ fprintf (stderr, "%d error%s",
java_error_count, (java_error_count == 1 ? "" : "s"));
if (java_warning_count)
fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""),
const char *context;
tree id, decl, cl;
{
- parse_error_context (cl, "%s `%s' already defined in %s:%d",
- context, IDENTIFIER_POINTER (id),
+ parse_error_context (cl, "%s `%s' already defined in %s:%d",
+ context, IDENTIFIER_POINTER (id),
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
/* Here we should point out where its redefined. It's a unicode. FIXME */
}
type_name = lang_printable_name (type, 0);
parse_error_context (context,
- "Variable `%s' is already defined in this method and was declared `%s %s' at line %d",
+ "Variable `%s' is already defined in this method and was declared `%s %s' at line %d",
IDENTIFIER_POINTER (name),
type_name, IDENTIFIER_POINTER (name), line);
}
/* Eventually get more dims */
more_dims = build_type_name_from_array_name (name, &name);
-
+
/* If we have, then craft a new type for this variable */
if (more_dims)
{
int uaaf = CLASS_MODIFIERS; /* Usually allowed access flags */
if (!quiet_flag)
- fprintf (stderr, " %s%s %s",
+ fprintf (stderr, " %s%s %s",
(CPC_INNER_P () ? "inner" : ""),
- (is_interface ? "interface" : "class"),
+ (is_interface ? "interface" : "class"),
IDENTIFIER_POINTER (qualified_name));
/* Scope of an interface/class type name:
&& (node = find_name_in_single_imports (raw_name))
&& !CPC_INNER_P ())
{
- parse_error_context
+ parse_error_context
(cl, "%s name `%s' clashes with imported type `%s'",
(is_interface ? "Interface" : "Class"),
IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node));
}
if (decl && CLASS_COMPLETE_P (decl))
{
- classitf_redefinition_error ((is_interface ? "Interface" : "Class"),
+ classitf_redefinition_error ((is_interface ? "Interface" : "Class"),
qualified_name, decl, cl);
return 1;
}
const char *f;
/* Contains OS dependent assumption on path separator. FIXME */
- for (f = &input_filename [strlen (input_filename)];
+ for (f = &input_filename [strlen (input_filename)];
f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR;
f--)
;
if (f[0] == '/' || f[0] == DIR_SEPARATOR)
f++;
- if (strncmp (IDENTIFIER_POINTER (raw_name),
+ if (strncmp (IDENTIFIER_POINTER (raw_name),
f , IDENTIFIER_LENGTH (raw_name)) ||
f [IDENTIFIER_LENGTH (raw_name)] != '.')
parse_error_context
- (cl, "Public %s `%s' must be defined in a file called `%s.java'",
+ (cl, "Public %s `%s' must be defined in a file called `%s.java'",
(is_interface ? "interface" : "class"),
IDENTIFIER_POINTER (qualified_name),
IDENTIFIER_POINTER (raw_name));
complaining a second time */
if (CPC_INNER_P () && !TOPLEVEL_CLASS_DECL_P (GET_CPC()))
{
- parse_error_context (cl, "Inner class `%s' can't be static. Static classes can only occur in interfaces and top-level classes",
+ parse_error_context (cl, "Inner class `%s' can't be static. Static classes can only occur in interfaces and top-level classes",
IDENTIFIER_POINTER (qualified_name));
sca = ACC_STATIC;
}
}
}
- if (is_interface)
+ if (is_interface)
{
if (CPC_INNER_P ())
uaaf = INTERFACE_INNER_MODIFIERS;
else
uaaf = INTERFACE_MODIFIERS;
-
- check_modifiers ("Illegal modifier `%s' for interface declaration",
+
+ check_modifiers ("Illegal modifier `%s' for interface declaration",
flags, uaaf);
}
else
{
tree scope_list;
- for (scope_list = GET_CPC_LIST (); scope_list;
+ for (scope_list = GET_CPC_LIST (); scope_list;
scope_list = GET_NEXT_ENCLOSING_CPC (scope_list))
if (raw_name == GET_CPC_UN_NODE (scope_list))
{
- parse_error_context
+ parse_error_context
(cl, "The class name `%s' is already defined in this scope. An inner class may not have the same simple name as any of its enclosing classes",
IDENTIFIER_POINTER (raw_name));
return 1;
{
if (!cl)
cl = lookup_cl (local_enclosing);
-
+
parse_error_context
(cl, "Cyclic inheritance involving %s",
IDENTIFIER_POINTER (DECL_NAME (local_enclosing)));
qual = build_tree_list (cl, NULL_TREE);
else
qual = build_tree_list (build_expr_wfl (name, NULL, 0, 0), NULL_TREE);
-
+
if ((to_return = find_as_inner_class_do (qual, enclosing)))
return to_return;
{
tree acc = NULL_TREE, decl = NULL_TREE, ptr;
- for (qual = EXPR_WFL_QUALIFICATION (cl); qual && !decl;
+ for (qual = EXPR_WFL_QUALIFICATION (cl); qual && !decl;
qual = TREE_CHAIN (qual))
{
- acc = merge_qualified_name (acc,
+ acc = merge_qualified_name (acc,
EXPR_WFL_NODE (TREE_PURPOSE (qual)));
BUILD_PTR_FROM_NAME (ptr, acc);
decl = do_resolve_class (NULL_TREE, ptr, NULL_TREE, cl);
/* A NULL qual and a decl means that the search ended
successfully?!? We have to do something then. FIXME */
-
+
if (decl)
enclosing = decl;
else
/* Otherwise, create a qual for the other part of the resolution. */
else
qual = build_tree_list (build_expr_wfl (name, NULL, 0, 0), NULL_TREE);
-
+
return find_as_inner_class_do (qual, enclosing);
}
tree l;
for (l = DECL_INNER_CLASS_LIST (outer); l; l = TREE_CHAIN (l))
- IDENTIFIER_GLOBAL_VALUE (TREE_VALUE (l)) = (set ?
+ IDENTIFIER_GLOBAL_VALUE (TREE_VALUE (l)) = (set ?
TREE_PURPOSE (l) : NULL_TREE);
}
if (GET_ENCLOSING_CPC ())
{
tree enclosing = GET_ENCLOSING_CPC_CONTEXT ();
- DECL_INNER_CLASS_LIST (enclosing) =
+ DECL_INNER_CLASS_LIST (enclosing) =
tree_cons (GET_CPC (), GET_CPC_UN (),
DECL_INNER_CLASS_LIST (enclosing));
}
obstack_1grow (&temporary_obstack, '$');
}
obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (name),
+ IDENTIFIER_POINTER (name),
IDENTIFIER_LENGTH (name));
id = get_identifier (obstack_finish (&temporary_obstack));
if (ctxp->package)
/* Install a new dependency list element */
create_jdep_list (ctxp);
- SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
+ SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
IDENTIFIER_POINTER (qualified_name)));
return decl;
}
EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */
- /* Basic checks: scope, redefinition, modifiers */
+ /* Basic checks: scope, redefinition, modifiers */
if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id))
{
PUSH_ERROR ();
- abstract is obsolete (comes first, it's a warning, or should be)
- Can't use twice the same (checked in the modifier rule) */
if ((flags & ACC_ABSTRACT) && flag_redundant)
- parse_warning_context
+ parse_warning_context
(MODIFIER_WFL (ABSTRACT_TK),
"Redundant use of `abstract' modifier. Interface `%s' is implicitly abstract", IDENTIFIER_POINTER (raw_name));
decl = maybe_create_class_interface_decl (decl, raw_name, q_name, id);
/* Set super info and mark the class a complete */
- set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl),
+ set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl),
object_type_node, ctxp->interface_number);
ctxp->interface_number = 0;
CLASS_COMPLETE_P (decl) = 1;
PUSH_ERROR ();
return NULL_TREE;
}
-
+
/* Suspend the current parsing context if we're parsing an inner
class or an anonymous class. */
if (CPC_INNER_P ())
if (CLASS_INTERFACE (GET_CPC ()))
flags |= ACC_PUBLIC;
}
-
+
/* Push a new context for (static) initialized upon declaration fields */
java_parser_context_push_initialized_field ();
- /* Class modifier check:
+ /* Class modifier check:
- Allowed modifier (already done at that point)
- - abstract AND final forbidden
+ - abstract AND final forbidden
- Public classes defined in the correct file */
if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
parse_error_context
return NULL_TREE;
}
- super_decl_type =
+ super_decl_type =
register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE);
}
else if (TREE_TYPE (decl) != object_type_node)
}
/* Set super info and mark the class as complete. */
- set_super_info (flags, TREE_TYPE (decl), super_decl_type,
+ set_super_info (flags, TREE_TYPE (decl), super_decl_type,
ctxp->interface_number);
ctxp->interface_number = 0;
CLASS_COMPLETE_P (decl) = 1;
f = add_field (TREE_TYPE (class_decl),
build_current_thisn (TREE_TYPE (class_decl)),
- build_pointer_type (TREE_TYPE (DECL_CONTEXT (class_decl))),
+ build_pointer_type (TREE_TYPE (DECL_CONTEXT (class_decl))),
ACC_PRIVATE);
FIELD_THISN (f) = 1;
if (!fct_decl)
return;
-
- for (block = GET_CURRENT_BLOCK (fct_decl);
+
+ for (block = GET_CURRENT_BLOCK (fct_decl);
block && TREE_CODE (block) == BLOCK; block = BLOCK_SUPERCONTEXT (block))
{
tree decl;
{
tree name, pname;
tree wfl, init, list;
-
+
/* Avoid non final arguments. */
if (!LOCAL_FINAL_P (decl))
continue;
-
+
MANGLE_OUTER_LOCAL_VARIABLE_NAME (name, DECL_NAME (decl));
MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID (pname, DECL_NAME (decl));
wfl = build_wfl_node (name);
invoking it (hence the constructor will also feature a
hidden parameter, set to the value of the outer context
local at the time the inner class is created.)
-
+
Note: we take into account all possible locals that can
be accessed by the inner class. It's actually not trivial
to minimize these aliases down to the ones really
identify locals really used in the inner class. We leave
the flag FIELD_LOCAL_ALIAS_USED around for that future
use.
-
+
On the other hand, it only affect local inner classes,
whose constructors (and finit$ call) will be featuring
unecessary arguments. It's easy for a developper to keep
this number of parameter down by using the `final'
keyword only when necessary. For the time being, we can
issue a warning on unecessary finals. FIXME */
- init = build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (wfl),
+ init = build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (wfl),
wfl, init);
/* Register the field. The TREE_LIST holding the part
if (decl)
{
char *t1 = xstrdup (purify_type_name
- ((TREE_CODE (new_type) == POINTER_TYPE
+ ((TREE_CODE (new_type) == POINTER_TYPE
&& TREE_TYPE (new_type) == NULL_TREE) ?
IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
lang_printable_name (new_type, 1)));
/* The type may not have been completed by the time we report
the error */
char *t2 = xstrdup (purify_type_name
- ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
+ ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
&& TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
lang_printable_name (TREE_TYPE (decl), 1)));
- parse_error_context
- (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
+ parse_error_context
+ (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
t1, IDENTIFIER_POINTER (new_field_name),
t2, IDENTIFIER_POINTER (DECL_NAME (decl)),
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
/* If TYPE is fully resolved and we don't have a reference, make one */
PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
- for (current = variable_list, saved_type = type; current;
+ for (current = variable_list, saved_type = type; current;
current = TREE_CHAIN (current), type = saved_type)
{
tree real_type;
/* Can't declare non-final static fields in inner classes */
if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (class_type)
&& !(flags & ACC_FINAL))
- parse_error_context
+ parse_error_context
(cl, "Field `%s' can't be static in inner class `%s' unless it is final",
IDENTIFIER_POINTER (EXPR_WFL_NODE (cl)),
lang_printable_name (class_type, 0));
FIELD_LOCAL_ALIAS (field_decl) = 1;
FIELD_FINAL (field_decl) = 0;
}
-
+
/* Check if we must chain. */
if (must_chain)
register_incomplete_type (JDEP_FIELD, wfl, field_decl, type);
-
+
/* If we have an initialization value tied to the field */
if (init)
{
appropriately. */
TREE_CHAIN (init) = CPC_STATIC_INITIALIZER_STMT (ctxp);
SET_CPC_STATIC_INITIALIZER_STMT (ctxp, init);
- if (TREE_OPERAND (init, 1)
+ if (TREE_OPERAND (init, 1)
&& TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT)
TREE_STATIC (TREE_OPERAND (init, 1)) = 1;
}
tree list = TYPE_FINIT_STMT_LIST (class_type);
tree mdecl, current, parms;
- parms = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION,
- class_type, NULL_TREE,
+ parms = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION,
+ class_type, NULL_TREE,
&count);
CRAFTED_PARAM_LIST_FIXUP (parms);
mdecl = create_artificial_method (class_type, ACC_PRIVATE, void_type_node,
start_artificial_method_body (mdecl);
for (current = list; current; current = TREE_CHAIN (current))
- java_method_add_stmt (mdecl,
- build_debugable_stmt (EXPR_WFL_LINECOL (current),
+ java_method_add_stmt (mdecl,
+ build_debugable_stmt (EXPR_WFL_LINECOL (current),
current));
end_artificial_method_body (mdecl);
return mdecl;
mdecl, NULL_TREE);
/* Gather all the statements in a compound */
- for (current = TYPE_II_STMT_LIST (class_type);
+ for (current = TYPE_II_STMT_LIST (class_type);
current; current = TREE_CHAIN (current))
compound = add_stmt_to_compound (compound, NULL_TREE, current);
We do that only if all ctors of CLASS_TYPE are set to catch a
checked exception. This doesn't apply to anonymous classes (since
they don't have declared ctors.) */
- if (!ANONYMOUS_CLASS_P (class_type) &&
+ if (!ANONYMOUS_CLASS_P (class_type) &&
ctors_unchecked_throws_clause_p (class_type))
{
- compound = encapsulate_with_try_catch (0, exception_type_node, compound,
+ compound = encapsulate_with_try_catch (0, exception_type_node, compound,
build1 (THROW_EXPR, NULL_TREE,
build_wfl_node (wpv_id)));
DECL_FUNCTION_THROWS (mdecl) = build_tree_list (NULL_TREE,
return error_mark_node;
meth = TREE_VALUE (mdecl);
id = TREE_PURPOSE (mdecl);
-
+
check_modifiers_consistency (flags);
if (GET_CPC ())
if (!this_class || this_class == error_mark_node)
return NULL_TREE;
-
+
/* There are some forbidden modifiers for an abstract method and its
class must be abstract as well. */
if (type && (flags & ACC_ABSTRACT))
ABSTRACT_CHECK (flags, ACC_STRICT, id, "Strictfp");
if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
&& !CLASS_INTERFACE (TYPE_NAME (this_class)))
- parse_error_context
- (id, "Class `%s' must be declared abstract to define abstract method `%s'",
+ parse_error_context
+ (id, "Class `%s' must be declared abstract to define abstract method `%s'",
IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())),
IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
}
/* 8.6: Constructor declarations: we might be trying to define a
method without specifying a return type. */
if (EXPR_WFL_NODE (id) != GET_CPC_UN ())
- parse_error_context
+ parse_error_context
(id, "Invalid method declaration, return type required");
/* 8.6.3: Constructor modifiers */
else
/* Inner class can't declare static methods */
if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (this_class))
{
- parse_error_context
+ parse_error_context
(id, "Method `%s' can't be static in inner class `%s'. Only members of interfaces and top-level classes can be static",
IDENTIFIER_POINTER (EXPR_WFL_NODE (id)),
lang_printable_name (this_class, 0));
/* When defining an abstract or interface method, the curly
bracket at level 1 doesn't exist because there is no function
body */
- lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
+ lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
EXPR_WFL_LINENO (id));
/* Remember the original argument list */
register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE);
}
else
- meth = add_method (this_class, flags, meth_name,
+ meth = add_method (this_class, flags, meth_name,
build_java_signature (meth));
/* Remember final parameters */
{
register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current),
NULL_TREE, NULL_TREE);
- JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
+ JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
&TREE_VALUE (current);
}
DECL_FUNCTION_THROWS (meth) = throws;
DECL_CONSTRUCTOR_P (meth) = 1;
/* Compute and store the number of artificial parameters declared
for this constructor */
- for (count = 0, current = TYPE_FIELDS (this_class); current;
+ for (count = 0, current = TYPE_FIELDS (this_class); current;
current = TREE_CHAIN (current))
if (FIELD_LOCAL_ALIAS (current))
count++;
if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
{
tree name = DECL_NAME (current_function_decl);
- parse_error_context (DECL_FUNCTION_WFL (current_function_decl),
+ parse_error_context (DECL_FUNCTION_WFL (current_function_decl),
"%s method `%s' can't have a body defined",
(METHOD_NATIVE (current_function_decl) ?
"Native" : "Abstract"),
{
tree name = DECL_NAME (current_function_decl);
parse_error_context
- (DECL_FUNCTION_WFL (current_function_decl),
+ (DECL_FUNCTION_WFL (current_function_decl),
"Non native and non abstract method `%s' must have a body defined",
IDENTIFIER_POINTER (name));
method_body = NULL_TREE;
}
- if (flag_emit_class_files && method_body
- && TREE_CODE (method_body) == NOP_EXPR
- && TREE_TYPE (current_function_decl)
+ if (flag_emit_class_files && method_body
+ && TREE_CODE (method_body) == NOP_EXPR
+ && TREE_TYPE (current_function_decl)
&& TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node)
method_body = build1 (RETURN_EXPR, void_type_node, NULL);
ARG_FINAL_P parameter that might have been set on some of this
function parameters. */
UNMARK_FINAL_PARMS (current_function_decl);
-
+
/* So we don't have an irrelevant function declaration context for
the next static block we'll see. */
current_function_decl = NULL_TREE;
vcc_list = nreverse (vcc_list);
for (liste = vcc_list; liste; liste = TREE_CHAIN (liste))
{
- parse_error_context
+ parse_error_context
(TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
constructor_circularity_msg
- (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
+ (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
java_error_count--;
}
}
t = xstrdup (lang_printable_name (meth, 0));
- parse_error_context (TREE_PURPOSE (c),
+ parse_error_context (TREE_PURPOSE (c),
"%s: recursive invocation of constructor `%s'",
constructor_circularity_msg (current, meth), t);
free (t);
OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags,
ACC_ABSTRACT, "abstract method",
IDENTIFIER_POINTER (DECL_NAME (meth)));
- OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags,
+ OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags,
ACC_PUBLIC, "abstract method",
IDENTIFIER_POINTER (DECL_NAME (meth)));
this$<n> decl in the name field of its parameter declaration. We
also might have to hide the outer context local alias
initializers. Not done when the class is a toplevel class. */
- if (PURE_INNER_CLASS_DECL_P (GET_CPC ())
+ if (PURE_INNER_CLASS_DECL_P (GET_CPC ())
&& EXPR_WFL_NODE (id) == GET_CPC_UN ())
{
tree aliases_list, type, thisn;
/* First the aliases, linked to the regular parameters */
aliases_list =
- build_alias_initializer_parameter_list (AIPL_FUNCTION_DECLARATION,
+ build_alias_initializer_parameter_list (AIPL_FUNCTION_DECLARATION,
TREE_TYPE (GET_CPC ()),
NULL_TREE, NULL);
list = chainon (nreverse (aliases_list), list);
list = tree_cons (build_wfl_node (thisn), build_pointer_type (type),
list);
}
-
+
for (current = list; current; current = TREE_CHAIN (current))
{
int must_chain = 0;
if (must_chain)
{
patch_stage = JDEP_METHOD;
- type = register_incomplete_type (patch_stage,
+ type = register_incomplete_type (patch_stage,
type_wfl, wfl_name, type);
jdep = CLASSD_LAST (ctxp->classd_list);
JDEP_MISC (jdep) = id;
arg_node = build_tree_list (name, real_type);
/* Remeber arguments declared final. */
ARG_FINAL_P (arg_node) = ARG_FINAL_P (current);
-
+
if (jdep)
JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node);
TREE_CHAIN (arg_node) = arg_types;
unresolved_type_p (wfl, returned)
tree wfl;
tree *returned;
-
+
{
if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
{
if (ctxp->package)
return merge_qualified_name (ctxp->package, name);
- else
+ else
return name;
}
/* Has to be an interface */
if (!CLASS_INTERFACE (super_decl))
{
- parse_error_context
+ parse_error_context
(this_wfl, "%s `%s' can't implement/extend %s `%s'",
- (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
+ (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
"Interface" : "Class"),
IDENTIFIER_POINTER (DECL_NAME (this_decl)),
(TYPE_ARRAY_P (super_type) ? "array" : "class"),
return 1;
}
- /* Check top-level interface access. Inner classes are subject to member
+ /* Check top-level interface access. Inner classes are subject to member
access rules (6.6.1). */
if (! INNER_CLASS_P (super_type)
&& check_pkg_class_access (DECL_NAME (super_decl),
/* SUPER should be a CLASS (neither an array nor an interface) */
if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type)))
{
- parse_error_context
+ parse_error_context
(wfl, "Class `%s' can't subclass %s `%s'",
IDENTIFIER_POINTER (DECL_NAME (this_decl)),
(CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"),
if (! INNER_CLASS_P (super_type)
&& (check_pkg_class_access (DECL_NAME (super_decl), wfl, true)))
return 1;
-
+
SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
IDENTIFIER_POINTER (DECL_NAME (this_decl)),
IDENTIFIER_POINTER (DECL_NAME (super_decl))));
create_jdep_list (ctxp)
struct parser_ctxt *ctxp;
{
- jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist));
+ jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist));
new->first = new->last = NULL;
new->next = ctxp->classd_list;
ctxp->classd_list = new;
&& GET_ENCLOSING_CPC ())
JDEP_ENCLOSING (new) = TREE_VALUE (GET_ENCLOSING_CPC ());
else if (kind == JDEP_SUPER)
- JDEP_ENCLOSING (new) = (GET_ENCLOSING_CPC () ?
+ JDEP_ENCLOSING (new) = (GET_ENCLOSING_CPC () ?
TREE_VALUE (GET_ENCLOSING_CPC ()) : NULL_TREE);
else
JDEP_ENCLOSING (new) = GET_CPC ();
return lookup_cl (TYPE_NAME (type));
return NULL_TREE;
}
-
+
for (i = 0; i < TREE_VEC_LENGTH (basetype_vec); i++)
{
tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
switch (mode)
{
case AIPL_FUNCTION_DECLARATION:
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
+ MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
&buffer [4]);
purpose = build_wfl_node (mangled_id);
if (TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE)
break;
case AIPL_FUNCTION_FINIT_INVOCATION:
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
+ MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
&buffer [4]);
/* Now, this is wrong. purpose should always be the NAME
of something and value its matching value (decl, type,
}
if (additional_parms)
{
- if (ANONYMOUS_CLASS_P (class_type)
+ if (ANONYMOUS_CLASS_P (class_type)
&& mode == AIPL_FUNCTION_CTOR_INVOCATION)
additional_parms = nreverse (additional_parms);
parm = chainon (additional_parms, parm);
int i = 0, artificial = 0;
tree decl, ctor_name;
char buffer [80];
-
+
/* The constructor name is <init> unless we're dealing with an
anonymous class, in which case the name will be fixed after having
be expanded. */
/* Some more arguments to be hidden here. The values of the local
variables of the outer context that the inner class needs to see. */
parm = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION,
- class_type, parm,
+ class_type, parm,
&artificial);
}
}
CRAFTED_PARAM_LIST_FIXUP (parm);
- decl = create_artificial_method (class_type, flags, void_type_node,
+ decl = create_artificial_method (class_type, flags, void_type_node,
ctor_name, parm);
fix_method_argument_names (parm, decl);
/* Now, mark the artificial parameters. */
JDEP_DECL (dep), JDEP_WFL (dep));
JDEP_RESOLVED (dep, decl);
}
-
+
if (!decl)
complete_class_report_errors (dep);
else if (PURE_INNER_CLASS_DECL_P (decl))
ctxp->class_list = nreverse (ctxp->class_list);
ctxp->classd_list = reverse_jdep_list (ctxp);
- for (cclassd = ctxp->classd_list, cclass = ctxp->class_list;
- cclass && cclassd;
+ for (cclassd = ctxp->classd_list, cclass = ctxp->class_list;
+ cclass && cclassd;
cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd))
{
jdep *dep;
/* Simply patch super */
if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
continue;
- BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
+ BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
(TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
break;
DECL_ALIGN (field_decl) = 0;
DECL_USER_ALIGN (field_decl) = 0;
layout_decl (field_decl, 0);
- SOURCE_FRONTEND_DEBUG
+ SOURCE_FRONTEND_DEBUG
(("Completed field/var decl `%s' with `%s'",
IDENTIFIER_POINTER (DECL_NAME (field_decl)),
IDENTIFIER_POINTER (DECL_NAME (decl))));
if (TREE_CODE (type) == RECORD_TYPE)
type = promote_type (type);
JDEP_APPLY_PATCH (dep, type);
- SOURCE_FRONTEND_DEBUG
+ SOURCE_FRONTEND_DEBUG
(((JDEP_KIND (dep) == JDEP_METHOD_RETURN ?
"Completing fct `%s' with ret type `%s'":
"Completing arg `%s' with type `%s'"),
- IDENTIFIER_POINTER (EXPR_WFL_NODE
+ IDENTIFIER_POINTER (EXPR_WFL_NODE
(JDEP_DECL_WFL (dep))),
IDENTIFIER_POINTER (DECL_NAME (decl))));
}
case JDEP_TYPE:
JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
- SOURCE_FRONTEND_DEBUG
+ SOURCE_FRONTEND_DEBUG
(("Completing a random type dependency on a '%s' node",
tree_code_name [TREE_CODE (JDEP_DECL (dep))]));
break;
case JDEP_EXCEPTION:
JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
- SOURCE_FRONTEND_DEBUG
+ SOURCE_FRONTEND_DEBUG
(("Completing `%s' `throws' argument node",
IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))));
break;
tree resolved_type = TREE_TYPE (class_type);
int array_dims = 0;
tree resolved_type_decl;
-
+
if (resolved_type != NULL_TREE)
{
tree resolved_type_decl = TYPE_NAME (resolved_type);
WFL_STRIP_BRACKET (cl, cl);
/* 2- Resolve the bare type */
- if (!(resolved_type_decl = do_resolve_class (enclosing, class_type,
+ if (!(resolved_type_decl = do_resolve_class (enclosing, class_type,
decl, cl)))
return NULL_TREE;
resolved_type = TREE_TYPE (resolved_type_decl);
through when searching the current class as an inner class, in
order to detect circular references. Remember to free it before
returning the section 0- of this function. */
- circularity_hash = htab_create (20, htab_hash_pointer, htab_eq_pointer,
+ circularity_hash = htab_create (20, htab_hash_pointer, htab_eq_pointer,
NULL);
/* 0- Search in the current class as an inner class.
/* If we haven't found anything because SUPER reached Object and
ENCLOSING happens to be an innerclass, try the enclosing context. */
- if ((!super || super == object_type_node) &&
+ if ((!super || super == object_type_node) &&
enclosing && INNER_CLASS_DECL_P (enclosing))
enclosing = DECL_CONTEXT (enclosing);
else
/* If there is a current package (ctxp->package), it's the first
element of package_list and we can skip it. */
- for (package = (ctxp->package ?
+ for (package = (ctxp->package ?
TREE_CHAIN (package_list) : package_list);
package; package = TREE_CHAIN (package))
if ((new_class_decl = qualify_and_find (class_type,
- TREE_PURPOSE (package),
+ TREE_PURPOSE (package),
TYPE_NAME (class_type))))
return new_class_decl;
}
/* 5- Check an other compilation unit that bears the name of type */
load_class (TYPE_NAME (class_type), 0);
-
+
if (!cl)
cl = lookup_cl (decl);
-
- /* If we don't have a value for CL, then we're being called recursively.
+
+ /* If we don't have a value for CL, then we're being called recursively.
We can't check package access just yet, but it will be taken care of
by the caller. */
if (cl)
/* Check methods */
if (CLASS_FROM_SOURCE_P (decl_type))
java_check_methods (decl);
- /* Layout the type if necessary */
+ /* Layout the type if necessary */
if (decl_type != current_class && !CLASS_LOADED_P (decl_type))
safe_layout_class (decl_type);
java_parser_context_save_global ();
decl = resolve_class (TYPE_NAME (current_class), ptr, NULL_TREE, cl);
java_parser_context_restore_global ();
-
+
return decl;
}
switch (JDEP_KIND (dep))
{
case JDEP_SUPER:
- parse_error_context
+ parse_error_context
(JDEP_WFL (dep), "Superclass `%s' of class `%s' not found",
purify_type_name (name),
IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
break;
case JDEP_METHOD_RETURN: /* Covers return type */
parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the return type of method `%s'",
+ (JDEP_WFL (dep), "Type `%s' not found in the declaration of the return type of method `%s'",
purify_type_name (name),
IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
break;
break;
case JDEP_VARIABLE:
parse_error_context
- (JDEP_WFL (dep), "Type `%s' not found in the declaration of the local variable `%s'",
- purify_type_name (IDENTIFIER_POINTER
+ (JDEP_WFL (dep), "Type `%s' not found in the declaration of the local variable `%s'",
+ purify_type_name (IDENTIFIER_POINTER
(EXPR_WFL_NODE (JDEP_WFL (dep)))),
IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
break;
case JDEP_EXCEPTION: /* As specified by `throws' */
- parse_error_context
+ parse_error_context
(JDEP_WFL (dep), "Class `%s' not found in `throws'",
IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))));
break;
name = DECL_NAME (decl);
DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
}
-
+
to_return = lang_printable_name (decl, 0);
if (DECL_CONSTRUCTOR_P (decl))
DECL_NAME (decl) = name;
-
+
return to_return;
}
&& sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef))
&& !DECL_ARTIFICIAL (method))
{
- parse_error_context
+ parse_error_context
(DECL_FUNCTION_WFL (method), "Duplicate %s declaration `%s'",
(DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
get_printable_method_name (redef));
tree other_super, other_method, method_sig, method_name;
int found = 0;
int end_type_reached = 0;
-
+
if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
continue;
-
+
/* Now verify that somewhere in between TYPE and CLASS,
abstract method METHOD gets a non abstract definition
that is inherited by CLASS. */
-
+
method_sig = build_java_signature (TREE_TYPE (method));
method_name = DECL_NAME (method);
if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
do {
if (other_super == end_type)
end_type_reached = 1;
-
+
/* Method search */
for (other_method = TYPE_METHODS (other_super); other_method;
other_method = TREE_CHAIN (other_method))
{
tree s = build_java_signature (TREE_TYPE (other_method));
tree other_name = DECL_NAME (other_method);
-
+
if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
other_name = EXPR_WFL_NODE (other_name);
if (!DECL_CLINIT_P (other_method)
}
other_super = CLASSTYPE_SUPER (other_super);
} while (!end_type_reached);
-
+
/* Report that abstract METHOD didn't find an implementation
that CLASS can use. */
if (!found)
{
- char *t = xstrdup (lang_printable_name
+ char *t = xstrdup (lang_printable_name
(TREE_TYPE (TREE_TYPE (method)), 0));
tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
-
- parse_error_context
+
+ parse_error_context
(lookup_cl (class_decl),
"Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract",
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- t, lang_printable_name (method, 0),
- (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
+ t, lang_printable_name (method, 0),
+ (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
"interface" : "class"),
IDENTIFIER_POINTER (ccn),
(CLASS_INTERFACE (class_decl) ? "interface" : "class"),
if (!INCOMPLETE_TYPE_P (TREE_TYPE (type)))
return 0;
-
+
args = TYPE_ARG_TYPES (type);
if (TREE_CODE (type) == METHOD_TYPE)
args = TREE_CHAIN (args);
java_check_abstract_methods (class_decl);
else
java_check_regular_methods (class_decl);
-
+
CLASS_METHOD_CHECKED_P (TREE_TYPE (class_decl)) = 1;
}
mthrows; mthrows = TREE_CHAIN (mthrows))
{
if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node))
- parse_error_context
+ parse_error_context
(TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be a subclass of class `java.lang.Throwable'",
- IDENTIFIER_POINTER
+ IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
}
if (METHOD_STATIC (method) && !TOPLEVEL_CLASS_DECL_P (class_decl))
{
char *t = xstrdup (lang_printable_name (class, 0));
- parse_error_context
+ parse_error_context
(method_wfl, "Method `%s' can't be static in inner class `%s'. Only members of interfaces and top-level classes can be static",
lang_printable_name (method, 0), t);
free (t);
/* If `found' is declared in an interface, make sure the
modifier matches. */
- if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
+ if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
&& clinit_identifier_node != DECL_NAME (found)
&& !METHOD_PUBLIC (method))
{
types. */
if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
{
- char *t = xstrdup
+ char *t = xstrdup
(lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
- parse_error_context
+ parse_error_context
(method_wfl,
- "Method `%s' was defined with return type `%s' in class `%s'",
+ "Method `%s' was defined with return type `%s' in class `%s'",
lang_printable_name (found, 0), t,
- IDENTIFIER_POINTER
+ IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
free (t);
}
/* Static *can* override static */
if (METHOD_STATIC (found) && METHOD_STATIC (method))
continue;
- parse_error_context
+ parse_error_context
(method_wfl,
"%s methods can't be overriden. Method `%s' is %s in class `%s'",
(METHOD_FINAL (found) ? "Final" : "Static"),
/* Static method can't override instance method. */
if (METHOD_STATIC (method))
{
- parse_error_context
+ parse_error_context
(method_wfl,
"Instance methods can't be overriden by a static method. Method `%s' is an instance method in class `%s'",
lang_printable_name (found, 0),
taken care of. */
if (!CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
&& ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method))
- || (METHOD_PROTECTED (found)
+ || (METHOD_PROTECTED (found)
&& !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method)))
|| (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC))
&& METHOD_PRIVATE (method))))
{
- parse_error_context
+ parse_error_context
(method_wfl,
"Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 0),
- (METHOD_PUBLIC (method) ? "public" :
+ (METHOD_PUBLIC (method) ? "public" :
(METHOD_PRIVATE (method) ? "private" : "protected")),
- IDENTIFIER_POINTER (DECL_NAME
+ IDENTIFIER_POINTER (DECL_NAME
(TYPE_NAME (DECL_CONTEXT (found)))));
continue;
}
/* Inheriting multiple methods with the same signature. FIXME */
}
-
+
if (!TYPE_NVIRTUALS (class))
TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows)))
continue;
/* Checked expression must be compatible */
- for (fthrows = DECL_FUNCTION_THROWS (found);
+ for (fthrows = DECL_FUNCTION_THROWS (found);
fthrows; fthrows = TREE_CHAIN (fthrows))
if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows)))
break;
if (!fthrows)
{
- parse_error_context
+ parse_error_context
(method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
lang_printable_name (found, 0),
- IDENTIFIER_POINTER
+ IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
}
}
{
char *t;
t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
- parse_error_context
+ parse_error_context
(DECL_FUNCTION_WFL (found),
"Method `%s' was defined with return type `%s' in class `%s'",
lang_printable_name (found, 0), t,
- IDENTIFIER_POINTER
+ IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
free (t);
continue;
if (!vec_elt)
continue;
sub_interface = BINFO_TYPE (vec_elt);
- for (sub_interface_method = TYPE_METHODS (sub_interface);
+ for (sub_interface_method = TYPE_METHODS (sub_interface);
sub_interface_method;
sub_interface_method = TREE_CHAIN (sub_interface_method))
{
- found = lookup_java_interface_method2 (interface,
+ found = lookup_java_interface_method2 (interface,
sub_interface_method);
if (found && (found != sub_interface_method))
{
- parse_error_context
+ parse_error_context
(lookup_cl (sub_interface_method),
"Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
lang_printable_name (found, 0),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME
+ IDENTIFIER_POINTER
+ (DECL_NAME (TYPE_NAME
(DECL_CONTEXT (sub_interface_method)))),
- IDENTIFIER_POINTER
+ IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
}
}
{
tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return;
if ((BINFO_TYPE (vec_elt) != object_type_node)
- && (to_return =
+ && (to_return =
lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1)))
return to_return;
}
for (i = 0; i < n; i++)
{
- to_return = lookup_java_interface_method2
+ to_return = lookup_java_interface_method2
(BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl);
if (to_return)
return to_return;
method_signature = build_java_argument_signature (TREE_TYPE (method_decl));
name = DECL_NAME (method_decl);
- method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
+ method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
EXPR_WFL_NODE (name) : name);
method_type = TREE_TYPE (TREE_TYPE (method_decl));
tree name = DECL_NAME (method);
if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
EXPR_WFL_NODE (name) : name) == method_name
- && method_sig == method_signature
+ && method_sig == method_signature
&& TREE_TYPE (TREE_TYPE (method)) != method_type)
return method;
}
tree decl;
{
char *line, *found;
-
+
if (!decl)
return NULL_TREE;
EXPR_WFL_FILENAME_NODE (cl_v) = get_identifier (DECL_SOURCE_FILE (decl));
EXPR_WFL_SET_LINECOL (cl_v, DECL_SOURCE_LINE_FIRST (decl), -1);
- line = java_get_line_col (EXPR_WFL_FILENAME (cl_v),
+ line = java_get_line_col (EXPR_WFL_FILENAME (cl_v),
EXPR_WFL_LINENO (cl_v), EXPR_WFL_COLNO (cl_v));
- found = strstr ((const char *)line,
+ found = strstr ((const char *)line,
(const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
if (found)
EXPR_WFL_SET_LINECOL (cl_v, EXPR_WFL_LINENO (cl_v), found - line);
/* Don't load twice something already defined. */
if (IDENTIFIER_CLASS_VALUE (to_be_found))
continue;
-
+
while (1)
{
tree left;
load_class (to_be_found, 0);
error_found =
check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true);
-
+
/* We found it, we can bail out */
if (IDENTIFIER_CLASS_VALUE (to_be_found))
break;
tree enclosing_type;
tree class_type;
{
- tree import = (enclosing_type ? TYPE_IMPORT_LIST (enclosing_type) :
+ tree import = (enclosing_type ? TYPE_IMPORT_LIST (enclosing_type) :
ctxp->import_list);
while (import)
{
int current_entry_len = zipd->filename_length;
if (current_entry_len >= BUFFER_LENGTH (filename)
- && strncmp (filename->data, current_entry,
+ && strncmp (filename->data, current_entry,
BUFFER_LENGTH (filename)) != 0)
continue;
found |= note_possible_classname (current_entry,
*filename->ptr++ = '/';
for (;;)
{
- int len;
+ int len;
const char *d_name;
struct dirent *direntp = readdir (dirp);
if (!direntp)
/* Possibly find a type in the import on demands specified
types. Returns 1 if an error occurred, 0 otherwise. Run through the
entire list, to detected potential double definitions. */
-
+
static int
find_in_imports_on_demand (enclosing_type, class_type)
tree enclosing_type;
const char *id_name;
tree decl, type_name_copy;
- obstack_grow (&temporary_obstack,
+ obstack_grow (&temporary_obstack,
IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
obstack_1grow (&temporary_obstack, '.');
- obstack_grow0 (&temporary_obstack,
+ obstack_grow0 (&temporary_obstack,
IDENTIFIER_POINTER (class_type_name),
IDENTIFIER_LENGTH (class_type_name));
id_name = obstack_finish (&temporary_obstack);
-
+
if (! (node = maybe_get_identifier (id_name)))
continue;
TYPE_NAME (class_type) = type_name_copy;
continue;
}
-
+
/* If the loaded class is accessible, we keep a tab on it to
detect and report multiple inclusions. */
if (IS_A_CLASSFILE_NAME (node))
else if (seen_once >= 0)
{
tree location = (cl ? cl : TREE_PURPOSE (import));
- tree package = (cl ? EXPR_WFL_NODE (cl) :
+ tree package = (cl ? EXPR_WFL_NODE (cl) :
EXPR_WFL_NODE (TREE_PURPOSE (import)));
seen_once++;
- parse_error_context
+ parse_error_context
(location,
"Type `%s' also potentially defined in package `%s'",
- IDENTIFIER_POINTER (TYPE_NAME (class_type)),
+ IDENTIFIER_POINTER (TYPE_NAME (class_type)),
IDENTIFIER_POINTER (package));
}
}
/* Try to progressively construct a type name */
if (TREE_CODE (pkg) == EXPR_WITH_FILE_LOCATION)
- for (current = EXPR_WFL_QUALIFICATION (pkg);
+ for (current = EXPR_WFL_QUALIFICATION (pkg);
current; current = TREE_CHAIN (current))
{
/* If we don't have what we're expecting, exit now. TYPE_NAME
will be null and the error caught later. */
if (TREE_CODE (QUAL_WFL (current)) != EXPR_WITH_FILE_LOCATION)
break;
- *type_name =
+ *type_name =
merge_qualified_name (*type_name, EXPR_WFL_NODE (QUAL_WFL (current)));
if ((decl = resolve_no_layout (*type_name, NULL_TREE)))
{
}
-/* Check accessibility of inner classes according to member access rules.
+/* Check accessibility of inner classes according to member access rules.
DECL is the inner class, ENCLOSING_DECL is the class from which the
access is being attempted. */
class in which DECL is declared. */
tree top_level = decl;
while (DECL_CONTEXT (top_level))
- top_level = DECL_CONTEXT (top_level);
+ top_level = DECL_CONTEXT (top_level);
while (DECL_CONTEXT (enclosing_decl))
enclosing_decl = DECL_CONTEXT (enclosing_decl);
if (top_level == enclosing_decl)
- return;
+ return;
access = "private";
}
else if (CLASS_PROTECTED (decl))
/* Access is permitted from within the same package... */
if (in_same_package (decl, enclosing_decl))
return;
-
+
/* ... or from within the body of a subtype of the context in which
DECL is declared. */
decl_context = DECL_CONTEXT (decl);
{
if (CLASS_INTERFACE (decl))
{
- if (interface_of_p (TREE_TYPE (decl_context),
+ if (interface_of_p (TREE_TYPE (decl_context),
enclosing_decl_type))
return;
}
else
{
/* Eww. The order of the arguments is different!! */
- if (inherits_from_p (enclosing_decl_type,
+ if (inherits_from_p (enclosing_decl_type,
TREE_TYPE (decl_context)))
return;
}
enclosing_decl = DECL_CONTEXT (enclosing_decl);
- }
+ }
access = "protected";
}
else if (! CLASS_PUBLIC (decl))
return 0;
if (verbose)
- parse_error_context
+ parse_error_context
(cl, "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed",
(CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
IDENTIFIER_POINTER (class_name));
for (i = 0; i <= 10; i++) if (1 << i & modifier) break;
if (modifier == ACC_FINAL)
final_p = 1;
- else
+ else
{
- parse_error_context
- (ctxp->modifier_ctx [i],
+ parse_error_context
+ (ctxp->modifier_ctx [i],
"Only `final' is allowed as a local variables modifier");
return;
}
MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
DECL_FINAL (decl) = final_p;
BLOCK_CHAIN_DECL (decl);
-
+
/* If doing xreferencing, replace the line number with the WFL
compound value */
if (flag_emit_xref)
DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl);
-
+
/* Don't try to use an INIT statement when an error was found */
if (init && java_error_count)
init = NULL_TREE;
-
+
/* Add the initialization function to the current function's code */
if (init)
{
build_debugable_stmt (EXPR_WFL_LINECOL (init),
init));
}
-
+
/* Setup dependency the type of the decl */
if (must_chain)
{
{
tree type = TREE_VALUE (tem);
tree name = TREE_PURPOSE (tem);
-
+
/* If type is incomplete. Create an incomplete decl and ask for
the decl to be patched later */
if (INCOMPLETE_TYPE_P (type))
tree mdecl;
java_parser_context_save_global ();
- lineno = 0;
- mdecl = make_node (FUNCTION_TYPE);
+ lineno = 0;
+ mdecl = make_node (FUNCTION_TYPE);
TREE_TYPE (mdecl) = type;
TYPE_ARG_TYPES (mdecl) = args;
- mdecl = add_method (class, flags, name, build_java_signature (mdecl));
+ mdecl = add_method (class, flags, name, build_java_signature (mdecl));
java_parser_context_restore_global ();
- DECL_ARTIFICIAL (mdecl) = 1;
+ DECL_ARTIFICIAL (mdecl) = 1;
return mdecl;
}
tree b, type, stmt;
{
tree body = BLOCK_EXPR_BODY (b), c;
-
+
if (java_error_count)
return body;
-
+
if ((c = add_stmt_to_compound (body, type, stmt)) == body)
return body;
while (1)
{
- for (current = previous_list;
+ for (current = previous_list;
current != end; current = TREE_CHAIN (current))
layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
-
+
if (previous_list != all_class_list)
{
end = previous_list;
after having reversed the fields */
else
{
- TYPE_FIELDS (current_class) =
+ TYPE_FIELDS (current_class) =
nreverse (TYPE_FIELDS (current_class));
TYPE_SIZE (current_class) = NULL_TREE;
}
if (!DECL_CONSTRUCTOR_P (decl))
continue;
-
+
no_body = !DECL_FUNCTION_BODY (decl);
/* Don't generate debug info on line zero when expanding a
generated constructor. */
/* Ctors aren't part of this batch. */
if (DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl))
continue;
-
+
/* Skip abstract or native methods -- but do handle native
methods when generating JNI stubs. */
if (METHOD_ABSTRACT (decl) || (! flag_jni && METHOD_NATIVE (decl)))
java_complete_expand_method (clinit);
ctxp->explicit_constructor_p = 0;
}
-
+
/* We might have generated a class$ that we now want to expand */
if (TYPE_DOT_CLASS (current_class))
java_complete_expand_method (TYPE_DOT_CLASS (current_class));
prove wrong.) */
if (!CLASS_INTERFACE (class_decl))
for (decl = TYPE_METHODS (current_class); decl; decl = TREE_CHAIN (decl))
- if (DECL_CONSTRUCTOR_P (decl)
+ if (DECL_CONSTRUCTOR_P (decl)
&& verify_constructor_circularity (decl, decl))
break;
return NULL_TREE;
/* Go through all static fields and pre expand them */
- for (current = TYPE_FIELDS (class_type); current;
+ for (current = TYPE_FIELDS (class_type); current;
current = TREE_CHAIN (current))
if (FIELD_STATIC (current))
build_field_ref (NULL_TREE, class_type, DECL_NAME (current));
case BLOCK:
bbody = BLOCK_EXPR_BODY (bbody);
break;
-
+
case EXPR_WITH_FILE_LOCATION:
bbody = EXPR_WFL_NODE (bbody);
break;
-
+
case COMPOUND_EXPR:
if (analyze_clinit_body (this_class, TREE_OPERAND (bbody, 0)))
return 1;
bbody = TREE_OPERAND (bbody, 1);
break;
-
+
case MODIFY_EXPR:
/* If we're generating to class file and we're dealing with an
array initialization, we return 1 to keep <clinit> */
{
tree type, current;
tree fbody, bbody;
-
+
if (!DECL_CLINIT_P (mdecl))
return 0;
type = DECL_CONTEXT (mdecl);
current = TYPE_FIELDS (type);
- for (current = (current ? TREE_CHAIN (current) : current);
+ for (current = (current ? TREE_CHAIN (current) : current);
current; current = TREE_CHAIN (current))
{
tree f_init;
if (TYPE_METHODS (type) == mdecl)
TYPE_METHODS (type) = TREE_CHAIN (mdecl);
else
- for (current = TYPE_METHODS (type); current;
+ for (current = TYPE_METHODS (type); current;
current = TREE_CHAIN (current))
if (TREE_CHAIN (current) == mdecl)
{
for (; tem; tem = TREE_CHAIN (tem))
{
- /* TREE_CHAIN (tem) will change after pushdecl. */
+ /* TREE_CHAIN (tem) will change after pushdecl. */
tree next = TREE_CHAIN (tem);
tree type = TREE_TYPE (tem);
if (PROMOTE_PROTOTYPES
/* Fix constructors before expanding them */
if (DECL_CONSTRUCTOR_P (mdecl))
fix_constructors (mdecl);
-
+
/* Expand functions that have a body */
if (!DECL_FUNCTION_BODY (mdecl))
return;
announce_function (mdecl);
if (! quiet_flag)
fprintf (stderr, "]");
-
+
/* Prepare the function for tree completion */
start_complete_expand_method (mdecl);
/* Install the current this */
- current_this = (!METHOD_STATIC (mdecl) ?
+ current_this = (!METHOD_STATIC (mdecl) ?
BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
/* Purge the `throws' list of unchecked exceptions (we save a copy
of the list and re-install it later.) */
exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl));
purge_unchecked_exceptions (mdecl);
-
+
/* Install exceptions thrown with `throws' */
PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
-
+
if (block_body != NULL_TREE)
{
block_body = java_complete_tree (block_body);
-
+
/* Before we check initialization, attached all class initialization
variable to the block_body */
htab_traverse (DECL_FUNCTION_INIT_TEST_TABLE (mdecl),
attach_init_test_initialization_flags, block_body);
-
+
if (! flag_emit_xref && ! METHOD_NATIVE (mdecl))
{
check_for_initialization (block_body, mdecl);
-
+
/* Go through all the flags marking the initialization of
static variables and see whether they're definitively
assigned, in which case the type is remembered as
initialization of self. */
if (METHOD_STATIC (mdecl))
{
- *(htab_find_slot
+ *(htab_find_slot
(DECL_FUNCTION_INITIALIZED_CLASS_TABLE (mdecl),
DECL_CONTEXT (mdecl), INSERT)) = DECL_CONTEXT (mdecl);
}
}
ctxp->explicit_constructor_p = 0;
}
-
+
BLOCK_EXPR_BODY (fbody) = block_body;
-
+
/* If we saw a return but couldn't evaluate it properly, we'll have
an error_mark_node here. */
if (block_body != error_mark_node
}
}
- /* Prepare the function for RTL expansion */
+ /* Prepare the function for RTL expansion */
start_complete_expand_method (decl);
/* Expand function start, generate initialization flag
&& (!FIELD_PRIVATE (decl) || !flag_emit_class_files ))
{
tree thisn = build_current_thisn (current_class);
- access = make_qualified_primary (build_wfl_node (thisn),
+ access = make_qualified_primary (build_wfl_node (thisn),
id, EXPR_WFL_LINECOL (id));
}
/* Otherwise, generate access methods to outer this and access the
outer_field_access_p (type, decl)
tree type, decl;
{
- if (!INNER_CLASS_TYPE_P (type)
+ if (!INNER_CLASS_TYPE_P (type)
|| TREE_CODE (decl) != FIELD_DECL
|| DECL_CONTEXT (decl) == type)
return 0;
-
+
/* If the inner class extends the declaration context of the field
we're try to acces, then this isn't an outer field access */
if (inherits_from_p (type, DECL_CONTEXT (decl)))
/* Well, gcj generates slightly different tree nodes when compiling
to native or bytecodes. It's the case for function calls. */
- if (flag_emit_class_files
+ if (flag_emit_class_files
&& TREE_CODE (node) == CALL_EXPR
&& OUTER_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (TREE_OPERAND (node, 0))))
identified = 1;
else if (!flag_emit_class_files)
{
node = TREE_OPERAND (node, 0);
-
+
if (node && TREE_OPERAND (node, 0)
&& TREE_CODE (TREE_OPERAND (node, 0)) == ADDR_EXPR)
{
node = TREE_OPERAND (node, 0);
if (TREE_OPERAND (node, 0)
&& TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL
- && (OUTER_FIELD_ACCESS_IDENTIFIER_P
+ && (OUTER_FIELD_ACCESS_IDENTIFIER_P
(DECL_NAME (TREE_OPERAND (node, 0)))))
identified = 1;
}
tree wfl, node, rhs;
{
tree name, arg_type, arg;
-
+
if (outer_field_expanded_access_p (node, &name, &arg_type, &arg))
{
- node = build_outer_field_access_expr (EXPR_WFL_LINECOL (wfl),
+ node = build_outer_field_access_expr (EXPR_WFL_LINECOL (wfl),
arg_type, name, arg, rhs);
return java_complete_tree (node);
}
}
/* Construct the expression that calls an access method:
- <type>.access$<n>(<arg1> [, <arg2>]);
+ <type>.access$<n>(<arg1> [, <arg2>]);
ARG2 can be NULL and will be omitted in that case. It will denote a
read access. */
{
tree args, cn, access;
- args = arg1 ? arg1 :
+ args = arg1 ? arg1 :
build_wfl_node (build_current_thisn (current_class));
args = build_tree_list (NULL_TREE, args);
tree decl;
{
tree id, args, stmt, mdecl;
-
+
if (FIELD_INNER_ACCESS_P (decl))
return FIELD_INNER_ACCESS (decl);
MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
-
+
/* Create the identifier and a function named after it. */
id = build_new_access_id ();
stmt = make_qualified_primary (build_wfl_node (inst_id),
build_wfl_node (DECL_NAME (decl)), 0);
stmt = build_return (0, stmt);
- mdecl = build_outer_field_access_method (DECL_CONTEXT (decl),
+ mdecl = build_outer_field_access_method (DECL_CONTEXT (decl),
TREE_TYPE (decl), id, args, stmt);
DECL_FUNCTION_ACCESS_DECL (mdecl) = decl;
/* Create the write access method. No write access for final variable */
if (!FIELD_FINAL (decl))
{
- args = build_tree_list (inst_id,
+ args = build_tree_list (inst_id,
build_pointer_type (DECL_CONTEXT (decl)));
TREE_CHAIN (args) = build_tree_list (wpv_id, TREE_TYPE (decl));
TREE_CHAIN (TREE_CHAIN (args)) = end_params_node;
build_wfl_node (DECL_NAME (decl)), 0);
stmt = build_return (0, build_assignment (ASSIGN_TK, 0, stmt,
build_wfl_node (wpv_id)));
- mdecl = build_outer_field_access_method (DECL_CONTEXT (decl),
- TREE_TYPE (decl), id,
+ mdecl = build_outer_field_access_method (DECL_CONTEXT (decl),
+ TREE_TYPE (decl), id,
args, stmt);
}
DECL_FUNCTION_ACCESS_DECL (mdecl) = decl;
/* Build an field access method NAME. */
-static tree
+static tree
build_outer_field_access_method (class, type, name, args, body)
tree class, type, name, args, body;
{
carg = TYPE_ARG_TYPES (TREE_TYPE (decl));
/* Create the arguments, as much as the original */
- for (; carg && carg != end_params_node;
+ for (; carg && carg != end_params_node;
carg = TREE_CHAIN (carg))
{
sprintf (buffer, "write_parm_value$%d", parm_id_count++);
- args = chainon (args, build_tree_list (get_identifier (buffer),
+ args = chainon (args, build_tree_list (get_identifier (buffer),
TREE_VALUE (carg)));
}
args = chainon (args, end_params_node);
/* Create the method */
- mdecl = create_artificial_method (class, ACC_STATIC,
+ mdecl = create_artificial_method (class, ACC_STATIC,
TREE_TYPE (TREE_TYPE (decl)), id, args);
layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
/* There is a potential bug here. We should be able to use
call_args = tree_cons (NULL_TREE, build_wfl_node (TREE_PURPOSE (carg)),
call_args);
- body = build_method_invocation (build_wfl_node (DECL_NAME (decl)),
+ body = build_method_invocation (build_wfl_node (DECL_NAME (decl)),
call_args);
if (!METHOD_STATIC (decl))
- body = make_qualified_primary (build_wfl_node (TREE_PURPOSE (args)),
+ body = make_qualified_primary (build_wfl_node (TREE_PURPOSE (args)),
body, 0);
if (TREE_TYPE (TREE_TYPE (decl)) != void_type_node)
body = build_return (0, body);
the enclosing instance of an inner class. The enclosing instance is
kept in a generated field called this$<n>, with <n> being the
inner class nesting level (starting from 0.) */
-
+
/* Build an access to a given this$<n>, always chaining access call to
others. Access methods to this$<n> are build on the fly if
necessary. This CAN'T be used to solely access this$<n-1> from
/* Build an access function to the this$<n> local to TYPE. NULL_TREE
is returned if nothing needs to be generated. Otherwise, the method
- generated and a method decl is returned.
+ generated and a method decl is returned.
NOTE: These generated methods should be declared in a class file
attribute so that they can't be referred to directly. */
fix_method_argument_names (args, mdecl);
layout_class_method (type, NULL_TREE, mdecl, NULL_TREE);
stmt = build_current_thisn (type);
- stmt = make_qualified_primary (build_wfl_node (inst_id),
+ stmt = make_qualified_primary (build_wfl_node (inst_id),
build_wfl_node (stmt), 0);
stmt = build_return (0, stmt);
i = saved_type_i;
else
{
- for (i = -1, decl = DECL_CONTEXT (TYPE_NAME (type));
+ for (i = -1, decl = DECL_CONTEXT (TYPE_NAME (type));
decl; decl = DECL_CONTEXT (decl), i++)
;
-
+
saved_type = type;
saved_type_i = i;
}
if (i == saved_i)
return saved_thisn;
-
+
sprintf (buffer, "this$%d", i);
saved_i = i;
saved_thisn = get_identifier (buffer);
TREE_CHAIN (args) = end_params_node;
/* Build the qualified name java.lang.Class.forName */
- tmp = MQN (MQN (MQN (BWF ("java"),
+ tmp = MQN (MQN (MQN (BWF ("java"),
BWF ("lang")), BWF ("Class")), BWF ("forName"));
load_class (class_not_found_type_node, 1);
load_class (no_class_def_found_type_node, 1);
-
+
/* Create the "class$" function */
- mdecl = create_artificial_method (class, ACC_STATIC,
+ mdecl = create_artificial_method (class, ACC_STATIC,
build_pointer_type (class_type_node),
classdollar_identifier_node, args);
- DECL_FUNCTION_THROWS (mdecl) =
+ DECL_FUNCTION_THROWS (mdecl) =
build_tree_list (NULL_TREE, no_class_def_found_type_node);
/* We start by building the try block. We need to build:
return (java.lang.Class.forName (type)); */
- stmt = build_method_invocation (tmp,
+ stmt = build_method_invocation (tmp,
build_tree_list (NULL_TREE, type_parm_wfl));
stmt = build_return (0, stmt);
/* Now onto the catch block. We start by building the expression
throwing a new exception: throw new NoClassDefFoundError (_.getMessage) */
- throw_stmt = make_qualified_name (build_wfl_node (wpv_id),
+ throw_stmt = make_qualified_name (build_wfl_node (wpv_id),
get_message_wfl, 0);
throw_stmt = build_method_invocation (throw_stmt, NULL_TREE);
-
+
/* Build new NoClassDefFoundError (_.getMessage) */
- throw_stmt = build_new_invocation
+ throw_stmt = build_new_invocation
(build_wfl_node (get_identifier ("NoClassDefFoundError")),
build_tree_list (build_pointer_type (string_type_node), throw_stmt));
sig_id = unmangle_classname (IDENTIFIER_POINTER (sig_id),
IDENTIFIER_LENGTH (sig_id));
- s = build_string (IDENTIFIER_LENGTH (sig_id),
+ s = build_string (IDENTIFIER_LENGTH (sig_id),
IDENTIFIER_POINTER (sig_id));
return build_method_invocation (build_wfl_node (classdollar_identifier_node),
build_tree_list (NULL_TREE, s));
const char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
DECL_NAME (mdecl) = DECL_NAME (sclass_decl);
parse_error_context
- (lookup_cl (TYPE_NAME (class_type)),
+ (lookup_cl (TYPE_NAME (class_type)),
"No constructor matching `%s' found in class `%s'",
lang_printable_name (mdecl, 0), n);
DECL_NAME (mdecl) = save;
}
-
+
/* The constructor body must be crafted by hand. It's the
constructor we defined when we realize we didn't have the
CLASSNAME() constructor */
start_artificial_method_body (mdecl);
-
+
/* Insert an assignment to the this$<n> hidden field, if
necessary */
if ((thisn_assign = build_thisn_assign ()))
end_artificial_method_body (mdecl);
}
/* Search for an explicit constructor invocation */
- else
+ else
{
int found = 0;
int invokes_this = 0;
tree found_call = NULL_TREE;
tree main_block = BLOCK_EXPR_BODY (body);
-
+
while (body)
switch (TREE_CODE (body))
{
TREE_OPERAND (found_call, 0));
TREE_OPERAND (found_call, 0) = empty_stmt_node;
}
-
+
DECL_INIT_CALLS_THIS (mdecl) = invokes_this;
/* Insert the instance initializer block right after. */
tree arg_type = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
if (super_inner)
arg_type = TREE_CHAIN (arg_type);
- for (m_arg_type = mdecl_arg_type;
- (arg_type != end_params_node
+ for (m_arg_type = mdecl_arg_type;
+ (arg_type != end_params_node
&& m_arg_type != end_params_node);
- arg_type = TREE_CHAIN (arg_type),
+ arg_type = TREE_CHAIN (arg_type),
m_arg_type = TREE_CHAIN (m_arg_type))
- if (!valid_method_invocation_conversion_p
+ if (!valid_method_invocation_conversion_p
(TREE_VALUE (arg_type),
TREE_VALUE (m_arg_type)))
break;
anything, unless we're emitting xrefs or checking the syntax only
(but not using -fsyntax-only for the purpose of generating
bytecode. */
- if (java_error_count && !flag_emit_xref
+ if (java_error_count && !flag_emit_xref
&& (!flag_syntax_only && !flag_emit_class_files))
return;
situation, the compiler cannot fall back to the original
source, having already read the outer class, so we must
prevent that situation. */
- for (current = ctxp->class_list;
- current;
+ for (current = ctxp->class_list;
+ current;
current = TREE_CHAIN (current))
reversed_class_list
= tree_cons (NULL_TREE, current, reversed_class_list);
- for (current = reversed_class_list;
- current;
+ for (current = reversed_class_list;
+ current;
current = TREE_CHAIN (current))
{
current_class = TREE_TYPE (TREE_VALUE (current));
EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left);
EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
}
-
+
wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0);
EXPR_WFL_LINECOL (wfl) = location;
chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE));
return decl;
/* 15.13.1: NAME can appear within a class declaration */
- else
+ else
{
decl = lookup_field_wrapper (current_class, name);
if (decl)
/* We've got an error here */
if (INNER_CLASS_TYPE_P (current_class))
- parse_error_context (id,
+ parse_error_context (id,
"Local variable `%s' can't be accessed from within the inner class `%s' unless it is declared final",
IDENTIFIER_POINTER (name),
IDENTIFIER_POINTER (DECL_NAME
(TYPE_NAME (current_class))));
else
- parse_error_context (id, "Undefined variable `%s'",
+ parse_error_context (id, "Undefined variable `%s'",
IDENTIFIER_POINTER (name));
return error_mark_node;
static_ref_err (wfl, field_id, class_type)
tree wfl, field_id, class_type;
{
- parse_error_context
- (wfl,
+ parse_error_context
+ (wfl,
"Can't make a static reference to nonstatic variable `%s' in class `%s'",
- IDENTIFIER_POINTER (field_id),
+ IDENTIFIER_POINTER (field_id),
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))));
}
return error_mark_node;
/* Resolve the LENGTH field of an array here */
- if (DECL_P (decl) && DECL_NAME (decl) == length_identifier_node
- && type_found && TYPE_ARRAY_P (type_found)
+ if (DECL_P (decl) && DECL_NAME (decl) == length_identifier_node
+ && type_found && TYPE_ARRAY_P (type_found)
&& ! flag_emit_class_files && ! flag_emit_xref)
{
tree length = build_java_array_length_access (where_found);
if (!type_found)
type_found = DECL_CONTEXT (decl);
is_static = FIELD_STATIC (decl);
- field_ref = build_field_ref ((is_static && !flag_emit_xref?
- NULL_TREE : where_found),
+ field_ref = build_field_ref ((is_static && !flag_emit_xref?
+ NULL_TREE : where_found),
type_found, DECL_NAME (decl));
if (field_ref == error_mark_node)
return error_mark_node;
if (field_decl)
*field_decl = decl;
if (field_type)
- *field_type = (QUAL_DECL_TYPE (decl) ?
+ *field_type = (QUAL_DECL_TYPE (decl) ?
QUAL_DECL_TYPE (decl) : TREE_TYPE (decl));
return field_ref;
}
int is_static;
tree decl = NULL_TREE, type = NULL_TREE, q;
/* For certain for of inner class instantiation */
- tree saved_current, saved_this;
+ tree saved_current, saved_this;
#define RESTORE_THIS_AND_CURRENT_CLASS \
{ current_class = saved_current; current_this = saved_this;}
build the code to access it. */
if (JDECL_P (decl) && !FIELD_STATIC (decl))
{
- decl = maybe_access_field (decl, *where_found,
+ decl = maybe_access_field (decl, *where_found,
DECL_CONTEXT (decl));
if (decl == error_mark_node)
return 1;
saved and restored shortly after */
saved_current = current_class;
saved_this = current_this;
- if (decl
+ if (decl
&& (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR
|| from_qualified_this))
{
if (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR
&& INNER_ENCLOSING_SCOPE_CHECK (type))
{
- parse_error_context
+ parse_error_context
(qual_wfl, "No enclosing instance for inner class `%s' is in scope%s",
lang_printable_name (type, 0),
(!current_this ? "" :
RESTORE_THIS_AND_CURRENT_CLASS;
/* EH check. No check on access$<n> functions */
- if (location
- && !OUTER_FIELD_ACCESS_IDENTIFIER_P
+ if (location
+ && !OUTER_FIELD_ACCESS_IDENTIFIER_P
(DECL_NAME (current_function_decl)))
check_thrown_exceptions (location, ret_decl);
{
if (!current_this)
{
- parse_error_context
+ parse_error_context
(wfl, "Keyword `this' used outside allowed context");
return 1;
}
if (!enclosing_context_p (type, current_class))
{
char *p = xstrdup (lang_printable_name (type, 0));
- parse_error_context (qual_wfl, "Can't use variable `%s.this': type `%s' isn't an outer type of type `%s'",
- p, p,
+ parse_error_context (qual_wfl, "Can't use variable `%s.this': type `%s' isn't an outer type of type `%s'",
+ p, p,
lang_printable_name (current_class, 0));
free (p);
return 1;
if (METHOD_STATIC (current_function_decl)
|| current_class == object_type_node)
{
- parse_error_context
+ parse_error_context
(wfl, "Keyword `super' used outside allowed context");
return 1;
}
/* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
- node = build_cast (EXPR_WFL_LINECOL (qual_wfl),
+ node = build_cast (EXPR_WFL_LINECOL (qual_wfl),
CLASSTYPE_SUPER (current_class),
build_this (EXPR_WFL_LINECOL (qual_wfl)));
*where_found = decl = java_complete_tree (node);
else
{
if (from_super || from_cast)
- parse_error_context
+ parse_error_context
((from_cast ? qual_wfl : wfl),
"No variable `%s' defined in class `%s'",
IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
/* Sneak preview. If next we see a `new', we're facing a
qualification with resulted in a type being selected
instead of a field. Report the error */
- if(TREE_CHAIN (q)
+ if(TREE_CHAIN (q)
&& TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR)
{
parse_error_context (qual_wfl, "Undefined variable `%s'",
if (not_accessible_p (TREE_TYPE (decl), decl, type, 0))
{
- parse_error_context
+ parse_error_context
(qual_wfl, "Can't access %s field `%s.%s' from `%s'",
java_accstring_lookup (get_access_flags_from_decl (decl)),
GET_TYPE_NAME (type),
from_type = 1;
}
/* We resolve an expression name */
- else
+ else
{
tree field_decl = NULL_TREE;
if (!from_type && !JREFERENCE_TYPE_P (type))
{
- parse_error_context
+ parse_error_context
(qual_wfl, "Attempt to reference field `%s' in `%s %s'",
IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
lang_printable_name (type, 0),
IDENTIFIER_POINTER (DECL_NAME (decl)));
return 1;
}
-
+
field_decl = lookup_field_wrapper (type,
EXPR_WFL_NODE (qual_wfl));
inner_decl = resolve_class (decl, ptr, NULL_TREE, qual_wfl);
if (inner_decl)
{
- check_inner_class_access (inner_decl, decl, qual_wfl);
+ check_inner_class_access (inner_decl, decl, qual_wfl);
type = TREE_TYPE (inner_decl);
decl = inner_decl;
from_type = 1;
if (field_decl == NULL_TREE)
{
- parse_error_context
+ parse_error_context
(qual_wfl, "No variable `%s' defined in type `%s'",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
+ IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
GET_TYPE_NAME (type));
return 1;
}
field_decl_type = TREE_TYPE (TREE_TYPE (field_decl));
else
field_decl_type = TREE_TYPE (field_decl);
- if (!JPRIMITIVE_TYPE_P (field_decl_type)
+ if (!JPRIMITIVE_TYPE_P (field_decl_type)
&& !CLASS_LOADED_P (field_decl_type)
&& !TYPE_ARRAY_P (field_decl_type))
resolve_and_layout (field_decl_type, NULL_TREE);
-
+
/* Check on accessibility here */
if (not_accessible_p (current_class, field_decl,
DECL_CONTEXT (field_decl), from_super))
{
- parse_error_context
+ parse_error_context
(qual_wfl,
"Can't access %s field `%s.%s' from `%s'",
- java_accstring_lookup
+ java_accstring_lookup
(get_access_flags_from_decl (field_decl)),
GET_TYPE_NAME (type),
IDENTIFIER_POINTER (DECL_NAME (field_decl)),
- IDENTIFIER_POINTER
+ IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (current_class))));
return 1;
}
check_deprecation (qual_wfl, field_decl);
-
+
/* There are things to check when fields are accessed
from type. There are no restrictions on a static
declaration of the field when it is accessed from an
interface */
is_static = FIELD_STATIC (field_decl);
- if (!from_super && from_type
- && !TYPE_INTERFACE_P (type)
- && !is_static
- && (current_function_decl
+ if (!from_super && from_type
+ && !TYPE_INTERFACE_P (type)
+ && !is_static
+ && (current_function_decl
&& METHOD_STATIC (current_function_decl)))
{
static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type);
/* Sneak preview. If decl is qualified by a `new', report
the error here to be accurate on the peculiar construct */
- if (TREE_CHAIN (q)
+ if (TREE_CHAIN (q)
&& TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR
&& !JREFERENCE_TYPE_P (type))
{
- parse_error_context (qual_wfl, "Attempt to reference field `new' in a `%s'",
+ parse_error_context (qual_wfl, "Attempt to reference field `new' in a `%s'",
lang_printable_name (type, 0));
return 1;
}
/* Access always granted for members declared public */
if (access_flag & ACC_PUBLIC)
return 0;
-
+
/* Check access on protected members */
if (access_flag & ACC_PROTECTED)
{
/* Complain if the field is deprecated and the file it was defined
in isn't compiled at the same time the file which contains its
use is */
- if (DECL_DEPRECATED (decl)
+ if (DECL_DEPRECATED (decl)
&& !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file)))
{
char the [20];
/* Don't issue a message if the context as been deprecated as a
whole. */
if (! CLASS_DEPRECATED (TYPE_NAME (DECL_CONTEXT (decl))))
- parse_warning_context
- (wfl, "The %s `%s' in class `%s' has been deprecated",
+ parse_warning_context
+ (wfl, "The %s `%s' in class `%s' has been deprecated",
the, lang_printable_name (decl, 0),
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)))));
}
{
if (TREE_CODE (decl) == FIELD_DECL && decl != current_this
&& !FIELD_STATIC (decl))
- decl = build_field_ref (where ? where : current_this,
+ decl = build_field_ref (where ? where : current_this,
(type ? type : DECL_CONTEXT (decl)),
DECL_NAME (decl));
return decl;
int is_super_init = 0;
tree this_arg = NULL_TREE;
int is_array_clone_call = 0;
-
+
/* Should be overriden if everything goes well. Otherwise, if
something fails, it should keep this value. It stop the
evaluation of a bogus assignment. See java_complete_tree,
data during error report. */
identifier_wfl = cut_identifier_in_qualified (wfl);
identifier = EXPR_WFL_NODE (identifier_wfl);
-
+
/* Given the context, IDENTIFIER is syntactically qualified
as a MethodName. We need to qualify what's before */
qualify_ambiguous_name (wfl);
resolved = resolve_field_access (wfl, NULL, NULL);
if (TREE_CODE (resolved) == VAR_DECL && FIELD_STATIC (resolved)
- && FIELD_FINAL (resolved)
+ && FIELD_FINAL (resolved)
&& !inherits_from_p (DECL_CONTEXT (resolved), current_class)
&& !flag_emit_class_files && !flag_emit_xref)
resolved = build_class_init (DECL_CONTEXT (resolved), resolved);
type = GET_SKIP_TYPE (resolved);
resolve_and_layout (type, NULL_TREE);
-
+
if (JPRIMITIVE_TYPE_P (type))
{
parse_error_context
(identifier_wfl,
"Can't invoke a method on primitive type `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
- PATCH_METHOD_RETURN_ERROR ();
+ PATCH_METHOD_RETURN_ERROR ();
}
list = lookup_method_invoke (0, identifier_wfl, type, identifier, args);
parse_error_context
(identifier_wfl,
"Can't make static reference to method `%s' in interface `%s'",
- IDENTIFIER_POINTER (identifier),
+ IDENTIFIER_POINTER (identifier),
IDENTIFIER_POINTER (name));
PATCH_METHOD_RETURN_ERROR ();
}
if (list && !METHOD_STATIC (list))
{
char *fct_name = xstrdup (lang_printable_name (list, 0));
- parse_error_context
+ parse_error_context
(identifier_wfl,
"Can't make static reference to method `%s %s' in class `%s'",
- lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
+ lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0),
fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
free (fct_name);
PATCH_METHOD_RETURN_ERROR ();
}
else
this_arg = primary = resolved;
-
+
if (TYPE_ARRAY_P (type) && identifier == get_identifier ("clone"))
is_array_clone_call = 1;
-
+
/* IDENTIFIER_WFL will be used to report any problem further */
wfl = identifier_wfl;
}
{
tree class_to_search = NULL_TREE;
int lc; /* Looking for Constructor */
-
+
/* We search constructor in their target class */
if (CALL_CONSTRUCTOR_P (patch))
{
if (TREE_CODE (patch) == NEW_CLASS_EXPR)
class_to_search = EXPR_WFL_NODE (wfl);
- else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
+ else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
this_identifier_node)
class_to_search = NULL_TREE;
else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
{
is_super_init = 1;
if (CLASSTYPE_SUPER (current_class))
- class_to_search =
+ class_to_search =
DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class)));
else
{
if (!class_to_search)
{
- parse_error_context
+ parse_error_context
(wfl, "Class `%s' not found in type declaration",
IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
PATCH_METHOD_RETURN_ERROR ();
}
-
+
/* Can't instantiate an abstract class, but we can
invoke it's constructor. It's use within the `new'
context is denied here. */
- if (CLASS_ABSTRACT (class_to_search)
+ if (CLASS_ABSTRACT (class_to_search)
&& TREE_CODE (patch) == NEW_CLASS_EXPR)
{
- parse_error_context
+ parse_error_context
(wfl, "Class `%s' is an abstract class. It can't be instantiated",
IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
PATCH_METHOD_RETURN_ERROR ();
can't be executed then. */
if (!list)
PATCH_METHOD_RETURN_ERROR ();
-
+
if (TYPE_ARRAY_P (class_to_search)
&& DECL_NAME (list) == get_identifier ("clone"))
is_array_clone_call = 1;
/* Check for static reference if non static methods */
- if (check_for_static_method_reference (wfl, patch, list,
+ if (check_for_static_method_reference (wfl, patch, list,
class_to_search, primary))
PATCH_METHOD_RETURN_ERROR ();
&& INNER_ENCLOSING_SCOPE_CHECK (class_to_search)
&& !DECL_INIT_P (current_function_decl))
{
- parse_error_context
+ parse_error_context
(wfl, "No enclosing instance for inner class `%s' is in scope%s",
lang_printable_name (class_to_search, 0),
(!current_this ? "" :
x(a1,...,an) into TYPE_OF(this$<n>).x(a1,....an)
2) We're generating bytecodes:
-
+
- LIST is non static. It's invocation is transformed from
x(a1,....,an) into access$<n>(this$<n>,a1,...,an).
- LIST is static. It's invocation is transformed from
x(a1,....,an) into TYPE_OF(this$<n>).x(a1,....an).
Of course, this$<n> can be abitrary complex, ranging from
- this$0 (the immediate outer context) to
- access$0(access$0(...(this$0))).
-
+ this$0 (the immediate outer context) to
+ access$0(access$0(...(this$0))).
+
maybe_use_access_method returns a non zero value if the
this_arg has to be moved into the (then generated) stub
argument list. In the meantime, the selected function
/* Merge point of all resolution schemes. If we have nothing, this
is an error, already signaled */
- if (!list)
+ if (!list)
PATCH_METHOD_RETURN_ERROR ();
/* Check accessibility, position the is_static flag, build and
return the call */
if (not_accessible_p (DECL_CONTEXT (current_function_decl), list,
- (primary ? TREE_TYPE (TREE_TYPE (primary)) :
+ (primary ? TREE_TYPE (TREE_TYPE (primary)) :
NULL_TREE), from_super)
/* Calls to clone() on array types are permitted as a special-case. */
&& !is_array_clone_call)
/* If invoking a innerclass constructor, there are hidden parameters
to pass */
- if (TREE_CODE (patch) == NEW_CLASS_EXPR
+ if (TREE_CODE (patch) == NEW_CLASS_EXPR
&& PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
{
/* And make sure we add the accessed local variables to be saved
/* This handles the situation where a constructor invocation needs
to have an enclosing context passed as a second parameter (the
constructor is one of an inner class). */
- if ((is_super_init ||
+ if ((is_super_init ||
(TREE_CODE (patch) == CALL_EXPR && name == this_identifier_node))
&& PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
{
tree dest = TYPE_NAME (DECL_CONTEXT (list));
- tree extra_arg =
+ tree extra_arg =
build_access_to_thisn (current_class, DECL_CONTEXT (dest), 0);
extra_arg = java_complete_tree (extra_arg);
args = tree_cons (NULL_TREE, extra_arg, args);
invoke any method relying on `this'. Exceptions are: we're
invoking a static function, primary exists and is not the current
this, we're creating a new object. */
- if (ctxp->explicit_constructor_p
- && !is_static_flag
+ if (ctxp->explicit_constructor_p
+ && !is_static_flag
&& (!primary || primary == current_this)
&& (TREE_CODE (patch) != NEW_CLASS_EXPR))
{
PATCH_METHOD_RETURN_ERROR ();
}
java_parser_context_restore_global ();
- if (is_static)
+ if (is_static)
*is_static = is_static_flag;
/* Sometimes, we want the decl of the selected method. Such as for
EH checking */
if (is_super_init && CLASS_HAS_FINIT_P (current_class))
{
tree finit_parms, finit_call;
-
+
/* Prepare to pass hidden parameters to finit$, if any. */
- finit_parms = build_alias_initializer_parameter_list
+ finit_parms = build_alias_initializer_parameter_list
(AIPL_FUNCTION_FINIT_INVOCATION, current_class, NULL_TREE, NULL);
-
- finit_call =
+
+ finit_call =
build_method_invocation (build_wfl_node (finit_identifier_node),
finit_parms);
check_for_static_method_reference (wfl, node, method, where, primary)
tree wfl, node, method, where, primary;
{
- if (METHOD_STATIC (current_function_decl)
+ if (METHOD_STATIC (current_function_decl)
&& !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
{
char *fct_name = xstrdup (lang_printable_name (method, 0));
- parse_error_context
- (wfl, "Can't make static reference to method `%s %s' in class `%s'",
+ parse_error_context
+ (wfl, "Can't make static reference to method `%s %s' in class `%s'",
lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where))));
free (fct_name);
int to_return = 0;
int non_static_context = !METHOD_STATIC (md);
- if (is_super_init
+ if (is_super_init
|| DECL_CONTEXT (md) == current_class
- || !PURE_INNER_CLASS_TYPE_P (current_class)
+ || !PURE_INNER_CLASS_TYPE_P (current_class)
|| DECL_FINIT_P (md)
|| DECL_INSTINIT_P (md))
return 0;
-
+
/* If we're calling a method found in an enclosing class, generate
what it takes to retrieve the right this. Don't do that if we're
invoking a static method. Note that if MD's type is unrelated to
ta = build_access_to_thisn (ctx, type, 0);
break;
}
- type = (DECL_CONTEXT (TYPE_NAME (type)) ?
+ type = (DECL_CONTEXT (TYPE_NAME (type)) ?
TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))) : NULL_TREE);
}
}
t = TYPE_ARG_TYPES (TREE_TYPE (method));
if (TREE_CODE (patch) == NEW_CLASS_EXPR)
t = TREE_CHAIN (t);
- for (ta = args; t != end_params_node && ta;
+ for (ta = args; t != end_params_node && ta;
t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
new = build (CALL_EXPR, promote_type (class),
build_address_of (alloc_node),
tree_cons (NULL_TREE, build_class_ref (class),
- build_tree_list (NULL_TREE,
+ build_tree_list (NULL_TREE,
size_in_bytes (class))),
NULL_TREE);
saved_new = save_expr (new);
char string [4096];
if (!cm || not_accessible_p (class, cm, NULL_TREE, 0))
continue;
- sprintf
+ sprintf
(string, " `%s' in `%s'%s",
get_printable_method_name (cm),
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))),
static int search_not_done = 0;
tree list = NULL_TREE, all_list = NULL_TREE;
- /* Check the hash table to determine if this class has been searched
+ /* Check the hash table to determine if this class has been searched
already. */
if (searched_classes)
{
searched_classes = htab_create (10, htab_hash_pointer,
htab_eq_pointer, NULL);
}
-
+
search_not_done++;
*htab_find_slot (searched_classes, class, INSERT) = class;
}
/* Search interfaces */
- if (TREE_CODE (TYPE_NAME (class)) == TYPE_DECL
+ if (TREE_CODE (TYPE_NAME (class)) == TYPE_DECL
&& CLASS_INTERFACE (TYPE_NAME (class)))
{
int i, n;
tree basetype_vec = TYPE_BINFO_BASETYPES (class);
- search_applicable_methods_list (lc, TYPE_METHODS (class),
+ search_applicable_methods_list (lc, TYPE_METHODS (class),
name, arglist, &list, &all_list);
n = TREE_VEC_LENGTH (basetype_vec);
for (i = 1; i < n; i++)
tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
tree rlist;
- rlist = find_applicable_accessible_methods_list (lc, t, name,
+ rlist = find_applicable_accessible_methods_list (lc, t, name,
arglist);
list = chainon (rlist, list);
}
/* Search classes */
else
{
- search_applicable_methods_list (lc, TYPE_METHODS (class),
+ search_applicable_methods_list (lc, TYPE_METHODS (class),
name, arglist, &list, &all_list);
/* When looking finit$, class$ or instinit$, we turn LC to 1 so
{
tree rlist;
class = CLASSTYPE_SUPER (class);
- rlist = find_applicable_accessible_methods_list (lc, class,
+ rlist = find_applicable_accessible_methods_list (lc, class,
name, arglist);
list = chainon (rlist, list);
}
&& TYPE_METHODS (object_type_node)
&& htab_find (searched_classes, object_type_node) == NULL)
{
- search_applicable_methods_list (lc,
+ search_applicable_methods_list (lc,
TYPE_METHODS (object_type_node),
name, arglist, &list, &all_list);
}
/* Effectively search for the appropriate method in method */
-static void
+static void
search_applicable_methods_list (lc, method, name, arglist, list, all_list)
int lc;
tree method, name, arglist;
other classes */
if (lc && !DECL_CONSTRUCTOR_P (method))
continue;
- else if (!lc && (DECL_CONSTRUCTOR_P (method)
+ else if (!lc && (DECL_CONSTRUCTOR_P (method)
|| (DECL_NAME (method) != name)))
continue;
if (argument_types_convertible (method, arglist))
{
/* Retain accessible methods only */
- if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
+ if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
method, NULL_TREE, 0))
*list = tree_cons (NULL_TREE, method, *list);
else
/* Compare arguments and location where methods where declared */
if (argument_types_convertible (method_v, current_v))
{
- if (valid_method_invocation_conversion_p
+ if (valid_method_invocation_conversion_p
(DECL_CONTEXT (method_v), DECL_CONTEXT (current_v))
|| (INNER_CLASS_TYPE_P (DECL_CONTEXT (current_v))
&& enclosing_context_p (DECL_CONTEXT (method_v),
DECL_CONTEXT (current_v))))
{
- int v = (DECL_SPECIFIC_COUNT (current_v) +=
+ int v = (DECL_SPECIFIC_COUNT (current_v) +=
(INNER_CLASS_TYPE_P (DECL_CONTEXT (current_v)) ? 2 : 1));
max = (v > max ? v : max);
}
else if (code == TREE_LIST)
name = EXPR_WFL_NODE (TREE_PURPOSE (qual_wfl));
- else if (code == STRING_CST || code == CONDITIONAL_EXPR
+ else if (code == STRING_CST || code == CONDITIONAL_EXPR
|| code == PLUS_EXPR)
{
qual = TREE_CHAIN (qual);
if (TREE_CODE (TREE_PURPOSE (qual)) == ARRAY_REF
&& TREE_CODE (TREE_OPERAND (TREE_PURPOSE (qual), 0)) ==
EXPR_WITH_FILE_LOCATION
- && EXPR_WFL_NODE (TREE_OPERAND (TREE_PURPOSE (qual), 0)) ==
+ && EXPR_WFL_NODE (TREE_OPERAND (TREE_PURPOSE (qual), 0)) ==
this_identifier_node)
{
qual = TREE_OPERAND (TREE_PURPOSE (qual), 0);
super_found = again = 1;
}
} while (again);
-
+
/* If name appears within the scope of a local variable declaration
or parameter declaration, then it is an expression name. We don't
carry this test out if we're in the context of the use of SUPER
or THIS */
- if (!this_found && !super_found
+ if (!this_found && !super_found
&& TREE_CODE (name) != STRING_CST && TREE_CODE (name) != INTEGER_CST
&& (decl = IDENTIFIER_LOCAL_VALUE (name)))
{
- NAME is declared in an another compilation unit of the package
of the compilation unit containing NAME,
- NAME is declared by exactly on type-import-on-demand declaration
- of the compilation unit containing NAME.
+ of the compilation unit containing NAME.
- NAME is actually a STRING_CST.
This can't happen if the expression was qualified by `this.' */
else if (! this_found &&
containing NAME. FIXME */
/* Otherwise, NAME is reclassified as a package name */
- else
+ else
RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
/* Propagate the qualification accross other components of the
{
if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1;
- else
+ else
RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1;
}
if (right)
*right = get_identifier (p+1);
*left = get_identifier (base);
-
+
return 0;
}
tree tmp;
tree pkg1;
tree pkg2;
-
+
if (TREE_CODE (name1) == TYPE_DECL)
name1 = DECL_NAME (name1);
if (TREE_CODE (name2) == TYPE_DECL)
breakdown_qualified (&pkg1, &tmp, name1);
breakdown_qualified (&pkg2, &tmp, name2);
-
+
return (pkg1 == pkg2);
}
int error_seen = 0;
if (TREE_CODE (stmt) == COMPOUND_EXPR)
{
- /* Re-order from (((A; B); C); ...; Z) to
+ /* Re-order from (((A; B); C); ...; Z) to
(A; (B; (C ; (...; Z)))).
This makes it easier to scan the statements left-to-right
without using recursion (which might overflow the stack
nn = ctxp->current_loop;
/* It must be assignable to the type of the switch expression. */
- if (!try_builtin_assignconv (NULL_TREE,
+ if (!try_builtin_assignconv (NULL_TREE,
TREE_TYPE (TREE_OPERAND (nn, 0)), cn))
{
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context
+ parse_error_context
(wfl_operator,
"Incompatible type for case. Can't convert `%s' to `int'",
lang_printable_name (TREE_TYPE (cn), 0));
if (SWITCH_HAS_DEFAULT (nn))
{
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator,
+ parse_error_context (wfl_operator,
"Duplicate case label: `default'");
return error_mark_node;
}
/* 3- Expression section */
case COMPOUND_EXPR:
wfl_op2 = TREE_OPERAND (node, 1);
- TREE_OPERAND (node, 0) = nn =
+ TREE_OPERAND (node, 0) = nn =
java_complete_tree (TREE_OPERAND (node, 0));
if (wfl_op2 == empty_stmt_node)
CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn);
}
else
TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node));
-
+
}
break;
for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
{
int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
- tree dim = convert (int_type_node,
+ tree dim = convert (int_type_node,
java_complete_tree (TREE_VALUE (cn)));
if (dim == error_mark_node)
{
TREE_VALUE (cn) = dim;
/* Setup the location of the current dimension, for
later error report. */
- TREE_PURPOSE (cn) =
+ TREE_PURPOSE (cn) =
build_expr_wfl (NULL_TREE, input_filename, 0, 0);
EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
}
check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl);
/* If we call this(...), register signature and positions */
if (in_this)
- DECL_CONSTRUCTOR_CALLS (current_function_decl) =
- tree_cons (wfl, decl,
+ DECL_CONSTRUCTOR_CALLS (current_function_decl) =
+ tree_cons (wfl, decl,
DECL_CONSTRUCTOR_CALLS (current_function_decl));
CAN_COMPLETE_NORMALLY (node) = 1;
return force_evaluation_order (node);
/* Save potential wfls */
wfl_op1 = TREE_OPERAND (node, 0);
TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1);
-
+
if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)
&& TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
&& DECL_INITIAL (nn) != NULL_TREE)
{
tree value;
-
+
value = fold_constant_for_init (nn, nn);
/* When we have a primitype type, or a string and we're not
emitting a class file, we actually don't want to generate
anything for the assignment. */
if (value != NULL_TREE &&
- (JPRIMITIVE_TYPE_P (TREE_TYPE (value)) ||
+ (JPRIMITIVE_TYPE_P (TREE_TYPE (value)) ||
(TREE_TYPE (value) == string_ptr_type_node &&
! flag_emit_class_files)))
{
{
/* This might break when accessing outer field from inner
class. TESTME, FIXME */
- tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
+ tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
/* Hand stabilize the lhs on both places */
TREE_OPERAND (node, 0) = lvalue;
- TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
+ TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
(flag_emit_class_files ? lvalue : save_expr (lvalue));
/* 15.25.2.a: Left hand is not an array access. FIXME */
if ((cn = patch_string (nn)))
nn = cn;
- /* The last part of the rewrite for E1 op= E2 is to have
+ /* The last part of the rewrite for E1 op= E2 is to have
E1 = (T)(E1 op E2), with T being the type of E1. */
- nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
+ nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
TREE_TYPE (lvalue), nn));
/* If the assignment is compound and has reference type,
if (node == error_mark_node)
return error_mark_node;
/* Reorganize the tree if necessary. */
- if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
+ if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
|| JSTRING_P (TREE_TYPE (node))))
node = java_refold (node);
}
undergone a conversion in patch_assignment. We do that only when
it's necessary to have DECL_INITIAL properly set. */
nn = TREE_OPERAND (node, 0);
- if (TREE_CODE (nn) == VAR_DECL
+ if (TREE_CODE (nn) == VAR_DECL
&& DECL_INITIAL (nn) && CONSTANT_VALUE_P (DECL_INITIAL (nn))
- && FIELD_STATIC (nn) && FIELD_FINAL (nn)
+ && FIELD_STATIC (nn) && FIELD_FINAL (nn)
&& (JPRIMITIVE_TYPE_P (TREE_TYPE (nn))
|| TREE_TYPE (nn) == string_ptr_type_node))
DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
case RDIV_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
- case EQ_EXPR:
+ case EQ_EXPR:
case NE_EXPR:
case GT_EXPR:
case GE_EXPR:
if (ctxp->explicit_constructor_p)
{
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context
+ parse_error_context
(wfl_operator, "Can't reference `this' or `super' before the superclass constructor has been called");
TREE_TYPE (node) = error_mark_node;
return error_mark_node;
}
return current_this;
-
+
case CLASS_LITERAL:
CAN_COMPLETE_NORMALLY (node) = 1;
node = patch_incomplete_class_ref (node);
for the first time for a given function. The current function body
(DECL_FUNCTION_BODY) is set to be block B. */
- tree fndecl = current_function_decl;
+ tree fndecl = current_function_decl;
if (!fndecl) {
BLOCK_SUPERCONTEXT (b) = current_static_block;
if (TREE_CODE (b) != BLOCK)
abort ();
- for (current = BLOCK_EXPR_DECLS (b); current;
+ for (current = BLOCK_EXPR_DECLS (b); current;
current = TREE_CHAIN (current))
if (DECL_NAME (current) == name)
return current;
int location;
{
tree wfl, node_to_insert = node;
-
+
/* We want to process THIS . xxx symbolicaly, to keep it consistent
with the way we're processing SUPER. A THIS from a primary as a
different form than a SUPER. Turn THIS into something symbolic */
int lloc, rloc;
{
tree invok;
- tree wfl =
+ tree wfl =
build_wfl_node (use_this ? this_identifier_node : super_identifier_node);
EXPR_WFL_LINECOL (wfl) = lloc;
invok = build_method_invocation (name, args);
static char buffer [80];
if (TREE_CONSTANT_OVERFLOW (node))
sprintf (buffer, "<overflow>");
-
+
if (TREE_INT_CST_HIGH (node) == 0)
sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED,
TREE_INT_CST_LOW (node));
{
lhs_type = TREE_TYPE (lvalue);
}
- else
+ else
{
parse_error_context (wfl_op1, "Invalid left hand side of assignment");
error_found = 1;
/* 10.10: Array Store Exception runtime check */
if (!flag_emit_class_files
&& !flag_emit_xref
- && lvalue_from_array
+ && lvalue_from_array
&& JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type)))
{
tree array, store_check, base, index_expr;
-
- /* Save RHS so that it doesn't get re-evaluated by the store check. */
+
+ /* Save RHS so that it doesn't get re-evaluated by the store check. */
new_rhs = save_expr (new_rhs);
/* Get the INDIRECT_REF. */
/* Get the array pointer expr. */
array = TREE_OPERAND (array, 0);
store_check = build_java_arraystore_check (array, new_rhs);
-
+
index_expr = TREE_OPERAND (lvalue, 1);
-
+
if (TREE_CODE (index_expr) == COMPOUND_EXPR)
{
- /* A COMPOUND_EXPR here is a bounds check. The bounds check must
+ /* A COMPOUND_EXPR here is a bounds check. The bounds check must
happen before the store check, so prepare to insert the store
check within the second operand of the existing COMPOUND_EXPR. */
base = index_expr;
}
else
base = lvalue;
-
+
index_expr = TREE_OPERAND (base, 1);
- TREE_OPERAND (base, 1) = build (COMPOUND_EXPR, TREE_TYPE (index_expr),
+ TREE_OPERAND (base, 1) = build (COMPOUND_EXPR, TREE_TYPE (index_expr),
store_check, index_expr);
}
/* Final locals can be used as case values in switch
statement. Prepare them for this eventuality. */
- if (TREE_CODE (lvalue) == VAR_DECL
+ if (TREE_CODE (lvalue) == VAR_DECL
&& DECL_FINAL (lvalue)
&& TREE_CONSTANT (new_rhs)
&& IDENTIFIER_LOCAL_VALUE (DECL_NAME (lvalue))
else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type))
new_rhs = convert (lhs_type, rhs);
- /* Try a narrowing primitive conversion (5.1.3):
+ /* Try a narrowing primitive conversion (5.1.3):
- expression is a constant expression of type int AND
- variable is byte, short or char AND
- - The value of the expression is representable in the type of the
+ - The value of the expression is representable in the type of the
variable */
else if (rhs_type == int_type_node && TREE_CONSTANT (rhs)
&& (lhs_type == byte_type_node || lhs_type == char_type_node
if (int_fits_type_p (rhs, lhs_type))
new_rhs = convert (lhs_type, rhs);
else if (wfl_op1) /* Might be called with a NULL */
- parse_warning_context
- (wfl_op1, "Constant expression `%s' too wide for narrowing primitive conversion to `%s'",
+ parse_warning_context
+ (wfl_op1, "Constant expression `%s' too wide for narrowing primitive conversion to `%s'",
print_int_node (rhs), lang_printable_name (lhs_type, 0));
/* Reported a warning that will turn into an error further
down, so we don't return */
/* From here, an integral is widened if its precision is smaller
than the precision of the LHS or if the LHS is a floating point
type, or the RHS is a float and the RHS a double. */
- if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type)
+ if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type)
&& (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)))
|| (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type))
|| (rhs_type == float_type_node && lhs_type == double_type_node))
if (TYPE_CLASS_P (source))
{
if (TYPE_CLASS_P (dest))
- return (source == dest
+ return (source == dest
|| inherits_from_p (source, dest)
|| (cast && inherits_from_p (dest, source)));
if (TYPE_INTERFACE_P (dest))
tree source_type;
tree source_sig;
tree source_name;
- for (method_source = TYPE_METHODS (source); method_source;
+ for (method_source = TYPE_METHODS (source); method_source;
method_source = TREE_CHAIN (method_source))
{
- source_sig =
+ source_sig =
build_java_argument_signature (TREE_TYPE (method_source));
source_type = TREE_TYPE (TREE_TYPE (method_source));
source_name = DECL_NAME (method_source);
for (method_dest = TYPE_METHODS (dest);
method_dest; method_dest = TREE_CHAIN (method_dest))
- if (source_sig ==
+ if (source_sig ==
build_java_argument_signature (TREE_TYPE (method_dest))
&& source_name == DECL_NAME (method_dest)
&& source_type != TREE_TYPE (TREE_TYPE (method_dest)))
{
tree source_element_type = TYPE_ARRAY_ELEMENT (source);
tree dest_element_type = TYPE_ARRAY_ELEMENT (dest);
-
+
/* In case of severe errors, they turn out null */
if (!dest_element_type || !source_element_type)
return 0;
sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
return buffer; \
}
-
+
static char buffer [10];
switch (TREE_CODE (node))
{
{
if (JDECL_P (var_acc1))
return (var_acc1 == var_acc2);
-
+
return (TREE_CODE (var_acc1) == COMPONENT_REF
&& TREE_CODE (var_acc2) == COMPONENT_REF
&& TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
/* Now the left branch of the binary operator. */
b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
- if (! (b && TREE_CODE (b) == NOP_EXPR
+ if (! (b && TREE_CODE (b) == NOP_EXPR
&& TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
return t;
error situation, unless it's too early to tell (in case we're
handling a `+', `==', `!=' or `instanceof'.) We want to set op<n>_type
correctly so the error can be later on reported accurately. */
- if (! (code == PLUS_EXPR || code == NE_EXPR
+ if (! (code == PLUS_EXPR || code == NE_EXPR
|| code == EQ_EXPR || code == INSTANCEOF_EXPR))
{
tree n;
parse_warning_context (wfl_operator, "Evaluating this expression will result in an arithmetic exception being thrown");
TREE_CONSTANT (node) = 0;
}
-
+
/* Change the division operator if necessary */
if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
TREE_SET_CODE (node, TRUNC_DIV_EXPR);
&& ! flag_emit_class_files
&& (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
-
+
/* This one is more complicated. FLOATs are processed by a
function call to soft_fmod. Duplicate the value of the
COMPOUND_ASSIGN_P flag. */
purpose of the a previous usage of the String concatenation
operator */
- if (TREE_CODE (op1) == STRING_CST
+ if (TREE_CODE (op1) == STRING_CST
|| TREE_CODE (op2) == STRING_CST
|| JSTRING_TYPE_P (op1_type)
|| JSTRING_TYPE_P (op2_type)
lang_printable_name (op2_type, 0));
else
parse_error_context (wfl_operator,
- "Incompatible type for `%s'. Can't convert shift distance from `%s' to integral",
+ "Incompatible type for `%s'. Can't convert shift distance from `%s' to integral",
operator_string (node),
lang_printable_name (op2_type, 0));
}
/* Shift int only up to 0x1f and long up to 0x3f */
if (prom_type == int_type_node)
- op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
+ op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
build_int_2 (0x1f, 0)));
else
- op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
+ op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
build_int_2 (0x3f, 0)));
/* The >>> operator is a >> operating on unsigned quantities */
TREE_TYPE (node) = boolean_type_node;
/* OP1_TYPE might be NULL when OP1 is a string constant. */
- if ((cn = patch_string (op1)))
+ if ((cn = patch_string (op1)))
{
op1 = cn;
op1_type = TREE_TYPE (op1);
{
char *t1 = xstrdup (lang_printable_name (op1_type, 0));
SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context
+ parse_error_context
(wfl_operator, "Impossible for `%s' to be instance of `%s'",
t1, lang_printable_name (op2_type, 0));
free (t1);
error_found = 1;
}
-
+
break;
/* 15.21 Bitwise and Logical Operators */
expression retain that type */
prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
- else if (TREE_CODE (op1_type) == BOOLEAN_TYPE
+ else if (TREE_CODE (op1_type) == BOOLEAN_TYPE
&& TREE_CODE (op1_type) == BOOLEAN_TYPE)
/* The type of the bitwise operator expression is BOOLEAN */
prom_type = boolean_type_node;
/* 15.23 Conditional-Or Operator */
case TRUTH_ORIF_EXPR:
/* Operands must be of BOOLEAN type */
- if (TREE_CODE (op1_type) != BOOLEAN_TYPE ||
+ if (TREE_CODE (op1_type) != BOOLEAN_TYPE ||
TREE_CODE (op2_type) != BOOLEAN_TYPE)
{
if (TREE_CODE (op1_type) != BOOLEAN_TYPE)
case EQ_EXPR:
case NE_EXPR:
/* It's time for us to patch the strings. */
- if ((cn = patch_string (op1)))
+ if ((cn = patch_string (op1)))
{
op1 = cn;
op1_type = TREE_TYPE (op1);
}
- if ((cn = patch_string (op2)))
+ if ((cn = patch_string (op2)))
{
op2 = cn;
op2_type = TREE_TYPE (op2);
}
-
+
/* 15.20.1 Numerical Equality Operators == and != */
/* Binary numeric promotion is performed on the operands */
if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))
binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
-
+
/* 15.20.2 Boolean Equality Operators == and != */
else if (TREE_CODE (op1_type) == BOOLEAN_TYPE &&
TREE_CODE (op2_type) == BOOLEAN_TYPE)
; /* Nothing to do here */
-
+
/* 15.20.3 Reference Equality Operators == and != */
/* Types have to be either references or the null type. If
they're references, it must be possible to convert either
type to the other by casting conversion. */
- else if (op1 == null_pointer_node || op2 == null_pointer_node
+ else if (op1 == null_pointer_node || op2 == null_pointer_node
|| (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type)
&& (valid_ref_assignconv_cast_p (op1_type, op2_type, 1)
- || valid_ref_assignconv_cast_p (op2_type,
+ || valid_ref_assignconv_cast_p (op2_type,
op1_type, 1))))
; /* Nothing to do here */
-
+
/* Else we have an error figure what can't be converted into
what and report the error */
else
{
char *t1;
t1 = xstrdup (lang_printable_name (op1_type, 0));
- parse_error_context
+ parse_error_context
(wfl_operator,
"Incompatible type for `%s'. Can't convert `%s' to `%s'",
- operator_string (node), t1,
+ operator_string (node), t1,
lang_printable_name (op2_type, 0));
free (t1);
TREE_TYPE (node) = boolean_type_node;
TREE_OPERAND (node, 1) = op2;
TREE_TYPE (node) = prom_type;
TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
-
+
if (flag_emit_xref)
return node;
{
/* Handle two string constants right away */
if (TREE_CODE (op2) == STRING_CST)
- return do_merge_string_cste (op1, TREE_STRING_POINTER (op2),
+ return do_merge_string_cste (op1, TREE_STRING_POINTER (op2),
TREE_STRING_LENGTH (op2), after);
-
+
/* Reasonable integer constant can be treated right away */
if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2))
{
static const char *const null_pointer = "null";
char ch[3];
const char *string;
-
+
if (op2 == boolean_true_node)
string = boolean_true;
else if (op2 == boolean_false_node)
{
tree string, rest;
int invert;
-
+
string = (TREE_CODE (op1) == STRING_CST ? op1 : op2);
rest = (string == op1 ? op2 : op1);
invert = (string == op1 ? 0 : 1 );
-
+
/* Walk REST, only if it looks reasonable */
if (TREE_CODE (rest) != STRING_CST
&& !IS_CRAFTED_STRING_BUFFER_P (rest)
if (flag_emit_xref)
return build (PLUS_EXPR, string_type_node, op1, op2);
-
+
/* Try to do some static optimization */
if ((result = string_constant_concatenation (op1, op2)))
return result;
initialize a new one */
if (!IS_CRAFTED_STRING_BUFFER_P (op1))
{
- /* Two solutions here:
+ /* Two solutions here:
1) OP1 is a constant string reference, we call new StringBuffer(OP1)
2) OP1 is something else, we call new StringBuffer().append(OP1). */
if (TREE_CONSTANT (op1) && JSTRING_TYPE_P (TREE_TYPE (op1)))
tree op1;
int is_post_p;
{
- static const enum tree_code lookup [2][2] =
+ static const enum tree_code lookup [2][2] =
{
{ PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
{ POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
};
- tree node = build (lookup [is_post_p][(op_token - DECR_TK)],
+ tree node = build (lookup [is_post_p][(op_token - DECR_TK)],
NULL_TREE, op1, NULL_TREE);
TREE_SIDE_EFFECTS (node) = 1;
/* Store the location of the operator, for better error report. The
string of the operator will be rebuild based on the OP value. */
EXPR_WFL_LINECOL (node) = op_location;
return node;
-}
+}
/* Build an incomplete cast operator, based on the use of the
CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
decl = DECL_FUNCTION_ACCESS_DECL (decl);
}
/* We really should have a JAVA_ARRAY_EXPR to avoid this */
- else if (!JDECL_P (decl)
+ else if (!JDECL_P (decl)
&& TREE_CODE (decl) != COMPONENT_REF
&& !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF)
&& TREE_CODE (decl) != INDIRECT_REF
TREE_TYPE (node) = error_mark_node;
error_found = 1;
}
-
+
/* From now on, we know that op if a variable and that it has a
valid wfl. We use wfl_op to locate errors related to the
++/-- operand. */
else
{
value = build_int_2 (1, 0);
- TREE_TYPE (node) =
- binary_numeric_promotion (op_type,
+ TREE_TYPE (node) =
+ binary_numeric_promotion (op_type,
TREE_TYPE (value), &op, &value);
}
if (outer_field_flag)
{
/* We re-generate an access to the field */
- value = build (PLUS_EXPR, TREE_TYPE (op),
+ value = build (PLUS_EXPR, TREE_TYPE (op),
build_outer_field_access (wfl_op, decl), value);
-
- /* And we patch the original access$() into a write
+
+ /* And we patch the original access$() into a write
with plus_op as a rhs */
return outer_field_access_fix (node, op, value);
}
}
break;
}
-
+
if (error_found)
return error_mark_node;
tree type_decl = resolve_and_layout (EXPR_WFL_NODE (type), type);
if (!type_decl)
{
- parse_error_context (type,
+ parse_error_context (type,
"Class `%s' not found in type declaration",
IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
return NULL_TREE;
/* The remaining legal casts involve conversion between reference
types. Check for their compile time correctness. */
- if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type)
+ if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type)
&& valid_ref_assignconv_cast_p (op_type, cast_type, 1))
{
TREE_TYPE (node) = promote_type (cast_type);
/* The array reference must be an array */
if (!TYPE_ARRAY_P (array_type))
{
- parse_error_context
+ parse_error_context
(wfl_operator,
"`[]' can only be applied to arrays. It can't be applied to `%s'",
lang_printable_name (array_type, 0));
int extra_dims;
{
tree node =
- build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims),
+ build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims),
build_int_2 (extra_dims, 0));
return node;
}
/* Report errors on types here */
if (dim_error)
{
- parse_error_context
- (TREE_PURPOSE (cdim),
- "Incompatible type for dimension in array creation expression. %s convert `%s' to `int'",
+ parse_error_context
+ (TREE_PURPOSE (cdim),
+ "Incompatible type for dimension in array creation expression. %s convert `%s' to `int'",
(valid_cast_to_p (TREE_TYPE (dim), int_type_node) ?
"Explicit cast needed to" : "Can't"),
lang_printable_name (TREE_TYPE (dim), 0));
(primitive or not) matters. */
if (ndims == 1)
return build_new_array (type, TREE_VALUE (dims));
-
+
/* Can't reuse what's already written in expr.c because it uses the
JVM stack representation. Provide a build_multianewarray. FIXME */
return build (CALL_EXPR, array_type,
build_address_of (soft_multianewarray_node),
tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)),
- tree_cons (NULL_TREE,
+ tree_cons (NULL_TREE,
build_int_2 (ndims, 0), dims )),
NULL_TREE);
}
TREE_PURPOSE (current) = NULL_TREE;
all_constant = 0;
}
- if (elt && TREE_CODE (elt) == TREE_LIST
+ if (elt && TREE_CODE (elt) == TREE_LIST
&& TREE_VALUE (elt) == error_mark_node)
error_seen = 1;
}
value = patched;
if (value == error_mark_node)
return 1;
-
+
type_value = TREE_TYPE (value);
-
+
/* At anytime, try_builtin_assignconv can report a warning on
constant overflow during narrowing. */
SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value);
"Can't" : "Explicit cast needed to");
if (!array_type_string)
array_type_string = xstrdup (lang_printable_name (type, 1));
- parse_error_context
+ parse_error_context
(wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
msg, lang_printable_name (type_value, 1), array_type_string);
error_seen = 1;
}
-
+
if (new_value)
TREE_VALUE (entry) = new_value;
isn't declared with the keyword `void' */
if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth)))
error_found = 2;
-
+
if (DECL_INSTINIT_P (current_function_decl))
error_found = 1;
if (DECL_INSTINIT_P (current_function_decl))
parse_error_context (wfl_operator,
"`return' inside instance initializer");
-
+
else if (DECL_CLINIT_P (current_function_decl))
parse_error_context (wfl_operator,
"`return' inside static initializer");
else if (!DECL_CONSTRUCTOR_P (meth))
{
char *t = xstrdup (lang_printable_name (mtype, 0));
- parse_error_context (wfl_operator,
+ parse_error_context (wfl_operator,
"`return' with%s value from `%s %s'",
- (error_found == 1 ? "" : "out"),
+ (error_found == 1 ? "" : "out"),
t, lang_printable_name (meth, 0));
free (t);
}
else
- parse_error_context (wfl_operator,
+ parse_error_context (wfl_operator,
"`return' with value from constructor `%s'",
lang_printable_name (meth, 0));
return error_mark_node;
if ((patched = patch_string (exp)))
exp = patched;
-
+
modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp);
EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node);
modify = java_complete_tree (modify);
if (TREE_TYPE (expression) != boolean_type_node
&& TREE_TYPE (expression) != promoted_boolean_type_node)
{
- parse_error_context
- (wfl_operator,
- "Incompatible type for `if'. Can't convert `%s' to `boolean'",
+ parse_error_context
+ (wfl_operator,
+ "Incompatible type for `if'. Can't convert `%s' to `boolean'",
lang_printable_name (TREE_TYPE (expression), 0));
return error_mark_node;
}
-
+
if (TREE_CODE (expression) == INTEGER_CST)
{
if (integer_zerop (expression))
parse_error_context (wfl_operator,
"Declaration of `%s' shadows a previous label declaration",
IDENTIFIER_POINTER (label));
- EXPR_WFL_LINECOL (wfl_operator) =
+ EXPR_WFL_LINECOL (wfl_operator) =
EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
parse_error_context (wfl_operator,
"This is the location of the previous declaration of label `%s'",
COMPOUND_EXPR (loop main body)
EXIT_EXPR (this order is for while/for loops.
LABELED_BLOCK_EXPR the order is reversed for do loops)
- LABEL_DECL (a continue occurring here branches at the
+ LABEL_DECL (a continue occurring here branches at the
BODY end of this labeled block)
INCREMENT (if any)
body = build_labeled_block (0, continue_identifier_node);
first = (reversed ? body : condition);
second = (reversed ? condition : body);
- return
- build (COMPOUND_EXPR, NULL_TREE,
+ return
+ build (COMPOUND_EXPR, NULL_TREE,
build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node);
}
if (name)
{
- if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE
+ if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE
(merge_qualified_name (label_id, EXPR_WFL_NODE (name)))))
/* Null means that we don't have a target for this named
break/continue. In this case, we make the target to be the
}
/* Unlabeled break/continue will be handled during the
break/continue patch operation */
- break_continue
+ break_continue
= build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE);
IS_BREAK_STMT_P (break_continue) = is_break;
tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt;
tree labeled_block = ctxp->current_labeled_block;
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-
+
/* Having an identifier here means that the target is unknown. */
if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE)
{
parse_error_context (wfl_operator,
"`continue' must be in loop");
else
- parse_error_context
+ parse_error_context
(wfl_operator, "continue label `%s' does not name a loop",
IDENTIFIER_POINTER (bc_label));
return error_mark_node;
}
}
else if (!bc_label)
- {
+ {
for (;; labeled_block = TREE_CHAIN (labeled_block))
{
if (labeled_block == NULL_TREE)
/* The type of expression must be boolean */
if (TREE_TYPE (expression) != boolean_type_node)
{
- parse_error_context
- (wfl_operator,
- "Incompatible type for loop conditional. Can't convert `%s' to `boolean'",
+ parse_error_context
+ (wfl_operator,
+ "Incompatible type for loop conditional. Can't convert `%s' to `boolean'",
lang_printable_name (TREE_TYPE (expression), 0));
return error_mark_node;
}
/* Now we know things are allright, invert the condition, fold and
return */
- TREE_OPERAND (node, 0) =
+ TREE_OPERAND (node, 0) =
fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression));
if (! integer_zerop (TREE_OPERAND (node, 0))
TREE_TYPE (node) = void_type_node;
TREE_SIDE_EFFECTS (node) = 1;
CAN_COMPLETE_NORMALLY (node)
- = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
+ = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
|| ! SWITCH_HAS_DEFAULT (node);
return node;
}
try_block = build_expr_block (try_stmts, NULL_TREE);
/* Build a catch block: we need a catch clause parameter */
- catch_clause_param = build_decl (VAR_DECL,
+ catch_clause_param = build_decl (VAR_DECL,
wpv_id, build_pointer_type (type));
/* And a block */
catch_block = build_expr_block (NULL_TREE, catch_clause_param);
-
+
/* Initialize the variable and store in the block */
catch = build (MODIFY_EXPR, NULL_TREE, catch_clause_param,
build (JAVA_EXC_OBJ_EXPR, ptr_type_node));
only parameter of the clause statement in of class Throwable
or a subclass of Throwable, but that was done earlier. The
catch clause parameter type has also been resolved. */
-
+
/* Just make sure that the catch clause parameter type inherits
from java.lang.Throwable */
if (!inherits_from_p (carg_type, throwable_type_node))
error_found = 1;
continue;
}
-
+
/* Partial check for unreachable catch statement: The catch
clause is reachable iff is no earlier catch block A in
the try statement such that the type of the catch
if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl))))
{
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
- parse_error_context
+ parse_error_context
(wfl_operator,
"`catch' not reached because of the catch clause at line %d",
EXPR_WFL_LINENO (sub_current));
POP_EXCEPTIONS ();
/* Verification ends here */
- if (error_found)
+ if (error_found)
return error_mark_node;
TREE_OPERAND (node, 0) = try;
that the handler that catches all throw exception calls
_Jv_MonitorExit and then rethrow the exception.
The synchronized statement is then implemented as:
- TRY
+ TRY
{
_Jv_MonitorEnter (expression)
synchronized_block
is explicitly declared in the `throws' clause of each
constructor. This doesn't apply to anonymous classes, since they
don't have declared constructors. */
- if (!unchecked_ok
+ if (!unchecked_ok
&& DECL_INSTINIT_P (current_function_decl)
&& !ANONYMOUS_CLASS_P (current_class))
{
tree current;
- for (current = TYPE_METHODS (current_class); current;
+ for (current = TYPE_METHODS (current_class); current;
current = TREE_CHAIN (current))
- if (DECL_CONSTRUCTOR_P (current)
+ if (DECL_CONSTRUCTOR_P (current)
&& !check_thrown_exceptions_do (TREE_TYPE (expr)))
{
- parse_error_context (wfl_operator, "Checked exception `%s' can't be thrown in instance initializer (not all declared constructor are declaring it in their `throws' clause)",
+ parse_error_context (wfl_operator, "Checked exception `%s' can't be thrown in instance initializer (not all declared constructor are declaring it in their `throws' clause)",
lang_printable_name (TREE_TYPE (expr), 0));
return error_mark_node;
}
/* We report that the exception can't be throw from a try block
in all circumstances but when the `throw' is inside a static
block. */
- else if (!EXCEPTIONS_P (currently_caught_type_list)
+ else if (!EXCEPTIONS_P (currently_caught_type_list)
&& !tryblock_throws_ok)
{
if (DECL_CLINIT_P (current_function_decl))
lang_printable_name (type, 0));
else
parse_error_context (wfl_operator,
- "Checked exception `%s' isn't thrown from a `try' block",
+ "Checked exception `%s' isn't thrown from a `try' block",
lang_printable_name (type, 0));
}
/* Otherwise, the current method doesn't have the appropriate
throws declaration */
else
- parse_error_context (wfl_operator, "Checked exception `%s' doesn't match any of current method's `throws' declaration(s)",
+ parse_error_context (wfl_operator, "Checked exception `%s' doesn't match any of current method's `throws' declaration(s)",
lang_printable_name (type, 0));
return error_mark_node;
}
{
tree throws;
/* For all the unchecked exceptions thrown by DECL */
- for (throws = DECL_FUNCTION_THROWS (decl); throws;
- throws = TREE_CHAIN (throws))
+ for (throws = DECL_FUNCTION_THROWS (decl); throws;
+ throws = TREE_CHAIN (throws))
if (!check_thrown_exceptions_do (TREE_VALUE (throws)))
{
#if 1
parse_error_context
(wfl_operator, "Exception `%s' can't be thrown in initializer",
lang_printable_name (TREE_VALUE (throws), 0));
- else
+ else
{
- parse_error_context
- (wfl_operator, "Exception `%s' must be caught, or it must be declared in the `throws' clause of `%s'",
+ parse_error_context
+ (wfl_operator, "Exception `%s' must be caught, or it must be declared in the `throws' clause of `%s'",
lang_printable_name (TREE_VALUE (throws), 0),
(DECL_INIT_P (current_function_decl) ?
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
/* Second and third can be numeric, boolean (i.e. primitive),
references or null. Anything else results in an error */
if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2))
- || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node)
+ || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node)
&& (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node))
|| (t1 == boolean_type_node && t2 == boolean_type_node)))
error_found = 1;
/* Otherwise, binary numeric promotion is applied and the
resulting type is the promoted type of operand 1 and 2 */
- else
- resulting_type = binary_numeric_promotion (t1, t2,
- &TREE_OPERAND (node, 1),
+ else
+ resulting_type = binary_numeric_promotion (t1, t2,
+ &TREE_OPERAND (node, 1),
&TREE_OPERAND (node, 2));
}
case BIT_IOR_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
- case EQ_EXPR:
+ case EQ_EXPR:
case NE_EXPR:
case GT_EXPR:
case GE_EXPR:
else if (! QUALIFIED_P (name))
{
decl = lookup_field_wrapper (DECL_CONTEXT (context), name);
- if (decl == NULL_TREE
+ if (decl == NULL_TREE
|| (! FIELD_STATIC (decl) && ! FIELD_FINAL (decl)))
return NULL_TREE;
return fold_constant_for_init (decl, decl);
{
tree block = (tree)ptr;
struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry;
-
+
TREE_CHAIN (ite->value) = BLOCK_EXPR_DECLS (block);
BLOCK_EXPR_DECLS (block) = ite->value;
return true;
if (current_function_decl == TREE_PURPOSE (l)
&& java_treetreehash_find (cf_ht, key) == NULL)
return true;
-
+
ite = java_treetreehash_new (cf_ht, key);
/* If we don't have a variable, create one and install it. */
if (*ite == NULL)
{
tree block;
-
+
decl = build_decl (VAR_DECL, NULL_TREE, boolean_type_node);
MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
LOCAL_CLASS_INITIALIZATION_FLAG (decl) = 1;