restore exactly named target, prevent non-named targets to participate in the ad-hoc switch game
authorhaftmann
Wed, 02 Jul 2014 08:03:49 +0200
changeset 57484 cc309f3c0490
parent 57483 950dc7446454
child 57485 b640e50c91a1
restore exactly named target, prevent non-named targets to participate in the ad-hoc switch game
src/Pure/Isar/named_target.ML
--- a/src/Pure/Isar/named_target.ML	Wed Jul 02 08:03:48 2014 +0200
+++ b/src/Pure/Isar/named_target.ML	Wed Jul 02 08:03:49 2014 +0200
@@ -42,6 +42,11 @@
     SOME ("", _) => true
   | _ => false;
 
+fun target_of lthy =
+  case get_data lthy of
+    NONE => error "Not in a named target"
+  | SOME (target, _) => target;
+
 fun locale_name_of NONE = NONE
   | locale_name_of (SOME ("", _)) = NONE
   | locale_name_of (SOME (locale, _)) = SOME locale;
@@ -182,7 +187,7 @@
   | switch NONE (Context.Proof lthy) =
       (Context.Proof o Local_Theory.restore, lthy)
   | switch (SOME name) (Context.Proof lthy) =
-      (Context.Proof o init (the (locale_of lthy)) o exit,
+      (Context.Proof o init (target_of lthy) o exit,
         (begin name o exit o Local_Theory.assert_nonbrittle) lthy);
 
 end;