[isoltest] Reworks (default) ABI Type construction.

This commit is contained in:
Erik Kundt 2019-07-21 16:04:04 +02:00
parent d9b98bf7af
commit 07051f41d2
2 changed files with 24 additions and 3 deletions

View File

@ -14,6 +14,7 @@
#pragma once
#include <libdevcore/AnsiColorized.h>
#include <libdevcore/CommonData.h>
#include <libsolidity/ast/Types.h>
@ -111,9 +112,23 @@ struct ABIType
AlignRight,
AlignNone,
};
explicit ABIType(
Type _type,
Align _align = ABIType::AlignRight,
size_t _size = 32
): type(_type), align(_align), size(_size) {}
ABIType(ABIType const& _other):
type(_other.type),
align(_other.align),
size(_other.size),
alignDeclared(_other.alignDeclared)
{}
Type type = ABIType::None;
Align align = ABIType::AlignRight;
size_t size = 0;
size_t size = 32;
bool alignDeclared = false;
};
@ -130,7 +145,7 @@ struct FormatInfo
* Parameter abstraction used for the encoding and decoding of
* function parameter and expectation / return value lists.
* A parameter list is usually a comma-separated list of literals.
* It should not be possible to call create a parameter holding
* It should not be possible to create a parameter holding
* an identifier, but if so, the ABI type would be invalid.
*/
struct Parameter
@ -154,12 +169,17 @@ struct Parameter
/// Types that were used to encode `rawBytes`. Expectations
/// are usually comma separated literals. Their type is auto-
/// detected and retained in order to format them later on.
ABIType abiType;
ABIType abiType = ABIType{ABIType::UnsignedDec, ABIType::AlignRight, 32};
/// Format info attached to the parameter. It handles newlines given
/// in the declaration of it.
FormatInfo format;
/// Stores the parsed alignment, which can be either left(...) or right(...).
Alignment alignment = Alignment::None;
/// Compares _bytes to the bytes stored in this object.
bool matchesBytes(bytes const& _bytes) const
{
return rawBytes == _bytes;
}
};
using ParameterList = std::vector<Parameter>;

View File

@ -234,6 +234,7 @@ Parameter TestFileParser::parseParameter()
parameter.format.newline = true;
m_lineNumber++;
}
parameter.abiType = ABIType{ABIType::None, ABIType::AlignNone, 0};
bool isSigned = false;
if (accept(Token::Left, true))