forked from extern/nushell
Reuse Closure
type in Value::Closure
(#10894)
# Description Reuses the existing `Closure` type in `Value::Closure`. This will help with the span refactoring for `Value`. Additionally, this allows us to more easily box or unbox the `Closure` case should we chose to do so in the future. # User-Facing Changes Breaking API change for `nu_protocol`.
This commit is contained in:
@@ -178,7 +178,10 @@ impl PartialEq for HashableValue {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use nu_protocol::ast::{CellPath, PathMember};
|
||||
use nu_protocol::{
|
||||
ast::{CellPath, PathMember},
|
||||
engine::Closure,
|
||||
};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
#[test]
|
||||
@@ -237,7 +240,13 @@ mod test {
|
||||
let span = Span::test_data();
|
||||
let values = [
|
||||
Value::list(vec![Value::bool(true, span)], span),
|
||||
Value::closure(0, HashMap::new(), span),
|
||||
Value::closure(
|
||||
Closure {
|
||||
block_id: 0,
|
||||
captures: HashMap::new(),
|
||||
},
|
||||
span,
|
||||
),
|
||||
Value::nothing(span),
|
||||
Value::error(ShellError::DidYouMean("what?".to_string(), span), span),
|
||||
Value::cell_path(
|
||||
|
Reference in New Issue
Block a user