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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
515 static getConstructor(String className) { | 515 static getConstructor(String className) { |
516 // TODO(ahe): How to safely access $? | 516 // TODO(ahe): How to safely access $? |
517 return JS('var', r'$[#]', className); | 517 return JS('var', r'$[#]', className); |
518 } | 518 } |
519 | 519 |
520 static bool identicalImplementation(a, b) { | 520 static bool identicalImplementation(a, b) { |
521 return JS('bool', '# == null', a) | 521 return JS('bool', '# == null', a) |
522 ? JS('bool', '# == null', b) | 522 ? JS('bool', '# == null', b) |
523 : JS('bool', '# === #', a, b); | 523 : JS('bool', '# === #', a, b); |
524 } | 524 } |
525 | |
526 // Used to implement deferred loading. Used as callback on "load" | |
ahe
2013/02/04 17:46:29
I should be able to move these methods into async_
ahe
2013/02/05 13:54:22
Done.
| |
527 // event by async_patch.dart. | |
528 static onDeferredLibraryLoadClosure(/* Completer<bool> */ completer, event) { | |
529 completer.complete(true); | |
530 } | |
531 | |
532 static onDeferredLibraryLoad() { | |
533 return DART_CLOSURE_TO_JS(onDeferredLibraryLoadClosure); | |
534 } | |
525 } | 535 } |
526 | 536 |
527 /** | 537 /** |
528 * Called by generated code to throw an illegal-argument exception, | 538 * Called by generated code to throw an illegal-argument exception, |
529 * for example, if a non-integer index is given to an optimized | 539 * for example, if a non-integer index is given to an optimized |
530 * indexed access. | 540 * indexed access. |
531 */ | 541 */ |
532 iae(argument) { | 542 iae(argument) { |
533 throw new ArgumentError(argument); | 543 throw new ArgumentError(argument); |
534 } | 544 } |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1495 if (len != t.length) return false; | 1505 if (len != t.length) return false; |
1496 for (int i = 1; i < len; i++) { | 1506 for (int i = 1; i < len; i++) { |
1497 if (!isSubtype(s[i], t[i])) { | 1507 if (!isSubtype(s[i], t[i])) { |
1498 return false; | 1508 return false; |
1499 } | 1509 } |
1500 } | 1510 } |
1501 return true; | 1511 return true; |
1502 } | 1512 } |
1503 | 1513 |
1504 createRuntimeType(String name) => new TypeImpl(name); | 1514 createRuntimeType(String name) => new TypeImpl(name); |
OLD | NEW |