diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-02 12:38:13 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-02 12:38:13 (GMT) |
commit | a874a181add7b292e52140f8c753f663a4cb5a87 (patch) | |
tree | 1b8958ba2abceef58901b3f90f1f05b44321deab /src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp | |
parent | 9caba3540b4d64a5277040f43bdaabde7ba227a0 (diff) | |
download | uscxml-a874a181add7b292e52140f8c753f663a4cb5a87.zip uscxml-a874a181add7b292e52140f8c753f663a4cb5a87.tar.gz uscxml-a874a181add7b292e52140f8c753f663a4cb5a87.tar.bz2 |
Optional 2nd argument for TypedArray.subarray and more tests
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp')
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp index b10fa96..3e10dfe 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp @@ -230,6 +230,21 @@ JSValueRef JSCInt32Array::subarrayCallback(JSContextRef ctx, JSObjectRef functio return retObj; + } else if (argumentCount == 1 && + JSValueIsNumber(ctx, arguments[0])) { + long localStart = (long)JSValueToNumber(ctx, arguments[0], exception); + + uscxml::Int32Array* retVal = new uscxml::Int32Array(privData->nativeObj->subarray(localStart)); + JSClassRef retClass = JSCInt32Array::getTmpl(); + + struct JSCInt32Array::JSCInt32ArrayPrivate* retPrivData = new JSCInt32Array::JSCInt32ArrayPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + } JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray"); |