mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
scope.lookup_str
This commit is contained in:
parent
b241bcf777
commit
95bf8bb505
4 changed files with 10 additions and 6 deletions
|
@ -50,15 +50,19 @@ impl Scope {
|
|||
}
|
||||
|
||||
pub fn lookup(&self, ident: &Ident, region: Region) -> Result<Symbol, RuntimeError> {
|
||||
self.lookup_str(ident.as_str(), region)
|
||||
}
|
||||
|
||||
pub fn lookup_str(&self, ident: &str, region: Region) -> Result<Symbol, RuntimeError> {
|
||||
use ContainsIdent::*;
|
||||
|
||||
match self.scope_contains_ident(ident.as_str()) {
|
||||
match self.scope_contains_ident(ident) {
|
||||
InScope(symbol, _) => Ok(symbol),
|
||||
NotInScope(_) | NotPresent => {
|
||||
let error = RuntimeError::LookupNotInScope(
|
||||
Loc {
|
||||
region,
|
||||
value: ident.clone(),
|
||||
value: Ident::from(ident),
|
||||
},
|
||||
self.idents_in_scope().map(|v| v.as_ref().into()).collect(),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue