ObjCPropertyRefExpr 0x7fc2f9a80ac0 '<pseudo-object type>' lvalue objcproperty Kind=PropertyRef Property="text" Messaging=Getter
`-OpaqueValueExpr 0x7fc2f9a80aa0 'UITextField *'
`-PseudoObjectExpr 0x7fc2f9a61d30 'UITextField *'
|-ObjCPropertyRefExpr 0x7fc2f9a61cb8 '<pseudo-object type>' lvalue objcproperty Kind=PropertyRef Property="txtFirstname" Messaging=Getter
| `-OpaqueValueExpr 0x7fc2f9a61c98 'EditInfoViewController *'
| `-ImplicitCastExpr 0x7fc2f9a61c50 'EditInfoViewController *' <LValueToRValue>
| `-DeclRefExpr 0x7fc2f9a61c28 'EditInfoViewController *const __strong' lvalue ImplicitParam 0x7fc2f9a61828 'self' 'EditInfoViewController *const __strong'
|-OpaqueValueExpr 0x7fc2f9a61c98 'EditInfoViewController *'
| `-ImplicitCastExpr 0x7fc2f9a61c50 'EditInfoViewController *' <LValueToRValue>
| `-DeclRefExpr 0x7fc2f9a61c28 'EditInfoViewController *const __strong' lvalue ImplicitParam 0x7fc2f9a61828 'self' 'EditInfoViewController *const __strong'
`-ImplicitCastExpr 0x7fc2f9a61d18 'UITextField *' <ARCReclaimReturnedObject>
`-ObjCMessageExpr 0x7fc2f9a61ce8 'UITextField *' selector=txtFirstname
`-OpaqueValueExpr 0x7fc2f9a61c98 'EditInfoViewController *'
`-ImplicitCastExpr 0x7fc2f9a61c50 'EditInfoViewController *' <LValueToRValue>
`-DeclRefExpr 0x7fc2f9a61c28 'EditInfoViewController *const __strong' lvalue ImplicitParam 0x7fc2f9a61828 'self' 'EditInfoViewController *const __strong'
鉴于上面的AST,是否有可能获得元素&#39; UITextField&#39;从ObjCPropertyRefExpr出来?
现在我疯狂地尝试了所有的getter方法,但到目前为止还没有好运。任何建议都会受到赞赏
答案 0 :(得分:0)
ObjectiveCPropertyRefExpr->getReceiverType(*ASTContext).getAsString()
可以正常使用
虽然这会返回'UITextField *'
,但需要使用简单的分隔/ substr来检索'UITextField'