Repository: w3c/webidl2.js (js)

Issue:
Enum value type should be "enum-value" not "string"
So, although enums are strings in JS, the type is not representative of the data type... it should be "enum-value". 

Pull request description:
fix: enum values should be of type enum-value
* closes #231 

- [ ]  update docs once this is merged. 

Patch:
diff --git a/lib/webidl2.js b/lib/webidl2.js
index fb12cef..233e8ab 100644
--- a/lib/webidl2.js
+++ b/lib/webidl2.js
@@ -1079,10 +1079,11 @@
           error("No comma between enum values");
         }
         const val = consume(STR) || error("Unexpected value in enum");
+        val.type = "enum-value";
         val.value = val.value.slice(1, -1);
-        ret.values.push(val);
         val.separator = untyped_consume(",") || null;
 
+        ret.values.push(val);
         value_expected = !!val.separator;
       }
     }


Test patch:
diff --git a/test/syntax/json/enum.json b/test/syntax/json/enum.json
index bf5b23d..90cae43 100644
--- a/test/syntax/json/enum.json
+++ b/test/syntax/json/enum.json
@@ -5,7 +5,7 @@
         "escapedName": "MealType",
         "values": [
             {
-                "type": "string",
+                "type": "enum-value",
                 "value": "rice",
                 "trivia": " ",
                 "separator": {
@@ -14,7 +14,7 @@
                 }
             },
             {
-                "type": "string",
+                "type": "enum-value",
                 "value": "noodles",
                 "trivia": " ",
                 "separator": {
@@ -23,7 +23,7 @@
                 }
             },
             {
-                "type": "string",
+                "type": "enum-value",
                 "value": "other",
                 "trivia": " ",
                 "separator": null
@@ -218,7 +218,7 @@
         "escapedName": "_AltMealType",
         "values": [
             {
-                "type": "string",
+                "type": "enum-value",
                 "value": "rice",
                 "trivia": " ",
                 "separator": {
@@ -227,7 +227,7 @@
                 }
             },
             {
-                "type": "string",
+                "type": "enum-value",
                 "value": "noodles",
                 "trivia": " ",
                 "separator": {
@@ -236,7 +236,7 @@
                 }
             },
             {
-                "type": "string",
+                "type": "enum-value",
                 "value": "other",
                 "trivia": " ",
                 "separator": {