aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-03-03 00:58:27 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-03-05 18:18:04 +0800
commitc633c0eacba12e940b12c6ff58b5c6c55dc0122c (patch)
tree9b54278c28df1c2fb97916c9ec7e263faea1b97d /libsolidity/ast
parent5982869e94965e48ec680fd32e6f80b8211fc34c (diff)
downloaddexon-solidity-c633c0eacba12e940b12c6ff58b5c6c55dc0122c.tar.gz
dexon-solidity-c633c0eacba12e940b12c6ff58b5c6c55dc0122c.tar.zst
dexon-solidity-c633c0eacba12e940b12c6ff58b5c6c55dc0122c.zip
Move msg.gas to global function gasleft(). Closes #2971.
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/Types.cpp14
-rw-r--r--libsolidity/ast/Types.h3
2 files changed, 12 insertions, 5 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 771ae643..bde0dd6e 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -3000,8 +3000,10 @@ bool MagicType::operator==(Type const& _other) const
return other.m_kind == m_kind;
}
-MemberList::MemberMap MagicType::nativeMembers(ContractDefinition const*) const
+MemberList::MemberMap MagicType::nativeMembers(ContractDefinition const *_contract) const
{
+ solAssert(_contract, "");
+ const bool v050 = _contract->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050);
switch (m_kind)
{
case Kind::Block:
@@ -3014,13 +3016,17 @@ MemberList::MemberMap MagicType::nativeMembers(ContractDefinition const*) const
{"gaslimit", make_shared<IntegerType>(256)}
});
case Kind::Message:
- return MemberList::MemberMap({
+ {
+ std::vector<MemberList::Member> members = {
{"sender", make_shared<IntegerType>(160, IntegerType::Modifier::Address)},
- {"gas", make_shared<IntegerType>(256)},
{"value", make_shared<IntegerType>(256)},
{"data", make_shared<ArrayType>(DataLocation::CallData)},
{"sig", make_shared<FixedBytesType>(4)}
- });
+ };
+ if (!v050)
+ members.emplace_back("gas", make_shared<IntegerType>(256));
+ return MemberList::MemberMap(members);
+ }
case Kind::Transaction:
return MemberList::MemberMap({
{"origin", make_shared<IntegerType>(160, IntegerType::Modifier::Address)},
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index 7985521e..c20a025f 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -902,7 +902,8 @@ public:
ByteArrayPush, ///< .push() to a dynamically sized byte array in storage
ObjectCreation, ///< array creation using new
Assert, ///< assert()
- Require ///< require()
+ Require, ///< require()
+ GasLeft ///< gasleft()
};
virtual Category category() const override { return Category::Function; }