forked from extern/nushell
Bring module's environment when activating overlay (#6425)
This commit is contained in:
@ -11,6 +11,7 @@ pub struct Module {
|
||||
pub decls: IndexMap<Vec<u8>, DeclId>,
|
||||
pub aliases: IndexMap<Vec<u8>, AliasId>,
|
||||
pub env_vars: IndexMap<Vec<u8>, BlockId>,
|
||||
pub env_block: Option<BlockId>,
|
||||
pub span: Option<Span>,
|
||||
}
|
||||
|
||||
@ -20,6 +21,7 @@ impl Module {
|
||||
decls: IndexMap::new(),
|
||||
aliases: IndexMap::new(),
|
||||
env_vars: IndexMap::new(),
|
||||
env_block: None,
|
||||
span: None,
|
||||
}
|
||||
}
|
||||
@ -29,6 +31,7 @@ impl Module {
|
||||
decls: IndexMap::new(),
|
||||
aliases: IndexMap::new(),
|
||||
env_vars: IndexMap::new(),
|
||||
env_block: None,
|
||||
span: Some(span),
|
||||
}
|
||||
}
|
||||
@ -45,6 +48,10 @@ impl Module {
|
||||
self.env_vars.insert(name, block_id)
|
||||
}
|
||||
|
||||
pub fn add_env_block(&mut self, block_id: BlockId) {
|
||||
self.env_block = Some(block_id);
|
||||
}
|
||||
|
||||
pub fn extend(&mut self, other: &Module) {
|
||||
self.decls.extend(other.decls.clone());
|
||||
self.env_vars.extend(other.env_vars.clone());
|
||||
|
Reference in New Issue
Block a user