diff --git a/tagmanager/ctags/js.c b/tagmanager/ctags/js.c index fac9b713b..72608a597 100644 --- a/tagmanager/ctags/js.c +++ b/tagmanager/ctags/js.c @@ -674,10 +674,35 @@ static void findCmdTerm (tokenInfo *const token) } } +static void findMatchingToken (tokenInfo *const token, tokenType begin_token, tokenType end_token) +{ + int nest_level = 0; + + if ( ! isType (token, end_token)) + { + nest_level++; + while (! (isType (token, end_token) && (nest_level == 0))) + { + readToken (token); + if (isType (token, begin_token)) + { + nest_level++; + } + if (isType (token, end_token)) + { + if (nest_level > 0) + { + nest_level--; + } + } + } + } +} + static void parseSwitch (tokenInfo *const token) { /* - * switch (expression){ + * switch (expression) { * case value1: * statement; * break; @@ -701,13 +726,7 @@ static void parseSwitch (tokenInfo *const token) if (isType (token, TOKEN_OPEN_CURLY)) { - /* - * This will be either a function or a class. - * We can only determine this by checking the body - * of the function. If we find a "this." we know - * it is a class, otherwise it is a function. - */ - parseBlock (token, token); + findMatchingToken (token, TOKEN_OPEN_CURLY, TOKEN_CLOSE_CURLY); } } diff --git a/tests/ctags/ui5.controller.js b/tests/ctags/ui5.controller.js index 2cde06756..eff40d021 100644 --- a/tests/ctags/ui5.controller.js +++ b/tests/ctags/ui5.controller.js @@ -1,5 +1,13 @@ sap.ui.controller("app.my_form", { + successfulRequest: function(data) { + switch( data.mParameters.headers.SAAP_SERVICE ) { + case SAAP_SERVICE.APPROVAL_DETAIL: + if (thisForm.getController().mApproval) { + } + } + }, + onInit : function () { this.selectListView = null; sap.ui.getCore().byId("id_createButton").setEnabled(true); diff --git a/tests/ctags/ui5.controller.js.tags b/tests/ctags/ui5.controller.js.tags index db637a53a..e24cdef92 100644 --- a/tests/ctags/ui5.controller.js.tags +++ b/tests/ctags/ui5.controller.js.tags @@ -3,3 +3,4 @@ onInit refreshFormÌ128Îsap.app.my_formÖ0 refreshSettlementsÌ128Îsap.app.my_formÖ0 setRefreshedÌ128Îsap.app.my_formÖ0 +successfulRequestÌ128Îapp.my_formÖ0