Skip to content

Commit

Permalink
fix: parse.js "parent.add(oneof)“ error (#1602)
Browse files Browse the repository at this point in the history
Co-authored-by: xiaoweili <[email protected]>
  • Loading branch information
2 people authored and alexander-fenster committed Apr 29, 2021
1 parent af1b449 commit 74fae61
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var ReflectionObject = require("./object");
((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace";

var Field = require("./field"),
OneOf = require("./oneof"),
util = require("./util");

var Type, // cyclic
Expand Down Expand Up @@ -217,7 +218,7 @@ Namespace.prototype.getEnum = function getEnum(name) {
*/
Namespace.prototype.add = function add(object) {

if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))
if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace || object instanceof OneOf))
throw TypeError("object must be a valid nested object");

if (!this.nested)
Expand Down

0 comments on commit 74fae61

Please sign in to comment.