Repository: w3c/webidl2.js
Pull request #272 (2019-03-06 02:19:01)

refactor: interface/mixin as classes
Baseline noise alert ⚠️ 


Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index eecdadd..41d29c4 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -753,20 +753,16 @@
     }
 
     function callback() {
-      let ret;
-      const callbackToken = consume("callback");
-      if (!callbackToken) return;
+      const callback = consume("callback");
+      if (!callback) return;
       const tok = consume("interface");
       if (tok) {
-        ret = interface_rest({ typeName: "callback interface" });
-        ret.trivia.callback = callbackToken.trivia;
-        ret.trivia.base = tok.trivia;
-        return ret;
+        return Interface.parse(tok, { callback });
       }
-      const trivia = { base: callbackToken.trivia };
+      const trivia = { base: callback.trivia };
       const name = consume(ID) || error("No name for callback");
       trivia.name = name.trivia;
-      ret = current = { type: "callback", name: sanitize_name(name.value, "callback") };
+      const ret = current = { type: "callback", name: sanitize_name(name.value, "callback") };
       const assign = consume("=") || error("No assignment in callback");
       trivia.assign = assign.trivia;
       ret.idlType = return_type() || error("Missing return type");
@@ -1006,92 +1002,60 @@
         return this.tokens.name.value;
       }
     }
