From: Jay Freeman (saurik) Date: Thu, 21 Mar 2013 06:45:48 +0000 (-0700) Subject: Allow expressions as array subscripts in @encode. X-Git-Tag: v0.9.500%b1~119 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/3b1534c097d91248e048f50f8835f791a3e507a1?ds=inline Allow expressions as array subscripts in @encode. --- diff --git a/Execute.cpp b/Execute.cpp index 74f29f2..36f475b 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -1178,7 +1178,7 @@ static JSValueRef CYValue_callAsFunction_toCYON(JSContextRef context, JSObjectRe static JSValueRef Pointer_callAsFunction_toCYON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry { Pointer *internal(reinterpret_cast(JSObjectGetPrivate(_this))); if (internal->length_ != _not(size_t)) { - JSObjectRef Array(CYGetCachedObject(context, Array_s)); + JSObjectRef Array(CYGetCachedObject(context, CYJSString("Array_prototype"))); JSObjectRef toCYON(CYCastJSObject(context, CYGetProperty(context, Array, toCYON_s))); return CYCallAsFunction(context, toCYON, _this, count, arguments); } else { diff --git a/ObjectiveC/Replace.cpp b/ObjectiveC/Replace.cpp index e0601db..1126231 100644 --- a/ObjectiveC/Replace.cpp +++ b/ObjectiveC/Replace.cpp @@ -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) { diff --git a/ObjectiveC/Syntax.hpp b/ObjectiveC/Syntax.hpp index 96e4604..effaa24 100644 --- a/ObjectiveC/Syntax.hpp +++ b/ObjectiveC/Syntax.hpp @@ -38,9 +38,9 @@ struct CYTypeModifier : struct CYTypeArrayOf : CYTypeModifier { - size_t size_; + CYExpression *size_; - CYTypeArrayOf(size_t size, CYTypeModifier *next = NULL) : + CYTypeArrayOf(CYExpression *size, CYTypeModifier *next = NULL) : CYTypeModifier(next), size_(size) {