🐎 Correction de l'algo de désactivation d'espace de nom

La vérification de l'applicabilité du parent faisait un aller/retour
inutile entre la règle enfant et la règle parent, à l'origine d'une
régression de performance.
pull/1290/head
Maxime Quandalle 2020-12-05 23:21:51 +01:00
parent f949a1292f
commit b9b8a0c9bf
1 changed files with 3 additions and 8 deletions

View File

@ -114,18 +114,13 @@ registerEvaluationFunction('rule', function evaluate(node) {
return this.cache[node.dottedName]
}
const explanation = { ...node.explanation }
this.cache._meta.contextRule.push(node.dottedName)
this.cache._meta.parentEvaluationStack ??= []
const verifyParentApplicability = !this.cache._meta.contextRule.includes(node.dottedName)
this.cache._meta.contextRule.push(node.dottedName)
let parent: EvaluatedNode | null = null
if (
explanation.parent &&
!this.cache._meta.parentEvaluationStack.includes(node.dottedName)
) {
this.cache._meta.parentEvaluationStack.push(node.dottedName)
if (explanation.parent && verifyParentApplicability) {
parent = this.evaluateNode(explanation.parent) as EvaluatedNode
explanation.parent = parent
this.cache._meta.parentEvaluationStack.pop()
}
let valeur: EvaluatedNode | null = null
if (!parent || parent.nodeValue !== false) {