mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
parent
7af408f58d
commit
394495d307
9 changed files with 14 additions and 52 deletions
|
@ -377,11 +377,7 @@ fn fmt_expect_fx<'a>(
|
|||
condition.format(buf, return_indent);
|
||||
}
|
||||
|
||||
pub fn fmt_value_def(
|
||||
buf: &mut Buf<'_>,
|
||||
def: &roc_parse::ast::ValueDef<'_>,
|
||||
indent: u16,
|
||||
) {
|
||||
pub fn fmt_value_def(buf: &mut Buf<'_>, def: &roc_parse::ast::ValueDef<'_>, indent: u16) {
|
||||
def.format(buf, indent);
|
||||
}
|
||||
|
||||
|
@ -393,12 +389,7 @@ pub fn fmt_defs(buf: &mut Buf<'_>, defs: &Defs<'_>, indent: u16) {
|
|||
defs.format(buf, indent);
|
||||
}
|
||||
|
||||
pub fn fmt_body<'a>(
|
||||
buf: &mut Buf<'_>,
|
||||
pattern: &'a Pattern<'a>,
|
||||
body: &'a Expr<'a>,
|
||||
indent: u16,
|
||||
) {
|
||||
pub fn fmt_body<'a>(buf: &mut Buf<'_>, pattern: &'a Pattern<'a>, body: &'a Expr<'a>, indent: u16) {
|
||||
pattern.format_with_options(buf, Parens::InApply, Newlines::No, indent);
|
||||
buf.indent(indent);
|
||||
buf.push_str(" =");
|
||||
|
|
|
@ -4,12 +4,7 @@ use crate::spaces::{fmt_comments_only, fmt_spaces, NewlineAt, INDENT};
|
|||
use crate::Buf;
|
||||
use roc_parse::ast::{Base, CommentOrNewline, Pattern, PatternAs};
|
||||
|
||||
pub fn fmt_pattern<'a>(
|
||||
buf: &mut Buf<'_>,
|
||||
pattern: &'a Pattern<'a>,
|
||||
indent: u16,
|
||||
parens: Parens,
|
||||
) {
|
||||
pub fn fmt_pattern<'a>(buf: &mut Buf<'_>, pattern: &'a Pattern<'a>, indent: u16, parens: Parens) {
|
||||
pattern.format_with_options(buf, parens, Newlines::No, indent);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,22 +21,14 @@ use crate::{Ast, Buf};
|
|||
/// The number of spaces to indent.
|
||||
pub const INDENT: u16 = 4;
|
||||
|
||||
pub fn fmt_default_spaces(
|
||||
buf: &mut Buf<'_>,
|
||||
spaces: &[CommentOrNewline<'_>],
|
||||
indent: u16,
|
||||
) {
|
||||
pub fn fmt_default_spaces(buf: &mut Buf<'_>, spaces: &[CommentOrNewline<'_>], indent: u16) {
|
||||
if spaces.is_empty() {
|
||||
buf.spaces(1);
|
||||
} else {
|
||||
fmt_spaces(buf, spaces.iter(), indent);
|
||||
}
|
||||
}
|
||||
pub fn fmt_default_newline(
|
||||
buf: &mut Buf<'_>,
|
||||
spaces: &[CommentOrNewline<'_>],
|
||||
indent: u16,
|
||||
) {
|
||||
pub fn fmt_default_newline(buf: &mut Buf<'_>, spaces: &[CommentOrNewline<'_>], indent: u16) {
|
||||
if spaces.is_empty() {
|
||||
buf.newline();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue