Repository: w3c/webidl2.js
Pull request #205 (2018-06-13 15:24:28)

Add trivia for partial types
Renames a local variable `isPartial` as `partialModifier`.


Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index 6f529f5..d2301b6 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -665,7 +665,7 @@
       if (!consume("callback")) return;
       const tok = consume("interface");
       if (tok) {
-        ret = interface_rest(false, "callback interface");
+        ret = interface_rest({ typeName: "callback interface" });
         ret.trivia.base = tok.trivia;
         return ret;
       }
@@ -851,7 +851,7 @@
       return ret;
     }
 
-    function interface_rest(isPartial, typeName = "interface") {
+    function interface_rest({ typeName = "interface", partialModifier = null } = {}) {
       const name = consume(ID) || error("No name for interface");
       const trivia = {
         base: null,
@@ -860,12 +860,12 @@
       const mems = [];
       const ret = current = {
         type: typeName,
-        name: isPartial ? name.value : sanitize_name(name.value, "interface"),
-        partial: isPartial,
+        name: partialModifier ? name.value : sanitize_name(name.value, "interface"),
+        partial: partialModifier,
         members: mems,
         trivia
       };
-      if (!isPartial) ret.inheritance = inheritance() || null;
+      if (!partialModifier) ret.inheritance = inheritance() || null;
       const open = consume("{") || error("Bodyless interface");
       trivia.open = open.trivia;
       while (true) {
@@ -889,7 +889,7 @@
       }
     }
 
-    function mixin_rest(isPartial) {
+    function mixin_rest({ partialModifier = null } = {}) {
       const mixin = consume("mixin");
       if (!mixin) return;
       const trivia = {
@@ -901,8 +901,8 @@
       const mems = [];
       const ret = current = {
         type: "interface mixin",
-        name: isPartial ? name.value : sanitize_name(name.value, "interface mixin"),
-        partial: isPartial,
+        name: partialModifier ? name.value : sanitize_name(name.value, "interface mixin"),
+        partial: partialModifier,
         members: mems,
         trivia
       };
@@ -927,17 +927,17 @@
       }
     }
 
-    function interface_(isPartial) {
+    function interface_(opts) {
       const base = consume("interface");
       if (!base) return;
-      const ret = mixin_rest(isPartial) ||
-        interface_rest(isPartial) ||
+      const ret = mixin_rest(opts) ||
+        interface_rest(opts) ||
         error("Interface has no proper body");
       ret.trivia.base = base.trivia;
       return ret;
     }
 
-    function namespace(isPartial) {
+    function namespace({ partialModifier = null } = {}) {
       const base = consume("namespace");
       if (!base) return;
       const trivia = { base: base.trivia };
@@ -946,8 +946,8 @@
       const mems = [];
       const ret = current = {
         type: "namespace",
-        name: isPartial ? name.value : sanitize_name(name.value, "namespace"),
-        partial: isPartial,
+        name: partialModifier ? name.value : sanitize_name(name.value, "namespace"),
+        partial: partialModifier,
         members: mems,
         trivia
       };
@@ -971,15 +971,16 @@
     }
 
     function partial() {
-      if (!consume("partial")) return;
-      const thing = dictionary(true) ||
-        interface_(true) ||
-        namespace(true) ||
+      const token = consume("partial");
+      if (!token) return;
+      const partialModifier = { trivia: token.trivia };
+      return dictionary({ partialModifier }) ||
+        interface_({ partialModifier }) ||
+        namespace({ partialModifier }) ||
         error("Partial doesn't apply to anything");
-      return thing;
     }
 
-    function dictionary(isPartial) {
+    function dictionary({ partialModifier = null } = {}) {
       const base = consume("dictionary");
       if (!base) return;
       const trivia = { base: base.trivia };
@@ -988,12 +989,12 @@
       const mems = [];
       const ret = current = {
         type: "dictionary",
-        name: isPartial ? name.value : sanitize_name(name.value, "dictionary"),
-        partial: isPartial,
+        name: partialModifier ? name.value : sanitize_name(name.value, "dictionary"),
+        partial: partialModifier,
         members: mems,
         trivia
       };
-      if (!isPartial) ret.inheritance = inheritance() || null;
+      if (!partialModifier) ret.inheritance = inheritance() || null;
       const open = consume("{") || error("Bodyless dictionary");
       trivia.open = open.trivia;
       while (true) {
@@ -1110,14 +1111,14 @@
 
     function definition() {
       return callback() ||
-        interface_(false) ||
+        interface_() ||
         partial() ||
-        dictionary(false) ||
+        dictionary() ||
         enum_() ||
         typedef() ||
         implements_() ||
         includes() ||
-        namespace(false);
+        namespace();
     }
 
     function definitions() {
diff --git a/lib/writer.js b/lib/writer.js
index bfea528..f7daa8b 100644
--- a/lib/writer.js
+++ b/lib/writer.js
@@ -94,7 +94,7 @@
 
     function interface_(it) {
       let ret = extended_attributes(it.extAttrs);
-      if (it.partial) ret += "partial";
+      if (it.partial) ret += `${it.partial.trivia}partial`;
       ret += `${it.trivia.base}interface${it.trivia.name}${it.name}`;
       if (it.inheritance) ret += inheritance(it.inheritance);
       ret += `${it.trivia.open}{${iterate(it.members)}${it.trivia.close}}${it.trivia.termination};`;
@@ -103,7 +103,7 @@
 
     function interface_mixin(it) {
       let ret = extended_attributes(it.extAttrs);
-      if (it.partial) ret += "partial";
+      if (it.partial) ret += `${it.partial.trivia}partial`;
       ret += `${it.trivia.base}interface${it.trivia.mixin}mixin${it.trivia.name}${it.name}`;
       ret += `${it.trivia.open}{${iterate(it.members)}${it.trivia.close}}${it.trivia.termination};`;
       return ret;
@@ -111,7 +111,7 @@
 
     function namespace(it) {
       let ret = extended_attributes(it.extAttrs);
-      if (it.partial) ret += "partial";
+      if (it.partial) ret += `${it.partial.trivia}partial`;
       ret += `${it.trivia.base}namespace${it.trivia.name}${it.name}`;
       ret += `${it.trivia.open}{${iterate(it.members)}${it.trivia.close}}${it.trivia.termination};`;
       return ret;
@@ -119,7 +119,7 @@
 
     function dictionary(it) {
       let ret = extended_attributes(it.extAttrs);
-      if (it.partial) ret += "partial";
+      if (it.partial) ret += `${it.partial.trivia}partial`;
       ret += `${it.trivia.base}dictionary${it.trivia.name}${it.name}`;
       if (it.inheritance) ret += inheritance(it.inheritance);
       ret += `${it.trivia.open}{${iterate(it.members)}${it.trivia.close}}${it.trivia.termination};`;


Test patch:
diff --git a/test/syntax/json/allowany.json b/test/syntax/json/allowany.json
index a4aa9ca..081f63b 100644
--- a/test/syntax/json/allowany.json
+++ b/test/syntax/json/allowany.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "B",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/attributes.json b/test/syntax/json/attributes.json
index 0165b96..74cd3b8 100644
--- a/test/syntax/json/attributes.json
+++ b/test/syntax/json/attributes.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Person",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/callback.json b/test/syntax/json/callback.json
index 62ac5c8..879dd9e 100644
--- a/test/syntax/json/callback.json
+++ b/test/syntax/json/callback.json
@@ -51,7 +51,7 @@
     {
         "type": "callback interface",
         "name": "EventHandler",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/constants.json b/test/syntax/json/constants.json
index 3bfbd29..7eb19c9 100644
--- a/test/syntax/json/constants.json
+++ b/test/syntax/json/constants.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Util",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "const",
diff --git a/test/syntax/json/constructor.json b/test/syntax/json/constructor.json
index aee1da5..4aebcf9 100644
--- a/test/syntax/json/constructor.json
+++ b/test/syntax/json/constructor.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Circle",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/dictionary-inherits.json b/test/syntax/json/dictionary-inherits.json
index d7b7b91..bb086cb 100644
--- a/test/syntax/json/dictionary-inherits.json
+++ b/test/syntax/json/dictionary-inherits.json
@@ -2,7 +2,7 @@
     {
         "type": "dictionary",
         "name": "PaintOptions",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "field",
@@ -116,7 +116,7 @@
     {
         "type": "dictionary",
         "name": "WetPaintOptions",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "field",
diff --git a/test/syntax/json/dictionary.json b/test/syntax/json/dictionary.json
index 6d63d70..f323d0d 100644
--- a/test/syntax/json/dictionary.json
+++ b/test/syntax/json/dictionary.json
@@ -2,7 +2,7 @@
     {
         "type": "dictionary",
         "name": "PaintOptions",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "field",
@@ -202,7 +202,9 @@
     {
         "type": "dictionary",
         "name": "A",
-        "partial": true,
+        "partial": {
+            "trivia": "\n\n"
+        },
         "members": [
             {
                 "type": "field",
diff --git a/test/syntax/json/documentation-dos.json b/test/syntax/json/documentation-dos.json
index 1e0e74e..27efd44 100644
--- a/test/syntax/json/documentation-dos.json
+++ b/test/syntax/json/documentation-dos.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Documentation",
-        "partial": false,
+        "partial": null,
         "members": [],
         "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",
diff --git a/test/syntax/json/documentation.json b/test/syntax/json/documentation.json
index 0eb0dd2..18a4f91 100644
--- a/test/syntax/json/documentation.json
+++ b/test/syntax/json/documentation.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Documentation",
-        "partial": false,
+        "partial": null,
         "members": [],
         "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",
diff --git a/test/syntax/json/enum.json b/test/syntax/json/enum.json
index 91cb553..4f4d999 100644
--- a/test/syntax/json/enum.json
+++ b/test/syntax/json/enum.json
@@ -21,7 +21,7 @@
     {
         "type": "interface",
         "name": "Meal",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/equivalent-decl.json b/test/syntax/json/equivalent-decl.json
index 4b56216..b8805e1 100644
--- a/test/syntax/json/equivalent-decl.json
+++ b/test/syntax/json/equivalent-decl.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Dictionary",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -221,7 +221,7 @@
     {
         "type": "interface",
         "name": "Dictionary2",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/extended-attributes.json b/test/syntax/json/extended-attributes.json
index 573fe54..f6a5437 100644
--- a/test/syntax/json/extended-attributes.json
+++ b/test/syntax/json/extended-attributes.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "ServiceWorkerGlobalScope",
-        "partial": false,
+        "partial": null,
         "members": [],
         "trivia": {
             "base": "\n",
@@ -82,7 +82,7 @@
     {
         "type": "interface",
         "name": "IdInterface",
-        "partial": false,
+        "partial": null,
         "members": [],
         "trivia": {
             "base": "\n",
@@ -161,7 +161,7 @@
     {
         "type": "interface",
         "name": "Circle",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -363,7 +363,7 @@
     {
         "type": "interface",
         "name": "I",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/generic.json b/test/syntax/json/generic.json
index 9c80ce3..7687ba7 100644
--- a/test/syntax/json/generic.json
+++ b/test/syntax/json/generic.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Foo",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
@@ -179,7 +179,7 @@
     {
         "type": "interface",
         "name": "ServiceWorkerClients",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
@@ -319,7 +319,7 @@
     {
         "type": "interface",
         "name": "FetchEvent",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/getter-setter.json b/test/syntax/json/getter-setter.json
index f920328..3ded434 100644
--- a/test/syntax/json/getter-setter.json
+++ b/test/syntax/json/getter-setter.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Dictionary",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/identifier-qualified-names.json b/test/syntax/json/identifier-qualified-names.json
index d5ea12d..c55cbc3 100644
--- a/test/syntax/json/identifier-qualified-names.json
+++ b/test/syntax/json/identifier-qualified-names.json
@@ -22,7 +22,7 @@
     {
         "type": "interface",
         "name": "System",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
@@ -170,7 +170,7 @@
     {
         "type": "interface",
         "name": "TextField",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -248,7 +248,7 @@
     {
         "type": "interface",
         "name": "FooEventTarget",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/implements.json b/test/syntax/json/implements.json
index 5eab19d..9c61367 100644
--- a/test/syntax/json/implements.json
+++ b/test/syntax/json/implements.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Node",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -53,7 +53,7 @@
     {
         "type": "interface",
         "name": "EventTarget",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/indexed-properties.json b/test/syntax/json/indexed-properties.json
index 8fc20a9..207afb6 100644
--- a/test/syntax/json/indexed-properties.json
+++ b/test/syntax/json/indexed-properties.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "OrderedMap",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/inherits-getter.json b/test/syntax/json/inherits-getter.json
index febd4fd..5da97aa 100644
--- a/test/syntax/json/inherits-getter.json
+++ b/test/syntax/json/inherits-getter.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Animal",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -50,7 +50,7 @@
     {
         "type": "interface",
         "name": "Person",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -139,7 +139,7 @@
     {
         "type": "interface",
         "name": "Ghost",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/interface-inherits.json b/test/syntax/json/interface-inherits.json
index f4901a3..dbead34 100644
--- a/test/syntax/json/interface-inherits.json
+++ b/test/syntax/json/interface-inherits.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Animal",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -48,7 +48,7 @@
     {
         "type": "interface",
         "name": "Human",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -100,7 +100,7 @@
     {
         "type": "interface",
         "name": "Dog",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/iterable.json b/test/syntax/json/iterable.json
index 43e426d..5f35b79 100644
--- a/test/syntax/json/iterable.json
+++ b/test/syntax/json/iterable.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "IterableOne",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "iterable",
@@ -45,7 +45,7 @@
     {
         "type": "interface",
         "name": "IterableTwo",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "iterable",
@@ -108,7 +108,7 @@
     {
         "type": "interface",
         "name": "IterableThree",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "iterable",
diff --git a/test/syntax/json/legacyiterable.json b/test/syntax/json/legacyiterable.json
index 1efd7e8..5c15851 100644
--- a/test/syntax/json/legacyiterable.json
+++ b/test/syntax/json/legacyiterable.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "LegacyIterable",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "legacyiterable",
diff --git a/test/syntax/json/maplike.json b/test/syntax/json/maplike.json
index c0fa7ff..fec5d21 100644
--- a/test/syntax/json/maplike.json
+++ b/test/syntax/json/maplike.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "MapLike",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "maplike",
@@ -64,7 +64,7 @@
     {
         "type": "interface",
         "name": "ReadOnlyMapLike",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "maplike",
@@ -128,7 +128,7 @@
     {
         "type": "interface",
         "name": "I",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "maplike",
diff --git a/test/syntax/json/mixin.json b/test/syntax/json/mixin.json
index 901cb92..39dd8b6 100644
--- a/test/syntax/json/mixin.json
+++ b/test/syntax/json/mixin.json
@@ -2,7 +2,7 @@
     {
         "type": "interface mixin",
         "name": "GlobalCrypto",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -62,7 +62,9 @@
     {
         "type": "interface mixin",
         "name": "WindowOrWorkerGlobalScope",
-        "partial": true,
+        "partial": {
+            "trivia": "\n\n"
+        },
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/namedconstructor.json b/test/syntax/json/namedconstructor.json
index 6a9e04d..20eaea6 100644
--- a/test/syntax/json/namedconstructor.json
+++ b/test/syntax/json/namedconstructor.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "HTMLAudioElement",
-        "partial": false,
+        "partial": null,
         "members": [],
         "trivia": {
             "base": "\n",
diff --git a/test/syntax/json/namespace.json b/test/syntax/json/namespace.json
index f1e72e8..0cefe8d 100644
--- a/test/syntax/json/namespace.json
+++ b/test/syntax/json/namespace.json
@@ -2,7 +2,7 @@
     {
         "type": "namespace",
         "name": "VectorUtils",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -243,7 +243,9 @@
     {
         "type": "namespace",
         "name": "SomeNamespace",
-        "partial": true,
+        "partial": {
+            "trivia": "\n\n"
+        },
         "members": [],
         "trivia": {
             "base": " ",
diff --git a/test/syntax/json/nointerfaceobject.json b/test/syntax/json/nointerfaceobject.json
index adf1278..44b8591 100644
--- a/test/syntax/json/nointerfaceobject.json
+++ b/test/syntax/json/nointerfaceobject.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Query",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/nullable.json b/test/syntax/json/nullable.json
index 96fc84a..eafa299 100644
--- a/test/syntax/json/nullable.json
+++ b/test/syntax/json/nullable.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "MyConstants",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "const",
@@ -51,7 +51,7 @@
     {
         "type": "interface",
         "name": "Node",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/nullableobjects.json b/test/syntax/json/nullableobjects.json
index 015fdd6..67c54e9 100644
--- a/test/syntax/json/nullableobjects.json
+++ b/test/syntax/json/nullableobjects.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "A",
-        "partial": false,
+        "partial": null,
         "members": [],
         "trivia": {
             "base": "// Extracted from WebIDL spec 2011-05-23\n\n",
@@ -17,7 +17,7 @@
     {
         "type": "interface",
         "name": "B",
-        "partial": false,
+        "partial": null,
         "members": [],
         "trivia": {
             "base": "\n",
@@ -32,7 +32,7 @@
     {
         "type": "interface",
         "name": "C",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/operation-optional-arg.json b/test/syntax/json/operation-optional-arg.json
index 04e3783..90aa680 100644
--- a/test/syntax/json/operation-optional-arg.json
+++ b/test/syntax/json/operation-optional-arg.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "ColorCreator",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/overloading.json b/test/syntax/json/overloading.json
index 7dbe0b5..4b1d951 100644
--- a/test/syntax/json/overloading.json
+++ b/test/syntax/json/overloading.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "A",
-        "partial": false,
+        "partial": null,
         "members": [],
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
@@ -17,7 +17,7 @@
     {
         "type": "interface",
         "name": "B",
-        "partial": false,
+        "partial": null,
         "members": [],
         "trivia": {
             "base": "\n\n",
@@ -32,7 +32,7 @@
     {
         "type": "interface",
         "name": "C",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
@@ -182,7 +182,7 @@
     {
         "type": "interface",
         "name": "D",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/overridebuiltins.json b/test/syntax/json/overridebuiltins.json
index e174818..c0265b8 100644
--- a/test/syntax/json/overridebuiltins.json
+++ b/test/syntax/json/overridebuiltins.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "StringMap2",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/partial-interface.json b/test/syntax/json/partial-interface.json
index a73f615..41bd2dd 100644
--- a/test/syntax/json/partial-interface.json
+++ b/test/syntax/json/partial-interface.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Foo",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -48,7 +48,9 @@
     {
         "type": "interface",
         "name": "Foo",
-        "partial": true,
+        "partial": {
+            "trivia": "\n\n"
+        },
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/primitives.json b/test/syntax/json/primitives.json
index 63c7d50..55f1913 100644
--- a/test/syntax/json/primitives.json
+++ b/test/syntax/json/primitives.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Primitives",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/promise-void.json b/test/syntax/json/promise-void.json
index cf9ed59..3815c8e 100644
--- a/test/syntax/json/promise-void.json
+++ b/test/syntax/json/promise-void.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Cat",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/prototyperoot.json b/test/syntax/json/prototyperoot.json
index 2031a03..bd62b47 100644
--- a/test/syntax/json/prototyperoot.json
+++ b/test/syntax/json/prototyperoot.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Node",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/putforwards.json b/test/syntax/json/putforwards.json
index c8514c7..376c8e6 100644
--- a/test/syntax/json/putforwards.json
+++ b/test/syntax/json/putforwards.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Person",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/record.json b/test/syntax/json/record.json
index 5592474..30bb762 100644
--- a/test/syntax/json/record.json
+++ b/test/syntax/json/record.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Foo",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
@@ -354,7 +354,7 @@
     {
         "type": "interface",
         "name": "Bar",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/reg-operations.json b/test/syntax/json/reg-operations.json
index 2913c4c..e1a6dc4 100644
--- a/test/syntax/json/reg-operations.json
+++ b/test/syntax/json/reg-operations.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Dimensions",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -84,7 +84,7 @@
     {
         "type": "interface",
         "name": "Button",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/replaceable.json b/test/syntax/json/replaceable.json
index 3dc073a..2861710 100644
--- a/test/syntax/json/replaceable.json
+++ b/test/syntax/json/replaceable.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Counter",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/sequence.json b/test/syntax/json/sequence.json
index a2e74e1..dbcc6c8 100644
--- a/test/syntax/json/sequence.json
+++ b/test/syntax/json/sequence.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Canvas",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
@@ -168,7 +168,7 @@
     {
         "type": "interface",
         "name": "I",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/setlike.json b/test/syntax/json/setlike.json
index 4763039..f862549 100644
--- a/test/syntax/json/setlike.json
+++ b/test/syntax/json/setlike.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "SetLike",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "setlike",
@@ -46,7 +46,7 @@
     {
         "type": "interface",
         "name": "ReadOnlySetLike",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "setlike",
@@ -92,7 +92,7 @@
     {
         "type": "interface",
         "name": "SetLikeExt",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "setlike",
diff --git a/test/syntax/json/static.json b/test/syntax/json/static.json
index ce980ac..88ed34c 100644
--- a/test/syntax/json/static.json
+++ b/test/syntax/json/static.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Point",
-        "partial": false,
+        "partial": null,
         "members": [],
         "trivia": {
             "base": "// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06\n",
@@ -17,7 +17,7 @@
     {
         "type": "interface",
         "name": "Circle",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/stringifier-attribute.json b/test/syntax/json/stringifier-attribute.json
index d3ad394..56d9c17 100644
--- a/test/syntax/json/stringifier-attribute.json
+++ b/test/syntax/json/stringifier-attribute.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Student",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/stringifier-custom.json b/test/syntax/json/stringifier-custom.json
index a20132f..26b3c18 100644
--- a/test/syntax/json/stringifier-custom.json
+++ b/test/syntax/json/stringifier-custom.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Student",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/stringifier.json b/test/syntax/json/stringifier.json
index 7a46045..6983f06 100644
--- a/test/syntax/json/stringifier.json
+++ b/test/syntax/json/stringifier.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "A",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
@@ -55,7 +55,7 @@
     {
         "type": "interface",
         "name": "B",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/treatasnull.json b/test/syntax/json/treatasnull.json
index 9506df9..e61d69a 100644
--- a/test/syntax/json/treatasnull.json
+++ b/test/syntax/json/treatasnull.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Dog",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/treatasundefined.json b/test/syntax/json/treatasundefined.json
index e053adb..2b7c585 100644
--- a/test/syntax/json/treatasundefined.json
+++ b/test/syntax/json/treatasundefined.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Cat",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/typedef.json b/test/syntax/json/typedef.json
index 0a46d50..61cc083 100644
--- a/test/syntax/json/typedef.json
+++ b/test/syntax/json/typedef.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Point",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -120,7 +120,7 @@
     {
         "type": "interface",
         "name": "Rect",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
@@ -196,7 +196,7 @@
     {
         "type": "interface",
         "name": "Widget",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/typesuffixes.json b/test/syntax/json/typesuffixes.json
index 4647094..50010ef 100644
--- a/test/syntax/json/typesuffixes.json
+++ b/test/syntax/json/typesuffixes.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Suffixes",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "operation",
diff --git a/test/syntax/json/uniontype.json b/test/syntax/json/uniontype.json
index 9799760..89e0064 100644
--- a/test/syntax/json/uniontype.json
+++ b/test/syntax/json/uniontype.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "Union",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",
diff --git a/test/syntax/json/variadic-operations.json b/test/syntax/json/variadic-operations.json
index 0aaf019..75dbd0b 100644
--- a/test/syntax/json/variadic-operations.json
+++ b/test/syntax/json/variadic-operations.json
@@ -2,7 +2,7 @@
     {
         "type": "interface",
         "name": "IntegerSet",
-        "partial": false,
+        "partial": null,
         "members": [
             {
                 "type": "attribute",