| 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, |
| 11 JS_CURRENT_ISOLATE, | 11 JS_CURRENT_ISOLATE, |
| 12 JS_CURRENT_ISOLATE_CONTEXT, | 12 JS_CURRENT_ISOLATE_CONTEXT, |
| 13 JS_DART_OBJECT_CONSTRUCTOR, | 13 JS_DART_OBJECT_CONSTRUCTOR, |
| 14 JS_FUNCTION_CLASS_NAME, | 14 JS_FUNCTION_CLASS_NAME, |
| 15 JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG, | 15 JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG, |
| 16 JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG, | 16 JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG, |
| 17 JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG, | 17 JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG, |
| 18 JS_FUNCTION_TYPE_RETURN_TYPE_TAG, | 18 JS_FUNCTION_TYPE_RETURN_TYPE_TAG, |
| 19 JS_FUNCTION_TYPE_TAG, | 19 JS_FUNCTION_TYPE_TAG, |
| 20 JS_FUNCTION_TYPE_VOID_RETURN_TAG, | 20 JS_FUNCTION_TYPE_VOID_RETURN_TAG, |
| 21 JS_GET_NAME, | 21 JS_GET_NAME, |
| 22 JS_GLOBAL_OBJECT, | 22 JS_GLOBAL_OBJECT, |
| 23 JS_HAS_EQUALS, | 23 JS_HAS_EQUALS, |
| 24 JS_IS_INDEXABLE_FIELD_NAME, | 24 JS_IS_INDEXABLE_FIELD_NAME, |
| 25 JS_OBJECT_CLASS_NAME, | 25 JS_OBJECT_CLASS_NAME, |
| 26 JS_NULL_CLASS_NAME, |
| 26 JS_OPERATOR_AS_PREFIX, | 27 JS_OPERATOR_AS_PREFIX, |
| 27 JS_OPERATOR_IS_PREFIX, | 28 JS_OPERATOR_IS_PREFIX, |
| 28 JS_SIGNATURE_NAME, | 29 JS_SIGNATURE_NAME, |
| 29 RAW_DART_FUNCTION_REF; | 30 RAW_DART_FUNCTION_REF; |
| 30 import 'dart:_interceptors'; | 31 import 'dart:_interceptors'; |
| 31 import 'dart:_collection-dev' as _symbol_dev; | 32 import 'dart:_collection-dev' as _symbol_dev; |
| 32 import 'dart:_js_names' show mangledNames, mangledGlobalNames; | 33 import 'dart:_js_names' show mangledNames, mangledGlobalNames; |
| 33 | 34 |
| 34 part 'constant_map.dart'; | 35 part 'constant_map.dart'; |
| 35 part 'native_helper.dart'; | 36 part 'native_helper.dart'; |
| (...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 * @JSName('title') | 1596 * @JSName('title') |
| 1596 * String $dom_title; | 1597 * String $dom_title; |
| 1597 * } | 1598 * } |
| 1598 */ | 1599 */ |
| 1599 class JSName { | 1600 class JSName { |
| 1600 final String name; | 1601 final String name; |
| 1601 const JSName(this.name); | 1602 const JSName(this.name); |
| 1602 } | 1603 } |
| 1603 | 1604 |
| 1604 /** | 1605 /** |
| 1605 * Represents the type of Null. The compiler treats this specially. | |
| 1606 * TODO(lrn): Null should be defined in core. It's a class, like int. | |
| 1607 * It just happens to act differently in assignability tests and, | |
| 1608 * like int, can't be extended or implemented. | |
| 1609 */ | |
| 1610 class Null { | |
| 1611 factory Null() { | |
| 1612 throw new UnsupportedError('new Null()'); | |
| 1613 } | |
| 1614 } | |
| 1615 | |
| 1616 /** | |
| 1617 * The following methods are called by the runtime to implement | 1606 * The following methods are called by the runtime to implement |
| 1618 * checked mode and casts. We specialize each primitive type (eg int, bool), and | 1607 * checked mode and casts. We specialize each primitive type (eg int, bool), and |
| 1619 * use the compiler's convention to do is-checks on regular objects. | 1608 * use the compiler's convention to do is-checks on regular objects. |
| 1620 */ | 1609 */ |
| 1621 boolConversionCheck(value) { | 1610 boolConversionCheck(value) { |
| 1622 boolTypeCheck(value); | 1611 boolTypeCheck(value); |
| 1623 assert(value != null); | 1612 assert(value != null); |
| 1624 return value; | 1613 return value; |
| 1625 } | 1614 } |
| 1626 | 1615 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 } | 1922 } |
| 1934 | 1923 |
| 1935 /** | 1924 /** |
| 1936 * Error thrown when a runtime error occurs. | 1925 * Error thrown when a runtime error occurs. |
| 1937 */ | 1926 */ |
| 1938 class RuntimeError extends Error { | 1927 class RuntimeError extends Error { |
| 1939 final message; | 1928 final message; |
| 1940 RuntimeError(this.message); | 1929 RuntimeError(this.message); |
| 1941 String toString() => "RuntimeError: $message"; | 1930 String toString() => "RuntimeError: $message"; |
| 1942 } | 1931 } |
| OLD | NEW |