diff --git a/libsolidity/analysis/PostTypeChecker.cpp b/libsolidity/analysis/PostTypeChecker.cpp index 4699a0b14..83db2be1e 100644 --- a/libsolidity/analysis/PostTypeChecker.cpp +++ b/libsolidity/analysis/PostTypeChecker.cpp @@ -219,7 +219,7 @@ struct OverrideSpecifierChecker: public PostTypeChecker::Checker { for (ASTPointer const& override: _overrideSpecifier.overrides()) { - Declaration const* decl = override->annotation().referencedDeclaration; + Declaration const* decl = override->annotation().referencedDeclaration; solAssert(decl, "Expected declaration to be resolved."); if (dynamic_cast(decl)) diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 75445f229..c16717d5c 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -171,16 +171,21 @@ void ReferencesResolver::endVisit(ModifierDefinition const&) m_returnParameters.pop_back(); } -void ReferencesResolver::endVisit(UserDefinedTypeName const& _typeName) +void ReferencesResolver::endVisit(IdentifierPath const& _path) { - Declaration const* declaration = m_resolver.pathFromCurrentScope(_typeName.namePath()); + Declaration const* declaration = m_resolver.pathFromCurrentScope(_path.path()); if (!declaration) { - m_errorReporter.fatalDeclarationError(7920_error, _typeName.location(), "Identifier not found or not unique."); + m_errorReporter.fatalDeclarationError(7920_error, _path.location(), "Identifier not found or not unique."); return; } - _typeName.annotation().referencedDeclaration = declaration; + _path.annotation().referencedDeclaration = declaration; +} + +void ReferencesResolver::endVisit(UserDefinedTypeName const& _typeName) +{ + _typeName.annotation().referencedDeclaration = _typeName.pathNode()->annotation().referencedDeclaration; } bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly) diff --git a/libsolidity/analysis/ReferencesResolver.h b/libsolidity/analysis/ReferencesResolver.h index 2c984f9b2..1ae92c5e6 100644 --- a/libsolidity/analysis/ReferencesResolver.h +++ b/libsolidity/analysis/ReferencesResolver.h @@ -82,6 +82,7 @@ private: void endVisit(FunctionDefinition const& _functionDefinition) override; bool visit(ModifierDefinition const& _modifierDefinition) override; void endVisit(ModifierDefinition const& _modifierDefinition) override; + void endVisit(IdentifierPath const& _typeName) override; void endVisit(UserDefinedTypeName const& _typeName) override; bool visit(InlineAssembly const& _inlineAssembly) override; bool visit(Return const& _return) override; diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index f3a79fcb0..a49f2722a 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -557,6 +557,27 @@ private: util::LazyInit> m_interfaceEvents; }; +/** + * A sequence of identifiers separated by dots + */ +class IdentifierPath: public ASTNode +{ +public: + IdentifierPath(int64_t _id, SourceLocation const& _location, std::vector _path): + ASTNode(_id, _location), m_path(std::move(_path)) {} + + std::vector const& path() const { return m_path; } + IdentifierPathAnnotation& annotation() const override + { + return initAnnotation(); + } + + void accept(ASTVisitor& _visitor) override; + void accept(ASTConstVisitor& _visitor) const override; +private: + std::vector m_path; +}; + class InheritanceSpecifier: public ASTNode { public: @@ -1203,18 +1224,19 @@ private: class UserDefinedTypeName: public TypeName { public: - UserDefinedTypeName(int64_t _id, SourceLocation const& _location, std::vector _namePath): + UserDefinedTypeName(int64_t _id, SourceLocation const& _location, ASTPointer _namePath): TypeName(_id, _location), m_namePath(std::move(_namePath)) {} void accept(ASTVisitor& _visitor) override; void accept(ASTConstVisitor& _visitor) const override; - std::vector const& namePath() const { return m_namePath; } + std::vector const& namePath() const { return m_namePath->path(); } + ASTPointer const& pathNode() const { return m_namePath; } UserDefinedTypeNameAnnotation& annotation() const override; private: - std::vector m_namePath; + ASTPointer m_namePath; }; /** diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index 0309e28db..d68bb8d53 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -233,6 +233,12 @@ struct TypeNameAnnotation: ASTAnnotation TypePointer type = nullptr; }; +struct IdentifierPathAnnotation: TypeNameAnnotation +{ + /// Referenced declaration, set during reference resolution stage. + Declaration const* referencedDeclaration = nullptr; +}; + struct UserDefinedTypeNameAnnotation: TypeNameAnnotation { /// Referenced declaration, set during reference resolution stage. diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 43e572069..2293ce5b6 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -326,6 +326,15 @@ bool ASTJsonConverter::visit(ContractDefinition const& _node) return false; } +bool ASTJsonConverter::visit(IdentifierPath const& _node) +{ + setJsonNode(_node, "IdentifierPath", { + make_pair("name", namePathToString(_node.path())), + make_pair("referencedDeclaration", idOrNull(_node.annotation().referencedDeclaration)) + }); + return false; +} + bool ASTJsonConverter::visit(InheritanceSpecifier const& _node) { setJsonNode(_node, "InheritanceSpecifier", { @@ -519,7 +528,7 @@ bool ASTJsonConverter::visit(ElementaryTypeName const& _node) bool ASTJsonConverter::visit(UserDefinedTypeName const& _node) { setJsonNode(_node, "UserDefinedTypeName", { - make_pair("name", namePathToString(_node.namePath())), + make_pair("pathNode", toJson(*_node.pathNode())), make_pair("referencedDeclaration", idOrNull(_node.annotation().referencedDeclaration)), make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true)) }); diff --git a/libsolidity/ast/ASTJsonConverter.h b/libsolidity/ast/ASTJsonConverter.h index 8d6bdbaba..59cd7dafb 100644 --- a/libsolidity/ast/ASTJsonConverter.h +++ b/libsolidity/ast/ASTJsonConverter.h @@ -77,6 +77,7 @@ public: bool visit(PragmaDirective const& _node) override; bool visit(ImportDirective const& _node) override; bool visit(ContractDefinition const& _node) override; + bool visit(IdentifierPath const& _node) override; bool visit(InheritanceSpecifier const& _node) override; bool visit(UsingForDirective const& _node) override; bool visit(StructDefinition const& _node) override; diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index 48eed4d8a..1eeb6ed91 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -115,6 +115,8 @@ ASTPointer ASTJsonImporter::convertJsonToASTNode(Json::Value const& _js return createImportDirective(_json); if (nodeType == "ContractDefinition") return createContractDefinition(_json); + if (nodeType == "IdentifierPath") + return createIdentifier(_json); if (nodeType == "InheritanceSpecifier") return createInheritanceSpecifier(_json); if (nodeType == "UsingForDirective") @@ -299,6 +301,22 @@ ASTPointer ASTJsonImporter::createContractDefinition(Json::V ); } +ASTPointer ASTJsonImporter::createIdentifierPath(Json::Value const& _node) +{ + astAssert(_node["name"].isString(), "Expected 'name' to be a string!"); + + vector namePath; + vector strs; + string nameString = member(_node, "name").asString(); + boost::algorithm::split(strs, nameString, boost::is_any_of(".")); + for (string s: strs) + namePath.emplace_back(s); + return createASTNode( + _node, + namePath + ); +} + ASTPointer ASTJsonImporter::createInheritanceSpecifier(Json::Value const& _node) { std::vector> arguments; @@ -518,17 +536,9 @@ ASTPointer ASTJsonImporter::createElementaryTypeName(Json::V ASTPointer ASTJsonImporter::createUserDefinedTypeName(Json::Value const& _node) { - astAssert(_node["name"].isString(), "Expected 'name' to be a string!"); - - vector namePath; - vector strs; - string nameString = member(_node, "name").asString(); - boost::algorithm::split(strs, nameString, boost::is_any_of(".")); - for (string s: strs) - namePath.emplace_back(s); return createASTNode( _node, - namePath + createIdentifierPath(member(_node, "pathNode")) ); } diff --git a/libsolidity/ast/ASTJsonImporter.h b/libsolidity/ast/ASTJsonImporter.h index 0bfb111bf..824249e59 100644 --- a/libsolidity/ast/ASTJsonImporter.h +++ b/libsolidity/ast/ASTJsonImporter.h @@ -74,6 +74,7 @@ private: ASTPointer createPragmaDirective(Json::Value const& _node); ASTPointer createImportDirective(Json::Value const& _node); ASTPointer createContractDefinition(Json::Value const& _node); + ASTPointer createIdentifierPath(Json::Value const& _node); ASTPointer createInheritanceSpecifier(Json::Value const& _node); ASTPointer createUsingForDirective(Json::Value const& _node); ASTPointer createStructDefinition(Json::Value const& _node); diff --git a/libsolidity/ast/ASTVisitor.h b/libsolidity/ast/ASTVisitor.h index 0f2d73348..9ad652b06 100644 --- a/libsolidity/ast/ASTVisitor.h +++ b/libsolidity/ast/ASTVisitor.h @@ -58,6 +58,7 @@ public: virtual bool visit(PragmaDirective& _node) { return visitNode(_node); } virtual bool visit(ImportDirective& _node) { return visitNode(_node); } virtual bool visit(ContractDefinition& _node) { return visitNode(_node); } + virtual bool visit(IdentifierPath& _node) { return visitNode(_node); } virtual bool visit(InheritanceSpecifier& _node) { return visitNode(_node); } virtual bool visit(UsingForDirective& _node) { return visitNode(_node); } virtual bool visit(StructDefinition& _node) { return visitNode(_node); } @@ -110,6 +111,7 @@ public: virtual void endVisit(PragmaDirective& _node) { endVisitNode(_node); } virtual void endVisit(ImportDirective& _node) { endVisitNode(_node); } virtual void endVisit(ContractDefinition& _node) { endVisitNode(_node); } + virtual void endVisit(IdentifierPath& _node) { endVisitNode(_node); } virtual void endVisit(InheritanceSpecifier& _node) { endVisitNode(_node); } virtual void endVisit(UsingForDirective& _node) { endVisitNode(_node); } virtual void endVisit(StructDefinition& _node) { endVisitNode(_node); } @@ -184,6 +186,7 @@ public: virtual bool visit(PragmaDirective const& _node) { return visitNode(_node); } virtual bool visit(ImportDirective const& _node) { return visitNode(_node); } virtual bool visit(ContractDefinition const& _node) { return visitNode(_node); } + virtual bool visit(IdentifierPath const& _node) { return visitNode(_node); } virtual bool visit(InheritanceSpecifier const& _node) { return visitNode(_node); } virtual bool visit(StructDefinition const& _node) { return visitNode(_node); } virtual bool visit(UsingForDirective const& _node) { return visitNode(_node); } @@ -236,6 +239,7 @@ public: virtual void endVisit(PragmaDirective const& _node) { endVisitNode(_node); } virtual void endVisit(ImportDirective const& _node) { endVisitNode(_node); } virtual void endVisit(ContractDefinition const& _node) { endVisitNode(_node); } + virtual void endVisit(IdentifierPath const& _node) { endVisitNode(_node); } virtual void endVisit(InheritanceSpecifier const& _node) { endVisitNode(_node); } virtual void endVisit(UsingForDirective const& _node) { endVisitNode(_node); } virtual void endVisit(StructDefinition const& _node) { endVisitNode(_node); } diff --git a/libsolidity/ast/AST_accept.h b/libsolidity/ast/AST_accept.h index 2105e369d..af81364e0 100644 --- a/libsolidity/ast/AST_accept.h +++ b/libsolidity/ast/AST_accept.h @@ -104,6 +104,18 @@ void ContractDefinition::accept(ASTConstVisitor& _visitor) const _visitor.endVisit(*this); } +void IdentifierPath::accept(ASTVisitor& _visitor) +{ + _visitor.visit(*this); + _visitor.endVisit(*this); +} + +void IdentifierPath::accept(ASTConstVisitor& _visitor) const +{ + _visitor.visit(*this); + _visitor.endVisit(*this); +} + void InheritanceSpecifier::accept(ASTVisitor& _visitor) { if (_visitor.visit(*this)) @@ -368,13 +380,15 @@ void ElementaryTypeName::accept(ASTConstVisitor& _visitor) const void UserDefinedTypeName::accept(ASTVisitor& _visitor) { - _visitor.visit(*this); + if (_visitor.visit(*this)) + this->pathNode()->accept(_visitor); _visitor.endVisit(*this); } void UserDefinedTypeName::accept(ASTConstVisitor& _visitor) const { - _visitor.visit(*this); + if (_visitor.visit(*this)) + this->pathNode()->accept(_visitor); _visitor.endVisit(*this); } diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 053a6718b..33719c983 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -939,6 +939,14 @@ ASTPointer Parser::parseIdentifier() } ASTPointer Parser::parseUserDefinedTypeName() +{ + ASTNodeFactory nodeFactory(*this); + ASTPointer identifierPath = parseIdentifierPath(); + nodeFactory.setEndPositionFromNode(identifierPath); + return nodeFactory.createNode(identifierPath); +} + +ASTPointer Parser::parseIdentifierPath() { RecursionGuard recursionGuard(*this); ASTNodeFactory nodeFactory(*this); @@ -950,7 +958,7 @@ ASTPointer Parser::parseUserDefinedTypeName() nodeFactory.markEndPosition(); identifierPath.push_back(*expectIdentifierToken()); } - return nodeFactory.createNode(identifierPath); + return nodeFactory.createNode(identifierPath); } ASTPointer Parser::parseTypeNameSuffix(ASTPointer type, ASTNodeFactory& nodeFactory) @@ -2101,7 +2109,7 @@ ASTPointer Parser::typeNameFromIndexAccessStructure(Parser::IndexAcces vector path; for (auto const& el: _iap.path) path.push_back(dynamic_cast(*el).name()); - type = nodeFactory.createNode(path); + type = nodeFactory.createNode(nodeFactory.createNode(path)); } for (auto const& lengthExpression: _iap.indices) { diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h index 822f394ba..08426287c 100644 --- a/libsolidity/parsing/Parser.h +++ b/libsolidity/parsing/Parser.h @@ -106,6 +106,7 @@ private: ASTPointer parseModifierInvocation(); ASTPointer parseIdentifier(); ASTPointer parseUserDefinedTypeName(); + ASTPointer parseIdentifierPath(); ASTPointer parseTypeNameSuffix(ASTPointer type, ASTNodeFactory& nodeFactory); ASTPointer parseTypeName(); ASTPointer parseFunctionType(); diff --git a/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/output b/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/output index 6af2128e1..731fc934a 100644 --- a/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/output +++ b/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/output @@ -34,17 +34,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "D_9" { +object "D_10" { code { { mstore(64, memoryguard(0x80)) if callvalue() { revert(0, 0) } - let _1 := datasize("D_9_deployed") - codecopy(0, dataoffset("D_9_deployed"), _1) + let _1 := datasize("D_10_deployed") + codecopy(0, dataoffset("D_10_deployed"), _1) return(0, _1) } } - object "D_9_deployed" { + object "D_10_deployed" { code { { mstore(64, memoryguard(0x80)) diff --git a/test/cmdlineTests/ir_compiler_subobjects/output b/test/cmdlineTests/ir_compiler_subobjects/output index 888f1216b..49840fa43 100644 --- a/test/cmdlineTests/ir_compiler_subobjects/output +++ b/test/cmdlineTests/ir_compiler_subobjects/output @@ -34,17 +34,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "D_13" { +object "D_15" { code { { mstore(64, memoryguard(0x80)) if callvalue() { revert(0, 0) } - let _1 := datasize("D_13_deployed") - codecopy(0, dataoffset("D_13_deployed"), _1) + let _1 := datasize("D_15_deployed") + codecopy(0, dataoffset("D_15_deployed"), _1) return(0, _1) } } - object "D_13_deployed" { + object "D_15_deployed" { code { { let _1 := memoryguard(0x80) diff --git a/test/cmdlineTests/recovery_standard_json/output.json b/test/cmdlineTests/recovery_standard_json/output.json index 7aa7214e4..7e9c50d3c 100644 --- a/test/cmdlineTests/recovery_standard_json/output.json +++ b/test/cmdlineTests/recovery_standard_json/output.json @@ -4,4 +4,4 @@ pragma solidity >=0.0; contract Errort6 { using foo for ; /* missing type name ","message":"Expected type name","severity":"error","sourceLocation":{"end":94,"file":"A","start":93},"type":"ParserError"},{"component":"general","errorCode":"3796","formattedMessage":"A:2:84: Warning: Recovered in ContractDefinition at '}'. pragma solidity >=0.0; contract Errort6 { using foo for ; /* missing type name */ } ^ -","message":"Recovered in ContractDefinition at '}'.","severity":"warning","sourceLocation":{"end":120,"file":"A","start":119},"type":"Warning"}],"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"Errort6":[3]},"id":4,"license":"GPL-3.0","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"36:22:0"},{"abstract":false,"baseContracts":[],"contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":3,"linearizedBaseContracts":[3],"name":"Errort6","nodeType":"ContractDefinition","nodes":[],"scope":4,"src":"59:35:0"}],"src":"36:84:0"},"id":0}}} +","message":"Recovered in ContractDefinition at '}'.","severity":"warning","sourceLocation":{"end":120,"file":"A","start":119},"type":"Warning"}],"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"Errort6":[4]},"id":5,"license":"GPL-3.0","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"36:22:0"},{"abstract":false,"baseContracts":[],"contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":4,"linearizedBaseContracts":[4],"name":"Errort6","nodeType":"ContractDefinition","nodes":[],"scope":5,"src":"59:35:0"}],"src":"36:84:0"},"id":0}}} diff --git a/test/cmdlineTests/storage_layout_many/output.json b/test/cmdlineTests/storage_layout_many/output.json index a413e1027..0b6dfcb7f 100644 --- a/test/cmdlineTests/storage_layout_many/output.json +++ b/test/cmdlineTests/storage_layout_many/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"},{"astId":26,"contract":"fileA:A","label":"map","offset":0,"slot":"7","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"},{"astId":29,"contract":"fileA:A","label":"array","offset":0,"slot":"8","type":"t_array(t_uint256)dyn_storage"},{"astId":31,"contract":"fileA:A","label":"s1","offset":0,"slot":"9","type":"t_string_storage"},{"astId":33,"contract":"fileA:A","label":"b1","offset":0,"slot":"10","type":"t_bytes_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":19,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":21,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"},{"astId":27,"contract":"fileA:A","label":"map","offset":0,"slot":"7","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"},{"astId":30,"contract":"fileA:A","label":"array","offset":0,"slot":"8","type":"t_array(t_uint256)dyn_storage"},{"astId":32,"contract":"fileA:A","label":"s1","offset":0,"slot":"9","type":"t_string_storage"},{"astId":34,"contract":"fileA:A","label":"b1","offset":0,"slot":"10","type":"t_bytes_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_struct/output.json b/test/cmdlineTests/storage_layout_struct/output.json index e8c2d6fdc..db5e55cc7 100644 --- a/test/cmdlineTests/storage_layout_struct/output.json +++ b/test/cmdlineTests/storage_layout_struct/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"7","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"b","offset":0,"slot":"1","type":"t_uint256"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"2","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"4","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"160"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":19,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":21,"contract":"fileA:A","label":"addr","offset":0,"slot":"7","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"b","offset":0,"slot":"1","type":"t_uint256"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"2","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"4","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"160"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_struct_packed/output.json b/test/cmdlineTests/storage_layout_struct_packed/output.json index 7ac8c11eb..d90dda2e4 100644 --- a/test/cmdlineTests/storage_layout_struct_packed/output.json +++ b/test/cmdlineTests/storage_layout_struct_packed/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":19,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":21,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset.json b/test/libsolidity/ASTJSON/assembly/slot_offset.json index 0858fe617..9d9a735b7 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset.json @@ -4,10 +4,10 @@ { "C": [ - 11 + 12 ] }, - "id": 12, + "id": 13, "nodeType": "SourceUnit", "nodes": [ @@ -17,10 +17,10 @@ "contractDependencies": [], "contractKind": "contract", "fullyImplemented": true, - "id": 11, + "id": 12, "linearizedBaseContracts": [ - 11 + 12 ], "name": "C", "nodeType": "ContractDefinition", @@ -63,17 +63,17 @@ ], "name": "S", "nodeType": "StructDefinition", - "scope": 11, + "scope": 12, "src": "17:20:1", "visibility": "public" }, { "constant": false, - "id": 5, + "id": 6, "mutability": "mutable", "name": "s", "nodeType": "VariableDeclaration", - "scope": 11, + "scope": 12, "src": "42:3:1", "stateVariable": true, "storageLocation": "default", @@ -84,9 +84,16 @@ }, "typeName": { - "id": 4, - "name": "S", + "id": 5, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 4, + "name": "S", + "nodeType": "IdentifierPath", + "referencedDeclaration": 3, + "src": "42:1:1" + }, "referencedDeclaration": 3, "src": "42:1:1", "typeDescriptions": @@ -100,7 +107,7 @@ { "body": { - "id": 9, + "id": 10, "nodeType": "Block", "src": "76:70:1", "statements": @@ -176,28 +183,28 @@ "externalReferences": [ { - "declaration": 5, + "declaration": 6, "isOffset": true, "isSlot": false, "src": "106:8:1", "valueSize": 1 }, { - "declaration": 5, + "declaration": 6, "isOffset": false, "isSlot": true, "src": "128:6:1", "valueSize": 1 } ], - "id": 8, + "id": 9, "nodeType": "InlineAssembly", "src": "86:54:1" } ] }, "functionSelector": "ffae15ba", - "id": 10, + "id": 11, "implemented": true, "kind": "function", "modifiers": [], @@ -205,26 +212,26 @@ "nodeType": "FunctionDefinition", "parameters": { - "id": 6, + "id": 7, "nodeType": "ParameterList", "parameters": [], "src": "61:2:1" }, "returnParameters": { - "id": 7, + "id": 8, "nodeType": "ParameterList", "parameters": [], "src": "76:0:1" }, - "scope": 11, + "scope": 12, "src": "51:95:1", "stateMutability": "pure", "virtual": false, "visibility": "public" } ], - "scope": 12, + "scope": 13, "src": "0:148:1" } ], diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json b/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json index 50747baaa..80326b1df 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json @@ -6,7 +6,7 @@ { "C": [ - 11 + 12 ] } }, @@ -28,10 +28,10 @@ "fullyImplemented": true, "linearizedBaseContracts": [ - 11 + 12 ], "name": "C", - "scope": 12 + "scope": 13 }, "children": [ @@ -40,7 +40,7 @@ { "canonicalName": "C.S", "name": "S", - "scope": 11, + "scope": 12, "visibility": "public" }, "children": @@ -85,7 +85,7 @@ "constant": false, "mutability": "mutable", "name": "s", - "scope": 11, + "scope": 12, "stateVariable": true, "storageLocation": "default", "type": "struct C.S", @@ -96,16 +96,28 @@ { "attributes": { - "name": "S", "referencedDeclaration": 3, "type": "struct C.S" }, - "id": 4, + "children": + [ + { + "attributes": + { + "name": "S", + "referencedDeclaration": 3 + }, + "id": 4, + "name": "IdentifierPath", + "src": "42:1:1" + } + ], + "id": 5, "name": "UserDefinedTypeName", "src": "42:1:1" } ], - "id": 5, + "id": 6, "name": "VariableDeclaration", "src": "42:3:1" }, @@ -121,7 +133,7 @@ null ], "name": "e", - "scope": 11, + "scope": 12, "stateMutability": "pure", "virtual": false, "visibility": "public" @@ -137,7 +149,7 @@ ] }, "children": [], - "id": 6, + "id": 7, "name": "ParameterList", "src": "61:2:1" }, @@ -150,7 +162,7 @@ ] }, "children": [], - "id": 7, + "id": 8, "name": "ParameterList", "src": "76:0:1" }, @@ -164,14 +176,14 @@ "externalReferences": [ { - "declaration": 5, + "declaration": 6, "isOffset": true, "isSlot": false, "src": "106:8:1", "valueSize": 1 }, { - "declaration": 5, + "declaration": 6, "isOffset": false, "isSlot": true, "src": "128:6:1", @@ -181,27 +193,27 @@ "operations": "{\n let x := s.offset\n let y := mul(s.slot, 2)\n}" }, "children": [], - "id": 8, + "id": 9, "name": "InlineAssembly", "src": "86:54:1" } ], - "id": 9, + "id": 10, "name": "Block", "src": "76:70:1" } ], - "id": 10, + "id": 11, "name": "FunctionDefinition", "src": "51:95:1" } ], - "id": 11, + "id": 12, "name": "ContractDefinition", "src": "0:148:1" } ], - "id": 12, + "id": 13, "name": "SourceUnit", "src": "0:149:1" } diff --git a/test/libsolidity/ASTJSON/contract_dep_order.json b/test/libsolidity/ASTJSON/contract_dep_order.json index ff1247548..21eae03a1 100644 --- a/test/libsolidity/ASTJSON/contract_dep_order.json +++ b/test/libsolidity/ASTJSON/contract_dep_order.json @@ -8,22 +8,22 @@ ], "B": [ - 4 + 5 ], "C": [ - 7 + 9 ], "D": [ - 10 + 13 ], "E": [ - 13 + 17 ] }, - "id": 14, + "id": 18, "nodeType": "SourceUnit", "nodes": [ @@ -41,7 +41,7 @@ "name": "A", "nodeType": "ContractDefinition", "nodes": [], - "scope": 14, + "scope": 18, "src": "0:14:1" }, { @@ -51,9 +51,16 @@ { "baseName": { - "id": 2, - "name": "A", + "id": 3, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 2, + "name": "A", + "nodeType": "IdentifierPath", + "referencedDeclaration": 1, + "src": "29:1:1" + }, "referencedDeclaration": 1, "src": "29:1:1", "typeDescriptions": @@ -62,7 +69,7 @@ "typeString": "contract A" } }, - "id": 3, + "id": 4, "nodeType": "InheritanceSpecifier", "src": "29:1:1" } @@ -73,16 +80,16 @@ ], "contractKind": "contract", "fullyImplemented": true, - "id": 4, + "id": 5, "linearizedBaseContracts": [ - 4, + 5, 1 ], "name": "B", "nodeType": "ContractDefinition", "nodes": [], - "scope": 14, + "scope": 18, "src": "15:19:1" }, { @@ -92,18 +99,25 @@ { "baseName": { - "id": 5, - "name": "B", + "id": 7, "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 4, + "pathNode": + { + "id": 6, + "name": "B", + "nodeType": "IdentifierPath", + "referencedDeclaration": 5, + "src": "49:1:1" + }, + "referencedDeclaration": 5, "src": "49:1:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_B_$4", + "typeIdentifier": "t_contract$_B_$5", "typeString": "contract B" } }, - "id": 6, + "id": 8, "nodeType": "InheritanceSpecifier", "src": "49:1:1" } @@ -111,21 +125,21 @@ "contractDependencies": [ 1, - 4 + 5 ], "contractKind": "contract", "fullyImplemented": true, - "id": 7, + "id": 9, "linearizedBaseContracts": [ - 7, - 4, + 9, + 5, 1 ], "name": "C", "nodeType": "ContractDefinition", "nodes": [], - "scope": 14, + "scope": 18, "src": "35:19:1" }, { @@ -135,18 +149,25 @@ { "baseName": { - "id": 8, - "name": "C", + "id": 11, "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 7, + "pathNode": + { + "id": 10, + "name": "C", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9, + "src": "69:1:1" + }, + "referencedDeclaration": 9, "src": "69:1:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_C_$7", + "typeIdentifier": "t_contract$_C_$9", "typeString": "contract C" } }, - "id": 9, + "id": 12, "nodeType": "InheritanceSpecifier", "src": "69:1:1" } @@ -154,23 +175,23 @@ "contractDependencies": [ 1, - 4, - 7 + 5, + 9 ], "contractKind": "contract", "fullyImplemented": true, - "id": 10, + "id": 13, "linearizedBaseContracts": [ - 10, - 7, - 4, + 13, + 9, + 5, 1 ], "name": "D", "nodeType": "ContractDefinition", "nodes": [], - "scope": 14, + "scope": 18, "src": "55:19:1" }, { @@ -180,18 +201,25 @@ { "baseName": { - "id": 11, - "name": "D", + "id": 15, "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 10, + "pathNode": + { + "id": 14, + "name": "D", + "nodeType": "IdentifierPath", + "referencedDeclaration": 13, + "src": "89:1:1" + }, + "referencedDeclaration": 13, "src": "89:1:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_D_$10", + "typeIdentifier": "t_contract$_D_$13", "typeString": "contract D" } }, - "id": 12, + "id": 16, "nodeType": "InheritanceSpecifier", "src": "89:1:1" } @@ -199,25 +227,25 @@ "contractDependencies": [ 1, - 4, - 7, - 10 + 5, + 9, + 13 ], "contractKind": "contract", "fullyImplemented": true, - "id": 13, + "id": 17, "linearizedBaseContracts": [ + 17, 13, - 10, - 7, - 4, + 9, + 5, 1 ], "name": "E", "nodeType": "ContractDefinition", "nodes": [], - "scope": 14, + "scope": 18, "src": "75:19:1" } ], diff --git a/test/libsolidity/ASTJSON/contract_dep_order_legacy.json b/test/libsolidity/ASTJSON/contract_dep_order_legacy.json index 20f40cb90..fef63a0e1 100644 --- a/test/libsolidity/ASTJSON/contract_dep_order_legacy.json +++ b/test/libsolidity/ASTJSON/contract_dep_order_legacy.json @@ -10,19 +10,19 @@ ], "B": [ - 4 + 5 ], "C": [ - 7 + 9 ], "D": [ - 10 + 13 ], "E": [ - 13 + 17 ] } }, @@ -51,7 +51,7 @@ [ null ], - "scope": 14 + "scope": 18 }, "id": 1, "name": "ContractDefinition", @@ -69,7 +69,7 @@ "fullyImplemented": true, "linearizedBaseContracts": [ - 4, + 5, 1 ], "name": "B", @@ -77,7 +77,7 @@ [ null ], - "scope": 14 + "scope": 18 }, "children": [ @@ -88,21 +88,33 @@ { "attributes": { - "name": "A", "referencedDeclaration": 1, "type": "contract A" }, - "id": 2, + "children": + [ + { + "attributes": + { + "name": "A", + "referencedDeclaration": 1 + }, + "id": 2, + "name": "IdentifierPath", + "src": "29:1:1" + } + ], + "id": 3, "name": "UserDefinedTypeName", "src": "29:1:1" } ], - "id": 3, + "id": 4, "name": "InheritanceSpecifier", "src": "29:1:1" } ], - "id": 4, + "id": 5, "name": "ContractDefinition", "src": "15:19:1" }, @@ -113,14 +125,14 @@ "contractDependencies": [ 1, - 4 + 5 ], "contractKind": "contract", "fullyImplemented": true, "linearizedBaseContracts": [ - 7, - 4, + 9, + 5, 1 ], "name": "C", @@ -128,7 +140,7 @@ [ null ], - "scope": 14 + "scope": 18 }, "children": [ @@ -139,21 +151,33 @@ { "attributes": { - "name": "B", - "referencedDeclaration": 4, + "referencedDeclaration": 5, "type": "contract B" }, - "id": 5, + "children": + [ + { + "attributes": + { + "name": "B", + "referencedDeclaration": 5 + }, + "id": 6, + "name": "IdentifierPath", + "src": "49:1:1" + } + ], + "id": 7, "name": "UserDefinedTypeName", "src": "49:1:1" } ], - "id": 6, + "id": 8, "name": "InheritanceSpecifier", "src": "49:1:1" } ], - "id": 7, + "id": 9, "name": "ContractDefinition", "src": "35:19:1" }, @@ -164,16 +188,16 @@ "contractDependencies": [ 1, - 4, - 7 + 5, + 9 ], "contractKind": "contract", "fullyImplemented": true, "linearizedBaseContracts": [ - 10, - 7, - 4, + 13, + 9, + 5, 1 ], "name": "D", @@ -181,7 +205,7 @@ [ null ], - "scope": 14 + "scope": 18 }, "children": [ @@ -192,21 +216,33 @@ { "attributes": { - "name": "C", - "referencedDeclaration": 7, + "referencedDeclaration": 9, "type": "contract C" }, - "id": 8, + "children": + [ + { + "attributes": + { + "name": "C", + "referencedDeclaration": 9 + }, + "id": 10, + "name": "IdentifierPath", + "src": "69:1:1" + } + ], + "id": 11, "name": "UserDefinedTypeName", "src": "69:1:1" } ], - "id": 9, + "id": 12, "name": "InheritanceSpecifier", "src": "69:1:1" } ], - "id": 10, + "id": 13, "name": "ContractDefinition", "src": "55:19:1" }, @@ -217,18 +253,18 @@ "contractDependencies": [ 1, - 4, - 7, - 10 + 5, + 9, + 13 ], "contractKind": "contract", "fullyImplemented": true, "linearizedBaseContracts": [ + 17, 13, - 10, - 7, - 4, + 9, + 5, 1 ], "name": "E", @@ -236,7 +272,7 @@ [ null ], - "scope": 14 + "scope": 18 }, "children": [ @@ -247,26 +283,38 @@ { "attributes": { - "name": "D", - "referencedDeclaration": 10, + "referencedDeclaration": 13, "type": "contract D" }, - "id": 11, + "children": + [ + { + "attributes": + { + "name": "D", + "referencedDeclaration": 13 + }, + "id": 14, + "name": "IdentifierPath", + "src": "89:1:1" + } + ], + "id": 15, "name": "UserDefinedTypeName", "src": "89:1:1" } ], - "id": 12, + "id": 16, "name": "InheritanceSpecifier", "src": "89:1:1" } ], - "id": 13, + "id": 17, "name": "ContractDefinition", "src": "75:19:1" } ], - "id": 14, + "id": 18, "name": "SourceUnit", "src": "0:95:1" } diff --git a/test/libsolidity/ASTJSON/inheritance_specifier.json b/test/libsolidity/ASTJSON/inheritance_specifier.json index 40acc5d2a..ad0426032 100644 --- a/test/libsolidity/ASTJSON/inheritance_specifier.json +++ b/test/libsolidity/ASTJSON/inheritance_specifier.json @@ -8,10 +8,10 @@ ], "C2": [ - 4 + 5 ] }, - "id": 5, + "id": 6, "nodeType": "SourceUnit", "nodes": [ @@ -29,7 +29,7 @@ "name": "C1", "nodeType": "ContractDefinition", "nodes": [], - "scope": 5, + "scope": 6, "src": "0:14:1" }, { @@ -39,9 +39,16 @@ { "baseName": { - "id": 2, - "name": "C1", + "id": 3, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 2, + "name": "C1", + "nodeType": "IdentifierPath", + "referencedDeclaration": 1, + "src": "30:2:1" + }, "referencedDeclaration": 1, "src": "30:2:1", "typeDescriptions": @@ -50,7 +57,7 @@ "typeString": "contract C1" } }, - "id": 3, + "id": 4, "nodeType": "InheritanceSpecifier", "src": "30:2:1" } @@ -61,16 +68,16 @@ ], "contractKind": "contract", "fullyImplemented": true, - "id": 4, + "id": 5, "linearizedBaseContracts": [ - 4, + 5, 1 ], "name": "C2", "nodeType": "ContractDefinition", "nodes": [], - "scope": 5, + "scope": 6, "src": "15:20:1" } ], diff --git a/test/libsolidity/ASTJSON/inheritance_specifier_legacy.json b/test/libsolidity/ASTJSON/inheritance_specifier_legacy.json index 4d6f0ffec..103238955 100644 --- a/test/libsolidity/ASTJSON/inheritance_specifier_legacy.json +++ b/test/libsolidity/ASTJSON/inheritance_specifier_legacy.json @@ -10,7 +10,7 @@ ], "C2": [ - 4 + 5 ] } }, @@ -39,7 +39,7 @@ [ null ], - "scope": 5 + "scope": 6 }, "id": 1, "name": "ContractDefinition", @@ -57,7 +57,7 @@ "fullyImplemented": true, "linearizedBaseContracts": [ - 4, + 5, 1 ], "name": "C2", @@ -65,7 +65,7 @@ [ null ], - "scope": 5 + "scope": 6 }, "children": [ @@ -76,26 +76,38 @@ { "attributes": { - "name": "C1", "referencedDeclaration": 1, "type": "contract C1" }, - "id": 2, + "children": + [ + { + "attributes": + { + "name": "C1", + "referencedDeclaration": 1 + }, + "id": 2, + "name": "IdentifierPath", + "src": "30:2:1" + } + ], + "id": 3, "name": "UserDefinedTypeName", "src": "30:2:1" } ], - "id": 3, + "id": 4, "name": "InheritanceSpecifier", "src": "30:2:1" } ], - "id": 4, + "id": 5, "name": "ContractDefinition", "src": "15:20:1" } ], - "id": 5, + "id": 6, "name": "SourceUnit", "src": "0:36:1" } diff --git a/test/libsolidity/ASTJSON/mappings.json b/test/libsolidity/ASTJSON/mappings.json index b1f150f10..ce72bbb11 100644 --- a/test/libsolidity/ASTJSON/mappings.json +++ b/test/libsolidity/ASTJSON/mappings.json @@ -4,10 +4,10 @@ { "C": [ - 17 + 19 ] }, - "id": 18, + "id": 20, "nodeType": "SourceUnit", "nodes": [ @@ -17,10 +17,10 @@ "contractDependencies": [], "contractKind": "contract", "fullyImplemented": true, - "id": 17, + "id": 19, "linearizedBaseContracts": [ - 17 + 19 ], "name": "C", "nodeType": "ContractDefinition", @@ -56,32 +56,39 @@ }, { "constant": false, - "id": 8, + "id": 9, "mutability": "mutable", "name": "a", "nodeType": "VariableDeclaration", - "scope": 17, + "scope": 19, "src": "40:20:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_contract$_C_$17_$_t_bool_$", + "typeIdentifier": "t_mapping$_t_contract$_C_$19_$_t_bool_$", "typeString": "mapping(contract C => bool)" }, "typeName": { - "id": 7, + "id": 8, "keyType": { - "id": 5, - "name": "C", + "id": 6, "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 17, + "pathNode": + { + "id": 5, + "name": "C", + "nodeType": "IdentifierPath", + "referencedDeclaration": 19, + "src": "48:1:1" + }, + "referencedDeclaration": 19, "src": "48:1:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_C_$17", + "typeIdentifier": "t_contract$_C_$19", "typeString": "contract C" } }, @@ -89,12 +96,12 @@ "src": "40:18:1", "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_contract$_C_$17_$_t_bool_$", + "typeIdentifier": "t_mapping$_t_contract$_C_$19_$_t_bool_$", "typeString": "mapping(contract C => bool)" }, "valueType": { - "id": 6, + "id": 7, "name": "bool", "nodeType": "ElementaryTypeName", "src": "53:4:1", @@ -109,11 +116,11 @@ }, { "constant": false, - "id": 12, + "id": 13, "mutability": "mutable", "name": "b", "nodeType": "VariableDeclaration", - "scope": 17, + "scope": 19, "src": "66:26:1", "stateVariable": true, "storageLocation": "default", @@ -124,10 +131,10 @@ }, "typeName": { - "id": 11, + "id": 12, "keyType": { - "id": 9, + "id": 10, "name": "address", "nodeType": "ElementaryTypeName", "src": "74:7:1", @@ -146,7 +153,7 @@ }, "valueType": { - "id": 10, + "id": 11, "name": "bool", "nodeType": "ElementaryTypeName", "src": "85:4:1", @@ -161,11 +168,11 @@ }, { "constant": false, - "id": 16, + "id": 18, "mutability": "mutable", "name": "c", "nodeType": "VariableDeclaration", - "scope": 17, + "scope": 19, "src": "98:20:1", "stateVariable": true, "storageLocation": "default", @@ -176,12 +183,19 @@ }, "typeName": { - "id": 15, + "id": 17, "keyType": { - "id": 13, - "name": "E", + "id": 15, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 14, + "name": "E", + "nodeType": "IdentifierPath", + "referencedDeclaration": 4, + "src": "106:1:1" + }, "referencedDeclaration": 4, "src": "106:1:1", "typeDescriptions": @@ -199,7 +213,7 @@ }, "valueType": { - "id": 14, + "id": 16, "name": "bool", "nodeType": "ElementaryTypeName", "src": "111:4:1", @@ -213,7 +227,7 @@ "visibility": "internal" } ], - "scope": 18, + "scope": 20, "src": "0:121:1" } ], diff --git a/test/libsolidity/ASTJSON/mappings_legacy.json b/test/libsolidity/ASTJSON/mappings_legacy.json index a44eea0eb..888070c56 100644 --- a/test/libsolidity/ASTJSON/mappings_legacy.json +++ b/test/libsolidity/ASTJSON/mappings_legacy.json @@ -6,7 +6,7 @@ { "C": [ - 17 + 19 ] } }, @@ -28,10 +28,10 @@ "fullyImplemented": true, "linearizedBaseContracts": [ - 17 + 19 ], "name": "C", - "scope": 18 + "scope": 20 }, "children": [ @@ -81,7 +81,7 @@ "constant": false, "mutability": "mutable", "name": "a", - "scope": 17, + "scope": 19, "stateVariable": true, "storageLocation": "default", "type": "mapping(contract C => bool)", @@ -99,11 +99,23 @@ { "attributes": { - "name": "C", - "referencedDeclaration": 17, + "referencedDeclaration": 19, "type": "contract C" }, - "id": 5, + "children": + [ + { + "attributes": + { + "name": "C", + "referencedDeclaration": 19 + }, + "id": 5, + "name": "IdentifierPath", + "src": "48:1:1" + } + ], + "id": 6, "name": "UserDefinedTypeName", "src": "48:1:1" }, @@ -113,17 +125,17 @@ "name": "bool", "type": "bool" }, - "id": 6, + "id": 7, "name": "ElementaryTypeName", "src": "53:4:1" } ], - "id": 7, + "id": 8, "name": "Mapping", "src": "40:18:1" } ], - "id": 8, + "id": 9, "name": "VariableDeclaration", "src": "40:20:1" }, @@ -133,7 +145,7 @@ "constant": false, "mutability": "mutable", "name": "b", - "scope": 17, + "scope": 19, "stateVariable": true, "storageLocation": "default", "type": "mapping(address => bool)", @@ -154,7 +166,7 @@ "name": "address", "type": "address" }, - "id": 9, + "id": 10, "name": "ElementaryTypeName", "src": "74:7:1" }, @@ -164,17 +176,17 @@ "name": "bool", "type": "bool" }, - "id": 10, + "id": 11, "name": "ElementaryTypeName", "src": "85:4:1" } ], - "id": 11, + "id": 12, "name": "Mapping", "src": "66:24:1" } ], - "id": 12, + "id": 13, "name": "VariableDeclaration", "src": "66:26:1" }, @@ -184,7 +196,7 @@ "constant": false, "mutability": "mutable", "name": "c", - "scope": 17, + "scope": 19, "stateVariable": true, "storageLocation": "default", "type": "mapping(enum C.E => bool)", @@ -202,11 +214,23 @@ { "attributes": { - "name": "E", "referencedDeclaration": 4, "type": "enum C.E" }, - "id": 13, + "children": + [ + { + "attributes": + { + "name": "E", + "referencedDeclaration": 4 + }, + "id": 14, + "name": "IdentifierPath", + "src": "106:1:1" + } + ], + "id": 15, "name": "UserDefinedTypeName", "src": "106:1:1" }, @@ -216,27 +240,27 @@ "name": "bool", "type": "bool" }, - "id": 14, + "id": 16, "name": "ElementaryTypeName", "src": "111:4:1" } ], - "id": 15, + "id": 17, "name": "Mapping", "src": "98:18:1" } ], - "id": 16, + "id": 18, "name": "VariableDeclaration", "src": "98:20:1" } ], - "id": 17, + "id": 19, "name": "ContractDefinition", "src": "0:121:1" } ], - "id": 18, + "id": 20, "name": "SourceUnit", "src": "0:122:1" } diff --git a/test/libsolidity/ASTJSON/override.json b/test/libsolidity/ASTJSON/override.json index 49f85144e..805ca6c50 100644 --- a/test/libsolidity/ASTJSON/override.json +++ b/test/libsolidity/ASTJSON/override.json @@ -8,14 +8,14 @@ ], "B": [ - 16 + 17 ], "C": [ - 31 + 35 ] }, - "id": 32, + "id": 36, "nodeType": "SourceUnit", "nodes": [ @@ -70,7 +70,7 @@ "visibility": "public" } ], - "scope": 32, + "scope": 36, "src": "0:40:1" }, { @@ -80,9 +80,16 @@ { "baseName": { - "id": 6, - "name": "A", + "id": 7, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 6, + "name": "A", + "nodeType": "IdentifierPath", + "referencedDeclaration": 5, + "src": "55:1:1" + }, "referencedDeclaration": 5, "src": "55:1:1", "typeDescriptions": @@ -91,7 +98,7 @@ "typeString": "contract A" } }, - "id": 7, + "id": 8, "nodeType": "InheritanceSpecifier", "src": "55:1:1" } @@ -102,10 +109,10 @@ ], "contractKind": "contract", "fullyImplemented": false, - "id": 16, + "id": 17, "linearizedBaseContracts": [ - 16, + 17, 5 ], "name": "B", @@ -114,7 +121,7 @@ [ { "functionSelector": "c2985578", - "id": 10, + "id": 11, "implemented": false, "kind": "function", "modifiers": [], @@ -122,19 +129,19 @@ "nodeType": "FunctionDefinition", "parameters": { - "id": 8, + "id": 9, "nodeType": "ParameterList", "parameters": [], "src": "72:2:1" }, "returnParameters": { - "id": 9, + "id": 10, "nodeType": "ParameterList", "parameters": [], "src": "81:0:1" }, - "scope": 16, + "scope": 17, "src": "60:22:1", "stateMutability": "nonpayable", "virtual": false, @@ -147,13 +154,13 @@ ], "body": { - "id": 14, + "id": 15, "nodeType": "Block", "src": "115:2:1", "statements": [] }, "functionSelector": "a399b6a2", - "id": 15, + "id": 16, "implemented": true, "kind": "function", "modifiers": [], @@ -161,33 +168,33 @@ "nodeType": "FunctionDefinition", "overrides": { - "id": 12, + "id": 13, "nodeType": "OverrideSpecifier", "overrides": [], "src": "106:8:1" }, "parameters": { - "id": 11, + "id": 12, "nodeType": "ParameterList", "parameters": [], "src": "96:2:1" }, "returnParameters": { - "id": 13, + "id": 14, "nodeType": "ParameterList", "parameters": [], "src": "115:0:1" }, - "scope": 16, + "scope": 17, "src": "84:33:1", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" } ], - "scope": 32, + "scope": 36, "src": "41:78:1" }, { @@ -197,18 +204,25 @@ { "baseName": { - "id": 17, - "name": "B", + "id": 19, "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 16, + "pathNode": + { + "id": 18, + "name": "B", + "nodeType": "IdentifierPath", + "referencedDeclaration": 17, + "src": "134:1:1" + }, + "referencedDeclaration": 17, "src": "134:1:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_B_$16", + "typeIdentifier": "t_contract$_B_$17", "typeString": "contract B" } }, - "id": 18, + "id": 20, "nodeType": "InheritanceSpecifier", "src": "134:1:1" } @@ -216,15 +230,15 @@ "contractDependencies": [ 5, - 16 + 17 ], "contractKind": "contract", "fullyImplemented": true, - "id": 31, + "id": 35, "linearizedBaseContracts": [ - 31, - 16, + 35, + 17, 5 ], "name": "C", @@ -234,17 +248,17 @@ { "baseFunctions": [ - 10 + 11 ], "body": { - "id": 22, + "id": 24, "nodeType": "Block", "src": "170:3:1", "statements": [] }, "functionSelector": "c2985578", - "id": 23, + "id": 25, "implemented": true, "kind": "function", "modifiers": [], @@ -252,26 +266,26 @@ "nodeType": "FunctionDefinition", "overrides": { - "id": 20, + "id": 22, "nodeType": "OverrideSpecifier", "overrides": [], "src": "161:8:1" }, "parameters": { - "id": 19, + "id": 21, "nodeType": "ParameterList", "parameters": [], "src": "151:2:1" }, "returnParameters": { - "id": 21, + "id": 23, "nodeType": "ParameterList", "parameters": [], "src": "170:0:1" }, - "scope": 31, + "scope": 35, "src": "139:34:1", "stateMutability": "nonpayable", "virtual": false, @@ -280,17 +294,17 @@ { "baseFunctions": [ - 15 + 16 ], "body": { - "id": 29, + "id": 33, "nodeType": "Block", "src": "212:2:1", "statements": [] }, "functionSelector": "a399b6a2", - "id": 30, + "id": 34, "implemented": true, "kind": "function", "modifiers": [], @@ -298,14 +312,21 @@ "nodeType": "FunctionDefinition", "overrides": { - "id": 27, + "id": 31, "nodeType": "OverrideSpecifier", "overrides": [ { - "id": 25, - "name": "A", + "id": 28, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 27, + "name": "A", + "nodeType": "IdentifierPath", + "referencedDeclaration": 5, + "src": "206:1:1" + }, "referencedDeclaration": 5, "src": "206:1:1", "typeDescriptions": @@ -315,14 +336,21 @@ } }, { - "id": 26, - "name": "B", + "id": 30, "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 16, + "pathNode": + { + "id": 29, + "name": "B", + "nodeType": "IdentifierPath", + "referencedDeclaration": 17, + "src": "209:1:1" + }, + "referencedDeclaration": 17, "src": "209:1:1", "typeDescriptions": { - "typeIdentifier": "t_contract$_B_$16", + "typeIdentifier": "t_contract$_B_$17", "typeString": "contract B" } } @@ -331,26 +359,26 @@ }, "parameters": { - "id": 24, + "id": 26, "nodeType": "ParameterList", "parameters": [], "src": "187:2:1" }, "returnParameters": { - "id": 28, + "id": 32, "nodeType": "ParameterList", "parameters": [], "src": "212:0:1" }, - "scope": 31, + "scope": 35, "src": "175:39:1", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" } ], - "scope": 32, + "scope": 36, "src": "120:96:1" } ], diff --git a/test/libsolidity/ASTJSON/override_legacy.json b/test/libsolidity/ASTJSON/override_legacy.json index 5cdc2f364..bf994680e 100644 --- a/test/libsolidity/ASTJSON/override_legacy.json +++ b/test/libsolidity/ASTJSON/override_legacy.json @@ -10,11 +10,11 @@ ], "B": [ - 16 + 17 ], "C": [ - 31 + 35 ] } }, @@ -39,7 +39,7 @@ 5 ], "name": "A", - "scope": 32 + "scope": 36 }, "children": [ @@ -123,11 +123,11 @@ "fullyImplemented": false, "linearizedBaseContracts": [ - 16, + 17, 5 ], "name": "B", - "scope": 32 + "scope": 36 }, "children": [ @@ -138,16 +138,28 @@ { "attributes": { - "name": "A", "referencedDeclaration": 5, "type": "contract A" }, - "id": 6, + "children": + [ + { + "attributes": + { + "name": "A", + "referencedDeclaration": 5 + }, + "id": 6, + "name": "IdentifierPath", + "src": "55:1:1" + } + ], + "id": 7, "name": "UserDefinedTypeName", "src": "55:1:1" } ], - "id": 7, + "id": 8, "name": "InheritanceSpecifier", "src": "55:1:1" }, @@ -163,7 +175,7 @@ null ], "name": "foo", - "scope": 16, + "scope": 17, "stateMutability": "nonpayable", "virtual": false, "visibility": "public" @@ -179,7 +191,7 @@ ] }, "children": [], - "id": 8, + "id": 9, "name": "ParameterList", "src": "72:2:1" }, @@ -192,12 +204,12 @@ ] }, "children": [], - "id": 9, + "id": 10, "name": "ParameterList", "src": "81:0:1" } ], - "id": 10, + "id": 11, "name": "FunctionDefinition", "src": "60:22:1" }, @@ -217,7 +229,7 @@ null ], "name": "faa", - "scope": 16, + "scope": 17, "stateMutability": "nonpayable", "virtual": false, "visibility": "public" @@ -232,7 +244,7 @@ null ] }, - "id": 12, + "id": 13, "name": "OverrideSpecifier", "src": "106:8:1" }, @@ -245,7 +257,7 @@ ] }, "children": [], - "id": 11, + "id": 12, "name": "ParameterList", "src": "96:2:1" }, @@ -258,7 +270,7 @@ ] }, "children": [], - "id": 13, + "id": 14, "name": "ParameterList", "src": "115:0:1" }, @@ -271,17 +283,17 @@ ] }, "children": [], - "id": 14, + "id": 15, "name": "Block", "src": "115:2:1" } ], - "id": 15, + "id": 16, "name": "FunctionDefinition", "src": "84:33:1" } ], - "id": 16, + "id": 17, "name": "ContractDefinition", "src": "41:78:1" }, @@ -292,18 +304,18 @@ "contractDependencies": [ 5, - 16 + 17 ], "contractKind": "contract", "fullyImplemented": true, "linearizedBaseContracts": [ - 31, - 16, + 35, + 17, 5 ], "name": "C", - "scope": 32 + "scope": 36 }, "children": [ @@ -314,16 +326,28 @@ { "attributes": { - "name": "B", - "referencedDeclaration": 16, + "referencedDeclaration": 17, "type": "contract B" }, - "id": 17, + "children": + [ + { + "attributes": + { + "name": "B", + "referencedDeclaration": 17 + }, + "id": 18, + "name": "IdentifierPath", + "src": "134:1:1" + } + ], + "id": 19, "name": "UserDefinedTypeName", "src": "134:1:1" } ], - "id": 18, + "id": 20, "name": "InheritanceSpecifier", "src": "134:1:1" }, @@ -332,7 +356,7 @@ { "baseFunctions": [ - 10 + 11 ], "functionSelector": "c2985578", "implemented": true, @@ -343,7 +367,7 @@ null ], "name": "foo", - "scope": 31, + "scope": 35, "stateMutability": "nonpayable", "virtual": false, "visibility": "public" @@ -358,7 +382,7 @@ null ] }, - "id": 20, + "id": 22, "name": "OverrideSpecifier", "src": "161:8:1" }, @@ -371,7 +395,7 @@ ] }, "children": [], - "id": 19, + "id": 21, "name": "ParameterList", "src": "151:2:1" }, @@ -384,7 +408,7 @@ ] }, "children": [], - "id": 21, + "id": 23, "name": "ParameterList", "src": "170:0:1" }, @@ -397,12 +421,12 @@ ] }, "children": [], - "id": 22, + "id": 24, "name": "Block", "src": "170:3:1" } ], - "id": 23, + "id": 25, "name": "FunctionDefinition", "src": "139:34:1" }, @@ -411,7 +435,7 @@ { "baseFunctions": [ - 15 + 16 ], "functionSelector": "a399b6a2", "implemented": true, @@ -422,7 +446,7 @@ null ], "name": "faa", - "scope": 31, + "scope": 35, "stateMutability": "nonpayable", "virtual": false, "visibility": "public" @@ -435,27 +459,51 @@ { "attributes": { - "name": "A", "referencedDeclaration": 5, "type": "contract A" }, - "id": 25, + "children": + [ + { + "attributes": + { + "name": "A", + "referencedDeclaration": 5 + }, + "id": 27, + "name": "IdentifierPath", + "src": "206:1:1" + } + ], + "id": 28, "name": "UserDefinedTypeName", "src": "206:1:1" }, { "attributes": { - "name": "B", - "referencedDeclaration": 16, + "referencedDeclaration": 17, "type": "contract B" }, - "id": 26, + "children": + [ + { + "attributes": + { + "name": "B", + "referencedDeclaration": 17 + }, + "id": 29, + "name": "IdentifierPath", + "src": "209:1:1" + } + ], + "id": 30, "name": "UserDefinedTypeName", "src": "209:1:1" } ], - "id": 27, + "id": 31, "name": "OverrideSpecifier", "src": "197:14:1" }, @@ -468,7 +516,7 @@ ] }, "children": [], - "id": 24, + "id": 26, "name": "ParameterList", "src": "187:2:1" }, @@ -481,7 +529,7 @@ ] }, "children": [], - "id": 28, + "id": 32, "name": "ParameterList", "src": "212:0:1" }, @@ -494,22 +542,22 @@ ] }, "children": [], - "id": 29, + "id": 33, "name": "Block", "src": "212:2:1" } ], - "id": 30, + "id": 34, "name": "FunctionDefinition", "src": "175:39:1" } ], - "id": 31, + "id": 35, "name": "ContractDefinition", "src": "120:96:1" } ], - "id": 32, + "id": 36, "name": "SourceUnit", "src": "0:217:1" } diff --git a/test/libsolidity/ASTJSON/two_base_functions.json b/test/libsolidity/ASTJSON/two_base_functions.json index 769e5c3f8..12c1ff92b 100644 --- a/test/libsolidity/ASTJSON/two_base_functions.json +++ b/test/libsolidity/ASTJSON/two_base_functions.json @@ -12,10 +12,10 @@ ], "C": [ - 22 + 26 ] }, - "id": 23, + "id": 27, "nodeType": "SourceUnit", "nodes": [ @@ -70,7 +70,7 @@ "visibility": "public" } ], - "scope": 23, + "scope": 27, "src": "0:49:1" }, { @@ -124,7 +124,7 @@ "visibility": "public" } ], - "scope": 23, + "scope": 27, "src": "50:49:1" }, { @@ -134,9 +134,16 @@ { "baseName": { - "id": 11, - "name": "A", + "id": 12, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 11, + "name": "A", + "nodeType": "IdentifierPath", + "referencedDeclaration": 5, + "src": "114:1:1" + }, "referencedDeclaration": 5, "src": "114:1:1", "typeDescriptions": @@ -145,16 +152,23 @@ "typeString": "contract A" } }, - "id": 12, + "id": 13, "nodeType": "InheritanceSpecifier", "src": "114:1:1" }, { "baseName": { - "id": 13, - "name": "B", + "id": 15, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 14, + "name": "B", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10, + "src": "117:1:1" + }, "referencedDeclaration": 10, "src": "117:1:1", "typeDescriptions": @@ -163,7 +177,7 @@ "typeString": "contract B" } }, - "id": 14, + "id": 16, "nodeType": "InheritanceSpecifier", "src": "117:1:1" } @@ -175,10 +189,10 @@ ], "contractKind": "contract", "fullyImplemented": true, - "id": 22, + "id": 26, "linearizedBaseContracts": [ - 22, + 26, 10, 5 ], @@ -194,13 +208,13 @@ ], "body": { - "id": 20, + "id": 24, "nodeType": "Block", "src": "160:2:1", "statements": [] }, "functionSelector": "26121ff0", - "id": 21, + "id": 25, "implemented": true, "kind": "function", "modifiers": [], @@ -208,14 +222,21 @@ "nodeType": "FunctionDefinition", "overrides": { - "id": 18, + "id": 22, "nodeType": "OverrideSpecifier", "overrides": [ { - "id": 16, - "name": "A", + "id": 19, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 18, + "name": "A", + "nodeType": "IdentifierPath", + "referencedDeclaration": 5, + "src": "154:1:1" + }, "referencedDeclaration": 5, "src": "154:1:1", "typeDescriptions": @@ -225,9 +246,16 @@ } }, { - "id": 17, - "name": "B", + "id": 21, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 20, + "name": "B", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10, + "src": "157:1:1" + }, "referencedDeclaration": 10, "src": "157:1:1", "typeDescriptions": @@ -241,26 +269,26 @@ }, "parameters": { - "id": 15, + "id": 17, "nodeType": "ParameterList", "parameters": [], "src": "135:2:1" }, "returnParameters": { - "id": 19, + "id": 23, "nodeType": "ParameterList", "parameters": [], "src": "160:0:1" }, - "scope": 22, + "scope": 26, "src": "125:37:1", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" } ], - "scope": 23, + "scope": 27, "src": "100:64:1" } ], diff --git a/test/libsolidity/ASTJSON/two_base_functions_legacy.json b/test/libsolidity/ASTJSON/two_base_functions_legacy.json index a5bd2d725..f55f7207b 100644 --- a/test/libsolidity/ASTJSON/two_base_functions_legacy.json +++ b/test/libsolidity/ASTJSON/two_base_functions_legacy.json @@ -14,7 +14,7 @@ ], "C": [ - 22 + 26 ] } }, @@ -39,7 +39,7 @@ 5 ], "name": "A", - "scope": 23 + "scope": 27 }, "children": [ @@ -130,7 +130,7 @@ 10 ], "name": "B", - "scope": 23 + "scope": 27 }, "children": [ @@ -215,12 +215,12 @@ "fullyImplemented": true, "linearizedBaseContracts": [ - 22, + 26, 10, 5 ], "name": "C", - "scope": 23 + "scope": 27 }, "children": [ @@ -231,16 +231,28 @@ { "attributes": { - "name": "A", "referencedDeclaration": 5, "type": "contract A" }, - "id": 11, + "children": + [ + { + "attributes": + { + "name": "A", + "referencedDeclaration": 5 + }, + "id": 11, + "name": "IdentifierPath", + "src": "114:1:1" + } + ], + "id": 12, "name": "UserDefinedTypeName", "src": "114:1:1" } ], - "id": 12, + "id": 13, "name": "InheritanceSpecifier", "src": "114:1:1" }, @@ -251,16 +263,28 @@ { "attributes": { - "name": "B", "referencedDeclaration": 10, "type": "contract B" }, - "id": 13, + "children": + [ + { + "attributes": + { + "name": "B", + "referencedDeclaration": 10 + }, + "id": 14, + "name": "IdentifierPath", + "src": "117:1:1" + } + ], + "id": 15, "name": "UserDefinedTypeName", "src": "117:1:1" } ], - "id": 14, + "id": 16, "name": "InheritanceSpecifier", "src": "117:1:1" }, @@ -281,7 +305,7 @@ null ], "name": "f", - "scope": 22, + "scope": 26, "stateMutability": "nonpayable", "virtual": false, "visibility": "public" @@ -294,27 +318,51 @@ { "attributes": { - "name": "A", "referencedDeclaration": 5, "type": "contract A" }, - "id": 16, + "children": + [ + { + "attributes": + { + "name": "A", + "referencedDeclaration": 5 + }, + "id": 18, + "name": "IdentifierPath", + "src": "154:1:1" + } + ], + "id": 19, "name": "UserDefinedTypeName", "src": "154:1:1" }, { "attributes": { - "name": "B", "referencedDeclaration": 10, "type": "contract B" }, - "id": 17, + "children": + [ + { + "attributes": + { + "name": "B", + "referencedDeclaration": 10 + }, + "id": 20, + "name": "IdentifierPath", + "src": "157:1:1" + } + ], + "id": 21, "name": "UserDefinedTypeName", "src": "157:1:1" } ], - "id": 18, + "id": 22, "name": "OverrideSpecifier", "src": "145:14:1" }, @@ -327,7 +375,7 @@ ] }, "children": [], - "id": 15, + "id": 17, "name": "ParameterList", "src": "135:2:1" }, @@ -340,7 +388,7 @@ ] }, "children": [], - "id": 19, + "id": 23, "name": "ParameterList", "src": "160:0:1" }, @@ -353,22 +401,22 @@ ] }, "children": [], - "id": 20, + "id": 24, "name": "Block", "src": "160:2:1" } ], - "id": 21, + "id": 25, "name": "FunctionDefinition", "src": "125:37:1" } ], - "id": 22, + "id": 26, "name": "ContractDefinition", "src": "100:64:1" } ], - "id": 23, + "id": 27, "name": "SourceUnit", "src": "0:165:1" } diff --git a/test/libsolidity/ASTJSON/using_for_directive.json b/test/libsolidity/ASTJSON/using_for_directive.json index d26922262..b21a3f6d5 100644 --- a/test/libsolidity/ASTJSON/using_for_directive.json +++ b/test/libsolidity/ASTJSON/using_for_directive.json @@ -4,14 +4,14 @@ { "C": [ - 5 + 6 ], "L": [ 1 ] }, - "id": 6, + "id": 7, "nodeType": "SourceUnit", "nodes": [ @@ -29,7 +29,7 @@ "name": "L", "nodeType": "ContractDefinition", "nodes": [], - "scope": 6, + "scope": 7, "src": "0:12:1" }, { @@ -38,22 +38,29 @@ "contractDependencies": [], "contractKind": "contract", "fullyImplemented": true, - "id": 5, + "id": 6, "linearizedBaseContracts": [ - 5 + 6 ], "name": "C", "nodeType": "ContractDefinition", "nodes": [ { - "id": 4, + "id": 5, "libraryName": { - "id": 2, - "name": "L", + "id": 3, "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 2, + "name": "L", + "nodeType": "IdentifierPath", + "referencedDeclaration": 1, + "src": "32:1:1" + }, "referencedDeclaration": 1, "src": "32:1:1", "typeDescriptions": @@ -66,7 +73,7 @@ "src": "26:17:1", "typeName": { - "id": 3, + "id": 4, "name": "uint", "nodeType": "ElementaryTypeName", "src": "38:4:1", @@ -78,7 +85,7 @@ } } ], - "scope": 6, + "scope": 7, "src": "13:32:1" } ], diff --git a/test/libsolidity/ASTJSON/using_for_directive_legacy.json b/test/libsolidity/ASTJSON/using_for_directive_legacy.json index bdd92fcba..3f2da9fb7 100644 --- a/test/libsolidity/ASTJSON/using_for_directive_legacy.json +++ b/test/libsolidity/ASTJSON/using_for_directive_legacy.json @@ -6,7 +6,7 @@ { "C": [ - 5 + 6 ], "L": [ @@ -39,7 +39,7 @@ [ null ], - "scope": 6 + "scope": 7 }, "id": 1, "name": "ContractDefinition", @@ -61,10 +61,10 @@ "fullyImplemented": true, "linearizedBaseContracts": [ - 5 + 6 ], "name": "C", - "scope": 6 + "scope": 7 }, "children": [ @@ -74,11 +74,23 @@ { "attributes": { - "name": "L", "referencedDeclaration": 1, "type": "library L" }, - "id": 2, + "children": + [ + { + "attributes": + { + "name": "L", + "referencedDeclaration": 1 + }, + "id": 2, + "name": "IdentifierPath", + "src": "32:1:1" + } + ], + "id": 3, "name": "UserDefinedTypeName", "src": "32:1:1" }, @@ -88,22 +100,22 @@ "name": "uint", "type": "uint256" }, - "id": 3, + "id": 4, "name": "ElementaryTypeName", "src": "38:4:1" } ], - "id": 4, + "id": 5, "name": "UsingForDirective", "src": "26:17:1" } ], - "id": 5, + "id": 6, "name": "ContractDefinition", "src": "13:32:1" } ], - "id": 6, + "id": 7, "name": "SourceUnit", "src": "0:46:1" }