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

Method invalid_star_expression

crates/ruff_python_parser/src/semantic_errors.rs:527–540  ·  view source on GitHub ↗

Emit a [`SemanticSyntaxErrorKind::InvalidStarExpression`] if `expr` is starred.

(expr: &Expr, ctx: &Ctx)

Source from the content-addressed store, hash-verified

525
526 /// Emit a [`SemanticSyntaxErrorKind::InvalidStarExpression`] if `expr` is starred.
527 fn invalid_star_expression<Ctx: SemanticSyntaxContext>(expr: &Expr, ctx: &Ctx) {
528 // test_ok single_star_in_tuple
529 // def f(): yield (*x,)
530 // def f(): return (*x,)
531 // for _ in (*x,): ...
532 // for (*x,) in xs: ...
533 if expr.is_starred_expr() {
534 Self::add_error(
535 ctx,
536 SemanticSyntaxErrorKind::InvalidStarExpression,
537 expr.range(),
538 );
539 }
540 }
541
542 fn multiple_star_expression<Ctx: SemanticSyntaxContext>(
543 ctx: &Ctx,

Callers

nothing calls this directly

Calls 2

is_starred_exprMethod · 0.80
rangeMethod · 0.45

Tested by

no test coverage detected