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

Function getTypedArrayType

valdi/src/valdi/hermes/HermesJavaScriptContext.cpp:942–965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

940}
941
942static TypedArrayType getTypedArrayType(const hermes::vm::PinnedHermesValue& hermesValue) {
943 if (hermes::vm::vmisa<hermes::vm::Uint8Array>(hermesValue)) {
944 return Uint8Array;
945 } else if (hermes::vm::vmisa<hermes::vm::Float32Array>(hermesValue)) {
946 return Float32Array;
947 } else if (hermes::vm::vmisa<hermes::vm::Float64Array>(hermesValue)) {
948 return Float64Array;
949 } else if (hermes::vm::vmisa<hermes::vm::Uint8ClampedArray>(hermesValue)) {
950 return Uint8ClampedArray;
951 } else if (hermes::vm::vmisa<hermes::vm::Int8Array>(hermesValue)) {
952 return Int8Array;
953 } else if (hermes::vm::vmisa<hermes::vm::Int16Array>(hermesValue)) {
954 return Int16Array;
955 } else if (hermes::vm::vmisa<hermes::vm::Int32Array>(hermesValue)) {
956 return Int32Array;
957 } else if (hermes::vm::vmisa<hermes::vm::Uint16Array>(hermesValue)) {
958 return Uint16Array;
959 } else if (hermes::vm::vmisa<hermes::vm::Uint32Array>(hermesValue)) {
960 return Uint32Array;
961 } else {
962 SC_ABORT("Unrecognized TypedArray type");
963 return Uint8Array;
964 }
965}
966
967JSTypedArray HermesJavaScriptContext::valueToTypedArray(const JSValue& value, JSExceptionTracker& exceptionTracker) {
968 hermes::vm::GCScope gcScope(*_runtime);

Callers 1

valueToTypedArrayMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected