diff --git a/src/ast/pretty_print.rs b/src/ast/pretty_print.rs index 274cb31..c8caf06 100644 --- a/src/ast/pretty_print.rs +++ b/src/ast/pretty_print.rs @@ -19,6 +19,7 @@ impl PrettyPrint for Operator { impl PrettyPrint for BinaryOperator { fn pretty_print(&self, writer: &mut IndentWriter) -> std::io::Result<()> { + writer.write_indented("BinaryOperator(")?; use BinaryOperator::*; match self { Or => writer.write("||"), @@ -36,12 +37,15 @@ impl PrettyPrint for BinaryOperator { Modulo => writer.write("%"), LeftShift => writer.write("<<"), RightShift => writer.write(">>"), - } + }?; + writer.writeln(")")?; + Ok(()) } } impl PrettyPrint for PrefixUnaryOperator { fn pretty_print(&self, writer: &mut IndentWriter) -> std::io::Result<()> { + writer.write_indented("PrefixUnaryOperator(")?; use PrefixUnaryOperator::*; match self { Spread => writer.write("..."), @@ -50,17 +54,22 @@ impl PrettyPrint for PrefixUnaryOperator { Mut => writer.write("mut"), Not => writer.write("!"), Negative => writer.write("-"), - } + }?; + writer.writeln(")")?; + Ok(()) } } impl PrettyPrint for SuffixUnaryOperator { fn pretty_print(&self, writer: &mut IndentWriter) -> std::io::Result<()> { + writer.write_indented("SuffixUnaryOperator(")?; use SuffixUnaryOperator::*; match self { PlusPlus => writer.write("++"), MinusMinus => writer.write("--"), - } + }?; + writer.write(")")?; + Ok(()) } }