From 311acd5aaa2cf4d9ab1126d6754ebd63dea38b03 Mon Sep 17 00:00:00 2001
From: charguer <arthur@chargueraud.org>
Date: Wed, 25 Nov 2015 17:26:19 +0100
Subject: [PATCH] module

---
 generator/js_of_ast.ml     | 8 ++++----
 generator/tests/testctx.ml | 8 +++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/generator/js_of_ast.ml b/generator/js_of_ast.ml
index 656be29..9abf7d1 100644
--- a/generator/js_of_ast.ml
+++ b/generator/js_of_ast.ml
@@ -398,8 +398,9 @@ and js_of_structure_item s =
   match s.str_desc with
   | Tstr_eval (e, _)     -> Printf.sprintf "%s" @@ js_of_expression ctx_initial Dest_ignore e
   | Tstr_value (_, vb_l) -> String.concat "@,@," @@ List.map (fun vb -> 
-      let (id, sdecl) = show_value_binding ctx_initial vb in
-      sdecl) @@ vb_l
+     (* let (id, sdecl) = show_value_binding ctx_initial vb in *)
+     Printf.sprintf "@\n@\n%s: %s," (ident_of_pat vb.vb_pat) (js_of_expression_inline_or_wrap ctx_initial vb.vb_expr))
+     @@ vb_l
   | Tstr_type       _  -> "" (* Types have no representation in JS, but the OCaml type checker uses them *)
   | Tstr_open       _  -> "" (* Handle modules by use of multiple compilation/linking *)
   | Tstr_modtype    _  -> ""
@@ -461,8 +462,7 @@ and js_of_expression ctx dest e =
       in
     let arg_ids, body = explore [c.c_lhs] c.c_rhs in
     let newctx = ctx_fresh() in
-    let newdest = Dest_return in
-    let sbody = js_of_expression newctx newdest body in
+    let sbody = js_of_expression newctx Dest_return body in
     let sexp = generate_logged_enter arg_ids ctx newctx sbody in
     apply_dest ctx dest sexp
 
diff --git a/generator/tests/testctx.ml b/generator/tests/testctx.ml
index 48eef10..1808ae1 100644
--- a/generator/tests/testctx.ml
+++ b/generator/tests/testctx.ml
@@ -3,7 +3,7 @@ let testa x =
   x
 
 let testb x = 
-  let x = x in x
+  let a = x in a
 
 let testc x = 
   let y = x in 
@@ -33,7 +33,7 @@ let testg x =
 
 
 
-let test0 = 
+let test0 f = 
   match Some 3 with
   | None -> 2
   | Some y -> y
@@ -80,4 +80,6 @@ let test6 =
 (*
 let test6 (x,y) =
   x
-  *)
\ No newline at end of file
+  *)
+  
+  
\ No newline at end of file
-- 
GitLab