From c69e65f5468a3aff99f1de11ee7c72a0d9f75afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 30 Jan 2023 14:38:08 +0800 Subject: infer types of tableindex by semantic fix #1831 --- script/vm/compiler.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'script/vm/compiler.lua') diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index a3057629..a438d06f 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -1325,6 +1325,18 @@ local compilerSwitch = util.switch() end end + if not hasMarkDoc and source.type == 'tableindex' then + vm.compileByParentNode(source.node, vm.ANY, function (src) + if src.type == 'doc.field' + or src.type == 'doc.type.field' then + if vm.isSubType(guide.getUri(source), vm.compileNode(source.index), vm.compileNode(src.field or src.name)) then + hasMarkDoc = true + vm.setNode(source, vm.compileNode(src)) + end + end + end) + end + if not hasMarkDoc and source.value then vm.setNode(source, vm.compileNode(source.value)) end -- cgit v1.2.3