X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/520c130fcc066582173d69b4c96797f87ba24a9b..032e971ea180d9e7f9df03887bedd233c8d5c537:/Output.cpp diff --git a/Output.cpp b/Output.cpp index 82156a0..d36afe6 100644 --- a/Output.cpp +++ b/Output.cpp @@ -213,10 +213,15 @@ void CYCall::Output(CYOutput &out, CYFlags flags) const { out << ')'; } -void CYCatch::Output(CYOutput &out) const { +namespace cy { +namespace Syntax { + +void Catch::Output(CYOutput &out) const { out << ' ' << "catch" << ' ' << '(' << *name_ << ')' << ' ' << code_; } +} } + void CYCompound::Output(CYOutput &out, CYFlags flags) const { if (CYExpression *expression = expressions_) if (CYExpression *next = expression->next_) { @@ -506,10 +511,9 @@ void CYNull::Output(CYOutput &out, CYFlags flags) const { } void CYNumber::Output(CYOutput &out, CYFlags flags) const { - char value[32]; - // XXX: I want this to print 1e3 rather than 1000 - sprintf(value, "%.17g", Value()); - out << value; + std::ostringstream str; + CYNumerify(str, Value()); + out << str.str().c_str(); } void CYNumber::PropertyName(CYOutput &out) const { @@ -651,17 +655,22 @@ void CYThis::Output(CYOutput &out, CYFlags flags) const { CYWord::Output(out); } -void CYThrow::Output(CYOutput &out, CYFlags flags) const { +namespace cy { +namespace Syntax { + +void Throw::Output(CYOutput &out, CYFlags flags) const { out << "throw"; if (value_ != NULL) out << ' ' << *value_; out << ';'; } -void CYTry::Output(CYOutput &out, CYFlags flags) const { +void Try::Output(CYOutput &out, CYFlags flags) const { out << "try" << ' ' << code_ << catch_ << finally_; } +} } + void CYVar::Output(CYOutput &out, CYFlags flags) const { out << "var"; declarations_->Output(out, flags);