aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-03-17 00:30:18 +0800
committerchriseth <c@ethdev.com>2015-03-17 00:30:18 +0800
commitc34e1da6dbc8c66dcdfcb0f09ee0cf8815473124 (patch)
tree75b459a925de1dd1096f7a8c5a4df50564598415
parent27a89a36e10f260521d20d4e54e6d2f710953776 (diff)
parentbb5364dd66a85b287b0dc5b71bd810c7af671b0e (diff)
downloaddexon-solidity-c34e1da6dbc8c66dcdfcb0f09ee0cf8815473124.tar
dexon-solidity-c34e1da6dbc8c66dcdfcb0f09ee0cf8815473124.tar.gz
dexon-solidity-c34e1da6dbc8c66dcdfcb0f09ee0cf8815473124.tar.bz2
dexon-solidity-c34e1da6dbc8c66dcdfcb0f09ee0cf8815473124.tar.lz
dexon-solidity-c34e1da6dbc8c66dcdfcb0f09ee0cf8815473124.tar.xz
dexon-solidity-c34e1da6dbc8c66dcdfcb0f09ee0cf8815473124.tar.zst
dexon-solidity-c34e1da6dbc8c66dcdfcb0f09ee0cf8815473124.zip
Merge pull request #1325 from LefterisJP/sol_MsgSig
Adding msg.sig Solidity Magic type
-rw-r--r--ExpressionCompiler.cpp3
-rw-r--r--Types.cpp3
2 files changed, 5 insertions, 1 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 9391bc2a..92fd7043 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -652,6 +652,9 @@ 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;
diff --git a/Types.cpp b/Types.cpp
index bd55e2a8..70cbec5d 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -1160,7 +1160,8 @@ MagicType::MagicType(MagicType::Kind _kind):
m_members = MemberList({{"sender", make_shared<IntegerType>(0, IntegerType::Modifier::Address)},
{"gas", make_shared<IntegerType>(256)},
{"value", make_shared<IntegerType>(256)},
- {"data", make_shared<ArrayType>(ArrayType::Location::CallData)}});
+ {"data", make_shared<ArrayType>(ArrayType::Location::CallData)},
+ {"sig", make_shared<FixedBytesType>(4)}});
break;
case Kind::Transaction:
m_members = MemberList({{"origin", make_shared<IntegerType>(0, IntegerType::Modifier::Address)},