Mercurial > vim
comparison src/structs.h @ 20247:e46e72aaff74 v8.2.0679
patch 8.2.0679: Vim9: incomplete support for closures
Commit: https://github.com/vim/vim/commit/bf67ea1af05cbb30cd8f0b665fb567c0dca79796
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 2 17:52:42 2020 +0200
patch 8.2.0679: Vim9: incomplete support for closures
Problem: Vim9: incomplete support for closures.
Solution: At the end of a function copy arguments and local variables if
they are still used by a referenced closure.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 02 May 2020 18:00:04 +0200 |
parents | 23d75968ca5e |
children | 683c2da4982b |
comparison
equal
deleted
inserted
replaced
20246:ef2250432801 | 20247:e46e72aaff74 |
---|---|
1561 sctx_T uf_script_ctx; // SCTX where function was defined, | 1561 sctx_T uf_script_ctx; // SCTX where function was defined, |
1562 // used for s: variables | 1562 // used for s: variables |
1563 int uf_refcount; // reference count, see func_name_refcount() | 1563 int uf_refcount; // reference count, see func_name_refcount() |
1564 | 1564 |
1565 funccall_T *uf_scoped; // l: local variables for closure | 1565 funccall_T *uf_scoped; // l: local variables for closure |
1566 garray_T *uf_ectx_stack; // where compiled closure finds local vars | |
1567 int uf_ectx_frame; // index of function frame in uf_ectx_stack | |
1568 | 1566 |
1569 char_u *uf_name_exp; // if "uf_name[]" starts with SNR the name with | 1567 char_u *uf_name_exp; // if "uf_name[]" starts with SNR the name with |
1570 // "<SNR>" as a string, otherwise NULL | 1568 // "<SNR>" as a string, otherwise NULL |
1571 char_u uf_name[1]; // name of function (actually longer); can | 1569 char_u uf_name[1]; // name of function (actually longer); can |
1572 // start with <SNR>123_ (<SNR> is K_SPECIAL | 1570 // start with <SNR>123_ (<SNR> is K_SPECIAL |
1589 #define MAX_FUNC_ARGS 20 // maximum number of function arguments | 1587 #define MAX_FUNC_ARGS 20 // maximum number of function arguments |
1590 #define VAR_SHORT_LEN 20 // short variable name length | 1588 #define VAR_SHORT_LEN 20 // short variable name length |
1591 #define FIXVAR_CNT 12 // number of fixed variables | 1589 #define FIXVAR_CNT 12 // number of fixed variables |
1592 | 1590 |
1593 /* | 1591 /* |
1594 * structure to hold info for a function that is currently being executed. | 1592 * Structure to hold info for a function that is currently being executed. |
1595 */ | 1593 */ |
1596 struct funccall_S | 1594 struct funccall_S |
1597 { | 1595 { |
1598 ufunc_T *func; // function being called | 1596 ufunc_T *func; // function being called |
1599 int linenr; // next line to be executed | 1597 int linenr; // next line to be executed |