+    class Interface extends Container {
+      static parse(base, { callback = null, partial = null } = {}) {
+        const tokens = { callback, partial, base };
+        return Container.parse(new Interface({ tokens }), {
+          type: "interface",
+          inheritable: !partial,
+          allowedMembers: [
+            [const_],
+            [static_member],
+            [stringifier],
+            [iterable],
+            [attribute],
+            [operation]
+          ]
+        });
+      }
 
-    function interface_rest({ typeName = "interface", partialModifier = null } = {}) {
-      const name = consume(ID) || error("No name for interface");
-      const trivia = {
-        base: null,
-        name: name.trivia
-      };
-      const mems = [];
-      const ret = current = {
-        type: typeName,
-        name: partialModifier ? name.value : sanitize_name(name.value, "interface"),
-        escapedName: name.value,
-        partial: partialModifier,
-        members: mems,
-        trivia
-      };
-      if (!partialModifier) ret.inheritance = Inheritance.parse() || null;
-      const open = consume("{") || error("Bodyless interface");
-      trivia.open = open.trivia;
-      while (true) {
-        const close = consume("}");
-        if (close) {
-          trivia.close = close.trivia;
-          const termination = consume(";") || error("Missing semicolon after interface");
-          trivia.termination = termination.trivia;
-          return ret;
+      get type() {
+        if (this.tokens.callback) {
+          return "callback interface";
         }
-        const ea = extended_attrs();
-        const mem = const_() ||
-          static_member() ||
-          stringifier() ||
-          iterable() ||
-          attribute() ||
-          operation() ||
-          error("Unknown member");
-        mem.extAttrs = ea;
-        ret.members.push(mem);
+        return "interface";
       }
     }
 
-    function mixin_rest({ partialModifier = null } = {}) {
-      const mixin = consume("mixin");
-      if (!mixin) return;
-      const trivia = {
-        base: null,
-        mixin: mixin.trivia
-      };
-      const name = consume(ID) || error("No name for interface mixin");
-      trivia.name = name.trivia;
-      const mems = [];
-      const ret = current = {
-        type: "interface mixin",
-        name: partialModifier ? name.value : sanitize_name(name.value, "interface mixin"),
-        escapedName: name.value,
-        partial: partialModifier,
-        members: mems,
-        trivia
-      };
-      const open = consume("{") || error("Bodyless interface mixin");
-      trivia.open = open.trivia;
-      while (true) {
-        const close = consume("}");
-        if (close) {
-          trivia.close = close.trivia;
-          const termination = consume(";") || error("Missing semicolon after interface mixin");
-          trivia.termination = termination.trivia;
-          return ret;
+    class Mixin extends Container {
+      static parse(base, { partial } = {}) {
+        const tokens = { partial, base };
+        tokens.mixin = consume("mixin");
+        if (!tokens.mixin) {
+          return;
         }
-        const ea = extended_attrs();
-        const mem = const_() ||
-          stringifier() ||
-          attribute({ noInherit: true }) ||
-          operation({ regular: true }) ||
-          error("Unknown member");
-        mem.extAttrs = ea;
-        ret.members.push(mem);
+        return Container.parse(new Mixin({ tokens }), {
+          type: "interface mixin",
+          allowedMembers: [
+            [const_],
+            [stringifier],
+            [attribute, { noInherit: true }],
+            [operation, { regular: true }]
+          ]
+        });
+      }
+
+      get type() {
+        return "interface mixin";
       }
     }
 
     function interface_(opts) {
       const base = consume("interface");
       if (!base) return;
-      const ret = mixin_rest(opts) ||
-        interface_rest(opts) ||
+      const ret = Mixin.parse(base, opts) ||
+        Interface.parse(base, opts) ||
         error("Interface has no proper body");
-      ret.trivia.base = base.trivia;
       return ret;
     }
 
@@ -1119,9 +1083,8 @@
     function partial() {
       const partial = optional_consume("partial");
       if (!partial) return;
-      const partialModifier = { trivia: partial.trivia };
       return Dictionary.parse({ partial }) ||
-        interface_({ partialModifier }) ||
+        interface_({ partial }) ||
         Namespace.parse({ partial }) ||
         error("Partial doesn't apply to anything");
     }


Test patch:
diff --git a/test/invalid/baseline/duplicate.txt b/test/invalid/baseline/duplicate.txt
index a9d2873..034d6e4 100644
--- a/test/invalid/baseline/duplicate.txt
+++ b/test/invalid/baseline/duplicate.txt
@@ -1,3 +1,3 @@
-Syntax error at line 3, since `typedef Test`:
+Syntax error at line 3, since `interface Test`:
 interface Test {
                ^ The name "Test" of type "typedef" was already seen
diff --git a/test/syntax/baseline/allowany.json b/test/syntax/baseline/allowany.json
index 2180109..46b5925 100644
--- a/test/syntax/baseline/allowany.json
+++ b/test/syntax/baseline/allowany.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "B",
         "escapedName": "B",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -187,15 +187,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/attributes.json b/test/syntax/baseline/attributes.json
index 1e54bb6..2ed7e09 100644
--- a/test/syntax/baseline/attributes.json
+++ b/test/syntax/baseline/attributes.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Person",
         "escapedName": "Person",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -67,15 +67,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/callback.json b/test/syntax/baseline/callback.json
index 207d9e8..3f3e0b3 100644
--- a/test/syntax/baseline/callback.json
+++ b/test/syntax/baseline/callback.json
@@ -61,7 +61,7 @@
         "type": "callback interface",
         "name": "EventHandler",
         "escapedName": "EventHandler",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -128,16 +128,16 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
+            "callback": "\n\n",
             "base": " ",
             "name": " ",
             "open": " ",
             "close": "\n",
-            "termination": "",
-            "callback": "\n\n"
-        },
-        "inheritance": null,
-        "extAttrs": null
+            "termination": ""
+        }
     },
     {
         "type": "callback",
diff --git a/test/syntax/baseline/constants.json b/test/syntax/baseline/constants.json
index fec1efe..c6f3df2 100644
--- a/test/syntax/baseline/constants.json
+++ b/test/syntax/baseline/constants.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Util",
         "escapedName": "Util",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "const",
@@ -270,15 +270,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/constructor.json b/test/syntax/baseline/constructor.json
index 5f75aae..89318df 100644
--- a/test/syntax/baseline/constructor.json
+++ b/test/syntax/baseline/constructor.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Circle",
         "escapedName": "Circle",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -124,14 +124,6 @@
                 "extAttrs": null
             }
         ],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n",
-            "termination": ""
-        },
-        "inheritance": null,
         "extAttrs": {
             "trivia": {
                 "open": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
@@ -196,6 +188,14 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n",
+            "termination": ""
         }
     },
     {
diff --git a/test/syntax/baseline/documentation-dos.json b/test/syntax/baseline/documentation-dos.json
index 3246edb..0358d9e 100644
--- a/test/syntax/baseline/documentation-dos.json
+++ b/test/syntax/baseline/documentation-dos.json
@@ -3,17 +3,17 @@
         "type": "interface",
         "name": "Documentation",
         "escapedName": "Documentation",
-        "partial": null,
+        "inheritance": null,
         "members": [],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "/**\n* \\brief Testing documentation features\n*\n* This is a\n* single paragraph\n*\n* <p>This is valid.</p>\n* <p>This is <em>valid</em>.</p>\n* <p>This is <b>valid</b>.</p>\n* <p>This is <a href=''>valid</a>.</p>\n* <ul>\n* <li>This</li>\n* <li>is</li>\n* <li>valid</li>\n* </ul>\n* <dl>\n* <dt>This</dt>\n* <dd>valid</dd>\n* </dl>\n* <table>\n* <tr>\n* <td>this</td>\n* <td>is</td>\n* </tr>\n* <tr>\n* <td>valid</td>\n* </tr>\n* </table>\n* <p>This is <br> valid.</p>\n* <p>This is <br /> valid.</p>\n* <p>This is <br/> valid.</p>\n*/\n",
             "name": " ",
             "open": " ",
             "close": "",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/documentation.json b/test/syntax/baseline/documentation.json
index e5b7984..796b22b 100644
--- a/test/syntax/baseline/documentation.json
+++ b/test/syntax/baseline/documentation.json
@@ -3,17 +3,17 @@
         "type": "interface",
         "name": "Documentation",
         "escapedName": "Documentation",
-        "partial": null,
+        "inheritance": null,
         "members": [],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "/**\n* \\brief Testing documentation features\n*\n* This is a\n* single paragraph\n*\n* <p>This is valid.</p>\n* <p>This is <em>valid</em>.</p>\n* <p>This is <b>valid</b>.</p>\n* <p>This is <a href=''>valid</a>.</p>\n* <ul>\n* <li>This</li>\n* <li>is</li>\n* <li>valid</li>\n* </ul>\n* <dl>\n* <dt>This</dt>\n* <dd>valid</dd>\n* </dl>\n* <table>\n* <tr>\n* <td>this</td>\n* <td>is</td>\n* </tr>\n* <tr>\n* <td>valid</td>\n* </tr>\n* </table>\n* <p>This is <br> valid.</p>\n* <p>This is <br /> valid.</p>\n* <p>This is <br/> valid.</p>\n* <p><img src=\"foo.png\" alt=\"Valid\"/></p>\n*/\n",
             "name": " ",
             "open": " ",
             "close": "",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/enum.json b/test/syntax/baseline/enum.json
index 63f2ec3..49292de 100644
--- a/test/syntax/baseline/enum.json
+++ b/test/syntax/baseline/enum.json
@@ -42,7 +42,7 @@
         "type": "interface",
         "name": "Meal",
         "escapedName": "Meal",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -197,15 +197,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "enum",
diff --git a/test/syntax/baseline/equivalent-decl.json b/test/syntax/baseline/equivalent-decl.json
index eed60ce..cb18cb8 100644
--- a/test/syntax/baseline/equivalent-decl.json
+++ b/test/syntax/baseline/equivalent-decl.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Dictionary",
         "escapedName": "Dictionary",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -204,21 +204,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "Dictionary2",
         "escapedName": "Dictionary2",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -569,15 +569,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/escaped-name.json b/test/syntax/baseline/escaped-name.json
index 7a22315..0b5612e 100644
--- a/test/syntax/baseline/escaped-name.json
+++ b/test/syntax/baseline/escaped-name.json
@@ -3,15 +3,6 @@
         "type": "interface",
         "name": "Iroha",
         "escapedName": "_Iroha",
-        "partial": null,
-        "members": [],
-        "trivia": {
-            "base": "",
-            "name": " ",
-            "open": " ",
-            "close": "",
-            "termination": ""
-        },
         "inheritance": {
             "name": "Magic",
             "escapedName": "_Magic",
@@ -20,7 +11,16 @@
                 "name": " "
             }
         },
-        "extAttrs": null
+        "members": [],
+        "extAttrs": null,
+        "partial": null,
+        "trivia": {
+            "base": "",
+            "name": " ",
+            "open": " ",
+            "close": "",
+            "termination": ""
+        }
     },
     {
         "type": "includes",
diff --git a/test/syntax/baseline/extended-attributes.json b/test/syntax/baseline/extended-attributes.json
index 05df551..669ef58 100644
--- a/test/syntax/baseline/extended-attributes.json
+++ b/test/syntax/baseline/extended-attributes.json
@@ -3,15 +3,6 @@
         "type": "interface",
         "name": "ServiceWorkerGlobalScope",
         "escapedName": "ServiceWorkerGlobalScope",
-        "partial": null,
-        "members": [],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n\n",
-            "termination": ""
-        },
         "inheritance": {
             "name": "WorkerGlobalScope",
             "escapedName": "WorkerGlobalScope",
@@ -20,6 +11,7 @@
                 "name": " "
             }
         },
