| 1026 | return; |
| 1027 | } |
| 1028 | auto symbolId = hermes::vm::stringToSymbolID(*_runtime, std::move(strResult.getValue())); |
| 1029 | if (!checkException(symbolId.getStatus(), exceptionTracker)) { |
| 1030 | return; |
| 1031 | } |
| 1032 | |
| 1033 | propertyName = toPropertyNameRef(symbolId.getValue()); |
| 1034 | } |
| 1035 | |
| 1036 | if (!propertyName.empty()) { |
| 1037 | if (!visitor.visitPropertyName(*this, object, propertyName.get(), exceptionTracker)) { |
| 1038 | return; |
| 1039 | } |
| 1040 | } |
| 1041 | } |
| 1042 | } |
| 1043 | |
| 1044 | static hermes::vm::CallResult<hermes::vm::PseudoHandle<hermes::vm::StringPrimitive>> toString( |
| 1045 | hermes::vm::Runtime& runtime, const hermes::vm::HermesValue& value) { |
| 1046 | return hermes::vm::toString_RJS(runtime, runtime.makeHandle(value)); |
| 1047 | } |
| 1048 | |
| 1049 | StringBox HermesJavaScriptContext::valueToString(const JSValue& value, JSExceptionTracker& exceptionTracker) { |
| 1050 | hermes::vm::GCScope gcScope(*_runtime); |
| 1051 | auto result = toString(*_runtime, toHermesValue(value)); |
| 1052 | |
| 1053 | if (!checkException(result.getStatus(), exceptionTracker)) { |
| 1054 | return StringBox(); |
| 1055 | } |
| 1056 | |
| 1057 | auto stringView = |
| 1058 | hermes::vm::StringPrimitive::createStringView(*_runtime, _runtime->makeHandle(std::move(result.getValue()))); |
| 1059 | |
| 1060 | if (stringView.isASCII()) { |
| 1061 | return StringCache::getGlobal().makeString(stringView.castToCharPtr(), stringView.length()); |
| 1062 | } else { |
| 1063 | return StringCache::getGlobal().makeStringFromUTF16(stringView.castToChar16Ptr(), stringView.length()); |
| 1064 | } |
| 1065 | } |
| 1066 | |
| 1067 | Ref<StaticString> HermesJavaScriptContext::valueToStaticString(const JSValue& value, |
| 1068 | JSExceptionTracker& exceptionTracker) { |
| 1069 | hermes::vm::GCScope gcScope(*_runtime); |
| 1070 | auto result = toString(*_runtime, toHermesValue(value)); |
| 1071 | |
| 1072 | if (!checkException(result.getStatus(), exceptionTracker)) { |
| 1073 | return nullptr; |
| 1074 | } |
| 1075 |
nothing calls this directly
no test coverage detected