Mercurial > vim
comparison src/vim9compile.c @ 19451:b26e96f7c12f v8.2.0283
patch 8.2.0283: Vim9: failing to load script var not tested
Commit: https://github.com/vim/vim/commit/fd1823e0b783c31a5022c7a4d31c34d84ff0a744
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 19 20:23:11 2020 +0100
patch 8.2.0283: Vim9: failing to load script var not tested
Problem: Vim9: failing to load script var not tested.
Solution: Add more tests. Fix using s: in old script.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 19 Feb 2020 20:30:04 +0100 |
parents | 5d34ae66118e |
children | 12a2df388bca |
comparison
equal
deleted
inserted
replaced
19450:260de9ec24d0 | 19451:b26e96f7c12f |
---|---|
1511 { | 1511 { |
1512 scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); | 1512 scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); |
1513 int idx = get_script_item_idx(current_sctx.sc_sid, name, FALSE); | 1513 int idx = get_script_item_idx(current_sctx.sc_sid, name, FALSE); |
1514 imported_T *import; | 1514 imported_T *import; |
1515 | 1515 |
1516 if (idx == -1) | 1516 if (idx == -1 || si->sn_version != SCRIPT_VERSION_VIM9) |
1517 { | 1517 { |
1518 // variable exists but is not in sn_var_vals: old style script. | 1518 // variable is not in sn_var_vals: old style script. |
1519 return generate_OLDSCRIPT(cctx, ISN_LOADS, name, current_sctx.sc_sid, | 1519 return generate_OLDSCRIPT(cctx, ISN_LOADS, name, current_sctx.sc_sid, |
1520 &t_any); | 1520 &t_any); |
1521 } | 1521 } |
1522 if (idx >= 0) | 1522 if (idx >= 0) |
1523 { | 1523 { |
1625 { | 1625 { |
1626 if ((len == 4 && STRNCMP("true", *arg, 4) == 0) | 1626 if ((len == 4 && STRNCMP("true", *arg, 4) == 0) |
1627 || (len == 5 && STRNCMP("false", *arg, 5) == 0)) | 1627 || (len == 5 && STRNCMP("false", *arg, 5) == 0)) |
1628 res = generate_PUSHBOOL(cctx, **arg == 't' | 1628 res = generate_PUSHBOOL(cctx, **arg == 't' |
1629 ? VVAL_TRUE : VVAL_FALSE); | 1629 ? VVAL_TRUE : VVAL_FALSE); |
1630 else | 1630 else if (SCRIPT_ITEM(current_sctx.sc_sid)->sn_version |
1631 == SCRIPT_VERSION_VIM9) | |
1632 // in Vim9 script "var" can be script-local. | |
1631 res = compile_load_scriptvar(cctx, name); | 1633 res = compile_load_scriptvar(cctx, name); |
1632 } | 1634 } |
1633 } | 1635 } |
1634 if (gen_load) | 1636 if (gen_load) |
1635 res = generate_LOAD(cctx, ISN_LOAD, idx, NULL, type); | 1637 res = generate_LOAD(cctx, ISN_LOAD, idx, NULL, type); |