Fix pretty-print operator bug.
This commit is contained in:
parent
692411e232
commit
e0f2810764
@ -19,6 +19,7 @@ impl PrettyPrint for Operator {
|
|||||||
|
|
||||||
impl PrettyPrint for BinaryOperator {
|
impl PrettyPrint for BinaryOperator {
|
||||||
fn pretty_print(&self, writer: &mut IndentWriter) -> std::io::Result<()> {
|
fn pretty_print(&self, writer: &mut IndentWriter) -> std::io::Result<()> {
|
||||||
|
writer.write_indented("BinaryOperator(")?;
|
||||||
use BinaryOperator::*;
|
use BinaryOperator::*;
|
||||||
match self {
|
match self {
|
||||||
Or => writer.write("||"),
|
Or => writer.write("||"),
|
||||||
@ -36,12 +37,15 @@ impl PrettyPrint for BinaryOperator {
|
|||||||
Modulo => writer.write("%"),
|
Modulo => writer.write("%"),
|
||||||
LeftShift => writer.write("<<"),
|
LeftShift => writer.write("<<"),
|
||||||
RightShift => writer.write(">>"),
|
RightShift => writer.write(">>"),
|
||||||
}
|
}?;
|
||||||
|
writer.writeln(")")?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PrettyPrint for PrefixUnaryOperator {
|
impl PrettyPrint for PrefixUnaryOperator {
|
||||||
fn pretty_print(&self, writer: &mut IndentWriter) -> std::io::Result<()> {
|
fn pretty_print(&self, writer: &mut IndentWriter) -> std::io::Result<()> {
|
||||||
|
writer.write_indented("PrefixUnaryOperator(")?;
|
||||||
use PrefixUnaryOperator::*;
|
use PrefixUnaryOperator::*;
|
||||||
match self {
|
match self {
|
||||||
Spread => writer.write("..."),
|
Spread => writer.write("..."),
|
||||||
@ -50,17 +54,22 @@ impl PrettyPrint for PrefixUnaryOperator {
|
|||||||
Mut => writer.write("mut"),
|
Mut => writer.write("mut"),
|
||||||
Not => writer.write("!"),
|
Not => writer.write("!"),
|
||||||
Negative => writer.write("-"),
|
Negative => writer.write("-"),
|
||||||
}
|
}?;
|
||||||
|
writer.writeln(")")?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PrettyPrint for SuffixUnaryOperator {
|
impl PrettyPrint for SuffixUnaryOperator {
|
||||||
fn pretty_print(&self, writer: &mut IndentWriter) -> std::io::Result<()> {
|
fn pretty_print(&self, writer: &mut IndentWriter) -> std::io::Result<()> {
|
||||||
|
writer.write_indented("SuffixUnaryOperator(")?;
|
||||||
use SuffixUnaryOperator::*;
|
use SuffixUnaryOperator::*;
|
||||||
match self {
|
match self {
|
||||||
PlusPlus => writer.write("++"),
|
PlusPlus => writer.write("++"),
|
||||||
MinusMinus => writer.write("--"),
|
MinusMinus => writer.write("--"),
|
||||||
}
|
}?;
|
||||||
|
writer.write(")")?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user