Skip to content

Commit 8231914

Browse files
committed
Added the following expression cases
- TernaryExpr - IsExpr
1 parent 8ac71b1 commit 8231914

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4635,7 +4635,9 @@ void PrintAST::visitPostfixOperatorDecl(PostfixOperatorDecl *decl) {
46354635
});
46364636
}
46374637

4638-
void PrintAST::visitModuleDecl(ModuleDecl *decl) { }
4638+
void PrintAST::visitModuleDecl(ModuleDecl *decl) {
4639+
4640+
}
46394641

46404642
void PrintAST::visitMissingDecl(MissingDecl *missing) {
46414643
Printer << "missing_decl";
@@ -4785,12 +4787,24 @@ void PrintAST::visitErrorExpr(ErrorExpr *expr) {
47854787
Printer << "<error>";
47864788
}
47874789

4788-
void PrintAST::visitTernaryExpr(TernaryExpr *expr) {}
4790+
void PrintAST::visitTernaryExpr(TernaryExpr *expr) {
4791+
visit(expr->getCondExpr());
4792+
Printer << " ? ";
4793+
visit(expr->getThenExpr());
4794+
Printer << " : ";
4795+
visit(expr->getElseExpr());
4796+
}
47894797

47904798
void PrintAST::visitIsExpr(IsExpr *expr) {
4799+
if (expr->getType()) {
4800+
Printer << "true";
4801+
} else {
4802+
Printer << "false";
4803+
}
47914804
}
47924805

47934806
void PrintAST::visitTapExpr(TapExpr *expr) {
4807+
47944808
}
47954809

47964810
void PrintAST::visitTryExpr(TryExpr *expr) {
@@ -4871,6 +4885,7 @@ void PrintAST::visitDictionaryExpr(DictionaryExpr *expr) {
48714885
}
48724886

48734887
void PrintAST::visitArrowExpr(ArrowExpr *expr) {
4888+
48744889
}
48754890

48764891
void PrintAST::visitAwaitExpr(AwaitExpr *expr) {
@@ -4913,6 +4928,7 @@ void PrintAST::visitTupleExpr(TupleExpr *expr) {
49134928
}
49144929

49154930
void PrintAST::visitTypeJoinExpr(TypeJoinExpr *expr) {
4931+
49164932
}
49174933

49184934
void PrintAST::visitAssignExpr(AssignExpr *expr) {
@@ -4934,12 +4950,15 @@ void PrintAST::visitBinaryExpr(BinaryExpr *expr) {
49344950
}
49354951

49364952
void PrintAST::visitCoerceExpr(CoerceExpr *expr) {
4953+
49374954
}
49384955

49394956
void PrintAST::visitOneWayExpr(OneWayExpr *expr) {
4957+
49404958
}
49414959

49424960
void PrintAST::visitClosureExpr(ClosureExpr *expr) {
4961+
49434962
}
49444963

49454964
void PrintAST::visitDeclRefExpr(DeclRefExpr *expr) {
@@ -4956,6 +4975,7 @@ void PrintAST::visitErasureExpr(ErasureExpr *expr) {
49564975
}
49574976

49584977
void PrintAST::visitKeyPathExpr(KeyPathExpr *expr) {
4978+
49594979
}
49604980

49614981
void PrintAST::visitSingleValueStmtExpr(SingleValueStmtExpr *expr) {
@@ -4968,6 +4988,7 @@ void PrintAST::visitForceTryExpr(ForceTryExpr *expr) {
49684988
}
49694989

49704990
void PrintAST::visitSequenceExpr(SequenceExpr *expr) {
4991+
49714992
}
49724993

49734994
void PrintAST::visitSuperRefExpr(SuperRefExpr *expr) {

0 commit comments

Comments
 (0)