[Javascript] For v8 >= 4.3.0, use V8_MAJOR_VERSION.
Fixes https://github.com/swig/swig/issues/561.
This commit is contained in:
parent
8b9a6d3c24
commit
b3bedc210c
7 changed files with 107 additions and 81 deletions
|
|
@ -13,7 +13,7 @@ typedef int (*V8ExtensionInitializer) (v8::Handle<v8::Object> module);
|
|||
|
||||
// Note: these typedefs and defines are used to deal with v8 API changes since version 3.19.00
|
||||
|
||||
#if (SWIG_V8_VERSION < 0x031903)
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
typedef v8::Handle<v8::Value> SwigV8ReturnValue;
|
||||
typedef v8::Arguments SwigV8Arguments;
|
||||
typedef v8::AccessorInfo SwigV8PropertyCallbackInfo;
|
||||
|
|
@ -28,11 +28,11 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
|||
#endif
|
||||
|
||||
|
||||
#if (SWIG_V8_VERSION < 0x032117)
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032117)
|
||||
#define SWIGV8_HANDLESCOPE() v8::HandleScope scope
|
||||
#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope
|
||||
#define SWIGV8_ESCAPE(val) return scope.Close(val)
|
||||
#elif (SWIG_V8_VERSION < 0x032318)
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
|
||||
#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
|
||||
#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope(v8::Isolate::GetCurrent());
|
||||
#define SWIGV8_ESCAPE(val) return scope.Close(val)
|
||||
|
|
@ -42,7 +42,7 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
|||
#define SWIGV8_ESCAPE(val) return scope.Escape(val)
|
||||
#endif
|
||||
|
||||
#if (SWIG_V8_VERSION < 0x032318)
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
|
||||
#define SWIGV8_CURRENT_CONTEXT() v8::Context::GetCurrent()
|
||||
#define SWIGV8_STRING_NEW(str) v8::String::New(str)
|
||||
#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(func)
|
||||
|
|
@ -59,7 +59,7 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
|||
#endif
|
||||
|
||||
|
||||
#if (SWIG_V8_VERSION < 0x031900)
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
typedef v8::Persistent<v8::Context> SwigV8Context;
|
||||
#else
|
||||
typedef v8::Local<v8::Context> SwigV8Context;
|
||||
|
|
@ -149,9 +149,9 @@ bool V8Shell::RunScript(const std::string &scriptPath) {
|
|||
|
||||
context->Exit();
|
||||
|
||||
#if (SWIG_V8_VERSION < 0x031710)
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
context.Dispose();
|
||||
#elif (SWIG_V8_VERSION < 0x031900)
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
context.Dispose(v8::Isolate::GetCurrent());
|
||||
#else
|
||||
// context.Dispose();
|
||||
|
|
@ -193,9 +193,9 @@ bool V8Shell::RunShell() {
|
|||
|
||||
context->Exit();
|
||||
|
||||
#if (SWIG_V8_VERSION < 0x031710)
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
context.Dispose();
|
||||
#elif (SWIG_V8_VERSION < 0x031900)
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
context.Dispose(v8::Isolate::GetCurrent());
|
||||
#else
|
||||
// context.Dispose();
|
||||
|
|
@ -249,7 +249,7 @@ SwigV8Context V8Shell::CreateShellContext() {
|
|||
global->Set(SWIGV8_STRING_NEW("require"), SWIGV8_FUNCTEMPLATE_NEW(V8Shell::Require));
|
||||
global->Set(SWIGV8_STRING_NEW("version"), SWIGV8_FUNCTEMPLATE_NEW(V8Shell::Version));
|
||||
|
||||
#if (SWIG_V8_VERSION < 0x031900)
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
SwigV8Context context = v8::Context::New(NULL, global);
|
||||
return context;
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue