File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 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)
12661266 int reEnd = stringBufferTop ;
12671267
12681268 while (true ) {
1269- if (in .match ('g' ))
1269+ if (in .match ('g' )) {
12701270 addToString ('g' );
1271- else if (in .match ('i' ))
1271+ } else if (in .match ('i' )) {
12721272 addToString ('i' );
1273- else if (in .match ('m' ))
1273+ } else if (in .match ('m' )) {
12741274 addToString ('m' );
1275- else
1275+ } else if (in .match ('u' )) {
1276+ addToString ('u' );
1277+ } else if (in .match ('v' )) {
1278+ addToString ('v' );
1279+ } else {
12761280 break ;
1281+ }
12771282 }
12781283
12791284 if (isAlpha (in .peek ())) {
Original file line number Diff line number Diff line change @@ -23,7 +23,23 @@ public static char charToLowerCase(char c) {
2323 }
2424
2525 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 ;
2743 }
2844
2945 private CaseMapper () {}
You can’t perform that action at this time.
0 commit comments