| Index: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
|
| index 279ee270849d8dd3f34dc94de87ee8f05a6af0d6..fc998c387aebbb35f13f7f7be8eef977f05ff8c2 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
|
| @@ -535,9 +535,27 @@ class Primitives {
|
|
|
| static num dateNow() => JS('num', r'Date.now()');
|
|
|
| + static stringFromCodePoints(codePoints) {
|
| + List<int> a = <int>[];
|
| + for (var i in codePoints) {
|
| + if (i is !int) throw new ArgumentError(i);
|
| + if (i <= 0xffff) {
|
| + JS('void', r'#.push(#)', a, i);
|
| + } else if (i <= 0x10ffff) {
|
| + JS('void', r'#.push(0xd800 + ((((#) >> 10) & 0x3ff)))', a, i - 0x10000);
|
| + JS('void', r'#.push(#)', a, 0xdc00 + (i & 0x3ff));
|
| + } else {
|
| + throw new ArgumentError(i);
|
| + }
|
| + }
|
| + return JS('String', r'String.fromCharCode.apply(#, #)', null, a);
|
| + }
|
| +
|
| static String stringFromCharCodes(charCodes) {
|
| for (var i in charCodes) {
|
| if (i is !int) throw new ArgumentError(i);
|
| + if (i < 0) throw new ArgumentError(i);
|
| + if (i > 0xffff) return stringFromCodePoints(charCodes);
|
| }
|
| return JS('String', r'String.fromCharCode.apply(#, #)', null, charCodes);
|
| }
|
|
|