From 5cb59c2cd6824c4d6c3483a8314f133c9a737191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 6 Nov 2019 09:38:27 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0=20parser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/parser/compile.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'server-beta/src/parser') diff --git a/server-beta/src/parser/compile.lua b/server-beta/src/parser/compile.lua index 6479106f..e110d08c 100644 --- a/server-beta/src/parser/compile.lua +++ b/server-beta/src/parser/compile.lua @@ -151,6 +151,24 @@ local vmMap = { obj.type = 'setlocal' obj.loc = loc addRef(loc, obj) + if loc.attrs then + local const + for i = 1, #loc.attrs do + local attr = loc.attrs[i][1] + if attr == 'const' + or attr == 'close' then + const = true + break + end + end + if const then + pushError { + type = 'SET_CONST', + start = obj.start, + finish = obj.finish, + } + end + end else obj.type = 'setglobal' if ENVMode == '_ENV' then -- cgit v1.2.3