mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-14 07:46:07 +00:00
Scripts: an error in code an earlier #targetengine run compiled names that run's file and line
A function an earlier run of a named engine defined was reported without a line, column or file when it threw in a later run. The realm now gives each source a tag that stays the same from run to run (Realm::error_tag, Realm::script_tag), and no two sources share one once the tags run out. Each named engine keeps the source maps of its runs' scripts, included files and $.evalFile files, within 8 MiB, dropping the oldest first, and an error in kept code is reported at that file, line and column. The report's name and the console line keep the calling run's name. For an earlier script given as source, file is that run's name. Docs: docs/mcp.md (Script engines), script.run params text, docs/target-app-parity.md.
This commit is contained in:
@@ -88,6 +88,13 @@ impl SourceMap {
|
||||
let name = self.files.get(seg.file).cloned().unwrap_or_else(|| Arc::from(""));
|
||||
(seg.file, name, seg.line.saturating_add(line - seg.out_line), column)
|
||||
}
|
||||
|
||||
/// The memory the map holds, in bytes: its lists and its file names, each name counted in full
|
||||
/// even when another map shares it.
|
||||
pub(crate) fn bytes(&self) -> usize {
|
||||
let names: usize = self.files.iter().map(|f| f.len() + 2 * size_of::<usize>()).sum();
|
||||
self.files.capacity() * size_of::<Arc<str>>() + self.segments.capacity() * size_of::<Segment>() + names
|
||||
}
|
||||
}
|
||||
|
||||
/// How a preprocessor failure ends the run.
|
||||
|
||||
Reference in New Issue
Block a user