diff options
author | Christian <c@ethdev.com> | 2014-10-14 00:22:15 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-16 00:40:19 +0800 |
commit | 89b794f1dc15c8688526470b9d68b361dab82be3 (patch) | |
tree | 92db8a29965ee2dd796b22a1508f58b2d199e71e /Token.h | |
parent | bdac5c7b4b5c23ea4f2cfe4a779da05b4722f1be (diff) | |
download | dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.gz dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.bz2 dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.lz dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.xz dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.zst dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.zip |
Type system, not yet complete.
Diffstat (limited to 'Token.h')
-rw-r--r-- | Token.h | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -93,6 +93,7 @@ namespace solidity { T(INIT_CONST, "=init_const", 2) /* AST-use only. */ \ T(INIT_CONST_LEGACY, "=init_const_legacy", 2) /* AST-use only. */ \ T(ASSIGN, "=", 2) \ + /* The following have to be in exactly the same order as the simple binary operators*/ \ T(ASSIGN_BIT_OR, "|=", 2) \ T(ASSIGN_BIT_XOR, "^=", 2) \ T(ASSIGN_BIT_AND, "&=", 2) \ @@ -117,7 +118,6 @@ namespace solidity { T(SHL, "<<", 11) \ T(SAR, ">>", 11) \ T(SHR, ">>>", 11) \ - T(ROR, "rotate right", 11) /* only used by Crankshaft */ \ T(ADD, "+", 12) \ T(SUB, "-", 12) \ T(MUL, "*", 13) \ @@ -181,7 +181,9 @@ namespace solidity { K(WHILE, "while", 0) \ K(WITH, "with", 0) \ \ - /* type keywords, keep them in this order, keep int as first keyword TODO more to be added */ \ + /* type keywords, keep them in this order, keep int as first keyword + * the implementation in Types.cpp has to be synced to this here + * TODO more to be added */ \ K(INT, "int", 0) \ K(INT32, "int32", 0) \ K(INT64, "int64", 0) \ @@ -274,7 +276,7 @@ public: } static bool IsTruncatingBinaryOp(Value op) { - return BIT_OR <= op && op <= ROR; + return BIT_OR <= op && op <= SHR; } static bool IsCompareOp(Value op) { @@ -332,6 +334,11 @@ public: } } + static Value AssignmentToBinaryOp(Value op) { + BOOST_ASSERT(IsAssignmentOp(op) && op != ASSIGN); + return Token::Value(op + (BIT_OR - ASSIGN_BIT_OR)); + } + static bool IsBitOp(Value op) { return (BIT_OR <= op && op <= SHR) || op == BIT_NOT; } |