diff options
author | chriseth <chris@ethereum.org> | 2018-02-09 23:53:52 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-27 19:17:25 +0800 |
commit | e6d48bb72a82e2b3140d5a98da2961e401430a25 (patch) | |
tree | 174e49e2eddf6b92fe2fd24960af928e2b9444a8 /libsolidity/analysis/NameAndTypeResolver.cpp | |
parent | 5f20129e65f5b8b714189145d177067152a21ac1 (diff) | |
download | dexon-solidity-e6d48bb72a82e2b3140d5a98da2961e401430a25.tar dexon-solidity-e6d48bb72a82e2b3140d5a98da2961e401430a25.tar.gz dexon-solidity-e6d48bb72a82e2b3140d5a98da2961e401430a25.tar.bz2 dexon-solidity-e6d48bb72a82e2b3140d5a98da2961e401430a25.tar.lz dexon-solidity-e6d48bb72a82e2b3140d5a98da2961e401430a25.tar.xz dexon-solidity-e6d48bb72a82e2b3140d5a98da2961e401430a25.tar.zst dexon-solidity-e6d48bb72a82e2b3140d5a98da2961e401430a25.zip |
Blocks and for loops can be scopes.
Diffstat (limited to 'libsolidity/analysis/NameAndTypeResolver.cpp')
-rw-r--r-- | libsolidity/analysis/NameAndTypeResolver.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 953b788d..1566df94 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -610,6 +610,30 @@ void DeclarationRegistrationHelper::endVisit(ModifierDefinition&) closeCurrentScope(); } +bool DeclarationRegistrationHelper::visit(Block& _block) +{ + enterNewSubScope(_block); + return true; +} + +void DeclarationRegistrationHelper::endVisit(Block&) +{ + closeCurrentScope(); +} + +bool DeclarationRegistrationHelper::visit(ForStatement& _for) +{ + // TODO special scoping rules for the init statement - if it is a block, then it should + // not open its own scope. + enterNewSubScope(_for); + return true; +} + +void DeclarationRegistrationHelper::endVisit(ForStatement&) +{ + closeCurrentScope(); +} + void DeclarationRegistrationHelper::endVisit(VariableDeclarationStatement& _variableDeclarationStatement) { // Register the local variables with the function |