diff options
Diffstat (limited to 'crates/parser/src/grammar/expressions/atom.rs')
-rw-r--r-- | crates/parser/src/grammar/expressions/atom.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs index 0b01d3bc6..ba6dd2fbc 100644 --- a/crates/parser/src/grammar/expressions/atom.rs +++ b/crates/parser/src/grammar/expressions/atom.rs | |||
@@ -75,9 +75,9 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
75 | T!['('] => tuple_expr(p), | 75 | T!['('] => tuple_expr(p), |
76 | T!['['] => array_expr(p), | 76 | T!['['] => array_expr(p), |
77 | L_DOLLAR => meta_var_expr(p), | 77 | L_DOLLAR => meta_var_expr(p), |
78 | T![|] => lambda_expr(p), | 78 | T![|] => closure_expr(p), |
79 | T![move] if la == T![|] => lambda_expr(p), | 79 | T![move] if la == T![|] => closure_expr(p), |
80 | T![async] if la == T![|] || (la == T![move] && p.nth(2) == T![|]) => lambda_expr(p), | 80 | T![async] if la == T![|] || (la == T![move] && p.nth(2) == T![|]) => closure_expr(p), |
81 | T![if] => if_expr(p), | 81 | T![if] => if_expr(p), |
82 | 82 | ||
83 | T![loop] => loop_expr(p, None), | 83 | T![loop] => loop_expr(p, None), |
@@ -228,7 +228,7 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { | |||
228 | // move || {}; | 228 | // move || {}; |
229 | // async move || {}; | 229 | // async move || {}; |
230 | // } | 230 | // } |
231 | fn lambda_expr(p: &mut Parser) -> CompletedMarker { | 231 | fn closure_expr(p: &mut Parser) -> CompletedMarker { |
232 | assert!( | 232 | assert!( |
233 | p.at(T![|]) | 233 | p.at(T![|]) |
234 | || (p.at(T![move]) && p.nth(1) == T![|]) | 234 | || (p.at(T![move]) && p.nth(1) == T![|]) |
@@ -239,7 +239,7 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker { | |||
239 | p.eat(T![async]); | 239 | p.eat(T![async]); |
240 | p.eat(T![move]); | 240 | p.eat(T![move]); |
241 | params::param_list_closure(p); | 241 | params::param_list_closure(p); |
242 | if opt_fn_ret_type(p) { | 242 | if opt_ret_type(p) { |
243 | // test lambda_ret_block | 243 | // test lambda_ret_block |
244 | // fn main() { || -> i32 { 92 }(); } | 244 | // fn main() { || -> i32 { 92 }(); } |
245 | block_expr(p); | 245 | block_expr(p); |
@@ -265,7 +265,7 @@ fn if_expr(p: &mut Parser) -> CompletedMarker { | |||
265 | assert!(p.at(T![if])); | 265 | assert!(p.at(T![if])); |
266 | let m = p.start(); | 266 | let m = p.start(); |
267 | p.bump(T![if]); | 267 | p.bump(T![if]); |
268 | cond(p); | 268 | condition(p); |
269 | block_expr(p); | 269 | block_expr(p); |
270 | if p.at(T![else]) { | 270 | if p.at(T![else]) { |
271 | p.bump(T![else]); | 271 | p.bump(T![else]); |
@@ -314,7 +314,7 @@ fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
314 | assert!(p.at(T![while])); | 314 | assert!(p.at(T![while])); |
315 | let m = m.unwrap_or_else(|| p.start()); | 315 | let m = m.unwrap_or_else(|| p.start()); |
316 | p.bump(T![while]); | 316 | p.bump(T![while]); |
317 | cond(p); | 317 | condition(p); |
318 | block_expr(p); | 318 | block_expr(p); |
319 | m.complete(p, WHILE_EXPR) | 319 | m.complete(p, WHILE_EXPR) |
320 | } | 320 | } |
@@ -342,7 +342,7 @@ fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
342 | // while let Some(_) | Some(_) = None {} | 342 | // while let Some(_) | Some(_) = None {} |
343 | // while let | Some(_) = None {} | 343 | // while let | Some(_) = None {} |
344 | // } | 344 | // } |
345 | fn cond(p: &mut Parser) { | 345 | fn condition(p: &mut Parser) { |
346 | let m = p.start(); | 346 | let m = p.start(); |
347 | if p.eat(T![let]) { | 347 | if p.eat(T![let]) { |
348 | patterns::pattern_top(p); | 348 | patterns::pattern_top(p); |
@@ -386,7 +386,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) { | |||
386 | // _ => (), | 386 | // _ => (), |
387 | // } | 387 | // } |
388 | // } | 388 | // } |
389 | attributes::inner_attributes(p); | 389 | attributes::inner_attrs(p); |
390 | 390 | ||
391 | while !p.at(EOF) && !p.at(T!['}']) { | 391 | while !p.at(EOF) && !p.at(T!['}']) { |
392 | if p.at(T!['{']) { | 392 | if p.at(T!['{']) { |
@@ -437,7 +437,7 @@ fn match_arm(p: &mut Parser) -> BlockLike { | |||
437 | // _ => (), | 437 | // _ => (), |
438 | // } | 438 | // } |
439 | // } | 439 | // } |
440 | attributes::outer_attributes(p); | 440 | attributes::outer_attrs(p); |
441 | 441 | ||
442 | patterns::pattern_top_r(p, TokenSet::EMPTY); | 442 | patterns::pattern_top_r(p, TokenSet::EMPTY); |
443 | if p.at(T![if]) { | 443 | if p.at(T![if]) { |