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 {
|
||||
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(())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user