mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 07:11:29 +02:00
Allow adding module blocks to engine state
This commit is contained in:
@@ -8,6 +8,7 @@ use super::Statement;
|
||||
pub struct Block {
|
||||
pub signature: Box<Signature>,
|
||||
pub stmts: Vec<Statement>,
|
||||
pub exports: Vec<Vec<u8>>, // Assuming just defs for now
|
||||
}
|
||||
|
||||
impl Block {
|
||||
@@ -45,6 +46,15 @@ impl Block {
|
||||
Self {
|
||||
signature: Box::new(Signature::new("")),
|
||||
stmts: vec![],
|
||||
exports: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_exports(self, exports: Vec<Vec<u8>>) -> Self {
|
||||
Self {
|
||||
signature: self.signature,
|
||||
stmts: self.stmts,
|
||||
exports,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,6 +67,7 @@ where
|
||||
Self {
|
||||
signature: Box::new(Signature::new("")),
|
||||
stmts: stmts.collect(),
|
||||
exports: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user