| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart._js_helper; | 5 library dart._js_helper; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'dart:_debugger' show stackTraceMapper; |
| 10 |
| 9 import 'dart:_foreign_helper' show | 11 import 'dart:_foreign_helper' show |
| 10 JS, | 12 JS, |
| 11 JS_STRING_CONCAT; | 13 JS_STRING_CONCAT; |
| 12 | 14 |
| 13 import 'dart:_interceptors'; | 15 import 'dart:_interceptors'; |
| 14 import 'dart:_internal' show | 16 import 'dart:_internal' show |
| 15 EfficientLengthIterable, | 17 EfficientLengthIterable, |
| 16 MappedIterable, | 18 MappedIterable, |
| 17 IterableElementError; | 19 IterableElementError; |
| 18 | 20 |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 623 |
| 622 /** | 624 /** |
| 623 * Called by generated code to fetch the stack trace from an | 625 * Called by generated code to fetch the stack trace from an |
| 624 * exception. Should never return null. | 626 * exception. Should never return null. |
| 625 */ | 627 */ |
| 626 StackTrace getTraceFromException(exception) => new _StackTrace(exception); | 628 StackTrace getTraceFromException(exception) => new _StackTrace(exception); |
| 627 | 629 |
| 628 class _StackTrace implements StackTrace { | 630 class _StackTrace implements StackTrace { |
| 629 var _exception; | 631 var _exception; |
| 630 String _trace; | 632 String _trace; |
| 633 |
| 631 _StackTrace(this._exception); | 634 _StackTrace(this._exception); |
| 632 | 635 |
| 633 String toString() { | 636 String toString() { |
| 634 if (_trace != null) return JS('String', '#', _trace); | 637 if (_trace != null) return _trace; |
| 635 | 638 |
| 636 String trace; | 639 String trace; |
| 637 if (JS('bool', '# !== null', _exception) && | 640 if (JS('bool', '# !== null', _exception) && |
| 638 JS('bool', 'typeof # === "object"', _exception)) { | 641 JS('bool', 'typeof # === "object"', _exception)) { |
| 639 trace = JS("String|Null", r"#.stack", _exception); | 642 trace = JS("String|Null", r"#.stack", _exception); |
| 643 if (trace != null && stackTraceMapper != null) { |
| 644 trace = stackTraceMapper(trace); |
| 645 } |
| 640 } | 646 } |
| 641 return _trace = (trace == null) ? '' : trace; | 647 return _trace = (trace == null) ? '' : trace; |
| 642 } | 648 } |
| 643 } | 649 } |
| 644 | 650 |
| 645 int objectHashCode(var object) { | 651 int objectHashCode(var object) { |
| 646 if (object == null || JS('bool', "typeof # != 'object'", object)) { | 652 if (object == null || JS('bool', "typeof # != 'object'", object)) { |
| 647 return object.hashCode; | 653 return object.hashCode; |
| 648 } else { | 654 } else { |
| 649 return Primitives.objectHashCode(object); | 655 return Primitives.objectHashCode(object); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 // we have no way of telling the compiler yet, so it will generate an extra | 913 // we have no way of telling the compiler yet, so it will generate an extra |
| 908 // layer of indirection that wraps the SyncIterator. | 914 // layer of indirection that wraps the SyncIterator. |
| 909 _jsIterator() => JS('', '#(...#)', _generator, _args); | 915 _jsIterator() => JS('', '#(...#)', _generator, _args); |
| 910 | 916 |
| 911 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator()); | 917 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator()); |
| 912 } | 918 } |
| 913 | 919 |
| 914 class BooleanConversionAssertionError extends AssertionError { | 920 class BooleanConversionAssertionError extends AssertionError { |
| 915 toString() => 'Failed assertion: boolean expression must not be null'; | 921 toString() => 'Failed assertion: boolean expression must not be null'; |
| 916 } | 922 } |
| OLD | NEW |