mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Rename Parameter#arg
and ParameterWithDefault#def
fields (#6255)
## Summary This PR renames... - `Parameter#arg` to `Parameter#name` - `ParameterWithDefault#def` to `ParameterWithDefault#parameter` (such that `ParameterWithDefault` has a `default` and a `parameter`) ## Test Plan `cargo test`
This commit is contained in:
parent
adc8bb7821
commit
9c708d8fc1
56 changed files with 268 additions and 260 deletions
|
@ -32,12 +32,12 @@ pub(crate) fn validate_arguments(arguments: &ast::Parameters) -> Result<(), Lexi
|
|||
for arg in posonlyargs
|
||||
.chain(args)
|
||||
.chain(kwonlyargs)
|
||||
.map(|arg| &arg.def)
|
||||
.map(|arg| &arg.parameter)
|
||||
.chain(vararg)
|
||||
.chain(kwarg)
|
||||
{
|
||||
let range = arg.range;
|
||||
let arg_name = arg.arg.as_str();
|
||||
let arg_name = arg.name.as_str();
|
||||
if !all_arg_names.insert(arg_name) {
|
||||
return Err(LexicalError {
|
||||
error: LexicalErrorType::DuplicateArgumentError(arg_name.to_string()),
|
||||
|
@ -66,7 +66,7 @@ pub(crate) fn validate_pos_params(
|
|||
if let Some(invalid) = first_invalid {
|
||||
return Err(LexicalError {
|
||||
error: LexicalErrorType::DefaultArgumentError,
|
||||
location: invalid.def.range.start(),
|
||||
location: invalid.parameter.range.start(),
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue