@@ -6,60 +6,6 @@ import { runtimeHelpers } from "./module-exports";
6
6
import { VoidPtr } from "../types/emscripten" ;
7
7
import { isSurrogate } from "./helpers" ;
8
8
9
- export function mono_wasm_change_case_invariant ( src : number , srcLength : number , dst : number , dstLength : number , toUpper : number ) : VoidPtr {
10
- try {
11
- const input = runtimeHelpers . utf16ToStringLoop ( src , src + 2 * srcLength ) ;
12
- const result = toUpper ? input . toUpperCase ( ) : input . toLowerCase ( ) ;
13
- // Unicode defines some codepoints which expand into multiple codepoints,
14
- // originally we do not support this expansion
15
- if ( result . length <= dstLength ) {
16
- runtimeHelpers . stringToUTF16 ( dst , dst + 2 * dstLength , result ) ;
17
- return VoidPtrNull ;
18
- }
19
-
20
- // workaround to maintain the ICU-like behavior
21
- const heapI16 = runtimeHelpers . localHeapViewU16 ( ) ;
22
- let jump = 1 ;
23
- if ( toUpper ) {
24
- for ( let i = 0 ; i < input . length ; i += jump ) {
25
- // surrogate parts have to enter ToUpper/ToLower together to give correct output
26
- if ( isSurrogate ( input , i ) ) {
27
- jump = 2 ;
28
- const surrogate = input . substring ( i , i + 2 ) ;
29
- const upperSurrogate = surrogate . toUpperCase ( ) ;
30
- const appendedSurrogate = upperSurrogate . length > 2 ? surrogate : upperSurrogate ;
31
- appendSurrogateToMemory ( heapI16 , dst , appendedSurrogate , i ) ;
32
-
33
- } else {
34
- jump = 1 ;
35
- const upperChar = input [ i ] . toUpperCase ( ) ;
36
- const appendedChar = upperChar . length > 1 ? input [ i ] : upperChar ;
37
- runtimeHelpers . setU16_local ( heapI16 , dst + i * 2 , appendedChar . charCodeAt ( 0 ) ) ;
38
- }
39
- }
40
- } else {
41
- for ( let i = 0 ; i < input . length ; i += jump ) {
42
- if ( isSurrogate ( input , i ) ) {
43
- jump = 2 ;
44
- const surrogate = input . substring ( i , i + 2 ) ;
45
- const upperSurrogate = surrogate . toLowerCase ( ) ;
46
- const appendedSurrogate = upperSurrogate . length > 2 ? surrogate : upperSurrogate ;
47
- appendSurrogateToMemory ( heapI16 , dst , appendedSurrogate , i ) ;
48
-
49
- } else {
50
- jump = 1 ;
51
- const upperChar = input [ i ] . toLowerCase ( ) ;
52
- const appendedChar = upperChar . length > 1 ? input [ i ] : upperChar ;
53
- runtimeHelpers . setU16_local ( heapI16 , dst + i * 2 , appendedChar . charCodeAt ( 0 ) ) ;
54
- }
55
- }
56
- }
57
- return VoidPtrNull ;
58
- } catch ( ex : any ) {
59
- return runtimeHelpers . stringToUTF16Ptr ( ex . toString ( ) ) ;
60
- }
61
- }
62
-
63
9
export function mono_wasm_change_case ( culture : number , cultureLength : number , src : number , srcLength : number , dst : number , dstLength : number , toUpper : number ) : VoidPtr {
64
10
try {
65
11
const cultureName = runtimeHelpers . utf16ToString ( < any > culture , < any > ( culture + 2 * cultureLength ) ) ;
0 commit comments