mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Add support for defaults to bytecode, compiler and VM
This commit is contained in:
@@ -308,12 +308,16 @@ FuncDef: ast::LocatedStatement = {
|
||||
},
|
||||
};
|
||||
|
||||
Parameters: Vec<String> = {
|
||||
Parameters: Vec<(String, Option<ast::Expression>)> = {
|
||||
"(" <a: TypedArgsList> ")" => a,
|
||||
};
|
||||
|
||||
TypedArgsList: Vec<String> = {
|
||||
<a: Comma<Identifier>> => a,
|
||||
// parameters are (String, None), kwargs are (String, Some(Test)) where Test is
|
||||
// the default
|
||||
TypedArgsList: Vec<(String, Option<ast::Expression>)> = {
|
||||
<a: Comma<Identifier>> => {
|
||||
a.iter().map(|param| (param.clone(), None)).collect()
|
||||
},
|
||||
};
|
||||
|
||||
ClassDef: ast::LocatedStatement = {
|
||||
|
||||
Reference in New Issue
Block a user