Skip to content

Commit e0ba7ef

Browse files
committed
Rename _short in toString to _withoutDataLocation
1 parent 0a14368 commit e0ba7ef

File tree

4 files changed

+45
-45
lines changed

4 files changed

+45
-45
lines changed

libsolidity/ast/ASTJsonExporter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ string ASTJsonExporter::namePathToString(std::vector<ASTString> const& _namePath
143143
return boost::algorithm::join(_namePath, ".");
144144
}
145145

146-
Json::Value ASTJsonExporter::typePointerToJson(Type const* _tp, bool _short)
146+
Json::Value ASTJsonExporter::typePointerToJson(Type const* _tp, bool _withoutDataLocation)
147147
{
148148
Json::Value typeDescriptions(Json::objectValue);
149-
typeDescriptions["typeString"] = _tp ? Json::Value(_tp->toString(_short)) : Json::nullValue;
149+
typeDescriptions["typeString"] = _tp ? Json::Value(_tp->toString(_withoutDataLocation)) : Json::nullValue;
150150
typeDescriptions["typeIdentifier"] = _tp ? Json::Value(_tp->identifier()) : Json::nullValue;
151151
return typeDescriptions;
152152

libsolidity/ast/ASTJsonExporter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class ASTJsonExporter: public ASTConstVisitor
184184

185185
return json;
186186
}
187-
static Json::Value typePointerToJson(Type const* _tp, bool _short = false);
187+
static Json::Value typePointerToJson(Type const* _tp, bool _withoutDataLocation = false);
188188
static Json::Value typePointerToJson(std::optional<FuncCallArguments> const& _tps);
189189
void appendExpressionAttributes(
190190
std::vector<std::pair<std::string, Json::Value>> &_attributes,

libsolidity/ast/Types.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ util::Result<TypePointers> transformParametersToExternal(TypePointers const& _pa
110110
return transformed;
111111
}
112112

113-
string toStringInParentheses(TypePointers const& _types, bool _short)
113+
string toStringInParentheses(TypePointers const& _types, bool _withoutDataLocation)
114114
{
115115
return '(' + util::joinHumanReadable(
116-
_types | ranges::views::transform([&](auto const* _type) { return _type->toString(_short); }),
116+
_types | ranges::views::transform([&](auto const* _type) { return _type->toString(_withoutDataLocation); }),
117117
","
118118
) + ')';
119119
}
@@ -1789,7 +1789,7 @@ vector<tuple<string, Type const*>> ArrayType::makeStackItems() const
17891789
solAssert(false, "");
17901790
}
17911791

1792-
string ArrayType::toString(bool _short) const
1792+
string ArrayType::toString(bool _withoutDataLocation) const
17931793
{
17941794
string ret;
17951795
if (isString())
@@ -1798,12 +1798,12 @@ string ArrayType::toString(bool _short) const
17981798
ret = "bytes";
17991799
else
18001800
{
1801-
ret = baseType()->toString(_short) + "[";
1801+
ret = baseType()->toString(_withoutDataLocation) + "[";
18021802
if (!isDynamicallySized())
18031803
ret += length().str();
18041804
ret += "]";
18051805
}
1806-
if (!_short)
1806+
if (!_withoutDataLocation)
18071807
ret += " " + stringForReferencePart();
18081808
return ret;
18091809
}
@@ -2008,9 +2008,9 @@ bool ArraySliceType::operator==(Type const& _other) const
20082008
return false;
20092009
}
20102010

2011-
string ArraySliceType::toString(bool _short) const
2011+
string ArraySliceType::toString(bool _withoutDataLocation) const
20122012
{
2013-
return m_arrayType.toString(_short) + " slice";
2013+
return m_arrayType.toString(_withoutDataLocation) + " slice";
20142014
}
20152015

20162016
string ArraySliceType::humanReadableName() const
@@ -2279,10 +2279,10 @@ bool StructType::containsNestedMapping() const
22792279
return m_struct.annotation().containsNestedMapping.value();
22802280
}
22812281

2282-
string StructType::toString(bool _short) const
2282+
string StructType::toString(bool _withoutDataLocation) const
22832283
{
22842284
string ret = "struct " + *m_struct.annotation().canonicalName;
2285-
if (!_short)
2285+
if (!_withoutDataLocation)
22862286
ret += " " + stringForReferencePart();
22872287
return ret;
22882288
}
@@ -2634,7 +2634,7 @@ bool UserDefinedValueType::operator==(Type const& _other) const
26342634
return other.definition() == definition();
26352635
}
26362636

