src/Pure/Isar/toplevel.ML
changeset 72436 d62d84634b06
parent 72434 cc27cf7e51c6
child 72449 e1ee4a9902bd
equal deleted inserted replaced
72435:166fc8b9b4cd 72436:d62d84634b06
   455     | _ => raise UNDEF));
   455     | _ => raise UNDEF));
   456 
   456 
   457 val end_nested_target = transaction (fn _ =>
   457 val end_nested_target = transaction (fn _ =>
   458   (fn Theory (Context.Proof lthy) =>
   458   (fn Theory (Context.Proof lthy) =>
   459         (case try Local_Theory.close_target lthy of
   459         (case try Local_Theory.close_target lthy of
   460           SOME ctxt' =>
   460           SOME lthy' =>
   461             let
   461             let
   462               val gthy' =
   462               val gthy' =
   463                 if can Local_Theory.assert ctxt'
   463                 if Named_Target.is_theory lthy'
   464                 then Context.Proof ctxt'
   464                 then Context.Theory (Local_Theory.exit_global lthy')
   465                 else Context.Theory (Proof_Context.theory_of ctxt');
   465                 else Context.Proof lthy'
   466             in (Theory gthy', lthy) end
   466             in (Theory gthy', lthy) end
   467         | NONE => raise UNDEF)
   467         | NONE => raise UNDEF)
   468     | _ => raise UNDEF));
   468     | _ => raise UNDEF));
   469 
   469 
   470 fun restricted_context (SOME (strict, scope)) =
   470 fun restricted_context (SOME (strict, scope)) =