|
1 | 1 | use crate::ast::{ |
2 | 2 | Arm, ArmX, Arms, AssocTypeImpl, AssocTypeImplX, BinaryOpr, CallTarget, CallTargetKind, |
3 | | - Datatype, DatatypeX, Expr, ExprX, Exprs, Field, Function, FunctionKind, FunctionX, |
4 | | - GenericBound, GenericBoundX, LoopInvariant, LoopInvariants, MaskSpec, NullaryOpr, Param, |
5 | | - ParamX, Params, Pattern, PatternBinding, PatternX, Place, PlaceX, SpannedTyped, Stmt, StmtX, |
6 | | - Trait, TraitImpl, TraitImplX, TraitX, Typ, TypDecorationArg, TypX, Typs, UnaryOpr, UnwindSpec, |
7 | | - VarBinder, VarBinderX, VarBinders, VarIdent, Variant, VirErr, |
| 3 | + CtorUpdateTail, Datatype, DatatypeX, Expr, ExprX, Exprs, Field, Function, FunctionKind, |
| 4 | + FunctionX, GenericBound, GenericBoundX, LoopInvariant, LoopInvariants, MaskSpec, NullaryOpr, |
| 5 | + Param, ParamX, Params, Pattern, PatternBinding, PatternX, Place, PlaceX, SpannedTyped, Stmt, |
| 6 | + StmtX, Trait, TraitImpl, TraitImplX, TraitX, Typ, TypDecorationArg, TypX, Typs, UnaryOpr, |
| 7 | + UnwindSpec, VarBinder, VarBinderX, VarBinders, VarIdent, Variant, VirErr, |
8 | 8 | }; |
9 | 9 | use crate::def::Spanned; |
10 | 10 | use crate::messages::Span; |
@@ -315,9 +315,9 @@ pub(crate) trait AstVisitor<R: Returner, Err, Scope: Scoper> { |
315 | 315 | let oe = self.visit_opt_expr(opt_e)?; |
316 | 316 | R::ret(|| expr_new(ExprX::Call(R::get(ct), R::get_vec_a(es), R::get_opt(oe)))) |
317 | 317 | } |
318 | | - ExprX::Ctor(dt, id, binders, opt_e) => { |
| 318 | + ExprX::Ctor(dt, id, binders, opt_tail) => { |
319 | 319 | let bs = self.visit_binders_expr(binders)?; |
320 | | - let oe = self.visit_opt_place(opt_e)?; |
| 320 | + let oe = R::map_opt(opt_tail, &mut |p| self.visit_ctor_update_tail(p))?; |
321 | 321 | R::ret(|| { |
322 | 322 | expr_new(ExprX::Ctor(dt.clone(), id.clone(), R::get_vec_a(bs), R::get_opt(oe))) |
323 | 323 | }) |
@@ -650,6 +650,15 @@ pub(crate) trait AstVisitor<R: Returner, Err, Scope: Scoper> { |
650 | 650 | } |
651 | 651 | } |
652 | 652 |
|
| 653 | + fn visit_ctor_update_tail( |
| 654 | + &mut self, |
| 655 | + tail: &CtorUpdateTail, |
| 656 | + ) -> Result<R::Ret<CtorUpdateTail>, Err> { |
| 657 | + let CtorUpdateTail { place, taken_fields } = tail; |
| 658 | + let place = self.visit_place(place)?; |
| 659 | + R::ret(|| CtorUpdateTail { place: R::get(place), taken_fields: taken_fields.clone() }) |
| 660 | + } |
| 661 | + |
653 | 662 | fn visit_arms(&mut self, arms: &Arms) -> Result<R::Vec<Arm>, Err> { |
654 | 663 | R::map_vec(arms, &mut |e| self.visit_arm(e)) |
655 | 664 | } |
|
0 commit comments