@@ -25,17 +25,6 @@ namespace refactoring {
25
25
using namespace swift ;
26
26
using namespace swift ::ide;
27
27
28
- namespace {
29
-
30
- // / Get the source file that corresponds to the given buffer.
31
- SourceFile *getContainingFile (ModuleDecl *M, RangeConfig Range) {
32
- auto &SM = M->getASTContext ().SourceMgr ;
33
- // TODO: We should add an ID -> SourceFile mapping.
34
- return M->getSourceFileContainingLocation (
35
- SM.getRangeForBuffer (Range.BufferID ).getStart ());
36
- }
37
- } // namespace
38
-
39
28
class RefactoringAction {
40
29
protected:
41
30
ModuleDecl *MD;
@@ -50,14 +39,7 @@ class RefactoringAction {
50
39
public:
51
40
RefactoringAction (ModuleDecl *MD, RefactoringOptions &Opts,
52
41
SourceEditConsumer &EditConsumer,
53
- DiagnosticConsumer &DiagConsumer)
54
- : MD(MD), TheFile(getContainingFile(MD, Opts.Range)),
55
- EditConsumer (EditConsumer), Ctx(MD->getASTContext ()),
56
- SM(MD->getASTContext ().SourceMgr), DiagEngine(SM),
57
- StartLoc(Lexer::getLocForStartOfToken(SM, Opts.Range.getStart(SM))),
58
- PreferredName(Opts.PreferredName) {
59
- DiagEngine.addConsumer (DiagConsumer);
60
- }
42
+ DiagnosticConsumer &DiagConsumer);
61
43
virtual ~RefactoringAction () = default ;
62
44
virtual bool performChange () = 0;
63
45
};
@@ -73,14 +55,7 @@ class TokenBasedRefactoringAction : public RefactoringAction {
73
55
public:
74
56
TokenBasedRefactoringAction (ModuleDecl *MD, RefactoringOptions &Opts,
75
57
SourceEditConsumer &EditConsumer,
76
- DiagnosticConsumer &DiagConsumer)
77
- : RefactoringAction(MD, Opts, EditConsumer, DiagConsumer) {
78
- // Resolve the sema token and save it for later use.
79
- CursorInfo =
80
- evaluateOrDefault (TheFile->getASTContext ().evaluator ,
81
- CursorInfoRequest{CursorInfoOwner (TheFile, StartLoc)},
82
- new ResolvedCursorInfo ());
83
- }
58
+ DiagnosticConsumer &DiagConsumer);
84
59
};
85
60
86
61
#define CURSOR_REFACTORING (KIND, NAME, ID ) \
@@ -106,13 +81,7 @@ class RangeBasedRefactoringAction : public RefactoringAction {
106
81
public:
107
82
RangeBasedRefactoringAction (ModuleDecl *MD, RefactoringOptions &Opts,
108
83
SourceEditConsumer &EditConsumer,
109
- DiagnosticConsumer &DiagConsumer)
110
- : RefactoringAction(MD, Opts, EditConsumer, DiagConsumer),
111
- RangeInfo (evaluateOrDefault(
112
- MD->getASTContext ().evaluator,
113
- RangeInfoRequest(RangeInfoOwner(TheFile, Opts.Range.getStart(SM),
114
- Opts.Range.getEnd(SM))),
115
- ResolvedRangeInfo())) {}
84
+ DiagnosticConsumer &DiagConsumer);
116
85
};
117
86
118
87
#define RANGE_REFACTORING (KIND, NAME, ID ) \
0 commit comments