+        "members": [],
         "extAttrs": {
             "trivia": {
                 "open": "// Extracted from http://www.w3.org/TR/2015/WD-service-workers-20150205/\n\n",
@@ -79,22 +71,22 @@
                     "separator": null
                 }
             ]
-        }
-    },
-    {
-        "type": "interface",
-        "name": "IdInterface",
-        "escapedName": "IdInterface",
+        },
         "partial": null,
-        "members": [],
         "trivia": {
             "base": "\n",
             "name": " ",
             "open": " ",
-            "close": "",
+            "close": "\n\n",
             "termination": ""
-        },
+        }
+    },
+    {
+        "type": "interface",
+        "name": "IdInterface",
+        "escapedName": "IdInterface",
         "inheritance": null,
+        "members": [],
         "extAttrs": {
             "trivia": {
                 "open": "\n\n// Conformance with ExtendedAttributeList grammar in http://www.w3.org/TR/WebIDL/#idl-extended-attributes\n// Section 3.11\n",
@@ -159,13 +151,21 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "",
+            "termination": ""
         }
     },
     {
         "type": "interface",
         "name": "Circle",
         "escapedName": "Circle",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -286,14 +286,6 @@
                 "extAttrs": null
             }
         ],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n",
-            "termination": ""
-        },
-        "inheritance": null,
         "extAttrs": {
             "trivia": {
                 "open": "\n\n// Extracted from http://www.w3.org/TR/2016/REC-WebIDL-1-20161215/#Constructor on 2017-5-18 with whitespace differences\n",
@@ -358,13 +350,21 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n",
+            "termination": ""
         }
     },
     {
         "type": "interface",
         "name": "I",
         "escapedName": "I",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -450,14 +450,6 @@
                 "extAttrs": null
             }
         ],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n",
