aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-03-14 00:36:00 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-03-16 19:59:56 +0800
commitd7ffba150458f947c03741f1b528d45eb6c8771a (patch)
treef4142709379a19c8ffd18531c075c94ee0309b2e /ExpressionCompiler.cpp
parent039b133c180b15863ee3104637c97822d815d932 (diff)
downloaddexon-solidity-d7ffba150458f947c03741f1b528d45eb6c8771a.tar.gz
dexon-solidity-d7ffba150458f947c03741f1b528d45eb6c8771a.tar.zst
dexon-solidity-d7ffba150458f947c03741f1b528d45eb6c8771a.zip
Adding msg.sig Solidity Magic type
msg.sig will return a bytes4 with the function signature located in CALLDATALOAD
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 3cee40df..07f4e94e 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -646,6 +646,8 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
m_context << eth::Instruction::GASPRICE;
else if (member == "data")
m_context << u256(0) << eth::Instruction::CALLDATASIZE;
+ else if (member == "sig")
+ m_context << u256(0) << eth::Instruction::CALLDATALOAD << (u256(0xffffffff) << (256 - 32))<< eth::Instruction::AND;
else
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unknown magic member."));
break;