aboutsummaryrefslogtreecommitdiffstats
path: root/libjulia
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-12-06 02:46:16 +0800
committerchriseth <chris@ethereum.org>2017-12-06 03:12:46 +0800
commit6769a9a503fd35ae147650634d82d1321e6b8826 (patch)
tree525fe2fa57b18a5ce9cd914a2b69324d54e7ed55 /libjulia
parenta08d853bbb0d5f052cc264a84340bde577f54c4e (diff)
downloaddexon-solidity-6769a9a503fd35ae147650634d82d1321e6b8826.tar.gz
dexon-solidity-6769a9a503fd35ae147650634d82d1321e6b8826.tar.zst
dexon-solidity-6769a9a503fd35ae147650634d82d1321e6b8826.zip
Make the modifier more flexible.
Diffstat (limited to 'libjulia')
-rw-r--r--libjulia/optimiser/ASTWalker.cpp10
-rw-r--r--libjulia/optimiser/ASTWalker.h6
2 files changed, 10 insertions, 6 deletions
diff --git a/libjulia/optimiser/ASTWalker.cpp b/libjulia/optimiser/ASTWalker.cpp
index 786afbe0..0caef04e 100644
--- a/libjulia/optimiser/ASTWalker.cpp
+++ b/libjulia/optimiser/ASTWalker.cpp
@@ -104,24 +104,24 @@ void ASTModifier::operator()(Assignment& _assignment)
{
for (auto& name: _assignment.variableNames)
(*this)(name);
- boost::apply_visitor(*this, *_assignment.value);
+ visit(*_assignment.value);
}
void ASTModifier::operator()(VariableDeclaration& _varDecl)
{
if (_varDecl.value)
- boost::apply_visitor(*this, *_varDecl.value);
+ visit(*_varDecl.value);
}
void ASTModifier::operator()(If& _if)
{
- boost::apply_visitor(*this, *_if.condition);
+ visit(*_if.condition);
(*this)(_if.body);
}
void ASTModifier::operator()(Switch& _switch)
{
- boost::apply_visitor(*this, *_switch.expression);
+ visit(*_switch.expression);
for (auto& _case: _switch.cases)
{
if (_case.value)
@@ -138,7 +138,7 @@ void ASTModifier::operator()(FunctionDefinition& _fun)
void ASTModifier::operator()(ForLoop& _for)
{
(*this)(_for.pre);
- boost::apply_visitor(*this, *_for.condition);
+ visit(*_for.condition);
(*this)(_for.post);
(*this)(_for.body);
}
diff --git a/libjulia/optimiser/ASTWalker.h b/libjulia/optimiser/ASTWalker.h
index 01499a50..8bd867d5 100644
--- a/libjulia/optimiser/ASTWalker.h
+++ b/libjulia/optimiser/ASTWalker.h
@@ -92,7 +92,11 @@ protected:
void walkVector(T&& _statements)
{
for (auto& st: _statements)
- boost::apply_visitor(*this, st);
+ visit(st);
+ }
+ virtual void visit(Statement& _st)
+ {
+ boost::apply_visitor(*this, _st);
}
};