-            "termination": ""
-        },
-        "inheritance": null,
         "extAttrs": {
             "trivia": {
                 "open": "\n\n// Extracted from https://heycam.github.io/webidl/#idl-annotated-types on 2017-12-15\n",
@@ -482,6 +474,14 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n",
+            "termination": ""
         }
     },
     {
diff --git a/test/syntax/baseline/generic.json b/test/syntax/baseline/generic.json
index 6858c1d..baaa00c 100644
--- a/test/syntax/baseline/generic.json
+++ b/test/syntax/baseline/generic.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Foo",
         "escapedName": "Foo",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -167,21 +167,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "ServiceWorkerClients",
         "escapedName": "ServiceWorkerClients",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -304,21 +304,28 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n// Extracted from https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ on 2014-05-08\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "FetchEvent",
         "escapedName": "FetchEvent",
-        "partial": null,
+        "inheritance": {
+            "name": "Event",
+            "escapedName": "Event",
+            "trivia": {
+                "colon": " ",
+                "name": " "
+            }
+        },
         "members": [
             {
                 "type": "operation",
@@ -380,22 +387,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n// Extracted from https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ on 2014-05-13\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": {
-            "name": "Event",
-            "escapedName": "Event",
-            "trivia": {
-                "colon": " ",
-                "name": " "
-            }
-        },
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/getter-setter.json b/test/syntax/baseline/getter-setter.json
index 24cdf0e..b60bebd 100644
--- a/test/syntax/baseline/getter-setter.json
+++ b/test/syntax/baseline/getter-setter.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Dictionary",
         "escapedName": "Dictionary",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -196,15 +196,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/identifier-hyphen.json b/test/syntax/baseline/identifier-hyphen.json
index b7d7030..3bc9427 100644
--- a/test/syntax/baseline/identifier-hyphen.json
+++ b/test/syntax/baseline/identifier-hyphen.json
@@ -3,9 +3,6 @@
         "type": "interface",
         "name": "CSSStyleDeclaration",
         "escapedName": "CSSStyleDeclaration",
-        "partial": {
-            "trivia": ""
-        },
         "members": [
             {
                 "type": "attribute",
@@ -78,14 +75,17 @@
                 }
             }
         ],
+        "extAttrs": null,
+        "partial": {
+            "trivia": ""
+        },
         "trivia": {
             "base": " ",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/identifier-qualified-names.json b/test/syntax/baseline/identifier-qualified-names.json
index 27055e0..affd9ea 100644
--- a/test/syntax/baseline/identifier-qualified-names.json
+++ b/test/syntax/baseline/identifier-qualified-names.json
@@ -30,7 +30,7 @@
         "type": "interface",
         "name": "System",
         "escapedName": "System",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -160,21 +160,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n  // Interface identifier: \"System\"\n  // Qualified name:       \"::framework::System\"\n  ",
             "name": " ",
             "open": " ",
             "close": "\n  ",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "TextField",
         "escapedName": "TextField",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -237,21 +237,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n\n    // Interface identifier: \"TextField\"\n    // Qualified name:       \"::framework::gui::TextField\"\n    ",
             "name": " ",
             "open": " ",
             "close": "\n    ",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "FooEventTarget",
         "escapedName": "FooEventTarget",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -320,15 +320,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/indexed-properties.json b/test/syntax/baseline/indexed-properties.json
index 4b8f772..cfae69e 100644
--- a/test/syntax/baseline/indexed-properties.json
+++ b/test/syntax/baseline/indexed-properties.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "OrderedMap",
         "escapedName": "OrderedMap",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -511,15 +511,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/inherits-getter.json b/test/syntax/baseline/inherits-getter.json
index 5f24685..be85678 100644
--- a/test/syntax/baseline/inherits-getter.json
+++ b/test/syntax/baseline/inherits-getter.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Animal",
         "escapedName": "Animal",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -37,21 +37,28 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "Person",
         "escapedName": "Person",
-        "partial": null,
+        "inheritance": {
+            "name": "Animal",
+            "escapedName": "Animal",
+            "trivia": {
+                "colon": " ",
+                "name": " "
+            }
+        },
         "members": [
             {
                 "type": "attribute",
@@ -120,28 +127,28 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
+        }
+    },
+    {
+        "type": "interface",
+        "name": "Ghost",
+        "escapedName": "Ghost",
         "inheritance": {
-            "name": "Animal",
-            "escapedName": "Animal",
+            "name": "Person",
+            "escapedName": "Person",
             "trivia": {
                 "colon": " ",
                 "name": " "
             }
         },
-        "extAttrs": null
-    },
-    {
-        "type": "interface",
-        "name": "Ghost",
-        "escapedName": "Ghost",
-        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -178,22 +185,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": {
-            "name": "Person",
-            "escapedName": "Person",
-            "trivia": {
-                "colon": " ",
-                "name": " "
-            }
-        },
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/interface-inherits.json b/test/syntax/baseline/interface-inherits.json
index dbe7f77..fa9cffc 100644
--- a/test/syntax/baseline/interface-inherits.json
+++ b/test/syntax/baseline/interface-inherits.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Animal",
         "escapedName": "Animal",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -35,21 +35,28 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "Human",
         "escapedName": "Human",
-        "partial": null,
+        "inheritance": {
+            "name": "Animal",
+            "escapedName": "Animal",
+            "trivia": {
+                "colon": " ",
+                "name": " "
+            }
+        },
         "members": [
             {
                 "type": "attribute",
@@ -81,13 +88,20 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
+        }
+    },
+    {
+        "type": "interface",
+        "name": "Dog",
+        "escapedName": "Dog",
         "inheritance": {
             "name": "Animal",
             "escapedName": "Animal",
@@ -96,13 +110,6 @@
                 "name": " "
             }
         },
-        "extAttrs": null
-    },
-    {
-        "type": "interface",
-        "name": "Dog",
-        "escapedName": "Dog",
-        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -134,22 +141,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": {
-            "name": "Animal",
-            "escapedName": "Animal",
-            "trivia": {
-                "colon": " ",
-                "name": " "
-            }
-        },
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/iterable.json b/test/syntax/baseline/iterable.json
index 051b205..6decadf 100644
--- a/test/syntax/baseline/iterable.json
+++ b/test/syntax/baseline/iterable.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "IterableOne",
         "escapedName": "IterableOne",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "iterable",
@@ -34,21 +34,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "IterableTwo",
         "escapedName": "IterableTwo",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "iterable",
@@ -100,21 +100,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "IterableThree",
         "escapedName": "IterableThree",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "iterable",
@@ -162,15 +162,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/maplike.json b/test/syntax/baseline/maplike.json
index 46cc257..030da7d 100644
--- a/test/syntax/baseline/maplike.json
+++ b/test/syntax/baseline/maplike.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "MapLike",
         "escapedName": "MapLike",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "maplike",
@@ -54,21 +54,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "ReadOnlyMapLike",
         "escapedName": "ReadOnlyMapLike",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "maplike",
@@ -121,21 +121,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "I",
         "escapedName": "I",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "maplike",
@@ -220,15 +220,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n// Extracted from https://heycam.github.io/webidl/#idl-type-extended-attribute-associated-with on 2017-07-01\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/mixin.json b/test/syntax/baseline/mixin.json
index 96928fb..357a22f 100644
--- a/test/syntax/baseline/mixin.json
+++ b/test/syntax/baseline/mixin.json
@@ -3,7 +3,6 @@
         "type": "interface mixin",
         "name": "GlobalCrypto",
         "escapedName": "GlobalCrypto",
-        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -37,6 +36,8 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from https://heycam.github.io/webidl/#using-mixins-and-partials on 2017-11-02\n\n",
             "mixin": " ",
@@ -44,8 +45,7 @@
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "extAttrs": null
+        }
     },
     {
         "type": "includes",
@@ -79,9 +79,6 @@
         "type": "interface mixin",
         "name": "WindowOrWorkerGlobalScope",
         "escapedName": "WindowOrWorkerGlobalScope",
-        "partial": {
-            "trivia": "\n\n"
-        },
         "members": [
             {
                 "type": "attribute",
@@ -115,6 +112,10 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": {
+            "trivia": "\n\n"
+        },
         "trivia": {
             "base": " ",
             "mixin": " ",
@@ -122,15 +123,15 @@
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "extAttrs": null
+        }
     },
     {
         "type": "interface mixin",
         "name": "LocalCrypto",
         "escapedName": "_LocalCrypto",
-        "partial": null,
         "members": [],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "mixin": " ",
@@ -138,8 +139,7 @@
             "open": " ",
             "close": "",
             "termination": ""
-        },
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/namedconstructor.json b/test/syntax/baseline/namedconstructor.json
index 50a31f4..b21f492 100644
--- a/test/syntax/baseline/namedconstructor.json
+++ b/test/syntax/baseline/namedconstructor.json
@@ -3,15 +3,6 @@
         "type": "interface",
         "name": "HTMLAudioElement",
         "escapedName": "HTMLAudioElement",
-        "partial": null,
-        "members": [],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n  // ...\n",
-            "termination": ""
-        },
         "inheritance": {
             "name": "HTMLMediaElement",
             "escapedName": "HTMLMediaElement",
@@ -20,6 +11,7 @@
                 "name": " "
             }
         },
