OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library _js_helper; | 5 library _js_helper; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS, | 8 import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS, |
9 JS, | 9 JS, |
10 JS_CALL_IN_ISOLATE, | 10 JS_CALL_IN_ISOLATE, |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 static String stringFromCharCodes(charCodes) { | 341 static String stringFromCharCodes(charCodes) { |
342 for (var i in charCodes) { | 342 for (var i in charCodes) { |
343 if (i is !int) throw new ArgumentError(i); | 343 if (i is !int) throw new ArgumentError(i); |
344 if (i < 0) throw new ArgumentError(i); | 344 if (i < 0) throw new ArgumentError(i); |
345 if (i > 0xffff) return stringFromCodePoints(charCodes); | 345 if (i > 0xffff) return stringFromCodePoints(charCodes); |
346 } | 346 } |
347 return _fromCharCodeApply(charCodes); | 347 return _fromCharCodeApply(charCodes); |
348 } | 348 } |
349 | 349 |
| 350 static String stringConcatUnchecked(String string1, String string2) { |
| 351 return JS('String', r'# + #', string1, string2); |
| 352 } |
| 353 |
350 static String getTimeZoneName(receiver) { | 354 static String getTimeZoneName(receiver) { |
351 // When calling toString on a Date it will emit the timezone in parenthesis. | 355 // When calling toString on a Date it will emit the timezone in parenthesis. |
352 // Example: "Wed May 16 2012 21:13:00 GMT+0200 (CEST)". | 356 // Example: "Wed May 16 2012 21:13:00 GMT+0200 (CEST)". |
353 // We extract this name using a regexp. | 357 // We extract this name using a regexp. |
354 var d = lazyAsJsDate(receiver); | 358 var d = lazyAsJsDate(receiver); |
355 return JS('String', r'/\((.*)\)/.exec(#.toString())[1]', d); | 359 return JS('String', r'/\((.*)\)/.exec(#.toString())[1]', d); |
356 } | 360 } |
357 | 361 |
358 static int getTimeZoneOffsetInMinutes(receiver) { | 362 static int getTimeZoneOffsetInMinutes(receiver) { |
359 // Note that JS and Dart disagree on the sign of the offset. | 363 // Note that JS and Dart disagree on the sign of the offset. |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 var substitution; | 1558 var substitution; |
1555 if (JS('bool', '# !== #', typeOfT, typeOfS)) { | 1559 if (JS('bool', '# !== #', typeOfT, typeOfS)) { |
1556 var field = '${JS_OPERATOR_AS_PREFIX()}${runtimeTypeToString(typeOfT)}'; | 1560 var field = '${JS_OPERATOR_AS_PREFIX()}${runtimeTypeToString(typeOfT)}'; |
1557 substitution = getField(typeOfS, field); | 1561 substitution = getField(typeOfS, field); |
1558 } | 1562 } |
1559 // Recursively check the type arguments. | 1563 // Recursively check the type arguments. |
1560 return checkArguments(substitution, getArguments(s), getArguments(t)); | 1564 return checkArguments(substitution, getArguments(s), getArguments(t)); |
1561 } | 1565 } |
1562 | 1566 |
1563 createRuntimeType(String name) => new TypeImpl(name); | 1567 createRuntimeType(String name) => new TypeImpl(name); |
OLD | NEW |