From 2c765a80bacb4dbec9bdc65d3dfbf12b9d913f7a Mon Sep 17 00:00:00 2001 From: Alexandre Hajjar Date: Fri, 24 Apr 2020 22:00:42 +0200 Subject: [PATCH] =?UTF-8?q?WIP=20=E2=9A=99=EF=B8=8F=20Detect=20cycles:=20f?= =?UTF-8?q?ix=20InversionNumMech=20following=20master?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publicodes/source/cyclesLib.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/publicodes/source/cyclesLib.ts b/publicodes/source/cyclesLib.ts index 2494eaab7..f19e059e5 100644 --- a/publicodes/source/cyclesLib.ts +++ b/publicodes/source/cyclesLib.ts @@ -380,9 +380,8 @@ export function isBaremeMech(node: ASTNode): node is BaremeMech { type InversionNumMech = AbstractMechanism & { name: 'inversion numérique' - avec: Array // Actually: short dotted name explanation: { - avec: Array> + inversionCandidates: Array> } } export function isInversionNumMech( @@ -395,16 +394,15 @@ export function isInversionNumMech( return ( isAbstractMechanism(inversionNumMech) && inversionNumMech.name === 'inversion numérique' && - inversionNumMech.avec instanceof Array && typeof inversionNumMech.explanation === 'object' && - inversionNumMech.explanation.avec instanceof Array && - R.all(isReferenceSpec, inversionNumMech.explanation.avec) + inversionNumMech.explanation.inversionCandidates instanceof Array && + R.all(isReferenceSpec, inversionNumMech.explanation.inversionCandidates) ) } type ArrondiMech = AbstractMechanism & { name: 'arrondi' - explanation: ArrondiExplanation + explanation: Record } export function isArrondiMech(node: ASTNode): node is ArrondiMech { const arrondiMech = node as ArrondiMech @@ -631,7 +629,6 @@ export function ruleDependenciesOfNode( applicableSi: ApplicableSi ): Array { logVisit(depth, 'applicable si', '') - debugger return ruleDependenciesOfNode(depth + 1, applicableSi.explanation) } @@ -848,7 +845,7 @@ export function ruleDependenciesOfNode( depth: number, inversionNumMech: InversionNumMech ): Array { - logVisit(depth, 'inversion numérique', inversionNumMech.avec) + logVisit(depth, 'inversion numérique', '') return [] } @@ -857,7 +854,6 @@ export function ruleDependenciesOfNode( arrondiMech: ArrondiMech ): Array { logVisit(depth, 'arrondi mech', '??') - const result = R.chain( R.partial>(ruleDependenciesOfNode, [ depth + 1 @@ -1071,7 +1067,6 @@ export function ruleDependenciesOfNode( `Visited a non-parsed recalcul node, to investigate: règle ${node.règle}` ) } else { - debugger throw new Error( `This node doesn't have a visitor method defined: ${JSON.stringify( node,