+        "members": [],
         "extAttrs": {
             "trivia": {
                 "open": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
@@ -98,6 +90,14 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n  // ...\n",
+            "termination": ""
         }
     },
     {
diff --git a/test/syntax/baseline/nointerfaceobject.json b/test/syntax/baseline/nointerfaceobject.json
index dbf4cf7..25945b2 100644
--- a/test/syntax/baseline/nointerfaceobject.json
+++ b/test/syntax/baseline/nointerfaceobject.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Query",
         "escapedName": "Query",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -73,14 +73,6 @@
                 "extAttrs": null
             }
         ],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n",
-            "termination": ""
-        },
-        "inheritance": null,
         "extAttrs": {
             "trivia": {
                 "open": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
@@ -98,6 +90,14 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n",
+            "termination": ""
         }
     },
     {
diff --git a/test/syntax/baseline/nullable.json b/test/syntax/baseline/nullable.json
index b4eba9d..e296e63 100644
--- a/test/syntax/baseline/nullable.json
+++ b/test/syntax/baseline/nullable.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "MyConstants",
         "escapedName": "MyConstants",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "const",
@@ -40,21 +40,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "Node",
         "escapedName": "Node",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -90,15 +90,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n  // ...\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/nullableobjects.json b/test/syntax/baseline/nullableobjects.json
index cb389a1..907e8b9 100644
--- a/test/syntax/baseline/nullableobjects.json
+++ b/test/syntax/baseline/nullableobjects.json
@@ -3,39 +3,39 @@
         "type": "interface",
         "name": "A",
         "escapedName": "A",
-        "partial": null,
+        "inheritance": null,
         "members": [],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from WebIDL spec 2011-05-23\n\n",
             "name": " ",
             "open": " ",
             "close": "\n  // ...\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "B",
         "escapedName": "B",
-        "partial": null,
+        "inheritance": null,
         "members": [],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n",
             "name": " ",
             "open": " ",
             "close": "\n  // ...\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "C",
         "escapedName": "C",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -170,15 +170,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n",
             "name": " ",
             "open": " ",
             "close": "\n\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/operation-optional-arg.json b/test/syntax/baseline/operation-optional-arg.json
index 1fff909..d1fd340 100644
--- a/test/syntax/baseline/operation-optional-arg.json
+++ b/test/syntax/baseline/operation-optional-arg.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "ColorCreator",
         "escapedName": "ColorCreator",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -169,15 +169,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/overloading.json b/test/syntax/baseline/overloading.json
index b68345b..2efa7db 100644
--- a/test/syntax/baseline/overloading.json
+++ b/test/syntax/baseline/overloading.json
@@ -3,39 +3,39 @@
         "type": "interface",
         "name": "A",
         "escapedName": "A",
-        "partial": null,
+        "inheritance": null,
         "members": [],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n  // ...\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "B",
         "escapedName": "B",
-        "partial": null,
+        "inheritance": null,
         "members": [],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n  // ...\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "C",
         "escapedName": "C",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -166,21 +166,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "D",
         "escapedName": "D",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -584,15 +584,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/overridebuiltins.json b/test/syntax/baseline/overridebuiltins.json
index 72512f6..1397c52 100644
--- a/test/syntax/baseline/overridebuiltins.json
+++ b/test/syntax/baseline/overridebuiltins.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "StringMap2",
         "escapedName": "StringMap2",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -107,14 +107,6 @@
                 "extAttrs": null
             }
         ],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n",
