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

Unified Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 1013543002: Quick Fix for creating a missing part file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/correction/fix_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index a887ed69f0db5253e3c0d24a592a15292fc359bd..9cf28754a4cddc05e9eb74592d67d0561a07fb89 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -134,6 +134,7 @@ class FixProcessor {
}
if (errorCode == CompileTimeErrorCode.URI_DOES_NOT_EXIST) {
_addFix_createImportUri();
+ _addFix_createPartUri();
_addFix_replaceImportUri();
}
if (errorCode == HintCode.DIVISION_OPTIMIZATION) {
@@ -1008,6 +1009,21 @@ class FixProcessor {
_addFix(FixKind.CREATE_NO_SUCH_METHOD, []);
}
+ void _addFix_createPartUri() {
+ if (node is SimpleStringLiteral && node.parent is PartDirective) {
+ PartDirective partDirective = node.parent;
+ Source source = partDirective.source;
+ if (source != null) {
+ String file = source.fullName;
+ String libName = unitLibraryElement.name;
+ SourceEdit edit = new SourceEdit(0, 0, 'part of $libName;$eol$eol');
+ change.addEdit(file, -1, edit);
+ doSourceChange_addSourceEdit(change, context, source, edit);
+ _addFix(FixKind.CREATE_FILE, [file]);
+ }
+ }
+ }
+
void _addFix_illegalAsyncReturnType() {
InterfaceType futureType = context.typeProvider.futureType;
String futureTypeCode = utils.getTypeSource(futureType, librariesToImport);
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698