summaryrefslogtreecommitdiff
path: root/src/errormsg.sml
diff options
context:
space:
mode:
authorGravatar FrigoEU <simon.van.casteren@gmail.com>2019-07-07 17:55:02 +0200
committerGravatar FrigoEU <simon.van.casteren@gmail.com>2019-07-07 17:55:02 +0200
commit562694cbb5beb31906610b7eabf42a56087673b5 (patch)
treeac44fa14f000b95d285dc18a2a6d1153bd0a918f /src/errormsg.sml
parent7fbfe759d3bc572dd7ee379429f0ff2d1f7894a0 (diff)
First iteration of more detailed elaboration caching
Diffstat (limited to 'src/errormsg.sml')
-rw-r--r--src/errormsg.sml21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/errormsg.sml b/src/errormsg.sml
index 8f3c93b1..eee20768 100644
--- a/src/errormsg.sml
+++ b/src/errormsg.sml
@@ -88,12 +88,31 @@ fun spanOf (pos1, pos2) = {file = !file,
val errors = ref false
+val structuresCurrentlyElaborating: ((string * bool) list) ref = ref nil
+
+fun startElabStructure s =
+ structuresCurrentlyElaborating := ((s, false) :: !structuresCurrentlyElaborating)
+fun stopElabStructureAndGetErrored s =
+ let
+ val errored =
+ case List.find (fn x => #1 x = s) (!structuresCurrentlyElaborating) of
+ NONE => false
+ | SOME tup => #2 tup
+ val () = structuresCurrentlyElaborating :=
+ (List.filter (fn x => #1 x <> s) (!structuresCurrentlyElaborating))
+ in
+ errored
+ end
+fun resetStructureTracker () =
+ structuresCurrentlyElaborating := []
fun resetErrors () = errors := false
fun anyErrors () = !errors
fun error s = (TextIO.output (TextIO.stdErr, s);
TextIO.output1 (TextIO.stdErr, #"\n");
- errors := true)
+ errors := true;
+ structuresCurrentlyElaborating :=
+ List.map (fn (s, e) => (s, true)) (!structuresCurrentlyElaborating))
fun errorAt (span : span) s = (TextIO.output (TextIO.stdErr, #file span);
TextIO.output (TextIO.stdErr, ":");