Remove Int wrapper type from parser (#7577)
## Summary This is only used for the `level` field in relative imports (e.g., `from ..foo import bar`). It seems unnecessary to use a wrapper here, so this PR changes to a `u32` directly.
This commit is contained in:
@@ -253,18 +253,18 @@ ImportStatement: ast::Stmt = {
|
||||
},
|
||||
};
|
||||
|
||||
ImportFromLocation: (Option<ast::Int>, Option<ast::Identifier>) = {
|
||||
ImportFromLocation: (Option<u32>, Option<ast::Identifier>) = {
|
||||
<dots: ImportDots*> <name:DottedName> => {
|
||||
(Some(ast::Int::new(dots.iter().map(ast::Int::to_u32).sum())), Some(name))
|
||||
(Some(dots.iter().sum()), Some(name))
|
||||
},
|
||||
<dots: ImportDots+> => {
|
||||
(Some(ast::Int::new(dots.iter().map(ast::Int::to_u32).sum())), None)
|
||||
(Some(dots.iter().sum()), None)
|
||||
},
|
||||
};
|
||||
|
||||
ImportDots: ast::Int = {
|
||||
"..." => ast::Int::new(3),
|
||||
"." => ast::Int::new(1),
|
||||
ImportDots: u32 = {
|
||||
"..." => 3,
|
||||
"." => 1,
|
||||
};
|
||||
|
||||
ImportAsNames: Vec<ast::Alias> = {
|
||||
|
||||
Reference in New Issue
Block a user