Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format lambda body like value declaration expressions #31

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

jmackie
Copy link
Member

@jmackie jmackie commented Apr 14, 2022

As part of adding if-then-else expressions (#21) I realised there are a few different ways we want to format expressions as part of value declarations.

-- inline
five = 5;
inline_if = if true then yeh else nah;

-- multiline hanging (calls, arrays...)
hanging_call = some_function(
    arg0,
    arg1,
    arg2,
);

-- multiline newline (if-then-else, let, matches...)
multi_line_if = 
    if true then
        yeh
    else
        nah;

But this same logic also applies to the function bodies. Hence I've moved this logic to a helper function, now used by both value declaration formatting and "lambda" formatting.

@ditto-lang ditto-lang deleted a comment from codecov bot Apr 14, 2022
@jmackie jmackie merged commit 7f42486 into main Apr 14, 2022
@jmackie jmackie deleted the gen-body-expression-fmt-helper branch April 14, 2022 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant