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

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

(expr: &Expr, ctx: &Ctx)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

is_starred_exprMethod · 0.80
rangeMethod · 0.45

Tested by

no test coverage detected