From c510b336d213cd51bc87637d6ccdd1c5ad565955 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Wed, 15 Oct 2014 09:38:19 -0700 Subject: [PATCH] fix performance regression caused by 2eb3c46 (#784) --- lib/jsdoc/src/parser.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/jsdoc/src/parser.js b/lib/jsdoc/src/parser.js index 24bafb7f..ba6052f2 100644 --- a/lib/jsdoc/src/parser.js +++ b/lib/jsdoc/src/parser.js @@ -455,7 +455,7 @@ Parser.prototype.resolvePropertyParents = function(node) { doclets.push(doclet); } - // if the next ancestor's parent is an assignment expression (for example, `exports.FOO` in + // if the next ancestor is an assignment expression (for example, `exports.FOO` in // `var foo = exports.FOO = { x: 1 }`, keep walking upwards if (nextAncestor && nextAncestor.type === Syntax.AssignmentExpression) { nextAncestor = nextAncestor.parent; @@ -512,14 +512,15 @@ Parser.prototype.resolveEnum = function(e) { // members of an enum inherit the enum's type if (doclet.type && !e.doclet.type) { - e.doclet.type = doclet.type; + // clone the type to prevent circular refs + e.doclet.type = jsdoc.util.doop(doclet.type); } delete e.doclet.undocumented; e.doclet.defaultvalue = e.doclet.meta.code.value; - // add a copy of the doclet to the parent's properties - doclet.properties.push( jsdoc.util.doop(e.doclet) ); + // add the doclet to the parent's properties + doclet.properties.push(e.doclet); } }); };