Skip to content
Permalink
Browse files
Fixed #4563: Formatter error with lambda initializer
  • Loading branch information
asterite committed Jun 13, 2017
1 parent 1a71e3d commit 3d5e845
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
@@ -1045,4 +1045,6 @@ describe Crystal::Formatter do
assert_format "foo bar, \\\nbaz", "foo bar,\n baz"

assert_format "alias X = ((Y, Z) ->)"

assert_format "def x(@y = ->(z) {})\nend"
end
@@ -1953,6 +1953,10 @@ module Crystal
end

if default_value
# The default value might be a Proc with args, so
# we need to remember this and restore it later
old_last_arg_is_skip = @last_arg_is_skip

skip_space_or_newline

check_align = check_assign_length node
@@ -1961,6 +1965,8 @@ module Crystal
skip_space_or_newline
accept default_value
check_assign_align before_column, default_value if check_align

@last_arg_is_skip = old_last_arg_is_skip
end

# This is the case of an enum member

0 comments on commit 3d5e845

Please sign in to comment.