|
15 | 15 | #include <string>
|
16 | 16 | #include <vector>
|
17 | 17 |
|
18 |
| -#ifndef JSI_EXPORT |
19 |
| -#ifdef _MSC_VER |
20 |
| -#ifdef CREATE_SHARED_LIBRARY |
21 |
| -#define JSI_EXPORT __declspec(dllexport) |
22 |
| -#else |
23 |
| -#define JSI_EXPORT |
24 |
| -#endif // CREATE_SHARED_LIBRARY |
25 |
| -#else // _MSC_VER |
26 |
| -#define JSI_EXPORT __attribute__((visibility("default"))) |
27 |
| -#endif // _MSC_VER |
28 |
| -#endif // !defined(JSI_EXPORT) |
29 |
| - |
30 | 18 | // JSI version defines set of features available in the API.
|
31 | 19 | // Each significant API change must be under a new version.
|
| 20 | +// The JSI_VERSION can be provided as a parameter to compiler |
| 21 | +// or in the optional "jsi_version.h" file. |
| 22 | + |
| 23 | +#ifndef JSI_VERSION |
| 24 | +#if defined(__has_include) && __has_include(<jsi/jsi-version.h>) |
| 25 | +#include <jsi/jsi-version.h> |
| 26 | +#endif |
| 27 | +#endif |
| 28 | + |
32 | 29 | #ifndef JSI_VERSION
|
| 30 | +// Use the latest version by default |
33 | 31 | #define JSI_VERSION 12
|
34 | 32 | #endif
|
35 | 33 |
|
|
45 | 43 | #define JSI_CONST_10
|
46 | 44 | #endif
|
47 | 45 |
|
| 46 | +#ifndef JSI_EXPORT |
| 47 | +#ifdef _MSC_VER |
| 48 | +#ifdef CREATE_SHARED_LIBRARY |
| 49 | +#define JSI_EXPORT __declspec(dllexport) |
| 50 | +#else |
| 51 | +#define JSI_EXPORT |
| 52 | +#endif // CREATE_SHARED_LIBRARY |
| 53 | +#else // _MSC_VER |
| 54 | +#define JSI_EXPORT __attribute__((visibility("default"))) |
| 55 | +#endif // _MSC_VER |
| 56 | +#endif // !defined(JSI_EXPORT) |
| 57 | + |
48 | 58 | class FBJSRuntime;
|
49 | 59 | namespace facebook {
|
50 | 60 | namespace jsi {
|
@@ -241,6 +251,7 @@ class JSI_EXPORT Runtime {
|
241 | 251 | /// \param callback a function to be executed as a microtask.
|
242 | 252 | virtual void queueMicrotask(const jsi::Function& callback) = 0;
|
243 | 253 | #endif
|
| 254 | + |
244 | 255 | #if JSI_VERSION >= 4
|
245 | 256 | /// Drain the JavaScript VM internal Microtask (a.k.a. Job in ECMA262) queue.
|
246 | 257 | ///
|
@@ -1592,6 +1603,7 @@ class JSI_EXPORT JSError : public JSIException {
|
1592 | 1603 | return *value_;
|
1593 | 1604 | }
|
1594 | 1605 |
|
| 1606 | + //TODO: (vmoroz) Can we remove it considering that we have the new JSError constructor? |
1595 | 1607 | // In V8's case, creating an Error object in JS doesn't record the callstack.
|
1596 | 1608 | // To preserve it, we need a way to manually add the stack here and on the JS
|
1597 | 1609 | // side.
|
|
0 commit comments