Complete instantiation annotations

This commit is contained in:
Ayaz Hafiz 2023-04-01 20:05:18 -05:00
parent ca5a5c2698
commit 0e47140eaf
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
7 changed files with 187 additions and 45 deletions

View file

@ -63,6 +63,15 @@ impl<'a> DeclarationInfo<'a> {
} => Region::span_across(&loc_pattern.region, &loc_expr.region),
}
}
fn var(&self) -> Variable {
match self {
DeclarationInfo::Value { expr_var, .. } => *expr_var,
DeclarationInfo::Expectation { .. } => Variable::BOOL,
DeclarationInfo::Function { expr_var, .. } => *expr_var,
DeclarationInfo::Destructure { expr_var, .. } => *expr_var,
}
}
}
pub fn walk_decls<V: Visitor>(visitor: &mut V, decls: &Declarations) {
@ -807,6 +816,13 @@ impl<'a> FoundDeclaration<'a> {
FoundDeclaration::Def(def) => def.region(),
}
}
pub fn var(&self) -> Variable {
match self {
FoundDeclaration::Decl(decl) => decl.var(),
FoundDeclaration::Def(def) => def.expr_var,
}
}
}
/// Finds the declaration of `symbol`.