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; | 9 import 'dart:_debugger' show stackTraceMapper; |
10 | 10 |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 String toString() => _message.isEmpty ? 'Error' : 'Error: $_message'; | 617 String toString() => _message.isEmpty ? 'Error' : 'Error: $_message'; |
618 } | 618 } |
619 | 619 |
620 /** | 620 /** |
621 * Called by generated code to fetch the stack trace from a Dart | 621 * Called by generated code to fetch the stack trace from a Dart |
622 * exception. Should never return null. | 622 * exception. Should never return null. |
623 */ | 623 */ |
624 final _stackTrace = JS('', 'Symbol("_stackTrace")'); | 624 final _stackTrace = JS('', 'Symbol("_stackTrace")'); |
625 StackTrace getTraceFromException(exception) { | 625 StackTrace getTraceFromException(exception) { |
626 var error = JS('', 'dart.recordJsError(#)', exception); | 626 var error = JS('', 'dart.recordJsError(#)', exception); |
627 var trace = JS('StackTrace', '#[#]', error, _stackTrace); | 627 var trace = JS('StackTrace|Null', '#[#]', error, _stackTrace); |
628 if (trace != null) return trace; | 628 if (trace != null) return trace; |
629 trace = new _StackTrace(error); | 629 trace = new _StackTrace(error); |
630 JS('', '#[#] = #', error, _stackTrace, trace); | 630 JS('', '#[#] = #', error, _stackTrace, trace); |
631 return trace; | 631 return trace; |
632 } | 632 } |
633 | 633 |
634 class _StackTrace implements StackTrace { | 634 class _StackTrace implements StackTrace { |
635 var _exception; | 635 var _exception; |
636 String _trace; | 636 String _trace; |
637 | 637 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 // we have no way of telling the compiler yet, so it will generate an extra | 915 // we have no way of telling the compiler yet, so it will generate an extra |
916 // layer of indirection that wraps the SyncIterator. | 916 // layer of indirection that wraps the SyncIterator. |
917 _jsIterator() => JS('', '#(...#)', _generator, _args); | 917 _jsIterator() => JS('', '#(...#)', _generator, _args); |
918 | 918 |
919 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator()); | 919 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator()); |
920 } | 920 } |
921 | 921 |
922 class BooleanConversionAssertionError extends AssertionError { | 922 class BooleanConversionAssertionError extends AssertionError { |
923 toString() => 'Failed assertion: boolean expression must not be null'; | 923 toString() => 'Failed assertion: boolean expression must not be null'; |
924 } | 924 } |
OLD | NEW |