Skip to content

Commit dfa4f16

Browse files
cameelr0qs
authored andcommitted
fixup! [libevmasm] Add support to import evm assembly json.
1 parent debc817 commit dfa4f16

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

libevmasm/Assembly.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,16 @@ class Assembly
152152
/// Create a JSON representation of the assembly.
153153
Json::Value assemblyJSON(std::map<std::string, unsigned> const& _sourceIndices, bool _includeSourceList = true) const;
154154

155-
/// Loads the JSON representation of assembly.
155+
/// Constructs an @a Assembly from the serialized JSON representation.
156156
/// @param _json JSON object containing assembly in the format produced by assemblyJSON().
157-
/// @param _sourceList list of source names (used to supply the source-list from the root-assembly object to sub-assemblies).
158-
/// @param _level this function might be called recursively, _level reflects the nesting level.
159-
/// @returns Resulting Assembly object loaded from given json.
157+
/// @param _sourceList List of source files the assembly was built from. When the JSON represents
158+
/// the root assembly, the function will read it from the 'sourceList' field and the parameter
159+
/// must be empty. It is only used to pass the list down to recursive calls.
160+
/// @param _level Nesting level of the current assembly in the assembly tree. The root is
161+
/// at level 0 and the value increases down the tree. Necessary to distinguish between creation
162+
/// and deployed objects.
163+
/// @returns Created @a Assembly and the source list read from the 'sourceList' field of the root
164+
/// assembly.
160165
static std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> fromJSON(
161166
Json::Value const& _json,
162167
std::vector<std::string> const& _sourceList = {},
@@ -182,12 +187,12 @@ class Assembly
182187
/// Add all assembly items from given JSON array. This function imports the items by iterating through
183188
/// the code array. This method only works on clean Assembly objects that don't have any items defined yet.
184189
/// @param _json JSON array that contains assembly items (e.g. json['.code'])
185-
/// @param _sourceList list of source names.
190+
/// @param _sourceList List of source names.
186191
void importAssemblyItemsFromJSON(Json::Value const& _code, std::vector<std::string> const& _sourceList);
187192

188193
/// Creates an AssemblyItem from a given JSON representation.
189194
/// @param _json JSON object that consists a single assembly item
190-
/// @param _sourceList list of source names.
195+
/// @param _sourceList List of source names.
191196
/// @returns AssemblyItem of _json argument.
192197
AssemblyItem createAssemblyItemFromJSON(Json::Value const& _json, std::vector<std::string> const& _sourceList);
193198

0 commit comments

Comments
 (0)