From 32ba5f5ae7af3d8ed846ee4032aac192298e703a Mon Sep 17 00:00:00 2001 From: Christian Parpart <christian@parpart.family> Date: Thu, 21 Jan 2021 16:01:39 +0100 Subject: [PATCH 1/2] libsolidity: Extend the AST for named AST nodes in order to get precise locations for names. The actual SourceLocation on an ASTNode is representing the whole ASTNode whereas in an LSP (for example) you are also interested in the SourceLocation of a name of a construct (e.g. variable decarlation, function definition, ...). This also properly encodes non-existend sources as `-1` in the JSON output (eliminating the use of `numeric_limits<size_t>::max()`). --- Changelog.md | 1 + liblangutil/SourceLocation.cpp | 10 ++-- libsolidity/ast/AST.h | 36 +++++++++----- libsolidity/ast/ASTJsonConverter.cpp | 21 +++++++-- libsolidity/ast/ASTJsonConverter.h | 3 +- libsolidity/ast/ASTJsonImporter.cpp | 15 ++++++ libsolidity/ast/ASTJsonImporter.h | 1 + libsolidity/parsing/Parser.cpp | 47 ++++++++++++------- libsolidity/parsing/Parser.h | 1 + libyul/AsmJsonConverter.cpp | 2 +- libyul/AsmJsonConverter.h | 5 +- .../recovery_ast_constructor/output | 4 ++ .../recovery_standard_json/output.json | 2 +- .../standard_only_ast_requested/output.json | 2 +- test/libsolidity/SolidityTypes.cpp | 8 ++-- 15 files changed, 112 insertions(+), 46 deletions(-) diff --git a/Changelog.md b/Changelog.md index 4b04965c1..09b5d59d2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -15,6 +15,7 @@ Bugfixes: AST Changes: * Support field `documentation` to hold NatSpec comments above each statement. + * Adds `nameLocation` to declarations to represent the exact location of the symbolic name. ### 0.8.1 (2021-01-27) diff --git a/liblangutil/SourceLocation.cpp b/liblangutil/SourceLocation.cpp index 160a3616b..8f3187437 100644 --- a/liblangutil/SourceLocation.cpp +++ b/liblangutil/SourceLocation.cpp @@ -34,9 +34,11 @@ SourceLocation const parseSourceLocation(std::string const& _input, std::string boost::algorithm::split(pos, _input, boost::is_any_of(":")); + solAssert(pos.size() == 3, "SourceLocation string must have 3 colon separated numeric fields."); + auto const sourceIndex = stoi(pos[Index]); + astAssert( - pos.size() == 3 && - _maxIndex >= static_cast<size_t>(stoi(pos[Index])), + sourceIndex == -1 || _maxIndex >= static_cast<size_t>(sourceIndex), "'src'-field ill-formatted or src-index too high" ); @@ -44,7 +46,9 @@ SourceLocation const parseSourceLocation(std::string const& _input, std::string int end = start + stoi(pos[Length]); // ASSUMPTION: only the name of source is used from here on, the m_source of the CharStream-Object can be empty - std::shared_ptr<langutil::CharStream> source = std::make_shared<langutil::CharStream>("", _sourceName); + std::shared_ptr<langutil::CharStream> source; + if (sourceIndex != -1) + source = std::make_shared<langutil::CharStream>("", _sourceName); return SourceLocation{start, end, source}; } diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 6edbc717e..ab5041049 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -244,12 +244,14 @@ public: int64_t _id, SourceLocation const& _location, ASTPointer<ASTString> _name, + SourceLocation _nameLocation, Visibility _visibility = Visibility::Default ): - ASTNode(_id, _location), m_name(std::move(_name)), m_visibility(_visibility) {} + ASTNode(_id, _location), m_name(std::move(_name)), m_nameLocation(std::move(_nameLocation)), m_visibility(_visibility) {} /// @returns the declared name. ASTString const& name() const { return *m_name; } + SourceLocation const& nameLocation() const noexcept { return m_nameLocation; } bool noVisibilitySpecified() const { return m_visibility == Visibility::Default; } Visibility visibility() const { return m_visibility == Visibility::Default ? defaultVisibility() : m_visibility; } bool isPublic() const { return visibility() >= Visibility::Public; } @@ -287,6 +289,7 @@ protected: private: ASTPointer<ASTString> m_name; + SourceLocation m_nameLocation; Visibility m_visibility; }; @@ -345,9 +348,10 @@ public: SourceLocation const& _location, ASTPointer<ASTString> _path, ASTPointer<ASTString> const& _unitAlias, + SourceLocation _unitAliasLocation, SymbolAliasList _symbolAliases ): - Declaration(_id, _location, _unitAlias), + Declaration(_id, _location, _unitAlias, std::move(_unitAliasLocation)), m_path(std::move(_path)), m_symbolAliases(move(_symbolAliases)) { } @@ -477,13 +481,14 @@ public: int64_t _id, SourceLocation const& _location, ASTPointer<ASTString> const& _name, + SourceLocation _nameLocation, ASTPointer<StructuredDocumentation> const& _documentation, std::vector<ASTPointer<InheritanceSpecifier>> _baseContracts, std::vector<ASTPointer<ASTNode>> _subNodes, ContractKind _contractKind = ContractKind::Contract, bool _abstract = false ): - Declaration(_id, _location, _name), + Declaration(_id, _location, _name, std::move(_nameLocation)), StructurallyDocumented(_documentation), m_baseContracts(std::move(_baseContracts)), m_subNodes(std::move(_subNodes)), @@ -643,9 +648,10 @@ public: int64_t _id, SourceLocation const& _location, ASTPointer<ASTString> const& _name, + SourceLocation _nameLocation, std::vector<ASTPointer<VariableDeclaration>> _members ): - Declaration(_id, _location, _name), m_members(std::move(_members)) {} + Declaration(_id, _location, _name, std::move(_nameLocation)), m_members(std::move(_members)) {} void accept(ASTVisitor& _visitor) override; void accept(ASTConstVisitor& _visitor) const override; @@ -670,9 +676,10 @@ public: int64_t _id, SourceLocation const& _location, ASTPointer<ASTString> const& _name, + SourceLocation _nameLocation, std::vector<ASTPointer<EnumValue>> _members ): - Declaration(_id, _location, _name), m_members(std::move(_members)) {} + Declaration(_id, _location, _name, std::move(_nameLocation)), m_members(std::move(_members)) {} void accept(ASTVisitor& _visitor) override; void accept(ASTConstVisitor& _visitor) const override; @@ -696,7 +703,7 @@ class EnumValue: public Declaration { public: EnumValue(int64_t _id, SourceLocation const& _location, ASTPointer<ASTString> const& _name): - Declaration(_id, _location, _name) {} + Declaration(_id, _location, _name, _location) {} void accept(ASTVisitor& _visitor) override; void accept(ASTConstVisitor& _visitor) const override; @@ -738,13 +745,14 @@ public: int64_t _id, SourceLocation const& _location, ASTPointer<ASTString> const& _name, + SourceLocation _nameLocation, Visibility _visibility, ASTPointer<ParameterList> _parameters, bool _isVirtual = false, ASTPointer<OverrideSpecifier> _overrides = nullptr, ASTPointer<ParameterList> _returnParameters = ASTPointer<ParameterList>() ): - Declaration(_id, _location, _name, _visibility), + Declaration(_id, _location, _name, std::move(_nameLocation), _visibility), m_parameters(std::move(_parameters)), m_overrides(std::move(_overrides)), m_returnParameters(std::move(_returnParameters)), @@ -815,6 +823,7 @@ public: int64_t _id, SourceLocation const& _location, ASTPointer<ASTString> const& _name, + SourceLocation const& _nameLocation, Visibility _visibility, StateMutability _stateMutability, bool _free, @@ -827,7 +836,7 @@ public: ASTPointer<ParameterList> const& _returnParameters, ASTPointer<Block> const& _body ): - CallableDeclaration(_id, _location, _name, _visibility, _parameters, _isVirtual, _overrides, _returnParameters), + CallableDeclaration(_id, _location, _name, std::move(_nameLocation), _visibility, _parameters, _isVirtual, _overrides, _returnParameters), StructurallyDocumented(_documentation), ImplementationOptional(_body != nullptr), m_stateMutability(_stateMutability), @@ -928,6 +937,7 @@ public: SourceLocation const& _location, ASTPointer<TypeName> _type, ASTPointer<ASTString> const& _name, + SourceLocation _nameLocation, ASTPointer<Expression> _value, Visibility _visibility, ASTPointer<StructuredDocumentation> const _documentation = nullptr, @@ -936,7 +946,7 @@ public: ASTPointer<OverrideSpecifier> _overrides = nullptr, Location _referenceLocation = Location::Unspecified ): - Declaration(_id, _location, _name, _visibility), + Declaration(_id, _location, _name, std::move(_nameLocation), _visibility), StructurallyDocumented(std::move(_documentation)), m_typeName(std::move(_type)), m_value(std::move(_value)), @@ -1033,13 +1043,14 @@ public: int64_t _id, SourceLocation const& _location, ASTPointer<ASTString> const& _name, + SourceLocation _nameLocation, ASTPointer<StructuredDocumentation> const& _documentation, ASTPointer<ParameterList> const& _parameters, bool _isVirtual, ASTPointer<OverrideSpecifier> const& _overrides, ASTPointer<Block> const& _body ): - CallableDeclaration(_id, _location, _name, Visibility::Internal, _parameters, _isVirtual, _overrides), + CallableDeclaration(_id, _location, _name, std::move(_nameLocation), Visibility::Internal, _parameters, _isVirtual, _overrides), StructurallyDocumented(_documentation), ImplementationOptional(_body != nullptr), m_body(_body) @@ -1108,11 +1119,12 @@ public: int64_t _id, SourceLocation const& _location, ASTPointer<ASTString> const& _name, + SourceLocation _nameLocation, ASTPointer<StructuredDocumentation> const& _documentation, ASTPointer<ParameterList> const& _parameters, bool _anonymous = false ): - CallableDeclaration(_id, _location, _name, Visibility::Default, _parameters), + CallableDeclaration(_id, _location, _name, std::move(_nameLocation), Visibility::Default, _parameters), StructurallyDocumented(_documentation), m_anonymous(_anonymous) { @@ -1151,7 +1163,7 @@ class MagicVariableDeclaration: public Declaration { public: MagicVariableDeclaration(int _id, ASTString const& _name, Type const* _type): - Declaration(_id, SourceLocation(), std::make_shared<ASTString>(_name)), m_type(_type) { } + Declaration(_id, SourceLocation(), std::make_shared<ASTString>(_name), {}), m_type(_type) { } void accept(ASTVisitor&) override { diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 619142a49..ce9ec4eee 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -107,21 +107,21 @@ void ASTJsonConverter::setJsonNode( m_currentValue[e.first] = std::move(e.second); } -size_t ASTJsonConverter::sourceIndexFromLocation(SourceLocation const& _location) const +optional<size_t> ASTJsonConverter::sourceIndexFromLocation(SourceLocation const& _location) const { if (_location.source && m_sourceIndices.count(_location.source->name())) return m_sourceIndices.at(_location.source->name()); else - return numeric_limits<size_t>::max(); + return nullopt; } string ASTJsonConverter::sourceLocationToString(SourceLocation const& _location) const { - size_t sourceIndex = sourceIndexFromLocation(_location); + optional<size_t> sourceIndexOpt = sourceIndexFromLocation(_location); int length = -1; if (_location.start >= 0 && _location.end >= 0) length = _location.end - _location.start; - return to_string(_location.start) + ":" + to_string(length) + ":" + to_string(sourceIndex); + return to_string(_location.start) + ":" + to_string(length) + ":" + (sourceIndexOpt.has_value() ? to_string(sourceIndexOpt.value()) : "-1"); } string ASTJsonConverter::namePathToString(std::vector<ASTString> const& _namePath) @@ -243,6 +243,8 @@ bool ASTJsonConverter::visit(ImportDirective const& _node) addIfSet(attributes, "absolutePath", _node.annotation().absolutePath); attributes.emplace_back("unitAlias", _node.name()); + attributes.emplace_back("nameLocation", Json::Value(sourceLocationToString(_node.nameLocation()))); + Json::Value symbolAliases(Json::arrayValue); for (auto const& symbolAlias: _node.symbolAliases()) { @@ -250,6 +252,7 @@ bool ASTJsonConverter::visit(ImportDirective const& _node) solAssert(symbolAlias.symbol, ""); tuple["foreign"] = toJson(*symbolAlias.symbol); tuple["local"] = symbolAlias.alias ? Json::Value(*symbolAlias.alias) : Json::nullValue; + tuple["nameLocation"] = sourceLocationToString(_node.nameLocation()); symbolAliases.append(tuple); } attributes.emplace_back("symbolAliases", std::move(symbolAliases)); @@ -261,6 +264,7 @@ bool ASTJsonConverter::visit(ContractDefinition const& _node) { std::vector<pair<string, Json::Value>> attributes = { make_pair("name", _node.name()), + make_pair("nameLocation", sourceLocationToString(_node.nameLocation())), make_pair("documentation", _node.documentation() ? toJson(*_node.documentation()) : Json::nullValue), make_pair("contractKind", contractKind(_node.contractKind())), make_pair("abstract", _node.abstract()), @@ -310,6 +314,7 @@ bool ASTJsonConverter::visit(StructDefinition const& _node) { std::vector<pair<string, Json::Value>> attributes = { make_pair("name", _node.name()), + make_pair("nameLocation", sourceLocationToString(_node.nameLocation())), make_pair("visibility", Declaration::visibilityToString(_node.visibility())), make_pair("members", toJson(_node.members())), make_pair("scope", idOrNull(_node.scope())) @@ -326,6 +331,7 @@ bool ASTJsonConverter::visit(EnumDefinition const& _node) { std::vector<pair<string, Json::Value>> attributes = { make_pair("name", _node.name()), + make_pair("nameLocation", sourceLocationToString(_node.nameLocation())), make_pair("members", toJson(_node.members())) }; @@ -339,7 +345,8 @@ bool ASTJsonConverter::visit(EnumDefinition const& _node) bool ASTJsonConverter::visit(EnumValue const& _node) { setJsonNode(_node, "EnumValue", { - make_pair("name", _node.name()) + make_pair("name", _node.name()), + make_pair("nameLocation", sourceLocationToString(_node.nameLocation())), }); return false; } @@ -364,6 +371,7 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node) { std::vector<pair<string, Json::Value>> attributes = { make_pair("name", _node.name()), + make_pair("nameLocation", sourceLocationToString(_node.nameLocation())), make_pair("documentation", _node.documentation() ? toJson(*_node.documentation()) : Json::nullValue), make_pair("kind", _node.isFree() ? "freeFunction" : TokenTraits::toString(_node.kind())), make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())), @@ -401,6 +409,7 @@ bool ASTJsonConverter::visit(VariableDeclaration const& _node) { std::vector<pair<string, Json::Value>> attributes = { make_pair("name", _node.name()), + make_pair("nameLocation", sourceLocationToString(_node.nameLocation())), make_pair("typeName", toJson(_node.typeName())), make_pair("constant", _node.isConstant()), make_pair("mutability", VariableDeclaration::mutabilityToString(_node.mutability())), @@ -428,6 +437,7 @@ bool ASTJsonConverter::visit(ModifierDefinition const& _node) { std::vector<pair<string, Json::Value>> attributes = { make_pair("name", _node.name()), + make_pair("nameLocation", sourceLocationToString(_node.nameLocation())), make_pair("documentation", _node.documentation() ? toJson(*_node.documentation()) : Json::nullValue), make_pair("visibility", Declaration::visibilityToString(_node.visibility())), make_pair("parameters", toJson(_node.parameterList())), @@ -455,6 +465,7 @@ bool ASTJsonConverter::visit(EventDefinition const& _node) m_inEvent = true; setJsonNode(_node, "EventDefinition", { make_pair("name", _node.name()), + make_pair("nameLocation", sourceLocationToString(_node.nameLocation())), make_pair("documentation", _node.documentation() ? toJson(*_node.documentation()) : Json::nullValue), make_pair("parameters", toJson(_node.parameterList())), make_pair("anonymous", _node.isAnonymous()) diff --git a/libsolidity/ast/ASTJsonConverter.h b/libsolidity/ast/ASTJsonConverter.h index 8e01f2390..699113ea8 100644 --- a/libsolidity/ast/ASTJsonConverter.h +++ b/libsolidity/ast/ASTJsonConverter.h @@ -137,7 +137,8 @@ private: std::string const& _nodeName, std::vector<std::pair<std::string, Json::Value>>&& _attributes ); - size_t sourceIndexFromLocation(langutil::SourceLocation const& _location) const; + /// Maps source location to an index, if source is valid and a mapping does exist, otherwise returns std::nullopt. + std::optional<size_t> sourceIndexFromLocation(langutil::SourceLocation const& _location) const; std::string sourceLocationToString(langutil::SourceLocation const& _location) const; static std::string namePathToString(std::vector<ASTString> const& _namePath); static Json::Value idOrNull(ASTNode const* _pt) diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index 29b8961e5..6bf5910f2 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -99,6 +99,13 @@ SourceLocation const ASTJsonImporter::createSourceLocation(Json::Value const& _n return solidity::langutil::parseSourceLocation(_node["src"].asString(), m_currentSourceName, m_sourceLocations.size()); } +SourceLocation ASTJsonImporter::createNameSourceLocation(Json::Value const& _node) +{ + astAssert(member(_node, "nameLocation").isString(), "'nameLocation' must be a string"); + + return solidity::langutil::parseSourceLocation(_node["nameLocation"].asString(), m_currentSourceName, m_sourceLocations.size()); +} + template<class T> ASTPointer<T> ASTJsonImporter::convertJsonToASTNode(Json::Value const& _node) { @@ -272,6 +279,7 @@ ASTPointer<ImportDirective> ASTJsonImporter::createImportDirective(Json::Value c _node, path, unitAlias, + createNameSourceLocation(_node), move(symbolAliases) ); @@ -298,6 +306,7 @@ ASTPointer<ContractDefinition> ASTJsonImporter::createContractDefinition(Json::V return createASTNode<ContractDefinition>( _node, make_shared<ASTString>(_node["name"].asString()), + createNameSourceLocation(_node), _node["documentation"].isNull() ? nullptr : createDocumentation(member(_node, "documentation")), baseContracts, subNodes, @@ -352,6 +361,7 @@ ASTPointer<ASTNode> ASTJsonImporter::createStructDefinition(Json::Value const& _ return createASTNode<StructDefinition>( _node, memberAsASTString(_node, "name"), + createNameSourceLocation(_node), members ); } @@ -364,6 +374,7 @@ ASTPointer<EnumDefinition> ASTJsonImporter::createEnumDefinition(Json::Value con return createASTNode<EnumDefinition>( _node, memberAsASTString(_node, "name"), + createNameSourceLocation(_node), members ); } @@ -434,6 +445,7 @@ ASTPointer<FunctionDefinition> ASTJsonImporter::createFunctionDefinition(Json::V return createASTNode<FunctionDefinition>( _node, memberAsASTString(_node, "name"), + createNameSourceLocation(_node), vis, stateMutability(_node), freeFunction, @@ -475,6 +487,7 @@ ASTPointer<VariableDeclaration> ASTJsonImporter::createVariableDeclaration(Json: _node, nullOrCast<TypeName>(member(_node, "typeName")), make_shared<ASTString>(member(_node, "name").asString()), + createNameSourceLocation(_node), nullOrCast<Expression>(member(_node, "value")), visibility(_node), _node["documentation"].isNull() ? nullptr : createDocumentation(member(_node, "documentation")), @@ -490,6 +503,7 @@ ASTPointer<ModifierDefinition> ASTJsonImporter::createModifierDefinition(Json::V return createASTNode<ModifierDefinition>( _node, memberAsASTString(_node, "name"), + createNameSourceLocation(_node), _node["documentation"].isNull() ? nullptr : createDocumentation(member(_node, "documentation")), createParameterList(member(_node, "parameters")), memberAsBool(_node, "virtual"), @@ -515,6 +529,7 @@ ASTPointer<EventDefinition> ASTJsonImporter::createEventDefinition(Json::Value c return createASTNode<EventDefinition>( _node, memberAsASTString(_node, "name"), + createNameSourceLocation(_node), _node["documentation"].isNull() ? nullptr : createDocumentation(member(_node, "documentation")), createParameterList(member(_node, "parameters")), memberAsBool(_node, "anonymous") diff --git a/libsolidity/ast/ASTJsonImporter.h b/libsolidity/ast/ASTJsonImporter.h index c64790d4d..c4f8c6cc9 100644 --- a/libsolidity/ast/ASTJsonImporter.h +++ b/libsolidity/ast/ASTJsonImporter.h @@ -67,6 +67,7 @@ private: template<class T> ASTPointer<T> convertJsonToASTNode(Json::Value const& _node); + langutil::SourceLocation createNameSourceLocation(Json::Value const& _node); /// \defgroup nodeCreators JSON to AST-Nodes ///@{ diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index bef212aa9..623060f0b 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -226,6 +226,7 @@ ASTPointer<ImportDirective> Parser::parseImportDirective() expectToken(Token::Import); ASTPointer<ASTString> path; ASTPointer<ASTString> unitAlias = make_shared<string>(); + SourceLocation unitAliasLocation{}; ImportDirective::SymbolAliasList symbolAliases; if (m_scanner->currentToken() == Token::StringLiteral) @@ -234,7 +235,7 @@ ASTPointer<ImportDirective> Parser::parseImportDirective() if (m_scanner->currentToken() == Token::As) { m_scanner->next(); - unitAlias = expectIdentifierToken(); + tie(unitAlias, unitAliasLocation) = expectIdentifierWithLocation(); } } else @@ -250,8 +251,7 @@ ASTPointer<ImportDirective> Parser::parseImportDirective() if (m_scanner->currentToken() == Token::As) { expectToken(Token::As); - aliasLocation = currentLocation(); - alias = expectIdentifierToken(); + tie(alias, aliasLocation) = expectIdentifierWithLocation(); } symbolAliases.emplace_back(ImportDirective::SymbolAlias{move(id), move(alias), aliasLocation}); if (m_scanner->currentToken() != Token::Comma) @@ -264,7 +264,7 @@ ASTPointer<ImportDirective> Parser::parseImportDirective() { m_scanner->next(); expectToken(Token::As); - unitAlias = expectIdentifierToken(); + tie(unitAlias, unitAliasLocation) = expectIdentifierWithLocation(); } else fatalParserError(9478_error, "Expected string literal (path), \"*\" or alias list."); @@ -281,7 +281,7 @@ ASTPointer<ImportDirective> Parser::parseImportDirective() fatalParserError(6326_error, "Import path cannot be empty."); nodeFactory.markEndPosition(); expectToken(Token::Semicolon); - return nodeFactory.createNode<ImportDirective>(path, unitAlias, move(symbolAliases)); + return nodeFactory.createNode<ImportDirective>(path, unitAlias, unitAliasLocation, move(symbolAliases)); } std::pair<ContractKind, bool> Parser::parseContractKind() @@ -317,6 +317,7 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition() RecursionGuard recursionGuard(*this); ASTNodeFactory nodeFactory(*this); ASTPointer<ASTString> name = nullptr; + SourceLocation nameLocation{}; ASTPointer<StructuredDocumentation> documentation; vector<ASTPointer<InheritanceSpecifier>> baseContracts; vector<ASTPointer<ASTNode>> subNodes; @@ -325,7 +326,7 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition() { documentation = parseStructuredDocumentation(); contractKind = parseContractKind(); - name = expectIdentifierToken(); + tie(name, nameLocation) = expectIdentifierWithLocation(); if (m_scanner->currentToken() == Token::Is) do { @@ -385,6 +386,7 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition() expectToken(Token::RBrace); return nodeFactory.createNode<ContractDefinition>( name, + nameLocation, documentation, baseContracts, subNodes, @@ -572,6 +574,7 @@ ASTPointer<ASTNode> Parser::parseFunctionDefinition(bool _freeFunction) Token kind = m_scanner->currentToken(); ASTPointer<ASTString> name; + SourceLocation nameLocation; if (kind == Token::Function) { m_scanner->next(); @@ -586,6 +589,7 @@ ASTPointer<ASTNode> Parser::parseFunctionDefinition(bool _freeFunction) {Token::Fallback, "fallback function"}, {Token::Receive, "receive function"}, }.at(m_scanner->currentToken()); + nameLocation = currentLocation(); name = make_shared<ASTString>(TokenTraits::toString(m_scanner->currentToken())); string message{ "This function is named \"" + *name + "\" but is not the " + expected + " of the contract. " @@ -599,7 +603,7 @@ ASTPointer<ASTNode> Parser::parseFunctionDefinition(bool _freeFunction) m_scanner->next(); } else - name = expectIdentifierToken(); + tie(name, nameLocation) = expectIdentifierWithLocation(); } else { @@ -621,6 +625,7 @@ ASTPointer<ASTNode> Parser::parseFunctionDefinition(bool _freeFunction) } return nodeFactory.createNode<FunctionDefinition>( name, + nameLocation, header.visibility, header.stateMutability, _freeFunction, @@ -640,7 +645,7 @@ ASTPointer<StructDefinition> Parser::parseStructDefinition() RecursionGuard recursionGuard(*this); ASTNodeFactory nodeFactory(*this); expectToken(Token::Struct); - ASTPointer<ASTString> name = expectIdentifierToken(); + auto [name, nameLocation] = expectIdentifierWithLocation(); vector<ASTPointer<VariableDeclaration>> members; expectToken(Token::LBrace); while (m_scanner->currentToken() != Token::RBrace) @@ -650,7 +655,7 @@ ASTPointer<StructDefinition> Parser::parseStructDefinition() } nodeFactory.markEndPosition(); expectToken(Token::RBrace); - return nodeFactory.createNode<StructDefinition>(name, members); + return nodeFactory.createNode<StructDefinition>(move(name), move(nameLocation), move(members)); } ASTPointer<EnumValue> Parser::parseEnumValue() @@ -666,7 +671,7 @@ ASTPointer<EnumDefinition> Parser::parseEnumDefinition() RecursionGuard recursionGuard(*this); ASTNodeFactory nodeFactory(*this); expectToken(Token::Enum); - ASTPointer<ASTString> name = expectIdentifierToken(); + auto [name, nameLocation] = expectIdentifierWithLocation(); vector<ASTPointer<EnumValue>> members; expectToken(Token::LBrace); @@ -684,7 +689,7 @@ ASTPointer<EnumDefinition> Parser::parseEnumDefinition() nodeFactory.markEndPosition(); expectToken(Token::RBrace); - return nodeFactory.createNode<EnumDefinition>(name, members); + return nodeFactory.createNode<EnumDefinition>(name, nameLocation, members); } ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration( @@ -717,6 +722,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration( Visibility visibility(Visibility::Default); VariableDeclaration::Location location = VariableDeclaration::Location::Unspecified; ASTPointer<ASTString> identifier; + SourceLocation nameLocation{}; while (true) { @@ -795,7 +801,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration( else { nodeFactory.markEndPosition(); - identifier = expectIdentifierToken(); + tie(identifier, nameLocation) = expectIdentifierWithLocation(); } ASTPointer<Expression> value; if (_options.allowInitialValue) @@ -810,6 +816,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration( return nodeFactory.createNode<VariableDeclaration>( type, identifier, + nameLocation, value, visibility, documentation, @@ -830,7 +837,7 @@ ASTPointer<ModifierDefinition> Parser::parseModifierDefinition() ASTPointer<StructuredDocumentation> documentation = parseStructuredDocumentation(); expectToken(Token::Modifier); - ASTPointer<ASTString> name(expectIdentifierToken()); + auto [name, nameLocation] = expectIdentifierWithLocation(); ASTPointer<ParameterList> parameters; if (m_scanner->currentToken() == Token::LParen) { @@ -875,7 +882,15 @@ ASTPointer<ModifierDefinition> Parser::parseModifierDefinition() else m_scanner->next(); // just consume the ';' - return nodeFactory.createNode<ModifierDefinition>(name, documentation, parameters, isVirtual, overrides, block); + return nodeFactory.createNode<ModifierDefinition>(name, nameLocation, documentation, parameters, isVirtual, overrides, block); +} + +pair<ASTPointer<ASTString>, SourceLocation> Parser::expectIdentifierWithLocation() +{ + SourceLocation nameLocation = currentLocation(); + ASTPointer<ASTString> name = expectIdentifierToken(); + + return {move(name), move(nameLocation)}; } ASTPointer<EventDefinition> Parser::parseEventDefinition() @@ -885,7 +900,7 @@ ASTPointer<EventDefinition> Parser::parseEventDefinition() ASTPointer<StructuredDocumentation> documentation = parseStructuredDocumentation(); expectToken(Token::Event); - ASTPointer<ASTString> name(expectIdentifierToken()); + auto [name, nameLocation] = expectIdentifierWithLocation(); VarDeclParserOptions options; options.allowIndexed = true; @@ -899,7 +914,7 @@ ASTPointer<EventDefinition> Parser::parseEventDefinition() } nodeFactory.markEndPosition(); expectToken(Token::Semicolon); - return nodeFactory.createNode<EventDefinition>(name, documentation, parameters, anonymous); + return nodeFactory.createNode<EventDefinition>(name, nameLocation, documentation, parameters, anonymous); } ASTPointer<UsingForDirective> Parser::parseUsingDirective() diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h index c5c85d76c..77152d38f 100644 --- a/libsolidity/parsing/Parser.h +++ b/libsolidity/parsing/Parser.h @@ -151,6 +151,7 @@ private: std::vector<ASTPointer<Expression>> parseFunctionCallListArguments(); std::pair<std::vector<ASTPointer<Expression>>, std::vector<ASTPointer<ASTString>>> parseFunctionCallArguments(); std::pair<std::vector<ASTPointer<Expression>>, std::vector<ASTPointer<ASTString>>> parseNamedArguments(); + std::pair<ASTPointer<ASTString>, langutil::SourceLocation> expectIdentifierWithLocation(); ///@} ///@{ diff --git a/libyul/AsmJsonConverter.cpp b/libyul/AsmJsonConverter.cpp index 019a5c4ce..aece124aa 100644 --- a/libyul/AsmJsonConverter.cpp +++ b/libyul/AsmJsonConverter.cpp @@ -187,7 +187,7 @@ Json::Value AsmJsonConverter::createAstNode(langutil::SourceLocation const& _loc int length = -1; if (_location.start >= 0 && _location.end >= 0) length = _location.end - _location.start; - ret["src"] = to_string(_location.start) + ":" + to_string(length) + ":" + m_sourceIndex; + ret["src"] = to_string(_location.start) + ":" + to_string(length) + ":" + (m_sourceIndex.has_value() ? to_string(m_sourceIndex.value()) : "-1"); return ret; } diff --git a/libyul/AsmJsonConverter.h b/libyul/AsmJsonConverter.h index fe0c4685c..6bb50002c 100644 --- a/libyul/AsmJsonConverter.h +++ b/libyul/AsmJsonConverter.h @@ -27,6 +27,7 @@ #include <liblangutil/SourceLocation.h> #include <json/json.h> #include <boost/variant.hpp> +#include <optional> #include <vector> namespace solidity::yul @@ -40,7 +41,7 @@ class AsmJsonConverter: public boost::static_visitor<Json::Value> public: /// Create a converter to JSON for any block of inline assembly /// @a _sourceIndex to be used to abbreviate source name in the source locations - explicit AsmJsonConverter(size_t _sourceIndex): m_sourceIndex(std::to_string(_sourceIndex)) {} + explicit AsmJsonConverter(std::optional<size_t> _sourceIndex): m_sourceIndex(_sourceIndex) {} Json::Value operator()(Block const& _node) const; Json::Value operator()(TypedName const& _node) const; @@ -65,7 +66,7 @@ private: template <class T> Json::Value vectorOfVariantsToJson(std::vector<T> const& vec) const; - std::string const m_sourceIndex; + std::optional<size_t> const m_sourceIndex; }; } diff --git a/test/cmdlineTests/recovery_ast_constructor/output b/test/cmdlineTests/recovery_ast_constructor/output index 5c11b5b99..1d94aee98 100644 --- a/test/cmdlineTests/recovery_ast_constructor/output +++ b/test/cmdlineTests/recovery_ast_constructor/output @@ -40,6 +40,7 @@ JSON AST (compact format): 18 ], "name": "Error1", + "nameLocation": "71:6:0", "nodeType": "ContractDefinition", "nodes": [ @@ -59,6 +60,7 @@ JSON AST (compact format): "kind": "constructor", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { @@ -120,6 +122,7 @@ JSON AST (compact format): "kind": "function", "modifiers": [], "name": "five", + "nameLocation": "407:4:0", "nodeType": "FunctionDefinition", "parameters": { @@ -139,6 +142,7 @@ JSON AST (compact format): "id": 12, "mutability": "mutable", "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 17, "src": "434:4:0", diff --git a/test/cmdlineTests/recovery_standard_json/output.json b/test/cmdlineTests/recovery_standard_json/output.json index 42926ae17..e84fc8c86 100644 --- a/test/cmdlineTests/recovery_standard_json/output.json +++ b/test/cmdlineTests/recovery_standard_json/output.json @@ -10,4 +10,4 @@ 2 | 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":[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","nameLocation":"68:7:0","nodeType":"ContractDefinition","nodes":[],"scope":4,"src":"59:35:0"}],"src":"36:84:0"},"id":0}}} diff --git a/test/cmdlineTests/standard_only_ast_requested/output.json b/test/cmdlineTests/standard_only_ast_requested/output.json index 16f8bfddb..f22de53d0 100644 --- a/test/cmdlineTests/standard_only_ast_requested/output.json +++ b/test/cmdlineTests/standard_only_ast_requested/output.json @@ -1 +1 @@ -{"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"C":[6]},"id":7,"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":6,"linearizedBaseContracts":[6],"name":"C","nodeType":"ContractDefinition","nodes":[{"body":{"id":4,"nodeType":"Block","src":"97:2:0","statements":[]},"functionSelector":"26121ff0","id":5,"implemented":true,"kind":"function","modifiers":[],"name":"f","nodeType":"FunctionDefinition","parameters":{"id":2,"nodeType":"ParameterList","parameters":[],"src":"82:2:0"},"returnParameters":{"id":3,"nodeType":"ParameterList","parameters":[],"src":"97:0:0"},"scope":6,"src":"72:27:0","stateMutability":"pure","virtual":false,"visibility":"public"}],"scope":7,"src":"59:42:0"}],"src":"36:65:0"},"id":0}}} +{"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"C":[6]},"id":7,"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":6,"linearizedBaseContracts":[6],"name":"C","nameLocation":"68:1:0","nodeType":"ContractDefinition","nodes":[{"body":{"id":4,"nodeType":"Block","src":"97:2:0","statements":[]},"functionSelector":"26121ff0","id":5,"implemented":true,"kind":"function","modifiers":[],"name":"f","nameLocation":"81:1:0","nodeType":"FunctionDefinition","parameters":{"id":2,"nodeType":"ParameterList","parameters":[],"src":"82:2:0"},"returnParameters":{"id":3,"nodeType":"ParameterList","parameters":[],"src":"97:0:0"},"scope":6,"src":"72:27:0","stateMutability":"pure","virtual":false,"visibility":"public"}],"scope":7,"src":"59:42:0"}],"src":"36:65:0"},"id":0}}} diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp index 95288d85c..be711467e 100644 --- a/test/libsolidity/SolidityTypes.cpp +++ b/test/libsolidity/SolidityTypes.cpp @@ -179,15 +179,15 @@ BOOST_AUTO_TEST_CASE(type_identifiers) TypePointer multiArray = TypeProvider::array(DataLocation::Storage, stringArray); BOOST_CHECK_EQUAL(multiArray->identifier(), "t_array$_t_array$_t_string_storage_$20_storage_$dyn_storage_ptr"); - ContractDefinition c(++id, SourceLocation{}, make_shared<string>("MyContract$"), {}, {}, {}, ContractKind::Contract); + ContractDefinition c(++id, SourceLocation{}, make_shared<string>("MyContract$"), SourceLocation{}, {}, {}, {}, ContractKind::Contract); BOOST_CHECK_EQUAL(c.type()->identifier(), "t_type$_t_contract$_MyContract$$$_$2_$"); BOOST_CHECK_EQUAL(ContractType(c, true).identifier(), "t_super$_MyContract$$$_$2"); - StructDefinition s(++id, {}, make_shared<string>("Struct"), {}); + StructDefinition s(++id, {}, make_shared<string>("Struct"), {}, {}); s.annotation().recursive = false; BOOST_CHECK_EQUAL(s.type()->identifier(), "t_type$_t_struct$_Struct_$3_storage_ptr_$"); - EnumDefinition e(++id, {}, make_shared<string>("Enum"), {}); + EnumDefinition e(++id, {}, make_shared<string>("Enum"), {}, {}); BOOST_CHECK_EQUAL(e.type()->identifier(), "t_type$_t_enum$_Enum_$4_$"); TupleType t({e.type(), s.type(), stringArray, nullptr}); @@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(type_identifiers) // TypeType is tested with contract auto emptyParams = make_shared<ParameterList>(++id, SourceLocation(), std::vector<ASTPointer<VariableDeclaration>>()); - ModifierDefinition mod(++id, SourceLocation{}, make_shared<string>("modif"), {}, emptyParams, {}, {}, {}); + ModifierDefinition mod(++id, SourceLocation{}, make_shared<string>("modif"), SourceLocation{}, {}, emptyParams, {}, {}, {}); BOOST_CHECK_EQUAL(ModifierType(mod).identifier(), "t_modifier$__$"); SourceUnit su(++id, {}, {}, {}); From 70aa111dbf4288992b5c8854b621e07e0e7e27d8 Mon Sep 17 00:00:00 2001 From: chriseth <chris@ethereum.org> Date: Wed, 10 Feb 2021 18:40:05 +0100 Subject: [PATCH 2/2] Update AST Json expectations. --- .../ast_json_import_wrong_evmVersion/input.sol | 2 ++ test/libsolidity/ASTJSON/abstract_contract.json | 2 ++ test/libsolidity/ASTJSON/abstract_contract_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/address_payable.json | 7 +++++++ test/libsolidity/ASTJSON/address_payable_parseOnly.json | 7 +++++++ test/libsolidity/ASTJSON/array_type_name.json | 2 ++ test/libsolidity/ASTJSON/array_type_name_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/assembly/call.json | 2 ++ test/libsolidity/ASTJSON/assembly/call_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/assembly/empty_block.json | 2 ++ .../ASTJSON/assembly/empty_block_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/assembly/function.json | 2 ++ test/libsolidity/ASTJSON/assembly/function_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/assembly/leave.json | 2 ++ test/libsolidity/ASTJSON/assembly/leave_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/assembly/loop.json | 2 ++ test/libsolidity/ASTJSON/assembly/loop_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/assembly/nested_functions.json | 3 +++ .../ASTJSON/assembly/nested_functions_parseOnly.json | 3 +++ test/libsolidity/ASTJSON/assembly/slot_offset.json | 5 +++++ .../ASTJSON/assembly/slot_offset_parseOnly.json | 5 +++++ test/libsolidity/ASTJSON/assembly/stringlit.json | 2 ++ .../libsolidity/ASTJSON/assembly/stringlit_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/assembly/switch.json | 2 ++ test/libsolidity/ASTJSON/assembly/switch_default.json | 2 ++ .../ASTJSON/assembly/switch_default_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/assembly/switch_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/assembly/var_access.json | 3 +++ .../ASTJSON/assembly/var_access_parseOnly.json | 3 +++ test/libsolidity/ASTJSON/constructor.json | 2 ++ test/libsolidity/ASTJSON/constructor_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/contract_dep_order.json | 5 +++++ .../libsolidity/ASTJSON/contract_dep_order_parseOnly.json | 5 +++++ test/libsolidity/ASTJSON/documentation.json | 7 +++++++ test/libsolidity/ASTJSON/documentation_on_statements.json | 5 +++++ .../ASTJSON/documentation_on_statements_parseOnly.json | 5 +++++ test/libsolidity/ASTJSON/documentation_parseOnly.json | 7 +++++++ test/libsolidity/ASTJSON/documentation_triple.json | 5 +++++ .../ASTJSON/documentation_triple_parseOnly.json | 5 +++++ test/libsolidity/ASTJSON/enum_value.json | 4 ++++ test/libsolidity/ASTJSON/enum_value_parseOnly.json | 4 ++++ test/libsolidity/ASTJSON/event_definition.json | 2 ++ test/libsolidity/ASTJSON/event_definition_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/fallback.json | 2 ++ test/libsolidity/ASTJSON/fallback_and_reveice_ether.json | 3 +++ .../ASTJSON/fallback_and_reveice_ether_parseOnly.json | 3 +++ test/libsolidity/ASTJSON/fallback_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/fallback_payable.json | 2 ++ test/libsolidity/ASTJSON/fallback_payable_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/function_type.json | 6 ++++++ test/libsolidity/ASTJSON/function_type_parseOnly.json | 6 ++++++ test/libsolidity/ASTJSON/global_enum.json | 2 ++ test/libsolidity/ASTJSON/global_enum_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/global_struct.json | 2 ++ test/libsolidity/ASTJSON/global_struct_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/inheritance_specifier.json | 2 ++ .../ASTJSON/inheritance_specifier_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/license.json | 1 + test/libsolidity/ASTJSON/license_parseOnly.json | 1 + .../ASTJSON/long_type_name_binary_operation.json | 3 +++ .../long_type_name_binary_operation_parseOnly.json | 3 +++ test/libsolidity/ASTJSON/long_type_name_identifier.json | 4 ++++ .../ASTJSON/long_type_name_identifier_parseOnly.json | 4 ++++ test/libsolidity/ASTJSON/mappings.json | 8 ++++++++ test/libsolidity/ASTJSON/mappings_parseOnly.json | 8 ++++++++ test/libsolidity/ASTJSON/modifier_definition.json | 4 ++++ .../ASTJSON/modifier_definition_parseOnly.json | 4 ++++ test/libsolidity/ASTJSON/modifier_invocation.json | 4 ++++ .../ASTJSON/modifier_invocation_parseOnly.json | 4 ++++ test/libsolidity/ASTJSON/mutability.json | 4 ++++ test/libsolidity/ASTJSON/mutability_parseOnly.json | 4 ++++ test/libsolidity/ASTJSON/non_utf8.json | 3 +++ test/libsolidity/ASTJSON/non_utf8_parseOnly.json | 3 +++ .../ASTJSON/not_existing_import_parseOnly.json | 4 ++++ test/libsolidity/ASTJSON/override.json | 8 ++++++++ test/libsolidity/ASTJSON/override_parseOnly.json | 8 ++++++++ test/libsolidity/ASTJSON/placeholder_statement.json | 2 ++ .../ASTJSON/placeholder_statement_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/receive_ether.json | 2 ++ test/libsolidity/ASTJSON/receive_ether_parseOnly.json | 2 ++ test/libsolidity/ASTJSON/short_type_name.json | 3 +++ test/libsolidity/ASTJSON/short_type_name_parseOnly.json | 3 +++ test/libsolidity/ASTJSON/short_type_name_ref.json | 3 +++ .../ASTJSON/short_type_name_ref_parseOnly.json | 3 +++ test/libsolidity/ASTJSON/smoke.json | 1 + test/libsolidity/ASTJSON/smoke_parseOnly.json | 1 + test/libsolidity/ASTJSON/source_location.json | 3 +++ test/libsolidity/ASTJSON/source_location_parseOnly.json | 3 +++ test/libsolidity/ASTJSON/string.json | 3 +++ test/libsolidity/ASTJSON/string_parseOnly.json | 3 +++ test/libsolidity/ASTJSON/two_base_functions.json | 6 ++++++ .../libsolidity/ASTJSON/two_base_functions_parseOnly.json | 6 ++++++ test/libsolidity/ASTJSON/unicode.json | 3 +++ test/libsolidity/ASTJSON/unicode_parseOnly.json | 3 +++ test/libsolidity/ASTJSON/using_for_directive.json | 2 ++ .../ASTJSON/using_for_directive_parseOnly.json | 2 ++ test/libsolidity/StandardCompiler.cpp | 2 +- 97 files changed, 315 insertions(+), 1 deletion(-) diff --git a/test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol b/test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol index a8e59cfa4..4f8eb2c79 100644 --- a/test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol +++ b/test/cmdlineTests/ast_json_import_wrong_evmVersion/input.sol @@ -49,6 +49,7 @@ 7 ], "name": "C", + "nameLocation": "27:1:0", "nodeType": "ContractDefinition", "nodes": [ @@ -82,6 +83,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "45:4:0", "nodeType": "FunctionDefinition", "overrides": null, "parameters": diff --git a/test/libsolidity/ASTJSON/abstract_contract.json b/test/libsolidity/ASTJSON/abstract_contract.json index 08b1e6d95..cf954cc30 100644 --- a/test/libsolidity/ASTJSON/abstract_contract.json +++ b/test/libsolidity/ASTJSON/abstract_contract.json @@ -23,6 +23,7 @@ 5 ], "name": "C", + "nameLocation": "18:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -39,6 +40,7 @@ "kind": "constructor", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/abstract_contract_parseOnly.json b/test/libsolidity/ASTJSON/abstract_contract_parseOnly.json index 1ab66ec27..baf73de4d 100644 --- a/test/libsolidity/ASTJSON/abstract_contract_parseOnly.json +++ b/test/libsolidity/ASTJSON/abstract_contract_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 5, "name": "C", + "nameLocation": "18:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -27,6 +28,7 @@ "kind": "constructor", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/address_payable.json b/test/libsolidity/ASTJSON/address_payable.json index 8d8e1f255..a31b2b7de 100644 --- a/test/libsolidity/ASTJSON/address_payable.json +++ b/test/libsolidity/ASTJSON/address_payable.json @@ -23,6 +23,7 @@ 39 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -32,6 +33,7 @@ "id": 4, "mutability": "mutable", "name": "m", + "nameLocation": "60:1:1", "nodeType": "VariableDeclaration", "scope": 39, "src": "17:44:1", @@ -100,6 +102,7 @@ "id": 12, "mutability": "mutable", "name": "a", + "nameLocation": "160:1:1", "nodeType": "VariableDeclaration", "scope": 37, "src": "144:17:1", @@ -234,6 +237,7 @@ "id": 22, "mutability": "mutable", "name": "c", + "nameLocation": "205:1:1", "nodeType": "VariableDeclaration", "scope": 37, "src": "197:9:1", @@ -468,6 +472,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "76:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -480,6 +485,7 @@ "id": 6, "mutability": "mutable", "name": "arg", + "nameLocation": "94:3:1", "nodeType": "VariableDeclaration", "scope": 38, "src": "78:19:1", @@ -519,6 +525,7 @@ "id": 9, "mutability": "mutable", "name": "r", + "nameLocation": "131:1:1", "nodeType": "VariableDeclaration", "scope": 38, "src": "115:17:1", diff --git a/test/libsolidity/ASTJSON/address_payable_parseOnly.json b/test/libsolidity/ASTJSON/address_payable_parseOnly.json index 4b769e307..92f4d6949 100644 --- a/test/libsolidity/ASTJSON/address_payable_parseOnly.json +++ b/test/libsolidity/ASTJSON/address_payable_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 39, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -19,6 +20,7 @@ "id": 4, "mutability": "mutable", "name": "m", + "nameLocation": "60:1:1", "nodeType": "VariableDeclaration", "src": "17:44:1", "stateVariable": false, @@ -70,6 +72,7 @@ "id": 12, "mutability": "mutable", "name": "a", + "nameLocation": "160:1:1", "nodeType": "VariableDeclaration", "src": "144:17:1", "stateVariable": false, @@ -159,6 +162,7 @@ "id": 22, "mutability": "mutable", "name": "c", + "nameLocation": "205:1:1", "nodeType": "VariableDeclaration", "src": "197:9:1", "stateVariable": false, @@ -296,6 +300,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "76:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -308,6 +313,7 @@ "id": 6, "mutability": "mutable", "name": "arg", + "nameLocation": "94:3:1", "nodeType": "VariableDeclaration", "src": "78:19:1", "stateVariable": false, @@ -338,6 +344,7 @@ "id": 9, "mutability": "mutable", "name": "r", + "nameLocation": "131:1:1", "nodeType": "VariableDeclaration", "src": "115:17:1", "stateVariable": false, diff --git a/test/libsolidity/ASTJSON/array_type_name.json b/test/libsolidity/ASTJSON/array_type_name.json index 90649b501..8829b894c 100644 --- a/test/libsolidity/ASTJSON/array_type_name.json +++ b/test/libsolidity/ASTJSON/array_type_name.json @@ -23,6 +23,7 @@ 4 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -31,6 +32,7 @@ "id": 3, "mutability": "mutable", "name": "i", + "nameLocation": "20:1:1", "nodeType": "VariableDeclaration", "scope": 4, "src": "13:8:1", diff --git a/test/libsolidity/ASTJSON/array_type_name_parseOnly.json b/test/libsolidity/ASTJSON/array_type_name_parseOnly.json index 18260b99e..6b0ac2afb 100644 --- a/test/libsolidity/ASTJSON/array_type_name_parseOnly.json +++ b/test/libsolidity/ASTJSON/array_type_name_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 4, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -19,6 +20,7 @@ "id": 3, "mutability": "mutable", "name": "i", + "nameLocation": "20:1:1", "nodeType": "VariableDeclaration", "src": "13:8:1", "stateVariable": false, diff --git a/test/libsolidity/ASTJSON/assembly/call.json b/test/libsolidity/ASTJSON/assembly/call.json index 9538fe5cc..a15ced6cc 100644 --- a/test/libsolidity/ASTJSON/assembly/call.json +++ b/test/libsolidity/ASTJSON/assembly/call.json @@ -23,6 +23,7 @@ 6 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -137,6 +138,7 @@ "kind": "function", "modifiers": [], "name": "j", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/call_parseOnly.json b/test/libsolidity/ASTJSON/assembly/call_parseOnly.json index ed8c40197..d7b9f4be8 100644 --- a/test/libsolidity/ASTJSON/assembly/call_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/call_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 6, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -124,6 +125,7 @@ "kind": "function", "modifiers": [], "name": "j", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/empty_block.json b/test/libsolidity/ASTJSON/assembly/empty_block.json index 2d22cc035..cf85557e5 100644 --- a/test/libsolidity/ASTJSON/assembly/empty_block.json +++ b/test/libsolidity/ASTJSON/assembly/empty_block.json @@ -23,6 +23,7 @@ 6 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -62,6 +63,7 @@ "kind": "function", "modifiers": [], "name": "g", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/empty_block_parseOnly.json b/test/libsolidity/ASTJSON/assembly/empty_block_parseOnly.json index a11bb9893..9ee4a257e 100644 --- a/test/libsolidity/ASTJSON/assembly/empty_block_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/empty_block_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 6, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -49,6 +50,7 @@ "kind": "function", "modifiers": [], "name": "g", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/function.json b/test/libsolidity/ASTJSON/assembly/function.json index ccbf3d853..df07a26e1 100644 --- a/test/libsolidity/ASTJSON/assembly/function.json +++ b/test/libsolidity/ASTJSON/assembly/function.json @@ -23,6 +23,7 @@ 6 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -124,6 +125,7 @@ "kind": "function", "modifiers": [], "name": "h", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/function_parseOnly.json b/test/libsolidity/ASTJSON/assembly/function_parseOnly.json index b7e196588..971a5c267 100644 --- a/test/libsolidity/ASTJSON/assembly/function_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/function_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 6, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -111,6 +112,7 @@ "kind": "function", "modifiers": [], "name": "h", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/leave.json b/test/libsolidity/ASTJSON/assembly/leave.json index ba765146f..1a928972f 100644 --- a/test/libsolidity/ASTJSON/assembly/leave.json +++ b/test/libsolidity/ASTJSON/assembly/leave.json @@ -23,6 +23,7 @@ 6 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -74,6 +75,7 @@ "kind": "function", "modifiers": [], "name": "l", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/leave_parseOnly.json b/test/libsolidity/ASTJSON/assembly/leave_parseOnly.json index 650181898..4a1b2196d 100644 --- a/test/libsolidity/ASTJSON/assembly/leave_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/leave_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 6, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -61,6 +62,7 @@ "kind": "function", "modifiers": [], "name": "l", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/loop.json b/test/libsolidity/ASTJSON/assembly/loop.json index 9c99cf491..2918c6b35 100644 --- a/test/libsolidity/ASTJSON/assembly/loop.json +++ b/test/libsolidity/ASTJSON/assembly/loop.json @@ -23,6 +23,7 @@ 6 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -137,6 +138,7 @@ "kind": "function", "modifiers": [], "name": "g", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/loop_parseOnly.json b/test/libsolidity/ASTJSON/assembly/loop_parseOnly.json index ea9544f6a..38196816d 100644 --- a/test/libsolidity/ASTJSON/assembly/loop_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/loop_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 6, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -124,6 +125,7 @@ "kind": "function", "modifiers": [], "name": "g", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/nested_functions.json b/test/libsolidity/ASTJSON/assembly/nested_functions.json index 687304c40..f5c5d7b6a 100644 --- a/test/libsolidity/ASTJSON/assembly/nested_functions.json +++ b/test/libsolidity/ASTJSON/assembly/nested_functions.json @@ -22,6 +22,7 @@ 8 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -99,6 +100,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "24:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -118,6 +120,7 @@ "id": 3, "mutability": "mutable", "name": "x", + "nameLocation": "54:1:1", "nodeType": "VariableDeclaration", "scope": 7, "src": "49:6:1", diff --git a/test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json b/test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json index 3ce638979..449d678ae 100644 --- a/test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 8, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -88,6 +89,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "24:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -107,6 +109,7 @@ "id": 3, "mutability": "mutable", "name": "x", + "nameLocation": "54:1:1", "nodeType": "VariableDeclaration", "src": "49:6:1", "stateVariable": false, diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset.json b/test/libsolidity/ASTJSON/assembly/slot_offset.json index b8be3afe2..fe43f1cfa 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset.json @@ -23,6 +23,7 @@ 12 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -36,6 +37,7 @@ "id": 2, "mutability": "mutable", "name": "x", + "nameLocation": "33:1:1", "nodeType": "VariableDeclaration", "scope": 3, "src": "28:6:1", @@ -62,6 +64,7 @@ } ], "name": "S", + "nameLocation": "24:1:1", "nodeType": "StructDefinition", "scope": 12, "src": "17:20:1", @@ -72,6 +75,7 @@ "id": 6, "mutability": "mutable", "name": "s", + "nameLocation": "44:1:1", "nodeType": "VariableDeclaration", "scope": 12, "src": "42:3:1", @@ -211,6 +215,7 @@ "kind": "function", "modifiers": [], "name": "e", + "nameLocation": "60:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset_parseOnly.json b/test/libsolidity/ASTJSON/assembly/slot_offset_parseOnly.json index 3829ea62a..c49f1857c 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 12, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -23,6 +24,7 @@ "id": 2, "mutability": "mutable", "name": "x", + "nameLocation": "33:1:1", "nodeType": "VariableDeclaration", "src": "28:6:1", "stateVariable": false, @@ -40,6 +42,7 @@ } ], "name": "S", + "nameLocation": "24:1:1", "nodeType": "StructDefinition", "src": "17:20:1", "visibility": "public" @@ -49,6 +52,7 @@ "id": 6, "mutability": "mutable", "name": "s", + "nameLocation": "44:1:1", "nodeType": "VariableDeclaration", "src": "42:3:1", "stateVariable": false, @@ -158,6 +162,7 @@ "kind": "function", "modifiers": [], "name": "e", + "nameLocation": "60:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/stringlit.json b/test/libsolidity/ASTJSON/assembly/stringlit.json index 08e0ea4f6..68c915301 100644 --- a/test/libsolidity/ASTJSON/assembly/stringlit.json +++ b/test/libsolidity/ASTJSON/assembly/stringlit.json @@ -23,6 +23,7 @@ 6 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -78,6 +79,7 @@ "kind": "function", "modifiers": [], "name": "m", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/stringlit_parseOnly.json b/test/libsolidity/ASTJSON/assembly/stringlit_parseOnly.json index de4762668..4dd401962 100644 --- a/test/libsolidity/ASTJSON/assembly/stringlit_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/stringlit_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 6, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -65,6 +66,7 @@ "kind": "function", "modifiers": [], "name": "m", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/switch.json b/test/libsolidity/ASTJSON/assembly/switch.json index bc82ad6a2..60a3dd800 100644 --- a/test/libsolidity/ASTJSON/assembly/switch.json +++ b/test/libsolidity/ASTJSON/assembly/switch.json @@ -22,6 +22,7 @@ 6 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -184,6 +185,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/switch_default.json b/test/libsolidity/ASTJSON/assembly/switch_default.json index 4226a8ea3..034e8a366 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default.json +++ b/test/libsolidity/ASTJSON/assembly/switch_default.json @@ -23,6 +23,7 @@ 6 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -101,6 +102,7 @@ "kind": "function", "modifiers": [], "name": "g", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/switch_default_parseOnly.json b/test/libsolidity/ASTJSON/assembly/switch_default_parseOnly.json index a515a3384..a68b2db92 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/switch_default_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 6, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -88,6 +89,7 @@ "kind": "function", "modifiers": [], "name": "g", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/switch_parseOnly.json b/test/libsolidity/ASTJSON/assembly/switch_parseOnly.json index 2f09261b1..898cd7a52 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/switch_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 6, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -157,6 +158,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/var_access.json b/test/libsolidity/ASTJSON/assembly/var_access.json index f10c45cc4..a81fef96c 100644 --- a/test/libsolidity/ASTJSON/assembly/var_access.json +++ b/test/libsolidity/ASTJSON/assembly/var_access.json @@ -23,6 +23,7 @@ 9 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -46,6 +47,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "57:1:1", "nodeType": "VariableDeclaration", "scope": 7, "src": "52:6:1", @@ -127,6 +129,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/assembly/var_access_parseOnly.json b/test/libsolidity/ASTJSON/assembly/var_access_parseOnly.json index 99119f4dc..e8651532a 100644 --- a/test/libsolidity/ASTJSON/assembly/var_access_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/var_access_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 9, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,6 +35,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "57:1:1", "nodeType": "VariableDeclaration", "src": "52:6:1", "stateVariable": false, @@ -96,6 +98,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/constructor.json b/test/libsolidity/ASTJSON/constructor.json index 31747901e..5fc4978d6 100644 --- a/test/libsolidity/ASTJSON/constructor.json +++ b/test/libsolidity/ASTJSON/constructor.json @@ -23,6 +23,7 @@ 5 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -39,6 +40,7 @@ "kind": "constructor", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/constructor_parseOnly.json b/test/libsolidity/ASTJSON/constructor_parseOnly.json index 275f538ae..fc54bd53f 100644 --- a/test/libsolidity/ASTJSON/constructor_parseOnly.json +++ b/test/libsolidity/ASTJSON/constructor_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 5, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -27,6 +28,7 @@ "kind": "constructor", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/contract_dep_order.json b/test/libsolidity/ASTJSON/contract_dep_order.json index 0d41123cd..ed96f2f7c 100644 --- a/test/libsolidity/ASTJSON/contract_dep_order.json +++ b/test/libsolidity/ASTJSON/contract_dep_order.json @@ -39,6 +39,7 @@ 1 ], "name": "A", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 14, @@ -75,6 +76,7 @@ 1 ], "name": "B", + "nameLocation": "24:1:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 14, @@ -113,6 +115,7 @@ 1 ], "name": "C", + "nameLocation": "44:1:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 14, @@ -153,6 +156,7 @@ 1 ], "name": "D", + "nameLocation": "64:1:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 14, @@ -195,6 +199,7 @@ 1 ], "name": "E", + "nameLocation": "84:1:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 14, diff --git a/test/libsolidity/ASTJSON/contract_dep_order_parseOnly.json b/test/libsolidity/ASTJSON/contract_dep_order_parseOnly.json index 1ee7586b0..bb42b5b62 100644 --- a/test/libsolidity/ASTJSON/contract_dep_order_parseOnly.json +++ b/test/libsolidity/ASTJSON/contract_dep_order_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 1, "name": "A", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [], "src": "0:14:1" @@ -36,6 +37,7 @@ "contractKind": "contract", "id": 4, "name": "B", + "nameLocation": "24:1:1", "nodeType": "ContractDefinition", "nodes": [], "src": "15:19:1" @@ -61,6 +63,7 @@ "contractKind": "contract", "id": 7, "name": "C", + "nameLocation": "44:1:1", "nodeType": "ContractDefinition", "nodes": [], "src": "35:19:1" @@ -86,6 +89,7 @@ "contractKind": "contract", "id": 10, "name": "D", + "nameLocation": "64:1:1", "nodeType": "ContractDefinition", "nodes": [], "src": "55:19:1" @@ -111,6 +115,7 @@ "contractKind": "contract", "id": 13, "name": "E", + "nameLocation": "84:1:1", "nodeType": "ContractDefinition", "nodes": [], "src": "75:19:1" diff --git a/test/libsolidity/ASTJSON/documentation.json b/test/libsolidity/ASTJSON/documentation.json index f0beba98f..c65a424ec 100644 --- a/test/libsolidity/ASTJSON/documentation.json +++ b/test/libsolidity/ASTJSON/documentation.json @@ -31,6 +31,7 @@ 2 ], "name": "C", + "nameLocation": "37:1:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 3, @@ -71,6 +72,7 @@ 5 ], "name": "C", + "nameLocation": "71:1:2", "nodeType": "ContractDefinition", "nodes": [], "scope": 6, @@ -104,6 +106,7 @@ 23 ], "name": "C", + "nameLocation": "9:1:3", "nodeType": "ContractDefinition", "nodes": [ @@ -120,6 +123,7 @@ "id": 9, "mutability": "mutable", "name": "state", + "nameLocation": "60:5:3", "nodeType": "VariableDeclaration", "scope": 23, "src": "48:17:3", @@ -155,6 +159,7 @@ }, "id": 12, "name": "Evt", + "nameLocation": "102:3:3", "nodeType": "EventDefinition", "parameters": { @@ -189,6 +194,7 @@ }, "id": 17, "name": "mod", + "nameLocation": "147:3:3", "nodeType": "ModifierDefinition", "parameters": { @@ -222,6 +228,7 @@ "kind": "function", "modifiers": [], "name": "fn", + "nameLocation": "197:2:3", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/documentation_on_statements.json b/test/libsolidity/ASTJSON/documentation_on_statements.json index 53544cdac..1be145af7 100644 --- a/test/libsolidity/ASTJSON/documentation_on_statements.json +++ b/test/libsolidity/ASTJSON/documentation_on_statements.json @@ -23,6 +23,7 @@ 27 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -31,6 +32,7 @@ "id": 2, "mutability": "mutable", "name": "a", + "nameLocation": "50:1:1", "nodeType": "VariableDeclaration", "scope": 27, "src": "45:6:1", @@ -193,6 +195,7 @@ "id": 8, "mutability": "mutable", "name": "i", + "nameLocation": "136:1:1", "nodeType": "VariableDeclaration", "scope": 22, "src": "131:6:1", @@ -308,6 +311,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "66:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -327,6 +331,7 @@ "id": 5, "mutability": "mutable", "name": "x", + "nameLocation": "96:1:1", "nodeType": "VariableDeclaration", "scope": 26, "src": "91:6:1", diff --git a/test/libsolidity/ASTJSON/documentation_on_statements_parseOnly.json b/test/libsolidity/ASTJSON/documentation_on_statements_parseOnly.json index 99784a300..27ae70cd7 100644 --- a/test/libsolidity/ASTJSON/documentation_on_statements_parseOnly.json +++ b/test/libsolidity/ASTJSON/documentation_on_statements_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 27, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -19,6 +20,7 @@ "id": 2, "mutability": "mutable", "name": "a", + "nameLocation": "50:1:1", "nodeType": "VariableDeclaration", "src": "45:6:1", "stateVariable": false, @@ -126,6 +128,7 @@ "id": 8, "mutability": "mutable", "name": "i", + "nameLocation": "136:1:1", "nodeType": "VariableDeclaration", "src": "131:6:1", "stateVariable": false, @@ -204,6 +207,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "66:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -223,6 +227,7 @@ "id": 5, "mutability": "mutable", "name": "x", + "nameLocation": "96:1:1", "nodeType": "VariableDeclaration", "src": "91:6:1", "stateVariable": false, diff --git a/test/libsolidity/ASTJSON/documentation_parseOnly.json b/test/libsolidity/ASTJSON/documentation_parseOnly.json index aaf7c160f..385af2818 100644 --- a/test/libsolidity/ASTJSON/documentation_parseOnly.json +++ b/test/libsolidity/ASTJSON/documentation_parseOnly.json @@ -19,6 +19,7 @@ }, "id": 2, "name": "C", + "nameLocation": "37:1:1", "nodeType": "ContractDefinition", "nodes": [], "src": "28:13:1" @@ -46,6 +47,7 @@ }, "id": 5, "name": "C", + "nameLocation": "71:1:2", "nodeType": "ContractDefinition", "nodes": [], "src": "62:13:2" @@ -66,6 +68,7 @@ "contractKind": "contract", "id": 23, "name": "C", + "nameLocation": "9:1:3", "nodeType": "ContractDefinition", "nodes": [ @@ -74,6 +77,7 @@ "id": 9, "mutability": "mutable", "name": "state", + "nameLocation": "60:5:3", "nodeType": "VariableDeclaration", "src": "48:17:3", "stateVariable": false, @@ -100,6 +104,7 @@ }, "id": 12, "name": "Evt", + "nameLocation": "102:3:3", "nodeType": "EventDefinition", "parameters": { @@ -134,6 +139,7 @@ }, "id": 17, "name": "mod", + "nameLocation": "147:3:3", "nodeType": "ModifierDefinition", "parameters": { @@ -166,6 +172,7 @@ "kind": "function", "modifiers": [], "name": "fn", + "nameLocation": "197:2:3", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/documentation_triple.json b/test/libsolidity/ASTJSON/documentation_triple.json index 8ca92b0b6..e8de09a3b 100644 --- a/test/libsolidity/ASTJSON/documentation_triple.json +++ b/test/libsolidity/ASTJSON/documentation_triple.json @@ -23,6 +23,7 @@ 28 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -38,6 +39,7 @@ "id": 3, "mutability": "mutable", "name": "a", + "nameLocation": "35:1:1", "nodeType": "VariableDeclaration", "scope": 28, "src": "30:6:1", @@ -202,6 +204,7 @@ "id": 9, "mutability": "mutable", "name": "i", + "nameLocation": "122:1:1", "nodeType": "VariableDeclaration", "scope": 23, "src": "117:6:1", @@ -318,6 +321,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "51:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -337,6 +341,7 @@ "id": 6, "mutability": "mutable", "name": "x", + "nameLocation": "81:1:1", "nodeType": "VariableDeclaration", "scope": 27, "src": "76:6:1", diff --git a/test/libsolidity/ASTJSON/documentation_triple_parseOnly.json b/test/libsolidity/ASTJSON/documentation_triple_parseOnly.json index ff7b998e7..66590281a 100644 --- a/test/libsolidity/ASTJSON/documentation_triple_parseOnly.json +++ b/test/libsolidity/ASTJSON/documentation_triple_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 28, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -19,6 +20,7 @@ "id": 3, "mutability": "mutable", "name": "a", + "nameLocation": "35:1:1", "nodeType": "VariableDeclaration", "src": "30:6:1", "stateVariable": false, @@ -128,6 +130,7 @@ "id": 9, "mutability": "mutable", "name": "i", + "nameLocation": "122:1:1", "nodeType": "VariableDeclaration", "src": "117:6:1", "stateVariable": false, @@ -207,6 +210,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "51:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -226,6 +230,7 @@ "id": 6, "mutability": "mutable", "name": "x", + "nameLocation": "81:1:1", "nodeType": "VariableDeclaration", "src": "76:6:1", "stateVariable": false, diff --git a/test/libsolidity/ASTJSON/enum_value.json b/test/libsolidity/ASTJSON/enum_value.json index 533e7b9e6..9baf45e36 100644 --- a/test/libsolidity/ASTJSON/enum_value.json +++ b/test/libsolidity/ASTJSON/enum_value.json @@ -23,6 +23,7 @@ 4 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,17 +35,20 @@ { "id": 1, "name": "A", + "nameLocation": "22:1:1", "nodeType": "EnumValue", "src": "22:1:1" }, { "id": 2, "name": "B", + "nameLocation": "25:1:1", "nodeType": "EnumValue", "src": "25:1:1" } ], "name": "E", + "nameLocation": "18:1:1", "nodeType": "EnumDefinition", "src": "13:15:1" } diff --git a/test/libsolidity/ASTJSON/enum_value_parseOnly.json b/test/libsolidity/ASTJSON/enum_value_parseOnly.json index 261e06e99..58f2f5d35 100644 --- a/test/libsolidity/ASTJSON/enum_value_parseOnly.json +++ b/test/libsolidity/ASTJSON/enum_value_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 4, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -21,17 +22,20 @@ { "id": 1, "name": "A", + "nameLocation": "22:1:1", "nodeType": "EnumValue", "src": "22:1:1" }, { "id": 2, "name": "B", + "nameLocation": "25:1:1", "nodeType": "EnumValue", "src": "25:1:1" } ], "name": "E", + "nameLocation": "18:1:1", "nodeType": "EnumDefinition", "src": "13:15:1" } diff --git a/test/libsolidity/ASTJSON/event_definition.json b/test/libsolidity/ASTJSON/event_definition.json index 61a1f46d4..619cd35d0 100644 --- a/test/libsolidity/ASTJSON/event_definition.json +++ b/test/libsolidity/ASTJSON/event_definition.json @@ -23,6 +23,7 @@ 3 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -30,6 +31,7 @@ "anonymous": false, "id": 2, "name": "E", + "nameLocation": "19:1:1", "nodeType": "EventDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/event_definition_parseOnly.json b/test/libsolidity/ASTJSON/event_definition_parseOnly.json index 02099388b..b1d9b927a 100644 --- a/test/libsolidity/ASTJSON/event_definition_parseOnly.json +++ b/test/libsolidity/ASTJSON/event_definition_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 3, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -18,6 +19,7 @@ "anonymous": false, "id": 2, "name": "E", + "nameLocation": "19:1:1", "nodeType": "EventDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/fallback.json b/test/libsolidity/ASTJSON/fallback.json index 7037b960a..758876c51 100644 --- a/test/libsolidity/ASTJSON/fallback.json +++ b/test/libsolidity/ASTJSON/fallback.json @@ -23,6 +23,7 @@ 5 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -39,6 +40,7 @@ "kind": "fallback", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/fallback_and_reveice_ether.json b/test/libsolidity/ASTJSON/fallback_and_reveice_ether.json index 009363e98..d116cfc1e 100644 --- a/test/libsolidity/ASTJSON/fallback_and_reveice_ether.json +++ b/test/libsolidity/ASTJSON/fallback_and_reveice_ether.json @@ -23,6 +23,7 @@ 9 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -39,6 +40,7 @@ "kind": "receive", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { @@ -73,6 +75,7 @@ "kind": "fallback", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/fallback_and_reveice_ether_parseOnly.json b/test/libsolidity/ASTJSON/fallback_and_reveice_ether_parseOnly.json index 838760bcd..d1a4561d5 100644 --- a/test/libsolidity/ASTJSON/fallback_and_reveice_ether_parseOnly.json +++ b/test/libsolidity/ASTJSON/fallback_and_reveice_ether_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 9, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -27,6 +28,7 @@ "kind": "receive", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { @@ -60,6 +62,7 @@ "kind": "fallback", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/fallback_parseOnly.json b/test/libsolidity/ASTJSON/fallback_parseOnly.json index 9a7a53e14..0b0b2670f 100644 --- a/test/libsolidity/ASTJSON/fallback_parseOnly.json +++ b/test/libsolidity/ASTJSON/fallback_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 5, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -27,6 +28,7 @@ "kind": "fallback", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/fallback_payable.json b/test/libsolidity/ASTJSON/fallback_payable.json index 2391f57bb..3d86c1f26 100644 --- a/test/libsolidity/ASTJSON/fallback_payable.json +++ b/test/libsolidity/ASTJSON/fallback_payable.json @@ -23,6 +23,7 @@ 5 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -39,6 +40,7 @@ "kind": "fallback", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/fallback_payable_parseOnly.json b/test/libsolidity/ASTJSON/fallback_payable_parseOnly.json index 17f78c8d6..ee9e20f79 100644 --- a/test/libsolidity/ASTJSON/fallback_payable_parseOnly.json +++ b/test/libsolidity/ASTJSON/fallback_payable_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 5, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -27,6 +28,7 @@ "kind": "fallback", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/function_type.json b/test/libsolidity/ASTJSON/function_type.json index c0d2efc68..872ec28c1 100644 --- a/test/libsolidity/ASTJSON/function_type.json +++ b/test/libsolidity/ASTJSON/function_type.json @@ -23,6 +23,7 @@ 17 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -40,6 +41,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -52,6 +54,7 @@ "id": 6, "mutability": "mutable", "name": "x", + "nameLocation": "67:1:1", "nodeType": "VariableDeclaration", "scope": 16, "src": "24:44:1", @@ -84,6 +87,7 @@ "id": 3, "mutability": "mutable", "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 5, "src": "61:4:1", @@ -136,6 +140,7 @@ "id": 13, "mutability": "mutable", "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 16, "src": "79:40:1", @@ -168,6 +173,7 @@ "id": 10, "mutability": "mutable", "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 12, "src": "113:4:1", diff --git a/test/libsolidity/ASTJSON/function_type_parseOnly.json b/test/libsolidity/ASTJSON/function_type_parseOnly.json index 3575cbee1..d0fa606e9 100644 --- a/test/libsolidity/ASTJSON/function_type_parseOnly.json +++ b/test/libsolidity/ASTJSON/function_type_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 17, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -27,6 +28,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -39,6 +41,7 @@ "id": 6, "mutability": "mutable", "name": "x", + "nameLocation": "67:1:1", "nodeType": "VariableDeclaration", "src": "24:44:1", "stateVariable": false, @@ -66,6 +69,7 @@ "id": 3, "mutability": "mutable", "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "src": "61:4:1", "stateVariable": false, @@ -105,6 +109,7 @@ "id": 13, "mutability": "mutable", "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "src": "79:40:1", "stateVariable": false, @@ -132,6 +137,7 @@ "id": 10, "mutability": "mutable", "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "src": "113:4:1", "stateVariable": false, diff --git a/test/libsolidity/ASTJSON/global_enum.json b/test/libsolidity/ASTJSON/global_enum.json index 1b0ffe377..0b673cffb 100644 --- a/test/libsolidity/ASTJSON/global_enum.json +++ b/test/libsolidity/ASTJSON/global_enum.json @@ -19,11 +19,13 @@ { "id": 1, "name": "A", + "nameLocation": "9:1:1", "nodeType": "EnumValue", "src": "9:1:1" } ], "name": "E", + "nameLocation": "5:1:1", "nodeType": "EnumDefinition", "src": "0:12:1" } diff --git a/test/libsolidity/ASTJSON/global_enum_parseOnly.json b/test/libsolidity/ASTJSON/global_enum_parseOnly.json index 389b1f4e2..887d5997c 100644 --- a/test/libsolidity/ASTJSON/global_enum_parseOnly.json +++ b/test/libsolidity/ASTJSON/global_enum_parseOnly.json @@ -11,11 +11,13 @@ { "id": 1, "name": "A", + "nameLocation": "9:1:1", "nodeType": "EnumValue", "src": "9:1:1" } ], "name": "E", + "nameLocation": "5:1:1", "nodeType": "EnumDefinition", "src": "0:12:1" } diff --git a/test/libsolidity/ASTJSON/global_struct.json b/test/libsolidity/ASTJSON/global_struct.json index 2d1d42bdc..2c14a5e41 100644 --- a/test/libsolidity/ASTJSON/global_struct.json +++ b/test/libsolidity/ASTJSON/global_struct.json @@ -21,6 +21,7 @@ "id": 2, "mutability": "mutable", "name": "a", + "nameLocation": "19:1:1", "nodeType": "VariableDeclaration", "scope": 3, "src": "11:9:1", @@ -47,6 +48,7 @@ } ], "name": "S", + "nameLocation": "7:1:1", "nodeType": "StructDefinition", "scope": 4, "src": "0:23:1", diff --git a/test/libsolidity/ASTJSON/global_struct_parseOnly.json b/test/libsolidity/ASTJSON/global_struct_parseOnly.json index 8cd50853d..418cb79fa 100644 --- a/test/libsolidity/ASTJSON/global_struct_parseOnly.json +++ b/test/libsolidity/ASTJSON/global_struct_parseOnly.json @@ -13,6 +13,7 @@ "id": 2, "mutability": "mutable", "name": "a", + "nameLocation": "19:1:1", "nodeType": "VariableDeclaration", "src": "11:9:1", "stateVariable": false, @@ -30,6 +31,7 @@ } ], "name": "S", + "nameLocation": "7:1:1", "nodeType": "StructDefinition", "src": "0:23:1", "visibility": "public" diff --git a/test/libsolidity/ASTJSON/inheritance_specifier.json b/test/libsolidity/ASTJSON/inheritance_specifier.json index 0e756f6d0..eed5ec73d 100644 --- a/test/libsolidity/ASTJSON/inheritance_specifier.json +++ b/test/libsolidity/ASTJSON/inheritance_specifier.json @@ -27,6 +27,7 @@ 1 ], "name": "C1", + "nameLocation": "9:2:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 5, @@ -63,6 +64,7 @@ 1 ], "name": "C2", + "nameLocation": "24:2:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 5, diff --git a/test/libsolidity/ASTJSON/inheritance_specifier_parseOnly.json b/test/libsolidity/ASTJSON/inheritance_specifier_parseOnly.json index 7054f573b..dc5f0b030 100644 --- a/test/libsolidity/ASTJSON/inheritance_specifier_parseOnly.json +++ b/test/libsolidity/ASTJSON/inheritance_specifier_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 1, "name": "C1", + "nameLocation": "9:2:1", "nodeType": "ContractDefinition", "nodes": [], "src": "0:14:1" @@ -36,6 +37,7 @@ "contractKind": "contract", "id": 4, "name": "C2", + "nameLocation": "24:2:1", "nodeType": "ContractDefinition", "nodes": [], "src": "15:20:1" diff --git a/test/libsolidity/ASTJSON/license.json b/test/libsolidity/ASTJSON/license.json index c365c072a..89bffe6a9 100644 --- a/test/libsolidity/ASTJSON/license.json +++ b/test/libsolidity/ASTJSON/license.json @@ -24,6 +24,7 @@ 1 ], "name": "C", + "nameLocation": "45:1:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 2, diff --git a/test/libsolidity/ASTJSON/license_parseOnly.json b/test/libsolidity/ASTJSON/license_parseOnly.json index a38f05a37..26ce58653 100644 --- a/test/libsolidity/ASTJSON/license_parseOnly.json +++ b/test/libsolidity/ASTJSON/license_parseOnly.json @@ -12,6 +12,7 @@ "contractKind": "contract", "id": 1, "name": "C", + "nameLocation": "45:1:1", "nodeType": "ContractDefinition", "nodes": [], "src": "36:13:1" diff --git a/test/libsolidity/ASTJSON/long_type_name_binary_operation.json b/test/libsolidity/ASTJSON/long_type_name_binary_operation.json index 7b598093b..c980ab1ca 100644 --- a/test/libsolidity/ASTJSON/long_type_name_binary_operation.json +++ b/test/libsolidity/ASTJSON/long_type_name_binary_operation.json @@ -23,6 +23,7 @@ 11 ], "name": "c", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -46,6 +47,7 @@ "id": 4, "mutability": "mutable", "name": "a", + "nameLocation": "40:1:1", "nodeType": "VariableDeclaration", "scope": 9, "src": "35:6:1", @@ -140,6 +142,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/long_type_name_binary_operation_parseOnly.json b/test/libsolidity/ASTJSON/long_type_name_binary_operation_parseOnly.json index 51ebaf12d..cf0c6881e 100644 --- a/test/libsolidity/ASTJSON/long_type_name_binary_operation_parseOnly.json +++ b/test/libsolidity/ASTJSON/long_type_name_binary_operation_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 11, "name": "c", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,6 +35,7 @@ "id": 4, "mutability": "mutable", "name": "a", + "nameLocation": "40:1:1", "nodeType": "VariableDeclaration", "src": "35:6:1", "stateVariable": false, @@ -90,6 +92,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/long_type_name_identifier.json b/test/libsolidity/ASTJSON/long_type_name_identifier.json index 4293f6df4..db240f5fe 100644 --- a/test/libsolidity/ASTJSON/long_type_name_identifier.json +++ b/test/libsolidity/ASTJSON/long_type_name_identifier.json @@ -23,6 +23,7 @@ 15 ], "name": "c", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -31,6 +32,7 @@ "id": 3, "mutability": "mutable", "name": "a", + "nameLocation": "20:1:1", "nodeType": "VariableDeclaration", "scope": 15, "src": "13:8:1", @@ -86,6 +88,7 @@ "id": 10, "mutability": "mutable", "name": "b", + "nameLocation": "60:1:1", "nodeType": "VariableDeclaration", "scope": 13, "src": "45:16:1", @@ -148,6 +151,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "32:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/long_type_name_identifier_parseOnly.json b/test/libsolidity/ASTJSON/long_type_name_identifier_parseOnly.json index bc94cc152..4f92ad651 100644 --- a/test/libsolidity/ASTJSON/long_type_name_identifier_parseOnly.json +++ b/test/libsolidity/ASTJSON/long_type_name_identifier_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 15, "name": "c", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -19,6 +20,7 @@ "id": 3, "mutability": "mutable", "name": "a", + "nameLocation": "20:1:1", "nodeType": "VariableDeclaration", "src": "13:8:1", "stateVariable": false, @@ -61,6 +63,7 @@ "id": 10, "mutability": "mutable", "name": "b", + "nameLocation": "60:1:1", "nodeType": "VariableDeclaration", "src": "45:16:1", "stateVariable": false, @@ -104,6 +107,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "32:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/mappings.json b/test/libsolidity/ASTJSON/mappings.json index ce72bbb11..2aee1601e 100644 --- a/test/libsolidity/ASTJSON/mappings.json +++ b/test/libsolidity/ASTJSON/mappings.json @@ -23,6 +23,7 @@ 19 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,23 +35,27 @@ { "id": 1, "name": "A", + "nameLocation": "26:1:1", "nodeType": "EnumValue", "src": "26:1:1" }, { "id": 2, "name": "B", + "nameLocation": "29:1:1", "nodeType": "EnumValue", "src": "29:1:1" }, { "id": 3, "name": "C", + "nameLocation": "32:1:1", "nodeType": "EnumValue", "src": "32:1:1" } ], "name": "E", + "nameLocation": "22:1:1", "nodeType": "EnumDefinition", "src": "17:18:1" }, @@ -59,6 +64,7 @@ "id": 9, "mutability": "mutable", "name": "a", + "nameLocation": "59:1:1", "nodeType": "VariableDeclaration", "scope": 19, "src": "40:20:1", @@ -119,6 +125,7 @@ "id": 13, "mutability": "mutable", "name": "b", + "nameLocation": "91:1:1", "nodeType": "VariableDeclaration", "scope": 19, "src": "66:26:1", @@ -171,6 +178,7 @@ "id": 18, "mutability": "mutable", "name": "c", + "nameLocation": "117:1:1", "nodeType": "VariableDeclaration", "scope": 19, "src": "98:20:1", diff --git a/test/libsolidity/ASTJSON/mappings_parseOnly.json b/test/libsolidity/ASTJSON/mappings_parseOnly.json index 7c78ad264..c29ee050e 100644 --- a/test/libsolidity/ASTJSON/mappings_parseOnly.json +++ b/test/libsolidity/ASTJSON/mappings_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 19, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -21,23 +22,27 @@ { "id": 1, "name": "A", + "nameLocation": "26:1:1", "nodeType": "EnumValue", "src": "26:1:1" }, { "id": 2, "name": "B", + "nameLocation": "29:1:1", "nodeType": "EnumValue", "src": "29:1:1" }, { "id": 3, "name": "C", + "nameLocation": "32:1:1", "nodeType": "EnumValue", "src": "32:1:1" } ], "name": "E", + "nameLocation": "22:1:1", "nodeType": "EnumDefinition", "src": "17:18:1" }, @@ -46,6 +51,7 @@ "id": 9, "mutability": "mutable", "name": "a", + "nameLocation": "59:1:1", "nodeType": "VariableDeclaration", "src": "40:20:1", "stateVariable": false, @@ -87,6 +93,7 @@ "id": 13, "mutability": "mutable", "name": "b", + "nameLocation": "91:1:1", "nodeType": "VariableDeclaration", "src": "66:26:1", "stateVariable": false, @@ -122,6 +129,7 @@ "id": 18, "mutability": "mutable", "name": "c", + "nameLocation": "117:1:1", "nodeType": "VariableDeclaration", "src": "98:20:1", "stateVariable": false, diff --git a/test/libsolidity/ASTJSON/modifier_definition.json b/test/libsolidity/ASTJSON/modifier_definition.json index 89fdab879..7e4bdc3b7 100644 --- a/test/libsolidity/ASTJSON/modifier_definition.json +++ b/test/libsolidity/ASTJSON/modifier_definition.json @@ -23,6 +23,7 @@ 14 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -43,6 +44,7 @@ }, "id": 6, "name": "M", + "nameLocation": "22:1:1", "nodeType": "ModifierDefinition", "parameters": { @@ -55,6 +57,7 @@ "id": 2, "mutability": "mutable", "name": "i", + "nameLocation": "29:1:1", "nodeType": "VariableDeclaration", "scope": 6, "src": "24:6:1", @@ -135,6 +138,7 @@ } ], "name": "F", + "nameLocation": "48:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/modifier_definition_parseOnly.json b/test/libsolidity/ASTJSON/modifier_definition_parseOnly.json index 33611e6ee..a0249ae86 100644 --- a/test/libsolidity/ASTJSON/modifier_definition_parseOnly.json +++ b/test/libsolidity/ASTJSON/modifier_definition_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 14, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -31,6 +32,7 @@ }, "id": 6, "name": "M", + "nameLocation": "22:1:1", "nodeType": "ModifierDefinition", "parameters": { @@ -43,6 +45,7 @@ "id": 2, "mutability": "mutable", "name": "i", + "nameLocation": "29:1:1", "nodeType": "VariableDeclaration", "src": "24:6:1", "stateVariable": false, @@ -104,6 +107,7 @@ } ], "name": "F", + "nameLocation": "48:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/modifier_invocation.json b/test/libsolidity/ASTJSON/modifier_invocation.json index 89fdab879..7e4bdc3b7 100644 --- a/test/libsolidity/ASTJSON/modifier_invocation.json +++ b/test/libsolidity/ASTJSON/modifier_invocation.json @@ -23,6 +23,7 @@ 14 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -43,6 +44,7 @@ }, "id": 6, "name": "M", + "nameLocation": "22:1:1", "nodeType": "ModifierDefinition", "parameters": { @@ -55,6 +57,7 @@ "id": 2, "mutability": "mutable", "name": "i", + "nameLocation": "29:1:1", "nodeType": "VariableDeclaration", "scope": 6, "src": "24:6:1", @@ -135,6 +138,7 @@ } ], "name": "F", + "nameLocation": "48:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/modifier_invocation_parseOnly.json b/test/libsolidity/ASTJSON/modifier_invocation_parseOnly.json index 33611e6ee..a0249ae86 100644 --- a/test/libsolidity/ASTJSON/modifier_invocation_parseOnly.json +++ b/test/libsolidity/ASTJSON/modifier_invocation_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 14, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -31,6 +32,7 @@ }, "id": 6, "name": "M", + "nameLocation": "22:1:1", "nodeType": "ModifierDefinition", "parameters": { @@ -43,6 +45,7 @@ "id": 2, "mutability": "mutable", "name": "i", + "nameLocation": "29:1:1", "nodeType": "VariableDeclaration", "src": "24:6:1", "stateVariable": false, @@ -104,6 +107,7 @@ } ], "name": "F", + "nameLocation": "48:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/mutability.json b/test/libsolidity/ASTJSON/mutability.json index f93bbb87f..242feda49 100644 --- a/test/libsolidity/ASTJSON/mutability.json +++ b/test/libsolidity/ASTJSON/mutability.json @@ -23,6 +23,7 @@ 10 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -32,6 +33,7 @@ "id": 3, "mutability": "immutable", "name": "a", + "nameLocation": "39:1:1", "nodeType": "VariableDeclaration", "scope": 10, "src": "17:27:1", @@ -80,6 +82,7 @@ "id": 6, "mutability": "constant", "name": "b", + "nameLocation": "71:1:1", "nodeType": "VariableDeclaration", "scope": 10, "src": "50:26:1", @@ -128,6 +131,7 @@ "id": 9, "mutability": "mutable", "name": "c", + "nameLocation": "94:1:1", "nodeType": "VariableDeclaration", "scope": 10, "src": "82:17:1", diff --git a/test/libsolidity/ASTJSON/mutability_parseOnly.json b/test/libsolidity/ASTJSON/mutability_parseOnly.json index 5f9d49c22..0ec1feaba 100644 --- a/test/libsolidity/ASTJSON/mutability_parseOnly.json +++ b/test/libsolidity/ASTJSON/mutability_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 10, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -19,6 +20,7 @@ "id": 3, "mutability": "immutable", "name": "a", + "nameLocation": "39:1:1", "nodeType": "VariableDeclaration", "src": "17:27:1", "stateVariable": false, @@ -49,6 +51,7 @@ "id": 6, "mutability": "constant", "name": "b", + "nameLocation": "71:1:1", "nodeType": "VariableDeclaration", "src": "50:26:1", "stateVariable": false, @@ -79,6 +82,7 @@ "id": 9, "mutability": "mutable", "name": "c", + "nameLocation": "94:1:1", "nodeType": "VariableDeclaration", "src": "82:17:1", "stateVariable": false, diff --git a/test/libsolidity/ASTJSON/non_utf8.json b/test/libsolidity/ASTJSON/non_utf8.json index 1a1ea5b96..447fc7765 100644 --- a/test/libsolidity/ASTJSON/non_utf8.json +++ b/test/libsolidity/ASTJSON/non_utf8.json @@ -23,6 +23,7 @@ 9 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -46,6 +47,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "49:1:1", "nodeType": "VariableDeclaration", "scope": 7, "src": "35:15:1", @@ -100,6 +102,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/non_utf8_parseOnly.json b/test/libsolidity/ASTJSON/non_utf8_parseOnly.json index a8ddabfbd..9bd73fc3f 100644 --- a/test/libsolidity/ASTJSON/non_utf8_parseOnly.json +++ b/test/libsolidity/ASTJSON/non_utf8_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 9, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,6 +35,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "49:1:1", "nodeType": "VariableDeclaration", "src": "35:15:1", "stateVariable": false, @@ -70,6 +72,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/not_existing_import_parseOnly.json b/test/libsolidity/ASTJSON/not_existing_import_parseOnly.json index 4a854afaa..aacb25cb0 100644 --- a/test/libsolidity/ASTJSON/not_existing_import_parseOnly.json +++ b/test/libsolidity/ASTJSON/not_existing_import_parseOnly.json @@ -7,6 +7,7 @@ { "file": "notexisting.sol", "id": 1, + "nameLocation": "28:11:1", "nodeType": "ImportDirective", "src": "0:40:1", "symbolAliases": [], @@ -33,6 +34,7 @@ "contractKind": "contract", "id": 11, "name": "C", + "nameLocation": "50:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -41,6 +43,7 @@ "id": 6, "mutability": "mutable", "name": "myStruct", + "nameLocation": "102:8:1", "nodeType": "VariableDeclaration", "src": "72:38:1", "stateVariable": false, @@ -75,6 +78,7 @@ "kind": "constructor", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/override.json b/test/libsolidity/ASTJSON/override.json index a7412cb5a..89fd04a77 100644 --- a/test/libsolidity/ASTJSON/override.json +++ b/test/libsolidity/ASTJSON/override.json @@ -31,6 +31,7 @@ 5 ], "name": "A", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -48,6 +49,7 @@ "kind": "function", "modifiers": [], "name": "faa", + "nameLocation": "23:3:1", "nodeType": "FunctionDefinition", "parameters": { @@ -104,6 +106,7 @@ 5 ], "name": "B", + "nameLocation": "50:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -114,6 +117,7 @@ "kind": "function", "modifiers": [], "name": "foo", + "nameLocation": "69:3:1", "nodeType": "FunctionDefinition", "parameters": { @@ -153,6 +157,7 @@ "kind": "function", "modifiers": [], "name": "faa", + "nameLocation": "93:3:1", "nodeType": "FunctionDefinition", "overrides": { @@ -218,6 +223,7 @@ 5 ], "name": "C", + "nameLocation": "129:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -239,6 +245,7 @@ "kind": "function", "modifiers": [], "name": "foo", + "nameLocation": "148:3:1", "nodeType": "FunctionDefinition", "overrides": { @@ -285,6 +292,7 @@ "kind": "function", "modifiers": [], "name": "faa", + "nameLocation": "184:3:1", "nodeType": "FunctionDefinition", "overrides": { diff --git a/test/libsolidity/ASTJSON/override_parseOnly.json b/test/libsolidity/ASTJSON/override_parseOnly.json index 60c70f9f7..fb9b3e566 100644 --- a/test/libsolidity/ASTJSON/override_parseOnly.json +++ b/test/libsolidity/ASTJSON/override_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 5, "name": "A", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -27,6 +28,7 @@ "kind": "function", "modifiers": [], "name": "faa", + "nameLocation": "23:3:1", "nodeType": "FunctionDefinition", "parameters": { @@ -71,6 +73,7 @@ "contractKind": "contract", "id": 16, "name": "B", + "nameLocation": "50:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -80,6 +83,7 @@ "kind": "function", "modifiers": [], "name": "foo", + "nameLocation": "69:3:1", "nodeType": "FunctionDefinition", "parameters": { @@ -113,6 +117,7 @@ "kind": "function", "modifiers": [], "name": "faa", + "nameLocation": "93:3:1", "nodeType": "FunctionDefinition", "overrides": { @@ -164,6 +169,7 @@ "contractKind": "contract", "id": 31, "name": "C", + "nameLocation": "129:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -180,6 +186,7 @@ "kind": "function", "modifiers": [], "name": "foo", + "nameLocation": "148:3:1", "nodeType": "FunctionDefinition", "overrides": { @@ -220,6 +227,7 @@ "kind": "function", "modifiers": [], "name": "faa", + "nameLocation": "184:3:1", "nodeType": "FunctionDefinition", "overrides": { diff --git a/test/libsolidity/ASTJSON/placeholder_statement.json b/test/libsolidity/ASTJSON/placeholder_statement.json index 4f9bbbdce..4db3665ec 100644 --- a/test/libsolidity/ASTJSON/placeholder_statement.json +++ b/test/libsolidity/ASTJSON/placeholder_statement.json @@ -23,6 +23,7 @@ 5 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -43,6 +44,7 @@ }, "id": 4, "name": "M", + "nameLocation": "22:1:1", "nodeType": "ModifierDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/placeholder_statement_parseOnly.json b/test/libsolidity/ASTJSON/placeholder_statement_parseOnly.json index aac418e75..f0748ea5e 100644 --- a/test/libsolidity/ASTJSON/placeholder_statement_parseOnly.json +++ b/test/libsolidity/ASTJSON/placeholder_statement_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 5, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -31,6 +32,7 @@ }, "id": 4, "name": "M", + "nameLocation": "22:1:1", "nodeType": "ModifierDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/receive_ether.json b/test/libsolidity/ASTJSON/receive_ether.json index 8a1f0ac9a..549cf325d 100644 --- a/test/libsolidity/ASTJSON/receive_ether.json +++ b/test/libsolidity/ASTJSON/receive_ether.json @@ -23,6 +23,7 @@ 5 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -39,6 +40,7 @@ "kind": "receive", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/receive_ether_parseOnly.json b/test/libsolidity/ASTJSON/receive_ether_parseOnly.json index 476dd6d68..4855a18e0 100644 --- a/test/libsolidity/ASTJSON/receive_ether_parseOnly.json +++ b/test/libsolidity/ASTJSON/receive_ether_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 5, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -27,6 +28,7 @@ "kind": "receive", "modifiers": [], "name": "", + "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/short_type_name.json b/test/libsolidity/ASTJSON/short_type_name.json index 882fcfe24..b320c9979 100644 --- a/test/libsolidity/ASTJSON/short_type_name.json +++ b/test/libsolidity/ASTJSON/short_type_name.json @@ -23,6 +23,7 @@ 11 ], "name": "c", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -46,6 +47,7 @@ "id": 7, "mutability": "mutable", "name": "x", + "nameLocation": "49:1:1", "nodeType": "VariableDeclaration", "scope": 9, "src": "35:15:1", @@ -94,6 +96,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/short_type_name_parseOnly.json b/test/libsolidity/ASTJSON/short_type_name_parseOnly.json index aa1098457..a88babaa6 100644 --- a/test/libsolidity/ASTJSON/short_type_name_parseOnly.json +++ b/test/libsolidity/ASTJSON/short_type_name_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 11, "name": "c", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,6 +35,7 @@ "id": 7, "mutability": "mutable", "name": "x", + "nameLocation": "49:1:1", "nodeType": "VariableDeclaration", "src": "35:15:1", "stateVariable": false, @@ -68,6 +70,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/short_type_name_ref.json b/test/libsolidity/ASTJSON/short_type_name_ref.json index 2d07a9c60..e6dde6f4d 100644 --- a/test/libsolidity/ASTJSON/short_type_name_ref.json +++ b/test/libsolidity/ASTJSON/short_type_name_ref.json @@ -23,6 +23,7 @@ 12 ], "name": "c", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -46,6 +47,7 @@ "id": 8, "mutability": "mutable", "name": "rows", + "nameLocation": "51:4:1", "nodeType": "VariableDeclaration", "scope": 10, "src": "35:20:1", @@ -105,6 +107,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/short_type_name_ref_parseOnly.json b/test/libsolidity/ASTJSON/short_type_name_ref_parseOnly.json index df5e74918..bd6883813 100644 --- a/test/libsolidity/ASTJSON/short_type_name_ref_parseOnly.json +++ b/test/libsolidity/ASTJSON/short_type_name_ref_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 12, "name": "c", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,6 +35,7 @@ "id": 8, "mutability": "mutable", "name": "rows", + "nameLocation": "51:4:1", "nodeType": "VariableDeclaration", "src": "35:20:1", "stateVariable": false, @@ -75,6 +77,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/smoke.json b/test/libsolidity/ASTJSON/smoke.json index dede1661c..3561ace5e 100644 --- a/test/libsolidity/ASTJSON/smoke.json +++ b/test/libsolidity/ASTJSON/smoke.json @@ -23,6 +23,7 @@ 1 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 2, diff --git a/test/libsolidity/ASTJSON/smoke_parseOnly.json b/test/libsolidity/ASTJSON/smoke_parseOnly.json index 2c3936629..c8a86073f 100644 --- a/test/libsolidity/ASTJSON/smoke_parseOnly.json +++ b/test/libsolidity/ASTJSON/smoke_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 1, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [], "src": "0:13:1" diff --git a/test/libsolidity/ASTJSON/source_location.json b/test/libsolidity/ASTJSON/source_location.json index f56231ed7..379257401 100644 --- a/test/libsolidity/ASTJSON/source_location.json +++ b/test/libsolidity/ASTJSON/source_location.json @@ -23,6 +23,7 @@ 12 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -46,6 +47,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "33:1:1", "nodeType": "VariableDeclaration", "scope": 10, "src": "28:6:1", @@ -137,6 +139,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/source_location_parseOnly.json b/test/libsolidity/ASTJSON/source_location_parseOnly.json index 2bd8e80d8..96f04708f 100644 --- a/test/libsolidity/ASTJSON/source_location_parseOnly.json +++ b/test/libsolidity/ASTJSON/source_location_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 12, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,6 +35,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "33:1:1", "nodeType": "VariableDeclaration", "src": "28:6:1", "stateVariable": false, @@ -94,6 +96,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/string.json b/test/libsolidity/ASTJSON/string.json index f47b41e47..748423fe0 100644 --- a/test/libsolidity/ASTJSON/string.json +++ b/test/libsolidity/ASTJSON/string.json @@ -23,6 +23,7 @@ 9 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -46,6 +47,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "49:1:1", "nodeType": "VariableDeclaration", "scope": 7, "src": "35:15:1", @@ -101,6 +103,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/string_parseOnly.json b/test/libsolidity/ASTJSON/string_parseOnly.json index 06ba82aaa..607ab5dc5 100644 --- a/test/libsolidity/ASTJSON/string_parseOnly.json +++ b/test/libsolidity/ASTJSON/string_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 9, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,6 +35,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "49:1:1", "nodeType": "VariableDeclaration", "src": "35:15:1", "stateVariable": false, @@ -71,6 +73,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/two_base_functions.json b/test/libsolidity/ASTJSON/two_base_functions.json index 1b3eb13fd..45f1c0046 100644 --- a/test/libsolidity/ASTJSON/two_base_functions.json +++ b/test/libsolidity/ASTJSON/two_base_functions.json @@ -31,6 +31,7 @@ 5 ], "name": "A", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -48,6 +49,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -85,6 +87,7 @@ 10 ], "name": "B", + "nameLocation": "59:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -102,6 +105,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "76:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -173,6 +177,7 @@ 5 ], "name": "C", + "nameLocation": "109:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -195,6 +200,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "134:1:1", "nodeType": "FunctionDefinition", "overrides": { diff --git a/test/libsolidity/ASTJSON/two_base_functions_parseOnly.json b/test/libsolidity/ASTJSON/two_base_functions_parseOnly.json index a807cabbd..8858b2079 100644 --- a/test/libsolidity/ASTJSON/two_base_functions_parseOnly.json +++ b/test/libsolidity/ASTJSON/two_base_functions_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 5, "name": "A", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -27,6 +28,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "26:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -57,6 +59,7 @@ "contractKind": "contract", "id": 10, "name": "B", + "nameLocation": "59:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -73,6 +76,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "76:1:1", "nodeType": "FunctionDefinition", "parameters": { @@ -129,6 +133,7 @@ "contractKind": "contract", "id": 22, "name": "C", + "nameLocation": "109:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -145,6 +150,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "134:1:1", "nodeType": "FunctionDefinition", "overrides": { diff --git a/test/libsolidity/ASTJSON/unicode.json b/test/libsolidity/ASTJSON/unicode.json index 219d89500..de4b74e77 100644 --- a/test/libsolidity/ASTJSON/unicode.json +++ b/test/libsolidity/ASTJSON/unicode.json @@ -23,6 +23,7 @@ 9 ], "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -46,6 +47,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "49:1:1", "nodeType": "VariableDeclaration", "scope": 7, "src": "35:15:1", @@ -101,6 +103,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/unicode_parseOnly.json b/test/libsolidity/ASTJSON/unicode_parseOnly.json index c48013a2e..8d36703c8 100644 --- a/test/libsolidity/ASTJSON/unicode_parseOnly.json +++ b/test/libsolidity/ASTJSON/unicode_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "contract", "id": 9, "name": "C", + "nameLocation": "9:1:1", "nodeType": "ContractDefinition", "nodes": [ @@ -34,6 +35,7 @@ "id": 4, "mutability": "mutable", "name": "x", + "nameLocation": "49:1:1", "nodeType": "VariableDeclaration", "src": "35:15:1", "stateVariable": false, @@ -71,6 +73,7 @@ "kind": "function", "modifiers": [], "name": "f", + "nameLocation": "22:1:1", "nodeType": "FunctionDefinition", "parameters": { diff --git a/test/libsolidity/ASTJSON/using_for_directive.json b/test/libsolidity/ASTJSON/using_for_directive.json index b6ef6a072..00fbca234 100644 --- a/test/libsolidity/ASTJSON/using_for_directive.json +++ b/test/libsolidity/ASTJSON/using_for_directive.json @@ -27,6 +27,7 @@ 1 ], "name": "L", + "nameLocation": "8:1:1", "nodeType": "ContractDefinition", "nodes": [], "scope": 6, @@ -44,6 +45,7 @@ 5 ], "name": "C", + "nameLocation": "22:1:1", "nodeType": "ContractDefinition", "nodes": [ diff --git a/test/libsolidity/ASTJSON/using_for_directive_parseOnly.json b/test/libsolidity/ASTJSON/using_for_directive_parseOnly.json index 36baafcad..486d76d71 100644 --- a/test/libsolidity/ASTJSON/using_for_directive_parseOnly.json +++ b/test/libsolidity/ASTJSON/using_for_directive_parseOnly.json @@ -11,6 +11,7 @@ "contractKind": "library", "id": 1, "name": "L", + "nameLocation": "8:1:1", "nodeType": "ContractDefinition", "nodes": [], "src": "0:12:1" @@ -22,6 +23,7 @@ "contractKind": "contract", "id": 5, "name": "C", + "nameLocation": "22:1:1", "nodeType": "ContractDefinition", "nodes": [ diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index 20a01ee7f..a1f9c06a3 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -473,7 +473,7 @@ BOOST_AUTO_TEST_CASE(basic_compilation) util::jsonCompactPrint(result["sources"]["fileA"]["ast"]), "{\"absolutePath\":\"fileA\",\"exportedSymbols\":{\"A\":[1]},\"id\":2,\"nodeType\":\"SourceUnit\",\"nodes\":[{\"abstract\":false," "\"baseContracts\":[],\"contractDependencies\":[],\"contractKind\":\"contract\",\"fullyImplemented\":true,\"id\":1," - "\"linearizedBaseContracts\":[1],\"name\":\"A\",\"nodeType\":\"ContractDefinition\",\"nodes\":[],\"scope\":2," + "\"linearizedBaseContracts\":[1],\"name\":\"A\",\"nameLocation\":\"9:1:0\",\"nodeType\":\"ContractDefinition\",\"nodes\":[],\"scope\":2," "\"src\":\"0:14:0\"}],\"src\":\"0:14:0\"}" ); }