@@ -54,7 +54,7 @@ static_assert(CompilerUtils::generalPurposeMemoryStart >= CompilerUtils::zeroPoi
54
54
void CompilerUtils::initialiseFreeMemoryPointer ()
55
55
{
56
56
size_t reservedMemory = m_context.reservedMemory ();
57
- solAssert (bigint (generalPurposeMemoryStart) + bigint (reservedMemory) < bigint (1 ) << 63 , " " );
57
+ solAssert (bigint (generalPurposeMemoryStart) + bigint (reservedMemory) < bigint (1 ) << 63 );
58
58
m_context << (u256 (generalPurposeMemoryStart) + reservedMemory);
59
59
storeFreeMemoryPointer ();
60
60
}
@@ -92,7 +92,7 @@ void CompilerUtils::toSizeAfterFreeMemoryPointer()
92
92
93
93
void CompilerUtils::revertWithStringData (Type const & _argumentType)
94
94
{
95
- solAssert (_argumentType.isImplicitlyConvertibleTo (*TypeProvider::fromElementaryTypeName (" string memory" )), " " );
95
+ solAssert (_argumentType.isImplicitlyConvertibleTo (*TypeProvider::fromElementaryTypeName (" string memory" )));
96
96
fetchFreeMemoryPointer ();
97
97
m_context << util::selectorFromSignature (" Error(string)" );
98
98
m_context << Instruction::DUP2 << Instruction::MSTORE;
@@ -173,9 +173,9 @@ void CompilerUtils::loadFromMemoryDynamic(
173
173
174
174
if (auto arrayType = dynamic_cast <ArrayType const *>(&_type))
175
175
{
176
- solAssert (!arrayType->isDynamicallySized (), " " );
177
- solAssert (!_fromCalldata, " " );
178
- solAssert (_padToWordBoundaries, " " );
176
+ solAssert (!arrayType->isDynamicallySized ());
177
+ solAssert (!_fromCalldata);
178
+ solAssert (_padToWordBoundaries);
179
179
if (_keepUpdatedMemoryOffset)
180
180
m_context << arrayType->memoryDataSize () << Instruction::ADD;
181
181
}
@@ -251,7 +251,7 @@ void CompilerUtils::abiDecode(TypePointers const& _typeParameters, bool _fromMem
251
251
// Use the new Yul-based decoding function
252
252
auto stackHeightBefore = m_context.stackHeight ();
253
253
abiDecodeV2 (_typeParameters, _fromMemory);
254
- solAssert (m_context.stackHeight () - stackHeightBefore == sizeOnStack (_typeParameters) - 2 , " " );
254
+ solAssert (m_context.stackHeight () - stackHeightBefore == sizeOnStack (_typeParameters) - 2 );
255
255
return ;
256
256
}
257
257
@@ -290,7 +290,7 @@ void CompilerUtils::abiDecode(TypePointers const& _typeParameters, bool _fromMem
290
290
);
291
291
// @todo If base type is an array or struct, it is still calldata-style encoded, so
292
292
// we would have to convert it like below.
293
- solAssert (arrayType.location () == DataLocation::Memory, " " );
293
+ solAssert (arrayType.location () == DataLocation::Memory);
294
294
if (arrayType.isDynamicallySized ())
295
295
{
296
296
// compute data pointer
@@ -430,7 +430,7 @@ void CompilerUtils::encodeToMemory(
430
430
// stack: <v1> <v2> ... <vn> <mem>
431
431
bool const encoderV2 = m_context.useABICoderV2 ();
432
432
TypePointers targetTypes = _targetTypes.empty () ? _givenTypes : _targetTypes;
433
- solAssert (targetTypes.size () == _givenTypes.size (), " " );
433
+ solAssert (targetTypes.size () == _givenTypes.size ());
434
434
for (Type const *& t: targetTypes)
435
435
{
436
436
Type const * tEncoding = t->fullEncodingType (_encodeAsLibraryTypes, encoderV2, !_padToWordBoundaries);
@@ -449,7 +449,7 @@ void CompilerUtils::encodeToMemory(
449
449
);
450
450
auto stackHeightBefore = m_context.stackHeight ();
451
451
abiEncodeV2 (_givenTypes, targetTypes, _encodeAsLibraryTypes, _padToWordBoundaries);
452
- solAssert (stackHeightBefore - m_context.stackHeight () == sizeOnStack (_givenTypes), " " );
452
+ solAssert (stackHeightBefore - m_context.stackHeight () == sizeOnStack (_givenTypes));
453
453
return ;
454
454
}
455
455
@@ -489,8 +489,8 @@ void CompilerUtils::encodeToMemory(
489
489
{
490
490
// special case: convert storage reference type to value type - this is only
491
491
// possible for library calls where we just forward the storage reference
492
- solAssert (_encodeAsLibraryTypes, " " );
493
- solAssert (_givenTypes[i]->sizeOnStack () == 1 , " " );
492
+ solAssert (_encodeAsLibraryTypes);
493
+ solAssert (_givenTypes[i]->sizeOnStack () == 1 );
494
494
}
495
495
else if (
496
496
_givenTypes[i]->dataStoredIn (DataLocation::Storage) ||
@@ -638,7 +638,7 @@ void CompilerUtils::zeroInitialiseMemoryArray(ArrayType const& _type)
638
638
{
639
639
if (_type.baseType ()->hasSimpleZeroValueInMemory ())
640
640
{
641
- solAssert (_type.baseType ()->isValueType (), " " );
641
+ solAssert (_type.baseType ()->isValueType ());
642
642
Whiskers templ (R"( {
643
643
let size := mul(length, <element_size>)
644
644
// cheap way of zero-initializing a memory range
@@ -774,9 +774,9 @@ void CompilerUtils::convertType(
774
774
775
775
if (stackTypeCategory == Type::Category::UserDefinedValueType)
776
776
{
777
- solAssert (_cleanupNeeded, " " );
777
+ solAssert (_cleanupNeeded);
778
778
auto & userDefined = dynamic_cast <UserDefinedValueType const &>(_typeOnStack);
779
- solAssert (_typeOnStack == _targetType || _targetType == userDefined.underlyingType (), " " );
779
+ solAssert (_typeOnStack == _targetType || _targetType == userDefined.underlyingType ());
780
780
return convertType (
781
781
userDefined.underlyingType (),
782
782
_targetType,
@@ -787,9 +787,9 @@ void CompilerUtils::convertType(
787
787
}
788
788
if (targetTypeCategory == Type::Category::UserDefinedValueType)
789
789
{
790
- solAssert (_cleanupNeeded, " " );
790
+ solAssert (_cleanupNeeded);
791
791
auto & userDefined = dynamic_cast <UserDefinedValueType const &>(_targetType);
792
- solAssert (_typeOnStack.isImplicitlyConvertibleTo (userDefined.underlyingType ()), " " );
792
+ solAssert (_typeOnStack.isImplicitlyConvertibleTo (userDefined.underlyingType ()));
793
793
return convertType (
794
794
_typeOnStack,
795
795
userDefined.underlyingType (),
@@ -829,7 +829,7 @@ void CompilerUtils::convertType(
829
829
}
830
830
else if (targetTypeCategory == Type::Category::Address)
831
831
{
832
- solAssert (typeOnStack.numBytes () * 8 == 160 , " " );
832
+ solAssert (typeOnStack.numBytes () * 8 == 160 );
833
833
rightShiftNumberOnStack (256 - 160 );
834
834
}
835
835
else
@@ -849,7 +849,7 @@ void CompilerUtils::convertType(
849
849
break ;
850
850
}
851
851
case Type::Category::Enum:
852
- solAssert (_targetType == _typeOnStack || targetTypeCategory == Type::Category::Integer, " " );
852
+ solAssert (_targetType == _typeOnStack || targetTypeCategory == Type::Category::Integer);
853
853
if (enumOverflowCheckPending)
854
854
{
855
855
EnumType const & enumType = dynamic_cast <decltype (enumType)>(_typeOnStack);
@@ -885,13 +885,13 @@ void CompilerUtils::convertType(
885
885
cleanHigherOrderBits (*typeOnStack);
886
886
}
887
887
else if (stackTypeCategory == Type::Category::Address)
888
- solAssert (targetBytesType.numBytes () * 8 == 160 , " " );
888
+ solAssert (targetBytesType.numBytes () * 8 == 160 );
889
889
leftShiftNumberOnStack (256 - targetBytesType.numBytes () * 8 );
890
890
}
891
891
else if (targetTypeCategory == Type::Category::Enum)
892
892
{
893
893
solAssert (stackTypeCategory != Type::Category::Address, " Invalid conversion to EnumType requested." );
894
- solAssert (_typeOnStack.mobileType (), " " );
894
+ solAssert (_typeOnStack.mobileType ());
895
895
// just clean
896
896
convertType (_typeOnStack, *_typeOnStack.mobileType (), true );
897
897
EnumType const & enumType = dynamic_cast <decltype (enumType)>(_targetType);
@@ -964,13 +964,13 @@ void CompilerUtils::convertType(
964
964
if (targetTypeCategory == Type::Category::FixedBytes)
965
965
{
966
966
unsigned const numBytes = dynamic_cast <FixedBytesType const &>(_targetType).numBytes ();
967
- solAssert (data.size () <= 32 , " " );
967
+ solAssert (data.size () <= 32 );
968
968
m_context << (u256 (h256 (data, h256::AlignLeft)) & (~(u256 (-1 ) >> (8 * numBytes))));
969
969
}
970
970
else if (targetTypeCategory == Type::Category::Array)
971
971
{
972
972
auto const & arrayType = dynamic_cast <ArrayType const &>(_targetType);
973
- solAssert (arrayType.isByteArray (), " " );
973
+ solAssert (arrayType.isByteArray ());
974
974
size_t storageSize = 32 + ((data.size () + 31 ) / 32 ) * 32 ;
975
975
allocateMemory (storageSize);
976
976
// stack: mempos
@@ -995,10 +995,10 @@ void CompilerUtils::convertType(
995
995
typeOnStack.isByteArray () && !typeOnStack.isString (),
996
996
" Array types other than bytes not convertible to bytesNN."
997
997
);
998
- solAssert (typeOnStack.isDynamicallySized (), " " );
998
+ solAssert (typeOnStack.isDynamicallySized ());
999
999
1000
1000
bool fromCalldata = typeOnStack.dataStoredIn (DataLocation::CallData);
1001
- solAssert (typeOnStack.sizeOnStack () == (fromCalldata ? 2 : 1 ), " " );
1001
+ solAssert (typeOnStack.sizeOnStack () == (fromCalldata ? 2 : 1 ));
1002
1002
if (fromCalldata)
1003
1003
m_context << Instruction::SWAP1;
1004
1004
@@ -1012,7 +1012,7 @@ void CompilerUtils::convertType(
1012
1012
);
1013
1013
break ;
1014
1014
}
1015
- solAssert (targetTypeCategory == stackTypeCategory, " " );
1015
+ solAssert (targetTypeCategory == stackTypeCategory);
1016
1016
auto const & targetType = dynamic_cast <ArrayType const &>(_targetType);
1017
1017
switch (targetType.location ())
1018
1018
{
@@ -1034,9 +1034,9 @@ void CompilerUtils::convertType(
1034
1034
typeOnStack.baseType ()->isDynamicallyEncoded ()
1035
1035
)
1036
1036
{
1037
- solAssert (m_context.useABICoderV2 (), " " );
1037
+ solAssert (m_context.useABICoderV2 ());
1038
1038
// stack: offset length(optional in case of dynamically sized array)
1039
- solAssert (typeOnStack.sizeOnStack () == (typeOnStack.isDynamicallySized () ? 2 : 1 ), " " );
1039
+ solAssert (typeOnStack.sizeOnStack () == (typeOnStack.isDynamicallySized () ? 2 : 1 ));
1040
1040
if (typeOnStack.isDynamicallySized ())
1041
1041
m_context << Instruction::SWAP1;
1042
1042
@@ -1122,9 +1122,9 @@ void CompilerUtils::convertType(
1122
1122
typeOnStack.arrayType ().isByteArray () && !typeOnStack.arrayType ().isString (),
1123
1123
" Array types other than bytes not convertible to bytesNN."
1124
1124
);
1125
- solAssert (typeOnStack.isDynamicallySized (), " " );
1126
- solAssert (typeOnStack.dataStoredIn (DataLocation::CallData), " " );
1127
- solAssert (typeOnStack.sizeOnStack () == 2 , " " );
1125
+ solAssert (typeOnStack.isDynamicallySized ());
1126
+ solAssert (typeOnStack.dataStoredIn (DataLocation::CallData));
1127
+ solAssert (typeOnStack.sizeOnStack () == 2 );
1128
1128
1129
1129
m_context << Instruction::SWAP1;
1130
1130
m_context.callYulFunction (
@@ -1138,22 +1138,24 @@ void CompilerUtils::convertType(
1138
1138
break ;
1139
1139
}
1140
1140
1141
- solAssert (_targetType.category () == Type::Category::Array, " " );
1141
+ solAssert (_targetType.category () == Type::Category::Array);
1142
1142
auto const & targetArrayType = dynamic_cast <ArrayType const &>(_targetType);
1143
- solAssert (typeOnStack.arrayType ().isImplicitlyConvertibleTo (targetArrayType), " " );
1143
+ solAssert (
1144
+ typeOnStack.arrayType ().isImplicitlyConvertibleTo (targetArrayType) ||
1145
+ (typeOnStack.arrayType ().isByteArray () && targetArrayType.isByteArray ())
1146
+ );
1144
1147
solAssert (
1145
1148
typeOnStack.arrayType ().dataStoredIn (DataLocation::CallData) &&
1146
1149
typeOnStack.arrayType ().isDynamicallySized () &&
1147
- !typeOnStack.arrayType ().baseType ()->isDynamicallyEncoded (),
1148
- " "
1150
+ !typeOnStack.arrayType ().baseType ()->isDynamicallyEncoded ()
1149
1151
);
1150
1152
if (!_targetType.dataStoredIn (DataLocation::CallData))
1151
1153
return convertType (typeOnStack.arrayType (), _targetType);
1152
1154
break ;
1153
1155
}
1154
1156
case Type::Category::Struct:
1155
1157
{
1156
- solAssert (targetTypeCategory == stackTypeCategory, " " );
1158
+ solAssert (targetTypeCategory == stackTypeCategory);
1157
1159
auto & targetType = dynamic_cast <StructType const &>(_targetType);
1158
1160
auto & typeOnStack = dynamic_cast <StructType const &>(_typeOnStack);
1159
1161
switch (targetType.location ())
@@ -1182,7 +1184,7 @@ void CompilerUtils::convertType(
1182
1184
// stack: <memory ptr> <source ref> <memory ptr>
1183
1185
for (auto const & member: typeOnStack->members (nullptr ))
1184
1186
{
1185
- solAssert (!member.type ->containsNestedMapping (), " " );
1187
+ solAssert (!member.type ->containsNestedMapping ());
1186
1188
pair<u256, unsigned > const & offsets = typeOnStack->storageOffsetsOfMember (member.name );
1187
1189
_context << offsets.first << Instruction::DUP3 << Instruction::ADD;
1188
1190
_context << u256 (offsets.second );
@@ -1209,7 +1211,7 @@ void CompilerUtils::convertType(
1209
1211
{
1210
1212
if (typeOnStack.isDynamicallyEncoded ())
1211
1213
{
1212
- solAssert (m_context.useABICoderV2 (), " " );
1214
+ solAssert (m_context.useABICoderV2 ());
1213
1215
m_context.callYulFunction (
1214
1216
m_context.utilFunctions ().conversionFunction (typeOnStack, targetType),
1215
1217
1 ,
@@ -1231,7 +1233,7 @@ void CompilerUtils::convertType(
1231
1233
}
1232
1234
break ;
1233
1235
case DataLocation::CallData:
1234
- solAssert (_typeOnStack == _targetType, " " );
1236
+ solAssert (_typeOnStack == _targetType);
1235
1237
// nothing to do
1236
1238
break ;
1237
1239
}
@@ -1241,15 +1243,15 @@ void CompilerUtils::convertType(
1241
1243
{
1242
1244
TupleType const & sourceTuple = dynamic_cast <TupleType const &>(_typeOnStack);
1243
1245
TupleType const & targetTuple = dynamic_cast <TupleType const &>(_targetType);
1244
- solAssert (targetTuple.components ().size () == sourceTuple.components ().size (), " " );
1246
+ solAssert (targetTuple.components ().size () == sourceTuple.components ().size ());
1245
1247
unsigned depth = sourceTuple.sizeOnStack ();
1246
1248
for (size_t i = 0 ; i < sourceTuple.components ().size (); ++i)
1247
1249
{
1248
1250
Type const * sourceType = sourceTuple.components ()[i];
1249
1251
Type const * targetType = targetTuple.components ()[i];
1250
1252
if (!sourceType)
1251
1253
{
1252
- solAssert (!targetType, " " );
1254
+ solAssert (!targetType);
1253
1255
continue ;
1254
1256
}
1255
1257
unsigned sourceSize = sourceType->sizeOnStack ();
@@ -1291,7 +1293,7 @@ void CompilerUtils::convertType(
1291
1293
break ;
1292
1294
default :
1293
1295
// we used to allow conversions from function to address
1294
- solAssert (!(stackTypeCategory == Type::Category::Function && targetTypeCategory == Type::Category::Address), " " );
1296
+ solAssert (!(stackTypeCategory == Type::Category::Function && targetTypeCategory == Type::Category::Address));
1295
1297
if (stackTypeCategory == Type::Category::Function && targetTypeCategory == Type::Category::Function)
1296
1298
{
1297
1299
FunctionType const & typeOnStack = dynamic_cast <FunctionType const &>(_typeOnStack);
@@ -1348,14 +1350,14 @@ void CompilerUtils::pushZeroValue(Type const& _type)
1348
1350
}
1349
1351
if (referenceType->location () == DataLocation::CallData)
1350
1352
{
1351
- solAssert (referenceType->sizeOnStack () == 1 || referenceType->sizeOnStack () == 2 , " " );
1353
+ solAssert (referenceType->sizeOnStack () == 1 || referenceType->sizeOnStack () == 2 );
1352
1354
m_context << Instruction::CALLDATASIZE;
1353
1355
if (referenceType->sizeOnStack () == 2 )
1354
1356
m_context << 0 ;
1355
1357
return ;
1356
1358
}
1357
1359
1358
- solAssert (referenceType->location () == DataLocation::Memory, " " );
1360
+ solAssert (referenceType->location () == DataLocation::Memory);
1359
1361
if (auto arrayType = dynamic_cast <ArrayType const *>(&_type))
1360
1362
if (arrayType->isDynamicallySized ())
1361
1363
{
@@ -1383,7 +1385,7 @@ void CompilerUtils::pushZeroValue(Type const& _type)
1383
1385
}
1384
1386
else if (auto arrayType = dynamic_cast <ArrayType const *>(type))
1385
1387
{
1386
- solAssert (!arrayType->isDynamicallySized (), " " );
1388
+ solAssert (!arrayType->isDynamicallySized ());
1387
1389
if (arrayType->length () > 0 )
1388
1390
{
1389
1391
_context << arrayType->length () << Instruction::SWAP1;
@@ -1483,7 +1485,7 @@ void CompilerUtils::popStackSlots(size_t _amount)
1483
1485
1484
1486
void CompilerUtils::popAndJump (unsigned _toHeight, evmasm::AssemblyItem const & _jumpTo)
1485
1487
{
1486
- solAssert (m_context.stackHeight () >= _toHeight, " " );
1488
+ solAssert (m_context.stackHeight () >= _toHeight);
1487
1489
unsigned amount = m_context.stackHeight () - _toHeight;
1488
1490
popStackSlots (amount);
1489
1491
m_context.appendJumpTo (_jumpTo);
@@ -1551,7 +1553,7 @@ void CompilerUtils::storeStringData(bytesConstRef _data)
1551
1553
1552
1554
unsigned CompilerUtils::loadFromMemoryHelper (Type const & _type, bool _fromCalldata, bool _padToWords)
1553
1555
{
1554
- solAssert (_type.isValueType (), " " );
1556
+ solAssert (_type.isValueType ());
1555
1557
Type const * type = &_type;
1556
1558
if (auto const * userDefined = dynamic_cast <UserDefinedValueType const *>(type))
1557
1559
type = &userDefined->underlyingType ();
@@ -1603,7 +1605,7 @@ void CompilerUtils::cleanHigherOrderBits(IntegerType const& _typeOnStack)
1603
1605
1604
1606
void CompilerUtils::leftShiftNumberOnStack (unsigned _bits)
1605
1607
{
1606
- solAssert (_bits < 256 , " " );
1608
+ solAssert (_bits < 256 );
1607
1609
if (m_context.evmVersion ().hasBitwiseShifting ())
1608
1610
m_context << _bits << Instruction::SHL;
1609
1611
else
@@ -1612,7 +1614,7 @@ void CompilerUtils::leftShiftNumberOnStack(unsigned _bits)
1612
1614
1613
1615
void CompilerUtils::rightShiftNumberOnStack (unsigned _bits)
1614
1616
{
1615
- solAssert (_bits < 256 , " " );
1617
+ solAssert (_bits < 256 );
1616
1618
// NOTE: If we add signed right shift, SAR rounds differently than SDIV
1617
1619
if (m_context.evmVersion ().hasBitwiseShifting ())
1618
1620
m_context << _bits << Instruction::SHR;
@@ -1627,7 +1629,7 @@ unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWords,
1627
1629
" Memory store of types with stack size != 1 not allowed (Type: " + _type.toString (true ) + " )."
1628
1630
);
1629
1631
1630
- solAssert (!_type.isDynamicallyEncoded (), " " );
1632
+ solAssert (!_type.isDynamicallyEncoded ());
1631
1633
1632
1634
unsigned numBytes = _type.calldataEncodedSize (_padToWords);
1633
1635
0 commit comments