Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ Extended attributes are arrays of items that look like this:
"extAttrs": [{
"name": "TreatNullAs",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "identifier",
"value": "EmptyString"
Expand All @@ -547,6 +548,7 @@ The fields are as follows:
whereas the lack thereof will yield a `null`. If there is an `rhs` field then
they are the right-hand side's arguments, otherwise they apply to the extended
attribute directly.
* `type`: Always `"extended-attribute"`.
* `rhs`: If there is a right-hand side, this will capture its `type` (which can be
"identifier" or "identifier-list") and its `value`.
* `typePair`: If the extended attribute is a `MapClass` this will capture the
Expand Down
3 changes: 2 additions & 1 deletion lib/webidl2.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@
if (!name) return;
const ret = {
name: name.value,
"arguments": null
"arguments": null,
type: "extended-attribute",
};
all_ws();
const eq = consume(OTHER, "=");
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/allowany.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"extAttrs": [
{
"name": "AllowAny",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
],
"idlType": {
Expand Down
6 changes: 4 additions & 2 deletions test/syntax/json/constructor.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"extAttrs": [
{
"name": "Constructor",
"arguments": null
"arguments": null,
"type": "extended-attribute"
},
{
"name": "Constructor",
Expand All @@ -91,7 +92,8 @@
},
"name": "radius"
}
]
],
"type": "extended-attribute"
}
]
}
Expand Down
11 changes: 9 additions & 2 deletions test/syntax/json/extended-attributes.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{
"name": "Global",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "identifier-list",
"value": [
Expand All @@ -20,6 +21,7 @@
{
"name": "Exposed",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "identifier",
"value": "ServiceWorker"
Expand All @@ -37,6 +39,7 @@
{
"name": "IntAttr",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "integer",
"value": "0"
Expand All @@ -45,6 +48,7 @@
{
"name": "FloatAttr",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "float",
"value": "3.14"
Expand All @@ -53,6 +57,7 @@
{
"name": "StringAttr",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "string",
"value": "\"abc\""
Expand Down Expand Up @@ -134,7 +139,8 @@
"extAttrs": [
{
"name": "Constructor",
"arguments": null
"arguments": null,
"type": "extended-attribute"
},
{
"name": "Constructor",
Expand All @@ -152,7 +158,8 @@
},
"name": "radius"
}
]
],
"type": "extended-attribute"
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/iterable.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"extAttrs": [
{
"name": "XAttr",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
},
Expand Down
6 changes: 4 additions & 2 deletions test/syntax/json/maplike.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
"extAttrs": [
{
"name": "XAttr2",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
},
Expand All @@ -89,7 +90,8 @@
"extAttrs": [
{
"name": "XAttr3",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions test/syntax/json/namedconstructor.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{
"name": "NamedConstructor",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "identifier",
"value": "Audio"
Expand All @@ -31,6 +32,7 @@
"name": "src"
}
],
"type": "extended-attribute",
"rhs": {
"type": "identifier",
"value": "Audio"
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/nointerfaceobject.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"extAttrs": [
{
"name": "NoInterfaceObject",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/overloading.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@
"extAttrs": [
{
"name": "AllowAny",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
],
"idlType": {
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/overridebuiltins.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"extAttrs": [
{
"name": "OverrideBuiltins",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/prototyperoot.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"extAttrs": [
{
"name": "PrototypeRoot",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
}
Expand Down
1 change: 1 addition & 0 deletions test/syntax/json/putforwards.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{
"name": "PutForwards",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "identifier",
"value": "full"
Expand Down
6 changes: 4 additions & 2 deletions test/syntax/json/record.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
},
"name": "init"
}
]
],
"type": "extended-attribute"
}
]
},
Expand Down Expand Up @@ -199,7 +200,8 @@
"extAttrs": [
{
"name": "XAttr",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/replaceable.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"extAttrs": [
{
"name": "Replaceable",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/sequence.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@
"extAttrs": [
{
"name": "XAttr",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/setlike.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"extAttrs": [
{
"name": "XAttr",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/stringifier-attribute.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"extAttrs": [
{
"name": "Constructor",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/stringifier-custom.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
"extAttrs": [
{
"name": "Constructor",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
}
Expand Down
1 change: 1 addition & 0 deletions test/syntax/json/treatasnull.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
{
"name": "TreatNullAs",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "identifier",
"value": "EmptyString"
Expand Down
1 change: 1 addition & 0 deletions test/syntax/json/treatasundefined.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
{
"name": "TreatUndefinedAs",
"arguments": null,
"type": "extended-attribute",
"rhs": {
"type": "identifier",
"value": "EmptyString"
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/typedef.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@
"extAttrs": [
{
"name": "Clamp",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion test/syntax/json/uniontype.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
"extAttrs": [
{
"name": "EnforceRange",
"arguments": null
"arguments": null,
"type": "extended-attribute"
}
],
"nullable": false,
Expand Down