mirror of
https://github.com/neovim/neovim.git
synced 2026-04-20 14:25:32 +00:00
vim-patch:9.0.1758: vim9 no class identifiers in stack dumps
Problem: vim9 no class identifiers in stack dumps
Solution: Prefix class members in stack traces with the class name
followed by a dot.
closes: vim/vim#12866
closes: vim/vim#12078
0ffc17aa47
Co-authored-by: LemonBoy <thatlemon@gmail.com>
This commit is contained in:
@@ -195,7 +195,6 @@ char *estack_sfile(estack_arg_T which)
|
|||||||
for (int idx = 0; idx < exestack.ga_len; idx++) {
|
for (int idx = 0; idx < exestack.ga_len; idx++) {
|
||||||
entry = ((estack_T *)exestack.ga_data) + idx;
|
entry = ((estack_T *)exestack.ga_data) + idx;
|
||||||
if (entry->es_name != NULL) {
|
if (entry->es_name != NULL) {
|
||||||
size_t len = strlen(entry->es_name) + 15;
|
|
||||||
char *type_name = "";
|
char *type_name = "";
|
||||||
if (entry->es_type != last_type) {
|
if (entry->es_type != last_type) {
|
||||||
switch (entry->es_type) {
|
switch (entry->es_type) {
|
||||||
@@ -208,26 +207,26 @@ char *estack_sfile(estack_arg_T which)
|
|||||||
}
|
}
|
||||||
last_type = entry->es_type;
|
last_type = entry->es_type;
|
||||||
}
|
}
|
||||||
len += strlen(type_name);
|
|
||||||
ga_grow(&ga, (int)len);
|
|
||||||
linenr_T lnum = idx == exestack.ga_len - 1
|
linenr_T lnum = idx == exestack.ga_len - 1
|
||||||
? which == ESTACK_STACK ? SOURCING_LNUM : 0
|
? which == ESTACK_STACK ? SOURCING_LNUM : 0
|
||||||
: entry->es_lnum;
|
: entry->es_lnum;
|
||||||
char *dots = idx == exestack.ga_len - 1 ? "" : "..";
|
size_t len = strlen(entry->es_name) + strlen(type_name) + 26;
|
||||||
if (lnum == 0) {
|
ga_grow(&ga, (int)len);
|
||||||
// For the bottom entry of <sfile>: do not add the line number,
|
ga_concat(&ga, type_name);
|
||||||
// it is used in <slnum>. Also leave it out when the number is
|
ga_concat(&ga, entry->es_name);
|
||||||
// not set.
|
// For the bottom entry of <sfile>: do not add the line number, it is used in
|
||||||
vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s%s",
|
// <slnum>. Also leave it out when the number is not set.
|
||||||
type_name, entry->es_name, dots);
|
if (lnum != 0) {
|
||||||
} else {
|
ga.ga_len += vim_snprintf((char *)ga.ga_data + ga.ga_len, 23,
|
||||||
vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s[%" PRIdLINENR "]%s",
|
"[%" PRIdLINENR "]", lnum);
|
||||||
type_name, entry->es_name, lnum, dots);
|
}
|
||||||
|
if (idx != exestack.ga_len - 1) {
|
||||||
|
ga_concat(&ga, "..");
|
||||||
}
|
}
|
||||||
ga.ga_len += (int)strlen((char *)ga.ga_data + ga.ga_len);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ga_append(&ga, '\0');
|
||||||
return (char *)ga.ga_data;
|
return (char *)ga.ga_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user