From 8ad4b49b3f4feb96307b5fe1d2d0010758f1fab0 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sat, 24 Jan 2015 09:09:31 -0800 Subject: [PATCH] correctly handle symbols named `prototype` (#891) --- lib/jsdoc/name.js | 5 +++++ test/specs/documentation/specialnames.js | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/jsdoc/name.js b/lib/jsdoc/name.js index d7a88bc8..b122b442 100644 --- a/lib/jsdoc/name.js +++ b/lib/jsdoc/name.js @@ -74,6 +74,11 @@ function nameIsLongname(name, memberof) { } function prototypeToPunc(name) { + // don't mangle symbols named "prototype" + if (name === 'prototype') { + return name; + } + return name.replace(/(?:^|\.)prototype\.?/g, SCOPE.PUNC.INSTANCE); } diff --git a/test/specs/documentation/specialnames.js b/test/specs/documentation/specialnames.js index bd5dab68..f14e05e1 100644 --- a/test/specs/documentation/specialnames.js +++ b/test/specs/documentation/specialnames.js @@ -20,13 +20,11 @@ describe('documenting symbols with special names', function() { expect(hasOwnProp).toBeDefined(); }); - // currently broken: https://github.com/jsdoc3/jsdoc/issues/891 - xit('When a symbol is named "prototype", the symbol should appear in the docs.', function() { + it('When a symbol is named "prototype", the symbol should appear in the docs.', function() { expect(proto).toBeDefined(); }); - // currently broken: https://github.com/jsdoc3/jsdoc/issues/891 - xit('When a symbol is named "prototype", its members are resolved correctly.', function() { + it('When a symbol is named "prototype", its members are resolved correctly.', function() { expect(protoValueOf).toBeDefined(); }); });