mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 16:35:29 +02:00
Remove the Value::Block
case (#12582)
# Description `Value` describes the types of first-class values that users and scripts can create, manipulate, pass around, and store. However, `Block`s are not first-class values in the language, so this PR removes it from `Value`. This removes some unnecessary code, and this change should be invisible to the user except for the change to `scope modules` described below. # User-Facing Changes Breaking change: the output of `scope modules` was changed so that `env_block` is now `has_env_block` which is a boolean value instead of a `Block`. # After Submitting Update the language guide possibly.
This commit is contained in:
12
crates/nu-command/src/env/export_env.rs
vendored
12
crates/nu-command/src/env/export_env.rs
vendored
@ -1,5 +1,4 @@
|
||||
use nu_engine::{command_prelude::*, get_eval_block, redirect_env};
|
||||
use nu_protocol::engine::Closure;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ExportEnv;
|
||||
@ -31,10 +30,15 @@ impl Command for ExportEnv {
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let capture_block: Closure = call.req(engine_state, caller_stack, 0)?;
|
||||
let block = engine_state.get_block(capture_block.block_id);
|
||||
let block_id = call
|
||||
.positional_nth(0)
|
||||
.expect("checked through parser")
|
||||
.as_block()
|
||||
.expect("internal error: missing block");
|
||||
|
||||
let block = engine_state.get_block(block_id);
|
||||
let mut callee_stack = caller_stack
|
||||
.captures_to_stack(capture_block.captures)
|
||||
.gather_captures(engine_state, &block.captures)
|
||||
.reset_pipes();
|
||||
|
||||
let eval_block = get_eval_block(engine_state);
|
||||
|
Reference in New Issue
Block a user