@@ -40,6 +40,12 @@ function Enum(name, values, options) {
40
40
*/
41
41
this . comments = { } ;
42
42
43
+ /**
44
+ * Reserved ranges, if any.
45
+ * @type {Array.<number[]|string> }
46
+ */
47
+ this . reserved = undefined ; // toJSON
48
+
43
49
// Note that values inherit valuesById on their prototype which makes them a TypeScript-
44
50
// compatible enum. This is used by pbts to write actual enum definitions that work for
45
51
// static and reflection code alike instead of emitting generic object definitions.
@@ -65,7 +71,9 @@ function Enum(name, values, options) {
65
71
* @throws {TypeError } If arguments are invalid
66
72
*/
67
73
Enum . 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 ;
69
77
} ;
70
78
71
79
/**
@@ -74,8 +82,9 @@ Enum.fromJSON = function fromJSON(name, json) {
74
82
*/
75
83
Enum . prototype . toJSON = function toJSON ( ) {
76
84
return util . toObject ( [
77
- "options" , this . options ,
78
- "values" , this . values
85
+ "options" , this . options ,
86
+ "values" , this . values ,
87
+ "reserved" , this . reserved
79
88
] ) ;
80
89
} ;
81
90
0 commit comments