diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/ast/expr_extensions.rs | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs index 8284f1b25..d2c19b98d 100644 --- a/crates/ra_syntax/src/ast/expr_extensions.rs +++ b/crates/ra_syntax/src/ast/expr_extensions.rs | |||
@@ -132,41 +132,42 @@ pub enum BinOp { | |||
132 | 132 | ||
133 | impl ast::BinExpr { | 133 | impl ast::BinExpr { |
134 | fn op_details(&self) -> Option<(SyntaxToken, BinOp)> { | 134 | fn op_details(&self) -> Option<(SyntaxToken, BinOp)> { |
135 | self.syntax().children_with_tokens().filter_map(|it| it.into_token()).find_map(|c| match c | 135 | self.syntax().children_with_tokens().filter_map(|it| it.into_token()).find_map(|c| { |
136 | .kind() | 136 | let bin_op = match c.kind() { |
137 | { | 137 | T![||] => BinOp::BooleanOr, |
138 | T![||] => Some((c, BinOp::BooleanOr)), | 138 | T![&&] => BinOp::BooleanAnd, |
139 | T![&&] => Some((c, BinOp::BooleanAnd)), | 139 | T![==] => BinOp::EqualityTest, |
140 | T![==] => Some((c, BinOp::EqualityTest)), | 140 | T![!=] => BinOp::NegatedEqualityTest, |
141 | T![!=] => Some((c, BinOp::NegatedEqualityTest)), | 141 | T![<=] => BinOp::LesserEqualTest, |
142 | T![<=] => Some((c, BinOp::LesserEqualTest)), | 142 | T![>=] => BinOp::GreaterEqualTest, |
143 | T![>=] => Some((c, BinOp::GreaterEqualTest)), | 143 | T![<] => BinOp::LesserTest, |
144 | T![<] => Some((c, BinOp::LesserTest)), | 144 | T![>] => BinOp::GreaterTest, |
145 | T![>] => Some((c, BinOp::GreaterTest)), | 145 | T![+] => BinOp::Addition, |
146 | T![+] => Some((c, BinOp::Addition)), | 146 | T![*] => BinOp::Multiplication, |
147 | T![*] => Some((c, BinOp::Multiplication)), | 147 | T![-] => BinOp::Subtraction, |
148 | T![-] => Some((c, BinOp::Subtraction)), | 148 | T![/] => BinOp::Division, |
149 | T![/] => Some((c, BinOp::Division)), | 149 | T![%] => BinOp::Remainder, |
150 | T![%] => Some((c, BinOp::Remainder)), | 150 | T![<<] => BinOp::LeftShift, |
151 | T![<<] => Some((c, BinOp::LeftShift)), | 151 | T![>>] => BinOp::RightShift, |
152 | T![>>] => Some((c, BinOp::RightShift)), | 152 | T![^] => BinOp::BitwiseXor, |
153 | T![^] => Some((c, BinOp::BitwiseXor)), | 153 | T![|] => BinOp::BitwiseOr, |
154 | T![|] => Some((c, BinOp::BitwiseOr)), | 154 | T![&] => BinOp::BitwiseAnd, |
155 | T![&] => Some((c, BinOp::BitwiseAnd)), | 155 | T![..] => BinOp::RangeRightOpen, |
156 | T![..] => Some((c, BinOp::RangeRightOpen)), | 156 | T![..=] => BinOp::RangeRightClosed, |
157 | T![..=] => Some((c, BinOp::RangeRightClosed)), | 157 | T![=] => BinOp::Assignment, |
158 | T![=] => Some((c, BinOp::Assignment)), | 158 | T![+=] => BinOp::AddAssign, |
159 | T![+=] => Some((c, BinOp::AddAssign)), | 159 | T![/=] => BinOp::DivAssign, |
160 | T![/=] => Some((c, BinOp::DivAssign)), | 160 | T![*=] => BinOp::MulAssign, |
161 | T![*=] => Some((c, BinOp::MulAssign)), | 161 | T![%=] => BinOp::RemAssign, |
162 | T![%=] => Some((c, BinOp::RemAssign)), | 162 | T![>>=] => BinOp::ShrAssign, |
163 | T![>>=] => Some((c, BinOp::ShrAssign)), | 163 | T![<<=] => BinOp::ShlAssign, |
164 | T![<<=] => Some((c, BinOp::ShlAssign)), | 164 | T![-=] => BinOp::SubAssign, |
165 | T![-=] => Some((c, BinOp::SubAssign)), | 165 | T![|=] => BinOp::BitOrAssign, |
166 | T![|=] => Some((c, BinOp::BitOrAssign)), | 166 | T![&=] => BinOp::BitAndAssign, |
167 | T![&=] => Some((c, BinOp::BitAndAssign)), | 167 | T![^=] => BinOp::BitXorAssign, |
168 | T![^=] => Some((c, BinOp::BitXorAssign)), | 168 | _ => return None, |
169 | _ => None, | 169 | }; |
170 | Some((c, bin_op)) | ||
170 | }) | 171 | }) |
171 | } | 172 | } |
172 | 173 | ||