]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: normalize whitespace around square brackets
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 7 Jan 2020 22:30:17 +0000 (14:30 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 20 Feb 2020 18:38:43 +0000 (18:38 +0000)
I noticed some instances of "[ " and " ]" in the rewrite rules.
Normalizing them helps catch possible future duplicate rules.

Change-Id: I892fd7e9b4019ed304f0a61fa2bb7f7e47ef8f38
Reviewed-on: https://go-review.googlesource.com/c/go/+/213682
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/ssa/gen/rulegen.go

index 77927cfbd316563dc39b1d317cba6b4193746ce8..7c6e1b29ddc9f2bfbb4b82b7c422504bd762f0d5 100644 (file)
@@ -1442,6 +1442,8 @@ func normalizeWhitespace(x string) string {
        x = strings.Join(strings.Fields(x), " ")
        x = strings.Replace(x, "( ", "(", -1)
        x = strings.Replace(x, " )", ")", -1)
+       x = strings.Replace(x, "[ ", "[", -1)
+       x = strings.Replace(x, " ]", "]", -1)
        x = strings.Replace(x, ")->", ") ->", -1)
        return x
 }