PrologRuleEvaluator: Remove unneeded check for closed changes
PrologRuleEvaluator#evaluate() is only used from PrologRule#evaluate(ChangeData, SubmitRuleOptions) which implements the SubmitRule interface. SubmitRules are only invoked from SubmitRuleEvaluator. SubmitRuleEvaluator checks the change state and whether closed changes are allowed before invoking the submit rules. If closed changes are not allowed and the change is closed SubmitRuleEvaluator returns a submit record with status SubmitRecord.Status.CLOSED and the submit rules are not invoked. This means PrologRuleEvaluator#evaluate() doesn't need to the same check again as it is never invoked if this is the case. If this check would be needed all other implementations of SubmitRule would need to do the same, but none of them does. This is part of an effort to eliminate the passing of SubmitRuleOptions into the submit rules. The SubmitRuleOptions contain mostly Prolog-specific settings and are only used by the PrologRule. All other implementation of SubmitRule ignore the options, hence it would be cleaner to remove them from the SubmitRule interface. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I453b575b6aaf22b335cd3d7fa89df662208abf3b
This commit is contained in:
@@ -159,12 +159,6 @@ public class PrologRuleEvaluator {
|
||||
return ruleError("Error looking up change " + cd.getId(), e);
|
||||
}
|
||||
|
||||
if (!opts.allowClosed() && change.isClosed()) {
|
||||
SubmitRecord rec = new SubmitRecord();
|
||||
rec.status = SubmitRecord.Status.CLOSED;
|
||||
return Collections.singletonList(rec);
|
||||
}
|
||||
|
||||
List<Term> results;
|
||||
try {
|
||||
results =
|
||||
|
||||
Reference in New Issue
Block a user