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

Method newFunction

valdi/src/valdi/hermes/HermesJavaScriptContext.cpp:362–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360 auto functionName = newSymbolIDFromString(callable->getReferenceInfo().getName().toStringView());
361
362 auto functionData = makeShared<JSFunctionData>(*this, callable);
363
364 auto functionResult = hermes::vm::FinalizableNativeFunction::createWithoutPrototype(
365 *_runtime, unsafeBridgeRetain(functionData.get()), &callTrampoline, &freeContext, functionName.get(), 0);
366
367 if (!checkException(functionResult.getStatus(), exceptionTracker)) {
368 return newUndefined();
369 }
370
371 return toJSValueRefUncached(functionResult.getValue());
372}
373
374JSValueRef HermesJavaScriptContext::newWeakRef(const JSValue& object, JSExceptionTracker& exceptionTracker) {
375 hermes::vm::GCScope gcScope(*_runtime);
376
377 auto jsObject = toJSObject(object, exceptionTracker);
378 if (!exceptionTracker) {
379 return newUndefined();
380 }

Callers

nothing calls this directly

Calls 6

unsafeBridgeRetainFunction · 0.85
getStatusMethod · 0.80
getMethod · 0.65
getValueMethod · 0.65
toStringViewMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected