Repository: w3c/webidl2.js
Pull request #134 (2018-01-29 13:05:14)

feat: add argument/return type
Doing `return-type` will probably be enough rather than doing `operation-type`/`callback-type`, what do you think?

marcoscaceres: > Doing return-type will probably be enough rather than doing operation-type/callback-type, what do you think?

I like `return-type` 👍 Good idea. 

Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index 93edfe3..98fb29a 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;
@@ -563,7 +563,7 @@
     };
 
     function return_type() {
-      const typ = type();
+      const typ = type("return-type");
       if (!typ) {
         if (consume(ID, "void")) {
           return "void";


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/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/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..f9ffd6a 100644
--- a/test/syntax/json/identifier-qualified-names.json
+++ b/test/syntax/json/identifier-qualified-names.json
@@ -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/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.json b/test/syntax/json/typedef.json
index 65210c1..416770b 100644
--- a/test/syntax/json/typedef.json
+++ b/test/syntax/json/typedef.json
@@ -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,
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,