X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/690cf1a8442f51ef6d03d9a0a4fb4ee2e9bb714d..a2b8d7ada7c9b527d46e781a217292603379e9e0:/ObjectiveC/Replace.cpp diff --git a/ObjectiveC/Replace.cpp b/ObjectiveC/Replace.cpp index 7c47eea..c3a885c 100644 --- a/ObjectiveC/Replace.cpp +++ b/ObjectiveC/Replace.cpp @@ -78,10 +78,6 @@ CYStatement *CYClassStatement::Replace(CYContext &context) { return $E(Replace_(context)); } -CYExpression *CYEncodedType::Replace(CYContext &context) { - return type_->Replace(context); -} - CYStatement *CYField::Replace(CYContext &context) const { $T(NULL) CYVariable *cyn($V("$cyn")); CYVariable *cyt($V("$cyt")); @@ -97,7 +93,7 @@ CYStatement *CYField::Replace(CYContext &context) const { $T(NULL) } CYStatement *CYImport::Replace(CYContext &context) { - return this; + return $ CYVar($L1($L(module_->part_->Word(), $C1($V("require"), module_->Replace(context, "/"))))); } CYStatement *CYMessage::Replace(CYContext &context, bool replace) const { $T(NULL) @@ -146,12 +142,18 @@ 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_); } CYExpression *CYObjCBlock::Replace(CYContext &context) { - return $N2($V("Functor"), $ CYFunctionExpression(NULL, $ CYFunctionParameter($ CYDeclaration($ CYIdentifier("$cyt")), parameters_->Parameters(context)), statements_), parameters_->TypeSignature(context, $ CYAdd(type_->Replace(context), $ CYString("@")))); + return $C1($ CYEncodedType(($ CYTypedIdentifier(*typed_))->Modify($ CYTypeBlockWith(parameters_))), $ CYFunctionExpression(NULL, parameters_->Parameters(context), statements_)); } CYStatement *CYProtocol::Replace(CYContext &context) const { $T(NULL)