Skip to content

Commit

Permalink
Added the following expression cases
Browse files Browse the repository at this point in the history
- TernaryExpr
- IsExpr
  • Loading branch information
Rajveer100 committed Mar 28, 2023
1 parent 8ac71b1 commit 8231914
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4635,7 +4635,9 @@ void PrintAST::visitPostfixOperatorDecl(PostfixOperatorDecl *decl) {
});
}

void PrintAST::visitModuleDecl(ModuleDecl *decl) { }
void PrintAST::visitModuleDecl(ModuleDecl *decl) {

}

void PrintAST::visitMissingDecl(MissingDecl *missing) {
Printer << "missing_decl";
Expand Down Expand Up @@ -4785,12 +4787,24 @@ void PrintAST::visitErrorExpr(ErrorExpr *expr) {
Printer << "<error>";
}

void PrintAST::visitTernaryExpr(TernaryExpr *expr) {}
void PrintAST::visitTernaryExpr(TernaryExpr *expr) {
visit(expr->getCondExpr());
Printer << " ? ";
visit(expr->getThenExpr());
Printer << " : ";
visit(expr->getElseExpr());
}

void PrintAST::visitIsExpr(IsExpr *expr) {
if (expr->getType()) {
Printer << "true";
} else {
Printer << "false";
}
}

void PrintAST::visitTapExpr(TapExpr *expr) {

}

void PrintAST::visitTryExpr(TryExpr *expr) {
Expand Down Expand Up @@ -4871,6 +4885,7 @@ void PrintAST::visitDictionaryExpr(DictionaryExpr *expr) {
}

void PrintAST::visitArrowExpr(ArrowExpr *expr) {

}

void PrintAST::visitAwaitExpr(AwaitExpr *expr) {
Expand Down Expand Up @@ -4913,6 +4928,7 @@ void PrintAST::visitTupleExpr(TupleExpr *expr) {
}

void PrintAST::visitTypeJoinExpr(TypeJoinExpr *expr) {

}

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

void PrintAST::visitCoerceExpr(CoerceExpr *expr) {

}

void PrintAST::visitOneWayExpr(OneWayExpr *expr) {

}

void PrintAST::visitClosureExpr(ClosureExpr *expr) {

}

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

void PrintAST::visitKeyPathExpr(KeyPathExpr *expr) {

}

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

void PrintAST::visitSequenceExpr(SequenceExpr *expr) {

}

void PrintAST::visitSuperRefExpr(SuperRefExpr *expr) {
Expand Down

0 comments on commit 8231914

Please sign in to comment.