@@ -40,6 +40,12 @@ function Enum(name, values, options) {
4040 */
4141 this . comments = { } ;
4242
43+ /**
44+ * Reserved ranges, if any.
45+ * @type {Array.<number[]|string> }
46+ */
47+ this . reserved = undefined ; // toJSON
48+
4349 // Note that values inherit valuesById on their prototype which makes them a TypeScript-
4450 // compatible enum. This is used by pbts to write actual enum definitions that work for
4551 // static and reflection code alike instead of emitting generic object definitions.
@@ -65,7 +71,9 @@ function Enum(name, values, options) {
6571 * @throws {TypeError } If arguments are invalid
6672 */
6773Enum . fromJSON = function fromJSON ( name , json ) {
68- return new Enum ( name , json . values , json . options ) ;
74+ var enm = new Enum ( name , json . values , json . options ) ;
75+ enm . reserved = json . reserved ;
76+ return enm ;
6977} ;
7078
7179/**
@@ -74,8 +82,9 @@ Enum.fromJSON = function fromJSON(name, json) {
7482 */
7583Enum . prototype . toJSON = function toJSON ( ) {
7684 return util . toObject ( [
77- "options" , this . options ,
78- "values" , this . values
85+ "options" , this . options ,
86+ "values" , this . values ,
87+ "reserved" , this . reserved
7988 ] ) ;
8089} ;
8190
0 commit comments