Skip to content

Commit

Permalink
Use ASTString instead of std::string
Browse files Browse the repository at this point in the history
  • Loading branch information
zemse authored and hrkrshnn committed Sep 25, 2022
1 parent 9b1a258 commit 9861fd1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions libsolidity/analysis/DeclarationTypeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion libsolidity/ast/TypeProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ MagicType const* TypeProvider::meta(Type const* _type)
return createAndGet<MagicType>(_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<MappingType>(_keyType, _valueType, _keyName, _valueName);
}
Expand Down
2 changes: 1 addition & 1 deletion libsolidity/ast/TypeProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion libsolidity/ast/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2782,7 +2782,7 @@ FunctionType::FunctionType(VariableDeclaration const& _varDecl):
m_declaration(&_varDecl)
{
auto returnType = _varDecl.annotation().type;
std::string returnName;
ASTString returnName;

while (true)
{
Expand Down
10 changes: 5 additions & 5 deletions libsolidity/ast/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -1532,17 +1532,17 @@ 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<Type const*> decomposition() const override { return {m_valueType}; }

private:
Type const* m_keyType;
Type const* m_valueType;
std::string m_keyName;
std::string m_valueName;
ASTString m_keyName;
ASTString m_valueName;
};

/**
Expand Down

0 comments on commit 9861fd1

Please sign in to comment.