Skip to content

Commit 3d2492f

Browse files
committed
RequirementMachine: Rename RewriteStep::ApplyRewriteRule to RewriteStep::Rule
1 parent f06f59a commit 3d2492f

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

lib/AST/RequirementMachine/HomotopyReduction.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ RewriteLoop::findRulesAppearingOnceInEmptyContext(
8686

8787
for (auto step : Path) {
8888
switch (step.Kind) {
89-
case RewriteStep::ApplyRewriteRule: {
89+
case RewriteStep::Rule: {
9090
if (!step.isInContext() && !evaluator.isInContext())
9191
rulesInEmptyContext.insert(step.getRuleID());
9292

@@ -207,7 +207,7 @@ RewritePath RewritePath::splitCycleAtRule(unsigned ruleID) const {
207207

208208
for (auto step : Steps) {
209209
switch (step.Kind) {
210-
case RewriteStep::ApplyRewriteRule: {
210+
case RewriteStep::Rule: {
211211
if (step.getRuleID() != ruleID)
212212
break;
213213

@@ -263,7 +263,7 @@ bool RewritePath::replaceRuleWithPath(unsigned ruleID,
263263
bool foundAny = false;
264264

265265
for (const auto &step : Steps) {
266-
if (step.Kind == RewriteStep::ApplyRewriteRule &&
266+
if (step.Kind == RewriteStep::Rule &&
267267
step.getRuleID() == ruleID) {
268268
foundAny = true;
269269
break;
@@ -283,7 +283,7 @@ bool RewritePath::replaceRuleWithPath(unsigned ruleID,
283283

284284
for (const auto &step : Steps) {
285285
switch (step.Kind) {
286-
case RewriteStep::ApplyRewriteRule: {
286+
case RewriteStep::Rule: {
287287
if (step.getRuleID() != ruleID) {
288288
newSteps.push_back(step);
289289
break;

lib/AST/RequirementMachine/MinimalConformances.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void RewriteLoop::findProtocolConformanceRules(
112112
for (const auto &step : Path) {
113113
if (!evaluator.isInContext()) {
114114
switch (step.Kind) {
115-
case RewriteStep::ApplyRewriteRule: {
115+
case RewriteStep::Rule: {
116116
const auto &rule = system.getRule(step.getRuleID());
117117

118118
if (rule.isIdentityConformanceRule())
@@ -268,7 +268,7 @@ MinimalConformances::decomposeTermIntoConformanceRuleLeftHandSides(
268268
assert(!rule.isIdentityConformanceRule());
269269
#endif
270270

271-
assert(step.Kind == RewriteStep::ApplyRewriteRule);
271+
assert(step.Kind == RewriteStep::Rule);
272272
assert(step.EndOffset == 0);
273273
assert(!step.Inverse);
274274

lib/AST/RequirementMachine/RewriteLoop.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void RewriteStep::dump(llvm::raw_ostream &out,
2424
RewritePathEvaluator &evaluator,
2525
const RewriteSystem &system) const {
2626
switch (Kind) {
27-
case ApplyRewriteRule: {
27+
case Rule: {
2828
auto result = evaluator.applyRewriteRule(*this, system);
2929

3030
if (!result.prefix.empty()) {
@@ -190,7 +190,7 @@ RewritePathEvaluator::applyRewriteRule(const RewriteStep &step,
190190
const RewriteSystem &system) {
191191
auto &term = getCurrentTerm();
192192

193-
assert(step.Kind == RewriteStep::ApplyRewriteRule);
193+
assert(step.Kind == RewriteStep::Rule);
194194

195195
const auto &rule = system.getRule(step.getRuleID());
196196

@@ -662,7 +662,7 @@ RewritePathEvaluator::applyAbstractTypeWitness(const RewriteStep &step,
662662
void RewritePathEvaluator::apply(const RewriteStep &step,
663663
const RewriteSystem &system) {
664664
switch (step.Kind) {
665-
case RewriteStep::ApplyRewriteRule:
665+
case RewriteStep::Rule:
666666
(void) applyRewriteRule(step, system);
667667
break;
668668

lib/AST/RequirementMachine/RewriteLoop.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct RewriteStep {
5252
/// The StartOffset field encodes the offset where to apply the rule.
5353
///
5454
/// The Arg field encodes the rule to apply.
55-
ApplyRewriteRule,
55+
Rule,
5656

5757
/// The term at the top of the primary stack must be a term ending with a
5858
/// superclass or concrete type symbol.
@@ -167,7 +167,7 @@ struct RewriteStep {
167167
/// after the rule is applied. In A.(X => Y).B, this is |B|=1.
168168
unsigned EndOffset : 16;
169169

170-
/// If Kind is ApplyRewriteRule, the index of the rule in the rewrite system.
170+
/// If Kind is Rule, the index of the rule in the rewrite system.
171171
///
172172
/// If Kind is AdjustConcreteType, the length of the prefix to add or remove
173173
/// at the beginning of each concrete substitution.
@@ -190,7 +190,7 @@ struct RewriteStep {
190190

191191
static RewriteStep forRewriteRule(unsigned startOffset, unsigned endOffset,
192192
unsigned ruleID, bool inverse) {
193-
return RewriteStep(ApplyRewriteRule, startOffset, endOffset, ruleID, inverse);
193+
return RewriteStep(Rule, startOffset, endOffset, ruleID, inverse);
194194
}
195195

196196
static RewriteStep forAdjustment(unsigned offset, unsigned endOffset,
@@ -249,7 +249,7 @@ struct RewriteStep {
249249
}
250250

251251
unsigned getRuleID() const {
252-
assert(Kind == RewriteStep::ApplyRewriteRule);
252+
assert(Kind == RewriteStep::Rule);
253253
return Arg;
254254
}
255255

@@ -375,15 +375,16 @@ struct AppliedRewriteStep {
375375

376376
/// A rewrite path is a list of instructions for a two-stack interpreter.
377377
///
378-
/// - ApplyRewriteRule and AdjustConcreteType manipulate the term at the top of
379-
/// the primary stack.
380-
///
381378
/// - Shift moves a term from A to B (if not inverted) or B to A (if inverted).
382379
///
383380
/// - Decompose splits off the substitutions from a superclass or concrete type
384381
/// symbol at the top of the primary stack (if not inverted) or assembles a
385382
/// new superclass or concrete type symbol at the top of the primary stack
386383
/// (if inverted).
384+
///
385+
/// - All other rewrite step kinds manipulate the term at the top of the primary
386+
/// stack.
387+
///
387388
struct RewritePathEvaluator {
388389
/// The primary stack. Most rewrite steps operate on the top of this stack.
389390
SmallVector<MutableTerm, 2> Primary;

0 commit comments

Comments
 (0)