[WEB-16445] When create a missing imported library/part, add the edit once.

R=brianwilkerson@google.com
BUG= https://youtrack.jetbrains.com/issue/WEB-16445

Review URL: https://codereview.chromium.org//1147543002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45813 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
scheglov@google.com 2015-05-15 16:22:01 +00:00
parent a9d194d049
commit 7344dcc35c
2 changed files with 2 additions and 2 deletions

View file

@ -922,7 +922,6 @@ class FixProcessor {
String libName = removeEnd(source.shortName, '.dart');
libName = libName.replaceAll('_', '.');
SourceEdit edit = new SourceEdit(0, 0, 'library $libName;$eol$eol');
change.addEdit(file, -1, edit);
doSourceChange_addSourceEdit(change, context, source, edit);
}
_addFix(DartFixKind.CREATE_FILE, [file]);
@ -1127,7 +1126,6 @@ class FixProcessor {
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(DartFixKind.CREATE_FILE, [file]);
}

View file

@ -1055,6 +1055,7 @@ import 'my_file.dart';
SourceFileEdit fileEdit = change.edits[0];
expect(fileEdit.file, '/my/project/bin/my_file.dart');
expect(fileEdit.fileStamp, -1);
expect(fileEdit.edits, hasLength(1));
expect(fileEdit.edits[0].replacement, contains('library my.file;'));
}
@ -1073,6 +1074,7 @@ part 'my_part.dart';
SourceFileEdit fileEdit = change.edits[0];
expect(fileEdit.file, '/my/project/bin/my_part.dart');
expect(fileEdit.fileStamp, -1);
expect(fileEdit.edits, hasLength(1));
expect(fileEdit.edits[0].replacement, contains('part of my.lib;'));
}