MCPcopy Index your code
hub / github.com/RustPython/RustPython / validate_duplicate_params

Function validate_duplicate_params

crates/codegen/src/compile.rs:233–245  ·  view source on GitHub ↗
(params: &ast::Parameters)

Source from the content-addressed store, hash-verified

231}
232
233fn validate_duplicate_params(params: &ast::Parameters) -> Result<(), CodegenErrorType> {
234 let mut seen_params = IndexSet::default();
235 for param in params {
236 let param_name = param.name().as_str();
237 if !seen_params.insert(param_name) {
238 return Err(CodegenErrorType::SyntaxError(format!(
239 r#"Duplicate parameter "{param_name}""#
240 )));
241 }
242 }
243
244 Ok(())
245}
246
247/// Compile an Mod produced from ruff parser
248pub fn compile_top(

Callers 2

compile_statementMethod · 0.85
compile_expressionMethod · 0.85

Calls 4

ErrClass · 0.50
as_strMethod · 0.45
nameMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected