This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: handle field initializers
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 08 Mar 2005 18:44:22 -0700
- Subject: [gcjx] Patch: FYI: handle field initializers
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This implements tree generation for field initializers.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* tree.cc (visit_field_initializer): Wrote.
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.14
diff -u -r1.1.2.14 tree.cc
--- tree.cc 8 Mar 2005 23:02:05 -0000 1.1.2.14
+++ tree.cc 9 Mar 2005 01:45:43 -0000
@@ -1469,7 +1469,21 @@
return;
}
- abort (); // FIXME
+ // FIXME: perhaps ABI should lay out class.
+ gcc_builtins->lay_out_class (field->get_declaring_class ());
+ tree field_tree = gcc_builtins->map_field_ref (class_wrapper, this_tree,
+ field);
+ tree lhs;
+ if (field->static_p ())
+ lhs = field_tree;
+ else
+ lhs = build3 (COMPONENT_REF, TREE_TYPE (field_tree),
+ build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (this_tree)),
+ this_tree),
+ field_tree, NULL_TREE);
+
+ field->get_initializer ()->visit (this);
+ current = build2 (MODIFY_EXPR, TREE_TYPE (field_tree), lhs, current);
}
tree