_Jv_LookupInterfaceMethod

Per Bothner per@bothner.com
Thu Dec 2 15:02:00 GMT 1999


Bryce McKinlay <bryce@albatross.co.nz> writes:
> Per Bothner wrote:
>> > Alex is right. (I am a bit rusty ...)
> > I meant `TREE_TYPE (method)' should give you the `IFACE'.
>> Cheers, that seems to work. Now, with the code:

Oops, no it doesn't. TREE_TYPE(method) give you the type of the
method itself (i.e. a method_type, which is not very interesting). We
want the type that *contains* the method. For that, use DECL_CONTEXT.
I.e. I believe `DECL_CONTEXT(method)' should give you the `IFACE'.
If I'm currect, debug_tree(iface) should show that it is a RECORD_TYPE node.
Btw: TYPE_METHOD_BASETYPE(TREE_TYPE(method)) should give you the
same value as TREE_TYPE (method). The reason your debug printout
for meth prints the record_type Interface is because TYPE_METHOD_BASETYPE
and TYPE_METHODS (by coincidence) have the same implementation;
however TYPE_METHOD_BASETYPE is only applicable to a METHOD_TYPE,
while TYPE_METHODS is applicable to RECORD_TYPE (i.e. classes and
interfaces).
Sorry about that.
-- 
	--Per Bothner
per@bothner.com http://www.bothner.com/~per/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /