X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/b3378a02d0a811be38e530933fb9a57a3012a823..7eda51e037bcb8edd633c89521961f1683463207:/ObjectiveC/Output.mm diff --git a/ObjectiveC/Output.mm b/ObjectiveC/Output.mm index 3f360a8..33f7ee7 100644 --- a/ObjectiveC/Output.mm +++ b/ObjectiveC/Output.mm @@ -1,20 +1,20 @@ /* Cycript - Optimizing JavaScript Compiler/Runtime - * Copyright (C) 2009-2010 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 . **/ /* }}} */ @@ -61,7 +61,7 @@ void CYClass::Output(CYOutput &out, CYFlags flags) const { out << "return $cyc;"; out << "}("; if (super_ != NULL) - super_->Output(out, CYPA, CYNoFlags); + super_->Output(out, CYAssign::Precedence_, CYNoFlags); else out << "null"; out << "))"; @@ -75,6 +75,12 @@ void CYClassStatement::Output(CYOutput &out, CYFlags flags) const { CYClass::Output(out, flags); } +void CYEncodedType::Output(CYOutput &out, CYFlags flags) const { + out << "@encode("; + // XXX: this is seriously wrong + out << ")"; +} + void CYField::Output(CYOutput &out) const { } @@ -85,7 +91,7 @@ void CYImport::Output(CYOutput &out, CYFlags flags) const { void CYMessage::Output(CYOutput &out, bool replace) const { out << (instance_ ? '-' : '+'); - for (CYMessageParameter *parameter(parameters_); parameter != NULL; parameter = parameter->next_) + CYForEach (parameter, parameters_) if (parameter->tag_ != NULL) { out << ' ' << *parameter->tag_; if (parameter->name_ != NULL) @@ -95,8 +101,21 @@ void CYMessage::Output(CYOutput &out, bool replace) const { out << code_; } +void CYBox::Output(CYOutput &out, CYFlags flags) const { + out << '@'; + value_->Output(out, Precedence(), CYRight(flags)); +} + +void CYObjCBlock::Output(CYOutput &out, CYFlags flags) const { + // XXX: this is seriously wrong + out << "^("; + out << ")"; + out << "{"; + out << "}"; +} + void CYProtocol::Output(CYOutput &out) const { - name_->Output(out, CYPA, CYNoFlags); + name_->Output(out, CYAssign::Precedence_, CYNoFlags); if (next_ != NULL) out << ',' << ' ' << *next_; } @@ -113,7 +132,7 @@ void CYSelectorPart::Output(CYOutput &out) const { } void CYSend::Output(CYOutput &out, CYFlags flags) const { - for (CYArgument *argument(arguments_); argument != NULL; argument = argument->next_) + CYForEach (argument, arguments_) if (argument->name_ != NULL) { out << ' ' << *argument->name_; if (argument->value_ != NULL) @@ -123,7 +142,7 @@ void CYSend::Output(CYOutput &out, CYFlags flags) const { void CYSendDirect::Output(CYOutput &out, CYFlags flags) const { out << '['; - self_->Output(out, CYPA, CYNoFlags); + self_->Output(out, CYAssign::Precedence_, CYNoFlags); CYSend::Output(out, flags); out << ']'; }