aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ExpressionCompiler.cpp9
-rw-r--r--Token.h4
-rw-r--r--Types.cpp4
-rw-r--r--Types.h2
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;
diff --git a/Token.h b/Token.h
index 2d4441d0..e5c61c7e 100644
--- a/Token.h
+++ b/Token.h
@@ -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
diff --git a/Types.cpp b/Types.cpp
index 6a1b120c..ae87a088 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -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)}});
diff --git a/Types.h b/Types.h
index 158d58eb..38e50acf 100644
--- a/Types.h
+++ b/Types.h
@@ -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; }