Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ast-pyo3/src/gen/to_py_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ impl<R> PyNode for ast::ExcepthandlerExceptHandler<R> {
}
}

impl<R> PyNode for ast::Arguments<R> {
impl<R> PyNode for ast::PythonArguments<R> {
#[inline]
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
Expand Down Expand Up @@ -2288,7 +2288,7 @@ impl ToPyAst for ast::ExcepthandlerExceptHandler<TextRange> {
}
}

impl ToPyAst for ast::Arguments<TextRange> {
impl ToPyAst for ast::PythonArguments<TextRange> {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let cache = Self::py_type_cache().get().unwrap();
Expand Down Expand Up @@ -4312,7 +4312,7 @@ impl ToPyAst for ast::ExcepthandlerExceptHandler<SourceRange> {
}
}

impl ToPyAst for ast::Arguments<SourceRange> {
impl ToPyAst for ast::PythonArguments<SourceRange> {
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let cache = Self::py_type_cache().get().unwrap();
Expand Down Expand Up @@ -4820,7 +4820,7 @@ fn init_types(py: Python) -> PyResult<()> {
cache_py_type::<ast::Comprehension>(ast_module)?;
cache_py_type::<ast::Excepthandler>(ast_module)?;
cache_py_type::<ast::ExcepthandlerExceptHandler>(ast_module)?;
cache_py_type::<ast::Arguments>(ast_module)?;
cache_py_type::<ast::PythonArguments>(ast_module)?;
cache_py_type::<ast::Arg>(ast_module)?;
cache_py_type::<ast::Keyword>(ast_module)?;
cache_py_type::<ast::Alias>(ast_module)?;
Expand Down
10 changes: 5 additions & 5 deletions ast-pyo3/src/gen/wrapper_located.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3289,10 +3289,10 @@ impl ExcepthandlerExceptHandler {

#[pyclass(module="rustpython_ast.located", name="_arguments", extends=super::Ast, frozen)]
#[derive(Clone, Debug)]
pub struct Arguments(pub &'static ast::Arguments<SourceRange>);
pub struct Arguments(pub &'static ast::PythonArguments<SourceRange>);

impl From<&'static ast::Arguments<SourceRange>> for Arguments {
fn from(node: &'static ast::Arguments<SourceRange>) -> Self {
impl From<&'static ast::PythonArguments<SourceRange>> for Arguments {
fn from(node: &'static ast::PythonArguments<SourceRange>) -> Self {
Arguments(node)
}
}
Expand All @@ -3304,7 +3304,7 @@ impl ToPyObject for Arguments {
}
}

impl ToPyWrapper for ast::Arguments<SourceRange> {
impl ToPyWrapper for ast::PythonArguments<SourceRange> {
#[inline]
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
Ok(Arguments(self).to_object(py))
Expand Down Expand Up @@ -4392,7 +4392,7 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
super::init_type::<Arguments, ast::Arguments>(py, m)?;
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
super::init_type::<Arg, ast::Arg>(py, m)?;
super::init_type::<Keyword, ast::Keyword>(py, m)?;
super::init_type::<Alias, ast::Alias>(py, m)?;
Expand Down
10 changes: 5 additions & 5 deletions ast-pyo3/src/gen/wrapper_ranged.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3289,10 +3289,10 @@ impl ExcepthandlerExceptHandler {

#[pyclass(module="rustpython_ast.ranged", name="_arguments", extends=super::Ast, frozen)]
#[derive(Clone, Debug)]
pub struct Arguments(pub &'static ast::Arguments<TextRange>);
pub struct Arguments(pub &'static ast::PythonArguments<TextRange>);

impl From<&'static ast::Arguments<TextRange>> for Arguments {
fn from(node: &'static ast::Arguments<TextRange>) -> Self {
impl From<&'static ast::PythonArguments<TextRange>> for Arguments {
fn from(node: &'static ast::PythonArguments<TextRange>) -> Self {
Arguments(node)
}
}
Expand All @@ -3304,7 +3304,7 @@ impl ToPyObject for Arguments {
}
}

impl ToPyWrapper for ast::Arguments<TextRange> {
impl ToPyWrapper for ast::PythonArguments<TextRange> {
#[inline]
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
Ok(Arguments(self).to_object(py))
Expand Down Expand Up @@ -4096,7 +4096,7 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
super::init_type::<Arguments, ast::Arguments>(py, m)?;
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
super::init_type::<Arg, ast::Arg>(py, m)?;
super::init_type::<Keyword, ast::Keyword>(py, m)?;
super::init_type::<Alias, ast::Alias>(py, m)?;
Expand Down
12 changes: 12 additions & 0 deletions ast-pyo3/src/py_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ impl ToPyAst for ConversionFlag {
}
}

impl<R> ToPyAst for ast::Arguments<R>
where
R: Clone,
ast::PythonArguments<R>: ToPyAst,
{
#[inline]
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
let arguments = self.to_python_arguments();
arguments.to_py_ast(py)
}
}

fn constant_to_object(constant: &ast::Constant, py: Python) -> PyObject {
let cache = ast_cache();
match constant {
Expand Down
12 changes: 12 additions & 0 deletions ast-pyo3/src/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ impl<T: ToPyWrapper> ToPyWrapper for Vec<T> {
}
}

impl<R> ToPyWrapper for ast::Arguments<R>
where
Self: Clone,
ast::PythonArguments<R>: ToPyWrapper,
{
#[inline]
fn to_py_wrapper(&'static self, _py: Python) -> PyResult<Py<PyAny>> {
todo!()
// Ok(FunctionArguments(self).to_object(py))
}
}

#[pyclass(module = "rustpython_ast", name = "AST", subclass)]
pub struct Ast;

Expand Down
Loading