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

Method setObjectProperty

valdi/src/valdi/quickjs/QuickJSJavaScriptContext.cpp:653–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

651}
652
653void QuickJSJavaScriptContext::setObjectProperty(const Valdi::JSValue& object,
654 const std::string_view& propertyName,
655 const Valdi::JSValue& propertyValue,
656 bool enumerable,
657 Valdi::JSExceptionTracker& exceptionTracker) {
658 auto guard = _threadAccessChecker.guard();
659 // JS_SetProperty() automatically releases the given value.
660 auto retainedJsValue = JS_DupValue(_context, fromValdiJSValue(propertyValue));
661
662 if (VALDI_LIKELY(enumerable)) {
663 checkCall(exceptionTracker,
664 JS_SetPropertyStr(_context, fromValdiJSValue(object), propertyName.data(), retainedJsValue));
665 } else {
666 auto convertedPropertyName = newPropertyName(propertyName);
667 setObjectPropertyNonEumerable(object, convertedPropertyName.get(), retainedJsValue, exceptionTracker);
668 }
669}
670
671void QuickJSJavaScriptContext::setObjectProperty(const Valdi::JSValue& object,
672 const Valdi::JSPropertyName& propertyName,

Callers

nothing calls this directly

Calls 8

JS_DupValueFunction · 0.85
JS_SetPropertyFunction · 0.85
guardMethod · 0.80
fromValdiJSValueFunction · 0.70
fromValdiJSPropertyNameFunction · 0.70
toValdiJSPropertyNameFunction · 0.70
getMethod · 0.65
dataMethod · 0.45

Tested by

no test coverage detected