Use prefix component of bindings for locale prefixes.
authorballarin
Wed, 10 Dec 2008 17:19:25 +0100
changeset 29208 b0c81b9a0133
parent 29207 a91012d9db21
child 29209 c2a750c8a37b
child 29223 e09c53289830
Use prefix component of bindings for locale prefixes.
src/Pure/General/binding.ML
src/Pure/Isar/expression.ML
--- a/src/Pure/General/binding.ML	Wed Dec 10 17:18:12 2008 +0100
+++ b/src/Pure/General/binding.ML	Wed Dec 10 17:19:25 2008 +0100
@@ -59,8 +59,8 @@
 val qualify = map_base o qualify_base;
   (*FIXME should all operations on bare names move here from name_space.ML ?*)
 
-fun add_prefix sticky prfx b = if prfx = "" then error "empty name prefix"
-  else (map_binding o apfst) (cons (prfx, sticky)) b;
+fun add_prefix sticky "" b = b
+  | add_prefix sticky prfx b = (map_binding o apfst) (cons (prfx, sticky)) b;
 
 fun map_prefix f (Binding ((prefix, name), pos)) =
   f prefix (name_pos (name, pos));
--- a/src/Pure/Isar/expression.ML	Wed Dec 10 17:18:12 2008 +0100
+++ b/src/Pure/Isar/expression.ML	Wed Dec 10 17:19:25 2008 +0100
@@ -175,7 +175,7 @@
     val inst = Symtab.make insts'';
   in
     (Element.inst_morphism (ProofContext.theory_of ctxt) (instT, inst) $>
-      Morphism.binding_morphism (Binding.qualify prfx), ctxt')
+      Morphism.binding_morphism (Binding.add_prefix false prfx), ctxt')
   end;