Skip to content
This repository
Browse code

[fix] renaming: Now dbGen needs non-sdlib ident load OpaMapToIdent ob…

…jects and set renaming maps
  • Loading branch information...
commit e68ea8c77c3f14fd6d0ae91776c80f88b0782cd2 1 parent 6019e3a
Quentin Bourgerie authored November 25, 2011

Showing 1 changed file with 13 additions and 12 deletions. Show diff stats Hide diff stats

  1. 25  passes/surfaceAstRenaming.ml
25  passes/surfaceAstRenaming.ml
@@ -1233,7 +1233,7 @@ and f_bindings ~rec_ all_env hierar iel =
1233 1233
     List.fold_left_map
1234 1234
       (fun all_env (i,e) ->
1235 1235
         let all_env, _pat_env, {SurfaceAst.ident=ident ; directives=_} =
1236  
-          f_pat_var_ext (Parser_utils.label e) all_env hierar {SurfaceAst.ident=i;directives=[]} 
  1236
+          f_pat_var_ext (Parser_utils.label e) all_env hierar {SurfaceAst.ident=i;directives=[]}
1237 1237
         in
1238 1238
         (update_all_env_with i ident e all_env, (ident,e))
1239 1239
       ) all_env iel
@@ -1781,7 +1781,7 @@ let save_env env =
1781 1781
   ObjectExpr.save map;
1782 1782
   let map = extract_types_in_scope_except_tuple env in
1783 1783
   ObjectType.save map;
1784  
-  let my_val,my_typ =
  1784
+  let val_,typ =
1785 1785
     if ObjectFiles.stdlib_packages (ObjectFiles.get_current_package ()) then
1786 1786
       env.maptoident_val, env.maptoident_typ
1787 1787
     else
@@ -1789,12 +1789,7 @@ let save_env env =
1789 1789
       (* only saving the local maptoident for the stdlib packages *)
1790 1790
       env.maptoident_val, env.maptoident_typ
1791 1791
   in
1792  
-  ObjectOpaMapToIdent.save (my_val,my_typ);
1793  
-  let val_,typ =
1794  
-    ObjectOpaMapToIdent.fold
1795  
-      (fun (val1,typ1) (val2,typ2) ->
1796  
-         (StringMap.safe_merge val1 val2, stringmap_safe_merge typ1 typ2))
1797  
-      (my_val,my_typ) in
  1792
+  ObjectOpaMapToIdent.save (val_,typ);
1798 1793
   OpaMapToIdent.set_val_map val_;
1799 1794
   OpaMapToIdent.set_typ_map typ
1800 1795
 
@@ -1816,10 +1811,16 @@ let load_type_env all_env map =
1816 1811
   {all_env with t = {all_env.t with ttypes = ttypes}}
1817 1812
 
1818 1813
 let load_env env =
1819  
-  let all_env = env.all_envs in
1820  
-  let all_env = ObjectExpr.fold load_expr_env all_env in
1821  
-  let all_env = ObjectType.fold load_type_env all_env in
1822  
-  {env with all_envs = all_env}
  1814
+  let options_packages = ObjectFiles.compilation_mode() = `init in
  1815
+  let all_envs = env.all_envs in
  1816
+  let all_envs = ObjectExpr.fold load_expr_env all_envs in
  1817
+  let all_envs = ObjectType.fold load_type_env all_envs in
  1818
+  let maptoident_val, maptoident_typ =
  1819
+    ObjectOpaMapToIdent.fold ~packages:options_packages ~deep:true
  1820
+      (fun (val1,typ1) (val2,typ2) ->
  1821
+         (stringmap_safe_merge val1 val2, stringmap_safe_merge typ1 typ2))
  1822
+      (StringMap.empty, StringMap.empty) in
  1823
+  {all_envs; maptoident_val; maptoident_typ}
1823 1824
 
1824 1825
 
1825 1826
 let get_exported_values env =

0 notes on commit e68ea8c

Please sign in to comment.
Something went wrong with that request. Please try again.