Skip to content

Commit

Permalink
Make attribute Promise<T>[] attr; work.
Browse files Browse the repository at this point in the history
This appears in the #attr-basic test case for ReSpec.

Fixes w3c#19.
  • Loading branch information
jyasskin committed Apr 22, 2015
1 parent d2da147 commit 4e64aae
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/webidl2.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@
ret.idlType = type() || error("Error parsing generic type " + value);
all_ws();
if (!consume(OTHER, ">")) error("Unterminated generic type " + value);
all_ws();
if (consume(OTHER, "?")) ret.nullable = true;
type_suffix(ret);
return ret;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion test/syntax/idl/generic.widl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
interface Foo {
Promise<ResponsePromise<sequence<DOMString?>>> bar();
readonly attribute Promise<DOMString>[] baz;
};

// Extracted from https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ on 2014-05-08
Expand All @@ -14,4 +15,3 @@ interface ServiceWorkerClients {
interface FetchEvent : Event {
ResponsePromise<any> default();
};

25 changes: 25 additions & 0 deletions test/syntax/json/generic.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@
"name": "bar",
"arguments": [],
"extAttrs": []
},
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": "Promise",
"nullable": false,
"array": 1,
"nullableArray": [false],
"union": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "DOMString"
}
},
"name": "baz",
"extAttrs": []
}
],
"inheritance": null,
Expand Down

0 comments on commit 4e64aae

Please sign in to comment.