feat: extract argument list parsing into finishArgumentList helper
Extract the duplicated argument list parsing logic from methodCall and subscript into a shared finishArgumentList function. This unifies the comma-separated expression parsing, arity tracking, and newline handling into a single location. Also add a new test case verifying that newlines after commas and before closing delimiters are correctly handled in both method calls and subscript expressions.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
class Foo {
|
||||
method(a, b) { "method " + a + " " + b }
|
||||
[a, b] { "subscript " + a + " " + b }
|
||||
}
|
||||
|
||||
var foo = new Foo
|
||||
|
||||
// Allow newlines after commas and before ")".
|
||||
IO.print(foo.method("a",
|
||||
|
||||
"b"
|
||||
|
||||
)) // expect: method a b
|
||||
|
||||
// Allow newlines after commas and before "]".
|
||||
IO.print(foo["a",
|
||||
|
||||
"b"
|
||||
|
||||
]) // expect: subscript a b
|
||||
Reference in New Issue
Block a user