mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
fix(source): Source giving E484 & parsing error at line 1 for lua files
It's happening because do_source is only expected to return FAIL when it was unable to open file . But `nlua_exec_file` returns fail for parsing and execution error too . Those errors are emitted through `nlua_error`. So now return value of nlua_exec_file is ignored like do_cmdline. It now only returns fail when it was unable to open file that check is done before calling nlua_exec_file or do_cmdline. Errors in nlua_exec_file are still directly emitted through nlua_error like before.
This commit is contained in:
@@ -3011,15 +3011,15 @@ int do_source(char_u *fname, int check_other, int is_vimrc)
|
||||
current_sctx.sc_lnum = 0;
|
||||
sourcing_lnum = 0;
|
||||
// Source the file as lua
|
||||
retval = (int)nlua_exec_file((const char *)fname);
|
||||
nlua_exec_file((const char *)fname);
|
||||
current_sctx = current_sctx_backup;
|
||||
sourcing_lnum = sourcing_lnum_backup;
|
||||
} else {
|
||||
// Call do_cmdline, which will call getsourceline() to get the lines.
|
||||
do_cmdline(firstline, getsourceline, (void *)&cookie,
|
||||
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
|
||||
retval = OK;
|
||||
}
|
||||
retval = OK;
|
||||
|
||||
if (l_do_profiling == PROF_YES) {
|
||||
// Get "si" again, "script_items" may have been reallocated.
|
||||
|
Reference in New Issue
Block a user