Skip to content

Commit

Permalink
Skip newline after block arg in paren call (#5237)
Browse files Browse the repository at this point in the history
Fixed #5235
  • Loading branch information
makenowjust authored and RX14 committed Nov 3, 2017
1 parent 074d61c commit eb4fa17
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions spec/compiler/parser/parser_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ describe "Parser" do
it_parses "foo(&.as?(T).bar)", Call.new(nil, "foo", block: Block.new([Var.new("__arg0")], Call.new(NilableCast.new(Var.new("__arg0"), "T".path), "bar")))
it_parses "foo &.as?(T)", Call.new(nil, "foo", block: Block.new([Var.new("__arg0")], NilableCast.new(Var.new("__arg0"), "T".path)))
it_parses "foo &.as?(T).bar", Call.new(nil, "foo", block: Block.new([Var.new("__arg0")], Call.new(NilableCast.new(Var.new("__arg0"), "T".path), "bar")))
it_parses "foo(\n &.block\n)", Call.new(nil, "foo", block: Block.new([Var.new("__arg0")], Call.new(Var.new("__arg0"), "block")))

it_parses "foo.[0]", Call.new("foo".call, "[]", 0.int32)
it_parses "foo.[0] = 1", Call.new("foo".call, "[]=", [0.int32, 1.int32] of ASTNode)
Expand Down
1 change: 1 addition & 0 deletions src/compiler/crystal/syntax/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,7 @@ module Crystal
end_location = token_end_location

if check_paren
skip_space_or_newline
check :")"
next_token_skip_space
else
Expand Down

0 comments on commit eb4fa17

Please sign in to comment.