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)
| 2333 | /// Add an identifier to the set of visited names in `self` and emit a [`SemanticSyntaxError`] |
| 2334 | /// if `ident` has already been seen. |
| 2335 | fn insert(&mut self, ident: &'a ast::Identifier) { |
| 2336 | if !self.names.insert(&ident.id) { |
| 2337 | SemanticSyntaxChecker::add_error( |
| 2338 | self.ctx, |
| 2339 | SemanticSyntaxErrorKind::MultipleCaseAssignment(ident.id.clone()), |
| 2340 | ident.range(), |
| 2341 | ); |
| 2342 | } |
| 2343 | // test_err debug_shadow_match |
| 2344 | // match x: |
| 2345 | // case __debug__: ... |
| 2346 | SemanticSyntaxChecker::check_identifier(ident, self.ctx); |
| 2347 | } |
| 2348 | } |
| 2349 | |
| 2350 | struct InvalidExpressionVisitor<'a, Ctx> { |