From 843c8a408cb76e22efc10ede577f17e2e5b7deb2 Mon Sep 17 00:00:00 2001 From: Oliver Buchtala Date: Sat, 8 Sep 2012 01:12:33 +0000 Subject: [PATCH] Fix AsVal macros of long and int for v8. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13813 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/javascript/v8/javascriptprimitives.swg | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Lib/javascript/v8/javascriptprimitives.swg b/Lib/javascript/v8/javascriptprimitives.swg index d3dba485d..bd0295478 100644 --- a/Lib/javascript/v8/javascriptprimitives.swg +++ b/Lib/javascript/v8/javascriptprimitives.swg @@ -29,11 +29,25 @@ v8::Handle SWIG_From_dec(int)(int value) } } +%fragment(SWIG_AsVal_frag(int),"header") { +SWIGINTERN +int SWIG_AsVal_dec(int)(v8::Handle valRef, int* val) +{ + if (!valRef->IsInt32()) { + return SWIG_TypeError; + } + if(val) *val = valRef->IntegerValue(); + + return SWIG_OK; +} +} + + %fragment(SWIG_From_frag(long),"header") { SWIGINTERNINLINE v8::Handle SWIG_From_dec(long)(long value) { - return v8::Integer::New(value); + return v8::Number::New(value); } }