Skip to content

Commit ecd6a48

Browse files
leon776xiaoweili
and
xiaoweili
authoredApr 29, 2021
fix: parse.js "parent.add(oneof)“ error (#1602)
Co-authored-by: xiaoweili <xiaoweili@tencent.com>
1 parent 49b19fb commit ecd6a48

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/namespace.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var ReflectionObject = require("./object");
66
((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace";
77

88
var Field = require("./field"),
9+
OneOf = require("./oneof"),
910
util = require("./util");
1011

1112
var Type, // cyclic
@@ -217,7 +218,7 @@ Namespace.prototype.getEnum = function getEnum(name) {
217218
*/
218219
Namespace.prototype.add = function add(object) {
219220

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

223224
if (!this.nested)

0 commit comments

Comments
 (0)
Please sign in to comment.