@@ -25,28 +25,19 @@ const specialProtoPropertyKey = {
2525 name : '__proto__' ,
2626} ;
2727
28- const propertyKeysEqual = ( keyA , keyB ) => {
29- if ( keyA . type === 'Identifier' ) {
30- if ( keyB . type === 'Identifier' ) {
31- return keyA . name === keyB . name ;
32- }
33-
34- if ( keyB . type === 'Literal' ) {
35- return keyA . name === keyB . value ;
36- }
28+ const getPropertyKeyName = key => {
29+ if ( key . type === 'Identifier' || key . type === 'JSXIdentifier' ) {
30+ return key . name ;
3731 }
3832
39- if ( keyA . type === 'Literal' ) {
40- if ( keyB . type === 'Identifier' ) {
41- return keyA . value === keyB . name ;
42- }
43-
44- if ( keyB . type === 'Literal' ) {
45- return keyA . value === keyB . value ;
46- }
33+ if ( key . type === 'Literal' ) {
34+ return key . value ;
4735 }
36+ } ;
4837
49- return false ;
38+ const propertyKeysEqual = ( keyA , keyB ) => {
39+ const keyNameA = getPropertyKeyName ( keyA ) ;
40+ return keyNameA !== undefined && keyNameA === getPropertyKeyName ( keyB ) ;
5041} ;
5142
5243const objectPatternMatchesObjectExprPropertyKey = ( pattern , key ) =>
@@ -137,7 +128,10 @@ const create = context => {
137128 return ;
138129 }
139130
140- if ( parent . type === 'MemberExpression' ) {
131+ if (
132+ parent . type === 'MemberExpression'
133+ || parent . type === 'JSXMemberExpression'
134+ ) {
141135 if (
142136 isMemberExpressionAssignment ( parent )
143137 || isMemberExpressionCall ( parent )
0 commit comments