X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/b639f46ddbb1709551093894de01802d818ca30f..561e7f1c23ea3804db1625ab806be939b4e9c5d1:/ObjectiveC/Replace.cpp diff --git a/ObjectiveC/Replace.cpp b/ObjectiveC/Replace.cpp index 3e267ae..a8515a5 100644 --- a/ObjectiveC/Replace.cpp +++ b/ObjectiveC/Replace.cpp @@ -32,7 +32,7 @@ static CYExpression *MessageType(CYContext &context, CYExpression *type, CYMessa if (extra != NULL) left = $ CYAdd(left, extra); - if (next == NULL) + if (next == NULL || next->name_ == NULL) return left; CYExpression *right(next->TypeSignature(context)); @@ -78,8 +78,38 @@ CYStatement *CYClassStatement::Replace(CYContext &context) { return $E(Replace_(context)); } -CYStatement *CYField::Replace(CYContext &context) const { - return NULL; +CYExpression *CYTypeArrayOf::Replace(CYContext &context) { + return $ CYCall($ CYDirectMember(next_->Replace(context), $ CYString("arrayOf")), $ CYArgument($ CYNumber(size_))); +} + +CYExpression *CYTypeConstant::Replace(CYContext &context) { + return $ CYCall($ CYDirectMember(next_->Replace(context), $ CYString("constant"))); +} + +CYExpression *CYTypePointerTo::Replace(CYContext &context) { + return $ CYCall($ CYDirectMember(next_->Replace(context), $ CYString("pointerTo"))); +} + +CYExpression *CYTypeVariable::Replace(CYContext &context) { + return expression_; +} + +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")); + + CYExpression *type($C0($M(type_, $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(name_->Word()), $M(cyn, $S("size")), $M(cyn, $S("alignment")), cyt)) + ); } CYStatement *CYImport::Replace(CYContext &context) { @@ -146,7 +176,7 @@ CYStatement *CYProtocol::Replace(CYContext &context) const { $T(NULL) } CYExpression *CYSelector::Replace(CYContext &context) { - return $N1($V("Selector"), name_->Replace(context)); + return $C1($V("sel_registerName"), name_->Replace(context)); } CYString *CYSelectorPart::Replace(CYContext &context) {