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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2549143007: Implement 'Import Library' Quick Fix for the new analysis driver. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement; 10 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement;
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 AnalysisResult _getAnalysisResultFromBytes( 738 AnalysisResult _getAnalysisResultFromBytes(
739 FileState libraryFile, FileState file, List<int> bytes, 739 FileState libraryFile, FileState file, List<int> bytes,
740 {String content, bool withErrors: true, CompilationUnit resolvedUnit}) { 740 {String content, bool withErrors: true, CompilationUnit resolvedUnit}) {
741 var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes); 741 var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes);
742 List<AnalysisError> errors = withErrors 742 List<AnalysisError> errors = withErrors
743 ? _getErrorsFromSerialized(file, unit.errors) 743 ? _getErrorsFromSerialized(file, unit.errors)
744 : const <AnalysisError>[]; 744 : const <AnalysisError>[];
745 return new AnalysisResult( 745 return new AnalysisResult(
746 libraryFile, 746 libraryFile,
747 file, 747 file,
748 this,
748 sourceFactory, 749 sourceFactory,
749 file.path, 750 file.path,
750 file.uri, 751 file.uri,
751 content, 752 content,
752 file.contentHash, 753 file.contentHash,
753 file.lineInfo, 754 file.lineInfo,
754 resolvedUnit, 755 resolvedUnit,
755 errors, 756 errors,
756 unit.index); 757 unit.index);
757 } 758 }
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 * guaranteed to be consistent with the state of the files. 1149 * guaranteed to be consistent with the state of the files.
1149 * 1150 *
1150 * Every result is independent, and is not guaranteed to be consistent with 1151 * Every result is independent, and is not guaranteed to be consistent with
1151 * any previously returned result, even inside of the same library. 1152 * any previously returned result, even inside of the same library.
1152 */ 1153 */
1153 class AnalysisResult { 1154 class AnalysisResult {
1154 final FileState _libraryFile; 1155 final FileState _libraryFile;
1155 final FileState _file; 1156 final FileState _file;
1156 1157
1157 /** 1158 /**
1159 * The [AnalysisDriver] that produced this result.
1160 */
1161 final AnalysisDriver driver;
1162
1163 /**
1158 * The [SourceFactory] with which the file was analyzed. 1164 * The [SourceFactory] with which the file was analyzed.
1159 */ 1165 */
1160 final SourceFactory sourceFactory; 1166 final SourceFactory sourceFactory;
1161 1167
1162 /** 1168 /**
1163 * The path of the analysed file, absolute and normalized. 1169 * The path of the analysed file, absolute and normalized.
1164 */ 1170 */
1165 final String path; 1171 final String path;
1166 1172
1167 /** 1173 /**
(...skipping 29 matching lines...) Expand all
1197 final List<AnalysisError> errors; 1203 final List<AnalysisError> errors;
1198 1204
1199 /** 1205 /**
1200 * The index of the unit. 1206 * The index of the unit.
1201 */ 1207 */
1202 final AnalysisDriverUnitIndex _index; 1208 final AnalysisDriverUnitIndex _index;
1203 1209
1204 AnalysisResult( 1210 AnalysisResult(
1205 this._libraryFile, 1211 this._libraryFile,
1206 this._file, 1212 this._file,
1213 this.driver,
1207 this.sourceFactory, 1214 this.sourceFactory,
1208 this.path, 1215 this.path,
1209 this.uri, 1216 this.uri,
1210 this.content, 1217 this.content,
1211 this.contentHash, 1218 this.contentHash,
1212 this.lineInfo, 1219 this.lineInfo,
1213 this.unit, 1220 this.unit,
1214 this.errors, 1221 this.errors,
1215 this._index); 1222 this._index);
1216 } 1223 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 libraryDeclarations.add(new TopLevelDeclarationInSource( 1485 libraryDeclarations.add(new TopLevelDeclarationInSource(
1479 file.source, declaration, isExported)); 1486 file.source, declaration, isExported));
1480 } 1487 }
1481 } 1488 }
1482 } 1489 }
1483 1490
1484 // We're not done yet. 1491 // We're not done yet.
1485 return false; 1492 return false;
1486 } 1493 }
1487 } 1494 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698