mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
Add a TypeParams
node to the AST (#6261)
## Summary Similar to #6259, this PR adds a `TypeParams` node to the AST, to capture the list of type parameters with their surrounding brackets. If a statement lacks type parameters, the `type_params` field will be `None`.
This commit is contained in:
parent
981e64f82b
commit
b095b7204b
31 changed files with 1104 additions and 866 deletions
|
@ -482,8 +482,8 @@ where
|
|||
|
||||
self.semantic.push_scope(ScopeKind::Type);
|
||||
|
||||
for type_param in type_params {
|
||||
self.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
self.visit_type_params(type_params);
|
||||
}
|
||||
|
||||
for parameter_with_default in parameters
|
||||
|
@ -565,8 +565,8 @@ where
|
|||
|
||||
self.semantic.push_scope(ScopeKind::Type);
|
||||
|
||||
for type_param in type_params {
|
||||
self.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
self.visit_type_params(type_params);
|
||||
}
|
||||
|
||||
if let Some(arguments) = arguments {
|
||||
|
@ -596,8 +596,8 @@ where
|
|||
value,
|
||||
}) => {
|
||||
self.semantic.push_scope(ScopeKind::Type);
|
||||
for type_param in type_params {
|
||||
self.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
self.visit_type_params(type_params);
|
||||
}
|
||||
self.visit_expr(value);
|
||||
self.semantic.pop_scope();
|
||||
|
|
|
@ -229,7 +229,7 @@ fn function(
|
|||
body: vec![body],
|
||||
decorator_list: vec![],
|
||||
returns: Some(Box::new(return_type)),
|
||||
type_params: vec![],
|
||||
type_params: None,
|
||||
range: TextRange::default(),
|
||||
});
|
||||
return generator.stmt(&func);
|
||||
|
@ -241,7 +241,7 @@ fn function(
|
|||
body: vec![body],
|
||||
decorator_list: vec![],
|
||||
returns: None,
|
||||
type_params: vec![],
|
||||
type_params: None,
|
||||
range: TextRange::default(),
|
||||
});
|
||||
generator.stmt(&func)
|
||||
|
|
|
@ -172,7 +172,7 @@ fn create_class_def_stmt(typename: &str, body: Vec<Stmt>, base_class: &Expr) ->
|
|||
range: TextRange::default(),
|
||||
}),
|
||||
body,
|
||||
type_params: vec![],
|
||||
type_params: None,
|
||||
decorator_list: vec![],
|
||||
range: TextRange::default(),
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ fn create_class_def_stmt(
|
|||
range: TextRange::default(),
|
||||
}),
|
||||
body,
|
||||
type_params: vec![],
|
||||
type_params: None,
|
||||
decorator_list: vec![],
|
||||
range: TextRange::default(),
|
||||
}
|
||||
|
|
|
@ -969,7 +969,7 @@ pub struct StmtFunctionDef<'a> {
|
|||
parameters: ComparableParameters<'a>,
|
||||
body: Vec<ComparableStmt<'a>>,
|
||||
decorator_list: Vec<ComparableDecorator<'a>>,
|
||||
type_params: Vec<ComparableTypeParam<'a>>,
|
||||
type_params: Option<ComparableTypeParams<'a>>,
|
||||
returns: Option<ComparableExpr<'a>>,
|
||||
}
|
||||
|
||||
|
@ -979,7 +979,7 @@ pub struct StmtAsyncFunctionDef<'a> {
|
|||
parameters: ComparableParameters<'a>,
|
||||
body: Vec<ComparableStmt<'a>>,
|
||||
decorator_list: Vec<ComparableDecorator<'a>>,
|
||||
type_params: Vec<ComparableTypeParam<'a>>,
|
||||
type_params: Option<ComparableTypeParams<'a>>,
|
||||
returns: Option<ComparableExpr<'a>>,
|
||||
}
|
||||
|
||||
|
@ -989,7 +989,7 @@ pub struct StmtClassDef<'a> {
|
|||
arguments: Option<ComparableArguments<'a>>,
|
||||
body: Vec<ComparableStmt<'a>>,
|
||||
decorator_list: Vec<ComparableDecorator<'a>>,
|
||||
type_params: Vec<ComparableTypeParam<'a>>,
|
||||
type_params: Option<ComparableTypeParams<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
|
@ -1005,10 +1005,23 @@ pub struct StmtDelete<'a> {
|
|||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
pub struct StmtTypeAlias<'a> {
|
||||
pub name: Box<ComparableExpr<'a>>,
|
||||
pub type_params: Vec<ComparableTypeParam<'a>>,
|
||||
pub type_params: Option<ComparableTypeParams<'a>>,
|
||||
pub value: Box<ComparableExpr<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
pub struct ComparableTypeParams<'a> {
|
||||
pub type_params: Vec<ComparableTypeParam<'a>>,
|
||||
}
|
||||
|
||||
impl<'a> From<&'a ast::TypeParams> for ComparableTypeParams<'a> {
|
||||
fn from(type_params: &'a ast::TypeParams) -> Self {
|
||||
Self {
|
||||
type_params: type_params.iter().map(Into::into).collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
pub enum ComparableTypeParam<'a> {
|
||||
TypeVar(TypeParamTypeVar<'a>),
|
||||
|
@ -1237,7 +1250,7 @@ impl<'a> From<&'a ast::Stmt> for ComparableStmt<'a> {
|
|||
body: body.iter().map(Into::into).collect(),
|
||||
decorator_list: decorator_list.iter().map(Into::into).collect(),
|
||||
returns: returns.as_ref().map(Into::into),
|
||||
type_params: type_params.iter().map(Into::into).collect(),
|
||||
type_params: type_params.as_ref().map(Into::into),
|
||||
}),
|
||||
ast::Stmt::AsyncFunctionDef(ast::StmtAsyncFunctionDef {
|
||||
name,
|
||||
|
@ -1253,7 +1266,7 @@ impl<'a> From<&'a ast::Stmt> for ComparableStmt<'a> {
|
|||
body: body.iter().map(Into::into).collect(),
|
||||
decorator_list: decorator_list.iter().map(Into::into).collect(),
|
||||
returns: returns.as_ref().map(Into::into),
|
||||
type_params: type_params.iter().map(Into::into).collect(),
|
||||
type_params: type_params.as_ref().map(Into::into),
|
||||
}),
|
||||
ast::Stmt::ClassDef(ast::StmtClassDef {
|
||||
name,
|
||||
|
@ -1267,7 +1280,7 @@ impl<'a> From<&'a ast::Stmt> for ComparableStmt<'a> {
|
|||
arguments: arguments.as_ref().map(Into::into),
|
||||
body: body.iter().map(Into::into).collect(),
|
||||
decorator_list: decorator_list.iter().map(Into::into).collect(),
|
||||
type_params: type_params.iter().map(Into::into).collect(),
|
||||
type_params: type_params.as_ref().map(Into::into),
|
||||
}),
|
||||
ast::Stmt::Return(ast::StmtReturn {
|
||||
value,
|
||||
|
@ -1288,7 +1301,7 @@ impl<'a> From<&'a ast::Stmt> for ComparableStmt<'a> {
|
|||
value,
|
||||
}) => Self::TypeAlias(StmtTypeAlias {
|
||||
name: name.into(),
|
||||
type_params: type_params.iter().map(Into::into).collect(),
|
||||
type_params: type_params.as_ref().map(Into::into),
|
||||
value: value.into(),
|
||||
}),
|
||||
ast::Stmt::Assign(ast::StmtAssign {
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
use std::borrow::Cow;
|
||||
use std::path::Path;
|
||||
|
||||
use num_traits::Zero;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use ruff_text_size::TextRange;
|
||||
|
||||
use crate::call_path::CallPath;
|
||||
use crate::statement_visitor::{walk_body, walk_stmt, StatementVisitor};
|
||||
use crate::{
|
||||
self as ast, Arguments, Constant, ExceptHandler, Expr, Keyword, MatchCase, Parameters, Pattern,
|
||||
Ranged, Stmt, TypeParam,
|
||||
};
|
||||
use num_traits::Zero;
|
||||
use ruff_text_size::TextRange;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::call_path::CallPath;
|
||||
use crate::statement_visitor::{walk_body, walk_stmt, StatementVisitor};
|
||||
|
||||
/// Return `true` if the `Stmt` is a compound statement (as opposed to a simple statement).
|
||||
pub const fn is_compound_statement(stmt: &Stmt) -> bool {
|
||||
|
@ -346,6 +347,7 @@ where
|
|||
match stmt {
|
||||
Stmt::FunctionDef(ast::StmtFunctionDef {
|
||||
parameters,
|
||||
type_params,
|
||||
body,
|
||||
decorator_list,
|
||||
returns,
|
||||
|
@ -353,6 +355,7 @@ where
|
|||
})
|
||||
| Stmt::AsyncFunctionDef(ast::StmtAsyncFunctionDef {
|
||||
parameters,
|
||||
type_params,
|
||||
body,
|
||||
decorator_list,
|
||||
returns,
|
||||
|
@ -385,6 +388,11 @@ where
|
|||
.as_ref()
|
||||
.is_some_and(|expr| any_over_expr(expr, func))
|
||||
})
|
||||
|| type_params.as_ref().is_some_and(|type_params| {
|
||||
type_params
|
||||
.iter()
|
||||
.any(|type_param| any_over_type_param(type_param, func))
|
||||
})
|
||||
|| body.iter().any(|stmt| any_over_stmt(stmt, func))
|
||||
|| decorator_list
|
||||
.iter()
|
||||
|
@ -395,6 +403,7 @@ where
|
|||
}
|
||||
Stmt::ClassDef(ast::StmtClassDef {
|
||||
arguments,
|
||||
type_params,
|
||||
body,
|
||||
decorator_list,
|
||||
..
|
||||
|
@ -407,6 +416,11 @@ where
|
|||
.iter()
|
||||
.any(|keyword| any_over_expr(&keyword.value, func))
|
||||
})
|
||||
|| type_params.as_ref().is_some_and(|type_params| {
|
||||
type_params
|
||||
.iter()
|
||||
.any(|type_param| any_over_type_param(type_param, func))
|
||||
})
|
||||
|| body.iter().any(|stmt| any_over_stmt(stmt, func))
|
||||
|| decorator_list
|
||||
.iter()
|
||||
|
@ -429,9 +443,11 @@ where
|
|||
..
|
||||
}) => {
|
||||
any_over_expr(name, func)
|
||||
|| type_params
|
||||
|| type_params.as_ref().is_some_and(|type_params| {
|
||||
type_params
|
||||
.iter()
|
||||
.any(|type_param| any_over_type_param(type_param, func))
|
||||
})
|
||||
|| any_over_expr(value, func)
|
||||
}
|
||||
Stmt::Assign(ast::StmtAssign { targets, value, .. }) => {
|
||||
|
@ -1271,13 +1287,13 @@ mod tests {
|
|||
use std::cell::RefCell;
|
||||
use std::vec;
|
||||
|
||||
use crate::{
|
||||
Constant, Expr, ExprConstant, ExprContext, ExprName, Identifier, Stmt, StmtTypeAlias,
|
||||
TypeParam, TypeParamParamSpec, TypeParamTypeVar, TypeParamTypeVarTuple,
|
||||
};
|
||||
use ruff_text_size::TextRange;
|
||||
|
||||
use crate::helpers::{any_over_stmt, any_over_type_param, resolve_imported_module_path};
|
||||
use crate::{
|
||||
Constant, Expr, ExprConstant, ExprContext, ExprName, Identifier, Stmt, StmtTypeAlias,
|
||||
TypeParam, TypeParamParamSpec, TypeParamTypeVar, TypeParamTypeVarTuple, TypeParams,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn resolve_import() {
|
||||
|
@ -1351,7 +1367,10 @@ mod tests {
|
|||
});
|
||||
let type_alias = Stmt::TypeAlias(StmtTypeAlias {
|
||||
name: Box::new(name.clone()),
|
||||
type_params: Some(TypeParams {
|
||||
type_params: vec![type_var_one, type_var_two],
|
||||
range: TextRange::default(),
|
||||
}),
|
||||
value: Box::new(constant_three.clone()),
|
||||
range: TextRange::default(),
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
self as ast, Alias, Arguments, Comprehension, Decorator, ExceptHandler, Expr, Keyword,
|
||||
MatchCase, Mod, Parameter, ParameterWithDefault, Parameters, Pattern, Ranged, Stmt, TypeParam,
|
||||
TypeParamParamSpec, TypeParamTypeVar, TypeParamTypeVarTuple, WithItem,
|
||||
TypeParamParamSpec, TypeParamTypeVar, TypeParamTypeVarTuple, TypeParams, WithItem,
|
||||
};
|
||||
use ruff_text_size::TextRange;
|
||||
use std::ptr::NonNull;
|
||||
|
@ -100,9 +100,10 @@ pub enum AnyNode {
|
|||
MatchCase(MatchCase),
|
||||
Decorator(Decorator),
|
||||
ElifElseClause(ast::ElifElseClause),
|
||||
TypeParamTypeVar(ast::TypeParamTypeVar),
|
||||
TypeParamTypeVarTuple(ast::TypeParamTypeVarTuple),
|
||||
TypeParamParamSpec(ast::TypeParamParamSpec),
|
||||
TypeParams(TypeParams),
|
||||
TypeParamTypeVar(TypeParamTypeVar),
|
||||
TypeParamTypeVarTuple(TypeParamTypeVarTuple),
|
||||
TypeParamParamSpec(TypeParamParamSpec),
|
||||
}
|
||||
|
||||
impl AnyNode {
|
||||
|
@ -187,6 +188,7 @@ impl AnyNode {
|
|||
| AnyNode::WithItem(_)
|
||||
| AnyNode::MatchCase(_)
|
||||
| AnyNode::Decorator(_)
|
||||
| AnyNode::TypeParams(_)
|
||||
| AnyNode::TypeParamTypeVar(_)
|
||||
| AnyNode::TypeParamTypeVarTuple(_)
|
||||
| AnyNode::TypeParamParamSpec(_)
|
||||
|
@ -275,6 +277,7 @@ impl AnyNode {
|
|||
| AnyNode::WithItem(_)
|
||||
| AnyNode::MatchCase(_)
|
||||
| AnyNode::Decorator(_)
|
||||
| AnyNode::TypeParams(_)
|
||||
| AnyNode::TypeParamTypeVar(_)
|
||||
| AnyNode::TypeParamTypeVarTuple(_)
|
||||
| AnyNode::TypeParamParamSpec(_)
|
||||
|
@ -363,6 +366,7 @@ impl AnyNode {
|
|||
| AnyNode::WithItem(_)
|
||||
| AnyNode::MatchCase(_)
|
||||
| AnyNode::Decorator(_)
|
||||
| AnyNode::TypeParams(_)
|
||||
| AnyNode::TypeParamTypeVar(_)
|
||||
| AnyNode::TypeParamTypeVarTuple(_)
|
||||
| AnyNode::TypeParamParamSpec(_)
|
||||
|
@ -451,6 +455,7 @@ impl AnyNode {
|
|||
| AnyNode::WithItem(_)
|
||||
| AnyNode::MatchCase(_)
|
||||
| AnyNode::Decorator(_)
|
||||
| AnyNode::TypeParams(_)
|
||||
| AnyNode::TypeParamTypeVar(_)
|
||||
| AnyNode::TypeParamTypeVarTuple(_)
|
||||
| AnyNode::TypeParamParamSpec(_)
|
||||
|
@ -539,6 +544,7 @@ impl AnyNode {
|
|||
| AnyNode::WithItem(_)
|
||||
| AnyNode::MatchCase(_)
|
||||
| AnyNode::Decorator(_)
|
||||
| AnyNode::TypeParams(_)
|
||||
| AnyNode::TypeParamTypeVar(_)
|
||||
| AnyNode::TypeParamTypeVarTuple(_)
|
||||
| AnyNode::TypeParamParamSpec(_)
|
||||
|
@ -646,6 +652,7 @@ impl AnyNode {
|
|||
Self::WithItem(node) => AnyNodeRef::WithItem(node),
|
||||
Self::MatchCase(node) => AnyNodeRef::MatchCase(node),
|
||||
Self::Decorator(node) => AnyNodeRef::Decorator(node),
|
||||
Self::TypeParams(node) => AnyNodeRef::TypeParams(node),
|
||||
Self::TypeParamTypeVar(node) => AnyNodeRef::TypeParamTypeVar(node),
|
||||
Self::TypeParamTypeVarTuple(node) => AnyNodeRef::TypeParamTypeVarTuple(node),
|
||||
Self::TypeParamParamSpec(node) => AnyNodeRef::TypeParamParamSpec(node),
|
||||
|
@ -3590,6 +3597,7 @@ impl Ranged for AnyNode {
|
|||
AnyNode::WithItem(node) => node.range(),
|
||||
AnyNode::MatchCase(node) => node.range(),
|
||||
AnyNode::Decorator(node) => node.range(),
|
||||
AnyNode::TypeParams(node) => node.range(),
|
||||
AnyNode::TypeParamTypeVar(node) => node.range(),
|
||||
AnyNode::TypeParamTypeVarTuple(node) => node.range(),
|
||||
AnyNode::TypeParamParamSpec(node) => node.range(),
|
||||
|
@ -3678,9 +3686,10 @@ pub enum AnyNodeRef<'a> {
|
|||
WithItem(&'a WithItem),
|
||||
MatchCase(&'a MatchCase),
|
||||
Decorator(&'a Decorator),
|
||||
TypeParamTypeVar(&'a ast::TypeParamTypeVar),
|
||||
TypeParamTypeVarTuple(&'a ast::TypeParamTypeVarTuple),
|
||||
TypeParamParamSpec(&'a ast::TypeParamParamSpec),
|
||||
TypeParams(&'a TypeParams),
|
||||
TypeParamTypeVar(&'a TypeParamTypeVar),
|
||||
TypeParamTypeVarTuple(&'a TypeParamTypeVarTuple),
|
||||
TypeParamParamSpec(&'a TypeParamParamSpec),
|
||||
ElifElseClause(&'a ast::ElifElseClause),
|
||||
}
|
||||
|
||||
|
@ -3765,6 +3774,7 @@ impl AnyNodeRef<'_> {
|
|||
AnyNodeRef::WithItem(node) => NonNull::from(*node).cast(),
|
||||
AnyNodeRef::MatchCase(node) => NonNull::from(*node).cast(),
|
||||
AnyNodeRef::Decorator(node) => NonNull::from(*node).cast(),
|
||||
AnyNodeRef::TypeParams(node) => NonNull::from(*node).cast(),
|
||||
AnyNodeRef::TypeParamTypeVar(node) => NonNull::from(*node).cast(),
|
||||
AnyNodeRef::TypeParamTypeVarTuple(node) => NonNull::from(*node).cast(),
|
||||
AnyNodeRef::TypeParamParamSpec(node) => NonNull::from(*node).cast(),
|
||||
|
@ -3858,6 +3868,7 @@ impl AnyNodeRef<'_> {
|
|||
AnyNodeRef::WithItem(_) => NodeKind::WithItem,
|
||||
AnyNodeRef::MatchCase(_) => NodeKind::MatchCase,
|
||||
AnyNodeRef::Decorator(_) => NodeKind::Decorator,
|
||||
AnyNodeRef::TypeParams(_) => NodeKind::TypeParams,
|
||||
AnyNodeRef::TypeParamTypeVar(_) => NodeKind::TypeParamTypeVar,
|
||||
AnyNodeRef::TypeParamTypeVarTuple(_) => NodeKind::TypeParamTypeVarTuple,
|
||||
AnyNodeRef::TypeParamParamSpec(_) => NodeKind::TypeParamParamSpec,
|
||||
|
@ -3946,6 +3957,7 @@ impl AnyNodeRef<'_> {
|
|||
| AnyNodeRef::WithItem(_)
|
||||
| AnyNodeRef::MatchCase(_)
|
||||
| AnyNodeRef::Decorator(_)
|
||||
| AnyNodeRef::TypeParams(_)
|
||||
| AnyNodeRef::TypeParamTypeVar(_)
|
||||
| AnyNodeRef::TypeParamTypeVarTuple(_)
|
||||
| AnyNodeRef::TypeParamParamSpec(_)
|
||||
|
@ -4034,6 +4046,7 @@ impl AnyNodeRef<'_> {
|
|||
| AnyNodeRef::WithItem(_)
|
||||
| AnyNodeRef::MatchCase(_)
|
||||
| AnyNodeRef::Decorator(_)
|
||||
| AnyNodeRef::TypeParams(_)
|
||||
| AnyNodeRef::TypeParamTypeVar(_)
|
||||
| AnyNodeRef::TypeParamTypeVarTuple(_)
|
||||
| AnyNodeRef::TypeParamParamSpec(_)
|
||||
|
@ -4121,6 +4134,7 @@ impl AnyNodeRef<'_> {
|
|||
| AnyNodeRef::WithItem(_)
|
||||
| AnyNodeRef::MatchCase(_)
|
||||
| AnyNodeRef::Decorator(_)
|
||||
| AnyNodeRef::TypeParams(_)
|
||||
| AnyNodeRef::TypeParamTypeVar(_)
|
||||
| AnyNodeRef::TypeParamTypeVarTuple(_)
|
||||
| AnyNodeRef::TypeParamParamSpec(_)
|
||||
|
@ -4209,6 +4223,7 @@ impl AnyNodeRef<'_> {
|
|||
| AnyNodeRef::WithItem(_)
|
||||
| AnyNodeRef::MatchCase(_)
|
||||
| AnyNodeRef::Decorator(_)
|
||||
| AnyNodeRef::TypeParams(_)
|
||||
| AnyNodeRef::TypeParamTypeVar(_)
|
||||
| AnyNodeRef::TypeParamTypeVarTuple(_)
|
||||
| AnyNodeRef::TypeParamParamSpec(_)
|
||||
|
@ -4297,6 +4312,7 @@ impl AnyNodeRef<'_> {
|
|||
| AnyNodeRef::WithItem(_)
|
||||
| AnyNodeRef::MatchCase(_)
|
||||
| AnyNodeRef::Decorator(_)
|
||||
| AnyNodeRef::TypeParams(_)
|
||||
| AnyNodeRef::TypeParamTypeVar(_)
|
||||
| AnyNodeRef::TypeParamTypeVarTuple(_)
|
||||
| AnyNodeRef::TypeParamParamSpec(_)
|
||||
|
@ -5011,6 +5027,7 @@ impl Ranged for AnyNodeRef<'_> {
|
|||
AnyNodeRef::MatchCase(node) => node.range(),
|
||||
AnyNodeRef::Decorator(node) => node.range(),
|
||||
AnyNodeRef::ElifElseClause(node) => node.range(),
|
||||
AnyNodeRef::TypeParams(node) => node.range(),
|
||||
AnyNodeRef::TypeParamTypeVar(node) => node.range(),
|
||||
AnyNodeRef::TypeParamTypeVarTuple(node) => node.range(),
|
||||
AnyNodeRef::TypeParamParamSpec(node) => node.range(),
|
||||
|
@ -5102,6 +5119,7 @@ pub enum NodeKind {
|
|||
MatchCase,
|
||||
Decorator,
|
||||
ElifElseClause,
|
||||
TypeParams,
|
||||
TypeParamTypeVar,
|
||||
TypeParamTypeVarTuple,
|
||||
TypeParamParamSpec,
|
||||
|
|
|
@ -5,6 +5,7 @@ use num_bigint::BigInt;
|
|||
use ruff_text_size::{TextRange, TextSize};
|
||||
use std::fmt;
|
||||
use std::fmt::Debug;
|
||||
use std::ops::Deref;
|
||||
|
||||
/// See also [mod](https://docs.python.org/3/library/ast.html#ast.mod)
|
||||
#[derive(Clone, Debug, PartialEq, is_macro::Is)]
|
||||
|
@ -121,12 +122,12 @@ impl From<StmtLineMagic> for Stmt {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct StmtFunctionDef {
|
||||
pub range: TextRange,
|
||||
pub name: Identifier,
|
||||
pub parameters: Box<Parameters>,
|
||||
pub body: Vec<Stmt>,
|
||||
pub decorator_list: Vec<Decorator>,
|
||||
pub name: Identifier,
|
||||
pub type_params: Option<TypeParams>,
|
||||
pub parameters: Box<Parameters>,
|
||||
pub returns: Option<Box<Expr>>,
|
||||
pub type_params: Vec<TypeParam>,
|
||||
pub body: Vec<Stmt>,
|
||||
}
|
||||
|
||||
impl From<StmtFunctionDef> for Stmt {
|
||||
|
@ -139,12 +140,12 @@ impl From<StmtFunctionDef> for Stmt {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct StmtAsyncFunctionDef {
|
||||
pub range: TextRange,
|
||||
pub name: Identifier,
|
||||
pub parameters: Box<Parameters>,
|
||||
pub body: Vec<Stmt>,
|
||||
pub decorator_list: Vec<Decorator>,
|
||||
pub name: Identifier,
|
||||
pub type_params: Option<TypeParams>,
|
||||
pub parameters: Box<Parameters>,
|
||||
pub returns: Option<Box<Expr>>,
|
||||
pub type_params: Vec<TypeParam>,
|
||||
pub body: Vec<Stmt>,
|
||||
}
|
||||
|
||||
impl From<StmtAsyncFunctionDef> for Stmt {
|
||||
|
@ -157,11 +158,11 @@ impl From<StmtAsyncFunctionDef> for Stmt {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct StmtClassDef {
|
||||
pub range: TextRange,
|
||||
pub decorator_list: Vec<Decorator>,
|
||||
pub name: Identifier,
|
||||
pub type_params: Option<TypeParams>,
|
||||
pub arguments: Option<Arguments>,
|
||||
pub body: Vec<Stmt>,
|
||||
pub type_params: Vec<TypeParam>,
|
||||
pub decorator_list: Vec<Decorator>,
|
||||
}
|
||||
|
||||
impl StmtClassDef {
|
||||
|
@ -221,7 +222,7 @@ impl From<StmtDelete> for Stmt {
|
|||
pub struct StmtTypeAlias {
|
||||
pub range: TextRange,
|
||||
pub name: Box<Expr>,
|
||||
pub type_params: Vec<TypeParam>,
|
||||
pub type_params: Option<TypeParams>,
|
||||
pub value: Box<Expr>,
|
||||
}
|
||||
|
||||
|
@ -2120,6 +2121,29 @@ pub struct Arguments {
|
|||
pub keywords: Vec<Keyword>,
|
||||
}
|
||||
|
||||
/// An AST node used to represent a sequence of type parameters.
|
||||
///
|
||||
/// For example, given:
|
||||
/// ```python
|
||||
/// class C[T, U, V]: ...
|
||||
/// ```
|
||||
/// The `TypeParams` node would span from the left to right brackets (inclusive), and contain
|
||||
/// the `T`, `U`, and `V` type parameters in the order they appear in the source code.
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct TypeParams {
|
||||
pub range: TextRange,
|
||||
pub type_params: Vec<TypeParam>,
|
||||
}
|
||||
|
||||
impl Deref for TypeParams {
|
||||
type Target = [TypeParam];
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.type_params
|
||||
}
|
||||
}
|
||||
|
||||
pub type Suite = Vec<Stmt>;
|
||||
|
||||
impl CmpOp {
|
||||
|
@ -2952,6 +2976,11 @@ impl Ranged for crate::Pattern {
|
|||
}
|
||||
}
|
||||
|
||||
impl Ranged for crate::nodes::TypeParams {
|
||||
fn range(&self) -> TextRange {
|
||||
self.range
|
||||
}
|
||||
}
|
||||
impl Ranged for crate::nodes::TypeParamTypeVar {
|
||||
fn range(&self) -> TextRange {
|
||||
self.range
|
||||
|
@ -3003,9 +3032,9 @@ mod size_assertions {
|
|||
use super::*;
|
||||
use static_assertions::assert_eq_size;
|
||||
|
||||
assert_eq_size!(Stmt, [u8; 176]);
|
||||
assert_eq_size!(StmtFunctionDef, [u8; 128]);
|
||||
assert_eq_size!(StmtClassDef, [u8; 168]);
|
||||
assert_eq_size!(Stmt, [u8; 184]);
|
||||
assert_eq_size!(StmtFunctionDef, [u8; 136]);
|
||||
assert_eq_size!(StmtClassDef, [u8; 176]);
|
||||
assert_eq_size!(StmtTry, [u8; 104]);
|
||||
assert_eq_size!(Expr, [u8; 80]);
|
||||
assert_eq_size!(Constant, [u8; 32]);
|
||||
|
|
|
@ -5,7 +5,7 @@ pub mod preorder;
|
|||
use crate::{
|
||||
self as ast, Alias, Arguments, BoolOp, CmpOp, Comprehension, Decorator, ElifElseClause,
|
||||
ExceptHandler, Expr, ExprContext, Keyword, MatchCase, Operator, Parameter, Parameters, Pattern,
|
||||
Stmt, TypeParam, TypeParamTypeVar, UnaryOp, WithItem,
|
||||
Stmt, TypeParam, TypeParamTypeVar, TypeParams, UnaryOp, WithItem,
|
||||
};
|
||||
|
||||
/// A trait for AST visitors. Visits all nodes in the AST recursively in evaluation-order.
|
||||
|
@ -70,6 +70,9 @@ pub trait Visitor<'a> {
|
|||
fn visit_with_item(&mut self, with_item: &'a WithItem) {
|
||||
walk_with_item(self, with_item);
|
||||
}
|
||||
fn visit_type_params(&mut self, type_params: &'a TypeParams) {
|
||||
walk_type_params(self, type_params);
|
||||
}
|
||||
fn visit_type_param(&mut self, type_param: &'a TypeParam) {
|
||||
walk_type_param(self, type_param);
|
||||
}
|
||||
|
@ -116,8 +119,8 @@ pub fn walk_stmt<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, stmt: &'a Stmt) {
|
|||
for decorator in decorator_list {
|
||||
visitor.visit_decorator(decorator);
|
||||
}
|
||||
for type_param in type_params {
|
||||
visitor.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
visitor.visit_type_params(type_params);
|
||||
}
|
||||
visitor.visit_parameters(parameters);
|
||||
for expr in returns {
|
||||
|
@ -136,8 +139,8 @@ pub fn walk_stmt<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, stmt: &'a Stmt) {
|
|||
for decorator in decorator_list {
|
||||
visitor.visit_decorator(decorator);
|
||||
}
|
||||
for type_param in type_params {
|
||||
visitor.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
visitor.visit_type_params(type_params);
|
||||
}
|
||||
visitor.visit_parameters(parameters);
|
||||
for expr in returns {
|
||||
|
@ -155,8 +158,8 @@ pub fn walk_stmt<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, stmt: &'a Stmt) {
|
|||
for decorator in decorator_list {
|
||||
visitor.visit_decorator(decorator);
|
||||
}
|
||||
for type_param in type_params {
|
||||
visitor.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
visitor.visit_type_params(type_params);
|
||||
}
|
||||
if let Some(arguments) = arguments {
|
||||
visitor.visit_arguments(arguments);
|
||||
|
@ -186,8 +189,8 @@ pub fn walk_stmt<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, stmt: &'a Stmt) {
|
|||
value,
|
||||
}) => {
|
||||
visitor.visit_expr(value);
|
||||
for type_param in type_params {
|
||||
visitor.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
visitor.visit_type_params(type_params);
|
||||
}
|
||||
visitor.visit_expr(name);
|
||||
}
|
||||
|
@ -699,6 +702,12 @@ pub fn walk_with_item<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, with_item: &
|
|||
}
|
||||
}
|
||||
|
||||
pub fn walk_type_params<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, type_params: &'a TypeParams) {
|
||||
for type_param in &type_params.type_params {
|
||||
visitor.visit_type_param(type_param);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn walk_type_param<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, type_param: &'a TypeParam) {
|
||||
match type_param {
|
||||
TypeParam::TypeVar(TypeParamTypeVar {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{
|
||||
self as ast, Alias, Arguments, BoolOp, CmpOp, Comprehension, Constant, Decorator,
|
||||
ElifElseClause, ExceptHandler, Expr, Keyword, MatchCase, Mod, Operator, Parameter,
|
||||
ParameterWithDefault, Parameters, Pattern, Stmt, TypeParam, TypeParamTypeVar, UnaryOp,
|
||||
WithItem,
|
||||
ParameterWithDefault, Parameters, Pattern, Stmt, TypeParam, TypeParamTypeVar, TypeParams,
|
||||
UnaryOp, WithItem,
|
||||
};
|
||||
|
||||
/// Visitor that traverses all nodes recursively in pre-order.
|
||||
|
@ -85,6 +85,10 @@ pub trait PreorderVisitor<'a> {
|
|||
walk_with_item(self, with_item);
|
||||
}
|
||||
|
||||
fn visit_type_params(&mut self, type_params: &'a TypeParams) {
|
||||
walk_type_params(self, type_params);
|
||||
}
|
||||
|
||||
fn visit_type_param(&mut self, type_param: &'a TypeParam) {
|
||||
walk_type_param(self, type_param);
|
||||
}
|
||||
|
@ -157,8 +161,8 @@ where
|
|||
visitor.visit_decorator(decorator);
|
||||
}
|
||||
|
||||
for type_param in type_params {
|
||||
visitor.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
visitor.visit_type_params(type_params);
|
||||
}
|
||||
|
||||
visitor.visit_parameters(parameters);
|
||||
|
@ -181,8 +185,8 @@ where
|
|||
visitor.visit_decorator(decorator);
|
||||
}
|
||||
|
||||
for type_param in type_params {
|
||||
visitor.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
visitor.visit_type_params(type_params);
|
||||
}
|
||||
|
||||
if let Some(arguments) = arguments {
|
||||
|
@ -217,8 +221,8 @@ where
|
|||
value,
|
||||
}) => {
|
||||
visitor.visit_expr(name);
|
||||
for type_param in type_params {
|
||||
visitor.visit_type_param(type_param);
|
||||
if let Some(type_params) = type_params {
|
||||
visitor.visit_type_params(type_params);
|
||||
}
|
||||
visitor.visit_expr(value);
|
||||
}
|
||||
|
@ -817,6 +821,15 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn walk_type_params<'a, V>(visitor: &mut V, type_params: &'a TypeParams)
|
||||
where
|
||||
V: PreorderVisitor<'a> + ?Sized,
|
||||
{
|
||||
for type_param in &type_params.type_params {
|
||||
visitor.visit_type_param(type_param);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn walk_type_param<'a, V>(visitor: &mut V, type_param: &'a TypeParam)
|
||||
where
|
||||
V: PreorderVisitor<'a> + ?Sized,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Generate Python source code from an abstract syntax tree (AST).
|
||||
|
||||
use ruff_python_ast::ParameterWithDefault;
|
||||
use ruff_python_ast::{ParameterWithDefault, TypeParams};
|
||||
use std::ops::Deref;
|
||||
|
||||
use ruff_python_ast::{
|
||||
|
@ -222,7 +222,9 @@ impl<'a> Generator<'a> {
|
|||
statement!({
|
||||
self.p("def ");
|
||||
self.p_id(name);
|
||||
if let Some(type_params) = type_params {
|
||||
self.unparse_type_params(type_params);
|
||||
}
|
||||
self.p("(");
|
||||
self.unparse_parameters(parameters);
|
||||
self.p(")");
|
||||
|
@ -256,7 +258,9 @@ impl<'a> Generator<'a> {
|
|||
statement!({
|
||||
self.p("async def ");
|
||||
self.p_id(name);
|
||||
if let Some(type_params) = type_params {
|
||||
self.unparse_type_params(type_params);
|
||||
}
|
||||
self.p("(");
|
||||
self.unparse_parameters(parameters);
|
||||
self.p(")");
|
||||
|
@ -289,7 +293,9 @@ impl<'a> Generator<'a> {
|
|||
statement!({
|
||||
self.p("class ");
|
||||
self.p_id(name);
|
||||
if let Some(type_params) = type_params {
|
||||
self.unparse_type_params(type_params);
|
||||
}
|
||||
if let Some(arguments) = arguments {
|
||||
self.p("(");
|
||||
let mut first = true;
|
||||
|
@ -540,7 +546,9 @@ impl<'a> Generator<'a> {
|
|||
}) => {
|
||||
self.p("type ");
|
||||
self.unparse_expr(name, precedence::MAX);
|
||||
if let Some(type_params) = type_params {
|
||||
self.unparse_type_params(type_params);
|
||||
}
|
||||
self.p(" = ");
|
||||
self.unparse_expr(value, precedence::ASSIGN);
|
||||
}
|
||||
|
@ -853,17 +861,15 @@ impl<'a> Generator<'a> {
|
|||
self.body(&ast.body);
|
||||
}
|
||||
|
||||
fn unparse_type_params(&mut self, type_params: &Vec<TypeParam>) {
|
||||
if !type_params.is_empty() {
|
||||
fn unparse_type_params(&mut self, type_params: &TypeParams) {
|
||||
self.p("[");
|
||||
let mut first = true;
|
||||
for type_param in type_params {
|
||||
for type_param in type_params.iter() {
|
||||
self.p_delim(&mut first, ", ");
|
||||
self.unparse_type_param(type_param);
|
||||
}
|
||||
self.p("]");
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn unparse_type_param(&mut self, ast: &TypeParam) {
|
||||
match ast {
|
||||
|
|
|
@ -1010,14 +1010,14 @@ WithItem<Goal>: ast::WithItem = {
|
|||
};
|
||||
|
||||
FuncDef: ast::Stmt = {
|
||||
<location:@L> <decorator_list:Decorator*> <is_async:"async"?> "def" <name:Identifier> <type_params:TypeParamList?> <args:Parameters> <r:("->" <Test<"all">>)?> ":" <body:Suite> => {
|
||||
<location:@L> <decorator_list:Decorator*> <is_async:"async"?> "def" <name:Identifier> <type_params:TypeParams?> <args:Parameters> <r:("->" <Test<"all">>)?> ":" <body:Suite> => {
|
||||
let args = Box::new(args);
|
||||
let returns = r.map(Box::new);
|
||||
let end_location = body.last().unwrap().end();
|
||||
if is_async.is_some() {
|
||||
ast::StmtAsyncFunctionDef { name, parameters:args, body, decorator_list, returns, type_params: type_params.unwrap_or_default(), range: (location..end_location).into() }.into()
|
||||
ast::StmtAsyncFunctionDef { name, parameters:args, body, decorator_list, returns, type_params, range: (location..end_location).into() }.into()
|
||||
} else {
|
||||
ast::StmtFunctionDef { name, parameters:args, body, decorator_list, returns, type_params: type_params.unwrap_or_default(), range: (location..end_location).into() }.into()
|
||||
ast::StmtFunctionDef { name, parameters:args, body, decorator_list, returns, type_params, range: (location..end_location).into() }.into()
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -1029,12 +1029,12 @@ TypeAliasName: ast::Expr = {
|
|||
}
|
||||
|
||||
TypeAliasStatement: ast::Stmt = {
|
||||
<location:@L> "type" <name:TypeAliasName> <type_params:TypeParamList?> "=" <value:Test<"all">> <end_location:@R> => {
|
||||
<location:@L> "type" <name:TypeAliasName> <type_params:TypeParams?> "=" <value:Test<"all">> <end_location:@R> => {
|
||||
ast::Stmt::TypeAlias(
|
||||
ast::StmtTypeAlias {
|
||||
name: Box::new(name),
|
||||
value: Box::new(value),
|
||||
type_params: type_params.unwrap_or_default(),
|
||||
type_params,
|
||||
range: (location..end_location).into()
|
||||
},
|
||||
)
|
||||
|
@ -1194,7 +1194,7 @@ KwargParameter<ParameterType>: Option<Box<ast::Parameter>> = {
|
|||
};
|
||||
|
||||
ClassDef: ast::Stmt = {
|
||||
<location:@L> <decorator_list:Decorator*> "class" <name:Identifier> <type_params:TypeParamList?> <arguments:Arguments?> ":" <body:Suite> => {
|
||||
<location:@L> <decorator_list:Decorator*> "class" <name:Identifier> <type_params:TypeParams?> <arguments:Arguments?> ":" <body:Suite> => {
|
||||
let end_location = body.last().unwrap().end();
|
||||
ast::Stmt::ClassDef(
|
||||
ast::StmtClassDef {
|
||||
|
@ -1202,17 +1202,19 @@ ClassDef: ast::Stmt = {
|
|||
arguments,
|
||||
body,
|
||||
decorator_list,
|
||||
type_params: type_params.unwrap_or_default(),
|
||||
type_params,
|
||||
range: (location..end_location).into()
|
||||
},
|
||||
)
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
TypeParamList: Vec<ast::TypeParam> = {
|
||||
TypeParams: ast::TypeParams = {
|
||||
<location:@L> "[" <vars:OneOrMore<TypeParam>> ","? "]" <end_location:@R> => {
|
||||
vars
|
||||
ast::TypeParams {
|
||||
type_params: vars,
|
||||
range: (location..end_location).into()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// auto-generated: "lalrpop 0.20.0"
|
||||
// sha3: 3c5459b3b4420f13663b68f1bf78d526b5e5b0249d7877fe70dad50319098ef9
|
||||
// sha3: aadf067e37a9f39d450f1403b759a9659c60e697758ddd2b8c2b5fa2d0d73672
|
||||
use num_bigint::BigInt;
|
||||
use ruff_text_size::TextSize;
|
||||
use ruff_python_ast::{self as ast, Ranged, MagicKind};
|
||||
|
@ -134,8 +134,9 @@ mod __parse__Top {
|
|||
Variant88(Vec<ast::Stmt>),
|
||||
Variant89(ast::Mod),
|
||||
Variant90(ast::TypeParam),
|
||||
Variant91(core::option::Option<Vec<ast::TypeParam>>),
|
||||
Variant92(ast::UnaryOp),
|
||||
Variant91(ast::TypeParams),
|
||||
Variant92(core::option::Option<ast::TypeParams>),
|
||||
Variant93(ast::UnaryOp),
|
||||
}
|
||||
const __ACTION: &[i16] = &[
|
||||
// State 0
|
||||
|
@ -18269,13 +18270,23 @@ mod __parse__Top {
|
|||
_ => __symbol_type_mismatch()
|
||||
}
|
||||
}
|
||||
fn __pop_Variant92<
|
||||
fn __pop_Variant91<
|
||||
>(
|
||||
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
|
||||
) -> (TextSize, ast::TypeParams, TextSize)
|
||||
{
|
||||
match __symbols.pop() {
|
||||
Some((__l, __Symbol::Variant91(__v), __r)) => (__l, __v, __r),
|
||||
_ => __symbol_type_mismatch()
|
||||
}
|
||||
}
|
||||
fn __pop_Variant93<
|
||||
>(
|
||||
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
|
||||
) -> (TextSize, ast::UnaryOp, TextSize)
|
||||
{
|
||||
match __symbols.pop() {
|
||||
Some((__l, __Symbol::Variant92(__v), __r)) => (__l, __v, __r),
|
||||
Some((__l, __Symbol::Variant93(__v), __r)) => (__l, __v, __r),
|
||||
_ => __symbol_type_mismatch()
|
||||
}
|
||||
}
|
||||
|
@ -18369,16 +18380,6 @@ mod __parse__Top {
|
|||
_ => __symbol_type_mismatch()
|
||||
}
|
||||
}
|
||||
fn __pop_Variant91<
|
||||
>(
|
||||
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
|
||||
) -> (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize)
|
||||
{
|
||||
match __symbols.pop() {
|
||||
Some((__l, __Symbol::Variant91(__v), __r)) => (__l, __v, __r),
|
||||
_ => __symbol_type_mismatch()
|
||||
}
|
||||
}
|
||||
fn __pop_Variant40<
|
||||
>(
|
||||
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
|
||||
|
@ -18459,6 +18460,16 @@ mod __parse__Top {
|
|||
_ => __symbol_type_mismatch()
|
||||
}
|
||||
}
|
||||
fn __pop_Variant92<
|
||||
>(
|
||||
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
|
||||
) -> (TextSize, core::option::Option<ast::TypeParams>, TextSize)
|
||||
{
|
||||
match __symbols.pop() {
|
||||
Some((__l, __Symbol::Variant92(__v), __r)) => (__l, __v, __r),
|
||||
_ => __symbol_type_mismatch()
|
||||
}
|
||||
}
|
||||
fn __pop_Variant7<
|
||||
>(
|
||||
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
|
||||
|
@ -22026,12 +22037,12 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// ClassDef = "class", Identifier, TypeParamList, Arguments, ":", Suite => ActionFn(1712);
|
||||
// ClassDef = "class", Identifier, TypeParams, Arguments, ":", Suite => ActionFn(1712);
|
||||
assert!(__symbols.len() >= 6);
|
||||
let __sym5 = __pop_Variant24(__symbols);
|
||||
let __sym4 = __pop_Variant0(__symbols);
|
||||
let __sym3 = __pop_Variant49(__symbols);
|
||||
let __sym2 = __pop_Variant81(__symbols);
|
||||
let __sym2 = __pop_Variant91(__symbols);
|
||||
let __sym1 = __pop_Variant22(__symbols);
|
||||
let __sym0 = __pop_Variant0(__symbols);
|
||||
let __start = __sym0.0;
|
||||
|
@ -22069,12 +22080,12 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// ClassDef = Decorator+, "class", Identifier, TypeParamList, Arguments, ":", Suite => ActionFn(1714);
|
||||
// ClassDef = Decorator+, "class", Identifier, TypeParams, Arguments, ":", Suite => ActionFn(1714);
|
||||
assert!(__symbols.len() >= 7);
|
||||
let __sym6 = __pop_Variant24(__symbols);
|
||||
let __sym5 = __pop_Variant0(__symbols);
|
||||
let __sym4 = __pop_Variant49(__symbols);
|
||||
let __sym3 = __pop_Variant81(__symbols);
|
||||
let __sym3 = __pop_Variant91(__symbols);
|
||||
let __sym2 = __pop_Variant22(__symbols);
|
||||
let __sym1 = __pop_Variant0(__symbols);
|
||||
let __sym0 = __pop_Variant58(__symbols);
|
||||
|
@ -22114,11 +22125,11 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// ClassDef = "class", Identifier, TypeParamList, ":", Suite => ActionFn(1716);
|
||||
// ClassDef = "class", Identifier, TypeParams, ":", Suite => ActionFn(1716);
|
||||
assert!(__symbols.len() >= 5);
|
||||
let __sym4 = __pop_Variant24(__symbols);
|
||||
let __sym3 = __pop_Variant0(__symbols);
|
||||
let __sym2 = __pop_Variant81(__symbols);
|
||||
let __sym2 = __pop_Variant91(__symbols);
|
||||
let __sym1 = __pop_Variant22(__symbols);
|
||||
let __sym0 = __pop_Variant0(__symbols);
|
||||
let __start = __sym0.0;
|
||||
|
@ -22155,11 +22166,11 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// ClassDef = Decorator+, "class", Identifier, TypeParamList, ":", Suite => ActionFn(1718);
|
||||
// ClassDef = Decorator+, "class", Identifier, TypeParams, ":", Suite => ActionFn(1718);
|
||||
assert!(__symbols.len() >= 6);
|
||||
let __sym5 = __pop_Variant24(__symbols);
|
||||
let __sym4 = __pop_Variant0(__symbols);
|
||||
let __sym3 = __pop_Variant81(__symbols);
|
||||
let __sym3 = __pop_Variant91(__symbols);
|
||||
let __sym2 = __pop_Variant22(__symbols);
|
||||
let __sym1 = __pop_Variant0(__symbols);
|
||||
let __sym0 = __pop_Variant58(__symbols);
|
||||
|
@ -24076,7 +24087,7 @@ mod __parse__Top {
|
|||
// Factor<"all"> = UnaryOp, Factor<"all"> => ActionFn(1278);
|
||||
assert!(__symbols.len() >= 2);
|
||||
let __sym1 = __pop_Variant14(__symbols);
|
||||
let __sym0 = __pop_Variant92(__symbols);
|
||||
let __sym0 = __pop_Variant93(__symbols);
|
||||
let __start = __sym0.0;
|
||||
let __end = __sym1.2;
|
||||
let __nt = super::__action1278::<>(mode, __sym0, __sym1);
|
||||
|
@ -24110,7 +24121,7 @@ mod __parse__Top {
|
|||
// Factor<"no-withitems"> = UnaryOp, Factor<"all"> => ActionFn(1279);
|
||||
assert!(__symbols.len() >= 2);
|
||||
let __sym1 = __pop_Variant14(__symbols);
|
||||
let __sym0 = __pop_Variant92(__symbols);
|
||||
let __sym0 = __pop_Variant93(__symbols);
|
||||
let __start = __sym0.0;
|
||||
let __end = __sym1.2;
|
||||
let __nt = super::__action1279::<>(mode, __sym0, __sym1);
|
||||
|
@ -24335,14 +24346,14 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// FuncDef = "async", "def", Identifier, TypeParamList, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1720);
|
||||
// FuncDef = "async", "def", Identifier, TypeParams, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1720);
|
||||
assert!(__symbols.len() >= 9);
|
||||
let __sym8 = __pop_Variant24(__symbols);
|
||||
let __sym7 = __pop_Variant0(__symbols);
|
||||
let __sym6 = __pop_Variant14(__symbols);
|
||||
let __sym5 = __pop_Variant0(__symbols);
|
||||
let __sym4 = __pop_Variant45(__symbols);
|
||||
let __sym3 = __pop_Variant81(__symbols);
|
||||
let __sym3 = __pop_Variant91(__symbols);
|
||||
let __sym2 = __pop_Variant22(__symbols);
|
||||
let __sym1 = __pop_Variant0(__symbols);
|
||||
let __sym0 = __pop_Variant0(__symbols);
|
||||
|
@ -24384,14 +24395,14 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// FuncDef = Decorator+, "async", "def", Identifier, TypeParamList, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1722);
|
||||
// FuncDef = Decorator+, "async", "def", Identifier, TypeParams, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1722);
|
||||
assert!(__symbols.len() >= 10);
|
||||
let __sym9 = __pop_Variant24(__symbols);
|
||||
let __sym8 = __pop_Variant0(__symbols);
|
||||
let __sym7 = __pop_Variant14(__symbols);
|
||||
let __sym6 = __pop_Variant0(__symbols);
|
||||
let __sym5 = __pop_Variant45(__symbols);
|
||||
let __sym4 = __pop_Variant81(__symbols);
|
||||
let __sym4 = __pop_Variant91(__symbols);
|
||||
let __sym3 = __pop_Variant22(__symbols);
|
||||
let __sym2 = __pop_Variant0(__symbols);
|
||||
let __sym1 = __pop_Variant0(__symbols);
|
||||
|
@ -24435,12 +24446,12 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// FuncDef = "async", "def", Identifier, TypeParamList, Parameters, ":", Suite => ActionFn(1724);
|
||||
// FuncDef = "async", "def", Identifier, TypeParams, Parameters, ":", Suite => ActionFn(1724);
|
||||
assert!(__symbols.len() >= 7);
|
||||
let __sym6 = __pop_Variant24(__symbols);
|
||||
let __sym5 = __pop_Variant0(__symbols);
|
||||
let __sym4 = __pop_Variant45(__symbols);
|
||||
let __sym3 = __pop_Variant81(__symbols);
|
||||
let __sym3 = __pop_Variant91(__symbols);
|
||||
let __sym2 = __pop_Variant22(__symbols);
|
||||
let __sym1 = __pop_Variant0(__symbols);
|
||||
let __sym0 = __pop_Variant0(__symbols);
|
||||
|
@ -24480,12 +24491,12 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// FuncDef = Decorator+, "async", "def", Identifier, TypeParamList, Parameters, ":", Suite => ActionFn(1726);
|
||||
// FuncDef = Decorator+, "async", "def", Identifier, TypeParams, Parameters, ":", Suite => ActionFn(1726);
|
||||
assert!(__symbols.len() >= 8);
|
||||
let __sym7 = __pop_Variant24(__symbols);
|
||||
let __sym6 = __pop_Variant0(__symbols);
|
||||
let __sym5 = __pop_Variant45(__symbols);
|
||||
let __sym4 = __pop_Variant81(__symbols);
|
||||
let __sym4 = __pop_Variant91(__symbols);
|
||||
let __sym3 = __pop_Variant22(__symbols);
|
||||
let __sym2 = __pop_Variant0(__symbols);
|
||||
let __sym1 = __pop_Variant0(__symbols);
|
||||
|
@ -24527,14 +24538,14 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// FuncDef = "def", Identifier, TypeParamList, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1728);
|
||||
// FuncDef = "def", Identifier, TypeParams, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1728);
|
||||
assert!(__symbols.len() >= 8);
|
||||
let __sym7 = __pop_Variant24(__symbols);
|
||||
let __sym6 = __pop_Variant0(__symbols);
|
||||
let __sym5 = __pop_Variant14(__symbols);
|
||||
let __sym4 = __pop_Variant0(__symbols);
|
||||
let __sym3 = __pop_Variant45(__symbols);
|
||||
let __sym2 = __pop_Variant81(__symbols);
|
||||
let __sym2 = __pop_Variant91(__symbols);
|
||||
let __sym1 = __pop_Variant22(__symbols);
|
||||
let __sym0 = __pop_Variant0(__symbols);
|
||||
let __start = __sym0.0;
|
||||
|
@ -24574,14 +24585,14 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// FuncDef = Decorator+, "def", Identifier, TypeParamList, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1730);
|
||||
// FuncDef = Decorator+, "def", Identifier, TypeParams, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1730);
|
||||
assert!(__symbols.len() >= 9);
|
||||
let __sym8 = __pop_Variant24(__symbols);
|
||||
let __sym7 = __pop_Variant0(__symbols);
|
||||
let __sym6 = __pop_Variant14(__symbols);
|
||||
let __sym5 = __pop_Variant0(__symbols);
|
||||
let __sym4 = __pop_Variant45(__symbols);
|
||||
let __sym3 = __pop_Variant81(__symbols);
|
||||
let __sym3 = __pop_Variant91(__symbols);
|
||||
let __sym2 = __pop_Variant22(__symbols);
|
||||
let __sym1 = __pop_Variant0(__symbols);
|
||||
let __sym0 = __pop_Variant58(__symbols);
|
||||
|
@ -24623,12 +24634,12 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// FuncDef = "def", Identifier, TypeParamList, Parameters, ":", Suite => ActionFn(1732);
|
||||
// FuncDef = "def", Identifier, TypeParams, Parameters, ":", Suite => ActionFn(1732);
|
||||
assert!(__symbols.len() >= 6);
|
||||
let __sym5 = __pop_Variant24(__symbols);
|
||||
let __sym4 = __pop_Variant0(__symbols);
|
||||
let __sym3 = __pop_Variant45(__symbols);
|
||||
let __sym2 = __pop_Variant81(__symbols);
|
||||
let __sym2 = __pop_Variant91(__symbols);
|
||||
let __sym1 = __pop_Variant22(__symbols);
|
||||
let __sym0 = __pop_Variant0(__symbols);
|
||||
let __start = __sym0.0;
|
||||
|
@ -24666,12 +24677,12 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// FuncDef = Decorator+, "def", Identifier, TypeParamList, Parameters, ":", Suite => ActionFn(1734);
|
||||
// FuncDef = Decorator+, "def", Identifier, TypeParams, Parameters, ":", Suite => ActionFn(1734);
|
||||
assert!(__symbols.len() >= 7);
|
||||
let __sym6 = __pop_Variant24(__symbols);
|
||||
let __sym5 = __pop_Variant0(__symbols);
|
||||
let __sym4 = __pop_Variant45(__symbols);
|
||||
let __sym3 = __pop_Variant81(__symbols);
|
||||
let __sym3 = __pop_Variant91(__symbols);
|
||||
let __sym2 = __pop_Variant22(__symbols);
|
||||
let __sym1 = __pop_Variant0(__symbols);
|
||||
let __sym0 = __pop_Variant58(__symbols);
|
||||
|
@ -29792,11 +29803,11 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// TypeAliasStatement = "type", TypeAliasName, TypeParamList, "=", Test<"all"> => ActionFn(1736);
|
||||
// TypeAliasStatement = "type", TypeAliasName, TypeParams, "=", Test<"all"> => ActionFn(1736);
|
||||
assert!(__symbols.len() >= 5);
|
||||
let __sym4 = __pop_Variant14(__symbols);
|
||||
let __sym3 = __pop_Variant0(__symbols);
|
||||
let __sym2 = __pop_Variant81(__symbols);
|
||||
let __sym2 = __pop_Variant91(__symbols);
|
||||
let __sym1 = __pop_Variant14(__symbols);
|
||||
let __sym0 = __pop_Variant0(__symbols);
|
||||
let __start = __sym0.0;
|
||||
|
@ -29904,7 +29915,7 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// TypeParamList = "[", OneOrMore<TypeParam>, ",", "]" => ActionFn(1462);
|
||||
// TypeParams = "[", OneOrMore<TypeParam>, ",", "]" => ActionFn(1462);
|
||||
assert!(__symbols.len() >= 4);
|
||||
let __sym3 = __pop_Variant0(__symbols);
|
||||
let __sym2 = __pop_Variant0(__symbols);
|
||||
|
@ -29913,7 +29924,7 @@ mod __parse__Top {
|
|||
let __start = __sym0.0;
|
||||
let __end = __sym3.2;
|
||||
let __nt = super::__action1462::<>(mode, __sym0, __sym1, __sym2, __sym3);
|
||||
__symbols.push((__start, __Symbol::Variant81(__nt), __end));
|
||||
__symbols.push((__start, __Symbol::Variant91(__nt), __end));
|
||||
(4, 260)
|
||||
}
|
||||
pub(crate) fn __reduce876<
|
||||
|
@ -29924,7 +29935,7 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// TypeParamList = "[", OneOrMore<TypeParam>, "]" => ActionFn(1463);
|
||||
// TypeParams = "[", OneOrMore<TypeParam>, "]" => ActionFn(1463);
|
||||
assert!(__symbols.len() >= 3);
|
||||
let __sym2 = __pop_Variant0(__symbols);
|
||||
let __sym1 = __pop_Variant81(__symbols);
|
||||
|
@ -29932,7 +29943,7 @@ mod __parse__Top {
|
|||
let __start = __sym0.0;
|
||||
let __end = __sym2.2;
|
||||
let __nt = super::__action1463::<>(mode, __sym0, __sym1, __sym2);
|
||||
__symbols.push((__start, __Symbol::Variant81(__nt), __end));
|
||||
__symbols.push((__start, __Symbol::Variant91(__nt), __end));
|
||||
(3, 260)
|
||||
}
|
||||
pub(crate) fn __reduce877<
|
||||
|
@ -29943,12 +29954,12 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// TypeParamList? = TypeParamList => ActionFn(284);
|
||||
let __sym0 = __pop_Variant81(__symbols);
|
||||
// TypeParams? = TypeParams => ActionFn(284);
|
||||
let __sym0 = __pop_Variant91(__symbols);
|
||||
let __start = __sym0.0;
|
||||
let __end = __sym0.2;
|
||||
let __nt = super::__action284::<>(mode, __sym0);
|
||||
__symbols.push((__start, __Symbol::Variant91(__nt), __end));
|
||||
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
|
||||
(1, 261)
|
||||
}
|
||||
pub(crate) fn __reduce878<
|
||||
|
@ -29959,11 +29970,11 @@ mod __parse__Top {
|
|||
_: core::marker::PhantomData<()>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// TypeParamList? = => ActionFn(285);
|
||||
// TypeParams? = => ActionFn(285);
|
||||
let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default();
|
||||
let __end = __start.clone();
|
||||
let __nt = super::__action285::<>(mode, &__start, &__end);
|
||||
__symbols.push((__start, __Symbol::Variant91(__nt), __end));
|
||||
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
|
||||
(0, 261)
|
||||
}
|
||||
pub(crate) fn __reduce879<
|
||||
|
@ -30014,7 +30025,7 @@ mod __parse__Top {
|
|||
let __start = __sym0.0;
|
||||
let __end = __sym0.2;
|
||||
let __nt = super::__action201::<>(mode, __sym0);
|
||||
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
|
||||
__symbols.push((__start, __Symbol::Variant93(__nt), __end));
|
||||
(1, 263)
|
||||
}
|
||||
pub(crate) fn __reduce882<
|
||||
|
@ -30030,7 +30041,7 @@ mod __parse__Top {
|
|||
let __start = __sym0.0;
|
||||
let __end = __sym0.2;
|
||||
let __nt = super::__action202::<>(mode, __sym0);
|
||||
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
|
||||
__symbols.push((__start, __Symbol::Variant93(__nt), __end));
|
||||
(1, 263)
|
||||
}
|
||||
pub(crate) fn __reduce883<
|
||||
|
@ -30046,7 +30057,7 @@ mod __parse__Top {
|
|||
let __start = __sym0.0;
|
||||
let __end = __sym0.2;
|
||||
let __nt = super::__action203::<>(mode, __sym0);
|
||||
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
|
||||
__symbols.push((__start, __Symbol::Variant93(__nt), __end));
|
||||
(1, 263)
|
||||
}
|
||||
pub(crate) fn __reduce884<
|
||||
|
@ -33385,7 +33396,7 @@ fn __action161<
|
|||
(_, is_async, _): (TextSize, core::option::Option<token::Tok>, TextSize),
|
||||
(_, _, _): (TextSize, token::Tok, TextSize),
|
||||
(_, name, _): (TextSize, ast::Identifier, TextSize),
|
||||
(_, type_params, _): (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
(_, type_params, _): (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
(_, args, _): (TextSize, ast::Parameters, TextSize),
|
||||
(_, r, _): (TextSize, core::option::Option<ast::Expr>, TextSize),
|
||||
(_, _, _): (TextSize, token::Tok, TextSize),
|
||||
|
@ -33397,9 +33408,9 @@ fn __action161<
|
|||
let returns = r.map(Box::new);
|
||||
let end_location = body.last().unwrap().end();
|
||||
if is_async.is_some() {
|
||||
ast::StmtAsyncFunctionDef { name, parameters:args, body, decorator_list, returns, type_params: type_params.unwrap_or_default(), range: (location..end_location).into() }.into()
|
||||
ast::StmtAsyncFunctionDef { name, parameters:args, body, decorator_list, returns, type_params, range: (location..end_location).into() }.into()
|
||||
} else {
|
||||
ast::StmtFunctionDef { name, parameters:args, body, decorator_list, returns, type_params: type_params.unwrap_or_default(), range: (location..end_location).into() }.into()
|
||||
ast::StmtFunctionDef { name, parameters:args, body, decorator_list, returns, type_params, range: (location..end_location).into() }.into()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33427,7 +33438,7 @@ fn __action163<
|
|||
(_, location, _): (TextSize, TextSize, TextSize),
|
||||
(_, _, _): (TextSize, token::Tok, TextSize),
|
||||
(_, name, _): (TextSize, ast::Expr, TextSize),
|
||||
(_, type_params, _): (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
(_, type_params, _): (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
(_, _, _): (TextSize, token::Tok, TextSize),
|
||||
(_, value, _): (TextSize, ast::Expr, TextSize),
|
||||
(_, end_location, _): (TextSize, TextSize, TextSize),
|
||||
|
@ -33438,7 +33449,7 @@ fn __action163<
|
|||
ast::StmtTypeAlias {
|
||||
name: Box::new(name),
|
||||
value: Box::new(value),
|
||||
type_params: type_params.unwrap_or_default(),
|
||||
type_params,
|
||||
range: (location..end_location).into()
|
||||
},
|
||||
)
|
||||
|
@ -33561,7 +33572,7 @@ fn __action170<
|
|||
(_, decorator_list, _): (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
(_, _, _): (TextSize, token::Tok, TextSize),
|
||||
(_, name, _): (TextSize, ast::Identifier, TextSize),
|
||||
(_, type_params, _): (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
(_, type_params, _): (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
(_, arguments, _): (TextSize, core::option::Option<ast::Arguments>, TextSize),
|
||||
(_, _, _): (TextSize, token::Tok, TextSize),
|
||||
(_, body, _): (TextSize, ast::Suite, TextSize),
|
||||
|
@ -33575,7 +33586,7 @@ fn __action170<
|
|||
arguments,
|
||||
body,
|
||||
decorator_list,
|
||||
type_params: type_params.unwrap_or_default(),
|
||||
type_params,
|
||||
range: (location..end_location).into()
|
||||
},
|
||||
)
|
||||
|
@ -33593,10 +33604,13 @@ fn __action171<
|
|||
(_, _, _): (TextSize, core::option::Option<token::Tok>, TextSize),
|
||||
(_, _, _): (TextSize, token::Tok, TextSize),
|
||||
(_, end_location, _): (TextSize, TextSize, TextSize),
|
||||
) -> Vec<ast::TypeParam>
|
||||
) -> ast::TypeParams
|
||||
{
|
||||
{
|
||||
vars
|
||||
ast::TypeParams {
|
||||
type_params: vars,
|
||||
range: (location..end_location).into()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35226,8 +35240,8 @@ fn __action283<
|
|||
fn __action284<
|
||||
>(
|
||||
mode: Mode,
|
||||
(_, __0, _): (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
) -> core::option::Option<Vec<ast::TypeParam>>
|
||||
(_, __0, _): (TextSize, ast::TypeParams, TextSize),
|
||||
) -> core::option::Option<ast::TypeParams>
|
||||
{
|
||||
Some(__0)
|
||||
}
|
||||
|
@ -35239,7 +35253,7 @@ fn __action285<
|
|||
mode: Mode,
|
||||
__lookbehind: &TextSize,
|
||||
__lookahead: &TextSize,
|
||||
) -> core::option::Option<Vec<ast::TypeParam>>
|
||||
) -> core::option::Option<ast::TypeParams>
|
||||
{
|
||||
None
|
||||
}
|
||||
|
@ -41093,7 +41107,7 @@ fn __action641<
|
|||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, TextSize, TextSize),
|
||||
) -> Vec<ast::TypeParam>
|
||||
) -> ast::TypeParams
|
||||
{
|
||||
let __start0 = __3.0;
|
||||
let __end0 = __3.2;
|
||||
|
@ -41123,7 +41137,7 @@ fn __action642<
|
|||
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, TextSize, TextSize),
|
||||
) -> Vec<ast::TypeParam>
|
||||
) -> ast::TypeParams
|
||||
{
|
||||
let __start0 = __2.2;
|
||||
let __end0 = __3.0;
|
||||
|
@ -41568,7 +41582,7 @@ fn __action657<
|
|||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, ast::Identifier, TextSize),
|
||||
__5: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__5: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__6: (TextSize, ast::Parameters, TextSize),
|
||||
__7: (TextSize, core::option::Option<ast::Expr>, TextSize),
|
||||
__8: (TextSize, token::Tok, TextSize),
|
||||
|
@ -41606,7 +41620,7 @@ fn __action658<
|
|||
__1: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__5: (TextSize, ast::Parameters, TextSize),
|
||||
__6: (TextSize, core::option::Option<ast::Expr>, TextSize),
|
||||
__7: (TextSize, token::Tok, TextSize),
|
||||
|
@ -44422,7 +44436,7 @@ fn __action757<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, core::option::Option<ast::Arguments>, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -45650,7 +45664,7 @@ fn __action798<
|
|||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__5: (TextSize, ast::Parameters, TextSize),
|
||||
__6: (TextSize, core::option::Option<ast::Expr>, TextSize),
|
||||
__7: (TextSize, token::Tok, TextSize),
|
||||
|
@ -45688,7 +45702,7 @@ fn __action799<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, core::option::Option<ast::Expr>, TextSize),
|
||||
__6: (TextSize, token::Tok, TextSize),
|
||||
|
@ -49144,7 +49158,7 @@ fn __action921<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Expr, TextSize),
|
||||
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, ast::Expr, TextSize),
|
||||
__5: (TextSize, TextSize, TextSize),
|
||||
|
@ -49261,7 +49275,7 @@ fn __action925<
|
|||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, TextSize, TextSize),
|
||||
) -> Vec<ast::TypeParam>
|
||||
) -> ast::TypeParams
|
||||
{
|
||||
let __start0 = __0.0;
|
||||
let __end0 = __0.0;
|
||||
|
@ -49291,7 +49305,7 @@ fn __action926<
|
|||
__1: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, TextSize, TextSize),
|
||||
) -> Vec<ast::TypeParam>
|
||||
) -> ast::TypeParams
|
||||
{
|
||||
let __start0 = __0.0;
|
||||
let __end0 = __0.0;
|
||||
|
@ -53480,7 +53494,7 @@ fn __action1073<
|
|||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__5: (TextSize, ast::Parameters, TextSize),
|
||||
__6: (TextSize, token::Tok, TextSize),
|
||||
__7: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -53519,7 +53533,7 @@ fn __action1074<
|
|||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__5: (TextSize, ast::Parameters, TextSize),
|
||||
__6: (TextSize, token::Tok, TextSize),
|
||||
__7: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -53555,7 +53569,7 @@ fn __action1075<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -53592,7 +53606,7 @@ fn __action1076<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -64235,7 +64249,7 @@ fn __action1457<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Expr, TextSize),
|
||||
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, ast::Expr, TextSize),
|
||||
) -> ast::Stmt
|
||||
|
@ -64368,7 +64382,7 @@ fn __action1462<
|
|||
__1: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
) -> Vec<ast::TypeParam>
|
||||
) -> ast::TypeParams
|
||||
{
|
||||
let __start0 = __3.2;
|
||||
let __end0 = __3.2;
|
||||
|
@ -64396,7 +64410,7 @@ fn __action1463<
|
|||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
) -> Vec<ast::TypeParam>
|
||||
) -> ast::TypeParams
|
||||
{
|
||||
let __start0 = __2.2;
|
||||
let __end0 = __2.2;
|
||||
|
@ -65355,7 +65369,7 @@ fn __action1500<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, ast::Arguments, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -65388,7 +65402,7 @@ fn __action1501<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, ast::Suite, TextSize),
|
||||
) -> ast::Stmt
|
||||
|
@ -66070,7 +66084,7 @@ fn __action1528<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Identifier, TextSize),
|
||||
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__3: (TextSize, ast::Arguments, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -66104,7 +66118,7 @@ fn __action1529<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, ast::Arguments, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -66136,7 +66150,7 @@ fn __action1530<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Identifier, TextSize),
|
||||
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, ast::Suite, TextSize),
|
||||
) -> ast::Stmt
|
||||
|
@ -66168,7 +66182,7 @@ fn __action1531<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, ast::Suite, TextSize),
|
||||
) -> ast::Stmt
|
||||
|
@ -66199,7 +66213,7 @@ fn __action1532<
|
|||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -66239,7 +66253,7 @@ fn __action1533<
|
|||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__5: (TextSize, ast::Parameters, TextSize),
|
||||
__6: (TextSize, token::Tok, TextSize),
|
||||
__7: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -66277,7 +66291,7 @@ fn __action1534<
|
|||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -66313,7 +66327,7 @@ fn __action1535<
|
|||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__5: (TextSize, ast::Parameters, TextSize),
|
||||
__6: (TextSize, token::Tok, TextSize),
|
||||
__7: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -66346,7 +66360,7 @@ fn __action1536<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Identifier, TextSize),
|
||||
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__3: (TextSize, ast::Parameters, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -66384,7 +66398,7 @@ fn __action1537<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -66420,7 +66434,7 @@ fn __action1538<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Identifier, TextSize),
|
||||
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__3: (TextSize, ast::Parameters, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -66454,7 +66468,7 @@ fn __action1539<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -71718,7 +71732,7 @@ fn __action1712<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Identifier, TextSize),
|
||||
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__2: (TextSize, ast::TypeParams, TextSize),
|
||||
__3: (TextSize, ast::Arguments, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -71781,7 +71795,7 @@ fn __action1714<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__3: (TextSize, ast::TypeParams, TextSize),
|
||||
__4: (TextSize, ast::Arguments, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -71846,7 +71860,7 @@ fn __action1716<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Identifier, TextSize),
|
||||
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__2: (TextSize, ast::TypeParams, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, ast::Suite, TextSize),
|
||||
) -> ast::Stmt
|
||||
|
@ -71905,7 +71919,7 @@ fn __action1718<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__3: (TextSize, ast::TypeParams, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, ast::Suite, TextSize),
|
||||
) -> ast::Stmt
|
||||
|
@ -71967,7 +71981,7 @@ fn __action1720<
|
|||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__3: (TextSize, ast::TypeParams, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -72042,7 +72056,7 @@ fn __action1722<
|
|||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__4: (TextSize, ast::TypeParams, TextSize),
|
||||
__5: (TextSize, ast::Parameters, TextSize),
|
||||
__6: (TextSize, token::Tok, TextSize),
|
||||
__7: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -72119,7 +72133,7 @@ fn __action1724<
|
|||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__3: (TextSize, ast::TypeParams, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -72186,7 +72200,7 @@ fn __action1726<
|
|||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__4: (TextSize, ast::TypeParams, TextSize),
|
||||
__5: (TextSize, ast::Parameters, TextSize),
|
||||
__6: (TextSize, token::Tok, TextSize),
|
||||
__7: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -72254,7 +72268,7 @@ fn __action1728<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Identifier, TextSize),
|
||||
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__2: (TextSize, ast::TypeParams, TextSize),
|
||||
__3: (TextSize, ast::Parameters, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -72325,7 +72339,7 @@ fn __action1730<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__3: (TextSize, ast::TypeParams, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Expr, TextSize),
|
||||
|
@ -72398,7 +72412,7 @@ fn __action1732<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Identifier, TextSize),
|
||||
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__2: (TextSize, ast::TypeParams, TextSize),
|
||||
__3: (TextSize, ast::Parameters, TextSize),
|
||||
__4: (TextSize, token::Tok, TextSize),
|
||||
__5: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -72461,7 +72475,7 @@ fn __action1734<
|
|||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, token::Tok, TextSize),
|
||||
__2: (TextSize, ast::Identifier, TextSize),
|
||||
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__3: (TextSize, ast::TypeParams, TextSize),
|
||||
__4: (TextSize, ast::Parameters, TextSize),
|
||||
__5: (TextSize, token::Tok, TextSize),
|
||||
__6: (TextSize, ast::Suite, TextSize),
|
||||
|
@ -72526,7 +72540,7 @@ fn __action1736<
|
|||
mode: Mode,
|
||||
__0: (TextSize, token::Tok, TextSize),
|
||||
__1: (TextSize, ast::Expr, TextSize),
|
||||
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
|
||||
__2: (TextSize, ast::TypeParams, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, ast::Expr, TextSize),
|
||||
) -> ast::Stmt
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..23,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..17,
|
||||
posonlyargs: [],
|
||||
|
@ -56,6 +58,7 @@ Ok(
|
|||
],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -63,9 +66,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..29,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..23,
|
||||
posonlyargs: [],
|
||||
|
@ -76,6 +78,7 @@ Ok(
|
|||
],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -83,9 +86,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..13,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..7,
|
||||
posonlyargs: [],
|
||||
|
@ -19,6 +21,7 @@ Ok(
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -26,9 +29,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..13,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..7,
|
||||
posonlyargs: [],
|
||||
|
@ -19,6 +21,7 @@ Ok(
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -26,9 +29,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..32,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..26,
|
||||
posonlyargs: [],
|
||||
|
@ -93,6 +95,7 @@ Ok(
|
|||
],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -100,9 +103,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..38,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..32,
|
||||
posonlyargs: [],
|
||||
|
@ -113,6 +115,7 @@ Ok(
|
|||
],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -120,9 +123,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..42,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..36,
|
||||
posonlyargs: [],
|
||||
|
@ -122,6 +124,7 @@ Ok(
|
|||
],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -129,9 +132,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..52,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..46,
|
||||
posonlyargs: [],
|
||||
|
@ -131,6 +133,7 @@ Ok(
|
|||
},
|
||||
),
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -138,9 +141,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..20,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..14,
|
||||
posonlyargs: [],
|
||||
|
@ -56,6 +58,7 @@ Ok(
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -63,9 +66,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..26,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..20,
|
||||
posonlyargs: [],
|
||||
|
@ -76,6 +78,7 @@ Ok(
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -83,9 +86,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -7,10 +7,12 @@ Ok(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..20,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "f",
|
||||
range: 4..5,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 5..14,
|
||||
posonlyargs: [],
|
||||
|
@ -56,6 +58,7 @@ Ok(
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -63,9 +66,6 @@ Ok(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -6,25 +6,6 @@ expression: parse_ast
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..34,
|
||||
name: Identifier {
|
||||
id: "test",
|
||||
range: 18..22,
|
||||
},
|
||||
parameters: Parameters {
|
||||
range: 22..24,
|
||||
posonlyargs: [],
|
||||
args: [],
|
||||
vararg: None,
|
||||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
range: 30..34,
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [
|
||||
Decorator {
|
||||
range: 0..13,
|
||||
|
@ -37,26 +18,32 @@ expression: parse_ast
|
|||
),
|
||||
},
|
||||
],
|
||||
name: Identifier {
|
||||
id: "test",
|
||||
range: 18..22,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 22..24,
|
||||
posonlyargs: [],
|
||||
args: [],
|
||||
vararg: None,
|
||||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
type_params: [],
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
range: 30..34,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 36..73,
|
||||
name: Identifier {
|
||||
id: "Abcd",
|
||||
range: 59..63,
|
||||
},
|
||||
arguments: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
range: 69..73,
|
||||
},
|
||||
),
|
||||
],
|
||||
type_params: [],
|
||||
decorator_list: [
|
||||
Decorator {
|
||||
range: 36..52,
|
||||
|
@ -69,6 +56,19 @@ expression: parse_ast
|
|||
),
|
||||
},
|
||||
],
|
||||
name: Identifier {
|
||||
id: "Abcd",
|
||||
range: 59..63,
|
||||
},
|
||||
type_params: None,
|
||||
arguments: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
range: 69..73,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
|
@ -125,10 +125,12 @@ Module(
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 566..626,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "foo",
|
||||
range: 570..573,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 573..575,
|
||||
posonlyargs: [],
|
||||
|
@ -137,6 +139,7 @@ Module(
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Return(
|
||||
StmtReturn {
|
||||
|
@ -170,9 +173,6 @@ Module(
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
LineMagic(
|
||||
|
|
|
@ -6,10 +6,12 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 0..98,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "Foo",
|
||||
range: 6..9,
|
||||
},
|
||||
type_params: None,
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 9..15,
|
||||
|
@ -36,10 +38,12 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 18..44,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "__init__",
|
||||
range: 22..30,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 30..36,
|
||||
posonlyargs: [],
|
||||
|
@ -61,6 +65,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -68,18 +73,17 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 46..98,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "method_with_default",
|
||||
range: 50..69,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 69..90,
|
||||
posonlyargs: [],
|
||||
|
@ -123,6 +127,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
|
@ -130,14 +135,9 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
type_params: [],
|
||||
decorator_list: [],
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
|
@ -6,10 +6,28 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 10..29,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "Foo",
|
||||
range: 16..19,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 19..22,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 20..21,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 20..21,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 22..24,
|
||||
|
@ -31,28 +49,41 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 20..21,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 20..21,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
},
|
||||
),
|
||||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 52..76,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "Foo",
|
||||
range: 58..61,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 61..69,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 62..68,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 62..63,
|
||||
},
|
||||
bound: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 65..68,
|
||||
id: "str",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 69..71,
|
||||
|
@ -74,57 +105,19 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 62..68,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 62..63,
|
||||
},
|
||||
bound: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 65..68,
|
||||
id: "str",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
},
|
||||
),
|
||||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 105..138,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "Foo",
|
||||
range: 111..114,
|
||||
},
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 131..133,
|
||||
args: [],
|
||||
keywords: [],
|
||||
},
|
||||
),
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 135..138,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 135..138,
|
||||
value: Ellipsis,
|
||||
kind: None,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 114..131,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -160,16 +153,66 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
},
|
||||
),
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 131..133,
|
||||
args: [],
|
||||
keywords: [],
|
||||
},
|
||||
),
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 135..138,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 135..138,
|
||||
value: Ellipsis,
|
||||
kind: None,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 159..181,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "Foo",
|
||||
range: 165..168,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 168..174,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 169..170,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 169..170,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 172..173,
|
||||
name: Identifier {
|
||||
id: "U",
|
||||
range: 172..173,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 174..176,
|
||||
|
@ -191,38 +234,43 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 169..170,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 169..170,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 172..173,
|
||||
name: Identifier {
|
||||
id: "U",
|
||||
range: 172..173,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
},
|
||||
),
|
||||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 200..223,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "Foo",
|
||||
range: 206..209,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 209..216,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 210..211,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 210..211,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 213..214,
|
||||
name: Identifier {
|
||||
id: "U",
|
||||
range: 213..214,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 216..218,
|
||||
|
@ -244,38 +292,32 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 210..211,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 210..211,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 213..214,
|
||||
name: Identifier {
|
||||
id: "U",
|
||||
range: 213..214,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
},
|
||||
),
|
||||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 240..261,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "Foo",
|
||||
range: 246..249,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 249..254,
|
||||
type_params: [
|
||||
TypeVarTuple(
|
||||
TypeParamTypeVarTuple {
|
||||
range: 250..253,
|
||||
name: Identifier {
|
||||
id: "Ts",
|
||||
range: 251..253,
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 254..256,
|
||||
|
@ -297,27 +339,32 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
type_params: [
|
||||
TypeVarTuple(
|
||||
TypeParamTypeVarTuple {
|
||||
range: 250..253,
|
||||
name: Identifier {
|
||||
id: "Ts",
|
||||
range: 251..253,
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
},
|
||||
),
|
||||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 275..296,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "Foo",
|
||||
range: 281..284,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 284..289,
|
||||
type_params: [
|
||||
ParamSpec(
|
||||
TypeParamParamSpec {
|
||||
range: 285..288,
|
||||
name: Identifier {
|
||||
id: "P",
|
||||
range: 287..288,
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 289..291,
|
||||
|
@ -339,41 +386,19 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
type_params: [
|
||||
ParamSpec(
|
||||
TypeParamParamSpec {
|
||||
range: 285..288,
|
||||
name: Identifier {
|
||||
id: "P",
|
||||
range: 287..288,
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
},
|
||||
),
|
||||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 312..351,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "Foo",
|
||||
range: 318..321,
|
||||
},
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 341..343,
|
||||
args: [],
|
||||
keywords: [],
|
||||
},
|
||||
),
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
range: 347..351,
|
||||
},
|
||||
),
|
||||
],
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 321..341,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -422,7 +447,22 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
},
|
||||
),
|
||||
arguments: Some(
|
||||
Arguments {
|
||||
range: 341..343,
|
||||
args: [],
|
||||
keywords: [],
|
||||
},
|
||||
),
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
range: 347..351,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
|
@ -6,10 +6,12 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 0..20,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "func",
|
||||
range: 4..8,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 8..11,
|
||||
posonlyargs: [],
|
||||
|
@ -31,6 +33,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
|
@ -45,18 +48,33 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [],
|
||||
},
|
||||
),
|
||||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 22..53,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "func",
|
||||
range: 26..30,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 30..33,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 31..32,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 31..32,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
parameters: Parameters {
|
||||
range: 33..39,
|
||||
posonlyargs: [],
|
||||
|
@ -86,6 +104,15 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 43..44,
|
||||
id: "T",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
|
@ -100,37 +127,41 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 43..44,
|
||||
id: "T",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 31..32,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 31..32,
|
||||
},
|
||||
bound: None,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 55..91,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "func",
|
||||
range: 59..63,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 63..71,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 64..70,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 64..65,
|
||||
},
|
||||
bound: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 67..70,
|
||||
id: "str",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
parameters: Parameters {
|
||||
range: 71..77,
|
||||
posonlyargs: [],
|
||||
|
@ -160,21 +191,6 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 88..91,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 88..91,
|
||||
value: Ellipsis,
|
||||
kind: None,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
|
@ -184,22 +200,16 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
),
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
range: 64..70,
|
||||
name: Identifier {
|
||||
id: "T",
|
||||
range: 64..65,
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 88..91,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 88..91,
|
||||
value: Ellipsis,
|
||||
kind: None,
|
||||
},
|
||||
bound: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 67..70,
|
||||
id: "str",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
|
@ -209,63 +219,14 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 93..138,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "func",
|
||||
range: 97..101,
|
||||
},
|
||||
parameters: Parameters {
|
||||
range: 118..124,
|
||||
posonlyargs: [],
|
||||
args: [
|
||||
ParameterWithDefault {
|
||||
range: 119..123,
|
||||
parameter: Parameter {
|
||||
range: 119..123,
|
||||
name: Identifier {
|
||||
id: "a",
|
||||
range: 119..120,
|
||||
},
|
||||
annotation: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 122..123,
|
||||
id: "T",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
},
|
||||
default: None,
|
||||
},
|
||||
],
|
||||
vararg: None,
|
||||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 135..138,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 135..138,
|
||||
value: Ellipsis,
|
||||
kind: None,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 128..129,
|
||||
id: "T",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 101..118,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -303,13 +264,84 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
],
|
||||
},
|
||||
),
|
||||
parameters: Parameters {
|
||||
range: 118..124,
|
||||
posonlyargs: [],
|
||||
args: [
|
||||
ParameterWithDefault {
|
||||
range: 119..123,
|
||||
parameter: Parameter {
|
||||
range: 119..123,
|
||||
name: Identifier {
|
||||
id: "a",
|
||||
range: 119..120,
|
||||
},
|
||||
annotation: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 122..123,
|
||||
id: "T",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
},
|
||||
default: None,
|
||||
},
|
||||
],
|
||||
vararg: None,
|
||||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: Some(
|
||||
Name(
|
||||
ExprName {
|
||||
range: 128..129,
|
||||
id: "T",
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
),
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 135..138,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 135..138,
|
||||
value: Ellipsis,
|
||||
kind: None,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 140..171,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "func",
|
||||
range: 144..148,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 148..153,
|
||||
type_params: [
|
||||
TypeVarTuple(
|
||||
TypeParamTypeVarTuple {
|
||||
range: 149..152,
|
||||
name: Identifier {
|
||||
id: "Ts",
|
||||
range: 150..152,
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
parameters: Parameters {
|
||||
range: 153..162,
|
||||
posonlyargs: [],
|
||||
|
@ -341,6 +373,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
|
@ -355,28 +388,32 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 173..230,
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [
|
||||
TypeVarTuple(
|
||||
TypeParamTypeVarTuple {
|
||||
range: 149..152,
|
||||
name: Identifier {
|
||||
id: "Ts",
|
||||
range: 150..152,
|
||||
id: "func",
|
||||
range: 177..181,
|
||||
},
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 181..186,
|
||||
type_params: [
|
||||
ParamSpec(
|
||||
TypeParamParamSpec {
|
||||
range: 182..185,
|
||||
name: Identifier {
|
||||
id: "P",
|
||||
range: 184..185,
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 173..230,
|
||||
name: Identifier {
|
||||
id: "func",
|
||||
range: 177..181,
|
||||
},
|
||||
parameters: Parameters {
|
||||
range: 186..221,
|
||||
posonlyargs: [],
|
||||
|
@ -439,6 +476,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
|
@ -453,45 +491,19 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: [
|
||||
ParamSpec(
|
||||
TypeParamParamSpec {
|
||||
range: 182..185,
|
||||
name: Identifier {
|
||||
id: "P",
|
||||
range: 184..185,
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 232..273,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "func",
|
||||
range: 236..240,
|
||||
},
|
||||
parameters: Parameters {
|
||||
range: 261..263,
|
||||
posonlyargs: [],
|
||||
args: [],
|
||||
vararg: None,
|
||||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
range: 269..273,
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: None,
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 240..261,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -542,4 +554,22 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
|
|||
],
|
||||
},
|
||||
),
|
||||
parameters: Parameters {
|
||||
range: 261..263,
|
||||
posonlyargs: [],
|
||||
args: [],
|
||||
vararg: None,
|
||||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
returns: None,
|
||||
body: [
|
||||
Pass(
|
||||
StmtPass {
|
||||
range: 269..273,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_python_parser/src/parser.rs
|
||||
expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
||||
expression: "parse_suite(source, \"<test>\").unwrap()"
|
||||
---
|
||||
[
|
||||
TypeAlias(
|
||||
|
@ -13,7 +13,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 10..13,
|
||||
|
@ -33,7 +33,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: BinOp(
|
||||
ExprBinOp {
|
||||
range: 23..32,
|
||||
|
@ -66,7 +66,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: BinOp(
|
||||
ExprBinOp {
|
||||
range: 42..61,
|
||||
|
@ -101,6 +101,9 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 68..71,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -113,6 +116,8 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
value: BinOp(
|
||||
ExprBinOp {
|
||||
range: 74..88,
|
||||
|
@ -171,6 +176,9 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 108..111,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -183,6 +191,8 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 114..117,
|
||||
|
@ -202,6 +212,9 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 124..127,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -214,6 +227,8 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
value: BinOp(
|
||||
ExprBinOp {
|
||||
range: 130..146,
|
||||
|
@ -272,6 +287,9 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 153..166,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -302,6 +320,8 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
value: Tuple(
|
||||
ExprTuple {
|
||||
range: 169..179,
|
||||
|
@ -343,6 +363,9 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 186..204,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -381,6 +404,8 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
value: Tuple(
|
||||
ExprTuple {
|
||||
range: 207..217,
|
||||
|
@ -422,6 +447,9 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 224..249,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -475,6 +503,8 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
value: Tuple(
|
||||
ExprTuple {
|
||||
range: 252..262,
|
||||
|
@ -516,7 +546,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 305..308,
|
||||
|
@ -536,7 +566,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 322..325,
|
||||
|
@ -556,7 +586,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 338..341,
|
||||
|
@ -576,7 +606,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 378..382,
|
||||
|
@ -596,7 +626,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 394..399,
|
||||
|
@ -616,7 +646,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 411..415,
|
||||
|
@ -636,7 +666,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 451..454,
|
||||
|
@ -656,7 +686,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 467..470,
|
||||
|
@ -676,7 +706,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 483..486,
|
||||
|
@ -696,7 +726,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: [],
|
||||
type_params: None,
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 502..505,
|
||||
|
@ -716,6 +746,9 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 520..523,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -728,6 +761,8 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 526..527,
|
||||
|
@ -747,6 +782,9 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 541..544,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -759,6 +797,8 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 547..548,
|
||||
|
@ -778,6 +818,9 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
ctx: Store,
|
||||
},
|
||||
),
|
||||
type_params: Some(
|
||||
TypeParams {
|
||||
range: 555..558,
|
||||
type_params: [
|
||||
TypeVar(
|
||||
TypeParamTypeVar {
|
||||
|
@ -790,6 +833,8 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
|||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
value: Name(
|
||||
ExprName {
|
||||
range: 567..568,
|
||||
|
|
|
@ -6,10 +6,12 @@ expression: parse_ast
|
|||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 1..49,
|
||||
decorator_list: [],
|
||||
name: Identifier {
|
||||
id: "args_to_tuple",
|
||||
range: 5..18,
|
||||
},
|
||||
type_params: None,
|
||||
parameters: Parameters {
|
||||
range: 18..30,
|
||||
posonlyargs: [],
|
||||
|
@ -41,21 +43,6 @@ expression: parse_ast
|
|||
kwonlyargs: [],
|
||||
kwarg: None,
|
||||
},
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 46..49,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 46..49,
|
||||
value: Ellipsis,
|
||||
kind: None,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
decorator_list: [],
|
||||
returns: Some(
|
||||
Subscript(
|
||||
ExprSubscript {
|
||||
|
@ -84,7 +71,20 @@ expression: parse_ast
|
|||
},
|
||||
),
|
||||
),
|
||||
type_params: [],
|
||||
body: [
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 46..49,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 46..49,
|
||||
value: Ellipsis,
|
||||
kind: None,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue