From c77a1b9edf57bbeb035bc97e61db29ea66030a90 Mon Sep 17 00:00:00 2001 From: John Lindal Date: Thu, 7 Apr 2022 16:50:16 -0700 Subject: [PATCH] javascript: always parse the contents of a function block The new test fails without this patch. --- .../js-parse-function-block.d/args.ctags | 1 + .../js-parse-function-block.d/expected.tags | 3 +++ .../js-parse-function-block.d/input.js | 13 +++++++++++++ parsers/jscript.c | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 Units/parser-javascript.r/js-parse-function-block.d/args.ctags create mode 100644 Units/parser-javascript.r/js-parse-function-block.d/expected.tags create mode 100644 Units/parser-javascript.r/js-parse-function-block.d/input.js diff --git a/Units/parser-javascript.r/js-parse-function-block.d/args.ctags b/Units/parser-javascript.r/js-parse-function-block.d/args.ctags new file mode 100644 index 0000000000..e6561a52bb --- /dev/null +++ b/Units/parser-javascript.r/js-parse-function-block.d/args.ctags @@ -0,0 +1 @@ +--fields=+K diff --git a/Units/parser-javascript.r/js-parse-function-block.d/expected.tags b/Units/parser-javascript.r/js-parse-function-block.d/expected.tags new file mode 100644 index 0000000000..03a232c3aa --- /dev/null +++ b/Units/parser-javascript.r/js-parse-function-block.d/expected.tags @@ -0,0 +1,3 @@ +AnonymousFunctionf0f039f00100 input.js /^A.add('X', function(Y) {$/;" function +c input.js /^B.c = function(type, field)$/;" function function:B +d input.js /^B.d = function(id)$/;" function function:B diff --git a/Units/parser-javascript.r/js-parse-function-block.d/input.js b/Units/parser-javascript.r/js-parse-function-block.d/input.js new file mode 100644 index 0000000000..2b1c3e86f5 --- /dev/null +++ b/Units/parser-javascript.r/js-parse-function-block.d/input.js @@ -0,0 +1,13 @@ +A.add('X', function(Y) { + +B.c = function(type, field) +{ + var min = 5, + is_int = (min != 'a'); +}; + +B.d = function(id) +{ +}; + +}); diff --git a/parsers/jscript.c b/parsers/jscript.c index df572df1cf..2e976ff358 100644 --- a/parsers/jscript.c +++ b/parsers/jscript.c @@ -2267,7 +2267,6 @@ static bool parseStatement (tokenInfo *const token, bool is_inside_class) makeJsTag (name, is_generator ? JSTAG_GENERATOR : JSTAG_METHOD, signature, NULL); if ( vStringLength(secondary_name->string) > 0 ) makeFunctionTag (secondary_name, signature, is_generator); - parseBlock (token, name->string); } else { @@ -2290,6 +2289,7 @@ static bool parseStatement (tokenInfo *const token, bool is_inside_class) if ( vStringLength(secondary_name->string) > 0 ) makeFunctionTag (secondary_name, signature, is_generator); } + parseBlock (token, name->string); } vStringDelete (signature);