Include argument parentheses in range (#5)

This commit is contained in:
Micha Reiser
2023-06-07 22:26:20 +02:00
committed by Charlie Marsh
parent 5054cbe84f
commit 8a415fa61e
7 changed files with 122 additions and 8 deletions

View File

@@ -981,8 +981,14 @@ FuncDef: ast::Stmt = {
Parameters: ast::Arguments = {
<location:@L> "(" <a: (ParameterList<TypedParameter, StarTypedParameter, DoubleStarTypedParameter>)?> ")" <end_location:@R> =>? {
a.as_ref().map(validate_arguments).transpose()?;
let range = optional_range(location, end_location);
let args = a
.unwrap_or_else(|| ast::Arguments::empty(optional_range(location, end_location)));
.map(|mut arguments| {
arguments.range = range;
arguments
})
.unwrap_or_else(|| ast::Arguments::empty(range));
Ok(args)
}