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

Method parse_match_pattern_target

crates/ruff_python_parser/src/parser/pattern.rs:310–321  ·  view source on GitHub ↗

Parses a binding target in an `as` or mapping pattern.

(&mut self)

Source from the content-addressed store, hash-verified

308
309 /// Parses a binding target in an `as` or mapping pattern.
310 fn parse_match_pattern_target(&mut self) -> ast::Identifier {
311 // test_err invalid_match_pattern_target
312 // match value:
313 // case 1 as _: ...
314 // case {**_}: ...
315 // after = 1
316 let identifier = self.parse_identifier();
317 if identifier.is_valid() && identifier.id == "_" {
318 self.add_error(ParseErrorType::InvalidMatchPatternTarget, &identifier);
319 }
320 identifier
321 }
322
323 /// Parses a parenthesized pattern or a sequence pattern.
324 ///

Callers 2

Calls 3

parse_identifierMethod · 0.80
is_validMethod · 0.80
add_errorMethod · 0.45

Tested by

no test coverage detected