Mercurial > vim
comparison src/if_lua.c @ 21367:f9d87868d77f v8.2.1234
patch 8.2.1234: Lua build problem with old compiler
Commit: https://github.com/vim/vim/commit/066e7da3cd0e3af438ff878a90ff1678363ce2a2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 18 12:50:35 2020 +0200
patch 8.2.1234: Lua build problem with old compiler
Problem: Lua build problem with old compiler.
Solution: Move declarations to start of the block. (Taro Muraoka,
closes #6477)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 18 Jul 2020 13:00:04 +0200 |
parents | 5b0bbc5d4e74 |
children | 8da5e18effc5 |
comparison
equal
deleted
inserted
replaced
21366:69e14aeb969f | 21367:f9d87868d77f |
---|---|
624 #endif | 624 #endif |
625 break; | 625 break; |
626 case LUA_TFUNCTION: | 626 case LUA_TFUNCTION: |
627 { | 627 { |
628 char_u *name; | 628 char_u *name; |
629 luaV_CFuncState *state; | |
630 | |
629 lua_pushvalue(L, pos); | 631 lua_pushvalue(L, pos); |
630 luaV_CFuncState *state = ALLOC_CLEAR_ONE(luaV_CFuncState); | 632 state = ALLOC_CLEAR_ONE(luaV_CFuncState); |
631 state->lua_funcref = luaL_ref(L, LUA_REGISTRYINDEX); | 633 state->lua_funcref = luaL_ref(L, LUA_REGISTRYINDEX); |
632 state->L = L; | 634 state->L = L; |
633 state->lua_tableref = LUA_NOREF; | 635 state->lua_tableref = LUA_NOREF; |
634 name = register_cfunc(&luaV_call_lua_func, | 636 name = register_cfunc(&luaV_call_lua_func, |
635 &luaV_call_lua_func_free, state); | 637 &luaV_call_lua_func_free, state); |
637 tv->vval.v_string = vim_strsave(name); | 639 tv->vval.v_string = vim_strsave(name); |
638 break; | 640 break; |
639 } | 641 } |
640 case LUA_TTABLE: | 642 case LUA_TTABLE: |
641 { | 643 { |
644 int lua_tableref; | |
645 | |
642 lua_pushvalue(L, pos); | 646 lua_pushvalue(L, pos); |
643 int lua_tableref = luaL_ref(L, LUA_REGISTRYINDEX); | 647 lua_tableref = luaL_ref(L, LUA_REGISTRYINDEX); |
644 if (lua_getmetatable(L, pos)) { | 648 if (lua_getmetatable(L, pos)) { |
645 lua_getfield(L, -1, LUA___CALL); | 649 lua_getfield(L, -1, LUA___CALL); |
646 if (lua_isfunction(L, -1)) { | 650 if (lua_isfunction(L, -1)) { |
647 char_u *name; | 651 char_u *name; |
648 int lua_funcref = luaL_ref(L, LUA_REGISTRYINDEX); | 652 int lua_funcref = luaL_ref(L, LUA_REGISTRYINDEX); |
649 luaV_CFuncState *state = ALLOC_CLEAR_ONE(luaV_CFuncState); | 653 luaV_CFuncState *state = ALLOC_CLEAR_ONE(luaV_CFuncState); |
654 | |
650 state->lua_funcref = lua_funcref; | 655 state->lua_funcref = lua_funcref; |
651 state->L = L; | 656 state->L = L; |
652 state->lua_tableref = lua_tableref; | 657 state->lua_tableref = lua_tableref; |
653 name = register_cfunc(&luaV_call_lua_func, | 658 name = register_cfunc(&luaV_call_lua_func, |
654 &luaV_call_lua_func_free, state); | 659 &luaV_call_lua_func_free, state); |
701 // check funcref | 706 // check funcref |
702 luaV_getfield(L, LUAVIM_FUNCREF); | 707 luaV_getfield(L, LUAVIM_FUNCREF); |
703 if (lua_rawequal(L, -1, -5)) | 708 if (lua_rawequal(L, -1, -5)) |
704 { | 709 { |
705 luaV_Funcref *f = (luaV_Funcref *) p; | 710 luaV_Funcref *f = (luaV_Funcref *) p; |
711 | |
706 func_ref(f->name); | 712 func_ref(f->name); |
707 tv->v_type = VAR_FUNC; | 713 tv->v_type = VAR_FUNC; |
708 tv->vval.v_string = vim_strsave(f->name); | 714 tv->vval.v_string = vim_strsave(f->name); |
709 lua_pop(L, 5); // MTs | 715 lua_pop(L, 5); // MTs |
710 break; | 716 break; |