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:545–558  ·  view source on GitHub ↗

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

(expr: &Expr, ctx: &Ctx)

Source from the content-addressed store, hash-verified

543
544 /// Emit a [`SemanticSyntaxErrorKind::InvalidStarExpression`] if `expr` is starred.
545 fn invalid_star_expression<Ctx: SemanticSyntaxContext>(expr: &Expr, ctx: &Ctx) {
546 // test_ok single_star_in_tuple
547 // def f(): yield (*x,)
548 // def f(): return (*x,)
549 // for _ in (*x,): ...
550 // for (*x,) in xs: ...
551 if expr.is_starred_expr() {
552 Self::add_error(
553 ctx,
554 SemanticSyntaxErrorKind::InvalidStarExpression,
555 expr.range(),
556 );
557 }
558 }
559
560 fn multiple_star_expression<Ctx: SemanticSyntaxContext>(
561 ctx: &Ctx,

Callers

nothing calls this directly

Calls 2

is_starred_exprMethod · 0.80
rangeMethod · 0.45

Tested by

no test coverage detected