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:_js_embedded_names' show | 7 import 'dart:_js_embedded_names' show |
8 DEFERRED_LIBRARY_URIS, | 8 DEFERRED_LIBRARY_URIS, |
9 DEFERRED_LIBRARY_HASHES, | 9 DEFERRED_LIBRARY_HASHES, |
10 GET_TYPE_FROM_NAME, | 10 GET_TYPE_FROM_NAME, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 /// Returns true if the given [type] is _the_ `Function` type. | 147 /// Returns true if the given [type] is _the_ `Function` type. |
148 // TODO(floitsch): move this to foreign_helper.dart or similar. | 148 // TODO(floitsch): move this to foreign_helper.dart or similar. |
149 @ForceInline() | 149 @ForceInline() |
150 bool isDartFunctionTypeRti(Object type) { | 150 bool isDartFunctionTypeRti(Object type) { |
151 return JS_BUILTIN('returns:bool;effects:none;depends:none', | 151 return JS_BUILTIN('returns:bool;effects:none;depends:none', |
152 JsBuiltin.isGivenTypeRti, | 152 JsBuiltin.isGivenTypeRti, |
153 type, | 153 type, |
154 JS_GET_NAME(JsGetName.FUNCTION_CLASS_TYPE_NAME)); | 154 JS_GET_NAME(JsGetName.FUNCTION_CLASS_TYPE_NAME)); |
155 } | 155 } |
156 | 156 |
| 157 /// Returns true if the given [type] is _the_ `Null` type. |
| 158 @ForceInline() |
| 159 bool isNullType(Object type) { |
| 160 return JS_BUILTIN('returns:bool;effects:none;depends:none', |
| 161 JsBuiltin.isGivenTypeRti, |
| 162 type, |
| 163 JS_GET_NAME(JsGetName.NULL_CLASS_TYPE_NAME)); |
| 164 } |
| 165 |
157 /// Returns whether the given type is _the_ Dart Object type. | 166 /// Returns whether the given type is _the_ Dart Object type. |
158 // TODO(floitsch): move this to foreign_helper.dart or similar. | 167 // TODO(floitsch): move this to foreign_helper.dart or similar. |
159 @ForceInline() | 168 @ForceInline() |
160 bool isDartObjectTypeRti(type) { | 169 bool isDartObjectTypeRti(type) { |
161 return JS_BUILTIN('returns:bool;effects:none;depends:none', | 170 return JS_BUILTIN('returns:bool;effects:none;depends:none', |
162 JsBuiltin.isGivenTypeRti, | 171 JsBuiltin.isGivenTypeRti, |
163 type, | 172 type, |
164 JS_GET_NAME(JsGetName.OBJECT_CLASS_TYPE_NAME)); | 173 JS_GET_NAME(JsGetName.OBJECT_CLASS_TYPE_NAME)); |
165 } | 174 } |
166 | 175 |
(...skipping 3893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4060 // unneeded code. | 4069 // unneeded code. |
4061 class _UnreachableError extends AssertionError { | 4070 class _UnreachableError extends AssertionError { |
4062 _UnreachableError(); | 4071 _UnreachableError(); |
4063 String toString() => "Assertion failed: Reached dead code"; | 4072 String toString() => "Assertion failed: Reached dead code"; |
4064 } | 4073 } |
4065 | 4074 |
4066 @NoInline() | 4075 @NoInline() |
4067 void assertUnreachable() { | 4076 void assertUnreachable() { |
4068 throw new _UnreachableError(); | 4077 throw new _UnreachableError(); |
4069 } | 4078 } |
OLD | NEW |