aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/formatter/formatter.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c
index 2d88b486..89535071 100644
--- a/src/formatter/formatter.c
+++ b/src/formatter/formatter.c
@@ -352,6 +352,22 @@ OptionalText_t format_inline_code(ast_t *ast, Table_t comments) {
Text_t space = op_tightness[ast->tag] >= op_tightness[Multiply] ? EMPTY_TEXT : Text(" ");
return Texts(lhs, space, Text$from_str(binop_operator(ast->tag)), space, rhs);
}
+ /*inline*/ case Deserialize: {
+ DeclareMatch(deserialize, ast, Deserialize);
+ return Texts("deserialize(", fmt_inline(deserialize->value, comments), " -> ", format_type(deserialize->type),
+ ")");
+ }
+ /*inline*/ case Use: {
+ DeclareMatch(use, ast, Use);
+ // struct {
+ // ast_t *var;
+ // const char *path;
+ // enum { USE_LOCAL, USE_MODULE, USE_SHARED_OBJECT, USE_HEADER, USE_C_CODE, USE_ASM } what;
+ // } Use;
+ return Texts("use ", use->path);
+ }
+ /*inline*/ case ExplicitlyTyped:
+ fail("Explicitly typed AST nodes are only meant to be used internally.");
default: {
fail("Formatting not implemented for: ", ast_to_sexp(ast));
}
@@ -749,6 +765,18 @@ Text_t format_code(ast_t *ast, Table_t comments, Text_t indent) {
Text_t space = op_tightness[ast->tag] >= op_tightness[Multiply] ? EMPTY_TEXT : Text(" ");
return Texts(lhs, space, Text$from_str(binop_operator(ast->tag)), space, rhs);
}
+ /*multiline*/ case Deserialize: {
+ if (inlined_fits) return inlined;
+ DeclareMatch(deserialize, ast, Deserialize);
+ return Texts("deserialize(", fmt(deserialize->value, comments, indent), " -> ", format_type(deserialize->type),
+ ")");
+ }
+ /*multiline*/ case Use: {
+ assert(inlined.length > 0);
+ return inlined;
+ }
+ /*multiline*/ case ExplicitlyTyped:
+ fail("Explicitly typed AST nodes are only meant to be used internally.");
default: {
if (inlined_fits) return inlined;
fail("Formatting not implemented for: ", ast_to_sexp(ast));