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

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

(expr: &Expr, ctx: &Ctx)

Source from the content-addressed store, hash-verified

553
554 /// Emit a [`SemanticSyntaxErrorKind::InvalidStarExpression`] if `expr` is starred.
555 fn invalid_star_expression<Ctx: SemanticSyntaxContext>(expr: &Expr, ctx: &Ctx) {
556 // test_ok single_star_in_tuple
557 // def f(): yield (*x,)
558 // def f(): return (*x,)
559 // for _ in (*x,): ...
560 // for (*x,) in xs: ...
561 if expr.is_starred_expr() {
562 Self::add_error(
563 ctx,
564 SemanticSyntaxErrorKind::InvalidStarExpression,
565 expr.range(),
566 );
567 }
568 }
569
570 fn multiple_star_expression<Ctx: SemanticSyntaxContext>(
571 ctx: &Ctx,

Callers

nothing calls this directly

Calls 2

is_starred_exprMethod · 0.80
rangeMethod · 0.45

Tested by

no test coverage detected