]> git.saurik.com Git - cycript.git/blobdiff - Output.cpp
Port Objective-C/Replace to C++.
[cycript.git] / Output.cpp
index 26dc81fb1d7e33252ab427c9d46c9b12c9a38944..67c9877a492d7d63ff92e3e20b8bc322f5be5315 100644 (file)
@@ -293,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));
@@ -325,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
@@ -431,8 +432,6 @@ void CYFunction::Output(CYOutput &out, CYFlags flags) const {
     if (protect)
         out << '(';
     out << "function";
-    if (out.options_.verbose_)
-        out.out_ << ':' << static_cast<const CYScope *>(this);
     if (name_ != NULL)
         out << ' ' << *name_;
     out << '(' << parameters_ << ')';
@@ -522,7 +521,10 @@ void CYLet::Output(CYOutput &out, CYFlags flags) const {
     out << "let" << ' ' << '(' << *declarations_ << ')' << ' ' << code_;
 }
 
-void CYNew::Output(CYOutput &out, CYFlags flags) const {
+namespace cy {
+namespace Syntax {
+
+void New::Output(CYOutput &out, CYFlags flags) const {
     out << "new" << ' ';
     CYFlags jacks(CYNoCall | CYCenter(flags));
     constructor_->Output(out, Precedence(), jacks);
@@ -530,6 +532,8 @@ void CYNew::Output(CYOutput &out, CYFlags flags) const {
         out << '(' << *arguments_ << ')';
 }
 
+} }
+
 void CYNull::Output(CYOutput &out, CYFlags flags) const {
     CYWord::Output(out);
 }
@@ -561,6 +565,13 @@ void CYObject::Output(CYOutput &out, CYFlags flags) const {
         out << ')';
 }
 
+void CYOptionalFunctionParameter::Output(CYOutput &out) const {
+    out << *name_ << '=';
+    initializer_->Output(out, CYPA, CYNoFlags);
+    if (next_ != NULL)
+        out << ',' << ' ' << *next_;
+}
+
 void CYPostfix::Output(CYOutput &out, CYFlags flags) const {
     lhs_->Output(out, Precedence(), CYLeft(flags));
     out << Operator();
@@ -601,6 +612,17 @@ void CYReturn::Output(CYOutput &out, CYFlags flags) const {
     out << ';';
 }
 
+void CYRubyBlock::Output(CYOutput &out, CYFlags flags) const {
+    call_->Output(out, CYLeft(flags));
+    out << ' ';
+    proc_->Output(out, CYRight(flags));
+}
+
+void CYRubyProc::Output(CYOutput &out, CYFlags flags) const {
+    // XXX: this is not outputting the parameters
+    out << code_;
+}
+
 void CYStatement::Multiple(CYOutput &out, CYFlags flags) const {
     bool first(true);
     for (const CYStatement *next(this); next != NULL; next = next->next_) {