Skip to content

Commit

Permalink
Merge pull request #4193 from b4n/js-held-implicit-semicolon
Browse files Browse the repository at this point in the history
JavaScript: Fix held tokens breaking implicit semicolon insertion
  • Loading branch information
masatake authored Feb 17, 2025
2 parents 114bd08 + ebb6eb0 commit e7db33b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ k input.js /^var k = new Function('a','b','return a+b')$/;" f
l input.js /^function l() {}$/;" f
m input.js /^var m = 0 \/\/ a single comment doesn't eat the newline$/;" v
n input.js /^function n() {}$/;" f
o input.js /^var o = () => {$/;" f
p input.js /^var p$/;" v
q input.js /^function q() {}$/;" f
6 changes: 6 additions & 0 deletions Units/parser-javascript.r/js-implicit-semicolons.d/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ var k = new Function('a','b','return a+b')
function l() {}
var m = 0 // a single comment doesn't eat the newline
function n() {}
/* test from https://github.com/universal-ctags/ctags/issues/4192 */
var o = () => {
return 0
}
var p
function q() {}
1 change: 1 addition & 0 deletions parsers/jscript.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ static void readTokenFullRaw (tokenInfo *const token, bool include_newlines, vSt
copyToken (token, NextToken, false);
deleteToken (NextToken);
NextToken = NULL;
LastTokenType = token->type;
if (repr)
reprToken (token, repr);
return;
Expand Down

0 comments on commit e7db33b

Please sign in to comment.