Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/function-params/function-go.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -19,6 +19,7 @@ class GetParams {
matchProcess () {
const matchObj = {
matchFunction: 2,
matchInterfaceFunc: 2,
matchFuncNoName: 1
}
let params = ''
Expand Down Expand Up @@ -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 = [] // 参数列表
Expand Down