From 9227e284854397d1f9d1af65e25c7ec879975372 Mon Sep 17 00:00:00 2001 From: Devyn Cairns Date: Fri, 28 Jun 2024 22:11:35 -0700 Subject: [PATCH] const --- crates/nu-engine/src/compile/call.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/nu-engine/src/compile/call.rs b/crates/nu-engine/src/compile/call.rs index 70bb14f5fa..85b9db0a5d 100644 --- a/crates/nu-engine/src/compile/call.rs +++ b/crates/nu-engine/src/compile/call.rs @@ -21,6 +21,13 @@ pub(crate) fn compile_call( "if" => { return compile_if(working_set, builder, call, redirect_modes, io_reg); } + "const" => { + // This differs from the behavior of the const command, which adds the const value + // to the stack. Since `load-variable` also checks `engine_state` for the variable + // and will get a const value though, is it really necessary to do that? + builder.load_empty(io_reg)?; + return Ok(()); + } "let" | "mut" => { return compile_let(working_set, builder, call, redirect_modes, io_reg); }