diff --git a/src/vm/wren_compiler.c b/src/vm/wren_compiler.c index 5cb34063a..44bdf6617 100644 --- a/src/vm/wren_compiler.c +++ b/src/vm/wren_compiler.c @@ -1876,6 +1876,9 @@ static void methodCall(Compiler* compiler, Code instruction, { called.type = SIG_METHOD; + // Allow new line before an empty argument list + ignoreNewlines(compiler); + // Allow empty an argument list. if (peek(compiler) != TOKEN_RIGHT_PAREN) { @@ -2547,6 +2550,9 @@ static void parameterList(Compiler* compiler, Signature* signature) signature->type = SIG_METHOD; + // Allow new line before an empty argument list + ignoreNewlines(compiler); + // Allow an empty parameter list. if (match(compiler, TOKEN_RIGHT_PAREN)) return; diff --git a/test/language/method/no_parameters_new_line.wren b/test/language/method/no_parameters_new_line.wren new file mode 100644 index 000000000..d7d6a12c6 --- /dev/null +++ b/test/language/method/no_parameters_new_line.wren @@ -0,0 +1,19 @@ + +class Foo { + static call( + ) { + System.print("Success") // expect: Success + } + + construct new () {} + + call( + ) { + System.print("Success") // expect: Success + } +} + +Foo.call( +) +Foo.new().call( +)