Commit ee5f86dc by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

[multiple changes]

2000-10-31  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* parse.y (outer_field_access_p): Inherited fields aren't
	consider outer fields.
	(maybe_build_thisn_access_method): Use
	PURE_INNER_CLASS_TYPE_P instead of INNER_CLASS_TYPE_P.
	(resolve_expression_name): Trigger an error if a static field
	is being accessed as an outer field.

2000-10-24  Alexandre Petit-Bianco  <apbianco@cygnus.com>

       * parse.h (INNER_ENCLOSING_SCOPE_CHECK): Check inherited type in
       scope.

(http://gcc.gnu.org/ml/gcc-patches/2000-11/msg01217.html)

From-SVN: r37645
parent a125d855
...@@ -127,6 +127,15 @@ ...@@ -127,6 +127,15 @@
Include flags.h. Include flags.h.
* jv-scan.c (pedantic): New global. * jv-scan.c (pedantic): New global.
2000-10-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (outer_field_access_p): Inherited fields aren't
consider outer fields.
(maybe_build_thisn_access_method): Use
PURE_INNER_CLASS_TYPE_P instead of INNER_CLASS_TYPE_P.
(resolve_expression_name): Trigger an error if a static field
is being accessed as an outer field.
2000-10-29 Alexandre Petit-Bianco <apbianco@cygnus.com> 2000-10-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
* Make-lang.in (LIBGCJ_ZIP_FILE): Define with `$(prefix)'. * Make-lang.in (LIBGCJ_ZIP_FILE): Define with `$(prefix)'.
...@@ -152,6 +161,11 @@ ...@@ -152,6 +161,11 @@
current class. Fixed comment. current class. Fixed comment.
Fixes gcj/361. Fixes gcj/361.
2000-10-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.h (INNER_ENCLOSING_SCOPE_CHECK): Check inherited type in
scope.
2000-10-24 Tom Tromey <tromey@cygnus.com> 2000-10-24 Tom Tromey <tromey@cygnus.com>
* lex.c (java_new_lexer): Initialize new fields. Work around * lex.c (java_new_lexer): Initialize new fields. Work around
......
...@@ -860,7 +860,12 @@ struct parser_ctxt { ...@@ -860,7 +860,12 @@ struct parser_ctxt {
&& !inherits_from_p (TREE_TYPE (TREE_TYPE (current_this)), \ && !inherits_from_p (TREE_TYPE (TREE_TYPE (current_this)), \
TREE_TYPE (DECL_CONTEXT (TYPE_NAME (T)))) \ TREE_TYPE (DECL_CONTEXT (TYPE_NAME (T)))) \
&& !common_enclosing_context_p (TREE_TYPE (TREE_TYPE (current_this)), \ && !common_enclosing_context_p (TREE_TYPE (TREE_TYPE (current_this)), \
(T))) \ (T)) \
&& INNER_CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (current_this))) \
&& !inherits_from_p \
(TREE_TYPE (DECL_CONTEXT \
(TYPE_NAME (TREE_TYPE (TREE_TYPE (current_this))))),\
TREE_TYPE (DECL_CONTEXT (TYPE_NAME (T))))) \
/* We don't have a this. */ \ /* We don't have a this. */ \
|| !current_this)) || !current_this))
......
...@@ -7887,6 +7887,11 @@ outer_field_access_p (type, decl) ...@@ -7887,6 +7887,11 @@ outer_field_access_p (type, decl)
|| TREE_CODE (decl) != FIELD_DECL || TREE_CODE (decl) != FIELD_DECL
|| DECL_CONTEXT (decl) == type) || DECL_CONTEXT (decl) == type)
return 0; 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)))
return 0;
for (type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))); ; for (type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))); ;
type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type)))) type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))))
...@@ -8238,7 +8243,7 @@ maybe_build_thisn_access_method (type) ...@@ -8238,7 +8243,7 @@ maybe_build_thisn_access_method (type)
/* If TYPE is a top-level class, no access method is required. /* If TYPE is a top-level class, no access method is required.
If there already is such an access method, bail out. */ If there already is such an access method, bail out. */
if (CLASS_ACCESS0_GENERATED_P (type) || !INNER_CLASS_TYPE_P (type)) if (CLASS_ACCESS0_GENERATED_P (type) || !PURE_INNER_CLASS_TYPE_P (type))
return NULL_TREE; return NULL_TREE;
/* We generate the method. The method looks like: /* We generate the method. The method looks like:
...@@ -8866,7 +8871,14 @@ resolve_expression_name (id, orig) ...@@ -8866,7 +8871,14 @@ resolve_expression_name (id, orig)
to access a field belonging to an outer class, build to access a field belonging to an outer class, build
the access to the field */ the access to the field */
if (!fs && outer_field_access_p (current_class, decl)) if (!fs && outer_field_access_p (current_class, decl))
return build_outer_field_access (id, decl); {
if (CLASS_STATIC (TYPE_NAME (current_class)))
{
static_ref_err (id, DECL_NAME (decl), current_class);
return error_mark_node;
}
return build_outer_field_access (id, decl);
}
/* Otherwise build what it takes to access the field */ /* Otherwise build what it takes to access the field */
access = build_field_ref ((fs ? NULL_TREE : current_this), access = build_field_ref ((fs ? NULL_TREE : current_this),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment