]> git.saurik.com Git - cycript.git/blobdiff - Output.cpp
On iOS 9, JSObjectGetPrototype changes JSValueRef.
[cycript.git] / Output.cpp
index 42d1854847d6849c06e9bb64ad9fa6e716c60924..467825cfdfeeaf5230cca96495752b45d3aea769 100644 (file)
@@ -1,21 +1,21 @@
 /* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2013  Jay Freeman (saurik)
+ * Copyright (C) 2009-2014  Jay Freeman (saurik)
 */
 
-/* GNU General Public License, Version 3 {{{ */
+/* GNU Affero General Public License, Version 3 {{{ */
 /*
- * Cycript is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License,
- * or (at your option) any later version.
- *
- * Cycript is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Cycript.  If not, see <http://www.gnu.org/licenses/>.
+ * GNU Affero General Public License for more details.
+
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/
 /* }}} */
 
@@ -118,8 +118,7 @@ void CYArgument::Output(CYOutput &out) const {
     if (value_ != NULL)
         value_->Output(out, CYAssign::Precedence_, CYNoFlags);
     if (next_ != NULL) {
-        if (next_->name_ == NULL)
-            out << ',';
+        out << ',';
         out << ' ' << *next_;
     }
 }
@@ -194,19 +193,13 @@ void CYComment::Output(CYOutput &out, CYFlags flags) const {
 }
 
 void CYCompound::Output(CYOutput &out, CYFlags flags) const {
-    if (CYExpression *expression = expressions_)
-        if (CYExpression *next = expression->next_) {
-            expression->Output(out, CYLeft(flags));
-            CYFlags center(CYCenter(flags));
-            while (next != NULL) {
-                expression = next;
-                out << ',' << ' ';
-                next = expression->next_;
-                CYFlags right(next != NULL ? center : CYRight(flags));
-                expression->Output(out, right);
-            }
-        } else
-            expression->Output(out, flags);
+    if (next_ == NULL)
+        expression_->Output(out, flags);
+    else {
+        expression_->Output(out, CYLeft(flags));
+        out << ',' << ' ';
+        next_->Output(out, CYRight(flags));
+    }
 }
 
 void CYCondition::Output(CYOutput &out, CYFlags flags) const {
@@ -336,6 +329,10 @@ void CYExpression::Output(CYOutput &out, int precedence, CYFlags flags) const {
         Output(out, flags);
 }
 
+void CYExternal::Output(CYOutput &out, CYFlags flags) const {
+    out << "extern" << abi_ << typed_ << ';';
+}
+
 void CYFatArrow::Output(CYOutput &out, CYFlags flags) const {
     out << '(' << parameters_ << ')' << ' ' << "=>" << ' ' << code_;
 }
@@ -447,6 +444,10 @@ void CYIfComprehension::Output(CYOutput &out) const {
     out << "if" << ' ' << '(' << *test_ << ')' << next_;
 }
 
+void CYImport::Output(CYOutput &out, CYFlags flags) const {
+    out << "@import";
+}
+
 void CYIndirectMember::Output(CYOutput &out, CYFlags flags) const {
     object_->Output(out, Precedence(), CYLeft(flags));
     if (const char *word = property_->Word())
@@ -554,6 +555,12 @@ void CYLetStatement::Output(CYOutput &out, CYFlags flags) const {
     code_->Single(out, CYRight(flags));
 }
 
+void CYModule::Output(CYOutput &out) const {
+    out << part_;
+    if (next_ != NULL)
+        out << '.' << next_;
+}
+
 namespace cy {
 namespace Syntax {
 
@@ -748,6 +755,10 @@ void Try::Output(CYOutput &out, CYFlags flags) const {
 
 } }
 
+void CYTypeError::Output(CYOutput &out) const {
+    out << "@error";
+}
+
 void CYTypeLong::Output(CYOutput &out) const {
     out << "long" << specifier_;
 }