]> git.saurik.com Git - cycript.git/blobdiff - ObjectiveC/Output.cpp
Avoid frustrating corner-case crashes in readline.
[cycript.git] / ObjectiveC / Output.cpp
index 7d21d6fe47f200efecece3d825294d4266294c47..37f86b1b08dffbd332e9b52f9bb0818265ddcbb0 100644 (file)
@@ -77,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 {