-            "termination": ""
-        },
-        "inheritance": null,
         "extAttrs": {
             "trivia": {
                 "open": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
@@ -132,6 +124,14 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n",
+            "termination": ""
         }
     },
     {
diff --git a/test/syntax/baseline/partial-interface.json b/test/syntax/baseline/partial-interface.json
index 5f91ade..813875d 100644
--- a/test/syntax/baseline/partial-interface.json
+++ b/test/syntax/baseline/partial-interface.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Foo",
         "escapedName": "Foo",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -35,23 +35,20 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "Foo",
         "escapedName": "Foo",
-        "partial": {
-            "trivia": "\n\n"
-        },
         "members": [
             {
                 "type": "attribute",
@@ -83,14 +80,17 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": {
+            "trivia": "\n\n"
+        },
         "trivia": {
             "base": " ",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/primitives.json b/test/syntax/baseline/primitives.json
index da60c10..48df29d 100644
--- a/test/syntax/baseline/primitives.json
+++ b/test/syntax/baseline/primitives.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Primitives",
         "escapedName": "Primitives",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -520,15 +520,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/promise-void.json b/test/syntax/baseline/promise-void.json
index 707af8e..d704f39 100644
--- a/test/syntax/baseline/promise-void.json
+++ b/test/syntax/baseline/promise-void.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Cat",
         "escapedName": "Cat",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -58,15 +58,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/prototyperoot.json b/test/syntax/baseline/prototyperoot.json
index 6c5b85f..e008e6b 100644
--- a/test/syntax/baseline/prototyperoot.json
+++ b/test/syntax/baseline/prototyperoot.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Node",
         "escapedName": "Node",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -40,14 +40,6 @@
                 "extAttrs": null
             }
         ],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n",
-            "termination": ""
-        },
-        "inheritance": null,
         "extAttrs": {
             "trivia": {
                 "open": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
@@ -65,6 +57,14 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n",
+            "termination": ""
         }
     },
     {
diff --git a/test/syntax/baseline/putforwards.json b/test/syntax/baseline/putforwards.json
index 3dc566b..e1c395f 100644
--- a/test/syntax/baseline/putforwards.json
+++ b/test/syntax/baseline/putforwards.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Person",
         "escapedName": "Person",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -93,15 +93,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/record.json b/test/syntax/baseline/record.json
index 5cb451a..d4f8581 100644
--- a/test/syntax/baseline/record.json
+++ b/test/syntax/baseline/record.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Foo",
         "escapedName": "Foo",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -252,14 +252,6 @@
                 "extAttrs": null
             }
         ],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n",
