| ... | ... | @@ -5264,7 +5264,9 @@ fn whileExpr( |
| 5264 | 5264 | const ident_token = if (payload_is_ref) payload_token + 1 else payload_token; |
| 5265 | 5265 | if (mem.eql(u8, "_", tree.tokenSlice(ident_token))) |
| 5266 | 5266 | break :s &then_scope.base; |
| 5267 | | const ident_name = try astgen.identAsString(payload_token + @boolToInt(payload_is_ref)); |
| 5267 | const payload_name_loc = payload_token + @boolToInt(payload_is_ref); |
| 5268 | const ident_name = try astgen.identAsString(payload_name_loc); |
| 5269 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, payload_name_loc); |
| 5268 | 5270 | payload_val_scope = .{ |
| 5269 | 5271 | .parent = &then_scope.base, |
| 5270 | 5272 | .gen_zir = &then_scope, |
| ... | ... | @@ -5287,6 +5289,7 @@ fn whileExpr( |
| 5287 | 5289 | const ident_name = try astgen.identAsString(ident_token); |
| 5288 | 5290 | if (mem.eql(u8, "_", tree.tokenSlice(ident_token))) |
| 5289 | 5291 | break :s &then_scope.base; |
| 5292 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token); |
| 5290 | 5293 | payload_val_scope = .{ |
| 5291 | 5294 | .parent = &then_scope.base, |
| 5292 | 5295 | .gen_zir = &then_scope, |
| ... | ... | @@ -5344,6 +5347,7 @@ fn whileExpr( |
| 5344 | 5347 | const ident_name = try astgen.identAsString(error_token); |
| 5345 | 5348 | if (mem.eql(u8, tree.tokenSlice(error_token), "_")) |
| 5346 | 5349 | break :s &else_scope.base; |
| 5350 | try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token); |
| 5347 | 5351 | payload_val_scope = .{ |
| 5348 | 5352 | .parent = &else_scope.base, |
| 5349 | 5353 | .gen_zir = &else_scope, |
| ... | ... | @@ -5483,6 +5487,7 @@ fn forExpr( |
| 5483 | 5487 | const name_str_index = try astgen.identAsString(ident); |
| 5484 | 5488 | const tag: Zir.Inst.Tag = if (is_ptr) .elem_ptr else .elem_val; |
| 5485 | 5489 | const payload_inst = try then_scope.addBin(tag, array_ptr, index); |
| 5490 | try astgen.detectLocalShadowing(&then_scope.base, name_str_index, ident); |
| 5486 | 5491 | payload_val_scope = .{ |
| 5487 | 5492 | .parent = &then_scope.base, |
| 5488 | 5493 | .gen_zir = &then_scope, |
| ... | ... | @@ -5506,6 +5511,7 @@ fn forExpr( |
| 5506 | 5511 | return astgen.failTok(index_token, "discard of index capture; omit it instead", .{}); |
| 5507 | 5512 | } |
| 5508 | 5513 | const index_name = try astgen.identAsString(index_token); |
| 5514 | try astgen.detectLocalShadowing(payload_sub_scope, index_name, index_token); |
| 5509 | 5515 | index_scope = .{ |
| 5510 | 5516 | .parent = payload_sub_scope, |
| 5511 | 5517 | .gen_zir = &then_scope, |