Permalink
Browse files

natives/unicode: Update signature of to.

In Go 1.11, the responsibility of function to has been increased to
additionally report whether caseRange contained a mapping for r.
Update our modified copy of it to fix the build.

Fixes:

	$ gopherjs build unicode
	unicode/letter.go:248:9: cannot assign 1 values to 2 variables
	unicode/letter.go:305:20: cannot initialize 2 variables with 1 values
	unicode/letter.go:296:20: cannot initialize 2 variables with 1 values
	unicode/letter.go:287:20: cannot initialize 2 variables with 1 values

Follows golang/go@05f8b44.
  • Loading branch information...
dmitshur committed Jun 27, 2018
1 parent 1075a94 commit 1a7431c97d8158c6d2e9825b05feb38c16830378
Showing with 5 additions and 5 deletions.
  1. +5 −5 compiler/natives/src/unicode/unicode.go
@@ -2,9 +2,9 @@
package unicode
func to(_case int, r rune, caseRange []CaseRange) rune {
func to(_case int, r rune, caseRange []CaseRange) (mappedRune rune, foundMapping bool) {
if _case < 0 || MaxCase <= _case {
return ReplacementChar
return ReplacementChar, false
}
lo := 0
hi := len(caseRange)
@@ -14,15 +14,15 @@ func to(_case int, r rune, caseRange []CaseRange) rune {
if rune(cr.Lo) <= r && r <= rune(cr.Hi) {
delta := rune(cr.Delta[_case])
if delta > MaxRune {
return rune(cr.Lo) + ((r-rune(cr.Lo))&^1 | rune(_case&1))
return rune(cr.Lo) + ((r-rune(cr.Lo))&^1 | rune(_case&1)), true
}
return r + delta
return r + delta, true
}
if r < rune(cr.Lo) {
hi = m
} else {
lo = m + 1
}
}
return r
return r, false
}

0 comments on commit 1a7431c

Please sign in to comment.