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 _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 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 if (value is List || value == null) return value; | 1914 if (value is List || value == null) return value; |
1915 if (JS('bool', '#[#]', getInterceptor(value), property)) return value; | 1915 if (JS('bool', '#[#]', getInterceptor(value), property)) return value; |
1916 propertyTypeCastError(value, property); | 1916 propertyTypeCastError(value, property); |
1917 } | 1917 } |
1918 | 1918 |
1919 voidTypeCheck(value) { | 1919 voidTypeCheck(value) { |
1920 if (value == null) return value; | 1920 if (value == null) return value; |
1921 throw new TypeErrorImplementation(value, 'void'); | 1921 throw new TypeErrorImplementation(value, 'void'); |
1922 } | 1922 } |
1923 | 1923 |
| 1924 checkMalformedType(value, message) { |
| 1925 if (value == null) return value; |
| 1926 throw new TypeErrorImplementation.fromMessage(message); |
| 1927 } |
| 1928 |
1924 /** | 1929 /** |
1925 * Special interface recognized by the compiler and implemented by DOM | 1930 * Special interface recognized by the compiler and implemented by DOM |
1926 * objects that support integer indexing. This interface is not | 1931 * objects that support integer indexing. This interface is not |
1927 * visible to anyone, and is only injected into special libraries. | 1932 * visible to anyone, and is only injected into special libraries. |
1928 */ | 1933 */ |
1929 abstract class JavaScriptIndexingBehavior extends JSMutableIndexable { | 1934 abstract class JavaScriptIndexingBehavior extends JSMutableIndexable { |
1930 } | 1935 } |
1931 | 1936 |
1932 // TODO(lrn): These exceptions should be implemented in core. | 1937 // TODO(lrn): These exceptions should be implemented in core. |
1933 // When they are, remove the 'Implementation' here. | 1938 // When they are, remove the 'Implementation' here. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 } | 2007 } |
2003 | 2008 |
2004 /** | 2009 /** |
2005 * Error thrown when a runtime error occurs. | 2010 * Error thrown when a runtime error occurs. |
2006 */ | 2011 */ |
2007 class RuntimeError extends Error { | 2012 class RuntimeError extends Error { |
2008 final message; | 2013 final message; |
2009 RuntimeError(this.message); | 2014 RuntimeError(this.message); |
2010 String toString() => "RuntimeError: $message"; | 2015 String toString() => "RuntimeError: $message"; |
2011 } | 2016 } |
OLD | NEW |