@@ -260,21 +260,6 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker {
260
260
SF->getASTContext ().SourceMgr , Range).str () == " nil" ;
261
261
}
262
262
263
- bool isDotMember (CharSourceRange Range) {
264
- auto S = Range.str ();
265
- return S.startswith (" ." ) && S.substr (1 ).find (" ." ) == StringRef::npos;
266
- }
267
-
268
- bool isDotMember (SourceRange Range) {
269
- return isDotMember (Lexer::getCharSourceRangeFromSourceRange (
270
- SF->getASTContext ().SourceMgr , Range));
271
- }
272
-
273
- bool isDotMember (Expr *E) {
274
- auto Range = E->getSourceRange ();
275
- return Range.isValid () && isDotMember (Range);
276
- }
277
-
278
263
std::vector<APIDiffItem*> getRelatedDiffItems (ValueDecl *VD) {
279
264
std::vector<APIDiffItem*> results;
280
265
auto addDiffItems = [&](ValueDecl *VD) {
@@ -323,11 +308,11 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker {
323
308
}
324
309
325
310
326
- bool isSimpleReplacement (APIDiffItem *Item, bool isDotMember, std::string &Text) {
311
+ bool isSimpleReplacement (APIDiffItem *Item, std::string &Text) {
327
312
if (auto *MD = dyn_cast<TypeMemberDiffItem>(Item)) {
328
313
if (MD->Subkind == TypeMemberDiffItemSubKind::SimpleReplacement) {
329
- Text = (llvm::Twine (isDotMember ? " " : MD->newTypeName ) + " ." +
330
- MD-> getNewName (). base ()). str ();
314
+ Text = (llvm::Twine (MD->newTypeName ) + " ." + MD-> getNewName (). base ()).
315
+ str ();
331
316
return true ;
332
317
}
333
318
}
@@ -390,7 +375,7 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker {
390
375
Type T, ReferenceMetaData Data) override {
391
376
for (auto *Item: getRelatedDiffItems (CtorTyRef ? CtorTyRef: D)) {
392
377
std::string RepText;
393
- if (isSimpleReplacement (Item, isDotMember (Range), RepText)) {
378
+ if (isSimpleReplacement (Item, RepText)) {
394
379
Editor.replace (Range, RepText);
395
380
return true ;
396
381
}
@@ -465,9 +450,8 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker {
465
450
for (auto *I: getRelatedDiffItems (VD)) {
466
451
if (auto *Item = dyn_cast<TypeMemberDiffItem>(I)) {
467
452
if (Item->Subkind == TypeMemberDiffItemSubKind::QualifiedReplacement) {
468
- Editor.replace (ToReplace,
469
- (llvm::Twine (isDotMember (ToReplace) ? " " : Item->newTypeName ) + " ." +
470
- Item->getNewName ().base ()).str ());
453
+ Editor.replace (ToReplace, (llvm::Twine (Item->newTypeName ) + " ." +
454
+ Item->getNewName ().base ()).str ());
471
455
return true ;
472
456
}
473
457
}
@@ -741,7 +725,7 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker {
741
725
StringRef LeftComment;
742
726
StringRef RightComment;
743
727
for (auto *Item: getRelatedDiffItems (RD)) {
744
- if (isSimpleReplacement (Item, isDotMember (Reference), Rename)) {
728
+ if (isSimpleReplacement (Item, Rename)) {
745
729
} else if (auto *CI = dyn_cast<CommonDiffItem>(Item)) {
746
730
if (CI->isStringRepresentableChange () &&
747
731
CI->NodeKind == SDKNodeKind::DeclVar) {
0 commit comments