src/Pure/System/scala.scala
changeset 71888 feb37a43ace6
parent 71882 f92c7e2ba8da
child 71889 8dbefe849666
--- a/src/Pure/System/scala.scala	Mon May 25 19:10:38 2020 +0200
+++ b/src/Pure/System/scala.scala	Mon May 25 20:43:19 2020 +0200
@@ -77,18 +77,14 @@
 
         if (!ok && errors.isEmpty) List("Error") else errors
       }
-
-      def check(body: String): List[String] =
-      {
-        try { toplevel("package test\nobject Test { " + body + " }") }
-        catch { case ERROR(msg) => List(msg) }
-      }
     }
   }
 
-  def check_yxml(body: String): String =
+  def toplevel_yxml(source: String): String =
   {
-    val errors = Compiler.default_context.check(body)
+    val errors =
+      try { Compiler.default_context.toplevel(source) }
+      catch { case ERROR(msg) => List(msg) }
     locally { import XML.Encode._; YXML.string_of_body(list(string)(errors)) }
   }
 
@@ -199,5 +195,5 @@
 
 class Functions extends Isabelle_Scala_Functions(
   Scala.Fun("echo", identity),
-  Scala.Fun("scala_check", Scala.check_yxml),
+  Scala.Fun("scala_toplevel", Scala.toplevel_yxml),
   Scala.Fun("check_bibtex_database", Bibtex.check_database_yxml))