File tree Expand file tree Collapse file tree 2 files changed +11
-14
lines changed Expand file tree Collapse file tree 2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -33,3 +33,11 @@ export function chained() {
33
33
export function templateLiteral ( ) {
34
34
return `foo bar` . split ( ' ' ) ;
35
35
}
36
+
37
+ export default function withThis ( ) {
38
+ return this . foo ( ) ;
39
+ }
40
+
41
+ export default function withNestedMemberExpressions ( ) {
42
+ return this . blub . blob . foo ( ) ;
43
+ }
Original file line number Diff line number Diff line change @@ -27,16 +27,6 @@ const validPossibleStatelessComponentTypes = [
27
27
'ArrowFunctionExpression' ,
28
28
] ;
29
29
30
- function isValidCalleeType ( type ) {
31
- return [
32
- 'Identifier' ,
33
- 'CallExpression' ,
34
- 'ArrayExpression' ,
35
- 'TemplateLiteral' ,
36
- 'Literal'
37
- ] . indexOf ( type ) < 0 ;
38
- }
39
-
40
30
function isJSXElementOrReactCreateElement ( path ) {
41
31
return (
42
32
path . node . type === 'JSXElement' ||
@@ -100,12 +90,11 @@ function returnsJSXElementOrReactCreateElementCall(path) {
100
90
if ( calleeValue . node . type === 'MemberExpression' ) {
101
91
if ( calleeValue . get ( 'object' ) . node . type === 'Identifier' ) {
102
92
resolvedValue = resolveToValue ( calleeValue . get ( 'object' ) ) ;
103
- }
104
- else {
105
- while ( isValidCalleeType ( calleeValue . get ( 'object' ) . node . type ) ) {
93
+ } else if ( types . MemberExpression . check ( calleeValue . node ) ) {
94
+ do {
106
95
calleeValue = calleeValue . get ( 'object' ) ;
107
96
namesToResolve . unshift ( calleeValue . get ( 'property' ) ) ;
108
- }
97
+ } while ( types . MemberExpression . check ( calleeValue . node ) ) ;
109
98
110
99
resolvedValue = resolveToValue ( calleeValue . get ( 'object' ) ) ;
111
100
}
You can’t perform that action at this time.
0 commit comments