Mercurial > python-compiler.rs
diff src/ast_dump.rs @ 47:38f59b0efc2c
Handle Import and add a test for it.
author | Bastien Orivel <eijebong@bananium.fr> |
---|---|
date | Tue, 07 Jun 2016 12:51:36 +0200 |
parents | 5f1d285471af |
children | 039f85b187f2 |
line wrap: on
line diff
--- a/src/ast_dump.rs +++ b/src/ast_dump.rs @@ -200,6 +200,16 @@ impl stmt { } names_.join(", ") }), + stmt::Import(names) => format!("{}import {}", current_indent, { + let mut names_ = vec!(); + for name in names { + match name.asname { + None => names_.push(name.name), + Some(asname) => names_.push(format!("{} as {}", name.name, asname)) + } + } + names_.join(", ") + }), stmt::Expr(expr) => format!("{}{}", current_indent, expr.to_string()), stmt::Break => format!("{}break", current_indent), stmt::Delete(targets) => format!("{}del {}", current_indent, args_to_string(targets))