nushell/crates/nu-engine/src
Wind b7af715f6b
IR: Don't generate instructions for def and export def. (#14114)
# Description
Fixes: #14110
Fixes: #14087

I think it's ok to not generating instruction to `def` and `export def`
call. Because they just return `PipelineData::Empty` without doing
anything.

If nushell generates instructions for `def` and `export def`, nushell
will try to capture variables for these block. It's not the time to do
this.

# User-Facing Changes
```
nu -c "
def bar [] {
    let x = 1
    ($x | foo)
}
def foo [] {
    foo
}
" 
```
Will no longer raise error.

# Tests + Formatting
Added 4 tests
2024-11-06 21:35:00 -08:00
..
compile IR: Don't generate instructions for def and export def. (#14114) 2024-11-06 21:35:00 -08:00
call_ext.rs Internal representation (IR) compiler and evaluator (#13330) 2024-07-10 17:33:59 -07:00
closure_eval.rs Use Arc for environment variables on the stack (#13333) 2024-07-10 17:34:50 -07:00
column.rs Use Record's public API in a bunch of places (#10927) 2023-11-08 14:24:00 +01:00
command_prelude.rs Internal representation (IR) compiler and evaluator (#13330) 2024-07-10 17:33:59 -07:00
documentation.rs add command_type to help (#14165) 2024-10-24 19:06:49 +02:00
env.rs Make get_env_var return a reference to a Value (#13987) 2024-10-02 13:05:48 +02:00
eval_helpers.rs Error on non-zero exit statuses (#13515) 2024-09-07 06:44:26 +00:00
eval_ir.rs add rendered and json error messages in try/catch (#14082) 2024-10-20 23:14:11 +02:00
eval.rs Fix try printing when it is not the last pipeline element (#13992) 2024-10-12 14:37:10 +08:00
glob_from.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
lib.rs Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
scope.rs add is_const to help commands and scope commands (#14125) 2024-10-21 12:54:18 +02:00