Simplifie le calcul des variables manquantes (2)

pull/197/head
Laurent Bossavit 2018-04-10 13:23:06 +02:00
parent d24a6b3908
commit 893448c487
1 changed files with 14 additions and 6 deletions

View File

@ -518,15 +518,19 @@ export let treatRuleRoot = (rules, rule) => {
'applicable si': evolveCond('applicable si', rule, rules),
formule: value => {
let evaluate = (cache, situationGate, parsedRules, node) => {
let collectMissing = node => collectNodeMissing(node.explanation)
let explanation = evaluateNode(
cache,
situationGate,
parsedRules,
node.explanation
),
nodeValue = explanation.nodeValue
return rewriteNode(node, nodeValue, explanation, collectMissing)
nodeValue = explanation.nodeValue,
missingVariables = collectNodeMissing(explanation)
return {
...rewriteNode(node, nodeValue, explanation),
missingVariables
}
}
let child = treat(rules, rule)(value)
@ -556,15 +560,19 @@ export let treatRuleRoot = (rules, rule) => {
let evolveCond = (name, rule, rules) => value => {
let evaluate = (cache, situationGate, parsedRules, node) => {
let collectMissing = node => collectNodeMissing(node.explanation)
let explanation = evaluateNode(
cache,
situationGate,
parsedRules,
node.explanation
),
nodeValue = explanation.nodeValue
return rewriteNode(node, nodeValue, explanation, collectMissing)
nodeValue = explanation.nodeValue,
missingVariables = collectNodeMissing(explanation)
return {
...rewriteNode(node, nodeValue, explanation),
missingVariables
}
}
let child = treat(rules, rule)(value)