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 <xiaoweili@tencent.com>
  • Loading branch information
leon776 and xiaoweili committed Apr 29, 2021
1 parent 49b19fb commit ecd6a48
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/namespace.js
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 ecd6a48

Please sign in to comment.