+2004-12-06 Tom Tromey <tromey@redhat.com>
+
+ PR java/14853:
+ * java-tree.h (extract_field_decl): Declare.
+ * parse.y (extract_field_decl): Renamed from
+ strip_out_static_field_access_decl. No longer static.
+ * check-init.c (get_variable_decl): Unwrap COMPOUND_EXPRs.
+
2004-12-03 Tom Tromey <tromey@redhat.com>
* lang.c (flag_new_verifier): Define.
static tree
get_variable_decl (tree exp)
{
+ /* A static field can be wrapped in a COMPOUND_EXPR where the first
+ argument initializes the class. */
+ if (TREE_CODE (exp) == COMPOUND_EXPR)
+ exp = extract_field_decl (exp);
+
if (TREE_CODE (exp) == VAR_DECL)
{
if (! TREE_STATIC (exp) || FIELD_FINAL (exp))
extern void java_genericize PARAMS ((tree));
extern int java_gimplify_expr PARAMS ((tree *, tree *, tree *));
+extern tree extract_field_decl (tree);
+
#endif /* ! GCC_JAVA_TREE_H */
static int array_constructor_check_entry (tree, tree);
static const char *purify_type_name (const char *);
static tree fold_constant_for_init (tree, tree);
-static tree strip_out_static_field_access_decl (tree);
static jdeplist *reverse_jdep_list (struct parser_ctxt *);
static void static_ref_err (tree, tree, tree);
static void parser_add_interface (tree, tree, tree);
return field_ref;
}
-/* If NODE is an access to f static field, strip out the class
+/* If NODE is an access to a static field, strip out the class
initialization part and return the field decl, otherwise, return
NODE. */
-static tree
-strip_out_static_field_access_decl (tree node)
+tree
+extract_field_decl (tree node)
{
if (TREE_CODE (node) == COMPOUND_EXPR)
{
case PREINCREMENT_EXPR:
/* 15.14.2 Prefix Decrement Operator -- */
case PREDECREMENT_EXPR:
- op = decl = strip_out_static_field_access_decl (op);
+ op = decl = extract_field_decl (op);
outer_field_flag = outer_field_expanded_access_p (op, NULL, NULL, NULL);
/* We might be trying to change an outer field accessed using
access method. */