Skip to content

Commit

Permalink
Merge pull request #1629 from DanielXMoore/implicit-object-args
Browse files Browse the repository at this point in the history
Fix implicit objects in indented arguments after other arguments
  • Loading branch information
edemaine authored Dec 2, 2024
2 parents 06addc3 + 1b2b5e9 commit 9b5b016
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
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

0 comments on commit 9b5b016

Please sign in to comment.