mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 07:11:29 +02:00
Separate Overlay into its own thing (#344)
It's no longer attached to a Block. Makes access to overlays more streamlined by removing this one indirection. Also makes it easier to create standalone overlays without a block which might come in handy.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::ops::{Index, IndexMut};
|
||||
|
||||
use crate::{Overlay, Signature, VarId};
|
||||
use crate::{Signature, VarId};
|
||||
|
||||
use super::Statement;
|
||||
|
||||
@@ -8,7 +8,6 @@ use super::Statement;
|
||||
pub struct Block {
|
||||
pub signature: Box<Signature>,
|
||||
pub stmts: Vec<Statement>,
|
||||
pub overlay: Overlay,
|
||||
pub captures: Vec<VarId>,
|
||||
}
|
||||
|
||||
@@ -47,19 +46,9 @@ impl Block {
|
||||
Self {
|
||||
signature: Box::new(Signature::new("")),
|
||||
stmts: vec![],
|
||||
overlay: Overlay::new(),
|
||||
captures: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_overlay(self, overlay: Overlay) -> Self {
|
||||
Self {
|
||||
signature: self.signature,
|
||||
stmts: self.stmts,
|
||||
overlay,
|
||||
captures: self.captures,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<T> for Block
|
||||
@@ -70,7 +59,6 @@ where
|
||||
Self {
|
||||
signature: Box::new(Signature::new("")),
|
||||
stmts: stmts.collect(),
|
||||
overlay: Overlay::new(),
|
||||
captures: vec![],
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user