Commit 063fb392 by Nathan Sidwell Committed by Nathan Sidwell

class.c (build_class_ref): Wrap the primary class type in a NOP_EXPR.

	* 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.

From-SVN: r102859
parent f303a996
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> 2005-07-28 Diego Novillo <dnovillo@redhat.com>
* expr.c (expand_load_internal): Fix missing parens in * expr.c (expand_load_internal): Fix missing parens in
......
...@@ -1011,6 +1011,11 @@ build_class_ref (tree type) ...@@ -1011,6 +1011,11 @@ build_class_ref (tree type)
abort (); abort ();
prim_class = lookup_class (get_identifier (prim_class_name)); 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, return build3 (COMPONENT_REF, NULL_TREE,
prim_class, TYPE_identifier_node, NULL_TREE); prim_class, TYPE_identifier_node, NULL_TREE);
} }
......
...@@ -12382,26 +12382,30 @@ java_complete_lhs (tree node) ...@@ -12382,26 +12382,30 @@ java_complete_lhs (tree node)
case COMPONENT_REF: case COMPONENT_REF:
/* The first step in the re-write of qualified name handling. FIXME. /* The first step in the re-write of qualified name handling. FIXME.
So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */ So far, this is only to support PRIMTYPE.class ->
TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); PRIMCLASS.TYPE. */
if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE) {
{ tree prim_class = TREE_OPERAND (node, 0);
tree name = TREE_OPERAND (node, 1); tree name = TREE_OPERAND (node, 1);
tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name); tree field;
if (field == NULL_TREE)
{ gcc_assert (TREE_CODE (prim_class) == NOP_EXPR);
error ("missing static field %qs", IDENTIFIER_POINTER (name)); prim_class = java_complete_tree (TREE_TYPE (prim_class));
return error_mark_node; gcc_assert (TREE_CODE (prim_class) == RECORD_TYPE);
} field = lookup_field_wrapper (prim_class, name);
if (! FIELD_STATIC (field))
{ if (field == NULL_TREE)
error ("not a static field %qs", IDENTIFIER_POINTER (name)); {
return error_mark_node; error ("missing static field %qs", IDENTIFIER_POINTER (name));
} return error_mark_node;
return field; }
} if (! FIELD_STATIC (field))
else {
abort (); error ("not a static field %qs", IDENTIFIER_POINTER (name));
return error_mark_node;
}
return field;
}
break; break;
case THIS_EXPR: case THIS_EXPR:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment