package.nan_scriptorigin.h Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nan Show documentation
Show all versions of nan Show documentation
Native Abstractions for Node.js: C++ header for Node 0.8 -> 18 compatibility
/*********************************************************************
* NAN - Native Abstractions for Node.js
*
* Copyright (c) 2021 NAN contributors
*
* MIT License
********************************************************************/
#ifndef NAN_SCRIPTORIGIN_H_
#define NAN_SCRIPTORIGIN_H_
class ScriptOrigin : public v8::ScriptOrigin {
public:
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 9 || \
(V8_MAJOR_VERSION == 9 && (defined(V8_MINOR_VERSION) && (V8_MINOR_VERSION > 0\
|| (V8_MINOR_VERSION == 0 && defined(V8_BUILD_NUMBER) \
&& V8_BUILD_NUMBER >= 1)))))
explicit ScriptOrigin(v8::Local name) :
v8::ScriptOrigin(v8::Isolate::GetCurrent(), name) {}
ScriptOrigin(v8::Local name
, v8::Local line) :
v8::ScriptOrigin(v8::Isolate::GetCurrent()
, name
, To(line).FromMaybe(0)) {}
ScriptOrigin(v8::Local name
, v8::Local line
, v8::Local column) :
v8::ScriptOrigin(v8::Isolate::GetCurrent()
, name
, To(line).FromMaybe(0)
, To(column).FromMaybe(0)) {}
#elif defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 8 || \
(V8_MAJOR_VERSION == 8 && (defined(V8_MINOR_VERSION) && (V8_MINOR_VERSION > 9\
|| (V8_MINOR_VERSION == 9 && defined(V8_BUILD_NUMBER) \
&& V8_BUILD_NUMBER >= 45)))))
explicit ScriptOrigin(v8::Local name) : v8::ScriptOrigin(name) {}
ScriptOrigin(v8::Local name
, v8::Local line) :
v8::ScriptOrigin(name, To(line).FromMaybe(0)) {}
ScriptOrigin(v8::Local name
, v8::Local line
, v8::Local column) :
v8::ScriptOrigin(name
, To(line).FromMaybe(0)
, To(column).FromMaybe(0)) {}
#else
explicit ScriptOrigin(v8::Local name) : v8::ScriptOrigin(name) {}
ScriptOrigin(v8::Local name
, v8::Local line) : v8::ScriptOrigin(name, line) {}
ScriptOrigin(v8::Local name
, v8::Local line
, v8::Local column) :
v8::ScriptOrigin(name, line, column) {}
#endif
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 8 || \
(V8_MAJOR_VERSION == 8 && (defined(V8_MINOR_VERSION) && (V8_MINOR_VERSION > 9\
|| (V8_MINOR_VERSION == 9 && defined(V8_BUILD_NUMBER) \
&& V8_BUILD_NUMBER >= 45)))))
v8::Local ResourceLineOffset() const {
return New(LineOffset());
}
v8::Local ResourceColumnOffset() const {
return New(ColumnOffset());
}
#endif
};
#endif // NAN_SCRIPTORIGIN_H_
© 2015 - 2024 Weber Informatics LLC | Privacy Policy