From 54a97c8ebd12bee141eb5d0d0a3b92f9d411d0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 17 Nov 2020 15:44:43 +0800 Subject: =?UTF-8?q?lookup=20=E8=A6=81=20deep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/parser/guide.lua | 25 ++++++++++++++----------- script-beta/vm/getClass.lua | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'script-beta') diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 9939dce6..8324cfd0 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -2575,11 +2575,12 @@ function m.viewInferType(infers) local hasDoc for i = 1, #infers do local infer = infers[i] - if infer.source.type == 'doc.class' - or infer.source.type == 'doc.class.name' - or infer.source.type == 'doc.type.name' - or infer.source.type == 'doc.type.array' - or infer.source.type == 'doc.type.generic' then + local src = infer.source + if src.type == 'doc.class' + or src.type == 'doc.class.name' + or src.type == 'doc.type.name' + or src.type == 'doc.type.array' + or src.type == 'doc.type.generic' then if infer.type ~= 'any' then hasDoc = true break @@ -2589,12 +2590,14 @@ function m.viewInferType(infers) if hasDoc then for i = 1, #infers do local infer = infers[i] - if infer.source.type == 'doc.class' - or infer.source.type == 'doc.class.name' - or infer.source.type == 'doc.type.name' - or infer.source.type == 'doc.type.array' - or infer.source.type == 'doc.type.generic' - or infer.source.type == 'doc.type.enum' then + local src = infer.source + if src.type == 'doc.class' + or src.type == 'doc.class.name' + or src.type == 'doc.type.name' + or src.type == 'doc.type.array' + or src.type == 'doc.type.generic' + or src.type == 'doc.type.enum' + or src.type == 'doc.resume' then local tp = infer.type or 'any' if not mark[tp] then types[#types+1] = tp diff --git a/script-beta/vm/getClass.lua b/script-beta/vm/getClass.lua index bd7f6f7c..1623090c 100644 --- a/script-beta/vm/getClass.lua +++ b/script-beta/vm/getClass.lua @@ -2,7 +2,7 @@ local vm = require 'vm.vm' local guide = require 'parser.guide' local function lookUpDocClass(source) - local infers = vm.getInfers(source) + local infers = vm.getInfers(source, 'deep') for _, infer in ipairs(infers) do if infer.source.type == 'doc.class' or infer.source.type == 'doc.type' then -- cgit v1.2.3