aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-01 00:09:13 +0800
committerchriseth <chris@ethereum.org>2018-08-15 16:45:16 +0800
commit9328ea4c3c023950e59405941cfc25ec4c0ed1b4 (patch)
treee2481f85477a18b935d0fb43d7901ef501175347 /libsolidity/ast
parent3c5226cefb9f883277530decedc08e2e48ed3050 (diff)
downloaddexon-solidity-9328ea4c3c023950e59405941cfc25ec4c0ed1b4.tar.gz
dexon-solidity-9328ea4c3c023950e59405941cfc25ec4c0ed1b4.tar.zst
dexon-solidity-9328ea4c3c023950e59405941cfc25ec4c0ed1b4.zip
Add abi.decode(bytes data, (...))
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/Types.cpp13
-rw-r--r--libsolidity/ast/Types.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 68c201a8..c9dca126 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -2553,6 +2553,7 @@ string FunctionType::richIdentifier() const
case Kind::ABIEncodePacked: id += "abiencodepacked"; break;
case Kind::ABIEncodeWithSelector: id += "abiencodewithselector"; break;
case Kind::ABIEncodeWithSignature: id += "abiencodewithsignature"; break;
+ case Kind::ABIDecode: id += "abidecode"; break;
default: solAssert(false, "Unknown function location."); break;
}
id += "_" + stateMutabilityToString(m_stateMutability);
@@ -2959,7 +2960,8 @@ bool FunctionType::isPure() const
m_kind == Kind::ABIEncode ||
m_kind == Kind::ABIEncodePacked ||
m_kind == Kind::ABIEncodeWithSelector ||
- m_kind == Kind::ABIEncodeWithSignature;
+ m_kind == Kind::ABIEncodeWithSignature ||
+ m_kind == Kind::ABIDecode;
}
TypePointers FunctionType::parseElementaryTypeVector(strings const& _types)
@@ -3315,6 +3317,15 @@ MemberList::MemberMap MagicType::nativeMembers(ContractDefinition const*) const
FunctionType::Kind::ABIEncodeWithSignature,
true,
StateMutability::Pure
+ )},
+ {"decode", make_shared<FunctionType>(
+ TypePointers(),
+ TypePointers(),
+ strings{},
+ strings{},
+ FunctionType::Kind::ABIDecode,
+ true,
+ StateMutability::Pure
)}
});
default:
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index 34f862c3..d8e73ab9 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -934,6 +934,7 @@ public:
ABIEncodePacked,
ABIEncodeWithSelector,
ABIEncodeWithSignature,
+ ABIDecode,
GasLeft ///< gasleft()
};