@@ -111,11 +111,11 @@ end function topological_sort
111111
112112 module procedure construct_from_json
113113 type (fallible_json_value_t) :: maybe_vertices
114+ type (error_list_t) errors
114115
115116 maybe_vertices = json_object% get_element(" vertices" )
116- associate(errors = > maybe_vertices% errors())
117- call assert(.not. errors% has_any(), " dag_s construct_from_json: .not. errors%has_any()" , char (errors% to_string()))
118- end associate
117+ errors = maybe_vertices% errors()
118+ call assert(.not. errors% has_any(), " dag_s construct_from_json: .not. errors%has_any()" , char (errors% to_string()))
119119
120120 select type (vertices = > maybe_vertices% value_())
121121 type is (json_array_t)
@@ -130,20 +130,18 @@ end function topological_sort
130130 module procedure to_json
131131 type (fallible_json_string_t) maybe_key
132132 type (error_list_t) errors
133+ type (json_string_t) vertices_key
134+ type (json_array_t) vertices_value
133135
134136 maybe_key = fallible_json_string_t(" vertices" )
135137 errors = maybe_key% errors()
136138 call assert(.not. errors% has_any(), " dag%to_json: .not. errors%has_any()" , char (errors% to_string()))
137139
138- block
139- type (json_array_t) vertices_value
140140
141- vertices_value = json_array_t(json_element_t(self% vertices% to_json()))
141+ vertices_value = json_array_t(json_element_t(self% vertices% to_json()))
142142
143- associate(vertices_key = > maybe_key% string ())
144- json_object = json_object_t([vertices_key], [json_element_t(vertices_value)])
145- end associate
146- end block
143+ vertices_key = maybe_key% string ()
144+ json_object = json_object_t([vertices_key], [json_element_t(vertices_value)])
147145 end procedure
148146
149147 module procedure num_vertices
0 commit comments