1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.default = getMembers;
|
5 |
|
6 | function getMembers(path) {
|
7 | const members = [];
|
8 | let nextPath = path;
|
9 |
|
10 | while (true) {
|
11 | if (nextPath.isMemberExpression() || nextPath.isJSXMemberExpression()) {
|
12 | members.push({
|
13 | path: nextPath.get('property'),
|
14 | computed: nextPath.node.computed
|
15 | });
|
16 | nextPath = path.get('object');
|
17 | } else if (nextPath.isCallExpression()) {
|
18 | nextPath = path.get('callee');
|
19 | }
|
20 |
|
21 | break;
|
22 | }
|
23 |
|
24 | members.push({
|
25 | path: nextPath,
|
26 | computed: false
|
27 | });
|
28 | return members.reverse();
|
29 | } |
\ | No newline at end of file |