diff options
Diffstat (limited to 'src/formatter')
| -rw-r--r-- | src/formatter/args.h | 2 | ||||
| -rw-r--r-- | src/formatter/formatter.c | 5 | ||||
| -rw-r--r-- | src/formatter/utils.c | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/src/formatter/args.h b/src/formatter/args.h index 42722f32..c902684b 100644 --- a/src/formatter/args.h +++ b/src/formatter/args.h @@ -9,5 +9,3 @@ OptionalText_t format_inline_arg(arg_ast_t *arg, Table_t comments); Text_t format_arg(arg_ast_t *arg, Table_t comments, Text_t indent); OptionalText_t format_inline_args(arg_ast_t *args, Table_t comments); Text_t format_args(arg_ast_t *args, Table_t comments, Text_t indent); -OptionalText_t format_inline_tag(tag_ast_t *tag, Table_t comments); -Text_t format_tag(tag_ast_t *tag, Table_t comments, Text_t indent); diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c index 824a936a..60714945 100644 --- a/src/formatter/formatter.c +++ b/src/formatter/formatter.c @@ -33,7 +33,7 @@ typedef struct { Text_t quote, unquote, interp; } text_opts_t; -text_opts_t choose_text_options(ast_list_t *chunks) { +PUREFUNC text_opts_t choose_text_options(ast_list_t *chunks) { int double_quotes = 0, single_quotes = 0, backticks = 0; for (ast_list_t *chunk = chunks; chunk; chunk = chunk->next) { if (chunk->ast->tag == TextLiteral) { @@ -146,6 +146,7 @@ OptionalText_t format_inline_code(ast_t *ast, Table_t comments) { if (if_->else_body == NULL && if_->condition->tag != Declare) { ast_t *stmt = unwrap_block(if_->body); + if (!stmt) return Texts("pass ", if_condition); switch (stmt->tag) { case Return: case Skip: @@ -391,7 +392,7 @@ OptionalText_t format_inline_code(ast_t *ast, Table_t comments) { } } -static int64_t trailing_line_len(Text_t text) { +PUREFUNC static int64_t trailing_line_len(Text_t text) { TextIter_t state = NEW_TEXT_ITER_STATE(text); int64_t len = 0; for (int64_t i = text.length - 1; i >= 0; i--) { diff --git a/src/formatter/utils.c b/src/formatter/utils.c index 80445ec3..bbe74d7f 100644 --- a/src/formatter/utils.c +++ b/src/formatter/utils.c @@ -27,7 +27,7 @@ OptionalText_t next_comment(Table_t comments, const char **pos, const char *end) const char **comment_end = Table$get(comments, &p, parse_comments_info); if (comment_end) { *pos = *comment_end; - return Text$from_strn(p, (int64_t)(*comment_end - p)); + return Text$from_strn(p, (size_t)(*comment_end - p)); } } return NONE_TEXT; |
