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:1203–1215  ·  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

1201 /// Add a [`SemanticSyntaxErrorKind::ReboundComprehensionVariable`] if `expr` rebinds an
1202 /// iteration variable in `generators`.
1203 fn check_generator_expr<Ctx: SemanticSyntaxContext>(
1204 expr: &Expr,
1205 comprehensions: &[ast::Comprehension],
1206 ctx: &Ctx,
1207 ) {
1208 Self::check_rebound_variables(
1209 expr,
1210 comprehension_target_names(comprehensions),
1211 FxHashSet::default(),
1212 ctx,
1213 );
1214 Self::check_class_body_expr(expr, ctx);
1215 }
1216
1217 fn check_generator_clauses<Ctx: SemanticSyntaxContext>(
1218 generators: &[ast::Comprehension],

Callers

nothing calls this directly

Calls 2

defaultFunction · 0.50

Tested by

no test coverage detected