rewrite5.input 538 B

1234567891011121314151617
  1. //gofmt -r=x+x->2*x
  2. // Copyright 2011 The Go Authors. All rights reserved.
  3. // Use of this source code is governed by a BSD-style
  4. // license that can be found in the LICENSE file.
  5. // Rewriting of expressions containing nodes with associated comments to
  6. // expressions without those nodes must also eliminate the associated
  7. // comments.
  8. package p
  9. func f(x int) int {
  10. _ = x + x // this comment remains in the rewrite
  11. _ = x /* this comment must not be in the rewrite */ + x
  12. return x /* this comment must not be in the rewrite */ + x
  13. }