Skip to content

Commit

Permalink
fix: prevent empty iterable declaration (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanaz authored Jun 4, 2018
1 parent d36f7e4 commit 1ea9f9c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webidl2.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@
if (ret.type !== 'maplike' && ret.type !== 'setlike')
delete ret.readonly;
if (consume("<")) {
ret.idlType = [type_with_extended_attributes()] || error(`Error parsing ${ittype} declaration`);
ret.idlType = [type_with_extended_attributes() || error(`Error parsing ${ittype} declaration`)];
if (secondTypeAllowed) {
if (consume(",")) {
ret.idlType.push(type_with_extended_attributes());
Expand Down
3 changes: 3 additions & 0 deletions test/invalid/idl/iterable-empty.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface X {
iterable<>;
};
4 changes: 4 additions & 0 deletions test/invalid/json/iterable-empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"message": "Got an error during or right after parsing `interface X`: Error parsing iterable declaration",
"line": 2
}

0 comments on commit 1ea9f9c

Please sign in to comment.