Magic variables get negative ids for easy differentiation
| 38 | |
| 39 | /// Magic variables get negative ids for easy differentiation |
| 40 | int magicVariableToID(std::string const& _name) |
| 41 | { |
| 42 | static std::unordered_map<std::string, int> const magicVariables = { |
| 43 | {"abi", -1}, |
| 44 | {"addmod", -2}, |
| 45 | {"assert", -3}, |
| 46 | {"block", -4}, |
| 47 | {"blockhash", -5}, |
| 48 | {"ecrecover", -6}, |
| 49 | {"gasleft", -7}, |
| 50 | {"keccak256", -8}, |
| 51 | {"msg", -15}, |
| 52 | {"mulmod", -16}, |
| 53 | {"now", -17}, |
| 54 | {"require", -18}, |
| 55 | {"revert", -19}, |
| 56 | {"ripemd160", -20}, |
| 57 | {"selfdestruct", -21}, |
| 58 | {"sha256", -22}, |
| 59 | {"sha3", -23}, |
| 60 | {"suicide", -24}, |
| 61 | {"super", -25}, |
| 62 | {"tx", -26}, |
| 63 | {"type", -27}, |
| 64 | {"this", -28}, |
| 65 | {"blobhash", -29}, |
| 66 | {"erc7201", -30} |
| 67 | }; |
| 68 | |
| 69 | if (auto id = magicVariables.find(_name); id != magicVariables.end()) |
| 70 | return id->second; |
| 71 | solAssert(false, "Unknown magic variable: \"" + _name + "\"."); |
| 72 | } |
| 73 | |
| 74 | inline std::vector<std::shared_ptr<MagicVariableDeclaration const>> constructMagicVariables(langutil::EVMVersion _evmVersion) |
| 75 | { |
no test coverage detected