mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-07 21:25:31 +00:00
Fix type param order during source location
There is a `debug_assert!` during source location which verifies that there is no backtracking during the location scanning process. Type params were being folded after everything else, which required a backtrack. This caused any code with function or class type parameters to break when run in debug mode.
This commit is contained in:
parent
6a2aa264b1
commit
649fdd4be9
1 changed files with 3 additions and 3 deletions
|
@ -156,11 +156,11 @@ impl crate::fold::Fold<TextRange> for LinearLocator<'_> {
|
|||
let context = self.will_map_user(&range);
|
||||
|
||||
let name = self.fold(name)?;
|
||||
let type_params = self.fold(type_params)?;
|
||||
let bases = self.fold(bases)?;
|
||||
let keywords = self.fold(keywords)?;
|
||||
let body = self.fold(body)?;
|
||||
let range = self.map_user(range, context)?;
|
||||
let type_params = self.fold(type_params)?;
|
||||
|
||||
Ok(crate::StmtClassDef {
|
||||
name,
|
||||
|
@ -190,11 +190,11 @@ impl crate::fold::Fold<TextRange> for LinearLocator<'_> {
|
|||
let context = self.will_map_user(&range);
|
||||
|
||||
let name = self.fold(name)?;
|
||||
let type_params = self.fold(type_params)?;
|
||||
let args: Box<crate::Arguments<SourceRange>> = self.fold(args)?;
|
||||
let returns = self.fold(returns)?;
|
||||
let body = self.fold(body)?;
|
||||
let type_comment = self.fold(type_comment)?;
|
||||
let type_params = self.fold(type_params)?;
|
||||
let range = self.map_user(range, context)?;
|
||||
Ok(crate::StmtFunctionDef {
|
||||
name,
|
||||
|
@ -225,11 +225,11 @@ impl crate::fold::Fold<TextRange> for LinearLocator<'_> {
|
|||
let context = self.will_map_user(&range);
|
||||
|
||||
let name = self.fold(name)?;
|
||||
let type_params = self.fold(type_params)?;
|
||||
let args: Box<crate::Arguments<SourceRange>> = self.fold(args)?;
|
||||
let returns = self.fold(returns)?;
|
||||
let body = self.fold(body)?;
|
||||
let type_comment = self.fold(type_comment)?;
|
||||
let type_params = self.fold(type_params)?;
|
||||
let range = self.map_user(range, context)?;
|
||||
Ok(crate::StmtAsyncFunctionDef {
|
||||
name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue