Skip to content

Commit 8fac7d7

Browse files
committed
rename ThridPartyCall
1 parent 9c22040 commit 8fac7d7

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/compress/golang/plugin/go_ast.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ type Function struct {
3131

3232
// call to third-party function calls, key is the {{pkgAlias.funcName}}
3333
// ex: http.Get() -> {"http.Get":{PkgDir: "net/http", Name: "Get"}}
34-
ThirdPartyFunctionCalls map[string]*ThirdPartyCall
34+
ThirdPartyFunctionCalls map[string]*ThirdPartyIdentity
3535

3636
// call to internal methods, key is the {{object.funcName}}
3737
InternalMethodCalls map[string]*Function
3838

3939
// call to thrid-party methods, key is the {{object.funcName}}
40-
ThirdPartyMethodCalls map[string]*ThirdPartyCall
40+
ThirdPartyMethodCalls map[string]*ThirdPartyIdentity
4141
}
4242

43-
// ThirdPartyCall holds location information about a third party declaration
44-
type ThirdPartyCall struct {
45-
PkgPath string // Import Path of the third party package
46-
Identity string // Unique Name of declaration (FunctionName, or StructName.MethodName etc)
43+
// ThirdPartyIdentity holds identity information about a third party declaration
44+
type ThirdPartyIdentity struct {
45+
PkgPath // Import Path of the third party package
46+
Identity string // Unique Name of declaration (FunctionName, StructName.MethodName, or StructName)
4747
}
4848

4949
// Struct holds the information about a struct
@@ -57,7 +57,7 @@ type Struct struct {
5757

5858
// related third party structs in fields,
5959
// ex: type A struct { B pkg.B }, pkg.B is a child of A, key is "pkg.B"
60-
ThirdPartyChildren map[string]ThirdPartyCall
60+
ThirdPartyChildren map[string]ThirdPartyIdentity
6161

6262
// method name to Function
6363
Methods map[string]*Function
@@ -155,7 +155,7 @@ func (p *goParser) parseFile(filePath string) (map[string]*Function, error) {
155155
end := fset.PositionFor(node.End(), false).Offset
156156
content := string(bs[pos:end])
157157

158-
var thirdPartyMethodCalls, thirdPartyFunctionCalls = map[string]*ThirdPartyCall{}, map[string]*ThirdPartyCall{}
158+
var thirdPartyMethodCalls, thirdPartyFunctionCalls = map[string]*ThirdPartyIdentity{}, map[string]*ThirdPartyIdentity{}
159159
var functionCalls, methodCalls = map[string]*Function{}, map[string]*Function{}
160160

161161
ast.Inspect(funcDecl.Body, func(node ast.Node) bool {
@@ -187,7 +187,7 @@ func (p *goParser) parseFile(filePath string) (map[string]*Function, error) {
187187
}
188188
// third-party function calls
189189
if impt, ok := thirdPartyImports[x.(*ast.Ident).Name]; ok {
190-
thirdPartyFunctionCalls[funcName] = &ThirdPartyCall{PkgPath: impt, Identity: expr.Sel.Name}
190+
thirdPartyFunctionCalls[funcName] = &ThirdPartyIdentity{PkgPath: impt, Identity: expr.Sel.Name}
191191
return true
192192
}
193193
// WHY: skip sys imports?

0 commit comments

Comments
 (0)