From 6c5594a2026604d47d3c94ae07d0514b6616d63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 16 Apr 2022 03:41:19 +0800 Subject: fix --- script/core/signature.lua | 2 +- test/signature/init.lua | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/script/core/signature.lua b/script/core/signature.lua index bade7d7a..ab7268dd 100644 --- a/script/core/signature.lua +++ b/script/core/signature.lua @@ -45,7 +45,7 @@ local function makeOneSignature(source, oop, index) label = label:gsub('%s*->.+', '') local params = {} local i = 0 - local argStart, argLabel = label:match '%S()(%b())' + local argStart, argLabel = label:match '()(%b())$' local converted = argLabel : sub(2, -2) : gsub('%b<>', function (str) diff --git a/test/signature/init.lua b/test/signature/init.lua index 701df286..0b750cd6 100644 --- a/test/signature/init.lua +++ b/test/signature/init.lua @@ -222,3 +222,9 @@ fooC(function (x, s) end,) ]] 'function fooC(callback: fun(x: number, s: string):nil, )' + +TEST [[ +(function (a, b) +end)() +]] +'function (, b: any)' -- cgit v1.2.3