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'; |
23 import 'package:unittest/unittest.dart'; | 24 import 'package:unittest/unittest.dart'; |
24 | 25 |
25 import '../../reflective_tests.dart'; | 26 import '../../reflective_tests.dart'; |
26 import '../context/abstract_context.dart'; | 27 import '../context/abstract_context.dart'; |
27 import '../task/strong/inferred_type_test.dart'; | 28 import '../task/strong/inferred_type_test.dart'; |
28 import 'resynthesize_test.dart'; | 29 import 'resynthesize_test.dart'; |
29 import 'summary_common.dart'; | 30 import 'summary_common.dart'; |
30 | 31 |
31 main() { | 32 main() { |
32 groupSep = ' | '; | 33 groupSep = ' | '; |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 String uriStr = source.uri.toString(); | 785 String uriStr = source.uri.toString(); |
785 { | 786 { |
786 UnlinkedUnit unlinkedUnitInSdk = | 787 UnlinkedUnit unlinkedUnitInSdk = |
787 SerializedMockSdk.instance.uriToUnlinkedUnit[uriStr]; | 788 SerializedMockSdk.instance.uriToUnlinkedUnit[uriStr]; |
788 if (unlinkedUnitInSdk != null) { | 789 if (unlinkedUnitInSdk != null) { |
789 return unlinkedUnitInSdk; | 790 return unlinkedUnitInSdk; |
790 } | 791 } |
791 } | 792 } |
792 return uriToUnit.putIfAbsent(uriStr, () { | 793 return uriToUnit.putIfAbsent(uriStr, () { |
793 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); | 794 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); |
794 UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit); | 795 LineInfo lineInfo = context.computeResult(source, LINE_INFO); |
| 796 UnlinkedUnitBuilder unlinkedUnit = |
| 797 serializeAstUnlinked(unit, lineInfo.lineStarts); |
795 bundleAssembler.addUnlinkedUnit(source, unlinkedUnit); | 798 bundleAssembler.addUnlinkedUnit(source, unlinkedUnit); |
796 return unlinkedUnit; | 799 return unlinkedUnit; |
797 }); | 800 }); |
798 } | 801 } |
799 | 802 |
800 void _serializeLibrary(Source librarySource) { | 803 void _serializeLibrary(Source librarySource) { |
801 if (librarySource.isInSystemLibrary) { | 804 if (librarySource.isInSystemLibrary) { |
802 return; | 805 return; |
803 } | 806 } |
804 if (!serializedSources.add(librarySource)) { | 807 if (!serializedSources.add(librarySource)) { |
(...skipping 19 matching lines...) Expand all Loading... |
824 } | 827 } |
825 | 828 |
826 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource); | 829 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource); |
827 LinkedLibraryBuilder linkedLibrary = | 830 LinkedLibraryBuilder linkedLibrary = |
828 prelink(definingUnit, getPart, getImport); | 831 prelink(definingUnit, getPart, getImport); |
829 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) { | 832 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) { |
830 _serializeLibrary(resolveRelativeUri(d.uri)); | 833 _serializeLibrary(resolveRelativeUri(d.uri)); |
831 }); | 834 }); |
832 } | 835 } |
833 } | 836 } |
OLD | NEW |