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

Method propertyNameToString

valdi/src/valdi/hermes/HermesJavaScriptContext.cpp:340–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340StringBox HermesJavaScriptContext::propertyNameToString(const JSPropertyName& propertyName) {
341 hermes::vm::GCScope gcScope(*_runtime);
342
343 auto symbolId = toSymbolID(propertyName);
344 auto str = _runtime->getStringPrimFromSymbolID(symbolId.get());
345
346 auto stringView = hermes::vm::StringPrimitive::createStringView(*_runtime, _runtime->makeHandle(str));
347
348 if (stringView.isASCII()) {
349 return StringCache::getGlobal().makeString(stringView.castToCharPtr(), stringView.length());
350 } else {
351 return StringCache::getGlobal().makeStringFromUTF16(stringView.castToChar16Ptr(), stringView.length());
352 }
353}
354
355JSValueRef HermesJavaScriptContext::newObject(JSExceptionTracker& exceptionTracker) {
356 hermes::vm::GCScope gcScope(*_runtime);

Callers

nothing calls this directly

Calls 5

getGlobalFunction · 0.85
makeStringMethod · 0.80
makeStringFromUTF16Method · 0.80
getMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected