/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2012 Jay Freeman (saurik)
+ * Copyright (C) 2009-2013 Jay Freeman (saurik)
*/
-/* GNU Lesser General Public License, Version 3 {{{ */
+/* GNU General Public License, Version 3 {{{ */
/*
- * Cycript is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser 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 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 MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
+ * Cycript 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 Lesser General Public License
+ * You should have received a copy of the GNU General Public License
* along with Cycript. If not, see <http://www.gnu.org/licenses/>.
**/
/* }}} */
Output(out, CYNoFlags);
}
-void CYExpression::Output(CYOutput &out, unsigned precedence, CYFlags flags) const {
+void CYExpression::Output(CYOutput &out, int precedence, CYFlags flags) const {
if (precedence < Precedence() || (flags & CYNoRightHand) != 0 && RightHand())
out << '(' << *this << ')';
else
Output(out, flags);
}
+void CYFatArrow::Output(CYOutput &out, CYFlags flags) const {
+ out << '(' << parameters_ << ')' << ' ' << "=>" << ' ' << code_;
+}
+
void CYFinally::Output(CYOutput &out) const {
out << ' ' << "finally" << ' ' << code_;
}
statement_->Single(out, CYRight(flags));
}
+void CYTypeArrayOf::Output(CYOutput &out, CYIdentifier *identifier) const {
+ next_->Output(out, Precedence(), identifier);
+ out << '[';
+ out << size_;
+ out << ']';
+}
+
+void CYTypeBlockWith::Output(CYOutput &out, CYIdentifier *identifier) const {
+ out << '(' << '^';
+ next_->Output(out, Precedence(), identifier);
+ out << ')' << '(' << parameters_ << ')';
+}
+
+void CYTypeConstant::Output(CYOutput &out, CYIdentifier *identifier) const {
+ out << "const";
+ next_->Output(out, Precedence(), identifier);
+}
+
+void CYTypeFunctionWith::Output(CYOutput &out, CYIdentifier *identifier) const {
+ next_->Output(out, Precedence(), identifier);
+ out << '(' << parameters_ << ')';
+}
+
+void CYTypePointerTo::Output(CYOutput &out, CYIdentifier *identifier) const {
+ out << '*';
+ next_->Output(out, Precedence(), identifier);
+}
+
+void CYTypeVolatile::Output(CYOutput &out, CYIdentifier *identifier) const {
+ out << "volatile";
+ next_->Output(out, Precedence(), identifier);
+}
+
+void CYTypeModifier::Output(CYOutput &out, int precedence, CYIdentifier *identifier) const {
+ if (this == NULL) {
+ out << identifier;
+ return;
+ }
+
+ bool protect(precedence > Precedence());
+
+ if (protect)
+ out << '(';
+ Output(out, identifier);
+ if (protect)
+ out << ')';
+}
+
+void CYTypedIdentifier::Output(CYOutput &out) const {
+ type_->Output(out, 0, CYNoFlags);
+ modifier_->Output(out, 0, identifier_);
+}
+
+void CYEncodedType::Output(CYOutput &out, CYFlags flags) const {
+ out << "@encode(" << typed_ << ")";
+}
+
+void CYTypedParameter::Output(CYOutput &out) const {
+ out << typed_;
+ if (next_ != NULL)
+ out << ',' << ' ' << next_;
+}
+
+void CYLambda::Output(CYOutput &out, CYFlags flags) const {
+ // XXX: this is seriously wrong
+ out << "[](";
+ out << ")->";
+ out << "{";
+ out << "}";
+}
+
+void CYTypeDefinition::Output(CYOutput &out, CYFlags flags) const {
+ out << "typedef" << *typed_;
+}
+
void CYLetStatement::Output(CYOutput &out, CYFlags flags) const {
out << "let" << ' ' << '(' << *declarations_ << ')';
code_->Single(out, CYRight(flags));