| 369 | return toRetainedJSValueRef(IndirectV8Persistent::make(_isolate, func)); |
| 370 | } |
| 371 | |
| 372 | Valdi::JSValueRef V8JavaScriptContext::newBigInt(const Valdi::BigInt& value, |
| 373 | Valdi::JSExceptionTracker& exceptionTracker) { |
| 374 | v8::HandleScope handleScope(_isolate); |
| 375 | if (auto small = value.toInt64()) { |
| 376 | return toRetainedJSValueRef(IndirectV8Persistent::make(_isolate, v8::BigInt::New(_isolate, *small))); |
| 377 | } |
| 378 | |
| 379 | const auto decimal = value.toString(); |
| 380 | if (decimal.size() > static_cast<size_t>(v8::String::kMaxLength)) { |
| 381 | exceptionTracker.onError("BigInt decimal exceeds V8's string capacity"); |
| 382 | return {}; |
| 383 | } |
no test coverage detected