File tree 5 files changed +306
-69
lines changed
dev/core/src/com/google/gwt/dev/js/rhino
super/com/google/gwt/emul/java/lang
test/com/google/gwt/emultest/java/lang
5 files changed +306
-69
lines changed Original file line number Diff line number Diff line change @@ -1266,14 +1266,19 @@ else if (!RESERVED_KEYWORD_AS_IDENTIFIER)
1266
1266
int reEnd = stringBufferTop ;
1267
1267
1268
1268
while (true ) {
1269
- if (in .match ('g' ))
1269
+ if (in .match ('g' )) {
1270
1270
addToString ('g' );
1271
- else if (in .match ('i' ))
1271
+ } else if (in .match ('i' )) {
1272
1272
addToString ('i' );
1273
- else if (in .match ('m' ))
1273
+ } else if (in .match ('m' )) {
1274
1274
addToString ('m' );
1275
- else
1275
+ } else if (in .match ('u' )) {
1276
+ addToString ('u' );
1277
+ } else if (in .match ('v' )) {
1278
+ addToString ('v' );
1279
+ } else {
1276
1280
break ;
1281
+ }
1277
1282
}
1278
1283
1279
1284
if (isAlpha (in .peek ())) {
Original file line number Diff line number Diff line change @@ -23,7 +23,23 @@ public static char charToLowerCase(char c) {
23
23
}
24
24
25
25
public static char charToUpperCase (char c ) {
26
- return String .valueOf (c ).toUpperCase ().charAt (0 );
26
+ String upper = String .valueOf (c ).toUpperCase ();
27
+ return hasExtraCodePoints (upper ) ? c : upper .charAt (0 );
28
+ }
29
+
30
+ public static int intToLowerCase (int codePoint ) {
31
+ return String .NativeString .fromCodePoint (codePoint ).toLowerCase ().codePointAt (0 );
32
+ }
33
+
34
+ public static int intToUpperCase (int codePoint ) {
35
+ String upper = String .NativeString .fromCodePoint (codePoint ).toUpperCase ();
36
+ return hasExtraCodePoints (upper ) ? codePoint : upper .codePointAt (0 );
37
+ }
38
+
39
+ // If String.toUpperCase produces more than 1 codepoint, Character.toUpperCase should
40
+ // act either as identity or title-case conversion (not supported in GWT).
41
+ private static boolean hasExtraCodePoints (String str ) {
42
+ return str .asNativeString ().codePointAt (1 ) > 0 ;
27
43
}
28
44
29
45
private CaseMapper () {}
You can’t perform that action at this time.
0 commit comments