# HG changeset patch # User Emmanuel Gil Peyrot # Date 1466632212 -3600 # Node ID 09f5e0d7bcf31d28660c959f46827cdbf0fc7e62 # Parent ff6b1aeb544a1e18091ee2d14072092ed410b762 Fix chained Compare dumping. diff --git a/src/ast_dump.rs b/src/ast_dump.rs --- a/src/ast_dump.rs +++ b/src/ast_dump.rs @@ -181,22 +181,9 @@ impl to_string_able for expr { expr::Compare(left, ops, comparators) => format!("{} {}", left.to_string(), { let mut arguments = vec!(); - - // XXX: wrong order! - for op in ops { - arguments.push(op.to_string().to_string()) - } - for comparator in comparators { - arguments.push(comparator.to_string()) - } - /* - for (op, comparator) in ops.zip(comparators) { - let op = op.unwrap(); - let comparator = comparator.unwrap(); + for (op, comparator) in ops.iter().zip(comparators.iter()) { arguments.push(format!("{} {}", op.to_string(), comparator.to_string())) } - */ - arguments.join(" ") }), expr::Call(func, args, keywords) => format!("{}({})", func.to_string(), { diff --git a/tests/test_parse_files/test_compare.py b/tests/test_parse_files/test_compare.py --- a/tests/test_parse_files/test_compare.py +++ b/tests/test_parse_files/test_compare.py @@ -9,3 +9,4 @@ a = 1 is 2 a = 1 is not 2 a = 1 in 2 a = 1 not in 2 +1 < 2 < 3