| 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 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
| 8 import 'package:analyzer/src/generated/engine.dart'; | 8 import 'package:analyzer/src/generated/engine.dart'; |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:analyzer/src/summary/base.dart'; | |
| 11 import 'package:analyzer/src/summary/format.dart'; | 10 import 'package:analyzer/src/summary/format.dart'; |
| 12 import 'package:analyzer/src/summary/resynthesize.dart'; | 11 import 'package:analyzer/src/summary/resynthesize.dart'; |
| 13 import 'package:analyzer/src/summary/summarize_elements.dart'; | 12 import 'package:analyzer/src/summary/summarize_elements.dart'; |
| 14 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
| 15 | 14 |
| 16 import '../../generated/resolver_test.dart'; | 15 import '../../generated/resolver_test.dart'; |
| 17 import '../../reflective_tests.dart'; | 16 import '../../reflective_tests.dart'; |
| 18 | 17 |
| 19 main() { | 18 main() { |
| 20 groupSep = ' | '; | 19 groupSep = ' | '; |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 } | 479 } |
| 481 String uri = source.uri.toString(); | 480 String uri = source.uri.toString(); |
| 482 addLibrary('dart:core'); | 481 addLibrary('dart:core'); |
| 483 return resynthesizeLibraryElement(uri, original); | 482 return resynthesizeLibraryElement(uri, original); |
| 484 } | 483 } |
| 485 | 484 |
| 486 LibraryElementImpl resynthesizeLibraryElement( | 485 LibraryElementImpl resynthesizeLibraryElement( |
| 487 String uri, LibraryElementImpl original) { | 486 String uri, LibraryElementImpl original) { |
| 488 Map<String, UnlinkedUnit> unlinkedSummaries = <String, UnlinkedUnit>{}; | 487 Map<String, UnlinkedUnit> unlinkedSummaries = <String, UnlinkedUnit>{}; |
| 489 PrelinkedLibrary getPrelinkedSummaryFor(LibraryElement lib) { | 488 PrelinkedLibrary getPrelinkedSummaryFor(LibraryElement lib) { |
| 490 BuilderContext ctx = new BuilderContext(); | |
| 491 LibrarySerializationResult serialized = | 489 LibrarySerializationResult serialized = |
| 492 serializeLibrary(ctx, lib, typeProvider); | 490 serializeLibrary(lib, typeProvider); |
| 493 for (int i = 0; i < serialized.unlinkedUnits.length; i++) { | 491 for (int i = 0; i < serialized.unlinkedUnits.length; i++) { |
| 494 unlinkedSummaries[serialized.unitUris[i]] = | 492 unlinkedSummaries[serialized.unitUris[i]] = |
| 495 new UnlinkedUnit.fromBuffer(serialized.unlinkedUnits[i].toBuffer()); | 493 new UnlinkedUnit.fromBuffer(serialized.unlinkedUnits[i].toBuffer()); |
| 496 } | 494 } |
| 497 return new PrelinkedLibrary.fromBuffer(serialized.prelinked.toBuffer()); | 495 return new PrelinkedLibrary.fromBuffer(serialized.prelinked.toBuffer()); |
| 498 } | 496 } |
| 499 Map<String, PrelinkedLibrary> prelinkedSummaries = | 497 Map<String, PrelinkedLibrary> prelinkedSummaries = |
| 500 <String, PrelinkedLibrary>{uri: getPrelinkedSummaryFor(original)}; | 498 <String, PrelinkedLibrary>{uri: getPrelinkedSummaryFor(original)}; |
| 501 for (Source source in otherLibrarySources) { | 499 for (Source source in otherLibrarySources) { |
| 502 LibraryElement original = resolve2(source); | 500 LibraryElement original = resolve2(source); |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 } | 1347 } |
| 1350 | 1348 |
| 1351 test_variable_implicit_type() { | 1349 test_variable_implicit_type() { |
| 1352 checkLibrary('var x;'); | 1350 checkLibrary('var x;'); |
| 1353 } | 1351 } |
| 1354 | 1352 |
| 1355 test_variables() { | 1353 test_variables() { |
| 1356 checkLibrary('int i; int j;'); | 1354 checkLibrary('int i; int j;'); |
| 1357 } | 1355 } |
| 1358 } | 1356 } |
| OLD | NEW |