Compare commits

...

6 Commits

Author SHA1 Message Date
Bram Moolenaar
968a5b62ff patch 8.2.3003: Vim9: closure compiled with wrong compile type
Problem:    Vim9: closure compiled with wrong compile type.
Solution:   Use COMPILE_TYPE() when calling a function. (closes #8384)
2021-06-15 19:32:40 +02:00
Dominique Pelle
affd0bc626 patch 8.2.3002: Vim doesn't abort on a fatal Tcl error
Problem:    Vim doesn't abort on a fatal Tcl error.
Solution:   Change emsg() to iemsg(). (Dominique Pellé, closes #8383)
2021-06-15 19:09:43 +02:00
Bram Moolenaar
caf1a2f296 patch 8.2.3001: Vim9: memory leak when compilation fails
Problem:    Vim9: memory leak when compilation fails.
Solution:   Free the list of variable names.
2021-06-15 11:27:21 +02:00
Bram Moolenaar
3b814af7e1 patch 8.2.3000: Vim9: warning for uninitialized variable
Problem:    Vim9: warning for uninitialized variable.
Solution:   Add initialization. (John Marriott)
2021-06-15 10:22:17 +02:00
Bram Moolenaar
47f6db9089 patch 8.2.2999: balloon sometimes does not hide with GTK 3
Problem:    Balloon sometimes does not hide with GTK 3.
Solution:   Also listen to GDK_LEAVE_NOTIFY. (Johannes Stezenbach)
2021-06-14 22:08:46 +02:00
Bram Moolenaar
1b0a9dd413 patch 8.2.2998: Vim9: disassemble test fails
Problem:    Vim9: disassemble test fails.
Solution:   Add missing call to lookup_debug_var().
2021-06-14 21:32:21 +02:00
7 changed files with 63 additions and 13 deletions

View File

@@ -2571,13 +2571,17 @@ eval_variable(
cc = name[len];
name[len] = NUL;
// Check for user-defined variables.
v = find_var(name, NULL, flags & EVAL_VAR_NOAUTOLOAD);
if (v != NULL)
// Check for local variable when debugging.
if ((tv = lookup_debug_var(name)) == NULL)
{
tv = &v->di_tv;
if (dip != NULL)
*dip = v;
// Check for user-defined variables.
v = find_var(name, NULL, flags & EVAL_VAR_NOAUTOLOAD);
if (v != NULL)
{
tv = &v->di_tv;
if (dip != NULL)
*dip = v;
}
}
if (tv == NULL && (in_vim9script() || STRNCMP(name, "s:", 2) == 0))

View File

@@ -253,6 +253,9 @@ addEventHandler(GtkWidget *target, BalloonEval *beval)
if (gtk_socket_id == 0 && gui.mainwin != NULL
&& gtk_widget_is_ancestor(target, gui.mainwin))
{
gtk_widget_add_events(gui.mainwin,
GDK_LEAVE_NOTIFY_MASK);
g_signal_connect(G_OBJECT(gui.mainwin), "event",
G_CALLBACK(mainwin_event_cb),
beval);
@@ -360,6 +363,12 @@ mainwin_event_cb(GtkWidget *widget UNUSED, GdkEvent *event, gpointer data)
case GDK_KEY_RELEASE:
key_event(beval, event->key.keyval, FALSE);
break;
case GDK_LEAVE_NOTIFY:
// Ignore LeaveNotify events that are not "normal".
// Apparently we also get it when somebody else grabs focus.
if (event->crossing.mode == GDK_CROSSING_NORMAL)
cancelBalloon(beval);
break;
default:
break;
}

View File

@@ -1531,7 +1531,7 @@ tclsetdelcmd(
reflist = reflist->next;
}
// This should never happen. Famous last word?
emsg(_("E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim.org"));
iemsg(_("E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim.org"));
Tcl_SetResult(interp, _("cannot register callback command: buffer/window reference not found"), TCL_STATIC);
return TCL_ERROR;
}

View File

@@ -932,6 +932,33 @@ func Test_Backtrace_DefFunction()
call delete('Xtest2.vim')
endfunc
func Test_debug_def_function()
CheckCWD
let file =<< trim END
vim9script
def g:Func()
var n: number
def Closure(): number
return n + 3
enddef
n += Closure()
echo 'result: ' .. n
enddef
END
call writefile(file, 'Xtest.vim')
let buf = RunVimInTerminal('-S Xtest.vim', {})
call RunDbgCmd(buf,
\ ':debug call Func()',
\ ['cmd: call Func()'])
call RunDbgCmd(buf, 'next', ['result: 3'])
call term_sendkeys(buf, "\r")
call StopVimInTerminal(buf)
call delete('Xtest.vim')
endfunc
func Test_debug_backtrace_level()
CheckCWD
let lines =<< trim END

View File

@@ -750,6 +750,18 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3003,
/**/
3002,
/**/
3001,
/**/
3000,
/**/
2999,
/**/
2998,
/**/
2997,
/**/

View File

@@ -9051,7 +9051,7 @@ compile_def_function(
{
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
+ ufunc->uf_dfunc_idx;
isn_T *instr_dest;
isn_T *instr_dest = NULL;
switch (compile_type)
{
@@ -9724,8 +9724,10 @@ erret:
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
+ ufunc->uf_dfunc_idx;
// Compiling aborted, free the generated instructions.
clear_instr_ga(instr);
VIM_CLEAR(dfunc->df_name);
ga_clear_strings(&dfunc->df_var_names);
// If using the last entry in the table and it was added above, we
// might as well remove it.

View File

@@ -752,12 +752,8 @@ call_ufunc(
int error;
int idx;
int did_emsg_before = did_emsg;
compiletype_T compile_type = CT_NONE;
compiletype_T compile_type = COMPILE_TYPE(ufunc);
#ifdef FEAT_PROFILE
if (do_profiling == PROF_YES && ufunc->uf_profiling)
compile_type = CT_PROFILE;
#endif
if (func_needs_compiling(ufunc, compile_type)
&& compile_def_function(ufunc, FALSE, compile_type, NULL)
== FAIL)