Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(434)

Issue 6822064: gofmt: simplify assignments of the form: v = v op y

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years ago by gri
Modified:
12 years, 10 months ago
Reviewers:
Visibility:
Public.

Description

gofmt: implemented -ss ("strong simplify") feature In contrast to gofmt -s, which enables idiomatic simplifications but leaves the programmers intentions with respect to expression of code intact, gofmt -ss is free to simplify code automatically as much as possible while preserving semantics. For instance, gofmt -s will simplify s[0:len(s)] to s[0:]; gofmt -ss will go a step further and replace s[0:b] to s[:b] (and thus s[0:len(s)] to s[:]). There is no intention in applying gofmt -ss to the basic library; this is simply a useful tool that may be applied on an individual basis. Currently implemented -ss simplifications: - v = v op y becomes: v op= y - v += 1 becomes: v++ - v -= 1 becomes: v-- - s[0:b] becomes s[:b]

Patch Set 1 #

Patch Set 2 : diff -r 170a9dc2724e https://code.google.com/p/go #

Patch Set 3 : diff -r fc6bbf557dac https://code.google.com/p/go #

Patch Set 4 : diff -r a2f1842353e7 https://code.google.com/p/go #

Patch Set 5 : diff -r 5ff1a3660917 https://code.google.com/p/go #

Patch Set 6 : diff -r e29b9036a11a https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+209 lines, -22 lines) Patch
M src/cmd/gofmt/doc.go View 1 2 1 chunk +10 lines, -1 line 0 comments Download
M src/cmd/gofmt/gofmt.go View 1 2 2 chunks +8 lines, -7 lines 0 comments Download
M src/cmd/gofmt/gofmt_test.go View 1 2 2 chunks +3 lines, -0 lines 0 comments Download
M src/cmd/gofmt/simplify.go View 1 2 5 chunks +108 lines, -14 lines 0 comments Download
A src/cmd/gofmt/testdata/assignops.golden View 1 2 3 1 chunk +40 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/assignops.input View 1 1 chunk +40 lines, -0 lines 0 comments Download

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b