MCPcopy Create free account
hub / github.com/Snapchat/Valdi / newArrayWithValues

Method newArrayWithValues

valdi/src/valdi/v8/V8JavaScriptContext.cpp:401–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399 }
400 return toRetainedJSValueRef(IndirectV8Persistent::make(_isolate, result));
401}
402
403Ref<BigInt> V8JavaScriptContext::valueToBigInt(const JSValue& value, JSExceptionTracker& exceptionTracker) {
404 v8::HandleScope handleScope(_isolate);
405 auto jsValue = fromValdiJSValue(_isolate, value, exceptionTracker);
406 if (!exceptionTracker) {
407 return nullptr;
408 }
409 if (!jsValue->IsBigInt()) {
410 exceptionTracker.onError("Expected bigint");
411 return nullptr;
412 }
413 bool lossless;
414 auto integer = jsValue.As<v8::BigInt>()->Int64Value(&lossless);
415 if (lossless) {
416 return BigInt::make(integer);
417 }
418
419 v8::TryCatch catcher(_isolate);
420 auto context = _context.Get(_isolate);
421 v8::Context::Scope contextScope(context);

Callers 1

TEST_PFunction · 0.45

Calls 2

fromValdiJSValueFunction · 0.70
NewFunction · 0.50

Tested by 1

TEST_PFunction · 0.36