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

Method tryUnwrap

valdi/src/valdi/runtime/JavaScript/JavaScriptValueMarshaller.cpp:172–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172Value JavaScriptValueMarshaller::tryUnwrap(const JSValue& jsValue, JSExceptionTracker& exceptionTracker) {
173 auto& jsObjectStore = _valueDelegate->getJsObjectStore();
174 if (VALDI_LIKELY(!jsObjectStore.hasValueForObjectKey(jsValue))) {
175 return Value::undefined();
176 }
177
178 auto attachedValue = jsObjectStore.getValueForObjectKey(jsValue, exceptionTracker);
179 if (attachedValue == nullptr) {
180 return Value::undefined();
181 }
182
183 auto objectAttachments = castOrNull<PlatformObjectAttachments>(attachedValue);
184 if (objectAttachments == nullptr) {
185 return Value::undefined();
186 }
187
188 return unwrapSingleProxy(*objectAttachments, exceptionTracker);
189}
190
191} // namespace Valdi

Callers 1

jsObjectToValueFunction · 0.80

Calls 3

unwrapSingleProxyFunction · 0.85
hasValueForObjectKeyMethod · 0.80
getValueForObjectKeyMethod · 0.45

Tested by

no test coverage detected