| ... | ... | @@ -5009,6 +5009,7 @@ fn ifExpr( |
| 5009 | 5009 | const token_name_str = tree.tokenSlice(token_name_index); |
| 5010 | 5010 | if (mem.eql(u8, "_", token_name_str)) |
| 5011 | 5011 | break :s &then_scope.base; |
| 5012 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, token_name_index); |
| 5012 | 5013 | payload_val_scope = .{ |
| 5013 | 5014 | .parent = &then_scope.base, |
| 5014 | 5015 | .gen_zir = &then_scope, |
| ... | ... | @@ -5031,6 +5032,7 @@ fn ifExpr( |
| 5031 | 5032 | break :s &then_scope.base; |
| 5032 | 5033 | const payload_inst = try then_scope.addUnNode(tag, cond.inst, node); |
| 5033 | 5034 | const ident_name = try astgen.identAsString(ident_token); |
| 5035 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token); |
| 5034 | 5036 | payload_val_scope = .{ |
| 5035 | 5037 | .parent = &then_scope.base, |
| 5036 | 5038 | .gen_zir = &then_scope, |
| ... | ... | @@ -5072,6 +5074,7 @@ fn ifExpr( |
| 5072 | 5074 | const error_token_str = tree.tokenSlice(error_token); |
| 5073 | 5075 | if (mem.eql(u8, "_", error_token_str)) |
| 5074 | 5076 | break :s &else_scope.base; |
| 5077 | try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token); |
| 5075 | 5078 | payload_val_scope = .{ |
| 5076 | 5079 | .parent = &else_scope.base, |
| 5077 | 5080 | .gen_zir = &else_scope, |
| ... | ... | @@ -5265,7 +5268,9 @@ fn whileExpr( |
| 5265 | 5268 | const ident_token = if (payload_is_ref) payload_token + 1 else payload_token; |
| 5266 | 5269 | if (mem.eql(u8, "_", tree.tokenSlice(ident_token))) |
| 5267 | 5270 | break :s &then_scope.base; |
| 5268 | | const ident_name = try astgen.identAsString(payload_token + @boolToInt(payload_is_ref)); |
| 5271 | const payload_name_loc = payload_token + @boolToInt(payload_is_ref); |
| 5272 | const ident_name = try astgen.identAsString(payload_name_loc); |
| 5273 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, payload_name_loc); |
| 5269 | 5274 | payload_val_scope = .{ |
| 5270 | 5275 | .parent = &then_scope.base, |
| 5271 | 5276 | .gen_zir = &then_scope, |
| ... | ... | @@ -5288,6 +5293,7 @@ fn whileExpr( |
| 5288 | 5293 | const ident_name = try astgen.identAsString(ident_token); |
| 5289 | 5294 | if (mem.eql(u8, "_", tree.tokenSlice(ident_token))) |
| 5290 | 5295 | break :s &then_scope.base; |
| 5296 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token); |
| 5291 | 5297 | payload_val_scope = .{ |
| 5292 | 5298 | .parent = &then_scope.base, |
| 5293 | 5299 | .gen_zir = &then_scope, |
| ... | ... | @@ -5345,6 +5351,7 @@ fn whileExpr( |
| 5345 | 5351 | const ident_name = try astgen.identAsString(error_token); |
| 5346 | 5352 | if (mem.eql(u8, tree.tokenSlice(error_token), "_")) |
| 5347 | 5353 | break :s &else_scope.base; |
| 5354 | try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token); |
| 5348 | 5355 | payload_val_scope = .{ |
| 5349 | 5356 | .parent = &else_scope.base, |
| 5350 | 5357 | .gen_zir = &else_scope, |
| ... | ... | @@ -5484,6 +5491,7 @@ fn forExpr( |
| 5484 | 5491 | const name_str_index = try astgen.identAsString(ident); |
| 5485 | 5492 | const tag: Zir.Inst.Tag = if (is_ptr) .elem_ptr else .elem_val; |
| 5486 | 5493 | const payload_inst = try then_scope.addBin(tag, array_ptr, index); |
| 5494 | try astgen.detectLocalShadowing(&then_scope.base, name_str_index, ident); |
| 5487 | 5495 | payload_val_scope = .{ |
| 5488 | 5496 | .parent = &then_scope.base, |
| 5489 | 5497 | .gen_zir = &then_scope, |
| ... | ... | @@ -5507,6 +5515,7 @@ fn forExpr( |
| 5507 | 5515 | return astgen.failTok(index_token, "discard of index capture; omit it instead", .{}); |
| 5508 | 5516 | } |
| 5509 | 5517 | const index_name = try astgen.identAsString(index_token); |
| 5518 | try astgen.detectLocalShadowing(payload_sub_scope, index_name, index_token); |
| 5510 | 5519 | index_scope = .{ |
| 5511 | 5520 | .parent = payload_sub_scope, |
| 5512 | 5521 | .gen_zir = &then_scope, |