Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for removeEmptyDeclGroups (0.21 sec)

  1. src/cmd/gofmt/simplify.go

    	ident, ok := x.(*ast.Ident)
    	return ok && ident.Name == "_"
    }
    
    func simplify(f *ast.File) {
    	// remove empty declarations such as "const ()", etc
    	removeEmptyDeclGroups(f)
    
    	var s simplifier
    	ast.Walk(s, f)
    }
    
    func removeEmptyDeclGroups(f *ast.File) {
    	i := 0
    	for _, d := range f.Decls {
    		if g, ok := d.(*ast.GenDecl); !ok || !isEmpty(f, g) {
    			f.Decls[i] = d
    			i++
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 19 20:06:14 UTC 2022
    - 4.8K bytes
    - Viewed (0)
Back to top