Skip to content

Commit

Permalink
Added the following expression cases
Browse files Browse the repository at this point in the history
- TernaryExpr
- IsExpr
- TapExpr
  • Loading branch information
Rajveer100 committed Mar 30, 2023
1 parent 8ac71b1 commit ca14635
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 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,27 @@ void PrintAST::visitErrorExpr(ErrorExpr *expr) {
Printer << "<error>";
}

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

void PrintAST::visitIsExpr(IsExpr *expr) {
visit(expr->getSubExpr());
Printer << " is ";
printType(expr->getCastType());
}

void PrintAST::visitTapExpr(TapExpr *expr) {
printType(expr->getVar()->getType());
printBraceStmt(expr->getBody());
}

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

void PrintAST::visitArrowExpr(ArrowExpr *expr) {

}

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

void PrintAST::visitTypeJoinExpr(TypeJoinExpr *expr) {

}

void PrintAST::visitAssignExpr(AssignExpr *expr) {
Expand All @@ -4934,12 +4953,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 +4978,7 @@ void PrintAST::visitErasureExpr(ErasureExpr *expr) {
}

void PrintAST::visitKeyPathExpr(KeyPathExpr *expr) {

}

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

void PrintAST::visitSequenceExpr(SequenceExpr *expr) {

}

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

0 comments on commit ca14635

Please sign in to comment.