From 4fb31de3b074da2aaba82ca1cf32d6138e33fc5f Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Mon, 9 Jun 2008 10:23:57 +0200
Subject: [PATCH] Fix  a bug  in Lazycompiler:  I was  reordering  variable
 declarations ordering in order to handle  clocks properly, but I forget to
 reorder them back for the interface variables!

---
 src/lazyCompiler.ml   | 13 ++++++++++---
 src/test/test.res.exp | 40 ++++++++++++++++++++--------------------
 2 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml
index dda561aa..48f83c5b 100644
--- a/src/lazyCompiler.ml
+++ b/src/lazyCompiler.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 09/06/2008 (at 10:16) by Erwan Jahier> *)
+(** Time-stamp: <modified the 09/06/2008 (at 10:20) by Erwan Jahier> *)
 
 
 open Lxm
@@ -627,10 +627,17 @@ and (node_check_do: t -> CompiledData.node_key -> Lxm.t -> SymbolTab.t ->
 		    let vars_loc_sorted = sort_vars loclist in
 		      Some (List.map type_args vars_loc_sorted)
 	    in
+	    let unsort l_id l_vi =
+	      let tab = List.map (fun vi -> vi.var_name_eff, vi) l_vi in
+		try List.map (fun id -> List.assoc id tab) l_id
+		with Not_found -> assert false
+	    in
+	    let inlist2 = unsort vars.inlist inlist
+	    and outlist2 = unsort vars.outlist outlist in
 	      {
 		node_key_eff = nk;
-		inlist_eff   = inlist;
-		outlist_eff  = outlist;
+		inlist_eff   = inlist2;
+		outlist_eff  = outlist2;
 		loclist_eff  = loclist;
 		def_eff = node_def_eff ();
 		has_mem_eff  = node_def.it.has_mem;
diff --git a/src/test/test.res.exp b/src/test/test.res.exp
index 8f138366..d09a795f 100644
--- a/src/test/test.res.exp
+++ b/src/test/test.res.exp
@@ -1627,7 +1627,7 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
 	Exported nodes:
-node ck4__ck4(b:bool; a:int when b) returns (c:int);
+node ck4__ck4(a:int when b; b:bool) returns (c:int);
 let
    c = current (a);
 tel
@@ -1774,21 +1774,21 @@ End of Syntax table dump. 
 	Exported constants:
 	Exported nodes:
 extern node clock__outOnIn(b:bool; a:bool) returns (c:bool when b);
-extern node clock__inOnIn(a:bool; b:bool when a) returns (c:bool);
+extern node clock__inOnIn(b:bool when a; a:bool) returns (c:bool);
 
 extern node clock__outOnOut(
 	b:bool;
 	a:bool) 
 returns (
-	c:bool;
-	d:bool when c);
+	d:bool when c;
+	c:bool);
 
 extern node clock__all(
-	a:bool;
-	b:bool when a) 
+	b:bool when a;
+	a:bool) 
 returns (
-	c:bool when b when a;
-	d:bool when c when b when a);
+	d:bool when c when b when a;
+	c:bool when b when a);
 node clock__clock(in:bool) returns (ok:bool);
 var
    v1:bool;
@@ -7155,15 +7155,15 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
 	Exported nodes:
-extern node clock__clock2(u:bool; v:bool when u) returns (y:bool);
-extern node clock__clock3(u:bool) returns (x:bool; y:bool when x);
+extern node clock__clock2(v:bool when u; u:bool) returns (y:bool);
+extern node clock__clock3(u:bool) returns (y:bool when x; x:bool);
 
 extern node clock__clock4(
-	u:bool;
-	v:bool when u) 
+	v:bool when u;
+	u:bool) 
 returns (
-	x:bool;
-	y:bool when x);
+	y:bool when x;
+	x:bool);
 node clock__clock(a:bool; b:bool) returns (c:bool; d:bool when c);
 var
    z:bool;
@@ -14165,15 +14165,15 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
 	Exported nodes:
-extern node clock__clock2(u:bool; v:bool when u) returns (y:bool);
-extern node clock__clock3(u:bool) returns (x:bool; y:bool when x);
+extern node clock__clock2(v:bool when u; u:bool) returns (y:bool);
+extern node clock__clock3(u:bool) returns (y:bool when x; x:bool);
 
 extern node clock__clock4(
-	u:bool;
-	v:bool when u) 
+	v:bool when u;
+	u:bool) 
 returns (
-	x:bool;
-	y:bool when x);
+	y:bool when x;
+	x:bool);
 node clock__clock(a:bool; b:bool) returns (c:bool; d:bool when c);
 var
    z:bool;
-- 
GitLab