-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix 3112 - disallow commas after block arg
Prism was already disallowing arguments after block args, but in parse.y, any comma after a block arg is a syntax error. This moves the error handling into `PM_TOKEN_UAMPERSAND` where we can check if the current type is `PM_TOKEN_COMMA`then raise an error. I've also updated the tests to include the examplesfrom #3112. Fixes: #3112
- Loading branch information
1 parent
fb25917
commit 754cf8e
Showing
2 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
a(&block, foo) | ||
^~~ unexpected argument after a block argument | ||
^ unexpected argument after a block argument | ||
a(&block,) | ||
^ unexpected argument after a block argument | ||
a.(&block,) | ||
^ unexpected argument after a block argument | ||
a[&block,] | ||
^ unexpected argument after a block argument | ||
def a(&block) | ||
p(&block,) | ||
^ unexpected argument after a block argument | ||
a.(&block,) | ||
^ unexpected argument after a block argument | ||
a[&block,] | ||
^ unexpected argument after a block argument | ||
end | ||
|