From 04b08da9af0c450d645ab7389d1467308cfc2db8 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 4 Mar 2013 21:27:36 +0100 Subject: Imported Upstream version 1.1~hg20130304 --- src/cmd/fix/math.go | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/cmd/fix/math.go (limited to 'src/cmd/fix/math.go') diff --git a/src/cmd/fix/math.go b/src/cmd/fix/math.go deleted file mode 100644 index 2ec837eb0..000000000 --- a/src/cmd/fix/math.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import "go/ast" - -func init() { - register(mathFix) -} - -var mathFix = fix{ - "math", - "2011-09-29", - math, - `Remove the leading F from math functions such as Fabs. - -http://codereview.appspot.com/5158043 -`, -} - -var mathRenames = []struct{ in, out string }{ - {"Fabs", "Abs"}, - {"Fdim", "Dim"}, - {"Fmax", "Max"}, - {"Fmin", "Min"}, - {"Fmod", "Mod"}, -} - -func math(f *ast.File) bool { - if !imports(f, "math") { - return false - } - - fixed := false - - walk(f, func(n interface{}) { - // Rename functions. - if expr, ok := n.(ast.Expr); ok { - for _, s := range mathRenames { - if isPkgDot(expr, "math", s.in) { - expr.(*ast.SelectorExpr).Sel.Name = s.out - fixed = true - return - } - } - } - }) - return fixed -} -- cgit v1.2.3