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

Side by Side Diff: src/cmd/godoc/index.go

Issue 4631098: code review 4631098: sort: rename helpers: s/Sort// in sort.Sort[Float64s|In... (Closed)
Patch Set: diff -r e276ba524959 https://go.googlecode.com/hg/ Created 12 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/godoc/codewalk.go ('k') | src/cmd/godoc/mapping.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // This file contains the infrastructure to create an 5 // This file contains the infrastructure to create an
6 // identifier and full-text index for a set of Go files. 6 // identifier and full-text index for a set of Go files.
7 // 7 //
8 // Algorithm for identifier index: 8 // Algorithm for identifier index:
9 // - traverse all .go files of the file tree specified by root 9 // - traverse all .go files of the file tree specified by root
10 // - for each word (identifier) encountered, collect all occurrences (spots) 10 // - for each word (identifier) encountered, collect all occurrences (spots)
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 line int 947 line int
948 } 948 }
949 949
950 func (list positionList) Len() int { return len(list) } 950 func (list positionList) Len() int { return len(list) }
951 func (list positionList) Less(i, j int) bool { return list[i].filename < list[j] .filename } 951 func (list positionList) Less(i, j int) bool { return list[i].filename < list[j] .filename }
952 func (list positionList) Swap(i, j int) { list[i], list[j] = list[j], list[ i] } 952 func (list positionList) Swap(i, j int) { list[i], list[j] = list[j], list[ i] }
953 953
954 954
955 // unique returns the list sorted and with duplicate entries removed 955 // unique returns the list sorted and with duplicate entries removed
956 func unique(list []int) []int { 956 func unique(list []int) []int {
957 » sort.SortInts(list) 957 » sort.Ints(list)
958 var last int 958 var last int
959 i := 0 959 i := 0
960 for _, x := range list { 960 for _, x := range list {
961 if i == 0 || x != last { 961 if i == 0 || x != last {
962 last = x 962 last = x
963 list[i] = x 963 list[i] = x
964 i++ 964 i++
965 } 965 }
966 } 966 }
967 return list[0:i] 967 return list[0:i]
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 if m.filename != last { 1033 if m.filename != last {
1034 addLines() 1034 addLines()
1035 last = m.filename 1035 last = m.filename
1036 } 1036 }
1037 lines = append(lines, m.line) 1037 lines = append(lines, m.line)
1038 } 1038 }
1039 addLines() 1039 addLines()
1040 1040
1041 return 1041 return
1042 } 1042 }
OLDNEW
« no previous file with comments | « src/cmd/godoc/codewalk.go ('k') | src/cmd/godoc/mapping.go » ('j') | no next file with comments »

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