From c633c0eacba12e940b12c6ff58b5c6c55dc0122c Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 2 Mar 2018 17:58:27 +0100 Subject: Move msg.gas to global function gasleft(). Closes #2971. --- libsolidity/codegen/ExpressionCompiler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libsolidity/codegen/ExpressionCompiler.cpp') diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 61920592..d3599367 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -906,6 +906,9 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) m_context << success; break; } + case FunctionType::Kind::GasLeft: + m_context << Instruction::GAS; + break; default: solAssert(false, "Invalid function type."); } @@ -921,6 +924,8 @@ bool ExpressionCompiler::visit(NewExpression const&) bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) { + const bool v050 = m_context.experimentalFeatureActive(ExperimentalFeature::V050); + CompilerContext::LocationSetter locationSetter(m_context, _memberAccess); // Check whether the member is a bound function. ASTString const& member = _memberAccess.memberName(); @@ -1135,7 +1140,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) m_context << Instruction::CALLVALUE; else if (member == "origin") m_context << Instruction::ORIGIN; - else if (member == "gas") + else if (!v050 && member == "gas") m_context << Instruction::GAS; else if (member == "gasprice") m_context << Instruction::GASPRICE; -- cgit