diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-21 17:49:54 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-21 17:49:54 +0200 |
commit | 7feb35e7782907b44659a2748ff5d7489deeed74 (patch) | |
tree | bbc07d7a942c0aa3d5e336ac8ea06244e25ba653 /src/ex_docmd.c | |
parent | fd6100b2aa6178b88cfadcdbc494966bf79a5488 (diff) |
patch 8.1.0309: profiling does not show a count for condition linesv8.1.0309
Problem: Profiling does not show a count for condition lines. (Daniel
Hahler)
Solution: Count lines when not skipping. (Ozaki Kiichi, closes #2499)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index ccd96b1d32..fc2b20ea7d 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1766,17 +1766,51 @@ do_one_cmd( ea.skip = (if_level > 0); #endif +/* + * 3. Skip over the range to find the command. Let "p" point to after it. + * + * We need the command to know what kind of range it uses. + */ + cmd = ea.cmd; + ea.cmd = skip_range(ea.cmd, NULL); + if (*ea.cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL) + ea.cmd = skipwhite(ea.cmd + 1); + p = find_command(&ea, NULL); + #ifdef FEAT_EVAL # ifdef FEAT_PROFILE - /* Count this line for profiling if ea.skip is FALSE. */ - if (do_profiling == PROF_YES && !ea.skip) - { - if (getline_equal(fgetline, cookie, get_func_line)) - func_line_exec(getline_cookie(fgetline, cookie)); - else if (getline_equal(fgetline, cookie, getsourceline)) - script_line_exec(); + // Count this line for profiling if skip is TRUE. + if (do_profiling == PROF_YES + && (!ea.skip || cstack->cs_idx == 0 || (cstack->cs_idx > 0 + && (cstack->cs_flags[cstack->cs_idx - 1] & CSF_ACTIVE)))) + { + int skip = did_emsg || got_int || did_throw; + + if (ea.cmdidx == CMD_catch) + skip = !skip && !(cstack->cs_idx >= 0 + && (cstack->cs_flags[cstack->cs_idx] & CSF_THROWN) + && !(cstack->cs_flags[cstack->cs_idx] & CSF_CAUGHT)); + else if (ea.cmdidx == CMD_else || ea.cmdidx == CMD_elseif) + skip = skip || !(cstack->cs_idx >= 0 + && !(cstack->cs_flags[cstack->cs_idx] + & (CSF_ACTIVE | CSF_TRUE))); + else if (ea.cmdidx == CMD_finally) + skip = FALSE; + else if (ea.cmdidx != CMD_endif + && ea.cmdidx != CMD_endfor + && ea.cmdidx != CMD_endtry + && ea.cmdidx != CMD_endwhile) + skip = ea.skip; + + if (!skip) + { + if (getline_equal(fgetline, cookie, get_func_line)) + func_line_exec(getline_cookie(fgetline, cookie)); + else if (getline_equal(fgetline, cookie, getsourceline)) + script_line_exec(); + } } -#endif +# endif /* May go to debug mode. If this happens and the ">quit" debug command is * used, throw an interrupt exception and skip the next command. */ @@ -1789,17 +1823,6 @@ do_one_cmd( #endif /* - * 3. Skip over the range to find the command. Let "p" point to after it. - * - * We need the command to know what kind of range it uses. - */ - cmd = ea.cmd; - ea.cmd = skip_range(ea.cmd, NULL); - if (*ea.cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL) - ea.cmd = skipwhite(ea.cmd + 1); - p = find_command(&ea, NULL); - -/* * 4. parse a range specifier of the form: addr [,addr] [;addr] .. * * where 'addr' is: |