X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/c5b15840ab1bb70218506531f9a73fe2d112b007..5f7a1d380823e5188490c2fd41009f90d59e6fee:/ObjectiveC/Output.cpp diff --git a/ObjectiveC/Output.cpp b/ObjectiveC/Output.cpp index 76838d8..37f86b1 100644 --- a/ObjectiveC/Output.cpp +++ b/ObjectiveC/Output.cpp @@ -49,6 +49,9 @@ void CYImplementation::Output(CYOutput &out, CYFlags flags) const { } void CYImplementationField::Output(CYOutput &out) const { + out << *typed_; + out.Terminate(); + out << '\n'; } void CYInstanceLiteral::Output(CYOutput &out, CYFlags flags) const { @@ -60,8 +63,8 @@ void CYMessage::Output(CYOutput &out) const { out << (instance_ ? '-' : '+'); CYForEach (parameter, parameters_) - if (parameter->tag_ != NULL) { - out << ' ' << *parameter->tag_; + if (parameter->name_ != NULL) { + out << ' ' << *parameter->name_; if (parameter->type_ != NULL) out << ':' << *parameter->type_->identifier_; } @@ -74,12 +77,31 @@ void CYBox::Output(CYOutput &out, CYFlags flags) const { value_->Output(out, Precedence(), CYRight(flags)); } +void CYObjCArray::Output(CYOutput &out, CYFlags flags) const { + out << '@' << '[' << elements_ << ']'; +} + +void CYObjCDictionary::Output(CYOutput &out, CYFlags flags) const { + out << '@' << '{' << '}'; +} + void CYObjCBlock::Output(CYOutput &out, CYFlags flags) const { - // XXX: this is seriously wrong - out << "^("; - out << ")"; - out << "{"; - out << "}"; + out << '^' << ' ' << *typed_ << ' ' << '('; + + bool comma(false); + CYForEach (parameter, parameters_) { + if (comma) + out << ',' << ' '; + else + comma = true; + out << *parameter->typed_; + } + + out << ')' << ' ' << '{' << '\n'; + ++out.indent_; + out << code_; + --out.indent_; + out << '\n' << '}'; } void CYProtocol::Output(CYOutput &out) const { @@ -89,7 +111,7 @@ void CYProtocol::Output(CYOutput &out) const { } void CYSelector::Output(CYOutput &out, CYFlags flags) const { - out << "@selector" << '(' << name_ << ')'; + out << "@selector" << '(' << parts_ << ')'; } void CYSelectorPart::Output(CYOutput &out) const {