comparison 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
comparison
equal deleted inserted replaced
46:b3f47c8150c0 47:38f59b0efc2c
198 Some(asname) => names_.push(format!("{} as {}", name.name, asname)) 198 Some(asname) => names_.push(format!("{} as {}", name.name, asname))
199 } 199 }
200 } 200 }
201 names_.join(", ") 201 names_.join(", ")
202 }), 202 }),
203 stmt::Import(names) => format!("{}import {}", current_indent, {
204 let mut names_ = vec!();
205 for name in names {
206 match name.asname {
207 None => names_.push(name.name),
208 Some(asname) => names_.push(format!("{} as {}", name.name, asname))
209 }
210 }
211 names_.join(", ")
212 }),
203 stmt::Expr(expr) => format!("{}{}", current_indent, expr.to_string()), 213 stmt::Expr(expr) => format!("{}{}", current_indent, expr.to_string()),
204 stmt::Break => format!("{}break", current_indent), 214 stmt::Break => format!("{}break", current_indent),
205 stmt::Delete(targets) => format!("{}del {}", current_indent, args_to_string(targets)) 215 stmt::Delete(targets) => format!("{}del {}", current_indent, args_to_string(targets))
206 } 216 }
207 } 217 }