| 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 /** | 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 // TODO(ahe): This is a poor hashCode as it collides with its name. | 61 // TODO(ahe): This is a poor hashCode as it collides with its name. |
| 62 int get hashCode => _typeName.hashCode; | 62 int get hashCode => _typeName.hashCode; |
| 63 | 63 |
| 64 bool operator ==(other) { | 64 bool operator ==(other) { |
| 65 return (other is TypeImpl) && _typeName == other._typeName; | 65 return (other is TypeImpl) && _typeName == other._typeName; |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 /** |
| 70 * Represents a type variable. |
| 71 * |
| 72 * This class holds the information needed when reflecting on generic classes |
| 73 * and their members. |
| 74 */ |
| 75 class TypeVariable { |
| 76 final Type owner; |
| 77 final String name; |
| 78 final int bound; |
| 79 |
| 80 const TypeVariable(this.owner, this.name, this.bound); |
| 81 } |
| 82 |
| 69 getMangledTypeName(TypeImpl type) => type._typeName; | 83 getMangledTypeName(TypeImpl type) => type._typeName; |
| 70 | 84 |
| 71 /** | 85 /** |
| 72 * Sets the runtime type information on [target]. [typeInfo] is a type | 86 * Sets the runtime type information on [target]. [typeInfo] is a type |
| 73 * representation of type 4 or 5, that is, either a JavaScript array or | 87 * representation of type 4 or 5, that is, either a JavaScript array or |
| 74 * [:null:]. | 88 * [:null:]. |
| 75 */ | 89 */ |
| 76 Object setRuntimeTypeInfo(Object target, var typeInfo) { | 90 Object setRuntimeTypeInfo(Object target, var typeInfo) { |
| 77 assert(isNull(typeInfo) || isJsArray(typeInfo)); | 91 assert(isNull(typeInfo) || isJsArray(typeInfo)); |
| 78 // We have to check for null because factories may return null. | 92 // We have to check for null because factories may return null. |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 * and [t] are Dart values. | 731 * and [t] are Dart values. |
| 718 */ | 732 */ |
| 719 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); | 733 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); |
| 720 | 734 |
| 721 /** | 735 /** |
| 722 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We | 736 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We |
| 723 * use this helper to avoid generating code under the invalid assumption that | 737 * use this helper to avoid generating code under the invalid assumption that |
| 724 * [s] and [t] are Dart values. | 738 * [s] and [t] are Dart values. |
| 725 */ | 739 */ |
| 726 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); | 740 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); |
| OLD | NEW |