Move msg.gas to global function gasleft(). Closes #2971.

This commit is contained in:
Daniel Kirchner
2018-03-05 11:18:04 +01:00
parent 5982869e94
commit c633c0eacb
11 changed files with 102 additions and 9 deletions
+6 -1
View File
@@ -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;