mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Fix issues caused during rebase
This commit is contained in:
parent
2608a6fd3a
commit
f78df42f81
1 changed files with 63 additions and 45 deletions
|
@ -318,16 +318,20 @@ impl ExprCollector<'_> {
|
||||||
ast::Expr::BlockExpr(e) => self.collect_block(e),
|
ast::Expr::BlockExpr(e) => self.collect_block(e),
|
||||||
ast::Expr::LoopExpr(e) => {
|
ast::Expr::LoopExpr(e) => {
|
||||||
let body = self.collect_block_opt(e.loop_body());
|
let body = self.collect_block_opt(e.loop_body());
|
||||||
track_parent!(self, self.alloc_expr(Expr::Loop { body }, syntax_ptr), vec![body])
|
track_parent!(
|
||||||
Expr::Loop {
|
self,
|
||||||
body,
|
self.alloc_expr(
|
||||||
label: e
|
Expr::Loop {
|
||||||
.label()
|
body,
|
||||||
.and_then(|l| l.lifetime_token())
|
label: e
|
||||||
.map(|l| Name::new_lifetime(&l)),
|
.label()
|
||||||
},
|
.and_then(|l| l.lifetime_token())
|
||||||
syntax_ptr,
|
.map(|l| Name::new_lifetime(&l)),
|
||||||
), body)
|
},
|
||||||
|
syntax_ptr,
|
||||||
|
),
|
||||||
|
body
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ast::Expr::WhileExpr(e) => {
|
ast::Expr::WhileExpr(e) => {
|
||||||
let body = self.collect_block_opt(e.loop_body());
|
let body = self.collect_block_opt(e.loop_body());
|
||||||
|
@ -350,48 +354,62 @@ impl ExprCollector<'_> {
|
||||||
];
|
];
|
||||||
let match_expr =
|
let match_expr =
|
||||||
self.alloc_expr_desugared(Expr::Match { expr: match_expr, arms });
|
self.alloc_expr_desugared(Expr::Match { expr: match_expr, arms });
|
||||||
return track_parent!(self, self.alloc_expr(
|
return track_parent!(
|
||||||
Expr::Loop {
|
self,
|
||||||
body: match_expr,
|
self.alloc_expr(
|
||||||
label: e
|
Expr::Loop {
|
||||||
.label()
|
body: match_expr,
|
||||||
.and_then(|l| l.lifetime_token())
|
label: e
|
||||||
.map(|l| Name::new_lifetime(&l)),
|
.label()
|
||||||
},
|
.and_then(|l| l.lifetime_token())
|
||||||
syntax_ptr,
|
.map(|l| Name::new_lifetime(&l)),
|
||||||
), match_expr);
|
},
|
||||||
|
syntax_ptr,
|
||||||
|
),
|
||||||
|
match_expr
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
track_parent!(self, self.alloc_expr(
|
track_parent!(
|
||||||
Expr::While {
|
self,
|
||||||
condition,
|
self.alloc_expr(
|
||||||
body,
|
Expr::While {
|
||||||
label: e
|
condition,
|
||||||
.label()
|
body,
|
||||||
.and_then(|l| l.lifetime_token())
|
label: e
|
||||||
.map(|l| Name::new_lifetime(&l)),
|
.label()
|
||||||
},
|
.and_then(|l| l.lifetime_token())
|
||||||
syntax_ptr,
|
.map(|l| Name::new_lifetime(&l)),
|
||||||
), body, condition)
|
},
|
||||||
|
syntax_ptr,
|
||||||
|
),
|
||||||
|
body,
|
||||||
|
condition
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ast::Expr::ForExpr(e) => {
|
ast::Expr::ForExpr(e) => {
|
||||||
let iterable = self.collect_expr_opt(e.iterable());
|
let iterable = self.collect_expr_opt(e.iterable());
|
||||||
let pat = self.collect_pat_opt(e.pat());
|
let pat = self.collect_pat_opt(e.pat());
|
||||||
let body = self.collect_block_opt(e.loop_body());
|
let body = self.collect_block_opt(e.loop_body());
|
||||||
track_parent!(self, self.alloc_expr(
|
track_parent!(
|
||||||
Expr::For {
|
self,
|
||||||
iterable,
|
self.alloc_expr(
|
||||||
pat,
|
Expr::For {
|
||||||
body,
|
iterable,
|
||||||
label: e
|
pat,
|
||||||
.label()
|
body,
|
||||||
.and_then(|l| l.lifetime_token())
|
label: e
|
||||||
.map(|l| Name::new_lifetime(&l)),
|
.label()
|
||||||
},
|
.and_then(|l| l.lifetime_token())
|
||||||
syntax_ptr,
|
.map(|l| Name::new_lifetime(&l)),
|
||||||
), iterable, body)
|
},
|
||||||
|
syntax_ptr,
|
||||||
|
),
|
||||||
|
iterable,
|
||||||
|
body
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ast::Expr::CallExpr(e) => {
|
ast::Expr::CallExpr(e) => {
|
||||||
let callee = self.collect_expr_opt(e.expr());
|
let callee = self.collect_expr_opt(e.expr());
|
||||||
|
@ -461,10 +479,10 @@ impl ExprCollector<'_> {
|
||||||
.unwrap_or(Expr::Missing);
|
.unwrap_or(Expr::Missing);
|
||||||
self.alloc_expr(path, syntax_ptr)
|
self.alloc_expr(path, syntax_ptr)
|
||||||
}
|
}
|
||||||
ast::Expr::ContinueExpr(e) => (self.alloc_expr(
|
ast::Expr::ContinueExpr(e) => self.alloc_expr(
|
||||||
Expr::Continue { label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) },
|
Expr::Continue { label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) },
|
||||||
syntax_ptr,
|
syntax_ptr,
|
||||||
), vec![]),
|
),
|
||||||
ast::Expr::BreakExpr(e) => {
|
ast::Expr::BreakExpr(e) => {
|
||||||
let expr = e.expr().map(|e| self.collect_expr(e));
|
let expr = e.expr().map(|e| self.collect_expr(e));
|
||||||
track_parent!(self, self.alloc_expr(
|
track_parent!(self, self.alloc_expr(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue