aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@gmail.com>2015-12-23 00:47:00 +0800
committerLu Guanqun <guanqun.lu@gmail.com>2016-01-23 01:14:00 +0800
commit4563d4bd3c3525fd2bf26823567f3c99018482e1 (patch)
treeaa5300660d0fc4547735e0c1a39a1b3f0d151aa9 /libsolidity/ast
parent4fa0326813b4fc9d3c85cb9235f42cf22beead72 (diff)
downloaddexon-solidity-4563d4bd3c3525fd2bf26823567f3c99018482e1.tar.gz
dexon-solidity-4563d4bd3c3525fd2bf26823567f3c99018482e1.tar.zst
dexon-solidity-4563d4bd3c3525fd2bf26823567f3c99018482e1.zip
[cond-expr] add visitor related functions
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/ASTJsonConverter.cpp11
-rw-r--r--libsolidity/ast/ASTJsonConverter.h2
-rw-r--r--libsolidity/ast/ASTPrinter.cpp13
-rw-r--r--libsolidity/ast/ASTPrinter.h2
-rw-r--r--libsolidity/ast/ASTVisitor.h4
5 files changed, 32 insertions, 0 deletions
diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp
index 377fa7e6..df836afe 100644
--- a/libsolidity/ast/ASTJsonConverter.cpp
+++ b/libsolidity/ast/ASTJsonConverter.cpp
@@ -217,6 +217,12 @@ bool ASTJsonConverter::visit(ExpressionStatement const&)
return true;
}
+bool ASTJsonConverter::visit(Conditional const&)
+{
+ addJsonNode("Conditional", {}, true);
+ return true;
+}
+
bool ASTJsonConverter::visit(Assignment const& _node)
{
addJsonNode("Assignment",
@@ -397,6 +403,11 @@ void ASTJsonConverter::endVisit(ExpressionStatement const&)
goUp();
}
+void ASTJsonConverter::endVisit(Conditional const&)
+{
+ goUp();
+}
+
void ASTJsonConverter::endVisit(Assignment const&)
{
goUp();
diff --git a/libsolidity/ast/ASTJsonConverter.h b/libsolidity/ast/ASTJsonConverter.h
index de891cc6..b7fc84e9 100644
--- a/libsolidity/ast/ASTJsonConverter.h
+++ b/libsolidity/ast/ASTJsonConverter.h
@@ -67,6 +67,7 @@ public:
bool visit(Throw const& _node) override;
bool visit(VariableDeclarationStatement const& _node) override;
bool visit(ExpressionStatement const& _node) override;
+ bool visit(Conditional const& _node) override;
bool visit(Assignment const& _node) override;
bool visit(TupleExpression const& _node) override;
bool visit(UnaryOperation const& _node) override;
@@ -99,6 +100,7 @@ public:
void endVisit(Throw const&) override;
void endVisit(VariableDeclarationStatement const&) override;
void endVisit(ExpressionStatement const&) override;
+ void endVisit(Conditional const&) override;
void endVisit(Assignment const&) override;
void endVisit(TupleExpression const&) override;
void endVisit(UnaryOperation const&) override;
diff --git a/libsolidity/ast/ASTPrinter.cpp b/libsolidity/ast/ASTPrinter.cpp
index d4f13e47..bc981f7d 100644
--- a/libsolidity/ast/ASTPrinter.cpp
+++ b/libsolidity/ast/ASTPrinter.cpp
@@ -248,6 +248,14 @@ bool ASTPrinter::visit(ExpressionStatement const& _node)
return goDeeper();
}
+bool ASTPrinter::visit(Conditional const& _node)
+{
+ writeLine("Conditional");
+ printType(_node);
+ printSourcePart(_node);
+ return goDeeper();
+}
+
bool ASTPrinter::visit(Assignment const& _node)
{
writeLine(string("Assignment using operator ") + Token::toString(_node.assignmentOperator()));
@@ -480,6 +488,11 @@ void ASTPrinter::endVisit(ExpressionStatement const&)
m_indentation--;
}
+void ASTPrinter::endVisit(Conditional const&)
+{
+ m_indentation--;
+}
+
void ASTPrinter::endVisit(Assignment const&)
{
m_indentation--;
diff --git a/libsolidity/ast/ASTPrinter.h b/libsolidity/ast/ASTPrinter.h
index d9b5e252..334fefc7 100644
--- a/libsolidity/ast/ASTPrinter.h
+++ b/libsolidity/ast/ASTPrinter.h
@@ -75,6 +75,7 @@ public:
bool visit(Throw const& _node) override;
bool visit(VariableDeclarationStatement const& _node) override;
bool visit(ExpressionStatement const& _node) override;
+ bool visit(Conditional const& _node) override;
bool visit(Assignment const& _node) override;
bool visit(TupleExpression const& _node) override;
bool visit(UnaryOperation const& _node) override;
@@ -115,6 +116,7 @@ public:
void endVisit(Throw const&) override;
void endVisit(VariableDeclarationStatement const&) override;
void endVisit(ExpressionStatement const&) override;
+ void endVisit(Conditional const&) override;
void endVisit(Assignment const&) override;
void endVisit(TupleExpression const&) override;
void endVisit(UnaryOperation const&) override;
diff --git a/libsolidity/ast/ASTVisitor.h b/libsolidity/ast/ASTVisitor.h
index f04d9682..625f395d 100644
--- a/libsolidity/ast/ASTVisitor.h
+++ b/libsolidity/ast/ASTVisitor.h
@@ -73,6 +73,7 @@ public:
virtual bool visit(Throw& _node) { return visitNode(_node); }
virtual bool visit(VariableDeclarationStatement& _node) { return visitNode(_node); }
virtual bool visit(ExpressionStatement& _node) { return visitNode(_node); }
+ virtual bool visit(Conditional& _node) { return visitNode(_node); }
virtual bool visit(Assignment& _node) { return visitNode(_node); }
virtual bool visit(TupleExpression& _node) { return visitNode(_node); }
virtual bool visit(UnaryOperation& _node) { return visitNode(_node); }
@@ -115,6 +116,7 @@ public:
virtual void endVisit(Throw& _node) { endVisitNode(_node); }
virtual void endVisit(VariableDeclarationStatement& _node) { endVisitNode(_node); }
virtual void endVisit(ExpressionStatement& _node) { endVisitNode(_node); }
+ virtual void endVisit(Conditional& _node) { endVisitNode(_node); }
virtual void endVisit(Assignment& _node) { endVisitNode(_node); }
virtual void endVisit(TupleExpression& _node) { endVisitNode(_node); }
virtual void endVisit(UnaryOperation& _node) { endVisitNode(_node); }
@@ -169,6 +171,7 @@ public:
virtual bool visit(Throw const& _node) { return visitNode(_node); }
virtual bool visit(VariableDeclarationStatement const& _node) { return visitNode(_node); }
virtual bool visit(ExpressionStatement const& _node) { return visitNode(_node); }
+ virtual bool visit(Conditional const& _node) { return visitNode(_node); }
virtual bool visit(Assignment const& _node) { return visitNode(_node); }
virtual bool visit(TupleExpression const& _node) { return visitNode(_node); }
virtual bool visit(UnaryOperation const& _node) { return visitNode(_node); }
@@ -211,6 +214,7 @@ public:
virtual void endVisit(Throw const& _node) { endVisitNode(_node); }
virtual void endVisit(VariableDeclarationStatement const& _node) { endVisitNode(_node); }
virtual void endVisit(ExpressionStatement const& _node) { endVisitNode(_node); }
+ virtual void endVisit(Conditional const& _node) { endVisitNode(_node); }
virtual void endVisit(Assignment const& _node) { endVisitNode(_node); }
virtual void endVisit(TupleExpression const& _node) { endVisitNode(_node); }
virtual void endVisit(UnaryOperation const& _node) { endVisitNode(_node); }