Resolve who owns the call object. So if the expression is i_ate.pie(). And i_ate is a Person, the callee is Person. This is returned as a string and eventually set to the owner_token in the call :param ast callee: :rtype: str
(callee)
| 44 | |
| 45 | |
| 46 | def resolve_owner(callee): |
| 47 | """ |
| 48 | Resolve who owns the call object. |
| 49 | So if the expression is i_ate.pie(). And i_ate is a Person, the callee is Person. |
| 50 | This is returned as a string and eventually set to the owner_token in the call |
| 51 | |
| 52 | :param ast callee: |
| 53 | :rtype: str |
| 54 | """ |
| 55 | |
| 56 | if callee['object']['type'] == 'ThisExpression': |
| 57 | return 'this' |
| 58 | if callee['object']['type'] == 'Identifier': |
| 59 | return callee['object']['name'] |
| 60 | if callee['object']['type'] == 'MemberExpression': |
| 61 | if 'object' in callee['object'] and 'name' in callee['object']['property']: |
| 62 | return djoin((resolve_owner(callee['object']) or ''), |
| 63 | callee['object']['property']['name']) |
| 64 | return OWNER_CONST.UNKNOWN_VAR |
| 65 | if callee['object']['type'] == 'CallExpression': |
| 66 | return OWNER_CONST.UNKNOWN_VAR |
| 67 | |
| 68 | if callee['object']['type'] == 'NewExpression': |
| 69 | if 'name' in callee['object']['callee']: |
| 70 | return callee['object']['callee']['name'] |
| 71 | return djoin(callee['object']['callee']['object']['name'], |
| 72 | callee['object']['callee']['property']['name']) |
| 73 | |
| 74 | return OWNER_CONST.UNKNOWN_VAR |
| 75 | |
| 76 | |
| 77 | def get_call_from_func_element(func): |
no test coverage detected