Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to Get The Scope of a Node

Hi thanks for the reply. I want to be able to find all references to a
particular variable from within its scope, not including its actual
definition, is there a fairly straightforward way of doing that?


For IASTName nodes: name.resolveBinding().getScope().
There's also CPPVisitor.getContainingScope().
I'm not entirely sure what the difference is (because these methods aren't
documented). I think the first one returns the scope that the name
represents like if its a class name, and the second one returns the scope
that contains the particular use of the name. Someone please correct me.

For AST nodes that represent lexical scopes, like IASTFunctionDefinition
and IASTCompoundStatement just use getScope() on the node.


Mike Kucera
Software Developer
IBM CDT Team, Toronto
mkucera@xxxxxxxxxx


                                                                       
             student08                                                 
             <pingu219@gmail.c                                         
             om>                                                        To
             Sent by:                  cdt-dev@xxxxxxxxxxx             
             cdt-dev-bounces@e                                          cc
             clipse.org                                                
                                                                   Subject
                                       [cdt-dev] How to Get The Scope of a
             05/15/2008 03:52          Node                            
             PM                                                        
                                                                       
                                                                       
             Please respond to                                         
               "CDT General                                            
             developers list."                                         
             <cdt-dev@eclipse.                                         
                   org>                                                
                                                                       
                                                                       





Hi does anyone know how to get the scope for a particular node?
--
View this message in context:
http://www.nabble.com/How-to-Get-The-Scope-of-a-Node-tp17261038p17261038.html

Sent from the Eclipse CDT - Development mailing list archive at Nabble.com.

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

 
 
 
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



-- 
View this message in context: http://www.nabble.com/How-to-Get-The-Scope-of-a-Node-tp17261038p17263576.html
Sent from the Eclipse CDT - Development mailing list archive at Nabble.com.



Back to the top