Repository: w3c/webidl2.js
Pull request #95 (2017-10-26 04:20:45)

 BREAKING CHANGE: argument + default types should be string


Patch:
diff --git a/README.md b/README.md
index ccfef66..3d8960f 100644
--- a/README.md
+++ b/README.md
@@ -563,7 +563,7 @@ values, all of which have the following fields:
 
 For string, number, boolean, and sequence:
 
-* `value`: The value of the given type. For sequence, the only possible value is `[]`.
+* `value`: The value of the given type, as a string. For sequence, the only possible value is `[]`.
 
 For Infinity:
 
diff --git a/lib/webidl2.js b/lib/webidl2.js
index 703a9bf..9e6711b 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -172,7 +172,7 @@
       if (consume(ID, "Infinity")) return { type: "Infinity", negative: false };
       if (consume(ID, "NaN")) return { type: "NaN" };
       const ret = consume(FLOAT) || consume(INT);
-      if (ret) return { type: "number", value: 1 * ret.value };
+      if (ret) return { type: "number", value: ret.value };
       const tok = consume(OTHER, "-");
       if (tok) {
         if (consume(ID, "Infinity")) return { type: "Infinity", negative: true };
diff --git a/package.json b/package.json
index 77a6acd..de254c4 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "webidl2",
   "description": "A WebIDL Parser",
-  "version": "6.0.1",
+  "version": "6.1.0",
   "contributors": [
     "Robin Berjon <robin@berjon.com> (https://berjon.com)",
     "Marcos Caceres <marcos@marcosc.com> (https://marcosc.com)",


Test patch:
diff --git a/test/syntax/json/constants.json b/test/syntax/json/constants.json
index d9e4e63..7522286 100644
--- a/test/syntax/json/constants.json
+++ b/test/syntax/json/constants.json
@@ -22,7 +22,7 @@
                 "name": "negative",
                 "value": {
                     "type": "number",
-                    "value": -1
+                    "value": "-1"
                 },
                 "extAttrs": []
             },
@@ -33,7 +33,7 @@
                 "name": "LF",
                 "value": {
                     "type": "number",
-                    "value": 10
+                    "value": "10"
                 },
                 "extAttrs": []
             },
@@ -44,7 +44,7 @@
                 "name": "BIT_MASK",
                 "value": {
                     "type": "number",
-                    "value": 64512
+                    "value": "0x0000fc00"
                 },
                 "extAttrs": []
             },
@@ -55,7 +55,7 @@
                 "name": "AVOGADRO",
                 "value": {
                     "type": "number",
-                    "value": 6.022e+23
+                    "value": "6.022e23"
                 },
                 "extAttrs": []
             },
diff --git a/test/syntax/json/operation-optional-arg.json b/test/syntax/json/operation-optional-arg.json
index a53f85f..44f5eef 100644
--- a/test/syntax/json/operation-optional-arg.json
+++ b/test/syntax/json/operation-optional-arg.json
@@ -74,7 +74,7 @@
                         "name": "alpha",
                         "default": {
                             "type": "number",
-                            "value": 3.5
+                            "value": "3.5"
                         }
                     }
                 ],