From 09bb35141dba0180fed9ecc1d20cc6c78c220172 Mon Sep 17 00:00:00 2001 From: apbianco Date: Thu, 1 Jun 2000 07:44:58 +0000 Subject: 2000-04-24 Alexandre Petit-Bianco * class.c (common_enclosing_context_p): New function. * java-tree.h (common_enclosing_context_p): Added prototype. * parse.h (INNER_ENCLOSING_SCOPE_CHECK): Relaxed test to allow classes sharing an outer context with the current instance. * parse.y (build_access_to_thisn): Fixed leading comment. (verify_constructor_super): New local `supper_inner'. Skip enclosing context argument in the case of inner class constructors. (patch_method_invocation): Insert proper context as second parameter to pure inner class constructor super invocations. This fixes the Java PR #177. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34332 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/java/class.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'gcc/java/class.c') diff --git a/gcc/java/class.c b/gcc/java/class.c index 21232e7f2d2..dcc544846d1 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -486,6 +486,30 @@ enclosing_context_p (type1, type2) return 0; } +/* Return 1 iff there exists a common enclosing context between TYPE1 + and TYPE2. */ + +int common_enclosing_context_p (type1, type2) + tree type1, type2; +{ + if (!PURE_INNER_CLASS_TYPE_P (type1) && !PURE_INNER_CLASS_TYPE_P (type2)) + return 0; + + for (type1 = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type1))); type1; + type1 = (PURE_INNER_CLASS_TYPE_P (type1) ? + TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type1))) : NULL_TREE)) + { + tree current; + for (current = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type2))); current; + current = (PURE_INNER_CLASS_TYPE_P (current) ? + TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current))) : + NULL_TREE)) + if (type1 == current) + return 1; + } + return 0; +} + static void add_interface_do (basetype_vec, interface_class, i) tree basetype_vec, interface_class; -- cgit v1.2.3