Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: sdk/lib/_internal/lib/js_rti.dart

Issue 23012003: Add Null class to dart:core. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Made VM not fail on x is Null tests. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 /** 5 /**
6 * This part contains helpers for supporting runtime type information. 6 * This part contains helpers for supporting runtime type information.
7 * 7 *
8 * The helper use a mixture of Dart and JavaScript objects. To indicate which is 8 * The helper use a mixture of Dart and JavaScript objects. To indicate which is
9 * used where we adopt the scheme of using explicit type annotation for Dart 9 * used where we adopt the scheme of using explicit type annotation for Dart
10 * objects and 'var' or omitted return type for JavaScript objects. 10 * objects and 'var' or omitted return type for JavaScript objects.
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 var typeArguments = getRuntimeTypeArguments(context, contextName); 376 var typeArguments = getRuntimeTypeArguments(context, contextName);
377 return invokeOn(signature, context, typeArguments); 377 return invokeOn(signature, context, typeArguments);
378 } 378 }
379 379
380 /** 380 /**
381 * Returns [:true:] if the runtime type representation [type] is a supertype of 381 * Returns [:true:] if the runtime type representation [type] is a supertype of
382 * [:Null:]. 382 * [:Null:].
383 */ 383 */
384 bool isSupertypeOfNull(var type) { 384 bool isSupertypeOfNull(var type) {
385 // `null` means `dynamic`. 385 // `null` means `dynamic`.
386 return isNull(type) || getConstructorName(type) == JS_OBJECT_CLASS_NAME(); 386 return isNull(type) || getConstructorName(type) == JS_OBJECT_CLASS_NAME()
387 || getConstructorName(type) == JS_NULL_CLASS_NAME();
387 } 388 }
388 389
389 /** 390 /**
390 * Tests whether the Dart object [o] is a subtype of the runtime type 391 * Tests whether the Dart object [o] is a subtype of the runtime type
391 * representation [t]. 392 * representation [t].
392 * 393 *
393 * See the comment in the beginning of this file for a description of type 394 * See the comment in the beginning of this file for a description of type
394 * representations. 395 * representations.
395 */ 396 */
396 bool checkSubtypeOfRuntimeType(Object o, var t) { 397 bool checkSubtypeOfRuntimeType(Object o, var t) {
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 * and [t] are Dart values. 708 * and [t] are Dart values.
708 */ 709 */
709 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); 710 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t);
710 711
711 /** 712 /**
712 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We 713 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We
713 * use this helper to avoid generating code under the invalid assumption that 714 * use this helper to avoid generating code under the invalid assumption that
714 * [s] and [t] are Dart values. 715 * [s] and [t] are Dart values.
715 */ 716 */
716 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); 717 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698