]> git.saurik.com Git - cycript.git/blobdiff - Output.cpp
Hide complicated hold manipulation behind CYHLD().
[cycript.git] / Output.cpp
index a6174087c8ddfbe67130c2e0ef3b8fc548d1bedf..c436b3ca1e184a7b93df08b84b4159347137cf6f 100644 (file)
@@ -326,7 +326,7 @@ void CYCondition::Output(CYOutput &out, CYFlags flags) const {
     test_->Output(out, Precedence() - 1, CYLeft(flags));
     out << ' ' << '?' << ' ';
     if (true_ != NULL)
-        true_->Output(out, CYAssign::Precedence_, CYNoFlags);
+        true_->Output(out, CYAssign::Precedence_, CYNoColon);
     out << ' ' << ':' << ' ';
     false_->Output(out, CYAssign::Precedence_, CYRight(flags));
 }
@@ -340,10 +340,12 @@ void CYContinue::Output(CYOutput &out, CYFlags flags) const {
 
 void CYClause::Output(CYOutput &out) const {
     out << '\t';
-    if (value_ != NULL)
-        out << "case" << ' ' << *value_;
-    else
+    if (value_ == NULL)
         out << "default";
+    else {
+        out << "case" << ' ';
+        value_->Output(out, CYNoColon);
+    }
     out << ':' << '\n';
     ++out.indent_;
     out << code_;
@@ -854,6 +856,14 @@ void CYRegEx::Output(CYOutput &out, CYFlags flags) const {
     out << Value();
 }
 
+void CYResolveMember::Output(CYOutput &out, CYFlags flags) const {
+    object_->Output(out, Precedence(), CYLeft(flags));
+    if (const char *word = property_->Word())
+        out << "::" << word;
+    else
+        out << "::" << '[' << *property_ << ']';
+}
+
 void CYReturn::Output(CYOutput &out, CYFlags flags) const {
     out << "return";
     if (value_ != NULL)
@@ -993,6 +1003,15 @@ void CYSwitch::Output(CYOutput &out, CYFlags flags) const {
     out << '\t' << '}';
 }
 
+void CYSymbol::Output(CYOutput &out, CYFlags flags) const {
+    bool protect((flags & CYNoColon) != 0);
+    if (protect)
+        out << '(';
+    out << ':' << name_;
+    if (protect)
+        out << ')';
+}
+
 void CYThis::Output(CYOutput &out, CYFlags flags) const {
     out << "this";
 }