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

Method check_generator_expr

crates/ruff_python_parser/src/semantic_errors.rs:1195–1207  ·  view source on GitHub ↗

Add a [`SemanticSyntaxErrorKind::ReboundComprehensionVariable`] if `expr` rebinds an iteration variable in `generators`.

(
        expr: &Expr,
        comprehensions: &[ast::Comprehension],
        ctx: &Ctx,
    )

Source from the content-addressed store, hash-verified

1193 /// Add a [`SemanticSyntaxErrorKind::ReboundComprehensionVariable`] if `expr` rebinds an
1194 /// iteration variable in `generators`.
1195 fn check_generator_expr<Ctx: SemanticSyntaxContext>(
1196 expr: &Expr,
1197 comprehensions: &[ast::Comprehension],
1198 ctx: &Ctx,
1199 ) {
1200 Self::check_rebound_variables(
1201 expr,
1202 comprehension_target_names(comprehensions),
1203 FxHashSet::default(),
1204 ctx,
1205 );
1206 Self::check_class_body_expr(expr, ctx);
1207 }
1208
1209 fn check_generator_clauses<Ctx: SemanticSyntaxContext>(
1210 generators: &[ast::Comprehension],

Callers

nothing calls this directly

Calls 2

defaultFunction · 0.50

Tested by

no test coverage detected