diff options
author | chriseth <chris@ethereum.org> | 2017-07-06 17:05:05 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-07-11 17:24:41 +0800 |
commit | 01a1296e90e48d64d5494ab4ba9231911ec72ac9 (patch) | |
tree | 7dc51a4d8abd1da74e090f94469f2bd9c9fed53e /libsolidity/ast/AST.cpp | |
parent | 6fa5d47f8fcd7076464ce8ed83c9d89883586f7a (diff) | |
download | dexon-solidity-01a1296e90e48d64d5494ab4ba9231911ec72ac9.tar.gz dexon-solidity-01a1296e90e48d64d5494ab4ba9231911ec72ac9.tar.zst dexon-solidity-01a1296e90e48d64d5494ab4ba9231911ec72ac9.zip |
Helper functions.
Diffstat (limited to 'libsolidity/ast/AST.cpp')
-rw-r--r-- | libsolidity/ast/AST.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 403f4b79..724a908f 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -416,6 +416,23 @@ bool VariableDeclaration::isCallableParameter() const return false; } +bool VariableDeclaration::isLocalOrReturn() const +{ + return isReturnParameter() || (isLocalVariable() && !isCallableParameter()); +} + +bool VariableDeclaration::isReturnParameter() const +{ + auto const* callable = dynamic_cast<CallableDeclaration const*>(scope()); + if (!callable) + return false; + if (callable->returnParameterList()) + for (auto const& variable: callable->returnParameterList()->parameters()) + if (variable.get() == this) + return true; + return false; +} + bool VariableDeclaration::isExternalCallableParameter() const { auto const* callable = dynamic_cast<CallableDeclaration const*>(scope()); |