diff --git a/tagmanager/ctags/js.c b/tagmanager/ctags/js.c index 64d84df0..1024b6ce 100644 --- a/tagmanager/ctags/js.c +++ b/tagmanager/ctags/js.c @@ -1433,6 +1433,8 @@ static boolean parseStatement (tokenInfo *const token, boolean is_inside_class) /* * Handle nameless functions * this.method_name = () {} + * Also assignments starting with parentheses + * var foo = (1 + 2) * 3; */ skipArgumentList(token); @@ -1446,6 +1448,8 @@ static boolean parseStatement (tokenInfo *const token, boolean is_inside_class) } else if (isType (token, TOKEN_CLOSE_CURLY)) is_terminated = FALSE; + else if (token->nestLevel == 0 && is_global) + makeJsTag (name, JSTAG_VARIABLE); } else if (isType (token, TOKEN_OPEN_CURLY)) { diff --git a/tests/ctags/bug2777310.js b/tests/ctags/bug2777310.js index 53070e7b..26c3fc9c 100644 --- a/tests/ctags/bug2777310.js +++ b/tests/ctags/bug2777310.js @@ -1,4 +1,6 @@ var x = 1; var z = {}; var y = []; +var a = (42 + 1) * 2; +var b = 2 * (42 + 1); diff --git a/tests/ctags/bug2777310.js.tags b/tests/ctags/bug2777310.js.tags index 8ae01b77..42f6ee87 100644 --- a/tests/ctags/bug2777310.js.tags +++ b/tests/ctags/bug2777310.js.tags @@ -1,4 +1,6 @@ # format=tagmanager +aÌ16384Ö0 +bÌ16384Ö0 xÌ16384Ö0 yÌ16384Ö0 zÌ16384Ö0