@@ -242,15 +242,7 @@ fn loc_term<'a>() -> impl Parser<'a, Loc<Expr<'a>>, EExpr<'a>> {
242
242
let mut e = expr;
243
243
let orig_region = e. region ;
244
244
for ( args_loc, maybe_suffixes) in arg_locs_with_suffixes_vec. iter ( ) {
245
- let value = if matches ! (
246
- e,
247
- Loc {
248
- value: Expr :: Dbg ,
249
- ..
250
- }
251
- ) {
252
- Expr :: Apply ( arena. alloc ( e) , args_loc. value . items , CalledVia :: Space )
253
- } else if let Some ( suffixes) = maybe_suffixes {
245
+ let value = if let Some ( suffixes) = maybe_suffixes {
254
246
apply_expr_access_chain (
255
247
arena,
256
248
Expr :: PncApply ( arena. alloc ( e) , args_loc. value ) ,
@@ -3150,49 +3142,65 @@ fn stmts_to_defs<'a>(
3150
3142
_,
3151
3143
) = e
3152
3144
{
3153
- let condition = & args[ 0 ] ;
3154
- let rest = stmts_to_expr ( & stmts[ i + 1 ..] , arena) ?;
3155
- let e = Expr :: DbgStmt {
3156
- first : condition ,
3157
- extra_args : & args [ 1 .. ] ,
3158
- continuation : arena. alloc ( rest) ,
3159
- } ;
3145
+ if let Some ( ( first , extra_args ) ) = args. split_first ( ) {
3146
+ let rest = stmts_to_expr ( & stmts[ i + 1 ..] , arena) ?;
3147
+ let e = Expr :: DbgStmt {
3148
+ first ,
3149
+ extra_args ,
3150
+ continuation : arena. alloc ( rest) ,
3151
+ } ;
3160
3152
3161
- let e = if sp_stmt. before . is_empty ( ) {
3162
- e
3163
- } else {
3164
- arena. alloc ( e) . before ( sp_stmt. before )
3165
- } ;
3153
+ let e = if sp_stmt. before . is_empty ( ) {
3154
+ e
3155
+ } else {
3156
+ arena. alloc ( e) . before ( sp_stmt. before )
3157
+ } ;
3166
3158
3167
- last_expr = Some ( Loc :: at ( sp_stmt. item . region , e) ) ;
3159
+ last_expr = Some ( Loc :: at ( sp_stmt. item . region , e) ) ;
3168
3160
3169
- // don't re-process the rest of the statements; they got consumed by the dbg expr
3170
- break ;
3161
+ // don't re-process the rest of the statements; they got consumed by the dbg expr
3162
+ break ;
3163
+ } else {
3164
+ defs. push_value_def (
3165
+ ValueDef :: Stmt ( arena. alloc ( Loc :: at ( sp_stmt. item . region , e) ) ) ,
3166
+ sp_stmt. item . region ,
3167
+ sp_stmt. before ,
3168
+ & [ ] ,
3169
+ ) ;
3170
+ }
3171
3171
} else if let Expr :: PncApply (
3172
3172
Loc {
3173
3173
value : Expr :: Dbg , ..
3174
3174
} ,
3175
3175
args,
3176
3176
) = e
3177
3177
{
3178
- let condition = & args. items [ 0 ] ;
3179
- let rest = stmts_to_expr ( & stmts[ i + 1 ..] , arena) ?;
3180
- let e = Expr :: DbgStmt {
3181
- first : condition ,
3182
- extra_args : & args . items [ 1 .. ] ,
3183
- continuation : arena. alloc ( rest) ,
3184
- } ;
3178
+ if let Some ( ( first , extra_args ) ) = args. items . split_first ( ) {
3179
+ let rest = stmts_to_expr ( & stmts[ i + 1 ..] , arena) ?;
3180
+ let e = Expr :: DbgStmt {
3181
+ first ,
3182
+ extra_args ,
3183
+ continuation : arena. alloc ( rest) ,
3184
+ } ;
3185
3185
3186
- let e = if sp_stmt. before . is_empty ( ) {
3187
- e
3188
- } else {
3189
- arena. alloc ( e) . before ( sp_stmt. before )
3190
- } ;
3186
+ let e = if sp_stmt. before . is_empty ( ) {
3187
+ e
3188
+ } else {
3189
+ arena. alloc ( e) . before ( sp_stmt. before )
3190
+ } ;
3191
3191
3192
- last_expr = Some ( Loc :: at ( sp_stmt. item . region , e) ) ;
3192
+ last_expr = Some ( Loc :: at ( sp_stmt. item . region , e) ) ;
3193
3193
3194
- // don't re-process the rest of the statements; they got consumed by the dbg expr
3195
- break ;
3194
+ // don't re-process the rest of the statements; they got consumed by the dbg expr
3195
+ break ;
3196
+ } else {
3197
+ defs. push_value_def (
3198
+ ValueDef :: Stmt ( arena. alloc ( Loc :: at ( sp_stmt. item . region , e) ) ) ,
3199
+ sp_stmt. item . region ,
3200
+ sp_stmt. before ,
3201
+ & [ ] ,
3202
+ ) ;
3203
+ }
3196
3204
} else {
3197
3205
defs. push_value_def (
3198
3206
ValueDef :: Stmt ( arena. alloc ( Loc :: at ( sp_stmt. item . region , e) ) ) ,
0 commit comments