From b143a3ccf41ddb9ed021b41e2b3c6b0e112234ca Mon Sep 17 00:00:00 2001 From: meizhichao Date: Mon, 9 May 2022 15:13:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81go=20interface=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=8F=82=E6=95=B0=E6=8F=90=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/function-params/function-go.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/function-params/function-go.js b/src/function-params/function-go.js index f1175bd..2b4da8a 100644 --- a/src/function-params/function-go.js +++ b/src/function-params/function-go.js @@ -4,7 +4,7 @@ * LastEditors : OBKoro1 * LastEditTime : 2020-12-24 15:44:06 * File : \koro1FileHeader\src\function-params\function-go.js - * Description : java语言获取函数参数 + * Description : go语言获取函数参数 */ class GetParams { @@ -19,6 +19,7 @@ class GetParams { matchProcess () { const matchObj = { matchFunction: 2, + matchInterfaceFunc: 2, matchFuncNoName: 1 } let params = '' @@ -49,6 +50,13 @@ class GetParams { return reg.exec(this.text) } + // 匹配接口方法声明的参数 + matchInterfaceFunc () { + //没有func关键字 可能有空格 可能有函数名 可能有空格 匹配括号 匹配括号内的一切 + const reg = /\b.*(\w+)\s*\((.*?)\)/ + return reg.exec(this.text) + } + parsing (params) { let res const paramsArr = [] // 参数列表