Skip to content

Commit

Permalink
add support for node master (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
Flarna authored and kkoopa committed Dec 18, 2018
1 parent 1b77c11 commit d113c02
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 20 additions & 2 deletions nan_converters_43_inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ imp::ToFactory<v8::TYPE>::convert(v8::Local<v8::Value> val) { \
.FromMaybe(v8::Local<v8::TYPE>())); \
}

X(Boolean)
X(Number)
X(String)
X(Object)
X(Integer)
X(Uint32)
X(Int32)
#if NODE_MODULE_VERSION <= NODE_11_0_MODULE_VERSION
X(Boolean)
#else
imp::ToFactory<v8::Boolean>::return_t \
imp::ToFactory<v8::Boolean>::convert(v8::Local<v8::Value> val) { \
v8::Isolate *isolate = v8::Isolate::GetCurrent(); \
v8::EscapableHandleScope scope(isolate); \
return scope.Escape(val->ToBoolean(isolate)); \
}
#endif

#undef X

Expand All @@ -37,11 +46,20 @@ imp::ToFactory<TYPE>::convert(v8::Local<v8::Value> val) { \
return val->NAME ## Value(isolate->GetCurrentContext()); \
}

X(bool, Boolean)
X(double, Number)
X(int64_t, Integer)
X(uint32_t, Uint32)
X(int32_t, Int32)
#if NODE_MODULE_VERSION <= NODE_11_0_MODULE_VERSION
X(bool, Boolean)
#else
imp::ToFactory<bool>::return_t \
imp::ToFactory<bool>::convert(v8::Local<v8::Value> val) { \
v8::Isolate *isolate = v8::Isolate::GetCurrent(); \
v8::HandleScope scope(isolate); \
return Just<bool>(val->BooleanValue(isolate)); \
}
#endif

#undef X

Expand Down
4 changes: 4 additions & 0 deletions nan_implementation_12_inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ Factory<v8::String>::New(ExternalOneByteStringResource * value) {
// TODO(bnoordhuis) Use isolate-based version in Node.js v12.
Factory<v8::StringObject>::return_t
Factory<v8::StringObject>::New(v8::Local<v8::String> value) {
#if NODE_MODULE_VERSION > NODE_11_0_MODULE_VERSION
return v8::StringObject::New(v8::Isolate::GetCurrent(), value).As<v8::StringObject>();
#else
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
Expand All @@ -360,6 +363,7 @@ Factory<v8::StringObject>::New(v8::Local<v8::String> value) {
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
}

//=== Unbound Script ===========================================================
Expand Down

0 comments on commit d113c02

Please sign in to comment.