diff src/ast_convert.rs @ 73:2a6629ea82b5

Add ast.Await.
author Bastien Orivel <eijebong@bananium.fr>
date Mon, 13 Jun 2016 18:21:06 +0200
parents 7ac23f4336b1
children 97537c90d92d
line wrap: on
line diff
--- a/src/ast_convert.rs
+++ b/src/ast_convert.rs
@@ -301,6 +301,7 @@ fn parse_expr(py: Python, ast: PyObject)
     let dictcomp_type = ast_module.get(py, "DictComp").unwrap();
     let tuple_type = ast_module.get(py, "Tuple").unwrap();
     let ellipsis_type = ast_module.get(py, "Ellipsis").unwrap();
+    let await_type = ast_module.get(py, "Await").unwrap();
 
     assert!(is_instance(&ast, &ast_type));
 
@@ -402,6 +403,11 @@ fn parse_expr(py: Python, ast: PyObject)
         expr::Tuple(elts, get_ctx(py, ast))
     } else if is_instance(&ast, &ellipsis_type) {
         expr::Ellipsis
+    } else if is_instance(&ast, &await_type) {
+        let value = ast.getattr(py, "value").unwrap();
+        let value = parse_expr(py, value);
+
+        expr::Await(Box::new(value))
     } else {
         println!("expr {}", ast);
         unreachable!()