Compatability workaround for debugging Hermes with Block Scoping enabled Issue outlined here: https://github.com/facebook/hermes/issues/1355. Should be fixed in a future release of Static Hermes. This workaround removes duplicate variables from the getProperties response so they display properly in the UI
| 207 | // Hermes. This workaround removes duplicate variables from the getProperties response so they display properly in the |
| 208 | // UI |
| 209 | void HermesDebuggerConnection::handleGetProperties(const Value& message) { |
| 210 | auto properties = message.getMapValue("result").getMapValue("result").getArrayRef(); |
| 211 | if (properties != nullptr) { |
| 212 | struct ValueCompare { |
| 213 | bool operator()(const Value& lhs, const Value& rhs) const { |
| 214 | return lhs.getMapValue("name") == rhs.getMapValue("name"); |
| 215 | } |
| 216 | }; |
| 217 | std::unordered_set<Value, std::hash<Value>, ValueCompare> uniqueValues; |
| 218 | for (const auto& property : *properties) { |
| 219 | uniqueValues.insert(property); |
| 220 | } |
| 221 | std::vector<Value> uniqueProperties(uniqueValues.begin(), uniqueValues.end()); |
| 222 | message.getMapValue("result").setMapValue("result", Value(ValueArray::make(std::move(uniqueProperties)))); |
| 223 | } |
| 224 | submitMessageToCDP(message); |
| 225 | } |
| 226 | |
| 227 | void HermesDebuggerConnection::handlePaused(const Value& message) { |
| 228 | auto callFrames = message.getMapValue("params").getMapValue("callFrames").getArrayRef(); |
nothing calls this directly
no test coverage detected