Repository: w3c/webidl2.js
Pull request #132 (2018-01-29 12:12:04)

feat: add const-type for idlTypes 
Now for `const-type`.

I'm not very happy with a field `idlType` again have its own `idlType`, can we rename it so that we can reduce same names?

marcoscaceres: > I'm not very happy with a field idlType again have its own idlType, can we rename it so that we can reduce same names?

I'm happy to go with whatever you think is best. 

Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index 93edfe3..4f3240c 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -276,8 +276,8 @@
       return ret;
     };
 
-    function type() {
-      return single_type() || union_type();
+    function type(typeName) {
+      return single_type(typeName) || union_type(typeName);
     };
 
     function type_with_extended_attributes(typeName) {
@@ -296,7 +296,7 @@
         ret.optional = true;
         all_ws();
       }
-      ret.idlType = type_with_extended_attributes();
+      ret.idlType = type_with_extended_attributes("argument-type");
       if (!ret.idlType) {
         if (opt_token) tokens.unshift(opt_token);
         return;
@@ -445,7 +445,7 @@
         typ = consume(ID) || error("No type for const");
         typ = typ.value;
       }
-      ret.idlType = typ;
+      ret.idlType = { type: "const-type", idlType: typ };
       all_ws();
       if (consume(OTHER, "?")) {
         ret.nullable = true;
@@ -563,7 +563,7 @@
     };
 
     function return_type() {
-      const typ = type();
+      const typ = type("return-type");
       if (!typ) {
         if (consume(ID, "void")) {
           return "void";
@@ -874,7 +874,7 @@
         const ea = extended_attrs(store ? mems : null);
         all_ws(store ? mems : null, "pea");
         const required = consume(ID, "required");
-        const typ = type_with_extended_attributes() || error("No type for dictionary member");
+        const typ = type_with_extended_attributes("dictionary-type") || error("No type for dictionary member");
         all_ws();
         const name = consume(ID) || error("No name for dictionary member");
         const dflt = default_();
@@ -937,7 +937,7 @@
         type: "typedef"
       };
       all_ws();
-      ret.idlType = type_with_extended_attributes() || error("No type in typedef");
+      ret.idlType = type_with_extended_attributes("typedef-type") || error("No type in typedef");
       all_ws();
       const name = consume(ID) || error("No name in typedef");
       ret.name = sanitize_name(name.value, "typedef");


Test patch:
diff --git a/test/syntax/json/allowany.json b/test/syntax/json/allowany.json
index aecbec8..cd5c6e0 100644
--- a/test/syntax/json/allowany.json
+++ b/test/syntax/json/allowany.json
@@ -12,7 +12,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -31,7 +31,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -45,7 +45,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -65,7 +65,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -86,7 +86,7 @@
                             }
                         ],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/callback.json b/test/syntax/json/callback.json
index 1dfa169..f31067d 100644
--- a/test/syntax/json/callback.json
+++ b/test/syntax/json/callback.json
@@ -3,7 +3,7 @@
         "type": "callback",
         "name": "AsyncOperationCallback",
         "idlType": {
-            "type": null,
+            "type": "return-type",
             "sequence": false,
             "generic": null,
             "nullable": false,
@@ -16,7 +16,7 @@
                 "variadic": false,
                 "extAttrs": [],
                 "idlType": {
-                    "type": null,
+                    "type": "argument-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -41,7 +41,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -55,7 +55,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -75,7 +75,7 @@
         "type": "callback",
         "name": "SortCallback",
         "idlType": {
-            "type": null,
+            "type": "return-type",
             "sequence": false,
             "generic": null,
             "nullable": false,
@@ -88,7 +88,7 @@
                 "variadic": false,
                 "extAttrs": [],
                 "idlType": {
-                    "type": null,
+                    "type": "argument-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -102,7 +102,7 @@
                 "variadic": false,
                 "extAttrs": [],
                 "idlType": {
-                    "type": null,
+                    "type": "argument-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
diff --git a/test/syntax/json/constants.json b/test/syntax/json/constants.json
index aa5bb27..4b98751 100644
--- a/test/syntax/json/constants.json
+++ b/test/syntax/json/constants.json
@@ -7,7 +7,10 @@
             {
                 "type": "const",
                 "nullable": false,
-                "idlType": "boolean",
+                "idlType": {
+                    "type": "const-type",
+                    "idlType": "boolean"
+                },
                 "name": "DEBUG",
                 "value": {
                     "type": "boolean",
@@ -18,7 +21,10 @@
             {
                 "type": "const",
                 "nullable": false,
-                "idlType": "short",
+                "idlType": {
+                    "type": "const-type",
+                    "idlType": "short"
+                },
                 "name": "negative",
                 "value": {
                     "type": "number",
@@ -29,7 +35,10 @@
             {
                 "type": "const",
                 "nullable": false,
-                "idlType": "octet",
+                "idlType": {
+                    "type": "const-type",
+                    "idlType": "octet"
+                },
                 "name": "LF",
                 "value": {
                     "type": "number",
@@ -40,7 +49,10 @@
             {
                 "type": "const",
                 "nullable": false,
-                "idlType": "unsigned long",
+                "idlType": {
+                    "type": "const-type",
+                    "idlType": "unsigned long"
+                },
                 "name": "BIT_MASK",
                 "value": {
                     "type": "number",
@@ -51,7 +63,10 @@
             {
                 "type": "const",
                 "nullable": false,
-                "idlType": "float",
+                "idlType": {
+                    "type": "const-type",
+                    "idlType": "float"
+                },
                 "name": "AVOGADRO",
                 "value": {
                     "type": "number",
@@ -62,7 +77,10 @@
             {
                 "type": "const",
                 "nullable": false,
-                "idlType": "unrestricted float",
+                "idlType": {
+                    "type": "const-type",
+                    "idlType": "unrestricted float"
+                },
                 "name": "sobig",
                 "value": {
                     "type": "Infinity",
@@ -73,7 +91,10 @@
             {
                 "type": "const",
                 "nullable": false,
-                "idlType": "unrestricted double",
+                "idlType": {
+                    "type": "const-type",
+                    "idlType": "unrestricted double"
+                },
                 "name": "minusonedividedbyzero",
                 "value": {
                     "type": "Infinity",
@@ -84,7 +105,10 @@
             {
                 "type": "const",
                 "nullable": false,
-                "idlType": "short",
+                "idlType": {
+                    "type": "const-type",
+                    "idlType": "short"
+                },
                 "name": "notanumber",
                 "value": {
                     "type": "NaN"
diff --git a/test/syntax/json/constructor.json b/test/syntax/json/constructor.json
index 7b31e97..292236f 100644
--- a/test/syntax/json/constructor.json
+++ b/test/syntax/json/constructor.json
@@ -89,7 +89,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/dictionary-inherits.json b/test/syntax/json/dictionary-inherits.json
index 0537dcc..9b928f4 100644
--- a/test/syntax/json/dictionary-inherits.json
+++ b/test/syntax/json/dictionary-inherits.json
@@ -9,7 +9,7 @@
                 "name": "fillPattern",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": true,
@@ -27,7 +27,7 @@
                 "name": "strokePattern",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": true,
@@ -44,7 +44,7 @@
                 "name": "position",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -67,7 +67,7 @@
                 "name": "hydrometry",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
diff --git a/test/syntax/json/dictionary.json b/test/syntax/json/dictionary.json
index 22144c9..f74fedc 100644
--- a/test/syntax/json/dictionary.json
+++ b/test/syntax/json/dictionary.json
@@ -9,7 +9,7 @@
                 "name": "fillPattern",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": true,
@@ -27,7 +27,7 @@
                 "name": "strokePattern",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": true,
@@ -44,7 +44,7 @@
                 "name": "position",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -58,13 +58,13 @@
                 "name": "seq",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": true,
                     "generic": "sequence",
                     "nullable": false,
                     "union": false,
                     "idlType": {
-                        "type": null,
+                        "type": "dictionary-type",
                         "sequence": false,
                         "generic": null,
                         "nullable": false,
@@ -83,7 +83,7 @@
                 "name": "reqSeq",
                 "required": true,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -106,7 +106,7 @@
                 "name": "h",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -120,7 +120,7 @@
                 "name": "d",
                 "required": false,
                 "idlType": {
-                    "type": null,
+                    "type": "dictionary-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
diff --git a/test/syntax/json/enum.json b/test/syntax/json/enum.json
index c7e57d8..29d1c86 100644
--- a/test/syntax/json/enum.json
+++ b/test/syntax/json/enum.json
@@ -65,7 +65,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -79,7 +79,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -93,7 +93,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/equivalent-decl.json b/test/syntax/json/equivalent-decl.json
index 41676b4..de8d4db 100644
--- a/test/syntax/json/equivalent-decl.json
+++ b/test/syntax/json/equivalent-decl.json
@@ -29,7 +29,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -43,7 +43,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -63,7 +63,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -77,7 +77,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -91,7 +91,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -137,7 +137,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -151,7 +151,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -171,7 +171,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -185,7 +185,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -199,7 +199,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -219,7 +219,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -233,7 +233,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -253,7 +253,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -267,7 +267,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -281,7 +281,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/extended-attributes.json b/test/syntax/json/extended-attributes.json
index 15b9d9a..7597d8d 100644
--- a/test/syntax/json/extended-attributes.json
+++ b/test/syntax/json/extended-attributes.json
@@ -155,7 +155,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/generic.json b/test/syntax/json/generic.json
index a2bdfc4..6259385 100644
--- a/test/syntax/json/generic.json
+++ b/test/syntax/json/generic.json
@@ -12,25 +12,25 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": "Promise",
                     "nullable": false,
                     "union": false,
                     "idlType": {
-                        "type": null,
+                        "type": "return-type",
                         "sequence": false,
                         "generic": "ResponsePromise",
                         "nullable": false,
                         "union": false,
                         "idlType": {
-                            "type": null,
+                            "type": "return-type",
                             "sequence": true,
                             "generic": "sequence",
                             "nullable": false,
                             "union": false,
                             "idlType": {
-                                "type": null,
+                                "type": "return-type",
                                 "sequence": false,
                                 "generic": null,
                                 "nullable": true,
@@ -85,13 +85,13 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": "Promise",
                     "nullable": false,
                     "union": false,
                     "idlType": {
-                        "type": null,
+                        "type": "return-type",
                         "sequence": false,
                         "generic": null,
                         "nullable": true,
@@ -111,13 +111,13 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": "Promise",
                     "nullable": false,
                     "union": false,
                     "idlType": {
-                        "type": null,
+                        "type": "return-type",
                         "sequence": false,
                         "generic": null,
                         "nullable": false,
@@ -146,13 +146,13 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": "ResponsePromise",
                     "nullable": false,
                     "union": false,
                     "idlType": {
-                        "type": null,
+                        "type": "return-type",
                         "sequence": false,
                         "generic": null,
                         "nullable": false,
diff --git a/test/syntax/json/getter-setter.json b/test/syntax/json/getter-setter.json
index 951cff7..1213307 100644
--- a/test/syntax/json/getter-setter.json
+++ b/test/syntax/json/getter-setter.json
@@ -29,7 +29,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -43,7 +43,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -63,7 +63,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -77,7 +77,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -91,7 +91,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/identifier-qualified-names.json b/test/syntax/json/identifier-qualified-names.json
index 1382d18..f4e295a 100644
--- a/test/syntax/json/identifier-qualified-names.json
+++ b/test/syntax/json/identifier-qualified-names.json
@@ -2,7 +2,7 @@
     {
         "type": "typedef",
         "idlType": {
-            "type": null,
+            "type": "typedef-type",
             "sequence": false,
             "generic": null,
             "nullable": false,
@@ -25,7 +25,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -39,7 +39,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -59,7 +59,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -73,7 +73,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -145,7 +145,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -159,7 +159,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/implements.json b/test/syntax/json/implements.json
index 01698c7..69879d9 100644
--- a/test/syntax/json/implements.json
+++ b/test/syntax/json/implements.json
@@ -38,7 +38,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -52,7 +52,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -66,7 +66,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -80,7 +80,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/indexed-properties.json b/test/syntax/json/indexed-properties.json
index 72afa1f..697b595 100644
--- a/test/syntax/json/indexed-properties.json
+++ b/test/syntax/json/indexed-properties.json
@@ -29,7 +29,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -43,7 +43,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -63,7 +63,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -77,7 +77,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -91,7 +91,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -111,7 +111,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -125,7 +125,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -145,7 +145,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -159,7 +159,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -179,7 +179,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -193,7 +193,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -207,7 +207,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -227,7 +227,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -241,7 +241,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/namedconstructor.json b/test/syntax/json/namedconstructor.json
index 40bf22e..f895461 100644
--- a/test/syntax/json/namedconstructor.json
+++ b/test/syntax/json/namedconstructor.json
@@ -23,7 +23,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/namespace.json b/test/syntax/json/namespace.json
index da3983f..0611b71 100644
--- a/test/syntax/json/namespace.json
+++ b/test/syntax/json/namespace.json
@@ -29,7 +29,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -43,7 +43,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -57,7 +57,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -77,7 +77,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -91,7 +91,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -105,7 +105,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/nointerfaceobject.json b/test/syntax/json/nointerfaceobject.json
index 8ba40c1..03bb994 100644
--- a/test/syntax/json/nointerfaceobject.json
+++ b/test/syntax/json/nointerfaceobject.json
@@ -12,7 +12,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -26,7 +26,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/nullable.json b/test/syntax/json/nullable.json
index 7cc887f..ae4d2aa 100644
--- a/test/syntax/json/nullable.json
+++ b/test/syntax/json/nullable.json
@@ -7,7 +7,10 @@
             {
                 "type": "const",
                 "nullable": true,
-                "idlType": "boolean",
+                "idlType": {
+                    "type": "const-type",
+                    "idlType": "boolean"
+                },
                 "name": "ARE_WE_THERE_YET",
                 "value": {
                     "type": "boolean",
diff --git a/test/syntax/json/nullableobjects.json b/test/syntax/json/nullableobjects.json
index 7033bbc..29d1314 100644
--- a/test/syntax/json/nullableobjects.json
+++ b/test/syntax/json/nullableobjects.json
@@ -28,7 +28,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -42,7 +42,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": true,
@@ -62,7 +62,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -76,7 +76,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": true,
diff --git a/test/syntax/json/operation-optional-arg.json b/test/syntax/json/operation-optional-arg.json
index 88165a6..44c3a16 100644
--- a/test/syntax/json/operation-optional-arg.json
+++ b/test/syntax/json/operation-optional-arg.json
@@ -12,7 +12,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -26,7 +26,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -40,7 +40,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -54,7 +54,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -68,7 +68,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/overloading.json b/test/syntax/json/overloading.json
index 73fa0d8..87169e9 100644
--- a/test/syntax/json/overloading.json
+++ b/test/syntax/json/overloading.json
@@ -28,7 +28,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -42,7 +42,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -62,7 +62,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -76,7 +76,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -105,7 +105,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -119,7 +119,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -139,7 +139,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -160,7 +160,7 @@
                             }
                         ],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -174,7 +174,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -188,7 +188,7 @@
                         "variadic": true,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -208,7 +208,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -227,7 +227,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -241,7 +241,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -255,7 +255,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -269,7 +269,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -283,7 +283,7 @@
                         "variadic": true,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/overridebuiltins.json b/test/syntax/json/overridebuiltins.json
index 3e5bbca..d63f8f7 100644
--- a/test/syntax/json/overridebuiltins.json
+++ b/test/syntax/json/overridebuiltins.json
@@ -29,7 +29,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -43,7 +43,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/record.json b/test/syntax/json/record.json
index 73dab8b..5e020d8 100644
--- a/test/syntax/json/record.json
+++ b/test/syntax/json/record.json
@@ -12,7 +12,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -26,20 +26,20 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": true,
                             "generic": "sequence",
                             "nullable": false,
                             "union": false,
                             "idlType": {
-                                "type": null,
+                                "type": "argument-type",
                                 "sequence": false,
                                 "generic": "record",
                                 "nullable": false,
                                 "union": false,
                                 "idlType": [
                                     {
-                                        "type": null,
+                                        "type": "argument-type",
                                         "sequence": false,
                                         "generic": null,
                                         "nullable": false,
@@ -47,7 +47,7 @@
                                         "idlType": "ByteString"
                                     },
                                     {
-                                        "type": null,
+                                        "type": "argument-type",
                                         "sequence": false,
                                         "generic": null,
                                         "nullable": false,
@@ -70,14 +70,14 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": "record",
                     "nullable": false,
                     "union": false,
                     "idlType": [
                         {
-                            "type": null,
+                            "type": "return-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -91,7 +91,7 @@
                             "union": true,
                             "idlType": [
                                 {
-                                    "type": null,
+                                    "type": "return-type",
                                     "sequence": false,
                                     "generic": null,
                                     "nullable": false,
@@ -99,7 +99,7 @@
                                     "idlType": "float"
                                 },
                                 {
-                                    "type": null,
+                                    "type": "return-type",
                                     "sequence": false,
                                     "generic": null,
                                     "nullable": false,
@@ -122,7 +122,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -144,14 +144,14 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": "record",
                             "nullable": false,
                             "union": false,
                             "idlType": [
                                 {
-                                    "type": null,
+                                    "type": "argument-type",
                                     "sequence": false,
                                     "generic": null,
                                     "nullable": false,
@@ -159,7 +159,7 @@
                                     "idlType": "USVString"
                                 },
                                 {
-                                    "type": null,
+                                    "type": "argument-type",
                                     "sequence": false,
                                     "generic": null,
                                     "nullable": false,
@@ -189,14 +189,14 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": "record",
                     "nullable": false,
                     "union": false,
                     "idlType": [
                         {
-                            "type": null,
+                            "type": "return-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -204,7 +204,7 @@
                             "idlType": "DOMString"
                         },
                         {
-                            "type": null,
+                            "type": "return-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/reg-operations.json b/test/syntax/json/reg-operations.json
index 683cc8b..d696e90 100644
--- a/test/syntax/json/reg-operations.json
+++ b/test/syntax/json/reg-operations.json
@@ -55,7 +55,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -74,7 +74,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -88,7 +88,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -108,7 +108,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -122,7 +122,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -136,7 +136,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/replaceable.json b/test/syntax/json/replaceable.json
index 46807e5..a10b0bf 100644
--- a/test/syntax/json/replaceable.json
+++ b/test/syntax/json/replaceable.json
@@ -36,7 +36,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
diff --git a/test/syntax/json/sequence.json b/test/syntax/json/sequence.json
index 65b3ff4..c2d1765 100644
--- a/test/syntax/json/sequence.json
+++ b/test/syntax/json/sequence.json
@@ -12,7 +12,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -26,13 +26,13 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": true,
                             "generic": "sequence",
                             "nullable": false,
                             "union": false,
                             "idlType": {
-                                "type": null,
+                                "type": "argument-type",
                                 "sequence": false,
                                 "generic": null,
                                 "nullable": false,
@@ -53,13 +53,13 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": true,
                     "generic": "sequence",
                     "nullable": false,
                     "union": false,
                     "idlType": {
-                        "type": null,
+                        "type": "return-type",
                         "sequence": false,
                         "generic": null,
                         "nullable": false,
@@ -88,7 +88,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -116,7 +116,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -130,13 +130,13 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": true,
                             "generic": "sequence",
                             "nullable": false,
                             "union": false,
                             "idlType": {
-                                "type": null,
+                                "type": "argument-type",
                                 "sequence": false,
                                 "generic": null,
                                 "nullable": false,
diff --git a/test/syntax/json/static.json b/test/syntax/json/static.json
index 3ed363c..0951b2a 100644
--- a/test/syntax/json/static.json
+++ b/test/syntax/json/static.json
@@ -88,7 +88,7 @@
                 "static": true,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -102,7 +102,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -116,7 +116,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -130,7 +130,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/stringifier-custom.json b/test/syntax/json/stringifier-custom.json
index af78a13..3dc3ac1 100644
--- a/test/syntax/json/stringifier-custom.json
+++ b/test/syntax/json/stringifier-custom.json
@@ -63,7 +63,7 @@
                 "static": false,
                 "stringifier": true,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
diff --git a/test/syntax/json/stringifier.json b/test/syntax/json/stringifier.json
index 53827a7..1a70276 100644
--- a/test/syntax/json/stringifier.json
+++ b/test/syntax/json/stringifier.json
@@ -12,7 +12,7 @@
                 "static": false,
                 "stringifier": true,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
diff --git a/test/syntax/json/treatasnull.json b/test/syntax/json/treatasnull.json
index 33959c2..611d974 100644
--- a/test/syntax/json/treatasnull.json
+++ b/test/syntax/json/treatasnull.json
@@ -46,7 +46,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -70,7 +70,7 @@
                             }
                         ],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/treatasundefined.json b/test/syntax/json/treatasundefined.json
index c2d6650..258acda 100644
--- a/test/syntax/json/treatasundefined.json
+++ b/test/syntax/json/treatasundefined.json
@@ -46,7 +46,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -70,7 +70,7 @@
                             }
                         ],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
diff --git a/test/syntax/json/typedef-union.json b/test/syntax/json/typedef-union.json
index f4c8692..5c155d4 100644
--- a/test/syntax/json/typedef-union.json
+++ b/test/syntax/json/typedef-union.json
@@ -8,7 +8,7 @@
             "union": true,
             "idlType": [
                 {
-                    "type": null,
+                    "type": "typedef-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -16,7 +16,7 @@
                     "idlType": "ImageData"
                 },
                 {
-                    "type": null,
+                    "type": "typedef-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -24,7 +24,7 @@
                     "idlType": "HTMLImageElement"
                 },
                 {
-                    "type": null,
+                    "type": "typedef-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -32,7 +32,7 @@
                     "idlType": "HTMLCanvasElement"
                 },
                 {
-                    "type": null,
+                    "type": "typedef-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
diff --git a/test/syntax/json/typedef.json b/test/syntax/json/typedef.json
index 65210c1..5e9715d 100644
--- a/test/syntax/json/typedef.json
+++ b/test/syntax/json/typedef.json
@@ -45,13 +45,13 @@
     {
         "type": "typedef",
         "idlType": {
-            "type": null,
+            "type": "typedef-type",
             "sequence": true,
             "generic": "sequence",
             "nullable": false,
             "union": false,
             "idlType": {
-                "type": null,
+                "type": "typedef-type",
                 "sequence": false,
                 "generic": null,
                 "nullable": false,
@@ -135,7 +135,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -149,7 +149,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -169,7 +169,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -183,7 +183,7 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -202,7 +202,7 @@
     {
         "type": "typedef",
         "idlType": {
-            "type": null,
+            "type": "typedef-type",
             "sequence": false,
             "generic": null,
             "nullable": false,
diff --git a/test/syntax/json/typesuffixes.json b/test/syntax/json/typesuffixes.json
index 8da1b62..be0b1f2 100644
--- a/test/syntax/json/typesuffixes.json
+++ b/test/syntax/json/typesuffixes.json
@@ -12,7 +12,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -26,13 +26,13 @@
                         "variadic": false,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": true,
                             "generic": "sequence",
                             "nullable": true,
                             "union": false,
                             "idlType": {
-                                "type": null,
+                                "type": "argument-type",
                                 "sequence": false,
                                 "generic": null,
                                 "nullable": true,
diff --git a/test/syntax/json/variadic-operations.json b/test/syntax/json/variadic-operations.json
index 7c7e717..53b02df 100644
--- a/test/syntax/json/variadic-operations.json
+++ b/test/syntax/json/variadic-operations.json
@@ -29,7 +29,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -43,7 +43,7 @@
                         "variadic": true,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,
@@ -63,7 +63,7 @@
                 "static": false,
                 "stringifier": false,
                 "idlType": {
-                    "type": null,
+                    "type": "return-type",
                     "sequence": false,
                     "generic": null,
                     "nullable": false,
@@ -77,7 +77,7 @@
                         "variadic": true,
                         "extAttrs": [],
                         "idlType": {
-                            "type": null,
+                            "type": "argument-type",
                             "sequence": false,
                             "generic": null,
                             "nullable": false,