You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: string_unicode.go
    path of file: ./repos/go-starter-kit/vendor/github.com/dop251/goja
    
    the code of the file until where you have to start completion: package goja

import (
	"errors"
	"fmt"
	"github.com/dop251/goja/parser"
	"golang.org/x/text/cases"
	"golang.org/x/text/language"
	"io"
	"math"
	"reflect"
	"regexp"
	"strings"
	"unicode/utf16"
	"unicode/utf8"
)

ty
    
func (s unicodeString) lastIndex(substr valueString, start int64) int64 {
	var ss []uint16
	switch substr := substr.(type) {
	case unicodeString:
		ss = substr
	case asciiString:
		ss = make([]uint16, len(substr))
		for i := 0; i < len(substr); i++ {
			ss[i] = uint16(substr[i])
		}
	default:
		panic(fmt.Errorf("Unknown string type: %T", substr))
	}

	if maxStart := int64(len(s) - len(ss)); start > maxStart {
		start = maxStart
	}
	// TODO: optimise
	for start >= 0 {
		for i := int64(0); i < int64(len(ss)); i++ {
			if s[start+i] != ss[i] {
				goto nomatch
			}
		}

		return start
	nomatch:
		start--
	}
	return -1
}