| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 part of models; | 5 part of models; |
| 6 | 6 |
| 7 enum InstanceKind { |
| 8 /// A general instance of the Dart class Object. |
| 9 plainInstance, |
| 10 /// null instance. |
| 11 vNull, |
| 12 /// true or false. |
| 13 bool, |
| 14 /// An instance of the Dart class double. |
| 15 double, |
| 16 /// An instance of the Dart class int. |
| 17 int, |
| 18 /// An instance of the Dart class String. |
| 19 string, |
| 20 /// An instance of the built-in VM List implementation. User-defined |
| 21 /// Lists will be PlainInstance. |
| 22 list, |
| 23 /// An instance of the built-in VM Map implementation. User-defined |
| 24 /// Maps will be PlainInstance. |
| 25 map, |
| 26 /// Vector instance kinds. |
| 27 float32x4, |
| 28 /// Vector instance kinds. |
| 29 float64x2, |
| 30 /// Vector instance kinds. |
| 31 int32x4, |
| 32 /// An instance of the built-in VM TypedData implementations. User-defined |
| 33 /// TypedDatas will be PlainInstance. |
| 34 uint8ClampedList, |
| 35 /// An instance of the built-in VM TypedData implementations. User-defined |
| 36 /// TypedDatas will be PlainInstance. |
| 37 uint8List, |
| 38 /// An instance of the built-in VM TypedData implementations. User-defined |
| 39 /// TypedDatas will be PlainInstance. |
| 40 uint16List, |
| 41 /// An instance of the built-in VM TypedData implementations. User-defined |
| 42 /// TypedDatas will be PlainInstance. |
| 43 uint32List, |
| 44 /// An instance of the built-in VM TypedData implementations. User-defined |
| 45 /// TypedDatas will be PlainInstance. |
| 46 uint64List, |
| 47 /// An instance of the built-in VM TypedData implementations. User-defined |
| 48 /// TypedDatas will be PlainInstance. |
| 49 int8List, |
| 50 /// An instance of the built-in VM TypedData implementations. User-defined |
| 51 /// TypedDatas will be PlainInstance. |
| 52 int16List, |
| 53 /// An instance of the built-in VM TypedData implementations. User-defined |
| 54 /// TypedDatas will be PlainInstance. |
| 55 int32List, |
| 56 /// An instance of the built-in VM TypedData implementations. User-defined |
| 57 /// TypedDatas will be PlainInstance. |
| 58 int64List, |
| 59 /// An instance of the built-in VM TypedData implementations. User-defined |
| 60 /// TypedDatas will be PlainInstance. |
| 61 float32List, |
| 62 /// An instance of the built-in VM TypedData implementations. User-defined |
| 63 /// TypedDatas will be PlainInstance. |
| 64 float64List, |
| 65 /// An instance of the built-in VM TypedData implementations. User-defined |
| 66 /// TypedDatas will be PlainInstance. |
| 67 int32x4List, |
| 68 /// An instance of the built-in VM TypedData implementations. User-defined |
| 69 /// TypedDatas will be PlainInstance. |
| 70 float32x4List, |
| 71 /// An instance of the built-in VM TypedData implementations. User-defined |
| 72 /// TypedDatas will be PlainInstance. |
| 73 float64x2List, |
| 74 /// An instance of the Dart class StackTrace. |
| 75 stackTrace, |
| 76 /// An instance of the built-in VM Closure implementation. User-defined |
| 77 /// Closures will be PlainInstance. |
| 78 closure, |
| 79 /// An instance of the Dart class MirrorReference. |
| 80 mirrorReference, |
| 81 /// An instance of the Dart class RegExp. |
| 82 regExp, |
| 83 /// An instance of the Dart class WeakProperty. |
| 84 weakProperty, |
| 85 /// An instance of the Dart class Type. |
| 86 type, |
| 87 /// An instance of the Dart class TypeParameter. |
| 88 typeParameter, |
| 89 /// An instance of the Dart class TypeRef. |
| 90 typeRef, |
| 91 /// An instance of the Dart class BoundedType. |
| 92 boundedType, |
| 93 } |
| 94 |
| 95 bool isTypedData(InstanceKind kind) { |
| 96 switch (kind) { |
| 97 case InstanceKind.uint8ClampedList: |
| 98 case InstanceKind.uint8List: |
| 99 case InstanceKind.uint16List: |
| 100 case InstanceKind.uint32List: |
| 101 case InstanceKind.uint64List: |
| 102 case InstanceKind.int8List: |
| 103 case InstanceKind.int16List: |
| 104 case InstanceKind.int32List: |
| 105 case InstanceKind.int64List: |
| 106 case InstanceKind.float32List: |
| 107 case InstanceKind.float64List: |
| 108 case InstanceKind.int32x4List: |
| 109 case InstanceKind.float32x4List: |
| 110 case InstanceKind.float64x2List: |
| 111 return true; |
| 112 default: |
| 113 return false; |
| 114 } |
| 115 } |
| 116 |
| 117 bool isSimdValue(InstanceKind kind) { |
| 118 switch (kind) { |
| 119 case InstanceKind.float32x4: |
| 120 case InstanceKind.float64x2: |
| 121 case InstanceKind.int32x4: |
| 122 return true; |
| 123 default: |
| 124 return false; |
| 125 } |
| 126 } |
| 127 |
| 7 abstract class InstanceRef extends ObjectRef { | 128 abstract class InstanceRef extends ObjectRef { |
| 129 /// What kind of instance is this? |
| 130 InstanceKind get kind; |
| 131 |
| 8 /// Instance references always include their class. | 132 /// Instance references always include their class. |
| 9 ClassRef get clazz; | 133 ClassRef get clazz; |
| 10 | 134 |
| 11 /// [optional] The value of this instance as a string. | 135 /// [optional] The value of this instance as a string. |
| 12 /// | 136 /// |
| 13 /// Provided for the instance kinds: | 137 /// Provided for the instance kinds: |
| 14 /// Null (null) | 138 /// Null (null) |
| 15 /// Bool (true or false) | 139 /// Bool (true or false) |
| 16 /// Double (suitable for passing to Double.parse()) | 140 /// Double (suitable for passing to Double.parse()) |
| 17 /// Int (suitable for passing to int.parse()) | 141 /// Int (suitable for passing to int.parse()) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 /// TypeParameter | 193 /// TypeParameter |
| 70 ClassRef get parameterizedClass; | 194 ClassRef get parameterizedClass; |
| 71 | 195 |
| 72 /// [optional] The pattern of a RegExp instance. | 196 /// [optional] The pattern of a RegExp instance. |
| 73 /// | 197 /// |
| 74 /// The pattern is always an instance of kind String. | 198 /// The pattern is always an instance of kind String. |
| 75 /// | 199 /// |
| 76 /// Provided for instance kinds: | 200 /// Provided for instance kinds: |
| 77 /// RegExp | 201 /// RegExp |
| 78 InstanceRef get pattern; | 202 InstanceRef get pattern; |
| 203 |
| 204 /// [optional] The function associated with a Closure instance. |
| 205 /// |
| 206 /// Provided for instance kinds: |
| 207 /// Closure |
| 208 FunctionRef get closureFunction; |
| 79 } | 209 } |
| 80 | 210 |
| 81 abstract class Instance extends Object implements InstanceRef {} | 211 abstract class Instance extends Object implements InstanceRef { |
| 212 /// [optional] The index of the first element or association or codeunit |
| 213 /// returned. This is only provided when it is non-zero. |
| 214 /// |
| 215 /// Provided for instance kinds: |
| 216 /// String |
| 217 /// List |
| 218 /// Map |
| 219 /// Uint8ClampedList |
| 220 /// Uint8List |
| 221 /// Uint16List |
| 222 /// Uint32List |
| 223 /// Uint64List |
| 224 /// Int8List |
| 225 /// Int16List |
| 226 /// Int32List |
| 227 /// Int64List |
| 228 /// Float32List |
| 229 /// Float64List |
| 230 /// Int32x4List |
| 231 /// Float32x4List |
| 232 /// Float64x2List |
| 233 int get offset; |
| 234 |
| 235 /// [optional] The number of elements or associations or codeunits returned. |
| 236 /// This is only provided when it is less than length. |
| 237 /// |
| 238 /// Provided for instance kinds: |
| 239 /// String |
| 240 /// List |
| 241 /// Map |
| 242 /// Uint8ClampedList |
| 243 /// Uint8List |
| 244 /// Uint16List |
| 245 /// Uint32List |
| 246 /// Uint64List |
| 247 /// Int8List |
| 248 /// Int16List |
| 249 /// Int32List |
| 250 /// Int64List |
| 251 /// Float32List |
| 252 /// Float64List |
| 253 /// Int32x4List |
| 254 /// Float32x4List |
| 255 /// Float64x2List |
| 256 int get count; |
| 257 |
| 258 /// [optional] The elements of a TypedData instance. |
| 259 /// |
| 260 /// Provided for instance kinds: |
| 261 /// Uint8ClampedList |
| 262 /// Uint8List |
| 263 /// Uint16List |
| 264 /// Uint32List |
| 265 /// Uint64List |
| 266 /// Int8List |
| 267 /// Int16List |
| 268 /// Int32List |
| 269 /// Int64List |
| 270 /// Float32List |
| 271 /// Float64List |
| 272 /// Int32x4List |
| 273 /// Float32x4List |
| 274 /// Float64x2List |
| 275 Iterable<dynamic> get typedElements; |
| 276 |
| 277 /// [optional]The fields of this Instance. |
| 278 Iterable<BoundField> get fields; |
| 279 |
| 280 /// [optional] The elements of a List instance. |
| 281 /// |
| 282 /// Provided for instance kinds: |
| 283 /// List |
| 284 Iterable<Guarded<ObjectRef>> get elements; |
| 285 // It should be: |
| 286 // Iterable<Guarded<InstanceRef>> get elements; |
| 287 // In some situations we obtain lists of non Instances |
| 288 |
| 289 /// [optional] The elements of a Map instance. |
| 290 /// |
| 291 /// Provided for instance kinds: |
| 292 /// Map |
| 293 Iterable<MapAssociation> get associations; |
| 294 |
| 295 /// [optional] The key for a WeakProperty instance. |
| 296 /// |
| 297 /// Provided for instance kinds: |
| 298 /// WeakProperty |
| 299 InstanceRef get key; |
| 300 |
| 301 /// [optional] The key for a WeakProperty instance. |
| 302 /// |
| 303 /// Provided for instance kinds: |
| 304 /// WeakProperty |
| 305 InstanceRef get value; |
| 306 |
| 307 /// [optional] The referent of a MirrorReference instance. |
| 308 /// |
| 309 /// Provided for instance kinds: |
| 310 /// MirrorReference |
| 311 InstanceRef get referent; |
| 312 } |
| OLD | NEW |