Hide alias (#4432)

* Add alias interning

Now, AliasId is used to reference aliases stored in EngineState, similar
to decls, blocks, etc.

* Fix wrong message

* Fix using decl instead of alias

* Extend also alias id visibility

* Merge also aliases from delta

* Add alias hiding code

Does not work yet but passes tests at least.

* Fix wrong alias lookup and visibility appending

* Add hide alias tests

* Fmt & Clippy

* Fix random clippy warnings in "which" command
This commit is contained in:
Jakub Žádník
2022-02-12 11:50:37 +02:00
committed by GitHub
parent fcc13224c1
commit 328f7e92a0
9 changed files with 378 additions and 57 deletions

View File

@ -828,9 +828,11 @@ pub fn parse_call(
if expand_aliases {
// If the word is an alias, expand it and re-parse the expression
if let Some(expansion) = working_set.find_alias(&name) {
if let Some(alias_id) = working_set.find_alias(&name) {
trace!("expanding alias");
let expansion = working_set.get_alias(alias_id);
let orig_span = spans[pos];
let mut new_spans: Vec<Span> = vec![];
new_spans.extend(&spans[0..pos]);