This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
java patch: fix multi-dimension array class literals
- To: gcc-patches at gcc dot gnu dot org
- Subject: java patch: fix multi-dimension array class literals
- From: Anthony Green <green at cygnus dot com>
- Date: Sun, 8 Oct 2000 19:09:16 -0700
- Reply-to: green at cygnus dot com
Non-array and single dimension array class literals have always worked
in gcj. That is, you could always refer to the Class object of
MyClass[] with MyClass[].class.
This patch fixes multi-dimension array class literal support, so now
we can safely refer to MyClass[][].class, etc. It also simplifies the
grammar somewhat.
I also have a simple test case I will submit to the libgcj patch list.
Ok to commit?
2000-10-08 Anthony Green <green@redhat.com>
* parse.y (array_type_literal): Remove production.
(type_literals): Refer to array_type, not array_type_literal.
Index: gcc/java/parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.214
diff -2 -c -u -p -r1.214 parse.y
--- parse.y 2000/10/05 07:17:34 1.214
+++ parse.y 2000/10/09 01:57:56
@@ -578,5 +578,5 @@ static tree currently_caught_type_list;
/* Added or modified JDK 1.1 rule types */
-%type <node> type_literals array_type_literal
+%type <node> type_literals
%%
@@ -1927,26 +1927,8 @@ primary_no_new_array:
;
-/* Added, JDK1.1 type literals. We can't use `type' directly, so we
- broke the rule down a bit. */
-
-array_type_literal:
- primitive_type OSB_TK CSB_TK
- {
- $$ = build_java_array_type ($1, -1);
- CLASS_LOADED_P ($$) = 1;
- }
-| name OSB_TK CSB_TK
- { $$ = build_unresolved_array_type ($1); }
-/* This triggers two reduce/reduce conflict between array_type_literal and
- dims. FIXME.
-| array_type OSB_TK CSB_TK
- { $$ = build_unresolved_array_type ($1); }
-*/
-;
-
type_literals:
name DOT_TK CLASS_TK
{ $$ = build_incomplete_class_ref ($2.location, $1); }
-| array_type_literal DOT_TK CLASS_TK
+| array_type DOT_TK CLASS_TK
{ $$ = build_incomplete_class_ref ($2.location, $1); }
| primitive_type DOT_TK CLASS_TK
@@ -10482,5 +10464,5 @@ search_applicable_methods_list (lc, meth
|| (GET_METHOD_NAME (method) != name)))
continue;
-
+
if (argument_types_convertible (method, arglist))
{
--
Anthony Green Red Hat
Sunnyvale, California