@@ -223,6 +223,8 @@ static const char *node_type_str(NodeType node_type) {
|
||||
return "TypeLiteral";
|
||||
case NodeTypeVarLiteral:
|
||||
return "VarLiteral";
|
||||
case NodeTypeTryExpr:
|
||||
return "TryExpr";
|
||||
}
|
||||
zig_unreachable();
|
||||
}
|
||||
@@ -769,6 +771,25 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NodeTypeTryExpr:
|
||||
{
|
||||
const char *var_str = node->data.try_expr.var_is_const ? "const" : "var";
|
||||
const char *var_name = buf_ptr(node->data.try_expr.var_symbol);
|
||||
const char *ptr_str = node->data.try_expr.var_is_ptr ? "*" : "";
|
||||
fprintf(ar->f, "try (%s %s%s", var_str, ptr_str, var_name);
|
||||
fprintf(ar->f, " = ");
|
||||
render_node_grouped(ar, node->data.try_expr.target_node);
|
||||
fprintf(ar->f, ") ");
|
||||
render_node_grouped(ar, node->data.try_expr.then_node);
|
||||
if (node->data.try_expr.else_node) {
|
||||
fprintf(ar->f, " else ");
|
||||
if (node->data.try_expr.err_symbol) {
|
||||
fprintf(ar->f, "|%s| ", buf_ptr(node->data.try_expr.err_symbol));
|
||||
}
|
||||
render_node_grouped(ar, node->data.try_expr.else_node);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NodeTypeSwitchExpr:
|
||||
{
|
||||
AstNodeSwitchExpr *switch_expr = &node->data.switch_expr;
|
||||
|
||||
Reference in New Issue
Block a user