refactor(tvix/eval): store spans instead of nodes in Warning/Error
Another step towards being able to report accurate errors. The codemap spans contain strictly more accessible information, as they now retain information about which input file something came from. This required some shuffling around in the compiler to thread all the right information to the right places. Change-Id: I18ccfb20f07b0c33e1c4f51ca00cd09f7b2d19c6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6404 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
8033300900
commit
55d21a1389
5 changed files with 92 additions and 90 deletions
|
|
@ -27,8 +27,8 @@ pub struct Local {
|
|||
// of `let`-expressions.
|
||||
pub name: String,
|
||||
|
||||
// Syntax node at which this local was declared.
|
||||
pub node: Option<rnix::SyntaxNode>,
|
||||
// Source span at which this local was declared.
|
||||
pub span: codemap::Span,
|
||||
|
||||
// Scope depth of this local.
|
||||
pub depth: usize,
|
||||
|
|
@ -203,14 +203,14 @@ impl Scope {
|
|||
/// Declare a local variable that occupies a stack slot and should
|
||||
/// be accounted for, but is not directly accessible by users
|
||||
/// (e.g. attribute sets used for `with`).
|
||||
pub fn declare_phantom(&mut self) -> LocalIdx {
|
||||
pub fn declare_phantom(&mut self, span: codemap::Span) -> LocalIdx {
|
||||
let idx = self.locals.len();
|
||||
self.locals.push(Local {
|
||||
span,
|
||||
depth: self.scope_depth,
|
||||
initialised: true,
|
||||
needs_finaliser: false,
|
||||
name: "".into(),
|
||||
node: None,
|
||||
phantom: true,
|
||||
used: true,
|
||||
});
|
||||
|
|
@ -219,14 +219,14 @@ impl Scope {
|
|||
}
|
||||
|
||||
/// Declare an uninitialised local variable.
|
||||
pub fn declare_local(&mut self, name: String, node: rnix::SyntaxNode) -> LocalIdx {
|
||||
pub fn declare_local(&mut self, name: String, span: codemap::Span) -> LocalIdx {
|
||||
let idx = self.locals.len();
|
||||
self.locals.push(Local {
|
||||
name,
|
||||
span,
|
||||
depth: self.scope_depth,
|
||||
initialised: false,
|
||||
needs_finaliser: false,
|
||||
node: Some(node),
|
||||
phantom: false,
|
||||
used: false,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue