mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Change how replacements are filtered (#541)
This replaces the use of `isExpansionInMainFile` with instead taking the list of input files, and only touching them. This doesn't keep `isExpansionInMainFile` because it should be redundant, and as such it'd be easy to forget. Unless it starts being a performance issue, it's probably better to omit.
This commit is contained in:
@@ -13,13 +13,8 @@ namespace Carbon {
|
||||
FnInserter::FnInserter(std::map<std::string, Replacements>& in_replacements,
|
||||
cam::MatchFinder* finder)
|
||||
: Matcher(in_replacements) {
|
||||
// TODO: Switch from isExpansionInMainFile to isDefinition. That should then
|
||||
// include `for (const auto* redecl : func->redecls())` to generate
|
||||
// replacements.
|
||||
finder->addMatcher(
|
||||
cam::functionDecl(cam::isExpansionInMainFile(), cam::hasTrailingReturn())
|
||||
.bind(Label),
|
||||
this);
|
||||
finder->addMatcher(cam::functionDecl(cam::hasTrailingReturn()).bind(Label),
|
||||
this);
|
||||
}
|
||||
|
||||
void FnInserter::run(const cam::MatchFinder::MatchResult& result) {
|
||||
|
||||
Reference in New Issue
Block a user