| 823 | } |
| 824 | |
| 825 | void to_flat(FlatJsonObject &obj, const char *json_object, DynamicString &prefix) |
| 826 | { |
| 827 | TempAllocator4096 ta; |
| 828 | JsonObject jo(ta); |
| 829 | sjson::parse_object(jo, json_object); |
| 830 | |
| 831 | auto cur = json_object::begin(jo); |
| 832 | auto end = json_object::end(jo); |
| 833 | for (; cur != end; ++cur) { |
| 834 | JSON_OBJECT_SKIP_HOLE(jo, cur); |
| 835 | |
| 836 | DynamicString key(default_allocator()); |
| 837 | key = prefix; |
| 838 | if (key.length() != 0) |
| 839 | key += "."; |
| 840 | key += cur->first; |
| 841 | |
| 842 | if (json::type(cur->second) == JsonValueType::OBJECT) { |
| 843 | hash_map::set(obj, key, cur->second); |
| 844 | DynamicString new_prefix(default_allocator()); |
| 845 | to_flat(obj, cur->second, key); |
| 846 | } else { |
| 847 | hash_map::set(obj, key, cur->second); |
| 848 | } |
| 849 | } |
| 850 | } |
| 851 | |
| 852 | s32 modify_unit_components(Unit *unit, const char *unit_json, CompileOptions &opts) |
| 853 | { |
no test coverage detected