File tree Expand file tree Collapse file tree 8 files changed +22
-6
lines changed
Expand file tree Collapse file tree 8 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 44* ` CHG ` completion: don't show loading process
55* ` FIX ` [ #1886 ]
66* ` FIX ` [ #1895 ]
7+ * ` FIX ` [ #1889 ]
78
89[ #1886 ] : https://github.com/LuaLS/lua-language-server/issues/1886
910[ #1895 ] : https://github.com/LuaLS/lua-language-server/issues/1895
11+ [ #1889 ] : https://github.com/LuaLS/lua-language-server/issues/1889
1012
1113## 3.6.10
1214` 2023-2-7 `
Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ local template = {
210210 ' assert' ,
211211 ' error' ,
212212 ' type' ,
213+ ' os.exit' ,
213214 }
214215 ),
215216 [' Lua.runtime.meta' ] = Type .String >> ' ${version} ${language} ${encoding}' ,
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ local await = require 'await'
77--- @param block parser.object
88--- @return boolean
99local function hasReturn (block )
10- if block .hasReturn or block .hasError then
10+ if block .hasReturn or block .hasExit then
1111 return true
1212 end
1313 if block .type == ' if' then
Original file line number Diff line number Diff line change 2323--- @param block parser.object
2424--- @return boolean
2525local function hasReturn (block )
26- if block .hasReturn or block .hasError then
26+ if block .hasReturn or block .hasExit then
2727 return true
2828 end
2929 if block .type == ' if' then
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ local Specials = {
118118 [' assert' ] = true ,
119119 [' error' ] = true ,
120120 [' type' ] = true ,
121+ [' os.exit' ] = true ,
121122}
122123
123124local UnarySymbol = {
@@ -2899,14 +2900,15 @@ local function compileExpAsAction(exp)
28992900 end
29002901
29012902 if exp .type == ' call' then
2902- if exp .node .special == ' error' then
2903+ if exp .node .special == ' error'
2904+ or exp .node .special == ' os.exit' then
29032905 for i = # Chunk , 1 , - 1 do
29042906 local block = Chunk [i ]
29052907 if block .type == ' ifblock'
29062908 or block .type == ' elseifblock'
29072909 or block .type == ' elseblock'
29082910 or block .type == ' function' then
2909- block .hasError = true
2911+ block .hasExit = true
29102912 break
29112913 end
29122914 end
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ local type = type
7272--- @field hasGoTo ? true
7373--- @field hasReturn ? true
7474--- @field hasBreak ? true
75- --- @field hasError ? true
75+ --- @field hasExit ? true
7676--- @field [ integer] parser.object | any
7777--- @field package _root parser.object
7878
Original file line number Diff line number Diff line change @@ -369,7 +369,7 @@ local lookIntoChild = util.switch()
369369 local neverReturn = subBlock .hasReturn
370370 or subBlock .hasGoTo
371371 or subBlock .hasBreak
372- or subBlock .hasError
372+ or subBlock .hasExit
373373 if neverReturn then
374374 mergedNode = true
375375 else
Original file line number Diff line number Diff line change @@ -2620,6 +2620,17 @@ end
26202620print(<?n?>)
26212621]]
26222622
2623+ TEST ' integer' [[
2624+ ---@type integer?
2625+ local n
2626+
2627+ if not n then
2628+ os.exit()
2629+ end
2630+
2631+ print(<?n?>)
2632+ ]]
2633+
26232634TEST ' table' [[
26242635---@type table?
26252636local n
You can’t perform that action at this time.
0 commit comments