X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/d2f6e642b39b0bc356fbabc61d9cf27267b48d2f..be2fde8755ef463f48111bd2090e3bb29d16e8d7:/ObjectiveC/Replace.cpp diff --git a/ObjectiveC/Replace.cpp b/ObjectiveC/Replace.cpp index 1f92319..d90eecf 100644 --- a/ObjectiveC/Replace.cpp +++ b/ObjectiveC/Replace.cpp @@ -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 . + * 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 . **/ /* }}} */ @@ -24,11 +24,11 @@ #include -static CYExpression *MessageType(CYContext &context, CYExpression *type, CYMessageParameter *next, CYExpression *extra = NULL) { +static CYExpression *MessageType(CYContext &context, CYTypedIdentifier *type, CYMessageParameter *next, CYExpression *extra = NULL) { if (type == NULL) return NULL; - CYExpression *left($C0($M(type, $S("toString")))); + CYExpression *left($C0($M(type->Replace(context), $S("toString")))); if (extra != NULL) left = $ CYAdd(left, extra); @@ -85,17 +85,13 @@ CYStatement *CYField::Replace(CYContext &context) const { $T(NULL) CYExpression *type($C0($M(typed_->Replace(context), $S("toString")))); return $ CYBlock($$->* - next_->Replace(context)->* $E($ CYAssign(cyt, type))->* $E($ CYAssign(cyn, $N1($V("Type"), cyt)))->* - $E($C5($V("class_addIvar"), $V("$cyc"), $S(typed_->identifier_->Word()), $M(cyn, $S("size")), $M(cyn, $S("alignment")), cyt)) + $E($C5($V("class_addIvar"), $V("$cyc"), $S(typed_->identifier_->Word()), $M(cyn, $S("size")), $M(cyn, $S("alignment")), cyt))->* + next_->Replace(context) ); } -CYStatement *CYImport::Replace(CYContext &context) { - return $ CYVar($L1($L(module_->part_->Word(), $C1($V("require"), module_->Replace(context, "/"))))); -} - CYExpression *CYInstanceLiteral::Replace(CYContext &context) { return $N1($V("Instance"), number_); } @@ -146,12 +142,6 @@ CYExpression *CYMessageParameter::TypeSignature(CYContext &context) const { return MessageType(context, type_, next_); } -CYString *CYModule::Replace(CYContext &context, const char *separator) const { - if (next_ == NULL) - return $ CYString(part_); - return $ CYString($pool.strcat(next_->Replace(context, separator)->Value(), separator, part_->Word(), NULL)); -} - CYExpression *CYBox::Replace(CYContext &context) { return $C1($M($V("Instance"), $S("box")), value_); } @@ -206,7 +196,7 @@ CYExpression *CYSendDirect::Replace(CYContext &context) { argument = &(*argument)->next_; } - return $C2($V("objc_msgSend"), self_, ($ CYSelector(selector))->Replace(context), arguments_); + return $C2($V("objc_msgSend"), self_, selector->Replace(context), arguments_); } CYExpression *CYSendSuper::Replace(CYContext &context) {