CtUnaryOperator extends CtStatement

吃可爱长大的小学妹 提交于 2019-12-25 16:41:53

问题


I can't understand why.

In the expression if (a++ > 0) {...} a++ can't be a Statement but since a++ is a CtUnaryOperator then it's also a CtStatement.

How can I differentiate between a++; and i = a++; since in both cases a++ will be a CtStatement?


回答1:


to differentiate between both, one looks at the parent. One class encapsulates this logic:

// does element act as a statement?
boolean hasStatementRole = new LineFilter().matches(element)



回答2:


Since the issues in this questions comes from design decisions in the Spoon tool, it can't be answered properly.



来源:https://stackoverflow.com/questions/41732525/ctunaryoperator-extends-ctstatement

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!