Mercurial > python-compiler.rs
diff src/ast_convert.rs @ 75:1abc8ca9f30b
Add ast.YieldFrom.
author | Bastien Orivel <eijebong@bananium.fr> |
---|---|
date | Mon, 13 Jun 2016 18:26:46 +0200 |
parents | 97537c90d92d |
children | efd42fc280e8 |
line wrap: on
line diff
--- a/src/ast_convert.rs +++ b/src/ast_convert.rs @@ -303,6 +303,7 @@ fn parse_expr(py: Python, ast: PyObject) let ellipsis_type = ast_module.get(py, "Ellipsis").unwrap(); let await_type = ast_module.get(py, "Await").unwrap(); let yield_type = ast_module.get(py, "Yield").unwrap(); + let yield_from_type = ast_module.get(py, "YieldFrom").unwrap(); assert!(is_instance(&ast, &ast_type)); @@ -414,6 +415,11 @@ fn parse_expr(py: Python, ast: PyObject) let value = parse_optional_expr(py, value); expr::Yield(Box::new(value)) + } else if is_instance(&ast, &yield_from_type) { + let value = ast.getattr(py, "value").unwrap(); + let value = parse_expr(py, value); + + expr::YieldFrom(Box::new(value)) } else { println!("expr {}", ast); unreachable!()