-            "termination": ""
-        },
-        "inheritance": null,
         "extAttrs": {
             "trivia": {
                 "open": "",
@@ -353,13 +345,21 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n",
+            "termination": ""
         }
     },
     {
         "type": "interface",
         "name": "Bar",
         "escapedName": "Bar",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -457,15 +457,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/reg-operations.json b/test/syntax/baseline/reg-operations.json
index 34ecabb..08e81e3 100644
--- a/test/syntax/baseline/reg-operations.json
+++ b/test/syntax/baseline/reg-operations.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Dimensions",
         "escapedName": "Dimensions",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -70,21 +70,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "Button",
         "escapedName": "Button",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -287,15 +287,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/replaceable.json b/test/syntax/baseline/replaceable.json
index 3df2451..c9028a5 100644
--- a/test/syntax/baseline/replaceable.json
+++ b/test/syntax/baseline/replaceable.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Counter",
         "escapedName": "Counter",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -93,15 +93,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/sequence.json b/test/syntax/baseline/sequence.json
index 4eacef1..f7fbce6 100644
--- a/test/syntax/baseline/sequence.json
+++ b/test/syntax/baseline/sequence.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Canvas",
         "escapedName": "Canvas",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -152,21 +152,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n// edited to remove sequence as attributes, now invalid\n",
             "name": " ",
             "open": " ",
             "close": "\n  // ...\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "I",
         "escapedName": "I",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -273,15 +273,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n// Extracted from https://heycam.github.io/webidl/#idl-type-extended-attribute-associated-with on 2017-07-01\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/setlike.json b/test/syntax/baseline/setlike.json
index 7204039..3adbb71 100644
--- a/test/syntax/baseline/setlike.json
+++ b/test/syntax/baseline/setlike.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "SetLike",
         "escapedName": "SetLike",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "setlike",
@@ -35,21 +35,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "ReadOnlySetLike",
         "escapedName": "ReadOnlySetLike",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "setlike",
@@ -83,21 +83,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "SetLikeExt",
         "escapedName": "SetLikeExt",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "setlike",
@@ -146,15 +146,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/static.json b/test/syntax/baseline/static.json
index 6666135..d1d9248 100644
--- a/test/syntax/baseline/static.json
+++ b/test/syntax/baseline/static.json
@@ -3,23 +3,23 @@
         "type": "interface",
         "name": "Point",
         "escapedName": "Point",
-        "partial": null,
+        "inheritance": null,
         "members": [],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": " /* ... */ ",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "Circle",
         "escapedName": "Circle",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -270,15 +270,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/stringifier-attribute.json b/test/syntax/baseline/stringifier-attribute.json
index 66ecab5..f906374 100644
--- a/test/syntax/baseline/stringifier-attribute.json
+++ b/test/syntax/baseline/stringifier-attribute.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Student",
         "escapedName": "Student",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -70,14 +70,6 @@
                 "extAttrs": null
             }
         ],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n",
