Ignore spurious differences in job patterns
This commit is contained in:
parent
bbbc1cc0a0
commit
b85ba4a9f0
|
@ -460,6 +460,19 @@ function isCompletelyConcrete(p) {
|
||||||
return walk(p);
|
return walk(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function withoutCaptures(p) {
|
||||||
|
function walk(p) {
|
||||||
|
if (Capture.isClassOf(p)) return walk(p.get(0));
|
||||||
|
if (Discard.isClassOf(p)) return p;
|
||||||
|
|
||||||
|
const cls = classOf(p);
|
||||||
|
if (cls === null) return p;
|
||||||
|
if (typeof cls === 'number') return p.map(walk);
|
||||||
|
return new Record(p.label, p.fields.map(walk));
|
||||||
|
}
|
||||||
|
return walk(p);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module.exports.EVENT_ADDED = EVENT_ADDED;
|
module.exports.EVENT_ADDED = EVENT_ADDED;
|
||||||
|
@ -471,3 +484,4 @@ module.exports.analyzeAssertion = analyzeAssertion;
|
||||||
module.exports.instantiateAssertion = instantiateAssertion;
|
module.exports.instantiateAssertion = instantiateAssertion;
|
||||||
module.exports.match = match;
|
module.exports.match = match;
|
||||||
module.exports.isCompletelyConcrete = isCompletelyConcrete;
|
module.exports.isCompletelyConcrete = isCompletelyConcrete;
|
||||||
|
module.exports.withoutCaptures = withoutCaptures;
|
||||||
|
|
|
@ -17,8 +17,9 @@ spawn named 'JobDispatcher' {
|
||||||
|
|
||||||
during Observe(Observe(WorkItem($worker, $pattern, _))) {
|
during Observe(Observe(WorkItem($worker, $pattern, _))) {
|
||||||
if (!Skeleton.isCompletelyConcrete(pattern)) {
|
if (!Skeleton.isCompletelyConcrete(pattern)) {
|
||||||
on start addWorker(pattern, worker);
|
const p = Skeleton.withoutCaptures(pattern);
|
||||||
on stop removeWorker(pattern, worker);
|
on start addWorker(p, worker);
|
||||||
|
on stop removeWorker(p, worker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue