@@ -245,9 +245,11 @@ class _ModuleMigrationVisitor extends MigrationVisitor {
245
245
var hiddenByUrl = < Uri , Set <MemberDeclaration >> {};
246
246
for (var declaration in references.globalDeclarations) {
247
247
var private = declaration.name.startsWith ('-' );
248
+
248
249
// Whether this member will be exposed by the regular entrypoint.
249
- var visibleAtEntrypoint = declaration.sourceUrl == entrypoint ||
250
- (_shouldForward (declaration.name) && ! private);
250
+ var visibleAtEntrypoint = ! private &&
251
+ (declaration.sourceUrl == entrypoint ||
252
+ _shouldForward (declaration.name));
251
253
// Whether this member should be exposed by the import-only file for the
252
254
// entrypoint.
253
255
var shouldBeVisible =
@@ -1147,7 +1149,11 @@ class _ModuleMigrationVisitor extends MigrationVisitor {
1147
1149
if (declaration == null ) return ;
1148
1150
if (renamedMembers.containsKey (declaration)) {
1149
1151
var newName = renamedMembers[declaration];
1150
- if (declaration.name.endsWith (newName)) {
1152
+ if (newName.startsWith ('-' ) &&
1153
+ declaration.name.endsWith (newName.substring (1 ))) {
1154
+ addPatch (patchDelete (span,
1155
+ start: 1 , end: declaration.name.length - newName.length + 1 ));
1156
+ } else if (declaration.name.endsWith (newName)) {
1151
1157
addPatch (
1152
1158
patchDelete (span, end: declaration.name.length - newName.length));
1153
1159
} else {
@@ -1167,8 +1173,11 @@ class _ModuleMigrationVisitor extends MigrationVisitor {
1167
1173
///
1168
1174
/// Otherwise, returns [name] unaltered.
1169
1175
String _unprefix (String name) {
1170
- var prefix = _prefixFor (name);
1171
- return prefix == null ? name : name.substring (prefix.length);
1176
+ var isPrivate = name.startsWith ('-' );
1177
+ var unprivateName = isPrivate ? name.substring (1 ) : name;
1178
+ var prefix = _prefixFor (unprivateName);
1179
+ if (prefix == null ) return name;
1180
+ return (isPrivate ? '-' : '' ) + unprivateName.substring (prefix.length);
1172
1181
}
1173
1182
1174
1183
/// Returns the namespace that built-in module [module] is loaded under.
0 commit comments