/src/solidity/libsolidity/ast/ASTJsonImporter.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | This file is part of solidity. |
3 | | |
4 | | solidity is free software: you can redistribute it and/or modify |
5 | | it under the terms of the GNU General Public License as published by |
6 | | the Free Software Foundation, either version 3 of the License, or |
7 | | (at your option) any later version. |
8 | | |
9 | | solidity is distributed in the hope that it will be useful, |
10 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | | GNU General Public License for more details. |
13 | | |
14 | | You should have received a copy of the GNU General Public License |
15 | | along with solidity. If not, see <http://www.gnu.org/licenses/>. |
16 | | */ |
17 | | // SPDX-License-Identifier: GPL-3.0 |
18 | | /** |
19 | | * @author julius <djudju@protonmail.com> |
20 | | * @date 2019 |
21 | | *Component that imports an AST from json format to the internal format |
22 | | */ |
23 | | |
24 | | #include <libsolidity/ast/ASTJsonImporter.h> |
25 | | #include <libsolidity/ast/UserDefinableOperators.h> |
26 | | |
27 | | #include <libyul/AsmJsonImporter.h> |
28 | | #include <libyul/AST.h> |
29 | | #include <libyul/Dialect.h> |
30 | | #include <libyul/backends/evm/EVMDialect.h> |
31 | | |
32 | | #include <liblangutil/Exceptions.h> |
33 | | #include <liblangutil/Scanner.h> |
34 | | #include <liblangutil/SourceLocation.h> |
35 | | #include <liblangutil/Token.h> |
36 | | |
37 | | #include <boost/algorithm/string/split.hpp> |
38 | | #include <boost/algorithm/string.hpp> |
39 | | |
40 | | #include <range/v3/algorithm/find_if.hpp> |
41 | | |
42 | | namespace solidity::frontend |
43 | | { |
44 | | |
45 | | using SourceLocation = langutil::SourceLocation; |
46 | | |
47 | | template<class T> |
48 | | ASTPointer<T> ASTJsonImporter::nullOrCast(Json const& _json) |
49 | 0 | { |
50 | 0 | if (_json.is_null()) |
51 | 0 | return nullptr; |
52 | 0 | else |
53 | 0 | return std::dynamic_pointer_cast<T>(convertJsonToASTNode(_json)); |
54 | 0 | } Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::StorageLayoutSpecifier> solidity::frontend::ASTJsonImporter::nullOrCast<solidity::frontend::StorageLayoutSpecifier>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::TypeName> solidity::frontend::ASTJsonImporter::nullOrCast<solidity::frontend::TypeName>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Expression> solidity::frontend::ASTJsonImporter::nullOrCast<solidity::frontend::Expression>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Statement> solidity::frontend::ASTJsonImporter::nullOrCast<solidity::frontend::Statement>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ParameterList> solidity::frontend::ASTJsonImporter::nullOrCast<solidity::frontend::ParameterList>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ExpressionStatement> solidity::frontend::ASTJsonImporter::nullOrCast<solidity::frontend::ExpressionStatement>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) |
55 | | |
56 | | |
57 | | // ============ public =========================== |
58 | | |
59 | | std::map<std::string, ASTPointer<SourceUnit>> ASTJsonImporter::jsonToSourceUnit(std::map<std::string, Json> const& _sourceList) |
60 | 0 | { |
61 | 0 | for (auto const& src: _sourceList) |
62 | 0 | m_sourceNames.emplace_back(std::make_shared<std::string const>(src.first)); |
63 | 0 | for (auto const& srcPair: _sourceList) |
64 | 0 | { |
65 | 0 | astAssert(!srcPair.second.is_null()); |
66 | 0 | astAssert(member(srcPair.second,"nodeType") == "SourceUnit", "The 'nodeType' of the highest node must be 'SourceUnit'."); |
67 | 0 | m_sourceUnits[srcPair.first] = createSourceUnit(srcPair.second, srcPair.first); |
68 | 0 | } |
69 | 0 | return m_sourceUnits; |
70 | 0 | } |
71 | | |
72 | | // ============ private =========================== |
73 | | |
74 | | // =========== general creation functions ============== |
75 | | template <typename T, typename... Args> |
76 | | ASTPointer<T> ASTJsonImporter::createASTNode(Json const& _node, Args&&... _args) |
77 | 0 | { |
78 | 0 | static_assert(std::is_same_v<Json::number_unsigned_t, uint64_t>); |
79 | 0 | astAssert(member(_node, "id").is_number_integer(), "'id'-field must be 64bit integer."); |
80 | | |
81 | 0 | int64_t id = static_cast<Json::number_integer_t>(_node["id"]); |
82 | |
|
83 | 0 | astAssert(m_usedIDs.insert(id).second, "Found duplicate node ID!"); |
84 | | |
85 | 0 | auto n = std::make_shared<T>( |
86 | 0 | id, |
87 | 0 | createSourceLocation(_node), |
88 | 0 | std::forward<Args>(_args)... |
89 | 0 | ); |
90 | 0 | return n; |
91 | 0 | } Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::SourceUnit> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::SourceUnit, std::__1::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::ASTNode>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::ASTNode> > >&, bool&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::ASTNode>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::ASTNode> > >&, bool&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::PragmaDirective> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::PragmaDirective, std::__1::vector<solidity::langutil::Token, std::__1::allocator<solidity::langutil::Token> >&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::vector<solidity::langutil::Token, std::__1::allocator<solidity::langutil::Token> >&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ImportDirective> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ImportDirective, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, solidity::langutil::SourceLocation, std::__1::vector<solidity::frontend::ImportDirective::SymbolAlias, std::__1::allocator<solidity::frontend::ImportDirective::SymbolAlias> > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, solidity::langutil::SourceLocation&&, std::__1::vector<solidity::frontend::ImportDirective::SymbolAlias, std::__1::allocator<solidity::frontend::ImportDirective::SymbolAlias> >&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ContractDefinition> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ContractDefinition, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>, std::__1::vector<std::__1::shared_ptr<solidity::frontend::InheritanceSpecifier>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::InheritanceSpecifier> > >&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::ASTNode>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::ASTNode> > >&, solidity::frontend::ContractKind, bool, std::__1::shared_ptr<solidity::frontend::StorageLayoutSpecifier> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>&&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::InheritanceSpecifier>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::InheritanceSpecifier> > >&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::ASTNode>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::ASTNode> > >&, solidity::frontend::ContractKind&&, bool&&, std::__1::shared_ptr<solidity::frontend::StorageLayoutSpecifier>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::StorageLayoutSpecifier> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::StorageLayoutSpecifier, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::IdentifierPath> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::IdentifierPath, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, std::__1::vector<solidity::langutil::SourceLocation, std::__1::allocator<solidity::langutil::SourceLocation> >&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, std::__1::vector<solidity::langutil::SourceLocation, std::__1::allocator<solidity::langutil::SourceLocation> >&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::InheritanceSpecifier> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::InheritanceSpecifier, std::__1::shared_ptr<solidity::frontend::IdentifierPath>, std::__1::unique_ptr<std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >, std::__1::default_delete<std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > > > > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::IdentifierPath>&&, std::__1::unique_ptr<std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >, std::__1::default_delete<std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > > > >&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::UsingForDirective> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::UsingForDirective, std::__1::vector<std::__1::shared_ptr<solidity::frontend::IdentifierPath>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::IdentifierPath> > >, std::__1::vector<std::__1::optional<solidity::langutil::Token>, std::__1::allocator<std::__1::optional<solidity::langutil::Token> > >, bool, std::__1::shared_ptr<solidity::frontend::TypeName>, bool>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::IdentifierPath>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::IdentifierPath> > >&&, std::__1::vector<std::__1::optional<solidity::langutil::Token>, std::__1::allocator<std::__1::optional<solidity::langutil::Token> > >&&, bool&&, std::__1::shared_ptr<solidity::frontend::TypeName>&&, bool&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::StructDefinition> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::StructDefinition, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, std::__1::vector<std::__1::shared_ptr<solidity::frontend::VariableDeclaration>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::VariableDeclaration> > >&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::VariableDeclaration>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::VariableDeclaration> > >&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::EnumDefinition> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::EnumDefinition, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, std::__1::vector<std::__1::shared_ptr<solidity::frontend::EnumValue>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::EnumValue> > >&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::EnumValue>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::EnumValue> > >&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::EnumValue> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::EnumValue, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::UserDefinedValueTypeDefinition> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::UserDefinedValueTypeDefinition, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, std::__1::shared_ptr<solidity::frontend::TypeName> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, std::__1::shared_ptr<solidity::frontend::TypeName>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ParameterList> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ParameterList, std::__1::vector<std::__1::shared_ptr<solidity::frontend::VariableDeclaration>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::VariableDeclaration> > >&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::VariableDeclaration>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::VariableDeclaration> > >&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::OverrideSpecifier> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::OverrideSpecifier, std::__1::vector<std::__1::shared_ptr<solidity::frontend::IdentifierPath>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::IdentifierPath> > >&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::IdentifierPath>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::IdentifierPath> > >&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::FunctionDefinition> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::FunctionDefinition, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, solidity::frontend::Visibility&, solidity::frontend::StateMutability, bool&, solidity::langutil::Token&, bool, std::__1::shared_ptr<solidity::frontend::OverrideSpecifier>, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>, std::__1::shared_ptr<solidity::frontend::ParameterList>, std::__1::vector<std::__1::shared_ptr<solidity::frontend::ModifierInvocation>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::ModifierInvocation> > >&, std::__1::shared_ptr<solidity::frontend::ParameterList>, std::__1::shared_ptr<solidity::frontend::Block> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, solidity::frontend::Visibility&, solidity::frontend::StateMutability&&, bool&, solidity::langutil::Token&, bool&&, std::__1::shared_ptr<solidity::frontend::OverrideSpecifier>&&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>&&, std::__1::shared_ptr<solidity::frontend::ParameterList>&&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::ModifierInvocation>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::ModifierInvocation> > >&, std::__1::shared_ptr<solidity::frontend::ParameterList>&&, std::__1::shared_ptr<solidity::frontend::Block>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::VariableDeclaration> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::VariableDeclaration, std::__1::shared_ptr<solidity::frontend::TypeName>, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, std::__1::shared_ptr<solidity::frontend::Expression>, solidity::frontend::Visibility, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>, bool, solidity::frontend::VariableDeclaration::Mutability&, std::__1::shared_ptr<solidity::frontend::OverrideSpecifier>, solidity::frontend::VariableDeclaration::Location>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::TypeName>&&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, std::__1::shared_ptr<solidity::frontend::Expression>&&, solidity::frontend::Visibility&&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>&&, bool&&, solidity::frontend::VariableDeclaration::Mutability&, std::__1::shared_ptr<solidity::frontend::OverrideSpecifier>&&, solidity::frontend::VariableDeclaration::Location&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ModifierDefinition> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ModifierDefinition, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>, std::__1::shared_ptr<solidity::frontend::ParameterList>, bool, std::__1::shared_ptr<solidity::frontend::OverrideSpecifier>, std::__1::shared_ptr<solidity::frontend::Block> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>&&, std::__1::shared_ptr<solidity::frontend::ParameterList>&&, bool&&, std::__1::shared_ptr<solidity::frontend::OverrideSpecifier>&&, std::__1::shared_ptr<solidity::frontend::Block>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ModifierInvocation> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ModifierInvocation, std::__1::shared_ptr<solidity::frontend::IdentifierPath>, std::__1::unique_ptr<std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >, std::__1::default_delete<std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > > > > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::IdentifierPath>&&, std::__1::unique_ptr<std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >, std::__1::default_delete<std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > > > >&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::EventDefinition> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::EventDefinition, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>, std::__1::shared_ptr<solidity::frontend::ParameterList>, bool>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>&&, std::__1::shared_ptr<solidity::frontend::ParameterList>&&, bool&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ErrorDefinition> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ErrorDefinition, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>, std::__1::shared_ptr<solidity::frontend::ParameterList> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, std::__1::shared_ptr<solidity::frontend::StructuredDocumentation>&&, std::__1::shared_ptr<solidity::frontend::ParameterList>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ElementaryTypeName> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ElementaryTypeName, solidity::langutil::ElementaryTypeNameToken&, std::__1::optional<solidity::frontend::StateMutability>&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, solidity::langutil::ElementaryTypeNameToken&, std::__1::optional<solidity::frontend::StateMutability>&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::UserDefinedTypeName> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::UserDefinedTypeName, std::__1::shared_ptr<solidity::frontend::IdentifierPath> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::IdentifierPath>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::FunctionTypeName> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::FunctionTypeName, std::__1::shared_ptr<solidity::frontend::ParameterList>, std::__1::shared_ptr<solidity::frontend::ParameterList>, solidity::frontend::Visibility, solidity::frontend::StateMutability>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::ParameterList>&&, std::__1::shared_ptr<solidity::frontend::ParameterList>&&, solidity::frontend::Visibility&&, solidity::frontend::StateMutability&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Mapping> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Mapping, std::__1::shared_ptr<solidity::frontend::TypeName>, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation, std::__1::shared_ptr<solidity::frontend::TypeName>, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::TypeName>&&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&, std::__1::shared_ptr<solidity::frontend::TypeName>&&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ArrayTypeName> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ArrayTypeName, std::__1::shared_ptr<solidity::frontend::TypeName>, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::TypeName>&&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::InlineAssembly> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::InlineAssembly, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::yul::Dialect const&, std::__1::shared_ptr<std::__1::vector<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > >, std::__1::shared_ptr<solidity::yul::AST>&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::yul::Dialect const&, std::__1::shared_ptr<std::__1::vector<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > >&&, std::__1::shared_ptr<solidity::yul::AST>&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Block> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Block, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, bool&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::Statement>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Statement> > >&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, bool&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::Statement>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Statement> > >&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::PlaceholderStatement> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::PlaceholderStatement, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::IfStatement> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::IfStatement, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::shared_ptr<solidity::frontend::Statement>, std::__1::shared_ptr<solidity::frontend::Statement> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::shared_ptr<solidity::frontend::Statement>&&, std::__1::shared_ptr<solidity::frontend::Statement>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::TryCatchClause> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::TryCatchClause, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::ParameterList>, std::__1::shared_ptr<solidity::frontend::Block> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::ParameterList>&&, std::__1::shared_ptr<solidity::frontend::Block>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::TryStatement> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::TryStatement, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::vector<std::__1::shared_ptr<solidity::frontend::TryCatchClause>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::TryCatchClause> > >&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::TryCatchClause>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::TryCatchClause> > >&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::WhileStatement> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::WhileStatement, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::shared_ptr<solidity::frontend::Statement>, bool&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::shared_ptr<solidity::frontend::Statement>&&, bool&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ForStatement> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ForStatement, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::Statement>, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::shared_ptr<solidity::frontend::ExpressionStatement>, std::__1::shared_ptr<solidity::frontend::Statement> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::Statement>&&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::shared_ptr<solidity::frontend::ExpressionStatement>&&, std::__1::shared_ptr<solidity::frontend::Statement>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Continue> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Continue, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Break> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Break, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Return> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Return, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Throw> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Throw, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::EmitStatement> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::EmitStatement, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::FunctionCall> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::FunctionCall>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::RevertStatement> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::RevertStatement, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::FunctionCall> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::FunctionCall>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::VariableDeclarationStatement> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::VariableDeclarationStatement, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::vector<std::__1::shared_ptr<solidity::frontend::VariableDeclaration>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::VariableDeclaration> > >&, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::VariableDeclaration>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::VariableDeclaration> > >&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ExpressionStatement> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ExpressionStatement, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Conditional> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Conditional, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Assignment> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Assignment, std::__1::shared_ptr<solidity::frontend::Expression>, solidity::langutil::Token, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::Expression>&&, solidity::langutil::Token&&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::TupleExpression> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::TupleExpression, std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >&, bool>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >&, bool&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::UnaryOperation> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::UnaryOperation, solidity::langutil::Token, std::__1::shared_ptr<solidity::frontend::Expression>, bool>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, solidity::langutil::Token&&, std::__1::shared_ptr<solidity::frontend::Expression>&&, bool&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::BinaryOperation> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::BinaryOperation, std::__1::shared_ptr<solidity::frontend::Expression>, solidity::langutil::Token, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::Expression>&&, solidity::langutil::Token&&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::FunctionCall> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::FunctionCall, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >&, std::__1::vector<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&, std::__1::vector<solidity::langutil::SourceLocation, std::__1::allocator<solidity::langutil::SourceLocation> > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >&, std::__1::vector<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&, std::__1::vector<solidity::langutil::SourceLocation, std::__1::allocator<solidity::langutil::SourceLocation> >&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::FunctionCallOptions> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::FunctionCallOptions, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >&, std::__1::vector<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::vector<std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::allocator<std::__1::shared_ptr<solidity::frontend::Expression> > >&, std::__1::vector<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::NewExpression> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::NewExpression, std::__1::shared_ptr<solidity::frontend::TypeName> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::TypeName>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::MemberAccess> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::MemberAccess, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, solidity::langutil::SourceLocation>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&, solidity::langutil::SourceLocation&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::IndexAccess> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::IndexAccess, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::IndexRangeAccess> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::IndexRangeAccess, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::shared_ptr<solidity::frontend::Expression>, std::__1::shared_ptr<solidity::frontend::Expression> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::shared_ptr<solidity::frontend::Expression>&&, std::__1::shared_ptr<solidity::frontend::Expression>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Identifier> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Identifier, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::ElementaryTypeNameExpression> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::ElementaryTypeNameExpression, std::__1::shared_ptr<solidity::frontend::ElementaryTypeName> >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<solidity::frontend::ElementaryTypeName>&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Literal> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::Literal, solidity::langutil::Token, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, solidity::frontend::Literal::SubDenomination>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, solidity::langutil::Token&&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, solidity::frontend::Literal::SubDenomination&&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::StructuredDocumentation> solidity::frontend::ASTJsonImporter::createASTNode<solidity::frontend::StructuredDocumentation, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&&) |
92 | | |
93 | | SourceLocation const ASTJsonImporter::createSourceLocation(Json const& _node) |
94 | 0 | { |
95 | 0 | astAssert(member(_node, "src").is_string(), "'src' must be a string"); |
96 | | |
97 | 0 | return solidity::langutil::parseSourceLocation(_node["src"].get<std::string>(), m_sourceNames); |
98 | 0 | } |
99 | | |
100 | | std::optional<std::vector<SourceLocation>> ASTJsonImporter::createSourceLocations(Json const& _node) const |
101 | 0 | { |
102 | 0 | std::vector<SourceLocation> locations; |
103 | |
|
104 | 0 | if (_node.contains("nameLocations") && _node["nameLocations"].is_array()) |
105 | 0 | { |
106 | 0 | for (auto const& val: _node["nameLocations"]) |
107 | 0 | locations.emplace_back(langutil::parseSourceLocation(val.get<std::string>(), m_sourceNames)); |
108 | 0 | return locations; |
109 | 0 | } |
110 | | |
111 | 0 | return std::nullopt; |
112 | 0 | } |
113 | | |
114 | | SourceLocation ASTJsonImporter::createNameSourceLocation(Json const& _node) |
115 | 0 | { |
116 | 0 | astAssert(member(_node, "nameLocation").is_string(), "'nameLocation' must be a string"); |
117 | | |
118 | 0 | return solidity::langutil::parseSourceLocation(_node["nameLocation"].get<std::string>(), m_sourceNames); |
119 | 0 | } |
120 | | |
121 | | SourceLocation ASTJsonImporter::createKeyNameSourceLocation(Json const& _node) |
122 | 0 | { |
123 | 0 | astAssert(member(_node, "keyNameLocation").is_string(), "'keyNameLocation' must be a string"); |
124 | | |
125 | 0 | return solidity::langutil::parseSourceLocation(_node["keyNameLocation"].get<std::string>(), m_sourceNames); |
126 | 0 | } |
127 | | |
128 | | SourceLocation ASTJsonImporter::createValueNameSourceLocation(Json const& _node) |
129 | 0 | { |
130 | 0 | astAssert(member(_node, "valueNameLocation").is_string(), "'valueNameLocation' must be a string"); |
131 | | |
132 | 0 | return solidity::langutil::parseSourceLocation(_node["valueNameLocation"].get<std::string>(), m_sourceNames); |
133 | 0 | } |
134 | | |
135 | | template<class T> |
136 | | ASTPointer<T> ASTJsonImporter::convertJsonToASTNode(Json const& _node) |
137 | 0 | { |
138 | 0 | ASTPointer<T> ret = std::dynamic_pointer_cast<T>(convertJsonToASTNode(_node)); |
139 | 0 | astAssert(ret, "cast of converted json-node must not be nullptr"); |
140 | 0 | return ret; |
141 | 0 | } Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Expression> solidity::frontend::ASTJsonImporter::convertJsonToASTNode<solidity::frontend::Expression>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::TypeName> solidity::frontend::ASTJsonImporter::convertJsonToASTNode<solidity::frontend::TypeName>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Statement> solidity::frontend::ASTJsonImporter::convertJsonToASTNode<solidity::frontend::Statement>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) Unexecuted instantiation: std::__1::shared_ptr<solidity::frontend::Block> solidity::frontend::ASTJsonImporter::convertJsonToASTNode<solidity::frontend::Block>(nlohmann::json_abi_v3_11_3::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void> const&) |
142 | | |
143 | | |
144 | | ASTPointer<ASTNode> ASTJsonImporter::convertJsonToASTNode(Json const& _json) |
145 | 0 | { |
146 | 0 | astAssert(_json["nodeType"].is_string() && _json.contains("id"), "JSON-Node needs to have 'nodeType' and 'id' fields."); |
147 | 0 | std::string nodeType = _json["nodeType"].get<std::string>(); |
148 | 0 | if (nodeType == "PragmaDirective") |
149 | 0 | return createPragmaDirective(_json); |
150 | 0 | if (nodeType == "ImportDirective") |
151 | 0 | return createImportDirective(_json); |
152 | 0 | if (nodeType == "ContractDefinition") |
153 | 0 | return createContractDefinition(_json); |
154 | 0 | if (nodeType == "IdentifierPath") |
155 | 0 | return createIdentifierPath(_json); |
156 | 0 | if (nodeType == "InheritanceSpecifier") |
157 | 0 | return createInheritanceSpecifier(_json); |
158 | 0 | if (nodeType == "UsingForDirective") |
159 | 0 | return createUsingForDirective(_json); |
160 | 0 | if (nodeType == "StructDefinition") |
161 | 0 | return createStructDefinition(_json); |
162 | 0 | if (nodeType == "EnumDefinition") |
163 | 0 | return createEnumDefinition(_json); |
164 | 0 | if (nodeType == "EnumValue") |
165 | 0 | return createEnumValue(_json); |
166 | 0 | if (nodeType == "UserDefinedValueTypeDefinition") |
167 | 0 | return createUserDefinedValueTypeDefinition(_json); |
168 | 0 | if (nodeType == "ParameterList") |
169 | 0 | return createParameterList(_json); |
170 | 0 | if (nodeType == "OverrideSpecifier") |
171 | 0 | return createOverrideSpecifier(_json); |
172 | 0 | if (nodeType == "FunctionDefinition") |
173 | 0 | return createFunctionDefinition(_json); |
174 | 0 | if (nodeType == "VariableDeclaration") |
175 | 0 | return createVariableDeclaration(_json); |
176 | 0 | if (nodeType == "ModifierDefinition") |
177 | 0 | return createModifierDefinition(_json); |
178 | 0 | if (nodeType == "ModifierInvocation") |
179 | 0 | return createModifierInvocation(_json); |
180 | 0 | if (nodeType == "EventDefinition") |
181 | 0 | return createEventDefinition(_json); |
182 | 0 | if (nodeType == "ErrorDefinition") |
183 | 0 | return createErrorDefinition(_json); |
184 | 0 | if (nodeType == "ElementaryTypeName") |
185 | 0 | return createElementaryTypeName(_json); |
186 | 0 | if (nodeType == "UserDefinedTypeName") |
187 | 0 | return createUserDefinedTypeName(_json); |
188 | 0 | if (nodeType == "FunctionTypeName") |
189 | 0 | return createFunctionTypeName(_json); |
190 | 0 | if (nodeType == "Mapping") |
191 | 0 | return createMapping(_json); |
192 | 0 | if (nodeType == "ArrayTypeName") |
193 | 0 | return createArrayTypeName(_json); |
194 | 0 | if (nodeType == "InlineAssembly") |
195 | 0 | return createInlineAssembly(_json); |
196 | 0 | if (nodeType == "Block") |
197 | 0 | return createBlock(_json, false); |
198 | 0 | if (nodeType == "UncheckedBlock") |
199 | 0 | return createBlock(_json, true); |
200 | 0 | if (nodeType == "PlaceholderStatement") |
201 | 0 | return createPlaceholderStatement(_json); |
202 | 0 | if (nodeType == "IfStatement") |
203 | 0 | return createIfStatement(_json); |
204 | 0 | if (nodeType == "TryCatchClause") |
205 | 0 | return createTryCatchClause(_json); |
206 | 0 | if (nodeType == "TryStatement") |
207 | 0 | return createTryStatement(_json); |
208 | 0 | if (nodeType == "WhileStatement") |
209 | 0 | return createWhileStatement(_json, false); |
210 | 0 | if (nodeType == "DoWhileStatement") |
211 | 0 | return createWhileStatement(_json, true); |
212 | 0 | if (nodeType == "ForStatement") |
213 | 0 | return createForStatement(_json); |
214 | 0 | if (nodeType == "Continue") |
215 | 0 | return createContinue(_json); |
216 | 0 | if (nodeType == "Break") |
217 | 0 | return createBreak(_json); |
218 | 0 | if (nodeType == "Return") |
219 | 0 | return createReturn(_json); |
220 | 0 | if (nodeType == "EmitStatement") |
221 | 0 | return createEmitStatement(_json); |
222 | 0 | if (nodeType == "RevertStatement") |
223 | 0 | return createRevertStatement(_json); |
224 | 0 | if (nodeType == "Throw") |
225 | 0 | return createThrow(_json); |
226 | 0 | if (nodeType == "VariableDeclarationStatement") |
227 | 0 | return createVariableDeclarationStatement(_json); |
228 | 0 | if (nodeType == "ExpressionStatement") |
229 | 0 | return createExpressionStatement(_json); |
230 | 0 | if (nodeType == "Conditional") |
231 | 0 | return createConditional(_json); |
232 | 0 | if (nodeType == "Assignment") |
233 | 0 | return createAssignment(_json); |
234 | 0 | if (nodeType == "TupleExpression") |
235 | 0 | return createTupleExpression(_json); |
236 | 0 | if (nodeType == "UnaryOperation") |
237 | 0 | return createUnaryOperation(_json); |
238 | 0 | if (nodeType == "BinaryOperation") |
239 | 0 | return createBinaryOperation(_json); |
240 | 0 | if (nodeType == "FunctionCall") |
241 | 0 | return createFunctionCall(_json); |
242 | 0 | if (nodeType == "FunctionCallOptions") |
243 | 0 | return createFunctionCallOptions(_json); |
244 | 0 | if (nodeType == "NewExpression") |
245 | 0 | return createNewExpression(_json); |
246 | 0 | if (nodeType == "MemberAccess") |
247 | 0 | return createMemberAccess(_json); |
248 | 0 | if (nodeType == "IndexAccess") |
249 | 0 | return createIndexAccess(_json); |
250 | 0 | if (nodeType == "IndexRangeAccess") |
251 | 0 | return createIndexRangeAccess(_json); |
252 | 0 | if (nodeType == "Identifier") |
253 | 0 | return createIdentifier(_json); |
254 | 0 | if (nodeType == "ElementaryTypeNameExpression") |
255 | 0 | return createElementaryTypeNameExpression(_json); |
256 | 0 | if (nodeType == "Literal") |
257 | 0 | return createLiteral(_json); |
258 | 0 | if (nodeType == "StructuredDocumentation") |
259 | 0 | return createDocumentation(_json); |
260 | 0 | if (nodeType == "StorageLayoutSpecifier") |
261 | 0 | return createStorageLayoutSpecifier(_json); |
262 | 0 | else |
263 | 0 | astAssert(false, "Unknown type of ASTNode: " + nodeType); |
264 | | |
265 | | // FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794) |
266 | 0 | util::unreachable(); |
267 | 0 | } |
268 | | |
269 | | // ============ functions to instantiate the AST-Nodes from Json-Nodes ============== |
270 | | |
271 | | ASTPointer<SourceUnit> ASTJsonImporter::createSourceUnit(Json const& _node, std::string const& _srcName) |
272 | 0 | { |
273 | 0 | std::optional<std::string> license; |
274 | 0 | if (_node.contains("license") && !_node["license"].is_null()) |
275 | 0 | license = _node["license"].get<std::string>(); |
276 | |
|
277 | 0 | bool experimentalSolidity = false; |
278 | 0 | if (_node.contains("experimentalSolidity") && !_node["experimentalSolidity"].is_null()) |
279 | 0 | experimentalSolidity = _node["experimentalSolidity"].get<bool>(); |
280 | |
|
281 | 0 | std::vector<ASTPointer<ASTNode>> nodes; |
282 | 0 | for (auto& child: member(_node, "nodes")) |
283 | 0 | nodes.emplace_back(convertJsonToASTNode(child)); |
284 | |
|
285 | 0 | ASTPointer<SourceUnit> tmp = createASTNode<SourceUnit>(_node, license, nodes, experimentalSolidity); |
286 | 0 | tmp->annotation().path = _srcName; |
287 | 0 | return tmp; |
288 | 0 | } |
289 | | |
290 | | ASTPointer<PragmaDirective> ASTJsonImporter::createPragmaDirective(Json const& _node) |
291 | 0 | { |
292 | 0 | std::vector<Token> tokens; |
293 | 0 | std::vector<ASTString> literals; |
294 | 0 | for (auto const& lit: member(_node, "literals")) |
295 | 0 | { |
296 | 0 | std::string l = lit.get<std::string>(); |
297 | 0 | literals.push_back(l); |
298 | 0 | tokens.push_back(scanSingleToken(l)); |
299 | 0 | } |
300 | 0 | return createASTNode<PragmaDirective>(_node, tokens, literals); |
301 | 0 | } |
302 | | |
303 | | ASTPointer<ImportDirective> ASTJsonImporter::createImportDirective(Json const& _node) |
304 | 0 | { |
305 | 0 | ASTPointer<ASTString> unitAlias = memberAsASTString(_node, "unitAlias"); |
306 | 0 | ASTPointer<ASTString> path = memberAsASTString(_node, "file"); |
307 | 0 | ImportDirective::SymbolAliasList symbolAliases; |
308 | |
|
309 | 0 | for (auto& tuple: member(_node, "symbolAliases")) |
310 | 0 | { |
311 | 0 | astAssert(tuple["local"].is_null() || tuple["local"].is_string(), "expected 'local' to be a string or null!"); |
312 | | |
313 | 0 | symbolAliases.push_back({ |
314 | 0 | createIdentifier(tuple["foreign"]), |
315 | 0 | tuple["local"].is_null() ? nullptr : std::make_shared<ASTString>(tuple["local"].get<std::string>()), |
316 | 0 | createSourceLocation(tuple["foreign"])} |
317 | 0 | ); |
318 | 0 | } |
319 | 0 | ASTPointer<ImportDirective> tmp = createASTNode<ImportDirective>( |
320 | 0 | _node, |
321 | 0 | path, |
322 | 0 | unitAlias, |
323 | 0 | createNameSourceLocation(_node), |
324 | 0 | std::move(symbolAliases) |
325 | 0 | ); |
326 | |
|
327 | 0 | astAssert(_node["absolutePath"].is_string(), "Expected 'absolutePath' to be a string!"); |
328 | | |
329 | 0 | tmp->annotation().absolutePath = _node["absolutePath"].get<std::string>(); |
330 | 0 | return tmp; |
331 | 0 | } |
332 | | |
333 | | ASTPointer<ContractDefinition> ASTJsonImporter::createContractDefinition(Json const& _node) |
334 | 0 | { |
335 | 0 | astAssert(_node["name"].is_string(), "Expected 'name' to be a string!"); |
336 | | |
337 | 0 | std::vector<ASTPointer<InheritanceSpecifier>> baseContracts; |
338 | |
|
339 | 0 | for (auto& base: _node["baseContracts"]) |
340 | 0 | baseContracts.push_back(createInheritanceSpecifier(base)); |
341 | |
|
342 | 0 | std::vector<ASTPointer<ASTNode>> subNodes; |
343 | |
|
344 | 0 | for (auto& subnode: _node["nodes"]) |
345 | 0 | subNodes.push_back(convertJsonToASTNode(subnode)); |
346 | |
|
347 | 0 | return createASTNode<ContractDefinition>( |
348 | 0 | _node, |
349 | 0 | std::make_shared<ASTString>(_node["name"].get<std::string>()), |
350 | 0 | createNameSourceLocation(_node), |
351 | 0 | (_node.contains("documentation") && !_node["documentation"].is_null()) ? createDocumentation(member(_node, "documentation")) : nullptr, |
352 | 0 | baseContracts, |
353 | 0 | subNodes, |
354 | 0 | contractKind(_node), |
355 | 0 | memberAsBool(_node, "abstract"), |
356 | 0 | nullOrCast<StorageLayoutSpecifier>(member(_node, "storageLayout")) |
357 | 0 | ); |
358 | 0 | } |
359 | | |
360 | | ASTPointer<StorageLayoutSpecifier> ASTJsonImporter::createStorageLayoutSpecifier(Json const& _node) |
361 | 0 | { |
362 | 0 | astAssert(_node.contains("baseSlotExpression"), "Expected field \"baseSlotExpression\" is missing."); |
363 | 0 | return createASTNode<StorageLayoutSpecifier>( |
364 | 0 | _node, |
365 | 0 | convertJsonToASTNode<Expression>(_node["baseSlotExpression"]) |
366 | 0 | ); |
367 | 0 | } |
368 | | |
369 | | ASTPointer<IdentifierPath> ASTJsonImporter::createIdentifierPath(Json const& _node) |
370 | 0 | { |
371 | 0 | astAssert(_node["name"].is_string(), "Expected 'name' to be a string!"); |
372 | | |
373 | 0 | std::vector<ASTString> namePath; |
374 | 0 | std::vector<SourceLocation> namePathLocations; |
375 | 0 | std::vector<std::string> strs; |
376 | 0 | std::string nameString = member(_node, "name").get<std::string>(); |
377 | 0 | boost::algorithm::split(strs, nameString, boost::is_any_of(".")); |
378 | 0 | astAssert(!strs.empty(), "Expected at least one element in IdentifierPath."); |
379 | 0 | for (std::string s: strs) |
380 | 0 | { |
381 | 0 | astAssert(!s.empty(), "Expected non-empty string for IdentifierPath element."); |
382 | 0 | namePath.emplace_back(s); |
383 | 0 | } |
384 | | |
385 | 0 | if (_node.contains("nameLocations") && _node["nameLocations"].is_array()) |
386 | 0 | for (auto const& val: _node["nameLocations"]) |
387 | 0 | namePathLocations.emplace_back(langutil::parseSourceLocation(val.get<std::string>(), m_sourceNames)); |
388 | 0 | else |
389 | 0 | namePathLocations.resize(namePath.size()); |
390 | |
|
391 | 0 | astAssert( |
392 | 0 | namePath.size() == namePathLocations.size(), |
393 | 0 | "SourceLocations don't match name paths." |
394 | 0 | ); |
395 | | |
396 | 0 | return createASTNode<IdentifierPath>( |
397 | 0 | _node, |
398 | 0 | namePath, |
399 | 0 | namePathLocations |
400 | 0 | ); |
401 | 0 | } |
402 | | |
403 | | ASTPointer<InheritanceSpecifier> ASTJsonImporter::createInheritanceSpecifier(Json const& _node) |
404 | 0 | { |
405 | 0 | std::vector<ASTPointer<Expression>> arguments; |
406 | 0 | for (auto& arg: member(_node, "arguments")) |
407 | 0 | arguments.push_back(convertJsonToASTNode<Expression>(arg)); |
408 | 0 | return createASTNode<InheritanceSpecifier>( |
409 | 0 | _node, |
410 | 0 | createIdentifierPath(member(_node, "baseName")), |
411 | 0 | member(_node, "arguments").is_null() ? nullptr : std::make_unique<std::vector<ASTPointer<Expression>>>(arguments) |
412 | 0 | ); |
413 | 0 | } |
414 | | |
415 | | ASTPointer<UsingForDirective> ASTJsonImporter::createUsingForDirective(Json const& _node) |
416 | 0 | { |
417 | 0 | std::vector<ASTPointer<IdentifierPath>> functions; |
418 | 0 | std::vector<std::optional<Token>> operators; |
419 | 0 | if (_node.contains("libraryName")) |
420 | 0 | { |
421 | 0 | astAssert(!_node["libraryName"].is_array()); |
422 | 0 | astAssert(!_node["libraryName"].contains("operator")); |
423 | 0 | functions.emplace_back(createIdentifierPath(_node["libraryName"])); |
424 | 0 | operators.emplace_back(std::nullopt); |
425 | 0 | } |
426 | 0 | else if (_node.contains("functionList")) |
427 | 0 | for (Json const& function: _node["functionList"]) |
428 | 0 | { |
429 | 0 | if (function.contains("function")) |
430 | 0 | { |
431 | 0 | astAssert(!function.contains("operator")); |
432 | 0 | astAssert(!function.contains("definition")); |
433 | | |
434 | 0 | functions.emplace_back(createIdentifierPath(function["function"])); |
435 | 0 | operators.emplace_back(std::nullopt); |
436 | 0 | } |
437 | 0 | else |
438 | 0 | { |
439 | 0 | astAssert(function.contains("operator")); |
440 | 0 | astAssert(function.contains("definition")); |
441 | | |
442 | 0 | Token const operatorName = scanSingleToken(function["operator"]); |
443 | 0 | astAssert(util::contains(frontend::userDefinableOperators, operatorName)); |
444 | | |
445 | 0 | functions.emplace_back(createIdentifierPath(function["definition"])); |
446 | 0 | operators.emplace_back(operatorName); |
447 | 0 | } |
448 | 0 | } |
449 | | |
450 | 0 | return createASTNode<UsingForDirective>( |
451 | 0 | _node, |
452 | 0 | std::move(functions), |
453 | 0 | std::move(operators), |
454 | 0 | !_node.contains("libraryName"), |
455 | 0 | (_node.contains("typeName") && !_node["typeName"].is_null()) ? convertJsonToASTNode<TypeName>(_node["typeName"]) : nullptr, |
456 | 0 | memberAsBool(_node, "global") |
457 | 0 | ); |
458 | 0 | } |
459 | | |
460 | | ASTPointer<ASTNode> ASTJsonImporter::createStructDefinition(Json const& _node) |
461 | 0 | { |
462 | 0 | std::vector<ASTPointer<VariableDeclaration>> members; |
463 | 0 | for (auto& member: _node["members"]) |
464 | 0 | members.push_back(createVariableDeclaration(member)); |
465 | 0 | return createASTNode<StructDefinition>( |
466 | 0 | _node, |
467 | 0 | memberAsASTString(_node, "name"), |
468 | 0 | createNameSourceLocation(_node), |
469 | 0 | members, |
470 | 0 | (_node.contains("documentation") && !_node["documentation"].is_null()) ? createDocumentation(member(_node, "documentation")) : nullptr |
471 | 0 | ); |
472 | 0 | } |
473 | | |
474 | | ASTPointer<EnumDefinition> ASTJsonImporter::createEnumDefinition(Json const& _node) |
475 | 0 | { |
476 | 0 | std::vector<ASTPointer<EnumValue>> members; |
477 | 0 | for (auto& member: _node["members"]) |
478 | 0 | members.push_back(createEnumValue(member)); |
479 | 0 | return createASTNode<EnumDefinition>( |
480 | 0 | _node, |
481 | 0 | memberAsASTString(_node, "name"), |
482 | 0 | createNameSourceLocation(_node), |
483 | 0 | members, |
484 | 0 | (_node.contains("documentation") && !_node["documentation"].is_null()) ? createDocumentation(member(_node, "documentation")) : nullptr |
485 | 0 | ); |
486 | 0 | } |
487 | | |
488 | | ASTPointer<EnumValue> ASTJsonImporter::createEnumValue(Json const& _node) |
489 | 0 | { |
490 | 0 | return createASTNode<EnumValue>( |
491 | 0 | _node, |
492 | 0 | memberAsASTString(_node, "name"), |
493 | 0 | _node.contains("documentation") && !_node["documentation"].is_null() ? createDocumentation(member(_node, "documentation")) : nullptr |
494 | 0 | ); |
495 | 0 | } |
496 | | |
497 | | ASTPointer<UserDefinedValueTypeDefinition> ASTJsonImporter::createUserDefinedValueTypeDefinition(Json const& _node) |
498 | 0 | { |
499 | 0 | return createASTNode<UserDefinedValueTypeDefinition>( |
500 | 0 | _node, |
501 | 0 | memberAsASTString(_node, "name"), |
502 | 0 | createNameSourceLocation(_node), |
503 | 0 | convertJsonToASTNode<TypeName>(member(_node, "underlyingType")) |
504 | 0 | ); |
505 | 0 | } |
506 | | |
507 | | ASTPointer<ParameterList> ASTJsonImporter::createParameterList(Json const& _node) |
508 | 0 | { |
509 | 0 | std::vector<ASTPointer<VariableDeclaration>> parameters; |
510 | 0 | for (auto& param: _node["parameters"]) |
511 | 0 | parameters.push_back(createVariableDeclaration(param)); |
512 | 0 | return createASTNode<ParameterList>( |
513 | 0 | _node, |
514 | 0 | parameters |
515 | 0 | ); |
516 | 0 | } |
517 | | |
518 | | ASTPointer<OverrideSpecifier> ASTJsonImporter::createOverrideSpecifier(Json const& _node) |
519 | 0 | { |
520 | 0 | std::vector<ASTPointer<IdentifierPath>> overrides; |
521 | |
|
522 | 0 | if ( _node.contains("overrides")) |
523 | 0 | for (auto& param: _node["overrides"]) |
524 | 0 | overrides.push_back(createIdentifierPath(param)); |
525 | |
|
526 | 0 | return createASTNode<OverrideSpecifier>( |
527 | 0 | _node, |
528 | 0 | overrides |
529 | 0 | ); |
530 | 0 | } |
531 | | |
532 | | ASTPointer<FunctionDefinition> ASTJsonImporter::createFunctionDefinition(Json const& _node) |
533 | 0 | { |
534 | 0 | astAssert(_node["kind"].is_string(), "Expected 'kind' to be a string!"); |
535 | | |
536 | 0 | Token kind; |
537 | 0 | bool freeFunction = false; |
538 | 0 | std::string kindStr = member(_node, "kind").get<std::string>(); |
539 | |
|
540 | 0 | if (kindStr == "constructor") |
541 | 0 | kind = Token::Constructor; |
542 | 0 | else if (kindStr == "function") |
543 | 0 | kind = Token::Function; |
544 | 0 | else if (kindStr == "fallback") |
545 | 0 | kind = Token::Fallback; |
546 | 0 | else if (kindStr == "receive") |
547 | 0 | kind = Token::Receive; |
548 | 0 | else if (kindStr == "freeFunction") |
549 | 0 | { |
550 | 0 | kind = Token::Function; |
551 | 0 | freeFunction = true; |
552 | 0 | } |
553 | 0 | else |
554 | 0 | astAssert(false, "Expected 'kind' to be one of [constructor, function, fallback, receive]"); |
555 | | |
556 | 0 | std::vector<ASTPointer<ModifierInvocation>> modifiers; |
557 | 0 | for (auto& mod: member(_node, "modifiers")) |
558 | 0 | modifiers.push_back(createModifierInvocation(mod)); |
559 | |
|
560 | 0 | Visibility vis = Visibility::Default; |
561 | | // Ignore public visibility for constructors |
562 | 0 | if (kind == Token::Constructor) |
563 | 0 | vis = (visibility(_node) == Visibility::Public) ? Visibility::Default : visibility(_node); |
564 | 0 | else if (!freeFunction) |
565 | 0 | vis = visibility(_node); |
566 | 0 | return createASTNode<FunctionDefinition>( |
567 | 0 | _node, |
568 | 0 | memberAsASTString(_node, "name"), |
569 | 0 | createNameSourceLocation(_node), |
570 | 0 | vis, |
571 | 0 | stateMutability(_node), |
572 | 0 | freeFunction, |
573 | 0 | kind, |
574 | 0 | memberAsBool(_node, "virtual"), |
575 | 0 | (_node.contains("overrides") && !_node["overrides"].is_null()) ? createOverrideSpecifier(member(_node, "overrides")) : nullptr, |
576 | 0 | (_node.contains("documentation") && !_node["documentation"].is_null()) ? createDocumentation(member(_node, "documentation")) : nullptr, |
577 | 0 | createParameterList(member(_node, "parameters")), |
578 | 0 | modifiers, |
579 | 0 | createParameterList(member(_node, "returnParameters")), |
580 | 0 | memberAsBool(_node, "implemented") ? createBlock(member(_node, "body"), false) : nullptr |
581 | 0 | ); |
582 | 0 | } |
583 | | |
584 | | ASTPointer<VariableDeclaration> ASTJsonImporter::createVariableDeclaration(Json const& _node) |
585 | 0 | { |
586 | 0 | astAssert(_node["name"].is_string(), "Expected 'name' to be a string!"); |
587 | | |
588 | 0 | VariableDeclaration::Mutability mutability{}; |
589 | 0 | astAssert(member(_node, "mutability").is_string(), "'mutability' expected to be string."); |
590 | 0 | std::string const mutabilityStr = member(_node, "mutability").get<std::string>(); |
591 | 0 | if (mutabilityStr == "constant") |
592 | 0 | { |
593 | 0 | mutability = VariableDeclaration::Mutability::Constant; |
594 | 0 | astAssert(memberAsBool(_node, "constant")); |
595 | 0 | } |
596 | 0 | else |
597 | 0 | { |
598 | 0 | astAssert(!memberAsBool(_node, "constant")); |
599 | 0 | if (mutabilityStr == "mutable") |
600 | 0 | mutability = VariableDeclaration::Mutability::Mutable; |
601 | 0 | else if (mutabilityStr == "immutable") |
602 | 0 | mutability = VariableDeclaration::Mutability::Immutable; |
603 | 0 | else |
604 | 0 | astAssert(false); |
605 | 0 | } |
606 | | |
607 | 0 | return createASTNode<VariableDeclaration>( |
608 | 0 | _node, |
609 | 0 | nullOrCast<TypeName>(member(_node, "typeName")), |
610 | 0 | std::make_shared<ASTString>(member(_node, "name").get<std::string>()), |
611 | 0 | createNameSourceLocation(_node), |
612 | 0 | nullOrCast<Expression>(member(_node, "value")), |
613 | 0 | visibility(_node), |
614 | 0 | (_node.contains("documentation") && !_node["documentation"].is_null()) ? createDocumentation(member(_node, "documentation")) : nullptr, |
615 | 0 | (_node.contains("indexed") && !_node["indexed"].is_null()) ? memberAsBool(_node, "indexed") : false, |
616 | 0 | mutability, |
617 | 0 | (_node.contains("overrides") && !_node["overrides"].is_null()) ? createOverrideSpecifier(member(_node, "overrides")) : nullptr, |
618 | 0 | location(_node) |
619 | 0 | ); |
620 | 0 | } |
621 | | |
622 | | ASTPointer<ModifierDefinition> ASTJsonImporter::createModifierDefinition(Json const& _node) |
623 | 0 | { |
624 | 0 | return createASTNode<ModifierDefinition>( |
625 | 0 | _node, |
626 | 0 | memberAsASTString(_node, "name"), |
627 | 0 | createNameSourceLocation(_node), |
628 | 0 | (_node.contains("documentation") && !_node["documentation"].is_null()) ? createDocumentation(member(_node, "documentation")) : nullptr, |
629 | 0 | createParameterList(member(_node, "parameters")), |
630 | 0 | memberAsBool(_node, "virtual"), |
631 | 0 | (_node.contains("overrides") && !_node["overrides"].is_null()) ? createOverrideSpecifier(member(_node, "overrides")) : nullptr, |
632 | 0 | (_node.contains("body") && !_node["body"].is_null()) ? createBlock(member(_node, "body"), false) : nullptr |
633 | 0 | ); |
634 | 0 | } |
635 | | |
636 | | ASTPointer<ModifierInvocation> ASTJsonImporter::createModifierInvocation(Json const& _node) |
637 | 0 | { |
638 | 0 | std::vector<ASTPointer<Expression>> arguments; |
639 | 0 | for (auto& arg: member(_node, "arguments")) |
640 | 0 | arguments.push_back(convertJsonToASTNode<Expression>(arg)); |
641 | 0 | return createASTNode<ModifierInvocation>( |
642 | 0 | _node, |
643 | 0 | createIdentifierPath(member(_node, "modifierName")), |
644 | 0 | member(_node, "arguments").is_null() ? nullptr : std::make_unique<std::vector<ASTPointer<Expression>>>(arguments) |
645 | 0 | ); |
646 | 0 | } |
647 | | |
648 | | ASTPointer<EventDefinition> ASTJsonImporter::createEventDefinition(Json const& _node) |
649 | 0 | { |
650 | 0 | return createASTNode<EventDefinition>( |
651 | 0 | _node, |
652 | 0 | memberAsASTString(_node, "name"), |
653 | 0 | createNameSourceLocation(_node), |
654 | 0 | (_node.contains("documentation") && !_node["documentation"].is_null()) ? createDocumentation(member(_node, "documentation")) : nullptr, |
655 | 0 | createParameterList(member(_node, "parameters")), |
656 | 0 | memberAsBool(_node, "anonymous") |
657 | 0 | ); |
658 | 0 | } |
659 | | |
660 | | ASTPointer<ErrorDefinition> ASTJsonImporter::createErrorDefinition(Json const& _node) |
661 | 0 | { |
662 | 0 | return createASTNode<ErrorDefinition>( |
663 | 0 | _node, |
664 | 0 | memberAsASTString(_node, "name"), |
665 | 0 | createNameSourceLocation(_node), |
666 | 0 | (_node.contains("documentation") && !_node["documentation"].is_null()) ? createDocumentation(member(_node, "documentation")) : nullptr, |
667 | 0 | createParameterList(member(_node, "parameters")) |
668 | 0 | ); |
669 | 0 | } |
670 | | |
671 | | ASTPointer<ElementaryTypeName> ASTJsonImporter::createElementaryTypeName(Json const& _node) |
672 | 0 | { |
673 | 0 | unsigned short firstNum; |
674 | 0 | unsigned short secondNum; |
675 | |
|
676 | 0 | astAssert(_node["name"].is_string(), "Expected 'name' to be a string!"); |
677 | | |
678 | 0 | std::string name = member(_node, "name").get<std::string>(); |
679 | 0 | Token token; |
680 | 0 | std::tie(token, firstNum, secondNum) = TokenTraits::fromIdentifierOrKeyword(name); |
681 | 0 | ElementaryTypeNameToken elem(token, firstNum, secondNum); |
682 | |
|
683 | 0 | std::optional<StateMutability> mutability = {}; |
684 | 0 | if (_node.contains("stateMutability")) |
685 | 0 | mutability = stateMutability(_node); |
686 | |
|
687 | 0 | return createASTNode<ElementaryTypeName>(_node, elem, mutability); |
688 | 0 | } |
689 | | |
690 | | ASTPointer<UserDefinedTypeName> ASTJsonImporter::createUserDefinedTypeName(Json const& _node) |
691 | 0 | { |
692 | 0 | return createASTNode<UserDefinedTypeName>( |
693 | 0 | _node, |
694 | 0 | createIdentifierPath(member(_node, "pathNode")) |
695 | 0 | ); |
696 | 0 | } |
697 | | |
698 | | ASTPointer<FunctionTypeName> ASTJsonImporter::createFunctionTypeName(Json const& _node) |
699 | 0 | { |
700 | 0 | return createASTNode<FunctionTypeName>( |
701 | 0 | _node, |
702 | 0 | createParameterList(member(_node, "parameterTypes")), |
703 | 0 | createParameterList(member(_node, "returnParameterTypes")), |
704 | 0 | visibility(_node), |
705 | 0 | stateMutability(_node) |
706 | 0 | ); |
707 | 0 | } |
708 | | |
709 | | ASTPointer<Mapping> ASTJsonImporter::createMapping(Json const& _node) |
710 | 0 | { |
711 | 0 | return createASTNode<Mapping>( |
712 | 0 | _node, |
713 | 0 | convertJsonToASTNode<TypeName>(member(_node, "keyType")), |
714 | 0 | memberAsASTString(_node, "keyName"), |
715 | 0 | createKeyNameSourceLocation(_node), |
716 | 0 | convertJsonToASTNode<TypeName>(member(_node, "valueType")), |
717 | 0 | memberAsASTString(_node, "valueName"), |
718 | 0 | createValueNameSourceLocation(_node) |
719 | 0 | ); |
720 | 0 | } |
721 | | |
722 | | ASTPointer<ArrayTypeName> ASTJsonImporter::createArrayTypeName(Json const& _node) |
723 | 0 | { |
724 | 0 | return createASTNode<ArrayTypeName>( |
725 | 0 | _node, |
726 | 0 | convertJsonToASTNode<TypeName>(member(_node, "baseType")), |
727 | 0 | nullOrCast<Expression>(member(_node, "length")) |
728 | 0 | ); |
729 | 0 | } |
730 | | |
731 | | ASTPointer<InlineAssembly> ASTJsonImporter::createInlineAssembly(Json const& _node) |
732 | 0 | { |
733 | 0 | astAssert(_node["evmVersion"].is_string(), "Expected evmVersion to be a string!"); |
734 | 0 | auto evmVersion = langutil::EVMVersion::fromString(_node["evmVersion"].get<std::string>()); |
735 | 0 | astAssert(evmVersion.has_value(), "Invalid EVM version!"); |
736 | 0 | astAssert(m_evmVersion == evmVersion, "Imported tree evm version differs from configured evm version!"); |
737 | | |
738 | | // TODO: Add test in test/linsolidity/ASTJSON/assembly. This requires adding support for eofVersion in ASTJSONTest |
739 | 0 | std::optional<uint8_t> eofVersion; |
740 | 0 | if (auto const it = _node.find("eofVersion"); it != _node.end()) |
741 | 0 | { |
742 | 0 | eofVersion = it->get<uint8_t>(); |
743 | 0 | astAssert(eofVersion > 0); |
744 | 0 | } |
745 | 0 | astAssert(m_eofVersion == eofVersion, "Imported tree EOF version differs from configured EOF version!"); |
746 | | |
747 | 0 | yul::Dialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(evmVersion.value(), eofVersion); |
748 | 0 | ASTPointer<std::vector<ASTPointer<ASTString>>> flags; |
749 | 0 | if (_node.contains("flags")) |
750 | 0 | { |
751 | 0 | flags = std::make_shared<std::vector<ASTPointer<ASTString>>>(); |
752 | 0 | Json const& flagsNode = _node["flags"]; |
753 | 0 | astAssert(flagsNode.is_array(), "Assembly flags must be an array."); |
754 | 0 | for (auto const& flag: flagsNode) |
755 | 0 | { |
756 | 0 | astAssert(flag.is_string(), "Assembly flag must be a string."); |
757 | 0 | flags->emplace_back(std::make_shared<ASTString>(flag.get<std::string>())); |
758 | 0 | } |
759 | 0 | } |
760 | 0 | std::shared_ptr<yul::AST> operations = std::make_shared<yul::AST>( |
761 | 0 | yul::AsmJsonImporter(dialect, m_sourceNames).createAST(member(_node, "AST")) |
762 | 0 | ); |
763 | 0 | return createASTNode<InlineAssembly>( |
764 | 0 | _node, |
765 | 0 | nullOrASTString(_node, "documentation"), |
766 | 0 | dialect, |
767 | 0 | std::move(flags), |
768 | 0 | operations |
769 | 0 | ); |
770 | 0 | } |
771 | | |
772 | | ASTPointer<Block> ASTJsonImporter::createBlock(Json const& _node, bool _unchecked) |
773 | 0 | { |
774 | 0 | std::vector<ASTPointer<Statement>> statements; |
775 | 0 | for (auto& stat: member(_node, "statements")) |
776 | 0 | statements.push_back(convertJsonToASTNode<Statement>(stat)); |
777 | 0 | return createASTNode<Block>( |
778 | 0 | _node, |
779 | 0 | nullOrASTString(_node, "documentation"), |
780 | 0 | _unchecked, |
781 | 0 | statements |
782 | 0 | ); |
783 | 0 | } |
784 | | |
785 | | ASTPointer<PlaceholderStatement> ASTJsonImporter::createPlaceholderStatement(Json const& _node) |
786 | 0 | { |
787 | 0 | return createASTNode<PlaceholderStatement>( |
788 | 0 | _node, |
789 | 0 | nullOrASTString(_node, "documentation") |
790 | 0 | ); |
791 | 0 | } |
792 | | |
793 | | ASTPointer<IfStatement> ASTJsonImporter::createIfStatement(Json const& _node) |
794 | 0 | { |
795 | 0 | return createASTNode<IfStatement>( |
796 | 0 | _node, |
797 | 0 | nullOrASTString(_node, "documentation"), |
798 | 0 | convertJsonToASTNode<Expression>(member(_node, "condition")), |
799 | 0 | convertJsonToASTNode<Statement>(member(_node, "trueBody")), |
800 | 0 | nullOrCast<Statement>(member(_node, "falseBody")) |
801 | 0 | ); |
802 | 0 | } |
803 | | |
804 | | ASTPointer<TryCatchClause> ASTJsonImporter::createTryCatchClause(Json const& _node) |
805 | 0 | { |
806 | 0 | return createASTNode<TryCatchClause>( |
807 | 0 | _node, |
808 | 0 | memberAsASTString(_node, "errorName"), |
809 | 0 | nullOrCast<ParameterList>(member(_node, "parameters")), |
810 | 0 | convertJsonToASTNode<Block>(member(_node, "block")) |
811 | 0 | ); |
812 | 0 | } |
813 | | |
814 | | ASTPointer<TryStatement> ASTJsonImporter::createTryStatement(Json const& _node) |
815 | 0 | { |
816 | 0 | std::vector<ASTPointer<TryCatchClause>> clauses; |
817 | |
|
818 | 0 | for (auto& param: _node["clauses"]) |
819 | 0 | clauses.emplace_back(createTryCatchClause(param)); |
820 | |
|
821 | 0 | return createASTNode<TryStatement>( |
822 | 0 | _node, |
823 | 0 | nullOrASTString(_node, "documentation"), |
824 | 0 | convertJsonToASTNode<Expression>(member(_node, "externalCall")), |
825 | 0 | clauses |
826 | 0 | ); |
827 | 0 | } |
828 | | |
829 | | ASTPointer<WhileStatement> ASTJsonImporter::createWhileStatement(Json const& _node, bool _isDoWhile=false) |
830 | 0 | { |
831 | 0 | return createASTNode<WhileStatement>( |
832 | 0 | _node, |
833 | 0 | nullOrASTString(_node, "documentation"), |
834 | 0 | convertJsonToASTNode<Expression>(member(_node, "condition")), |
835 | 0 | convertJsonToASTNode<Statement>(member(_node, "body")), |
836 | 0 | _isDoWhile |
837 | 0 | ); |
838 | 0 | } |
839 | | |
840 | | ASTPointer<ForStatement> ASTJsonImporter::createForStatement(Json const& _node) |
841 | 0 | { |
842 | 0 | return createASTNode<ForStatement>( |
843 | 0 | _node, |
844 | 0 | nullOrASTString(_node, "documentation"), |
845 | 0 | nullOrCast<Statement>(member(_node, "initializationExpression")), |
846 | 0 | nullOrCast<Expression>(member(_node, "condition")), |
847 | 0 | nullOrCast<ExpressionStatement>(member(_node, "loopExpression")), |
848 | 0 | convertJsonToASTNode<Statement>(member(_node, "body")) |
849 | 0 | ); |
850 | 0 | } |
851 | | |
852 | | ASTPointer<Continue> ASTJsonImporter::createContinue(Json const& _node) |
853 | 0 | { |
854 | 0 | return createASTNode<Continue>( |
855 | 0 | _node, |
856 | 0 | nullOrASTString(_node, "documentation") |
857 | 0 | ); |
858 | 0 | } |
859 | | |
860 | | ASTPointer<Break> ASTJsonImporter::createBreak(Json const& _node) |
861 | 0 | { |
862 | 0 | return createASTNode<Break>( |
863 | 0 | _node, |
864 | 0 | nullOrASTString(_node, "documentation") |
865 | 0 | ); |
866 | 0 | } |
867 | | |
868 | | ASTPointer<Return> ASTJsonImporter::createReturn(Json const& _node) |
869 | 0 | { |
870 | 0 | return createASTNode<Return>( |
871 | 0 | _node, |
872 | 0 | nullOrASTString(_node, "documentation"), |
873 | 0 | nullOrCast<Expression>(member(_node, "expression")) |
874 | 0 | ); |
875 | 0 | } |
876 | | |
877 | | ASTPointer<Throw> ASTJsonImporter::createThrow(Json const& _node) |
878 | 0 | { |
879 | 0 | return createASTNode<Throw>( |
880 | 0 | _node, |
881 | 0 | nullOrASTString(_node, "documentation") |
882 | 0 | ); |
883 | 0 | } |
884 | | |
885 | | ASTPointer<EmitStatement> ASTJsonImporter::createEmitStatement(Json const& _node) |
886 | 0 | { |
887 | 0 | return createASTNode<EmitStatement>( |
888 | 0 | _node, |
889 | 0 | nullOrASTString(_node, "documentation"), |
890 | 0 | createFunctionCall(member(_node, "eventCall")) |
891 | 0 | ); |
892 | 0 | } |
893 | | |
894 | | ASTPointer<RevertStatement> ASTJsonImporter::createRevertStatement(Json const& _node) |
895 | 0 | { |
896 | 0 | return createASTNode<RevertStatement>( |
897 | 0 | _node, |
898 | 0 | nullOrASTString(_node, "documentation"), |
899 | 0 | createFunctionCall(member(_node, "errorCall")) |
900 | 0 | ); |
901 | 0 | } |
902 | | |
903 | | ASTPointer<VariableDeclarationStatement> ASTJsonImporter::createVariableDeclarationStatement(Json const& _node) |
904 | 0 | { |
905 | 0 | std::vector<ASTPointer<VariableDeclaration>> variables; |
906 | 0 | for (auto& var: member(_node, "declarations")) |
907 | 0 | variables.push_back(var.is_null() ? nullptr : createVariableDeclaration(var)); //unnamed components are empty pointers |
908 | 0 | return createASTNode<VariableDeclarationStatement>( |
909 | 0 | _node, |
910 | 0 | nullOrASTString(_node, "documentation"), |
911 | 0 | variables, |
912 | 0 | nullOrCast<Expression>(member(_node, "initialValue")) |
913 | 0 | ); |
914 | 0 | } |
915 | | |
916 | | ASTPointer<ExpressionStatement> ASTJsonImporter::createExpressionStatement(Json const& _node) |
917 | 0 | { |
918 | 0 | return createASTNode<ExpressionStatement>( |
919 | 0 | _node, |
920 | 0 | nullOrASTString(_node, "documentation"), |
921 | 0 | convertJsonToASTNode<Expression>(member(_node, "expression")) |
922 | 0 | ); |
923 | 0 | } |
924 | | |
925 | | ASTPointer<Conditional> ASTJsonImporter::createConditional(Json const& _node) |
926 | 0 | { |
927 | 0 | return createASTNode<Conditional>( |
928 | 0 | _node, |
929 | 0 | convertJsonToASTNode<Expression>(member(_node, "condition")), |
930 | 0 | convertJsonToASTNode<Expression>(member(_node, "trueExpression")), |
931 | 0 | convertJsonToASTNode<Expression>(member(_node, "falseExpression")) |
932 | 0 | ); |
933 | 0 | } |
934 | | |
935 | | ASTPointer<Assignment> ASTJsonImporter::createAssignment(Json const& _node) |
936 | 0 | { |
937 | 0 | return createASTNode<Assignment>( |
938 | 0 | _node, |
939 | 0 | convertJsonToASTNode<Expression>(member(_node, "leftHandSide")), |
940 | 0 | scanSingleToken(member(_node, "operator")), |
941 | 0 | convertJsonToASTNode<Expression>(member(_node, "rightHandSide")) |
942 | 0 | ); |
943 | 0 | } |
944 | | |
945 | | ASTPointer<TupleExpression> ASTJsonImporter::createTupleExpression(Json const& _node) |
946 | 0 | { |
947 | 0 | std::vector<ASTPointer<Expression>> components; |
948 | 0 | for (auto& comp: member(_node, "components")) |
949 | 0 | components.push_back(nullOrCast<Expression>(comp)); |
950 | 0 | return createASTNode<TupleExpression>( |
951 | 0 | _node, |
952 | 0 | components, |
953 | 0 | memberAsBool(_node, "isInlineArray") |
954 | 0 | ); |
955 | 0 | } |
956 | | |
957 | | ASTPointer<UnaryOperation> ASTJsonImporter::createUnaryOperation(Json const& _node) |
958 | 0 | { |
959 | 0 | return createASTNode<UnaryOperation>( |
960 | 0 | _node, |
961 | 0 | scanSingleToken(member(_node, "operator")), |
962 | 0 | convertJsonToASTNode<Expression>(member(_node, "subExpression")), |
963 | 0 | memberAsBool(_node, "prefix") |
964 | 0 | ); |
965 | 0 | } |
966 | | |
967 | | ASTPointer<BinaryOperation> ASTJsonImporter::createBinaryOperation(Json const& _node) |
968 | 0 | { |
969 | 0 | return createASTNode<BinaryOperation>( |
970 | 0 | _node, |
971 | 0 | convertJsonToASTNode<Expression>(member(_node, "leftExpression")), |
972 | 0 | scanSingleToken(member(_node, "operator")), |
973 | 0 | convertJsonToASTNode<Expression>(member(_node, "rightExpression")) |
974 | 0 | ); |
975 | 0 | } |
976 | | |
977 | | ASTPointer<FunctionCall> ASTJsonImporter::createFunctionCall(Json const& _node) |
978 | 0 | { |
979 | 0 | std::vector<ASTPointer<Expression>> arguments; |
980 | 0 | for (auto& arg: member(_node, "arguments")) |
981 | 0 | arguments.push_back(convertJsonToASTNode<Expression>(arg)); |
982 | 0 | std::vector<ASTPointer<ASTString>> names; |
983 | 0 | for (auto& name: member(_node, "names")) |
984 | 0 | { |
985 | 0 | astAssert(name.is_string(), "Expected 'names' members to be strings!"); |
986 | 0 | names.push_back(std::make_shared<ASTString>(name.get<std::string>())); |
987 | 0 | } |
988 | | |
989 | 0 | std::optional<std::vector<SourceLocation>> sourceLocations = createSourceLocations(_node); |
990 | |
|
991 | 0 | return createASTNode<FunctionCall>( |
992 | 0 | _node, |
993 | 0 | convertJsonToASTNode<Expression>(member(_node, "expression")), |
994 | 0 | arguments, |
995 | 0 | names, |
996 | 0 | sourceLocations ? |
997 | 0 | *sourceLocations : |
998 | 0 | std::vector<SourceLocation>(names.size()) |
999 | 0 | ); |
1000 | 0 | } |
1001 | | |
1002 | | ASTPointer<FunctionCallOptions> ASTJsonImporter::createFunctionCallOptions(Json const& _node) |
1003 | 0 | { |
1004 | 0 | std::vector<ASTPointer<Expression>> options; |
1005 | 0 | for (auto& option: member(_node, "options")) |
1006 | 0 | options.push_back(convertJsonToASTNode<Expression>(option)); |
1007 | 0 | std::vector<ASTPointer<ASTString>> names; |
1008 | 0 | for (auto& name: member(_node, "names")) |
1009 | 0 | { |
1010 | 0 | astAssert(name.is_string(), "Expected 'names' members to be strings!"); |
1011 | 0 | names.push_back(std::make_shared<ASTString>(name.get<std::string>())); |
1012 | 0 | } |
1013 | | |
1014 | 0 | return createASTNode<FunctionCallOptions>( |
1015 | 0 | _node, |
1016 | 0 | convertJsonToASTNode<Expression>(member(_node, "expression")), |
1017 | 0 | options, |
1018 | 0 | names |
1019 | 0 | ); |
1020 | 0 | } |
1021 | | |
1022 | | ASTPointer<NewExpression> ASTJsonImporter::createNewExpression(Json const& _node) |
1023 | 0 | { |
1024 | 0 | return createASTNode<NewExpression>( |
1025 | 0 | _node, |
1026 | 0 | convertJsonToASTNode<TypeName>(member(_node, "typeName")) |
1027 | 0 | ); |
1028 | 0 | } |
1029 | | |
1030 | | ASTPointer<MemberAccess> ASTJsonImporter::createMemberAccess(Json const& _node) |
1031 | 0 | { |
1032 | 0 | SourceLocation memberLocation; |
1033 | 0 | if (member(_node, "memberLocation").is_string()) |
1034 | 0 | memberLocation = solidity::langutil::parseSourceLocation(_node["memberLocation"].get<std::string>(), m_sourceNames); |
1035 | |
|
1036 | 0 | return createASTNode<MemberAccess>( |
1037 | 0 | _node, |
1038 | 0 | convertJsonToASTNode<Expression>(member(_node, "expression")), |
1039 | 0 | memberAsASTString(_node, "memberName"), |
1040 | 0 | std::move(memberLocation) |
1041 | 0 | ); |
1042 | 0 | } |
1043 | | |
1044 | | ASTPointer<IndexAccess> ASTJsonImporter::createIndexAccess(Json const& _node) |
1045 | 0 | { |
1046 | 0 | return createASTNode<IndexAccess>( |
1047 | 0 | _node, |
1048 | 0 | convertJsonToASTNode<Expression>(member(_node, "baseExpression")), |
1049 | 0 | nullOrCast<Expression>(member(_node, "indexExpression")) |
1050 | 0 | ); |
1051 | 0 | } |
1052 | | |
1053 | | ASTPointer<IndexRangeAccess> ASTJsonImporter::createIndexRangeAccess(Json const& _node) |
1054 | 0 | { |
1055 | 0 | return createASTNode<IndexRangeAccess>( |
1056 | 0 | _node, |
1057 | 0 | convertJsonToASTNode<Expression>(member(_node, "baseExpression")), |
1058 | 0 | nullOrCast<Expression>(member(_node, "startExpression")), |
1059 | 0 | nullOrCast<Expression>(member(_node, "endExpression")) |
1060 | 0 | ); |
1061 | 0 | } |
1062 | | |
1063 | | ASTPointer<Identifier> ASTJsonImporter::createIdentifier(Json const& _node) |
1064 | 0 | { |
1065 | 0 | return createASTNode<Identifier>(_node, memberAsASTString(_node, "name")); |
1066 | 0 | } |
1067 | | |
1068 | | ASTPointer<ElementaryTypeNameExpression> ASTJsonImporter::createElementaryTypeNameExpression(Json const& _node) |
1069 | 0 | { |
1070 | 0 | return createASTNode<ElementaryTypeNameExpression>( |
1071 | 0 | _node, |
1072 | 0 | createElementaryTypeName(member(_node, "typeName")) |
1073 | 0 | ); |
1074 | 0 | } |
1075 | | |
1076 | | ASTPointer<ASTNode> ASTJsonImporter::createLiteral(Json const& _node) |
1077 | 0 | { |
1078 | 0 | static std::string const valStr = "value"; |
1079 | 0 | static std::string const hexValStr = "hexValue"; |
1080 | |
|
1081 | 0 | astAssert(member(_node, valStr).is_string() || member(_node, hexValStr).is_string(), "Literal-value is unset."); |
1082 | | |
1083 | 0 | ASTPointer<ASTString> value = _node.contains(hexValStr) ? |
1084 | 0 | std::make_shared<ASTString>(util::asString(util::fromHex(_node[hexValStr].get<std::string>()))) : |
1085 | 0 | std::make_shared<ASTString>(_node[valStr].get<std::string>()); |
1086 | |
|
1087 | 0 | return createASTNode<Literal>( |
1088 | 0 | _node, |
1089 | 0 | literalTokenKind(_node), |
1090 | 0 | value, |
1091 | 0 | member(_node, "subdenomination").is_null() ? Literal::SubDenomination::None : subdenomination(_node) |
1092 | 0 | ); |
1093 | 0 | } |
1094 | | |
1095 | | ASTPointer<StructuredDocumentation> ASTJsonImporter::createDocumentation(Json const& _node) |
1096 | 0 | { |
1097 | 0 | static std::string const textString = "text"; |
1098 | |
|
1099 | 0 | astAssert(member(_node, textString).is_string(), "'text' must be a string"); |
1100 | | |
1101 | 0 | return createASTNode<StructuredDocumentation>( |
1102 | 0 | _node, |
1103 | 0 | std::make_shared<ASTString>(_node[textString].get<std::string>()) |
1104 | 0 | ); |
1105 | 0 | } |
1106 | | |
1107 | | // ===== helper functions ========== |
1108 | | |
1109 | | Json ASTJsonImporter::member(Json const& _node, std::string const& _name) |
1110 | 0 | { |
1111 | 0 | if (!_node.contains(_name)) |
1112 | 0 | return Json(); |
1113 | 0 | return _node[_name]; |
1114 | 0 | } |
1115 | | |
1116 | | Token ASTJsonImporter::scanSingleToken(Json const& _node) |
1117 | 0 | { |
1118 | 0 | langutil::CharStream charStream(_node.get<std::string>(), ""); |
1119 | 0 | langutil::Scanner scanner{charStream}; |
1120 | 0 | astAssert(scanner.peekNextToken() == Token::EOS, "Token string is too long."); |
1121 | 0 | return scanner.currentToken(); |
1122 | 0 | } |
1123 | | |
1124 | | ASTPointer<ASTString> ASTJsonImporter::nullOrASTString(Json const& _json, std::string const& _name) |
1125 | 0 | { |
1126 | 0 | return (_json.contains(_name) && (_json[_name].is_string())) ? memberAsASTString(_json, _name) : nullptr; |
1127 | 0 | } |
1128 | | |
1129 | | ASTPointer<ASTString> ASTJsonImporter::memberAsASTString(Json const& _node, std::string const& _name) |
1130 | 0 | { |
1131 | 0 | Json value = member(_node, _name); |
1132 | 0 | astAssert(value.is_string(), "field " + _name + " must be of type string."); |
1133 | 0 | return std::make_shared<ASTString>(_node[_name].get<std::string>()); |
1134 | 0 | } |
1135 | | |
1136 | | bool ASTJsonImporter::memberAsBool(Json const& _node, std::string const& _name) |
1137 | 0 | { |
1138 | 0 | Json value = member(_node, _name); |
1139 | 0 | astAssert(value.is_boolean(), "field " + _name + " must be of type boolean."); |
1140 | 0 | return _node[_name].get<bool>(); |
1141 | 0 | } |
1142 | | |
1143 | | |
1144 | | // =========== JSON to definition helpers ======================= |
1145 | | |
1146 | | ContractKind ASTJsonImporter::contractKind(Json const& _node) |
1147 | 0 | { |
1148 | 0 | ContractKind kind; |
1149 | 0 | astAssert(!member(_node, "contractKind").is_null(), "'Contract-kind' can not be null."); |
1150 | 0 | if (_node["contractKind"].get<std::string>() == "interface") |
1151 | 0 | kind = ContractKind::Interface; |
1152 | 0 | else if (_node["contractKind"].get<std::string>() == "contract") |
1153 | 0 | kind = ContractKind::Contract; |
1154 | 0 | else if (_node["contractKind"].get<std::string>() == "library") |
1155 | 0 | kind = ContractKind::Library; |
1156 | 0 | else |
1157 | 0 | astAssert(false, "Unknown ContractKind"); |
1158 | 0 | return kind; |
1159 | 0 | } |
1160 | | |
1161 | | Token ASTJsonImporter::literalTokenKind(Json const& _node) |
1162 | 0 | { |
1163 | 0 | astAssert(member(_node, "kind").is_string(), "Token-'kind' expected to be a string."); |
1164 | 0 | Token tok; |
1165 | 0 | if (_node["kind"].get<std::string>() == "number") |
1166 | 0 | tok = Token::Number; |
1167 | 0 | else if (_node["kind"].get<std::string>() == "string") |
1168 | 0 | tok = Token::StringLiteral; |
1169 | 0 | else if (_node["kind"].get<std::string>() == "unicodeString") |
1170 | 0 | tok = Token::UnicodeStringLiteral; |
1171 | 0 | else if (_node["kind"].get<std::string>() == "hexString") |
1172 | 0 | tok = Token::HexStringLiteral; |
1173 | 0 | else if (_node["kind"].get<std::string>() == "bool") |
1174 | 0 | tok = (member(_node, "value").get<std::string>() == "true") ? Token::TrueLiteral : Token::FalseLiteral; |
1175 | 0 | else |
1176 | 0 | astAssert(false, "Unknown kind of literalString"); |
1177 | 0 | return tok; |
1178 | 0 | } |
1179 | | |
1180 | | Visibility ASTJsonImporter::visibility(Json const& _node) |
1181 | 0 | { |
1182 | 0 | Json visibility = member(_node, "visibility"); |
1183 | 0 | astAssert(visibility.is_string(), "'visibility' expected to be a string."); |
1184 | | |
1185 | 0 | std::string const visibilityStr = visibility.get<std::string>(); |
1186 | |
|
1187 | 0 | if (visibilityStr == "default") |
1188 | 0 | return Visibility::Default; |
1189 | 0 | else if (visibilityStr == "private") |
1190 | 0 | return Visibility::Private; |
1191 | 0 | else if ( visibilityStr == "internal") |
1192 | 0 | return Visibility::Internal; |
1193 | 0 | else if (visibilityStr == "public") |
1194 | 0 | return Visibility::Public; |
1195 | 0 | else if (visibilityStr == "external") |
1196 | 0 | return Visibility::External; |
1197 | 0 | else |
1198 | 0 | astAssert(false, "Unknown visibility declaration"); |
1199 | | |
1200 | | // FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794) |
1201 | 0 | util::unreachable(); |
1202 | 0 | } |
1203 | | |
1204 | | VariableDeclaration::Location ASTJsonImporter::location(Json const& _node) |
1205 | 0 | { |
1206 | 0 | Json storageLoc = member(_node, "storageLocation"); |
1207 | 0 | astAssert(storageLoc.is_string(), "'storageLocation' expected to be a string."); |
1208 | | |
1209 | 0 | std::string const storageLocStr = storageLoc.get<std::string>(); |
1210 | |
|
1211 | 0 | if (storageLocStr == "default") |
1212 | 0 | return VariableDeclaration::Location::Unspecified; |
1213 | 0 | else if (storageLocStr == "storage") |
1214 | 0 | return VariableDeclaration::Location::Storage; |
1215 | 0 | else if (storageLocStr == "memory") |
1216 | 0 | return VariableDeclaration::Location::Memory; |
1217 | 0 | else if (storageLocStr == "calldata") |
1218 | 0 | return VariableDeclaration::Location::CallData; |
1219 | 0 | else if (storageLocStr == "transient") |
1220 | 0 | return VariableDeclaration::Location::Transient; |
1221 | 0 | else |
1222 | 0 | astAssert(false, "Unknown location declaration"); |
1223 | | |
1224 | | // FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794) |
1225 | 0 | util::unreachable(); |
1226 | 0 | } |
1227 | | |
1228 | | Literal::SubDenomination ASTJsonImporter::subdenomination(Json const& _node) |
1229 | 0 | { |
1230 | 0 | Json subDen = member(_node, "subdenomination"); |
1231 | |
|
1232 | 0 | if (subDen.is_null()) |
1233 | 0 | return Literal::SubDenomination::None; |
1234 | | |
1235 | 0 | astAssert(subDen.is_string(), "'subDenomination' expected to be string."); |
1236 | | |
1237 | 0 | std::string const subDenStr = subDen.get<std::string>(); |
1238 | |
|
1239 | 0 | if (subDenStr == "wei") |
1240 | 0 | return Literal::SubDenomination::Wei; |
1241 | 0 | else if (subDenStr == "gwei") |
1242 | 0 | return Literal::SubDenomination::Gwei; |
1243 | 0 | else if (subDenStr == "ether") |
1244 | 0 | return Literal::SubDenomination::Ether; |
1245 | 0 | else if (subDenStr == "seconds") |
1246 | 0 | return Literal::SubDenomination::Second; |
1247 | 0 | else if (subDenStr == "minutes") |
1248 | 0 | return Literal::SubDenomination::Minute; |
1249 | 0 | else if (subDenStr == "hours") |
1250 | 0 | return Literal::SubDenomination::Hour; |
1251 | 0 | else if (subDenStr == "days") |
1252 | 0 | return Literal::SubDenomination::Day; |
1253 | 0 | else if (subDenStr == "weeks") |
1254 | 0 | return Literal::SubDenomination::Week; |
1255 | 0 | else if (subDenStr == "years") |
1256 | 0 | return Literal::SubDenomination::Year; |
1257 | 0 | else |
1258 | 0 | astAssert(false, "Unknown subdenomination"); |
1259 | | |
1260 | | // FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794) |
1261 | 0 | util::unreachable(); |
1262 | 0 | } |
1263 | | |
1264 | | StateMutability ASTJsonImporter::stateMutability(Json const& _node) |
1265 | 0 | { |
1266 | 0 | astAssert(member(_node, "stateMutability").is_string(), "StateMutability' expected to be string."); |
1267 | 0 | std::string const mutabilityStr = member(_node, "stateMutability").get<std::string>(); |
1268 | |
|
1269 | 0 | if (mutabilityStr == "pure") |
1270 | 0 | return StateMutability::Pure; |
1271 | 0 | else if (mutabilityStr == "view") |
1272 | 0 | return StateMutability::View; |
1273 | 0 | else if (mutabilityStr == "nonpayable") |
1274 | 0 | return StateMutability::NonPayable; |
1275 | 0 | else if (mutabilityStr == "payable") |
1276 | 0 | return StateMutability::Payable; |
1277 | 0 | else |
1278 | 0 | astAssert(false, "Unknown stateMutability"); |
1279 | | |
1280 | | // FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794) |
1281 | 0 | util::unreachable(); |
1282 | 0 | } |
1283 | | |
1284 | | } |