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

Fix implicit objects in indented arguments after other arguments #1629

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion source/parser.hera
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ NestedArgumentList
return stripTrailingImplicitComma(args.flat())

NestedArgument
Nested:indent !Bullet SingleLineArgumentExpressions:args ParameterElementDelimiter:comma ->
# Exclude `a: b` property definition, leaving it for potentially multi-line
# NestedImplicitObjectLiteral
!NestedImplicitPropertyDefinition Nested:indent !Bullet SingleLineArgumentExpressions:args ParameterElementDelimiter:comma ->
// Attach indentation to first argument in SingleLineArgumentExpressions
let [ arg0, ...rest ] = args
arg0 = prepend(indent, arg0)
Expand Down
22 changes: 22 additions & 0 deletions test/function-application.civet
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,28 @@ describe "function application", ->
.y)
"""

// #1623
testCase """
nested multiline arguments after regular arguments
---
func
=> foo
a: b
c: d
=> bar
. 1
. 2
---
func(
() => foo, {
a: b,
c: d,
},
() => bar, [
1,
2])
"""

testCase """
mix of trailing members
---
Expand Down
Loading