OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/constant/value.dart'; | 10 import 'package:analyzer/dart/constant/value.dart'; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ClassElement resynthesized, ClassElement original, String desc) { | 215 ClassElement resynthesized, ClassElement original, String desc) { |
216 ClassElementImpl r = ClassElementImpl.getImpl(resynthesized); | 216 ClassElementImpl r = ClassElementImpl.getImpl(resynthesized); |
217 ClassElementImpl o = ClassElementImpl.getImpl(original); | 217 ClassElementImpl o = ClassElementImpl.getImpl(original); |
218 compareElements(r, o, desc); | 218 compareElements(r, o, desc); |
219 expect(r.fields.length, o.fields.length, reason: '$desc fields.length'); | 219 expect(r.fields.length, o.fields.length, reason: '$desc fields.length'); |
220 for (int i = 0; i < r.fields.length; i++) { | 220 for (int i = 0; i < r.fields.length; i++) { |
221 String name = o.fields[i].name; | 221 String name = o.fields[i].name; |
222 compareFieldElements(r.fields[i], o.fields[i], '$desc.field $name'); | 222 compareFieldElements(r.fields[i], o.fields[i], '$desc.field $name'); |
223 } | 223 } |
224 compareTypes(r.supertype, o.supertype, '$desc supertype'); | 224 compareTypes(r.supertype, o.supertype, '$desc supertype'); |
225 expect(r.interfaces.length, o.interfaces.length); | 225 expect(r.interfaces.length, o.interfaces.length, |
| 226 reason: '$desc interfaces.length'); |
226 for (int i = 0; i < r.interfaces.length; i++) { | 227 for (int i = 0; i < r.interfaces.length; i++) { |
227 compareTypes(r.interfaces[i], o.interfaces[i], | 228 compareTypes(r.interfaces[i], o.interfaces[i], |
228 '$desc interface ${o.interfaces[i].name}'); | 229 '$desc interface ${o.interfaces[i].name}'); |
229 } | 230 } |
230 expect(r.mixins.length, o.mixins.length); | 231 expect(r.mixins.length, o.mixins.length, reason: '$desc mixins.length'); |
231 for (int i = 0; i < r.mixins.length; i++) { | 232 for (int i = 0; i < r.mixins.length; i++) { |
232 compareTypes(r.mixins[i], o.mixins[i], '$desc mixin ${o.mixins[i].name}'); | 233 compareTypes(r.mixins[i], o.mixins[i], '$desc mixin ${o.mixins[i].name}'); |
233 } | 234 } |
234 expect(r.typeParameters.length, o.typeParameters.length); | 235 expect(r.typeParameters.length, o.typeParameters.length, |
| 236 reason: '$desc typeParameters.length'); |
235 for (int i = 0; i < r.typeParameters.length; i++) { | 237 for (int i = 0; i < r.typeParameters.length; i++) { |
236 compareTypeParameterElements(r.typeParameters[i], o.typeParameters[i], | 238 compareTypeParameterElements(r.typeParameters[i], o.typeParameters[i], |
237 '$desc type parameter ${o.typeParameters[i].name}'); | 239 '$desc type parameter ${o.typeParameters[i].name}'); |
238 } | 240 } |
239 expect(r.constructors.length, o.constructors.length, | 241 expect(r.constructors.length, o.constructors.length, |
240 reason: '$desc constructors.length'); | 242 reason: '$desc constructors.length'); |
241 for (int i = 0; i < r.constructors.length; i++) { | 243 for (int i = 0; i < r.constructors.length; i++) { |
242 compareConstructorElements(r.constructors[i], o.constructors[i], | 244 compareConstructorElements(r.constructors[i], o.constructors[i], |
243 '$desc constructor ${o.constructors[i].name}'); | 245 '$desc constructor ${o.constructors[i].name}'); |
244 } | 246 } |
245 expect(r.accessors.length, o.accessors.length); | 247 expect(r.accessors.length, o.accessors.length, |
| 248 reason: '$desc accessors.length'); |
246 for (int i = 0; i < r.accessors.length; i++) { | 249 for (int i = 0; i < r.accessors.length; i++) { |
247 comparePropertyAccessorElements(r.accessors[i], o.accessors[i], | 250 comparePropertyAccessorElements(r.accessors[i], o.accessors[i], |
248 '$desc accessor ${o.accessors[i].name}'); | 251 '$desc accessor ${o.accessors[i].name}'); |
249 } | 252 } |
250 expect(r.methods.length, o.methods.length); | 253 expect(r.methods.length, o.methods.length, reason: '$desc methods.length'); |
251 for (int i = 0; i < r.methods.length; i++) { | 254 for (int i = 0; i < r.methods.length; i++) { |
252 compareMethodElements( | 255 compareMethodElements( |
253 r.methods[i], o.methods[i], '$desc.${o.methods[i].name}'); | 256 r.methods[i], o.methods[i], '$desc.${o.methods[i].name}'); |
254 } | 257 } |
255 compareTypes(r.type, o.type, desc); | 258 compareTypes(r.type, o.type, desc); |
256 expect(r.hasBeenInferred, o.hasBeenInferred, reason: desc); | 259 expect(r.hasBeenInferred, o.hasBeenInferred, reason: desc); |
257 } | 260 } |
258 | 261 |
259 void compareCompilationUnitElements(CompilationUnitElementImpl resynthesized, | 262 void compareCompilationUnitElements(CompilationUnitElementImpl resynthesized, |
260 CompilationUnitElementImpl original) { | 263 CompilationUnitElementImpl original) { |
(...skipping 4351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4612 fail('Unexpectedly tried to get unlinked summary for $uri'); | 4615 fail('Unexpectedly tried to get unlinked summary for $uri'); |
4613 } | 4616 } |
4614 return serializedUnit; | 4617 return serializedUnit; |
4615 } | 4618 } |
4616 | 4619 |
4617 @override | 4620 @override |
4618 bool hasLibrarySummary(String uri) { | 4621 bool hasLibrarySummary(String uri) { |
4619 return true; | 4622 return true; |
4620 } | 4623 } |
4621 } | 4624 } |
OLD | NEW |