in source/Frame.cpp [393:464]
Json::Value Frame::to_json() const {
auto value = Json::Value(Json::objectValue);
mt_assert(kind_ != nullptr);
auto kind_json = kind_->to_json();
mt_assert(kind_json.isObject());
for (const auto& member : kind_json.getMemberNames()) {
value[member] = kind_json[member];
}
value["callee_port"] = callee_port_.to_json();
if (callee_ != nullptr) {
value["callee"] = callee_->to_json();
} else if (field_callee_ != nullptr) {
value["field_callee"] = field_callee_->to_json();
}
if (call_position_ != nullptr) {
value["call_position"] = call_position_->to_json();
}
if (distance_ != 0) {
value["distance"] = Json::Value(distance_);
}
if (!origins_.empty()) {
value["origins"] = origins_.to_json();
}
if (!field_origins_.empty()) {
value["field_origins"] = field_origins_.to_json();
}
JsonValidation::update_object(value, features().to_json());
if (!locally_inferred_features_.is_bottom() &&
!locally_inferred_features_.empty()) {
value["local_features"] = locally_inferred_features_.to_json();
}
if (via_type_of_ports_.is_value() && !via_type_of_ports_.elements().empty()) {
auto ports = Json::Value(Json::arrayValue);
for (const auto& root : via_type_of_ports_.elements()) {
ports.append(root.to_json());
}
value["via_type_of"] = ports;
}
if (via_value_of_ports_.is_value() &&
!via_value_of_ports_.elements().empty()) {
auto ports = Json::Value(Json::arrayValue);
for (const auto& root : via_value_of_ports_.elements()) {
ports.append(root.to_json());
}
value["via_value_of"] = ports;
}
if (local_positions_.is_value() && !local_positions_.empty()) {
value["local_positions"] = local_positions_.to_json();
}
if (canonical_names_.is_value() && !canonical_names_.elements().empty()) {
auto canonical_names = Json::Value(Json::arrayValue);
for (const auto& canonical_name : canonical_names_.elements()) {
canonical_names.append(canonical_name.to_json());
}
value["canonical_names"] = canonical_names;
}
return value;
}