mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Complete instantiation annotations
This commit is contained in:
parent
ca5a5c2698
commit
0e47140eaf
7 changed files with 187 additions and 45 deletions
|
@ -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`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue