Skip to content

Commit 3264de9

Browse files
rscgopherbot
authored andcommitted
all: clean up old Go hacks
We are not maintaining pre-Go 1.24 code anymore, and certainly not pre-Go 1.16 or pre-Go 1.9 code. Change-Id: Idd3a1fd476f8eb34b8fbb6352addb5955e6b5893 Reviewed-on: https://go-review.googlesource.com/c/text/+/738582 Auto-Submit: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
1 parent 74af298 commit 3264de9

File tree

15 files changed

+958
-1023
lines changed

15 files changed

+958
-1023
lines changed

internal/export/idna/idna.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,3 +857,24 @@ func ascii(s string) bool {
857857
}
858858
return true
859859
}
860+
861+
// appendMapping appends the mapping for the respective rune. isMapped must be
862+
// true. A mapping is a categorization of a rune as defined in UTS #46.
863+
func (c info) appendMapping(b []byte, s string) []byte {
864+
index := int(c >> indexShift)
865+
if c&xorBit == 0 {
866+
p := index
867+
return append(b, mappings[mappingIndex[p]:mappingIndex[p+1]]...)
868+
}
869+
b = append(b, s...)
870+
if c&inlineXOR == inlineXOR {
871+
// TODO: support and handle two-byte inline masks
872+
b[len(b)-1] ^= byte(index)
873+
} else {
874+
for p := len(b) - int(xorData[index]); p < len(b); p++ {
875+
index++
876+
b[p] ^= xorData[index]
877+
}
878+
}
879+
return b
880+
}

internal/export/idna/trie13.0.0.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

message/catalog/catalog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func String(name string) Message {
333333
//
334334
// The name passed to a Var must be unique within message sequence.
335335
func Var(name string, msg ...Message) Message {
336-
return &catmsg.Var{Name: name, Message: firstInSequence(msg)}
336+
return &catmsg.Var{Name: name, Message: catmsg.FirstOf(msg)}
337337
}
338338

339339
// Context returns a Context for formatting messages.

message/catalog/catalog_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func initCatalog(t *testing.T, tc testCase) Catalog {
205205
case Message:
206206
msg = x
207207
case []Message:
208-
msg = firstInSequence(x)
208+
msg = catmsg.FirstOf(x)
209209
}
210210
data, _ := catmsg.Compile(language.MustParse(e.tag), nil, msg)
211211
m[e.tag].(dictionary)[e.key] = data

message/catalog/dict.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import (
1212
"golang.org/x/text/language"
1313
)
1414

15+
// A Message holds a collection of translations for the same phrase that may
16+
// vary based on the values of substitution arguments.
17+
type Message = catmsg.Message
18+
1519
// TODO:
1620
// Dictionary returns a Dictionary that returns the first Message, using the
1721
// given language tag, that matches:
@@ -38,7 +42,7 @@ func (b *Builder) lookup(tag language.Tag, key string) (data string, ok bool) {
3842
}
3943

4044
func (c *Builder) set(tag language.Tag, key string, s *store, msg ...Message) error {
41-
data, err := catmsg.Compile(tag, &dict{&c.macros, tag}, firstInSequence(msg))
45+
data, err := catmsg.Compile(tag, &dict{&c.macros, tag}, catmsg.FirstOf(msg))
4246

4347
s.mutex.Lock()
4448
defer s.mutex.Unlock()

message/catalog/go19.go

Lines changed: 0 additions & 15 deletions
This file was deleted.

message/pipeline/go19_test.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

message/pipeline/pipeline_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ import (
2525

2626
var genFiles = flag.Bool("gen", false, "generate output files instead of comparing")
2727

28-
// setHelper is testing.T.Helper on Go 1.9+, overridden by go19_test.go.
29-
var setHelper = func(t *testing.T) {}
30-
3128
func TestFullCycle(t *testing.T) {
3229
if runtime.GOOS == "android" {
3330
t.Skip("cannot load outside packages on android")
@@ -75,7 +72,7 @@ func TestFullCycle(t *testing.T) {
7572
}
7673
t.Run(f.Name(), func(t *testing.T) {
7774
chk := func(t *testing.T, err error) {
78-
setHelper(t)
75+
t.Helper()
7976
if err != nil {
8077
t.Fatal(err)
8178
}

secure/bidirule/bidirule.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,3 +334,7 @@ func (t *Transformer) advanceString(s string) (n int, ok bool) {
334334
}
335335
return n, true
336336
}
337+
338+
func (t *Transformer) isFinal() bool {
339+
return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial
340+
}

secure/bidirule/bidirule10.0.0.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)