[英]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? 我是Eclipse AST的新手,我想知道在遍历树期间是否可以获取变量的类型? I read somewhere that it is possible to get it by setting the setResolveBindings. 我读过某个地方,可以通过设置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. 具体来说,我想在处理SimpleName访问时获取变量的类型。
resolveTypeBinding()
from the Expression
class - a superclass of SimpleName
and NumberLiteral
- will return an ITypeBinding
. resolveTypeBinding()
从Expression
类-的超SimpleName
和NumberLiteral
-将返回ITypeBinding
。 A method such as getName()
will get you the type. 诸如getName()
之类的方法将为您提供类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.