diff options
-rw-r--r-- | ExpressionCompiler.cpp | 9 | ||||
-rw-r--r-- | Token.h | 4 | ||||
-rw-r--r-- | Types.cpp | 4 | ||||
-rw-r--r-- | Types.h | 2 |
4 files changed, 15 insertions, 4 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index bcb57737..2b6e53cb 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -326,6 +326,13 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) m_context << u256(32) << u256(0) << eth::logInstruction(logNumber); break; } + case Location::BLOCKHASH: + { + arguments[0]->accept(*this); + appendTypeConversion(*arguments[0]->getType(), *function.getParameterTypes()[0], true); + m_context << eth::Instruction::BLOCKHASH; + break; + } case Location::ECRECOVER: case Location::SHA256: case Location::RIPEMD160: @@ -344,7 +351,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) return false; } -bool ExpressionCompiler::visit(NewExpression const& _newExpression) +bool ExpressionCompiler::visit(NewExpression const&) { // code is created for the function call (CREATION) only return false; @@ -47,6 +47,10 @@ #include <libsolidity/Utils.h> #include <libsolidity/Exceptions.h> +#if defined(DELETE) +#error The macro "DELETE" from windows.h conflicts with this file. Please change the order of includes. +#endif + namespace dev { namespace solidity @@ -693,8 +693,8 @@ MagicType::MagicType(MagicType::Kind _kind): { case Kind::BLOCK: m_members = MemberList({{"coinbase", make_shared<IntegerType>(0, IntegerType::Modifier::ADDRESS)}, - {"timestamp", make_shared<IntegerType >(256)}, - {"prevhash", make_shared<IntegerType>(256, IntegerType::Modifier::HASH)}, + {"timestamp", make_shared<IntegerType>(256)}, + {"blockhash", make_shared<FunctionType>(strings{"uint"}, strings{"hash"}, FunctionType::Location::BLOCKHASH)}, {"difficulty", make_shared<IntegerType>(256)}, {"number", make_shared<IntegerType>(256)}, {"gaslimit", make_shared<IntegerType>(256)}}); @@ -354,7 +354,7 @@ public: SHA3, SUICIDE, ECRECOVER, SHA256, RIPEMD160, LOG0, LOG1, LOG2, LOG3, LOG4, - SET_GAS, SET_VALUE, + SET_GAS, SET_VALUE, BLOCKHASH, BARE }; virtual Category getCategory() const override { return Category::FUNCTION; } |