[gcjx] Generalise visitor
Tom Tromey
tromey@redhat.com
Fri Oct 7 00:47:00 GMT 2005
>>>>> "Ranjit" == Ranjit Mathew <rmathew@gmail.com> writes:
Ranjit> The new methods are not exhaustive, but it's a start - technically,
Ranjit> I could have just added visit() to model_element and a visit_element()
Ranjit> to visitor and be done with it. However, I've attempted to declare
Ranjit> a few more. The implementations of the methods are dummies for now.
Ideally model_element::visit would be abstract. Presumably there are
still other elements that aren't handled?
Ranjit> If this is not too gross, may I apply it?
Yes.
Ranjit> There's another patch to fix "gcc/java" for the new changes.
Please put it in too.
Ranjit> + virtual void visit (visitor *);
I usually don't reiterate the 'virtual'.
Ranjit> + void visit_forwarding_type (model_forwarding_type *,
Ranjit> + const model_type *)
Ranjit> + {
Ranjit> + // Nothing.
Ranjit> + }
We should have mixins that implement different subsets of the
visitors, either as do-nothings or abort()s (or either -- write the
mixin as a template). It seems to me that often a given visitor
really only wants to deal with some subset of the model.
In fact I considered doing this already, since fold already only wants
to visit expressions, not statements.
Tom
More information about the Java-patches
mailing list