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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 569 |
570 throwAbstractClassInstantiationError(className) { | 570 throwAbstractClassInstantiationError(className) { |
571 throw new AbstractClassInstantiationError(className); | 571 throw new AbstractClassInstantiationError(className); |
572 } | 572 } |
573 | 573 |
574 @NoInline() | 574 @NoInline() |
575 throwConcurrentModificationError(collection) { | 575 throwConcurrentModificationError(collection) { |
576 throw new ConcurrentModificationError(collection); | 576 throw new ConcurrentModificationError(collection); |
577 } | 577 } |
578 | 578 |
579 @JsPeerInterface(name: 'TypeError') | |
580 class NullError extends Interceptor implements NoSuchMethodError { | |
581 StackTrace get stackTrace => Primitives.extractStackTrace(this); | |
582 | |
583 String toString() { | |
584 // TODO(vsm): Distinguish between null reference errors and other | |
585 // TypeErrors. We should not get non-null TypeErrors from DDC code, | |
586 // but we may from native JavaScript. | |
587 var message = JS('String', '#.message', this); | |
588 return "NullError: $message"; | |
589 } | |
590 } | |
591 | |
592 class JsNoSuchMethodError extends Error implements NoSuchMethodError { | 579 class JsNoSuchMethodError extends Error implements NoSuchMethodError { |
593 final String _message; | 580 final String _message; |
594 final String _method; | 581 final String _method; |
595 final String _receiver; | 582 final String _receiver; |
596 | 583 |
597 JsNoSuchMethodError(this._message, match) | 584 JsNoSuchMethodError(this._message, match) |
598 : _method = match == null ? null : JS('String|Null', '#.method', match), | 585 : _method = match == null ? null : JS('String|Null', '#.method', match), |
599 _receiver = | 586 _receiver = |
600 match == null ? null : JS('String|Null', '#.receiver', match); | 587 match == null ? null : JS('String|Null', '#.receiver', match); |
601 | 588 |
(...skipping 313 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 | 902 // we have no way of telling the compiler yet, so it will generate an extra |
916 // layer of indirection that wraps the SyncIterator. | 903 // layer of indirection that wraps the SyncIterator. |
917 _jsIterator() => JS('', '#(...#)', _generator, _args); | 904 _jsIterator() => JS('', '#(...#)', _generator, _args); |
918 | 905 |
919 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator()); | 906 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator()); |
920 } | 907 } |
921 | 908 |
922 class BooleanConversionAssertionError extends AssertionError { | 909 class BooleanConversionAssertionError extends AssertionError { |
923 toString() => 'Failed assertion: boolean expression must not be null'; | 910 toString() => 'Failed assertion: boolean expression must not be null'; |
924 } | 911 } |
OLD | NEW |