simultaneous modification of statements: statement names
authorhaftmann
Wed, 01 Sep 2010 17:21:50 +0200
changeset 39024 30d5dd2f30b6
parent 39023 3f70c03e8282
child 39025 582546cc49a1
simultaneous modification of statements: statement names
src/Tools/Code/code_namespace.ML
src/Tools/Code/code_scala.ML
--- a/src/Tools/Code/code_namespace.ML	Wed Sep 01 17:14:42 2010 +0200
+++ b/src/Tools/Code/code_namespace.ML	Wed Sep 01 17:21:50 2010 +0200
@@ -14,7 +14,7 @@
     reserved: Name.context, empty_nsp: 'c, namify_module: string -> 'c -> string * 'c,
     namify_stmt: Code_Thingol.stmt -> string -> 'c -> string * 'c,
     cyclic_modules: bool, empty_data: 'b, memorize_data: string -> 'b -> 'b,
-    modify_stmts: Code_Thingol.stmt list -> 'a option list }
+    modify_stmts: (string * Code_Thingol.stmt) list -> 'a option list }
       -> Code_Thingol.program
       -> { deresolver: string list -> string -> string,
            hierarchical_program: (string * ('a, 'b) node) Graph.T }
@@ -109,8 +109,7 @@
           #> AList.make (snd o Graph.get_node nodes)
           #> split_list
           ##> map (fn Stmt stmt => stmt)
-          ##> modify_stmts
-          #> op ~~;
+          #> (fn (names, stmts) => names ~~ modify_stmts (names ~~ stmts));
         val stmtss' = maps modify_stmts' (Graph.strong_conn nodes);
         val nodes'' = Graph.map (fn name => apsnd (fn Module content => Module (make_declarations nsps' content)
             | _ => case AList.lookup (op =) stmtss' name of SOME (SOME stmt) => Stmt stmt | _ => Dummy)) nodes';
--- a/src/Tools/Code/code_scala.ML	Wed Sep 01 17:14:42 2010 +0200
+++ b/src/Tools/Code/code_scala.ML	Wed Sep 01 17:21:50 2010 +0200
@@ -317,10 +317,10 @@
         val implicits = filter (is_classinst o Graph.get_node program)
           (Graph.imm_succs program name);
       in union (op =) implicits end;
-    fun modify_stmt (Code_Thingol.Datatypecons _) = NONE
-      | modify_stmt (Code_Thingol.Classrel _) = NONE
-      | modify_stmt (Code_Thingol.Classparam _) = NONE
-      | modify_stmt stmt = SOME stmt;
+    fun modify_stmt (_, Code_Thingol.Datatypecons _) = NONE
+      | modify_stmt (_, Code_Thingol.Classrel _) = NONE
+      | modify_stmt (_, Code_Thingol.Classparam _) = NONE
+      | modify_stmt (_, stmt) = SOME stmt;
   in
     Code_Namespace.hierarchical_program labelled_name { module_alias = module_alias, reserved = reserved,
       empty_nsp = ((reserved, reserved), reserved), namify_module = namify_module, namify_stmt = namify_stmt,