Skip to content

Commit ff832f1

Browse files
committed
fix tests
1 parent 3104086 commit ff832f1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

script/parser/compile.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2207,7 +2207,7 @@ local function resolveName(node)
22072207
return nil
22082208
end
22092209
local var = getVariable(node[1], node.start)
2210-
if var and var.type == 'local' then
2210+
if var and (var.type == 'local' or var.type == 'self') then
22112211
node.type = 'getlocal'
22122212
node.node = var
22132213
if not var.ref then

test/parser_test/syntax_check.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,12 +898,14 @@ x = 2
898898

899899
TEST [[
900900
global x
901-
function f()
901+
function <!f!>()
902902
local x
903903
x = 1
904904
end
905905
]]
906-
(nil)
906+
{
907+
type = 'VARIABLE_NOT_DECLARED',
908+
}
907909

908910
-- Still error when assigning to truly undefined name under strict global scope
909911
TEST [[

0 commit comments

Comments
 (0)