MCPcopy Create free account
hub / github.com/astral-sh/ruff / insert

Method insert

crates/ruff_python_parser/src/semantic_errors.rs:2414–2426  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

2412 /// Add an identifier to the set of visited names in `self` and emit a [`SemanticSyntaxError`]
2413 /// if `ident` has already been seen.
2414 fn insert(&mut self, ident: &'a ast::Identifier) {
2415 if !self.names.insert(&ident.id) {
2416 SemanticSyntaxChecker::add_error(
2417 self.ctx,
2418 SemanticSyntaxErrorKind::MultipleCaseAssignment(ident.id.clone()),
2419 ident.range(),
2420 );
2421 }
2422 // test_err debug_shadow_match
2423 // match x:
2424 // case __debug__: ...
2425 SemanticSyntaxChecker::check_identifier(ident, self.ctx);
2426 }
2427}
2428
2429struct InvalidExpressionVisitor<'a, Ctx> {

Callers 6

visit_patternMethod · 0.45
internMethod · 0.45
try_fromMethod · 0.45
existing_testsFunction · 0.45

Calls 2

cloneMethod · 0.45
rangeMethod · 0.45

Tested by 2

try_fromMethod · 0.36
existing_testsFunction · 0.36