简体   繁体   中英

Variable types in Eclipse AST

I am new to Eclipse AST and I was wondering is it possible to get the type of the variable during the traversal of the tree? I read somewhere that it is possible to get it by setting the setResolveBindings. However, I don't know what needs to be done in visit methods. To be concrete, I would like to get the type of the variable when processing the SimpleName visit.

resolveTypeBinding() from the Expression class - a superclass of SimpleName and NumberLiteral - will return an ITypeBinding . A method such as getName() will get you the type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM