From 82673b7b3fefbacf4f1ffae7b53414eea6310b44 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 26 Sep 2017 21:48:59 +0100 Subject: Format GlobalContext for readability --- libsolidity/analysis/GlobalContext.cpp | 67 +++++++++++++--------------------- 1 file changed, 25 insertions(+), 42 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/analysis/GlobalContext.cpp b/libsolidity/analysis/GlobalContext.cpp index 62dbd394..624cc957 100644 --- a/libsolidity/analysis/GlobalContext.cpp +++ b/libsolidity/analysis/GlobalContext.cpp @@ -34,44 +34,29 @@ namespace solidity { GlobalContext::GlobalContext(): -m_magicVariables(vector>{make_shared("block", make_shared(MagicType::Kind::Block)), - make_shared("msg", make_shared(MagicType::Kind::Message)), - make_shared("tx", make_shared(MagicType::Kind::Transaction)), - make_shared("now", make_shared(256)), - make_shared("suicide", - make_shared(strings{"address"}, strings{}, FunctionType::Kind::Selfdestruct)), - make_shared("selfdestruct", - make_shared(strings{"address"}, strings{}, FunctionType::Kind::Selfdestruct)), - make_shared("addmod", - make_shared(strings{"uint256", "uint256", "uint256"}, strings{"uint256"}, FunctionType::Kind::AddMod, false, StateMutability::Pure)), - make_shared("mulmod", - make_shared(strings{"uint256", "uint256", "uint256"}, strings{"uint256"}, FunctionType::Kind::MulMod, false, StateMutability::Pure)), - make_shared("sha3", - make_shared(strings(), strings{"bytes32"}, FunctionType::Kind::SHA3, true, StateMutability::Pure)), - make_shared("keccak256", - make_shared(strings(), strings{"bytes32"}, FunctionType::Kind::SHA3, true, StateMutability::Pure)), - make_shared("log0", - make_shared(strings{"bytes32"}, strings{}, FunctionType::Kind::Log0)), - make_shared("log1", - make_shared(strings{"bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log1)), - make_shared("log2", - make_shared(strings{"bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log2)), - make_shared("log3", - make_shared(strings{"bytes32", "bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log3)), - make_shared("log4", - make_shared(strings{"bytes32", "bytes32", "bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log4)), - make_shared("sha256", - make_shared(strings(), strings{"bytes32"}, FunctionType::Kind::SHA256, true, StateMutability::Pure)), - make_shared("ecrecover", - make_shared(strings{"bytes32", "uint8", "bytes32", "bytes32"}, strings{"address"}, FunctionType::Kind::ECRecover, false, StateMutability::Pure)), - make_shared("ripemd160", - make_shared(strings(), strings{"bytes20"}, FunctionType::Kind::RIPEMD160, true, StateMutability::Pure)), - make_shared("assert", - make_shared(strings{"bool"}, strings{}, FunctionType::Kind::Assert, false, StateMutability::Pure)), - make_shared("require", - make_shared(strings{"bool"}, strings{}, FunctionType::Kind::Require, false, StateMutability::Pure)), - make_shared("revert", - make_shared(strings(), strings(), FunctionType::Kind::Revert, false, StateMutability::Pure))}) +m_magicVariables(vector>{ + make_shared("block", make_shared(MagicType::Kind::Block)), + make_shared("msg", make_shared(MagicType::Kind::Message)), + make_shared("tx", make_shared(MagicType::Kind::Transaction)), + make_shared("now", make_shared(256)), + make_shared("suicide", make_shared(strings{"address"}, strings{}, FunctionType::Kind::Selfdestruct)), + make_shared("selfdestruct", make_shared(strings{"address"}, strings{}, FunctionType::Kind::Selfdestruct)), + make_shared("addmod", make_shared(strings{"uint256", "uint256", "uint256"}, strings{"uint256"}, FunctionType::Kind::AddMod, false, StateMutability::Pure)), + make_shared("mulmod", make_shared(strings{"uint256", "uint256", "uint256"}, strings{"uint256"}, FunctionType::Kind::MulMod, false, StateMutability::Pure)), + make_shared("sha3", make_shared(strings(), strings{"bytes32"}, FunctionType::Kind::SHA3, true, StateMutability::Pure)), + make_shared("keccak256", make_shared(strings(), strings{"bytes32"}, FunctionType::Kind::SHA3, true, StateMutability::Pure)), + make_shared("log0", make_shared(strings{"bytes32"}, strings{}, FunctionType::Kind::Log0)), + make_shared("log1", make_shared(strings{"bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log1)), + make_shared("log2", make_shared(strings{"bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log2)), + make_shared("log3", make_shared(strings{"bytes32", "bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log3)), + make_shared("log4", make_shared(strings{"bytes32", "bytes32", "bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log4)), + make_shared("sha256", make_shared(strings(), strings{"bytes32"}, FunctionType::Kind::SHA256, true, StateMutability::Pure)), + make_shared("ecrecover", make_shared(strings{"bytes32", "uint8", "bytes32", "bytes32"}, strings{"address"}, FunctionType::Kind::ECRecover, false, StateMutability::Pure)), + make_shared("ripemd160", make_shared(strings(), strings{"bytes20"}, FunctionType::Kind::RIPEMD160, true, StateMutability::Pure)), + make_shared("assert", make_shared(strings{"bool"}, strings{}, FunctionType::Kind::Assert, false, StateMutability::Pure)), + make_shared("require", make_shared(strings{"bool"}, strings{}, FunctionType::Kind::Require, false, StateMutability::Pure)), + make_shared("revert", make_shared(strings(), strings(), FunctionType::Kind::Revert, false, StateMutability::Pure)) +}) { } @@ -92,8 +77,7 @@ vector GlobalContext::declarations() const MagicVariableDeclaration const* GlobalContext::currentThis() const { if (!m_thisPointer[m_currentContract]) - m_thisPointer[m_currentContract] = make_shared( - "this", make_shared(*m_currentContract)); + m_thisPointer[m_currentContract] = make_shared("this", make_shared(*m_currentContract)); return m_thisPointer[m_currentContract].get(); } @@ -101,8 +85,7 @@ MagicVariableDeclaration const* GlobalContext::currentThis() const MagicVariableDeclaration const* GlobalContext::currentSuper() const { if (!m_superPointer[m_currentContract]) - m_superPointer[m_currentContract] = make_shared( - "super", make_shared(*m_currentContract, true)); + m_superPointer[m_currentContract] = make_shared("super", make_shared(*m_currentContract, true)); return m_superPointer[m_currentContract].get(); } -- cgit