@@ -93,49 +93,41 @@ fn new_op_call_expr<'a>(
93
93
) ,
94
94
) ;
95
95
}
96
- TrySuffix ( fn_expr) => {
97
- let loc_fn = env. arena . alloc ( Loc :: at ( right. region , * * fn_expr) ) ;
98
- let function = desugar_expr ( env, scope, loc_fn) ;
96
+ TrySuffix ( PncApply ( loc_fn_expr, loc_args) ) => {
97
+ let function = desugar_expr ( env, scope, loc_fn_expr) ;
98
+
99
+ let mut desugared_args = Vec :: with_capacity_in ( loc_args. len ( ) , env. arena ) ;
100
+ desugared_args. push ( desugar_expr ( env, scope, left) ) ;
101
+ for loc_arg in loc_args. iter ( ) {
102
+ desugared_args. push ( desugar_expr ( env, scope, loc_arg) ) ;
103
+ }
99
104
100
105
return Loc :: at (
101
106
region,
102
107
LowLevelTry (
103
108
env. arena . alloc ( Loc :: at (
104
109
region,
105
- Expr :: Apply (
110
+ Expr :: PncApply (
106
111
function,
107
- env. arena . alloc ( [ desugar_expr ( env, scope, left) ] ) ,
108
- CalledVia :: Try ,
112
+ Collection :: with_items ( desugared_args. into_bump_slice ( ) ) ,
109
113
) ,
110
114
) ) ,
111
115
ResultTryKind :: OperatorSuffix ,
112
116
) ,
113
117
) ;
114
118
}
115
- PncApply (
116
- & Loc {
117
- value : TrySuffix ( fn_expr) ,
118
- region : fn_region,
119
- } ,
120
- loc_args,
121
- ) => {
122
- let loc_fn = env. arena . alloc ( Loc :: at ( fn_region, * fn_expr) ) ;
119
+ TrySuffix ( fn_expr) => {
120
+ let loc_fn = env. arena . alloc ( Loc :: at ( right. region , * * fn_expr) ) ;
123
121
let function = desugar_expr ( env, scope, loc_fn) ;
124
122
125
- let mut desugared_args = Vec :: with_capacity_in ( loc_args. len ( ) + 1 , env. arena ) ;
126
- desugared_args. push ( desugar_expr ( env, scope, left) ) ;
127
- for loc_arg in loc_args. items {
128
- desugared_args. push ( desugar_expr ( env, scope, loc_arg) ) ;
129
- }
130
-
131
123
return Loc :: at (
132
124
region,
133
125
LowLevelTry (
134
126
env. arena . alloc ( Loc :: at (
135
127
region,
136
128
Expr :: Apply (
137
129
function,
138
- desugared_args . into_bump_slice ( ) ,
130
+ env . arena . alloc ( [ desugar_expr ( env , scope , left ) ] ) ,
139
131
CalledVia :: Try ,
140
132
) ,
141
133
) ) ,
0 commit comments