Added new method findMatchingToken() to skip over blocks of code. Updated parseSwitch() to use the new method.

Updated tests/ctags/ui5.ui.controller.js with code that broke the switch statement.

git-svn-id: https://svn.code.sf.net/p/ctags/code/trunk@809 c5d04d22-be80-434c-894e-aa346cc9e8e8
This commit is contained in:
dfishburn 2014-05-07 20:37:00 +00:00 committed by Colomban Wendling
parent 52d2d73527
commit c54c3ad5e8
3 changed files with 36 additions and 8 deletions

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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