Browse Source

Remove more

pull/646/head
Augusto 5 years ago committed by xpetit
parent
commit
90443d4b4c
  1. 53
      go/tests/rc/rc.go

53
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(`^\.`)

Loading…
Cancel
Save