MCPcopy Create free account
hub / github.com/dop251/goja / devirtualizeString

Function devirtualizeString

string.go:320–335  ·  view source on GitHub ↗
(s String)

Source from the content-addressed store, hash-verified

318}
319
320func devirtualizeString(s String) (asciiString, unicodeString) {
321 switch s := s.(type) {
322 case asciiString:
323 return s, nil
324 case unicodeString:
325 return "", s
326 case *importedString:
327 s.ensureScanned()
328 if s.u != nil {
329 return "", s.u
330 }
331 return asciiString(s.s), nil
332 default:
333 panic(unknownStringTypeErr(s))
334 }
335}
336
337func unknownStringTypeErr(v Value) interface{} {
338 return newTypeError("Internal bug: unknown string type: %T", v)

Callers 15

writeStringMethod · 0.85
WriteStringMethod · 0.85
WriteSubstringMethod · 0.85
ConcatMethod · 0.85
indexMethod · 0.85
lastIndexMethod · 0.85
ConcatMethod · 0.85
indexMethod · 0.85
lastIndexMethod · 0.85
stringproto_concatMethod · 0.85
_stringPadMethod · 0.85
stringproto_repeatMethod · 0.85

Calls 3

asciiStringTypeAlias · 0.85
unknownStringTypeErrFunction · 0.85
ensureScannedMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…