From 90443d4b4cb7d22e34e10ac5772b27aeb0770271 Mon Sep 17 00:00:00 2001 From: Augusto Date: Wed, 1 Apr 2020 18:45:53 +0100 Subject: [PATCH] Remove more --- go/tests/rc/rc.go | 53 ++++------------------------------------------- 1 file changed, 4 insertions(+), 49 deletions(-) diff --git a/go/tests/rc/rc.go b/go/tests/rc/rc.go index 36568dc61..e813eabb6 100644 --- a/go/tests/rc/rc.go +++ b/go/tests/rc/rc.go @@ -84,28 +84,6 @@ var ( allowBuiltin bool ) -// pkgFunc for all the functions of a given package -type pkgFunc struct { - functions []string - path string -} - -type funcImp struct { - pkg, fun string - pos token.Pos -} - -// All visitors -type callVisitor struct { - Calls []string - Fset *token.FileSet -} - -// Get the position of the node in the file -type locate interface { - getPos(ast.Node) string -} - type illegal struct { T string Name string @@ -319,6 +297,10 @@ func (v *visitor) Visit(n ast.Node) ast.Visitor { case *ast.FuncDecl, *ast.GenDecl, *ast.AssignStmt: //Avoids analysing a declaration inside a declaration //Since this is handle by the functions `isAllowed` + fdef := funcInfo(t) + if fdef == nil || fdef.obj == nil { + return v + } if v.oneTime { return nil } @@ -510,23 +492,6 @@ func analyseProgram(functions []*fDefInfo, path string, load loadedSource) *info return info } -//reformat from the data base -func splitArgs(args string) []string { - result := strings.Split(args, " ") - return result -} - -func rightFile(args string) string { - expectedFiles := splitArgs(args) - - for _, s := range expectedFiles { - if strings.Contains(s, ".go") { - return s - } - } - return "" -} - type flags struct { l struct { // flag for char or string literal noLit bool // true -> unallows @@ -878,16 +843,6 @@ func (l *loadVisitor) Visit(n ast.Node) ast.Visitor { return l } -func (f flags) isLitAllowed(s string) bool { - matched, err := regexp.Match(f.l.pattern, []byte(s)) - - if err != nil { - return true - } - - return !matched -} - // Returns true if the string matches the format of a relative import func isRelativeImport(s string) bool { reg := regexp.MustCompile(`^\.`)