mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 11:05:40 +02:00
Make aliased call not look up predeclarations (#9244)
This commit is contained in:
@ -952,6 +952,8 @@ pub struct StateWorkingSet<'a> {
|
||||
pub currently_parsed_cwd: Option<PathBuf>,
|
||||
/// All previously parsed module files. Used to protect against circular imports.
|
||||
pub parsed_module_files: Vec<PathBuf>,
|
||||
/// Whether or not predeclarations are searched when looking up a command (used with aliases)
|
||||
pub search_predecls: bool,
|
||||
pub parse_errors: Vec<ParseError>,
|
||||
}
|
||||
|
||||
@ -1130,6 +1132,7 @@ impl<'a> StateWorkingSet<'a> {
|
||||
type_scope: TypeScope::default(),
|
||||
currently_parsed_cwd: permanent_state.currently_parsed_cwd.clone(),
|
||||
parsed_module_files: vec![],
|
||||
search_predecls: true,
|
||||
parse_errors: vec![],
|
||||
}
|
||||
}
|
||||
@ -1456,9 +1459,11 @@ impl<'a> StateWorkingSet<'a> {
|
||||
let mut visibility: Visibility = Visibility::new();
|
||||
|
||||
for scope_frame in self.delta.scope.iter().rev() {
|
||||
if let Some(decl_id) = scope_frame.predecls.get(name) {
|
||||
if visibility.is_decl_id_visible(decl_id) {
|
||||
return Some(*decl_id);
|
||||
if self.search_predecls {
|
||||
if let Some(decl_id) = scope_frame.predecls.get(name) {
|
||||
if visibility.is_decl_id_visible(decl_id) {
|
||||
return Some(*decl_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1466,9 +1471,11 @@ impl<'a> StateWorkingSet<'a> {
|
||||
for overlay_frame in scope_frame.active_overlays(&mut removed_overlays).rev() {
|
||||
visibility.append(&overlay_frame.visibility);
|
||||
|
||||
if let Some(decl_id) = overlay_frame.predecls.get(name) {
|
||||
if visibility.is_decl_id_visible(decl_id) {
|
||||
return Some(*decl_id);
|
||||
if self.search_predecls {
|
||||
if let Some(decl_id) = overlay_frame.predecls.get(name) {
|
||||
if visibility.is_decl_id_visible(decl_id) {
|
||||
return Some(*decl_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user