Mercurial > python-compiler.rs
diff src/ast_convert.rs @ 51:ded1907b7a69
Add ast.Nonlocal.
author | Bastien Orivel <eijebong@bananium.fr> |
---|---|
date | Wed, 08 Jun 2016 17:26:09 +0200 |
parents | 5edbc24b625f |
children | d9838e8b3ec5 |
line wrap: on
line diff
--- a/src/ast_convert.rs +++ b/src/ast_convert.rs @@ -430,6 +430,7 @@ fn parse_statement(py: Python, ast: PyOb let class_def_type = ast_module.get(py, "ClassDef").unwrap(); let function_def_type = ast_module.get(py, "FunctionDef").unwrap(); let global_type = ast_module.get(py, "Global").unwrap(); + let nonlocal_type = ast_module.get(py, "Nonlocal").unwrap(); let assign_type = ast_module.get(py, "Assign").unwrap(); let aug_assign_type = ast_module.get(py, "AugAssign").unwrap(); let return_type = ast_module.get(py, "Return").unwrap(); @@ -489,6 +490,10 @@ fn parse_statement(py: Python, ast: PyOb let names = ast.getattr(py, "names").unwrap(); let names = parse_list(py, names, get_str); stmt::Global(names) + } else if is_instance(&ast, &nonlocal_type) { + let names = ast.getattr(py, "names").unwrap(); + let names = parse_list(py, names, get_str); + stmt::Nonlocal(names) } else if is_instance(&ast, &if_type) { let test = ast.getattr(py, "test").unwrap(); let body = ast.getattr(py, "body").unwrap();