+2005-08-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (build_class_ref): Wrap the primary class type in a
+ NOP_EXPR.
+ * parse.y (java_complete_lhs) <COMPONENT_REF case>: Extract the
+ primary class type from the NOP_EXPR in which it was placed.
+
2005-07-28 Diego Novillo <dnovillo@redhat.com>
* expr.c (expand_load_internal): Fix missing parens in
abort ();
prim_class = lookup_class (get_identifier (prim_class_name));
+ /* We wrap the class in a NOP_EXPR, because it is a
+ type. We can't hold it in the COMPONENT_REF itself,
+ as that type must remain NULL. */
+ prim_class = build1 (NOP_EXPR, prim_class, NULL_TREE);
+
return build3 (COMPONENT_REF, NULL_TREE,
prim_class, TYPE_identifier_node, NULL_TREE);
}
case COMPONENT_REF:
/* The first step in the re-write of qualified name handling. FIXME.
- So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
- TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
- if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE)
- {
- tree name = TREE_OPERAND (node, 1);
- tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name);
- if (field == NULL_TREE)
- {
- error ("missing static field %qs", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- if (! FIELD_STATIC (field))
- {
- error ("not a static field %qs", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- return field;
- }
- else
- abort ();
+ So far, this is only to support PRIMTYPE.class ->
+ PRIMCLASS.TYPE. */
+ {
+ tree prim_class = TREE_OPERAND (node, 0);
+ tree name = TREE_OPERAND (node, 1);
+ tree field;
+
+ gcc_assert (TREE_CODE (prim_class) == NOP_EXPR);
+ prim_class = java_complete_tree (TREE_TYPE (prim_class));
+ gcc_assert (TREE_CODE (prim_class) == RECORD_TYPE);
+ field = lookup_field_wrapper (prim_class, name);
+
+ if (field == NULL_TREE)
+ {
+ error ("missing static field %qs", IDENTIFIER_POINTER (name));
+ return error_mark_node;
+ }
+ if (! FIELD_STATIC (field))
+ {
+ error ("not a static field %qs", IDENTIFIER_POINTER (name));
+ return error_mark_node;
+ }
+ return field;
+ }
break;
case THIS_EXPR: