Skip to content

Commit

Permalink
javascript: Fix more handling of class-related unterminated statements
Browse files Browse the repository at this point in the history
  • Loading branch information
b4n committed Nov 24, 2014
1 parent 9c84a91 commit f65dec4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tagmanager/ctags/js.c
Expand Up @@ -1229,6 +1229,8 @@ static boolean parseStatement (tokenInfo *const token, tokenInfo *const parent,
}
else
addContext (name, token);

readToken (token);
}
else if ( isKeyword(token, KEYWORD_prototype) )
{
Expand Down Expand Up @@ -1321,7 +1323,8 @@ static boolean parseStatement (tokenInfo *const token, tokenInfo *const parent,
}
}
}
readToken (token);
else
readToken (token);
} while (isType (token, TOKEN_PERIOD));
}

Expand Down
12 changes: 12 additions & 0 deletions tests/ctags/js-class-related-unterminated.js
Expand Up @@ -39,6 +39,18 @@ Cls.B.prototype.m5 = function(e) {
Cls.B.prototype.m6 = function(f) {
}

Cls.C = function () {
this.a = 0;
}

Cls.C.prototype = {
n1: function() {
Cls.C.prototype = Cls.C.prototype
},
n2: function() {
}
}

function main() {
var c = new Cls.B(1, 2);
var d = new Cls.B.Sub();
Expand Down
3 changes: 3 additions & 0 deletions tests/ctags/js-class-related-unterminated.js.tags
@@ -1,6 +1,7 @@
# format=tagmanager
A�64�Cls�0
B�1�Cls�0
C�1�Cls�0
Cls�1�0
Sub�1�Cls.B�0
dyn1�128�Cls.B.Sub�0
Expand All @@ -11,3 +12,5 @@ m4
m5�128�Cls.B�0
m6�128�Cls.B�0
main�16�0
n1�128�Cls.C�0
n2�128�Cls.C�0

0 comments on commit f65dec4

Please sign in to comment.