(self, vm: &VirtualMachine, source_file: &SourceFile)
| 4 | // product |
| 5 | impl Node for ast::Parameters { |
| 6 | fn ast_to_object(self, vm: &VirtualMachine, source_file: &SourceFile) -> PyObjectRef { |
| 7 | let Self { |
| 8 | node_index: _, |
| 9 | posonlyargs, |
| 10 | args, |
| 11 | vararg, |
| 12 | kwonlyargs, |
| 13 | kwarg, |
| 14 | range, |
| 15 | } = self; |
| 16 | let (posonlyargs, args, defaults) = |
| 17 | extract_positional_parameter_defaults(posonlyargs, args); |
| 18 | let (kwonlyargs, kw_defaults) = extract_keyword_parameter_defaults(kwonlyargs); |
| 19 | let node = NodeAst |
| 20 | .into_ref_with_type(vm, pyast::NodeArguments::static_type().to_owned()) |
| 21 | .unwrap(); |
| 22 | let dict = node.as_object().dict().unwrap(); |
| 23 | dict.set_item( |
| 24 | "posonlyargs", |
| 25 | posonlyargs.ast_to_object(vm, source_file), |
| 26 | vm, |
| 27 | ) |
| 28 | .unwrap(); |
| 29 | dict.set_item("args", args.ast_to_object(vm, source_file), vm) |
| 30 | .unwrap(); |
| 31 | dict.set_item("vararg", vararg.ast_to_object(vm, source_file), vm) |
| 32 | .unwrap(); |
| 33 | dict.set_item("kwonlyargs", kwonlyargs.ast_to_object(vm, source_file), vm) |
| 34 | .unwrap(); |
| 35 | dict.set_item( |
| 36 | "kw_defaults", |
| 37 | kw_defaults.ast_to_object(vm, source_file), |
| 38 | vm, |
| 39 | ) |
| 40 | .unwrap(); |
| 41 | dict.set_item("kwarg", kwarg.ast_to_object(vm, source_file), vm) |
| 42 | .unwrap(); |
| 43 | dict.set_item("defaults", defaults.ast_to_object(vm, source_file), vm) |
| 44 | .unwrap(); |
| 45 | let _ = range; |
| 46 | node.into() |
| 47 | } |
| 48 | |
| 49 | fn ast_from_object( |
| 50 | vm: &VirtualMachine, |
nothing calls this directly
no test coverage detected