From 9861fd1fa0f875d28d3beb2c694c8918ca9f6b05 Mon Sep 17 00:00:00 2001 From: Soham Zemse <22412996+zemse@users.noreply.github.com> Date: Sun, 28 Aug 2022 13:16:14 +0530 Subject: [PATCH] Use ASTString instead of std::string --- libsolidity/analysis/DeclarationTypeChecker.cpp | 4 ++-- libsolidity/ast/TypeProvider.cpp | 2 +- libsolidity/ast/TypeProvider.h | 2 +- libsolidity/ast/Types.cpp | 2 +- libsolidity/ast/Types.h | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libsolidity/analysis/DeclarationTypeChecker.cpp b/libsolidity/analysis/DeclarationTypeChecker.cpp index 20cccc5be5de..903809ed2af4 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.cpp +++ b/libsolidity/analysis/DeclarationTypeChecker.cpp @@ -269,8 +269,8 @@ void DeclarationTypeChecker::endVisit(Mapping const& _mapping) Type const* keyType = _mapping.keyType().annotation().type; Type const* valueType = _mapping.valueType().annotation().type; - std::string keyName = _mapping.keyName(); - std::string valueName = _mapping.valueName(); + ASTString keyName = _mapping.keyName(); + ASTString valueName = _mapping.valueName(); // Convert key type to memory. keyType = TypeProvider::withLocationIfReference(DataLocation::Memory, keyType); diff --git a/libsolidity/ast/TypeProvider.cpp b/libsolidity/ast/TypeProvider.cpp index 907aaaa70e5a..720c139aea67 100644 --- a/libsolidity/ast/TypeProvider.cpp +++ b/libsolidity/ast/TypeProvider.cpp @@ -571,7 +571,7 @@ MagicType const* TypeProvider::meta(Type const* _type) return createAndGet(_type); } -MappingType const* TypeProvider::mapping(Type const* _keyType, Type const* _valueType, std::string _keyName, std::string _valueName) +MappingType const* TypeProvider::mapping(Type const* _keyType, Type const* _valueType, ASTString _keyName, ASTString _valueName) { return createAndGet(_keyType, _valueType, _keyName, _valueName); } diff --git a/libsolidity/ast/TypeProvider.h b/libsolidity/ast/TypeProvider.h index dfea410f115e..08bcfc71a46c 100644 --- a/libsolidity/ast/TypeProvider.h +++ b/libsolidity/ast/TypeProvider.h @@ -195,7 +195,7 @@ class TypeProvider static MagicType const* meta(Type const* _type); - static MappingType const* mapping(Type const* _keyType, Type const* _valueType, std::string _keyName, std::string _valueName); + static MappingType const* mapping(Type const* _keyType, Type const* _valueType, ASTString _keyName, ASTString _valueName); static UserDefinedValueType const* userDefinedValueType(UserDefinedValueTypeDefinition const& _definition); diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 24f8c4bfc77c..8ba95364e371 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -2782,7 +2782,7 @@ FunctionType::FunctionType(VariableDeclaration const& _varDecl): m_declaration(&_varDecl) { auto returnType = _varDecl.annotation().type; - std::string returnName; + ASTString returnName; while (true) { diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 5fcf6cde9a54..1a3613b1b50c 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -1510,7 +1510,7 @@ class FunctionType: public Type class MappingType: public CompositeType { public: - MappingType(Type const* _keyType, Type const* _valueType, std::string _keyName, std::string _valueName): + MappingType(Type const* _keyType, Type const* _valueType, ASTString _keyName, ASTString _valueName): m_keyType(_keyType), m_valueType(_valueType), m_keyName(_keyName), m_valueName(_valueName) {} Category category() const override { return Category::Mapping; } @@ -1532,8 +1532,8 @@ class MappingType: public CompositeType Type const* keyType() const { return m_keyType; } Type const* valueType() const { return m_valueType; } - std::string keyName() const { return m_keyName; } - std::string valueName() const { return m_valueName; } + ASTString keyName() const { return m_keyName; } + ASTString valueName() const { return m_valueName; } protected: std::vector decomposition() const override { return {m_valueType}; } @@ -1541,8 +1541,8 @@ class MappingType: public CompositeType private: Type const* m_keyType; Type const* m_valueType; - std::string m_keyName; - std::string m_valueName; + ASTString m_keyName; + ASTString m_valueName; }; /**