forked from extern/nushell
Look up predecl only in the working set (#4592)
Previously, the parser tried to look up the predecl also in the permanent state and if a definition with that name already existed, it would try to update it, which is illegal.
This commit is contained in:
@ -999,6 +999,16 @@ impl<'a> StateWorkingSet<'a> {
|
||||
self.delta.exit_scope();
|
||||
}
|
||||
|
||||
pub fn find_predecl(&self, name: &[u8]) -> Option<DeclId> {
|
||||
for scope in self.delta.scope.iter().rev() {
|
||||
if let Some(decl_id) = scope.predecls.get(name) {
|
||||
return Some(*decl_id);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
pub fn find_decl(&self, name: &[u8]) -> Option<DeclId> {
|
||||
let mut visibility: Visibility = Visibility::new();
|
||||
|
||||
|
Reference in New Issue
Block a user