X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/320ce7537deb2d6f8a5db078d2d6aab1e1a77f8f..1504c9b837a7561d8ae2c81f1c4d57fe0f138781:/Output.cpp diff --git a/Output.cpp b/Output.cpp index 04f893c..d6c3a03 100644 --- a/Output.cpp +++ b/Output.cpp @@ -89,12 +89,10 @@ CYOutput &CYOutput::operator <<(char rhs) { if (right_) { out_ << '\n'; right_ = false; - goto mode; - } + } goto done; } else goto work; right_ = true; - mode: mode_ = NoMode; goto done; @@ -236,7 +234,8 @@ void Catch::Output(CYOutput &out) const { void CYComment::Output(CYOutput &out, CYFlags flags) const { out << '\r'; - out << value_; + out.out_ << value_; + out.right_ = true; out << '\r'; } @@ -284,7 +283,7 @@ void CYClause::Output(CYOutput &out) const { } const char *CYDeclaration::ForEachIn() const { - return identifier_->Value(); + return identifier_->Word(); } void CYDeclaration::ForIn(CYOutput &out, CYFlags flags) const { @@ -294,6 +293,7 @@ void CYDeclaration::ForIn(CYOutput &out, CYFlags flags) const { void CYDeclaration::Output(CYOutput &out, CYFlags flags) const { out << *identifier_; + //out.out_ << ':' << identifier_->usage_ << '#' << identifier_->offset_; if (initialiser_ != NULL) { out << ' ' << '=' << ' '; initialiser_->Output(out, CYPA, CYRight(flags)); @@ -326,7 +326,7 @@ void CYDeclarations::Output(CYOutput &out, CYFlags flags) const { } void CYDirectMember::Output(CYOutput &out, CYFlags flags) const { - object_->Output(out, Precedence(), CYLeft(flags)); + object_->Output(out, Precedence(), CYLeft(flags) | CYNoInteger); if (const char *word = property_->Word()) out << '.' << word; else @@ -416,7 +416,8 @@ void CYForEachInComprehension::Output(CYOutput &out) const { void CYForIn::Output(CYOutput &out, CYFlags flags) const { out << "for" << ' ' << '('; - initialiser_->ForIn(out, CYNoIn); + if (initialiser_ != NULL) + initialiser_->ForIn(out, CYNoIn); out << "in" << *set_ << ')'; code_->Single(out, CYRight(flags)); } @@ -453,6 +454,10 @@ void CYFunctionParameter::Output(CYOutput &out) const { out << ',' << ' ' << *next_; } +const char *CYIdentifier::Word() const { + return replace_ == NULL || replace_ == this ? CYWord::Word() : replace_->Word(); +} + void CYIf::Output(CYOutput &out, CYFlags flags) const { bool protect(false); if (false_ == NULL && (flags & CYNoDangle) != 0) { @@ -649,8 +654,6 @@ static const char *Reserved_[] = { "let", "yield", - "each", - NULL }; @@ -716,15 +719,21 @@ void CYWith::Output(CYOutput &out, CYFlags flags) const { void CYWord::ClassName(CYOutput &out, bool object) const { if (object) out << "objc_getClass("; - out << '"' << Value() << '"'; + out << '"' << Word() << '"'; if (object) out << ')'; } void CYWord::Output(CYOutput &out) const { - out << Value(); + out << Word(); + if (out.options_.verbose_) + out.out_ << '@' << this; } void CYWord::PropertyName(CYOutput &out) const { Output(out); } + +const char *CYWord::Word() const { + return word_; +}