This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Java: minor fixes patch.


I'm checking in this patch which fixes a annonymous class constructor
problem Tom discovered recently.

./A

2000-07-27  Tom Tromey  <tromey@cygnus.com>

	* parse.y (patch_method_invocation): Don't reverse the argument
	list when dealing with anonymous class constructors. Fixed typo in
	comment.

2000-07-27  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* parse.y (build_alias_initializer_parameter_list): Reverse
	crafted list when building aliases for anonymous class
	constructors.

Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.196
diff -u -p -r1.196 parse.y
--- parse.y     2000/07/22 04:36:13     1.196
+++ parse.y     2000/07/27 10:01:09
@@ -5022,6 +5006,8 @@ build_alias_initializer_parameter_list (
     int *artificial;
 {
   tree field;
+  tree additional_parms = NULL_TREE;
+
   for (field = TYPE_FIELDS (class_type); field; field = TREE_CHAIN (field))
     if (FIELD_LOCAL_ALIAS (field))
       {
@@ -5072,10 +5058,18 @@ build_alias_initializer_parameter_list (
              }
            break;
          }
-       parm = tree_cons (purpose, value, parm);
+       additional_parms = tree_cons (purpose, value, additional_parms);
        if (artificial)
          *artificial +=1;
       }
+  if (additional_parms)
+    {
+      if (ANONYMOUS_CLASS_P (class_type) 
+         && mode == AIPL_FUNCTION_CTOR_INVOCATION)
+       additional_parms = nreverse (additional_parms);
+      parm = chainon (additional_parms, parm);
+    }
+
   return parm;
 }
 
@@ -9753,11 +9747,7 @@ patch_method_invocation (patch, primary,
       args = build_alias_initializer_parameter_list
        (AIPL_FUNCTION_CTOR_INVOCATION, DECL_CONTEXT (list), args, NULL);
 
-      /* We have to reverse things. Find out why. FIXME */
-      if (ANONYMOUS_CLASS_P (DECL_CONTEXT (list)))
-       args = nreverse (args);
-      
-      /* Secretely pass the current_this/primary as a second argument */
+      /* Secretly pass the current_this/primary as a second argument */
       if (primary || current_this)
        args = tree_cons (NULL_TREE, (primary ? primary : current_this), args);
       else

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]