Skip to content

Commit

Permalink
Fixed bug that caused parens around a function to make it to be unrec…
Browse files Browse the repository at this point in the history
…ognized. ( issue #213 )

git-svn-id: http://jsdoc-toolkit.googlecode.com/svn/trunk@799 c4b26cf2-672e-0410-81b6-737671b986b9
  • Loading branch information
micmath committed Jun 20, 2009
1 parent e5e1ccb commit b4a0f29
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 10 additions & 9 deletions app/lib/JSDOC/Walker.js
Expand Up @@ -115,17 +115,17 @@ JSDOC.Walker.prototype.step = function() {
}
}
else if (!JSDOC.Parser.conf.ignoreCode) { // it's code
if (this.token.is("NAME")) {
if (this.token.is("NAME")) { // it's the name of something
var symbol;
var name = this.token.data;
var doc = null; if (this.lastDoc) doc = this.lastDoc;
var params = [];

// it's inside an anonymous object
if (this.ts.look(1).is("COLON") && this.ts.look(-1).is("LEFT_CURLY") && !(this.ts.look(-2).is("JSDOC") || this.namescope.last().comment.getTag("lends").length || this.ts.look(-2).is("ASSIGN") || this.ts.look(-2).is("COLON"))) {
name = "$anonymous";
name = this.namescope.last().alias+"-"+name

params = [];

symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
Expand Down Expand Up @@ -175,7 +175,7 @@ JSDOC.Walker.prototype.step = function() {
else if (name.indexOf("this.") == 0) {
name = this.resolveThis(name);
}

if (this.lastDoc) doc = this.lastDoc;
params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));

Expand All @@ -196,8 +196,8 @@ JSDOC.Walker.prototype.step = function() {
if (matching) matching.popNamescope = name;
else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
}
// foo = new function() {}
else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("NEW") && this.ts.look(3).is("FUNCTION")) {
// foo = new function() {} or foo = (function() {}
else if (this.ts.look(1).is("ASSIGN") && (this.ts.look(2).is("NEW") || this.ts.look(2).is("LEFT_PAREN")) && this.ts.look(3).is("FUNCTION")) {
var isInner;
if (this.ts.look(-1).is("VAR") || this.isInner) {
name = this.namescope.last().alias+"-"+name
Expand All @@ -206,6 +206,8 @@ JSDOC.Walker.prototype.step = function() {
else if (name.indexOf("this.") == 0) {
name = this.resolveThis(name);
}

this.ts.next(3); // advance past the "new" or "("

if (this.lastDoc) doc = this.lastDoc;
params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
Expand Down Expand Up @@ -289,6 +291,7 @@ JSDOC.Walker.prototype.step = function() {
// var foo;
else if (this.ts.look(1).is("SEMICOLON")) {
var isInner;

if (this.ts.look(-1).is("VAR") || this.isInner) {
name = this.namescope.last().alias+"-"+name
if (!this.namescope.last().is("GLOBAL")) isInner = true;
Expand All @@ -303,8 +306,7 @@ JSDOC.Walker.prototype.step = function() {
}
}
// foo = x
else if (this.ts.look(1).is("ASSIGN")) {

else if (this.ts.look(1).is("ASSIGN")) {
var isInner;
if (this.ts.look(-1).is("VAR") || this.isInner) {
name = this.namescope.last().alias+"-"+name
Expand Down Expand Up @@ -384,7 +386,6 @@ JSDOC.Walker.prototype.step = function() {

symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);


JSDOC.Parser.addSymbol(symbol);

this.namescope.push(symbol);
Expand Down
1 change: 1 addition & 0 deletions changes.txt
@@ -1,6 +1,7 @@
== 2.2.2 ==

* Fixed bug where {@links} in @deprecated tags did not resolve. ( issue #220 )
* Fixed bug that caused parens around a function to make it to be unrecognized. ( issue #213 )

== 2.2.1 ==

Expand Down

0 comments on commit b4a0f29

Please sign in to comment.