2637-
string UserDefinedValueType::toString(bool /* _short */) const
2637+
string UserDefinedValueType::toString(bool /* _withoutDataLocation */) const
26382638
{
26392639
return *definition().annotation().canonicalName;
26402640
}
@@ -2682,13 +2682,13 @@ bool TupleType::operator==(Type const& _other) const
26822682
return false;
26832683
}
26842684

2685-
string TupleType::toString(bool _short) const
2685+
string TupleType::toString(bool _withoutDataLocation) const
26862686
{
26872687
if (components().empty())
26882688
return "tuple()";
26892689
string str = "tuple(";
26902690
for (auto const& t: components())
2691-
str += (t ? t->toString(_short) : "") + ",";
2691+
str += (t ? t->toString(_withoutDataLocation) : "") + ",";
26922692
str.pop_back();
26932693
return str + ")";
26942694
}
@@ -3137,15 +3137,15 @@ string FunctionType::humanReadableName() const
31373137
switch (m_kind)
31383138
{
31393139
case Kind::Error:
3140-
return "error " + m_declaration->name() + toStringInParentheses(m_parameterTypes, /* _short */ true);
3140+
return "error " + m_declaration->name() + toStringInParentheses(m_parameterTypes, /* _withoutDataLocation */ true);
31413141
case Kind::Event:
3142-
return "event " + m_declaration->name() + toStringInParentheses(m_parameterTypes, /* _short */ true);
3142+
return "event " + m_declaration->name() + toStringInParentheses(m_parameterTypes, /* _withoutDataLocation */ true);
31433143
default:
3144-
return toString(/* _short */ false);
3144+
return toString(/* _withoutDataLocation */ false);
31453145
}
31463146
}
31473147

3148-
string FunctionType::toString(bool _short) const
3148+
string FunctionType::toString(bool _withoutDataLocation) const
31493149
{
31503150
string name = "function ";
31513151
if (m_kind == Kind::Declaration)
@@ -3156,15 +3156,15 @@ string FunctionType::toString(bool _short) const
31563156
name += *contract->annotation().canonicalName + ".";
31573157
name += functionDefinition->name();
31583158
}
3159-
name += toStringInParentheses(m_parameterTypes, _short);
3159+
name += toStringInParentheses(m_parameterTypes, _withoutDataLocation);
31603160
if (m_stateMutability != StateMutability::NonPayable)
31613161
name += " " + stateMutabilityToString(m_stateMutability);
31623162
if (m_kind == Kind::External)
31633163
name += " external";
31643164
if (!m_returnParameterTypes.empty())
31653165
{
31663166
name += " returns ";
3167-
name += toStringInParentheses(m_returnParameterTypes, _short);
3167+
name += toStringInParentheses(m_returnParameterTypes, _withoutDataLocation);
31683168
}
31693169
return name;
31703170
}
@@ -3756,9 +3756,9 @@ bool MappingType::operator==(Type const& _other) const
37563756
return *other.m_keyType == *m_keyType && *other.m_valueType == *m_valueType;
37573757
}
37583758

3759-
string MappingType::toString(bool _short) const
3759+
string MappingType::toString(bool _withoutDataLocation) const
37603760
{
3761-
return "mapping(" + keyType()->toString(_short) + " => " + valueType()->toString(_short) + ")";
3761+
return "mapping(" + keyType()->toString(_withoutDataLocation) + " => " + valueType()->toString(_withoutDataLocation) + ")";
37623762
}
37633763

37643764
string MappingType::canonicalName() const
@@ -3983,11 +3983,11 @@ bool ModifierType::operator==(Type const& _other) const
39833983
return true;
39843984
}
39853985

3986-
string ModifierType::toString(bool _short) const
3986+
string ModifierType::toString(bool _withoutDataLocation) const
39873987
{
39883988
string name = "modifier (";
39893989
for (auto it = m_parameterTypes.begin(); it != m_parameterTypes.end(); ++it)
3990-
name += (*it)->toString(_short) + (it + 1 == m_parameterTypes.end() ? "" : ",");
3990+
name += (*it)->toString(_withoutDataLocation) + (it + 1 == m_parameterTypes.end() ? "" : ",");
39913991
return name + ")";
39923992
}
39933993

