feat: Add span information to compiler errors

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2025-12-02 12:29:15 -06:00
parent e060e43a6c
commit 5aefd51cb6
10 changed files with 159 additions and 57 deletions

View File

@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
use super::{Compiler, Result};
use super::{Compiler, CompilerError, Result};
use crate::interpreter::Interpreter;
use crate::rvm::program::{Program, RuleType, SpanInfo};
use crate::rvm::Instruction;
@@ -129,7 +129,9 @@ impl<'a> Compiler<'a> {
self.program.entry_points = self.entry_points;
if !self.program.builtin_info_table.is_empty() {
self.program.initialize_resolved_builtins()?;
self.program
.initialize_resolved_builtins()
.map_err(|err| CompilerError::from(err))?;
}
Ok(self.program)