106
106
} \
107
107
} while (false )
108
108
109
+ #ifdef __APPLE__
110
+
111
+ // Crash if the condition is false.
112
+ #define CRASH_IF_FALSE (condition ) \
113
+ do { \
114
+ if (!(condition)) { \
115
+ std::terminate (); \
116
+ } \
117
+ } while (false )
118
+
119
+ #else
120
+
109
121
// Crash if the condition is false.
110
122
#define CRASH_IF_FALSE (condition ) \
111
123
do { \
116
128
} \
117
129
} while (false )
118
130
131
+ #endif
132
+
119
133
// Return error status with message.
120
134
#define ERROR_STATUS (status, ...) \
121
135
env.setLastNativeError( \
@@ -209,7 +223,12 @@ union HermesBuildVersionInfo {
209
223
uint64_t version;
210
224
};
211
225
212
- constexpr HermesBuildVersionInfo HermesBuildVersion = {HERMES_FILE_VERSION_BIN};
226
+ #ifdef __APPLE__
227
+ #undef HERMES_FILE_VERSION_BIN
228
+ #define HERMES_FILE_VERSION_BIN 0 ,0 ,0 ,0
229
+ #endif
230
+
231
+ constexpr HermesBuildVersionInfo HermesBuildVersion = {{HERMES_FILE_VERSION_BIN}};
213
232
214
233
// =============================================================================
215
234
// Forward declaration of all classes.
@@ -2218,7 +2237,7 @@ class NapiComplexReference : public NapiReference {
2218
2237
}
2219
2238
if (--refCount_ == 0 ) {
2220
2239
if (value_.isObject ()) {
2221
- weakRoot_ = env.createWeakRoot (getObjectUnsafe (value_));
2240
+ weakRoot_ = std::move ( env.createWeakRoot (getObjectUnsafe (value_) ));
2222
2241
} else {
2223
2242
weakRoot_ = vm::WeakRoot<vm::JSObject>{};
2224
2243
}
@@ -2297,7 +2316,7 @@ class NapiFinalizeCallbackHolder : public TBaseReference {
2297
2316
if (finalizeCallback_) {
2298
2317
napi_finalize finalizeCallback =
2299
2318
std::exchange (finalizeCallback_, nullptr );
2300
- env.callFinalizer (finalizeCallback, nativeData (), finalizeHint ());
2319
+ env.callFinalizer (finalizeCallback, this -> nativeData (), this -> finalizeHint ());
2301
2320
}
2302
2321
return napi_ok;
2303
2322
}
@@ -2331,7 +2350,7 @@ class NapiFinalizingReference final : public TBaseReference {
2331
2350
: TBaseReference(std::forward<TArgs>(args)...) {}
2332
2351
2333
2352
void finalize (NapiEnvironment &env) noexcept override {
2334
- callFinalizeCallback (env);
2353
+ this -> callFinalizeCallback (env);
2335
2354
NapiReference::deleteReference (
2336
2355
env, this , NapiReference::ReasonToDelete::FinalizerCall);
2337
2356
}
@@ -3107,8 +3126,8 @@ NapiEnvironment::NapiEnvironment(
3107
3126
std::shared_ptr<facebook::jsi::PreparedScriptStore> scriptCache,
3108
3127
const vm::RuntimeConfig &runtimeConfig) noexcept
3109
3128
: runtime_(runtime),
3110
- isInspectable_(isInspectable ),
3111
- scriptCache_(std::move(scriptCache) ) {
3129
+ scriptCache_(std::move(scriptCache) ),
3130
+ isInspectable_(isInspectable ) {
3112
3131
switch (runtimeConfig.getCompilationMode ()) {
3113
3132
case vm::SmartCompilation:
3114
3133
compileFlags_.lazy = true ;
@@ -6378,7 +6397,7 @@ napi_status NapiEnvironment::createPreparedScript(
6378
6397
6379
6398
if (scriptCache_) {
6380
6399
uint64_t hash{};
6381
- bool isAscii = murmurhash (buffer->data (), buffer->size (), /* ref*/ hash);
6400
+ murmurhash (buffer->data (), buffer->size (), /* ref*/ hash);
6382
6401
facebook::jsi::JSRuntimeVersion_t runtimeVersion =
6383
6402
HermesBuildVersion.version ;
6384
6403
scriptSignature = {std::string (sourceURL ? sourceURL : " " ), hash};
@@ -6390,7 +6409,7 @@ napi_status NapiEnvironment::createPreparedScript(
6390
6409
cache = scriptCache_->tryGetPreparedScript (
6391
6410
scriptSignature, runtimeSignature, prepareTag);
6392
6411
bcErr = hbc::BCProviderFromBuffer::createBCProviderFromBuffer (
6393
- std::make_unique<JsiBuffer>(move (cache)));
6412
+ std::make_unique<JsiBuffer>(std:: move (cache)));
6394
6413
}
6395
6414
6396
6415
hbc::BCProviderFromSrc *bytecodeProviderFromSrc{};
0 commit comments