@@ -4183,7 +4183,7 @@ MemberList::MemberMap MagicType::nativeMembers(ASTNode const*) const
41834183
return {};
41844184
}
41854185

4186-
string MagicType::toString(bool _short) const
4186+
string MagicType::toString(bool _withoutDataLocation) const
41874187
{
41884188
switch (m_kind)
41894189
{
@@ -4197,7 +4197,7 @@ string MagicType::toString(bool _short) const
41974197
return "abi";
41984198
case Kind::MetaType:
41994199
solAssert(m_typeArgument, "");
4200-
return "type(" + m_typeArgument->toString(_short) + ")";
4200+
return "type(" + m_typeArgument->toString(_withoutDataLocation) + ")";
42014201
}
42024202
solAssert(false, "Unknown kind of magic.");
42034203
return {};

libsolidity/ast/Types.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class Type
335335
return members(_currentScope).memberType(_name);
336336
}
337337

338-
virtual std::string toString(bool _short) const = 0;
338+
virtual std::string toString(bool _withoutDataLocation) const = 0;
339339
std::string toString() const { return toString(false); }
340340
/// @returns the canonical name of this type for use in library function signatures.
341341
virtual std::string canonicalName() const { return toString(true); }
@@ -428,7 +428,7 @@ class AddressType: public Type
428428

429429
MemberList::MemberMap nativeMembers(ASTNode const*) const override;
430430

431-
std::string toString(bool _short) const override;
431+
std::string toString(bool _withoutDataLocation) const override;
432432
std::string canonicalName() const override;
433433

434434
u256 literalValue(Literal const* _literal) const override;
@@ -471,7 +471,7 @@ class IntegerType: public Type
471471
bool isValueType() const override { return true; }
472472
bool nameable() const override { return true; }
473473

474-
std::string toString(bool _short) const override;
474+
std::string toString(bool _withoutDataLocation) const override;
475475

476476
Type const* encodingType() const override { return this; }
477477
TypeResult interfaceType(bool) const override { return this; }
@@ -518,7 +518,7 @@ class FixedPointType: public Type
518518
bool isValueType() const override { return true; }
519519
bool nameable() const override { return true; }
520520

521-
std::string toString(bool _short) const override;
521+
std::string toString(bool _withoutDataLocation) const override;
522522

523523
Type const* encodingType() const override { return this; }
524524
TypeResult interfaceType(bool) const override { return this; }
@@ -568,7 +568,7 @@ class RationalNumberType: public Type
568568

569569
bool canBeStored() const override { return false; }
570570

571-
std::string toString(bool _short) const override;
571+
std::string toString(bool _withoutDataLocation) const override;
572572
u256 literalValue(Literal const* _literal) const override;
573573
Type const* mobileType() const override;
574574

@@ -832,7 +832,7 @@ class ArrayType: public ReferenceType
832832
bool containsNestedMapping() const override { return m_baseType->containsNestedMapping(); }
833833
bool nameable() const override { return true; }
834834

835-
std::string toString(bool _short) const override;
835+
std::string toString(bool _withoutDataLocation) const override;
836836
std::string humanReadableName() const override;
837837
std::string canonicalName() const override;
838838
std::string signatureInExternalFunction(bool _structsByName) const override;
@@ -897,7 +897,7 @@ class ArraySliceType: public ReferenceType
897897
unsigned calldataEncodedTailSize() const override { return 32; }
898898
bool isDynamicallySized() const override { return true; }
899899
bool isDynamicallyEncoded() const override { return true; }
900-
std::string toString(bool _short) const override;
900+
std::string toString(bool _withoutDataLocation) const override;
901901
std::string humanReadableName() const override;
902902
Type const* mobileType() const override;
903903

@@ -942,7 +942,7 @@ class ContractType: public Type
942942
bool leftAligned() const override { solAssert(!isSuper(), ""); return false; }
943943
bool isValueType() const override { return !isSuper(); }
944944
bool nameable() const override { return !isSuper(); }
945-
std::string toString(bool _short) const override;
945+
std::string toString(bool _withoutDataLocation) const override;
946946
std::string canonicalName() const override;
947947

948948
MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override;
@@ -1004,7 +1004,7 @@ class StructType: public ReferenceType
10041004
u256 storageSize() const override;
10051005
bool containsNestedMapping() const override;
10061006
bool nameable() const override { return true; }
1007-
std::string toString(bool _short) const override;
1007+
std::string toString(bool _withoutDataLocation) const override;
10081008

