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 library analyzer.test.src.summary.resynthesize_ast_test; | 5 library analyzer.test.src.summary.resynthesize_ast_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
9 import 'package:analyzer/src/dart/element/element.dart'; | 9 import 'package:analyzer/src/dart/element/element.dart'; |
10 import 'package:analyzer/src/generated/engine.dart' | 10 import 'package:analyzer/src/generated/engine.dart' |
11 show AnalysisContext, AnalysisOptionsImpl; | 11 show AnalysisContext, AnalysisOptionsImpl; |
12 import 'package:analyzer/src/generated/sdk.dart'; | 12 import 'package:analyzer/src/generated/sdk.dart'; |
13 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
14 import 'package:analyzer/src/summary/format.dart'; | 14 import 'package:analyzer/src/summary/format.dart'; |
15 import 'package:analyzer/src/summary/idl.dart'; | 15 import 'package:analyzer/src/summary/idl.dart'; |
16 import 'package:analyzer/src/summary/link.dart'; | 16 import 'package:analyzer/src/summary/link.dart'; |
17 import 'package:analyzer/src/summary/prelink.dart'; | 17 import 'package:analyzer/src/summary/prelink.dart'; |
18 import 'package:analyzer/src/summary/resynthesize.dart'; | 18 import 'package:analyzer/src/summary/resynthesize.dart'; |
19 import 'package:analyzer/src/summary/summarize_ast.dart'; | 19 import 'package:analyzer/src/summary/summarize_ast.dart'; |
20 import 'package:analyzer/src/summary/summarize_elements.dart' | 20 import 'package:analyzer/src/summary/summarize_elements.dart' |
21 show PackageBundleAssembler; | 21 show PackageBundleAssembler; |
22 import 'package:analyzer/task/dart.dart' show PARSED_UNIT; | 22 import 'package:analyzer/task/dart.dart' show PARSED_UNIT; |
23 import 'package:analyzer/task/general.dart'; | |
24 import 'package:unittest/unittest.dart'; | 23 import 'package:unittest/unittest.dart'; |
25 | 24 |
26 import '../../reflective_tests.dart'; | 25 import '../../reflective_tests.dart'; |
27 import '../context/abstract_context.dart'; | 26 import '../context/abstract_context.dart'; |
28 import '../task/strong/inferred_type_test.dart'; | 27 import '../task/strong/inferred_type_test.dart'; |
29 import 'resynthesize_test.dart'; | 28 import 'resynthesize_test.dart'; |
30 import 'summary_common.dart'; | 29 import 'summary_common.dart'; |
31 | 30 |
32 main() { | 31 main() { |
33 groupSep = ' | '; | 32 groupSep = ' | '; |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 String uriStr = source.uri.toString(); | 784 String uriStr = source.uri.toString(); |
786 { | 785 { |
787 UnlinkedUnit unlinkedUnitInSdk = | 786 UnlinkedUnit unlinkedUnitInSdk = |
788 SerializedMockSdk.instance.uriToUnlinkedUnit[uriStr]; | 787 SerializedMockSdk.instance.uriToUnlinkedUnit[uriStr]; |
789 if (unlinkedUnitInSdk != null) { | 788 if (unlinkedUnitInSdk != null) { |
790 return unlinkedUnitInSdk; | 789 return unlinkedUnitInSdk; |
791 } | 790 } |
792 } | 791 } |
793 return uriToUnit.putIfAbsent(uriStr, () { | 792 return uriToUnit.putIfAbsent(uriStr, () { |
794 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); | 793 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); |
795 LineInfo lineInfo = context.computeResult(source, LINE_INFO); | 794 UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit); |
796 UnlinkedUnitBuilder unlinkedUnit = | |
797 serializeAstUnlinked(unit, lineInfo.lineStarts); | |
798 bundleAssembler.addUnlinkedUnit(source, unlinkedUnit); | 795 bundleAssembler.addUnlinkedUnit(source, unlinkedUnit); |
799 return unlinkedUnit; | 796 return unlinkedUnit; |
800 }); | 797 }); |
801 } | 798 } |
802 | 799 |
803 void _serializeLibrary(Source librarySource) { | 800 void _serializeLibrary(Source librarySource) { |
804 if (librarySource.isInSystemLibrary) { | 801 if (librarySource.isInSystemLibrary) { |
805 return; | 802 return; |
806 } | 803 } |
807 if (!serializedSources.add(librarySource)) { | 804 if (!serializedSources.add(librarySource)) { |
(...skipping 19 matching lines...) Expand all Loading... |
827 } | 824 } |
828 | 825 |
829 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource); | 826 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource); |
830 LinkedLibraryBuilder linkedLibrary = | 827 LinkedLibraryBuilder linkedLibrary = |
831 prelink(definingUnit, getPart, getImport); | 828 prelink(definingUnit, getPart, getImport); |
832 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) { | 829 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) { |
833 _serializeLibrary(resolveRelativeUri(d.uri)); | 830 _serializeLibrary(resolveRelativeUri(d.uri)); |
834 }); | 831 }); |
835 } | 832 } |
836 } | 833 } |
OLD | NEW |