From 3b1534c097d91248e048f50f8835f791a3e507a1 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 20 Mar 2013 23:45:48 -0700 Subject: [PATCH 1/1] Allow expressions as array subscripts in @encode. --- Execute.cpp | 2 +- ObjectiveC/Replace.cpp | 2 +- ObjectiveC/Syntax.hpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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) { -- 2.45.2