Chromium Code Reviews| 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 1c7e134d39a819dcd4f7981d18613f45e54b4989..a56658448294567d53efc910f6dd1963e3561665 100644 |
| --- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
| +++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
| @@ -143,6 +143,9 @@ class FixProcessor { |
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT) { |
| _addFix_createConstructorSuperImplicit(); |
| } |
| + if (errorCode == CompileTimeErrorCode.PART_OF_NON_PART) { |
| + _addFix_addPartOfDirective(); |
| + } |
| if (errorCode == |
| CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT) { |
| _addFix_createConstructorSuperExplicit(); |
| @@ -344,6 +347,25 @@ class FixProcessor { |
| return false; |
| } |
| + void _addFix_addPartOfDirective() { |
| + // TODO(scheglov) |
|
Brian Wilkerson
2015/05/18 22:22:58
Left over?
|
| + if (node is SimpleStringLiteral && node.parent is PartDirective) { |
| + PartDirective directive = node.parent; |
| + Source partSource = directive.source; |
| + CompilationUnit partUnit = |
| + context.getResolvedCompilationUnit2(partSource, unitSource); |
| + if (partUnit != null) { |
| + CorrectionUtils partUtils = new CorrectionUtils(partUnit); |
| + CorrectionUtils_InsertDesc desc = partUtils.getInsertDescTop(); |
| + String libraryName = unitLibraryElement.name; |
| + _addInsertEdit(desc.offset, |
| + '${desc.prefix}part of $libraryName;$eol${desc.suffix}', |
| + partUnit.element); |
| + _addFix(DartFixKind.ADD_PART_OF, []); |
| + } |
| + } |
| + } |
| + |
| void _addFix_boolInsteadOfBoolean() { |
| SourceRange range = rf.rangeError(error); |
| _addReplaceEdit(range, 'bool'); |