X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/3fe16be7c02b11754e3d367ffd228beb14da2555..a2ab0fd327b427d1f537cb7bc79de985fae3a0f5:/Output.cpp?ds=sidebyside
diff --git a/Output.cpp b/Output.cpp
index 51134c7..12c72df 100644
--- a/Output.cpp
+++ b/Output.cpp
@@ -1,21 +1,21 @@
/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2013 Jay Freeman (saurik)
+ * Copyright (C) 2009-2015 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 .
+ * 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 .
**/
/* }}} */
@@ -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 {
@@ -256,7 +249,7 @@ void CYDeclaration::Output(CYOutput &out, CYFlags flags) const {
void CYForDeclarations::Output(CYOutput &out, CYFlags flags) const {
out << "var";
- Output(out, CYRight(flags));
+ declarations_->Output(out, CYRight(flags));
}
void CYDeclarations::Output(CYOutput &out) 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())
@@ -523,7 +524,7 @@ void CYTypeModifier::Output(CYOutput &out, int precedence, CYIdentifier *identif
}
void CYTypedIdentifier::Output(CYOutput &out) const {
- type_->Output(out, 0, CYNoFlags);
+ specifier_->Output(out);
modifier_->Output(out, 0, identifier_);
}
@@ -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,34 @@ 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_;
+}
+
+void CYTypeShort::Output(CYOutput &out) const {
+ out << "short" << specifier_;
+}
+
+void CYTypeSigned::Output(CYOutput &out) const {
+ out << "signed" << specifier_;
+}
+
+void CYTypeUnsigned::Output(CYOutput &out) const {
+ out << "unsigned" << specifier_;
+}
+
+void CYTypeVariable::Output(CYOutput &out) const {
+ out << *name_;
+}
+
+void CYTypeVoid::Output(CYOutput &out) const {
+ out << "void";
+}
+
void CYVar::Output(CYOutput &out, CYFlags flags) const {
out << "var";
declarations_->Output(out, flags);