10091009
MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override;
10101010

@@ -1066,7 +1066,7 @@ class EnumType: public Type
10661066
}
10671067
unsigned storageBytes() const override;
10681068
bool leftAligned() const override { return false; }
1069-
std::string toString(bool _short) const override;
1069+
std::string toString(bool _withoutDataLocation) const override;
10701070
std::string canonicalName() const override;
10711071
bool isValueType() const override { return true; }
10721072
bool nameable() const override { return true; }
@@ -1153,7 +1153,7 @@ class UserDefinedValueType: public Type
11531153
return false;
11541154
}
11551155

1156-
std::string toString(bool _short) const override;
1156+
std::string toString(bool _withoutDataLocation) const override;
11571157
std::string canonicalName() const override;
11581158
std::string signatureInExternalFunction(bool) const override { solAssert(false, ""); }
11591159

@@ -1179,7 +1179,7 @@ class TupleType: public CompositeType
11791179
std::string richIdentifier() const override;
11801180
bool operator==(Type const& _other) const override;
11811181
TypeResult binaryOperatorResult(Token, Type const*) const override { return nullptr; }
1182-
std::string toString(bool _short) const override;
1182+
std::string toString(bool _withoutDataLocation) const override;
11831183
std::string humanReadableName() const override;
11841184
bool canBeStored() const override { return false; }
11851185
u256 storageSize() const override;
@@ -1383,7 +1383,7 @@ class FunctionType: public Type
13831383
TypeResult binaryOperatorResult(Token, Type const*) const override;
13841384
std::string canonicalName() const override;
13851385
std::string humanReadableName() const override;
1386-
std::string toString(bool _short) const override;
1386+
std::string toString(bool _withoutDataLocation) const override;
13871387
unsigned calldataEncodedSize(bool _padded) const override;
13881388
bool canBeStored() const override { return m_kind == Kind::Internal || m_kind == Kind::External; }
13891389
u256 storageSize() const override;
@@ -1517,7 +1517,7 @@ class MappingType: public CompositeType
15171517

15181518
std::string richIdentifier() const override;
15191519
bool operator==(Type const& _other) const override;
1520-
std::string toString(bool _short) const override;
1520+
std::string toString(bool _withoutDataLocation) const override;
15211521
std::string canonicalName() const override;
15221522
bool containsNestedMapping() const override { return true; }
15231523
TypeResult binaryOperatorResult(Token, Type const*) const override { return nullptr; }
@@ -1558,7 +1558,7 @@ class TypeType: public Type
15581558
bool canBeStored() const override { return false; }
15591559
u256 storageSize() const override;
15601560
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
1561-
std::string toString(bool _short) const override { return "type(" + m_actualType->toString(_short) + ")"; }
1561+
std::string toString(bool _withoutDataLocation) const override { return "type(" + m_actualType->toString(_withoutDataLocation) + ")"; }
15621562
MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override;
15631563

15641564
BoolResult isExplicitlyConvertibleTo(Type const& _convertTo) const override;
@@ -1585,7 +1585,7 @@ class ModifierType: public Type
15851585
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
15861586
std::string richIdentifier() const override;
15871587
bool operator==(Type const& _other) const override;
1588-
std::string toString(bool _short) const override;
1588+
std::string toString(bool _withoutDataLocation) const override;
15891589
protected:
15901590
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override { return {}; }
15911591
private:
@@ -1611,7 +1611,7 @@ class ModuleType: public Type
16111611
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
16121612
MemberList::MemberMap nativeMembers(ASTNode const*) const override;
16131613

1614-
std::string toString(bool _short) const override;
1614+
std::string toString(bool _withoutDataLocation) const override;
16151615

16161616
protected:
16171617
std::vector<std::tuple<std::string, Type const*>> makeStackItems() const override { return {}; }
@@ -1650,7 +1650,7 @@ class MagicType: public Type
16501650
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
16511651
MemberList::MemberMap nativeMembers(ASTNode const*) const override;
16521652

1653-
std::string toString(bool _short) const override;
1653+
std::string toString(bool _withoutDataLocation) const override;
16541654

16551655
Kind kind() const { return m_kind; }
16561656

0 commit comments

Comments
 (0)