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 auto symbolId = toSymbolID(propertyName);
339 auto str = _runtime->getStringPrimFromSymbolID(symbolId.get());
340
341 auto stringView = hermes::vm::StringPrimitive::createStringView(*_runtime, _runtime->makeHandle(str));
342
343 if (stringView.isASCII()) {
344 return StringCache::getGlobal().makeString(stringView.castToCharPtr(), stringView.length());
345 } else {
346 return StringCache::getGlobal().makeStringFromUTF16(stringView.castToChar16Ptr(), stringView.length());
347 }
348}
349
350JSValueRef HermesJavaScriptContext::newObject(JSExceptionTracker& exceptionTracker) {
351 hermes::vm::GCScope gcScope(*_runtime);
352
353 auto result = hermes::vm::JSObject::create(*_runtime);
354 return toJSValueRefUncached(result.getHermesValue());
355}
356

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