aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing
diff options
context:
space:
mode:
authorVoR0220 <rj@erisindustries.com>2016-12-23 02:20:03 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-20 04:49:01 +0800
commit78769f3b39bccbfa02edec302a02377e8fa08a8d (patch)
treea96666346bbc2abf3d2ed8f331b472b2f90fb2a1 /libsolidity/parsing
parent6d6d4f69078a6417e1cfb89942f7df2264d89987 (diff)
downloaddexon-solidity-78769f3b39bccbfa02edec302a02377e8fa08a8d.tar.gz
dexon-solidity-78769f3b39bccbfa02edec302a02377e8fa08a8d.tar.zst
dexon-solidity-78769f3b39bccbfa02edec302a02377e8fa08a8d.zip
Change fixed point types to have digit count
Signed-off-by: VoR0220 <rj@erisindustries.com>
Diffstat (limited to 'libsolidity/parsing')
-rw-r--r--libsolidity/parsing/Token.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/libsolidity/parsing/Token.cpp b/libsolidity/parsing/Token.cpp
index 66312f69..d290bedb 100644
--- a/libsolidity/parsing/Token.cpp
+++ b/libsolidity/parsing/Token.cpp
@@ -70,7 +70,7 @@ void ElementaryTypeNameToken::assertDetails(Token::Value _baseType, unsigned con
else if (_baseType == Token::UFixedMxN || _baseType == Token::FixedMxN)
{
solAssert(
- _first + _second <= 256 && _first % 8 == 0 && _second % 8 == 0,
+ _first <= 256 && _first % 8 == 0 && _second >= 0 && _second <= 80,
"No elementary type " + string(Token::toString(_baseType)) + to_string(_first) + "x" + to_string(_second) + "."
);
}
@@ -157,12 +157,8 @@ tuple<Token::Value, unsigned int, unsigned int> Token::fromIdentifierOrKeyword(s
) {
int n = parseSize(positionX + 1, _literal.end());
if (
- 0 <= m && m <= 256 &&
- 8 <= n && n <= 256 &&
- m + n > 0 &&
- m + n <= 256 &&
- m % 8 == 0 &&
- n % 8 == 0
+ 8 <= m && m <= 256 && m % 8 == 0 &&
+ 0 <= n && n <= 80
) {
if (keyword == Token::UFixed)
return make_tuple(Token::UFixedMxN, m, n);