Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Finding references using PDOM and then finding the AST elements that contain the reference..

Um, sure. You can resolve the binding for the IASTName using the IPDOMResolver interface, or if you know it is a PDOMName, simply invoke it’s resolveBinding method. That will give you the binding. From there, you can navigate the IBinding hierarchy like you would with the DOM. And when doing that, please use the IBinding interfaces if at all possible since the PDOM classes are and will remain internal and are subject to change. If there are interfaces missing for PDOM specific info, we’ll add new interfaces for that in 4.0.

 

Cheers,

Doug Schaefer

QNX Software Systems

Eclipse CDT Project Lead

http://cdtdoug.blogspot.com

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Neeraj U Bhope
Sent: Wednesday, September 06, 2006 12:15 AM
To: CDT General developers list.
Subject: RE: [cdt-dev] Finding references using PDOM and then finding the AST elements that contain the reference..

 


Oks..maybe not exactly the AST per se...I saw in the code that when we add IASTNames to the PDOM we add stuff like PDOMCPPField, PDOMCPPBase etc...if there is a way of getting to these from the PDOMName that is returned as the reference it would be good enough for me so that I save on recreating the AST and walking over it.
--
neeraj


cdt-dev-bounces@xxxxxxxxxxx wrote on 09/06/2006 01:51:04 AM:

> The PDOM does not store the AST. It only contains IASTNames and
> IBindings and ITypes. You would need to recreate the AST for the
> file and walk it to find the right name given the file location
> stored in the PDOMName.

>  
> Doug Schaefer
> QNX Software Systems
> Eclipse CDT Project Lead
> http://cdtdoug.blogspot.com
>  
>
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of Neeraj U Bhope
> Sent: Tuesday, September 05, 2006 4:21 PM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] Finding references using PDOM and then finding
> the AST elements that contain the reference..

>  
>
> Given a PDOMBinding one can use PDOMBinding.getFirstReference() to
> get the references. The reference returned is of the type PDOMName.
> Is there a way to find what place in the AST this PDOMName lies in?
> e.g.
> class A {};
> class B {
>   A myA;
> };
>
> Can I find out where in the AST the reference to A lies in the class
> B which in this case is in a field declaration in the enclosing
> class B.. I tried using PDOMName.getParent() PDOMName.
> getPropertyInParent() to see if I could get what I wanted, but it
> turned out that they are currently not implemented.
> Thanks,
> --
> neeraj_______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top