@@ -104,6 +104,9 @@ impl<'a, 'b> SimpleArgument<'a, 'b> {
104104 self . is_simple_call_like ( & expr. callee , & expr. arguments , depth)
105105 }
106106 Expression :: ImportExpression ( expr) => depth < 2 && expr. options . is_none ( ) ,
107+ Expression :: ChainExpression ( chain) => {
108+ self . is_simple_chain_element ( & chain. expression , depth)
109+ }
107110 _ => false ,
108111 } ,
109112 Self :: Assignment ( SimpleAssignmentTarget :: AssignmentTargetIdentifier ( _) ) => true ,
@@ -152,6 +155,28 @@ impl<'a, 'b> SimpleArgument<'a, 'b> {
152155 && arguments. len ( ) + usize:: from ( depth) <= 2
153156 && arguments. iter ( ) . all ( |argument| Self :: new ( argument) . is_simple_impl ( depth + 1 ) )
154157 }
158+
159+ #[ inline]
160+ fn is_simple_chain_element ( & self , element : & ' b ChainElement < ' a > , depth : u8 ) -> bool {
161+ match element {
162+ ChainElement :: CallExpression ( call) => {
163+ self . is_simple_call_like ( & call. callee , & call. arguments , depth)
164+ }
165+ ChainElement :: TSNonNullExpression ( assertion) => {
166+ Self :: from ( & assertion. expression ) . is_simple_impl ( depth)
167+ }
168+ ChainElement :: StaticMemberExpression ( static_expression) => {
169+ Self :: from ( & static_expression. object ) . is_simple_impl ( depth)
170+ }
171+ ChainElement :: ComputedMemberExpression ( computed_expression) => {
172+ Self :: from ( & computed_expression. expression ) . is_simple_impl ( depth)
173+ && Self :: from ( & computed_expression. object ) . is_simple_impl ( depth)
174+ }
175+ ChainElement :: PrivateFieldExpression ( private_field) => {
176+ Self :: from ( & private_field. object ) . is_simple_impl ( depth)
177+ }
178+ }
179+ }
155180}
156181
157182impl < ' a , ' b > From < & ' b Expression < ' a > > for SimpleArgument < ' a , ' b > {
0 commit comments