diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-16 19:58:17 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-16 20:49:52 +0800 |
commit | 3ae88377d6bf59afe823eef2e4df4065561ed6ea (patch) | |
tree | 5d3df9cd820cd53f6b98a80e5d5ffb2ddbbdbc3d /libsolidity/analysis | |
parent | 7123f25210c200f225c5988452d9e2c35d668223 (diff) | |
download | dexon-solidity-3ae88377d6bf59afe823eef2e4df4065561ed6ea.tar dexon-solidity-3ae88377d6bf59afe823eef2e4df4065561ed6ea.tar.gz dexon-solidity-3ae88377d6bf59afe823eef2e4df4065561ed6ea.tar.bz2 dexon-solidity-3ae88377d6bf59afe823eef2e4df4065561ed6ea.tar.lz dexon-solidity-3ae88377d6bf59afe823eef2e4df4065561ed6ea.tar.xz dexon-solidity-3ae88377d6bf59afe823eef2e4df4065561ed6ea.tar.zst dexon-solidity-3ae88377d6bf59afe823eef2e4df4065561ed6ea.zip |
Change references to FunctionType::Location
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/GlobalContext.cpp | 34 | ||||
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 15 |
2 files changed, 24 insertions, 25 deletions
diff --git a/libsolidity/analysis/GlobalContext.cpp b/libsolidity/analysis/GlobalContext.cpp index d8f1603a..a54b8c8d 100644 --- a/libsolidity/analysis/GlobalContext.cpp +++ b/libsolidity/analysis/GlobalContext.cpp @@ -39,39 +39,39 @@ m_magicVariables(vector<shared_ptr<MagicVariableDeclaration const>>{make_shared< make_shared<MagicVariableDeclaration>("tx", make_shared<MagicType>(MagicType::Kind::Transaction)), make_shared<MagicVariableDeclaration>("now", make_shared<IntegerType>(256)), make_shared<MagicVariableDeclaration>("suicide", - make_shared<FunctionType>(strings{"address"}, strings{}, FunctionType::Location::Selfdestruct)), + make_shared<FunctionType>(strings{"address"}, strings{}, FunctionType::Kind::Selfdestruct)), make_shared<MagicVariableDeclaration>("selfdestruct", - make_shared<FunctionType>(strings{"address"}, strings{}, FunctionType::Location::Selfdestruct)), + make_shared<FunctionType>(strings{"address"}, strings{}, FunctionType::Kind::Selfdestruct)), make_shared<MagicVariableDeclaration>("addmod", - make_shared<FunctionType>(strings{"uint256", "uint256", "uint256"}, strings{"uint256"}, FunctionType::Location::AddMod)), + make_shared<FunctionType>(strings{"uint256", "uint256", "uint256"}, strings{"uint256"}, FunctionType::Kind::AddMod)), make_shared<MagicVariableDeclaration>("mulmod", - make_shared<FunctionType>(strings{"uint256", "uint256", "uint256"}, strings{"uint256"}, FunctionType::Location::MulMod)), + make_shared<FunctionType>(strings{"uint256", "uint256", "uint256"}, strings{"uint256"}, FunctionType::Kind::MulMod)), make_shared<MagicVariableDeclaration>("sha3", - make_shared<FunctionType>(strings(), strings{"bytes32"}, FunctionType::Location::SHA3, true)), + make_shared<FunctionType>(strings(), strings{"bytes32"}, FunctionType::Kind::SHA3, true)), make_shared<MagicVariableDeclaration>("keccak256", - make_shared<FunctionType>(strings(), strings{"bytes32"}, FunctionType::Location::SHA3, true)), + make_shared<FunctionType>(strings(), strings{"bytes32"}, FunctionType::Kind::SHA3, true)), make_shared<MagicVariableDeclaration>("log0", - make_shared<FunctionType>(strings{"bytes32"}, strings{}, FunctionType::Location::Log0)), + make_shared<FunctionType>(strings{"bytes32"}, strings{}, FunctionType::Kind::Log0)), make_shared<MagicVariableDeclaration>("log1", - make_shared<FunctionType>(strings{"bytes32", "bytes32"}, strings{}, FunctionType::Location::Log1)), + make_shared<FunctionType>(strings{"bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log1)), make_shared<MagicVariableDeclaration>("log2", - make_shared<FunctionType>(strings{"bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Location::Log2)), + make_shared<FunctionType>(strings{"bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log2)), make_shared<MagicVariableDeclaration>("log3", - make_shared<FunctionType>(strings{"bytes32", "bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Location::Log3)), + make_shared<FunctionType>(strings{"bytes32", "bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log3)), make_shared<MagicVariableDeclaration>("log4", - make_shared<FunctionType>(strings{"bytes32", "bytes32", "bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Location::Log4)), + make_shared<FunctionType>(strings{"bytes32", "bytes32", "bytes32", "bytes32", "bytes32"}, strings{}, FunctionType::Kind::Log4)), make_shared<MagicVariableDeclaration>("sha256", - make_shared<FunctionType>(strings(), strings{"bytes32"}, FunctionType::Location::SHA256, true)), + make_shared<FunctionType>(strings(), strings{"bytes32"}, FunctionType::Kind::SHA256, true)), make_shared<MagicVariableDeclaration>("ecrecover", - make_shared<FunctionType>(strings{"bytes32", "uint8", "bytes32", "bytes32"}, strings{"address"}, FunctionType::Location::ECRecover)), + make_shared<FunctionType>(strings{"bytes32", "uint8", "bytes32", "bytes32"}, strings{"address"}, FunctionType::Kind::ECRecover)), make_shared<MagicVariableDeclaration>("ripemd160", - make_shared<FunctionType>(strings(), strings{"bytes20"}, FunctionType::Location::RIPEMD160, true)), + make_shared<FunctionType>(strings(), strings{"bytes20"}, FunctionType::Kind::RIPEMD160, true)), make_shared<MagicVariableDeclaration>("assert", - make_shared<FunctionType>(strings{"bool"}, strings{}, FunctionType::Location::Assert)), + make_shared<FunctionType>(strings{"bool"}, strings{}, FunctionType::Kind::Assert)), make_shared<MagicVariableDeclaration>("require", - make_shared<FunctionType>(strings{"bool"}, strings{}, FunctionType::Location::Require)), + make_shared<FunctionType>(strings{"bool"}, strings{}, FunctionType::Kind::Require)), make_shared<MagicVariableDeclaration>("revert", - make_shared<FunctionType>(strings(), strings(), FunctionType::Location::Revert))}) + make_shared<FunctionType>(strings(), strings(), FunctionType::Kind::Revert))}) { } diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 512493cd..34ed8129 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -582,7 +582,7 @@ bool TypeChecker::visit(EventDefinition const& _eventDef) void TypeChecker::endVisit(FunctionTypeName const& _funType) { FunctionType const& fun = dynamic_cast<FunctionType const&>(*_funType.annotation().type); - if (fun.location() == FunctionType::Location::External) + if (fun.kind() == FunctionType::Kind::External) if (!fun.canBeUsedExternally(false)) typeError(_funType.location(), "External function type uses internal types."); } @@ -886,15 +886,14 @@ void TypeChecker::endVisit(ExpressionStatement const& _statement) { if (auto callType = dynamic_cast<FunctionType const*>(type(call->expression()).get())) { - using Location = FunctionType::Location; - Location location = callType->location(); + auto kind = callType->kind(); if ( - location == Location::Bare || - location == Location::BareCallCode || - location == Location::BareDelegateCall + kind == FunctionType::Kind::Bare || + kind == FunctionType::Kind::BareCallCode || + kind == FunctionType::Kind::BareDelegateCall ) warning(_statement.location(), "Return value of low-level calls not used."); - else if (location == Location::Send) + else if (kind == FunctionType::Kind::Send) warning(_statement.location(), "Failure condition of 'send' ignored. Consider using 'transfer' instead."); } } @@ -1387,7 +1386,7 @@ void TypeChecker::endVisit(NewExpression const& _newExpression) TypePointers{type}, strings(), strings(), - FunctionType::Location::ObjectCreation + FunctionType::Kind::ObjectCreation ); _newExpression.annotation().isPure = true; } |