diff options
author | chriseth <chris@ethereum.org> | 2018-02-14 08:48:40 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-27 19:17:25 +0800 |
commit | 6b9dda06f3d85344a70efb2f868760a0dde9dc45 (patch) | |
tree | 860f6e2c040387261969907fc1214b6aa9bc234d /libsolidity/analysis/ReferencesResolver.cpp | |
parent | e227bdbfa7157d2675c177c75d44e13f0bd82214 (diff) | |
download | dexon-solidity-6b9dda06f3d85344a70efb2f868760a0dde9dc45.tar dexon-solidity-6b9dda06f3d85344a70efb2f868760a0dde9dc45.tar.gz dexon-solidity-6b9dda06f3d85344a70efb2f868760a0dde9dc45.tar.bz2 dexon-solidity-6b9dda06f3d85344a70efb2f868760a0dde9dc45.tar.lz dexon-solidity-6b9dda06f3d85344a70efb2f868760a0dde9dc45.tar.xz dexon-solidity-6b9dda06f3d85344a70efb2f868760a0dde9dc45.tar.zst dexon-solidity-6b9dda06f3d85344a70efb2f868760a0dde9dc45.zip |
Enable C99-scoping with the 0.5.0-experimental pragma.
Diffstat (limited to 'libsolidity/analysis/ReferencesResolver.cpp')
-rw-r--r-- | libsolidity/analysis/ReferencesResolver.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index bee42e77..4d919f2b 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -47,7 +47,10 @@ bool ReferencesResolver::visit(Block const& _block) { if (!m_resolveInsideCode) return false; - m_resolver.setScope(&_block); + m_experimental050Mode = _block.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050); + // C99-scoped variables + if (m_experimental050Mode) + m_resolver.setScope(&_block); return true; } @@ -56,14 +59,19 @@ void ReferencesResolver::endVisit(Block const& _block) if (!m_resolveInsideCode) return; - m_resolver.setScope(_block.scope()); + // C99-scoped variables + if (m_experimental050Mode) + m_resolver.setScope(_block.scope()); } bool ReferencesResolver::visit(ForStatement const& _for) { if (!m_resolveInsideCode) return false; - m_resolver.setScope(&_for); + m_experimental050Mode = _for.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050); + // C99-scoped variables + if (m_experimental050Mode) + m_resolver.setScope(&_for); return true; } @@ -71,7 +79,8 @@ void ReferencesResolver::endVisit(ForStatement const& _for) { if (!m_resolveInsideCode) return; - m_resolver.setScope(_for.scope()); + if (m_experimental050Mode) + m_resolver.setScope(_for.scope()); } bool ReferencesResolver::visit(Identifier const& _identifier) |