Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_ast_test.dart

Issue 2225893003: Provide LINE_INFO from ResynthesizerResultProvider. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/package_bundle_reader_test.dart ('k') | pkg/analyzer/test/src/summary/summarize_ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698