-            "termination": ""
-        },
-        "inheritance": null,
         "extAttrs": {
             "trivia": {
                 "open": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
@@ -95,6 +87,14 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n",
+            "termination": ""
         }
     },
     {
diff --git a/test/syntax/baseline/stringifier-custom.json b/test/syntax/baseline/stringifier-custom.json
index 07e496d..523d726 100644
--- a/test/syntax/baseline/stringifier-custom.json
+++ b/test/syntax/baseline/stringifier-custom.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Student",
         "escapedName": "Student",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -133,14 +133,6 @@
                 "extAttrs": null
             }
         ],
-        "trivia": {
-            "base": "\n",
-            "name": " ",
-            "open": " ",
-            "close": "\n",
-            "termination": ""
-        },
-        "inheritance": null,
         "extAttrs": {
             "trivia": {
                 "open": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
@@ -158,6 +150,14 @@
                     "separator": null
                 }
             ]
+        },
+        "partial": null,
+        "trivia": {
+            "base": "\n",
+            "name": " ",
+            "open": " ",
+            "close": "\n",
+            "termination": ""
         }
     },
     {
diff --git a/test/syntax/baseline/stringifier.json b/test/syntax/baseline/stringifier.json
index ba48925..68ae1e8 100644
--- a/test/syntax/baseline/stringifier.json
+++ b/test/syntax/baseline/stringifier.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "A",
         "escapedName": "A",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -41,21 +41,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "B",
         "escapedName": "B",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -70,15 +70,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/treatasnull.json b/test/syntax/baseline/treatasnull.json
index d740269..bd75f3d 100644
--- a/test/syntax/baseline/treatasnull.json
+++ b/test/syntax/baseline/treatasnull.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Dog",
         "escapedName": "Dog",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -152,15 +152,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/treatasundefined.json b/test/syntax/baseline/treatasundefined.json
index cc49caa..10a13d3 100644
--- a/test/syntax/baseline/treatasundefined.json
+++ b/test/syntax/baseline/treatasundefined.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Cat",
         "escapedName": "Cat",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -152,15 +152,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/typedef.json b/test/syntax/baseline/typedef.json
index 733b1f7..3be5f77 100644
--- a/test/syntax/baseline/typedef.json
+++ b/test/syntax/baseline/typedef.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Point",
         "escapedName": "Point",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -64,15 +64,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n      ",
             "name": " ",
             "open": " ",
             "close": "\n      ",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "typedef",
@@ -128,7 +128,7 @@
         "type": "interface",
         "name": "Rect",
         "escapedName": "Rect",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -189,21 +189,21 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n      ",
             "name": " ",
             "open": " ",
             "close": "\n      ",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "interface",
         "name": "Widget",
         "escapedName": "Widget",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -365,15 +365,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "\n\n  ",
             "name": " ",
             "open": " ",
             "close": "\n  ",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "typedef",
diff --git a/test/syntax/baseline/typesuffixes.json b/test/syntax/baseline/typesuffixes.json
index 1c1177d..3c72d35 100644
--- a/test/syntax/baseline/typesuffixes.json
+++ b/test/syntax/baseline/typesuffixes.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Suffixes",
         "escapedName": "Suffixes",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "operation",
@@ -97,15 +97,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/uniontype.json b/test/syntax/baseline/uniontype.json
index 79f99d8..a204925 100644
--- a/test/syntax/baseline/uniontype.json
+++ b/test/syntax/baseline/uniontype.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "Union",
         "escapedName": "Union",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -250,15 +250,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",
diff --git a/test/syntax/baseline/variadic-operations.json b/test/syntax/baseline/variadic-operations.json
index ba2a641..1c95ed6 100644
--- a/test/syntax/baseline/variadic-operations.json
+++ b/test/syntax/baseline/variadic-operations.json
@@ -3,7 +3,7 @@
         "type": "interface",
         "name": "IntegerSet",
         "escapedName": "IntegerSet",
-        "partial": null,
+        "inheritance": null,
         "members": [
             {
                 "type": "attribute",
@@ -172,15 +172,15 @@
                 "extAttrs": null
             }
         ],
+        "extAttrs": null,
+        "partial": null,
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
             "name": " ",
             "open": " ",
             "close": "\n",
             "termination": ""
-        },
-        "inheritance": null,
-        "extAttrs": null
+        }
     },
     {
         "type": "eof",