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

Method valueToInt

valdi/src/valdi/v8/V8JavaScriptContext.cpp:857–871  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855}
856
857int32_t V8JavaScriptContext::valueToInt(const JSValue& value, JSExceptionTracker& exceptionTracker) {
858 v8::HandleScope handleScope(_isolate);
859
860 auto val = v8::Local<v8::Int32>::Cast(fromValdiJSValue(_isolate, value, exceptionTracker));
861 if (!exceptionTracker) {
862 return 0;
863 }
864
865 if (!val->IsInt32()) {
866 exceptionTracker.onError("Value is not an int32 type and cannot be converted");
867 return 0;
868 }
869
870 return val->Value();
871}
872
873Ref<RefCountable> V8JavaScriptContext::valueToWrappedObject(const JSValue& value,
874 JSExceptionTracker& exceptionTracker) {

Callers 1

marshallMethod · 0.45

Calls 4

fromValdiJSValueFunction · 0.70
onErrorMethod · 0.65
CastFunction · 0.50
ValueMethod · 0.45

Tested by

no test coverage detected