aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/DeclarationContainer.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-12-05 10:09:47 +0800
committerchriseth <c@ethdev.com>2015-12-10 02:09:24 +0800
commit7cb7818ceaf8f2e50cdd66b33a4e0d17c2a0e879 (patch)
treed6ac5e5fe041afc29dcea2aafa97d60dca82a991 /libsolidity/analysis/DeclarationContainer.h
parente510e7e7929326de3a556d6d2e66b8b4376af7a9 (diff)
downloaddexon-solidity-7cb7818ceaf8f2e50cdd66b33a4e0d17c2a0e879.tar.gz
dexon-solidity-7cb7818ceaf8f2e50cdd66b33a4e0d17c2a0e879.tar.zst
dexon-solidity-7cb7818ceaf8f2e50cdd66b33a4e0d17c2a0e879.zip
Source units are independent scopes.
Diffstat (limited to 'libsolidity/analysis/DeclarationContainer.h')
-rw-r--r--libsolidity/analysis/DeclarationContainer.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/libsolidity/analysis/DeclarationContainer.h b/libsolidity/analysis/DeclarationContainer.h
index 064724d1..5862f7a5 100644
--- a/libsolidity/analysis/DeclarationContainer.h
+++ b/libsolidity/analysis/DeclarationContainer.h
@@ -41,23 +41,24 @@ class DeclarationContainer
{
public:
explicit DeclarationContainer(
- Declaration const* _enclosingDeclaration = nullptr,
+ ASTNode const* _enclosingNode = nullptr,
DeclarationContainer const* _enclosingContainer = nullptr
):
- m_enclosingDeclaration(_enclosingDeclaration), m_enclosingContainer(_enclosingContainer) {}
+ m_enclosingNode(_enclosingNode), m_enclosingContainer(_enclosingContainer) {}
/// Registers the declaration in the scope unless its name is already declared or the name is empty.
+ /// @param _name the name to register, if nullptr the intrinsic name of @a _declaration is used.
/// @param _invisible if true, registers the declaration, reports name clashes but does not return it in @a resolveName
/// @param _update if true, replaces a potential declaration that is already present
/// @returns false if the name was already declared.
- bool registerDeclaration(Declaration const& _declaration, bool _invisible = false, bool _update = false);
+ bool registerDeclaration(Declaration const& _declaration, ASTString const* _name = nullptr, bool _invisible = false, bool _update = false);
std::vector<Declaration const*> resolveName(ASTString const& _name, bool _recursive = false) const;
- Declaration const* enclosingDeclaration() const { return m_enclosingDeclaration; }
+ ASTNode const* enclosingNode() const { return m_enclosingNode; }
std::map<ASTString, std::vector<Declaration const*>> const& declarations() const { return m_declarations; }
/// @returns whether declaration is valid, and if not also returns previous declaration.
- Declaration const* conflictingDeclaration(Declaration const& _declaration) const;
+ Declaration const* conflictingDeclaration(Declaration const& _declaration, ASTString const* _name = nullptr) const;
private:
- Declaration const* m_enclosingDeclaration;
+ ASTNode const* m_enclosingNode;
DeclarationContainer const* m_enclosingContainer;
std::map<ASTString, std::vector<Declaration const*>> m_declarations;
std::map<ASTString, std::vector<Declaration const*>> m_invisibleDeclarations;