]> git.saurik.com Git - cycript.git/blobdiff - ObjectiveC/Replace.cpp
Keep usage of dlerror() from relying on dlsym().
[cycript.git] / ObjectiveC / Replace.cpp
index a8515a5ee4555610e35dc11c62add543b45dfb17..11262318e4f98972e0748747cb14984e515e4531 100644 (file)
@@ -79,7 +79,7 @@ CYStatement *CYClassStatement::Replace(CYContext &context) {
 }
 
 CYExpression *CYTypeArrayOf::Replace(CYContext &context) {
-    return $ CYCall($ CYDirectMember(next_->Replace(context), $ CYString("arrayOf")), $ CYArgument($ CYNumber(size_)));
+    return $ CYCall($ CYDirectMember(next_->Replace(context), $ CYString("arrayOf")), $ CYArgument(size_));
 }
 
 CYExpression *CYTypeConstant::Replace(CYContext &context) {
@@ -166,6 +166,10 @@ 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("@"))));
+}
+
 CYStatement *CYProtocol::Replace(CYContext &context) const { $T(NULL)
     return $ CYBlock($$->*
         next_->Replace(context)->*
@@ -218,3 +222,11 @@ CYExpression *CYSendDirect::Replace(CYContext &context) {
 CYExpression *CYSendSuper::Replace(CYContext &context) {
     return $ CYSendDirect($V("$cyr"), arguments_);
 }
+
+CYFunctionParameter *CYTypedParameter::Parameters(CYContext &context) { $T(NULL)
+    return $ CYFunctionParameter($ CYDeclaration(typed_->identifier_ ?: context.Unique()), next_->Parameters(context));
+}
+
+CYExpression *CYTypedParameter::TypeSignature(CYContext &context, CYExpression *prefix) { $T(prefix)
+    return next_->TypeSignature(context, $ CYAdd(prefix, typed_->type_->Replace(context)));
+}