parse.y (build_assertion): If we're in an inner class, create the class$ helper routi...
authorPer Bothner <per@bothner.com>
Thu, 26 Feb 2004 05:30:01 +0000 (21:30 -0800)
committerPer Bothner <bothner@gcc.gnu.org>
Thu, 26 Feb 2004 05:30:01 +0000 (21:30 -0800)
* parse.y (build_assertion):  If we're in an inner class, create the
class$ helper routine in the outer class.

From-SVN: r78489

gcc/java/ChangeLog
gcc/java/parse.y

index a0568c7084ba894c4195ff092daf1d04be26e1cd..a1a368508ce84bd44acfdb9cff0acce8b936c863 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-25  Per Bothner  <per@bothner.com>
+
+       * parse.y (build_assertion):  If we're in an inner class, create the
+       class$ helper routine in the outer class.
+
 2004-02-19  Richard Henderson  <rth@redhat.com>
 
        * parse.y (switch_label): Use make_node for DEFAULT_EXPR.
index 72cc9f3d103c37f9a4a7dfb969d13ac789d37b5f..8e419a55d776b192c69a90da5a854e64f7f1d3e1 100644 (file)
@@ -15301,6 +15301,10 @@ build_assertion (int location, tree condition, tree value)
     {
       tree field, classdollar, id, call;
       tree class_type = TREE_TYPE (klass);
+      tree outer_class = klass;
+      while (INNER_CLASS_DECL_P (outer_class))
+       outer_class = DECL_CONTEXT (outer_class);
+      outer_class = TREE_TYPE (outer_class);
 
       field = add_field (class_type,
                         get_identifier ("$assertionsDisabled"),
@@ -15309,9 +15313,10 @@ build_assertion (int location, tree condition, tree value)
       MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field);
       FIELD_SYNTHETIC (field) = 1;
 
-      if (!TYPE_DOT_CLASS (class_type))
-       build_dot_class_method (class_type);
-      classdollar = build_dot_class_method_invocation (class_type, class_type);
+      if (!TYPE_DOT_CLASS (outer_class))
+       build_dot_class_method (outer_class);
+      classdollar
+       = build_dot_class_method_invocation (outer_class, class_type);
 
       /* Call CLASS.desiredAssertionStatus().  */
       id = build_wfl_node (get_identifier ("desiredAssertionStatus"));