Remove "using namespace" from header and move Instruction to dev::eth.

This commit is contained in:
chriseth
2019-03-28 13:48:11 +01:00
parent 77b8b4874d
commit 2308904f68
66 changed files with 190 additions and 220 deletions
+17 -13
View File
@@ -41,9 +41,9 @@ using namespace dev;
using namespace langutil;
using namespace yul;
using namespace dev;
using namespace dev::solidity;
namespace {
namespace
{
set<string> const builtinTypes{"bool", "u8", "s8", "u32", "s32", "u64", "s64", "u128", "s128", "u256", "s256"};
@@ -86,7 +86,7 @@ bool AsmAnalyzer::operator()(Label const& _label)
"The use of labels is disallowed. Please use \"if\", \"switch\", \"for\" or function calls instead."
);
m_info.stackHeightInfo[&_label] = m_stackHeight;
warnOnInstructions(solidity::Instruction::JUMPDEST, _label.location);
warnOnInstructions(dev::eth::Instruction::JUMPDEST, _label.location);
return true;
}
@@ -653,7 +653,7 @@ void AsmAnalyzer::expectValidType(string const& type, SourceLocation const& _loc
);
}
void AsmAnalyzer::warnOnInstructions(solidity::Instruction _instr, SourceLocation const& _location)
void AsmAnalyzer::warnOnInstructions(dev::eth::Instruction _instr, SourceLocation const& _location)
{
// We assume that returndatacopy, returndatasize and staticcall are either all available
// or all not available.
@@ -677,33 +677,37 @@ void AsmAnalyzer::warnOnInstructions(solidity::Instruction _instr, SourceLocatio
};
if ((
_instr == solidity::Instruction::RETURNDATACOPY ||
_instr == solidity::Instruction::RETURNDATASIZE
_instr == dev::eth::Instruction::RETURNDATACOPY ||
_instr == dev::eth::Instruction::RETURNDATASIZE
) && !m_evmVersion.supportsReturndata())
{
errorForVM("only available for Byzantium-compatible");
}
else if (_instr == solidity::Instruction::STATICCALL && !m_evmVersion.hasStaticCall())
else if (_instr == dev::eth::Instruction::STATICCALL && !m_evmVersion.hasStaticCall())
{
errorForVM("only available for Byzantium-compatible");
}
else if ((
_instr == solidity::Instruction::SHL ||
_instr == solidity::Instruction::SHR ||
_instr == solidity::Instruction::SAR
_instr == dev::eth::Instruction::SHL ||
_instr == dev::eth::Instruction::SHR ||
_instr == dev::eth::Instruction::SAR
) && !m_evmVersion.hasBitwiseShifting())
{
errorForVM("only available for Constantinople-compatible");
}
else if (_instr == solidity::Instruction::CREATE2 && !m_evmVersion.hasCreate2())
else if (_instr == dev::eth::Instruction::CREATE2 && !m_evmVersion.hasCreate2())
{
errorForVM("only available for Constantinople-compatible");
}
else if (_instr == solidity::Instruction::EXTCODEHASH && !m_evmVersion.hasExtCodeHash())
else if (_instr == dev::eth::Instruction::EXTCODEHASH && !m_evmVersion.hasExtCodeHash())
{
errorForVM("only available for Constantinople-compatible");
}
else if (_instr == solidity::Instruction::JUMP || _instr == solidity::Instruction::JUMPI || _instr == solidity::Instruction::JUMPDEST)
else if (
_instr == dev::eth::Instruction::JUMP ||
_instr == dev::eth::Instruction::JUMPI ||
_instr == dev::eth::Instruction::JUMPDEST
)
{
if (m_dialect->flavour == AsmFlavour::Loose)
m_errorReporter.error(