1

我是 Eclipse AST 的新手,我想知道在树的遍历过程中是否可以获取变量的类型?我在某处读到可以通过设置 setResolveBindings 来获取它。但是,我不知道在访问方法中需要做什么。具体来说,我想在处理 SimpleName 访问时获取变量的类型。

4

1 回答 1

1

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.

于 2012-10-05T15:18:36.457 回答