Add an identifier to the set of visited names in `self` and emit a [`SemanticSyntaxError`] if `ident` has already been seen.
(&mut self, ident: &'a ast::Identifier)
| 2497 | /// Add an identifier to the set of visited names in `self` and emit a [`SemanticSyntaxError`] |
| 2498 | /// if `ident` has already been seen. |
| 2499 | fn insert(&mut self, ident: &'a ast::Identifier) { |
| 2500 | if !self.names.insert(&ident.id) { |
| 2501 | SemanticSyntaxChecker::add_error( |
| 2502 | self.ctx, |
| 2503 | SemanticSyntaxErrorKind::MultipleCaseAssignment(ident.id.clone()), |
| 2504 | ident.range(), |
| 2505 | ); |
| 2506 | } |
| 2507 | // test_err debug_shadow_match |
| 2508 | // match x: |
| 2509 | // case __debug__: ... |
| 2510 | SemanticSyntaxChecker::check_identifier(ident, self.ctx); |
| 2511 | } |
| 2512 | } |
| 2513 | |
| 2514 | struct InvalidExpressionVisitor<'a, Ctx> { |