mirror of
https://github.com/nushell/nushell.git
synced 2026-11-26 03:25:39 +08:00
## Description This is phase 4 of the AST to IR call migration, after #18808, #18813, #18967, #19351 and #19462. Commands now run only from compiled IR, so `engine::Call` loses its AST variants and the code that handled them goes too. Plain `cal` was the last runtime code that built an `ast::Call`, to run `table --index false`. It now runs `table` through `eval_ir_call`, as `help` does. The rest is deletion: `CallImpl::AstRef`/`AstBox`, `eval_call`, `eval_external`, `impl CallExt for ast::Call`, and the AST branches in `get`, `run`, `run-internal`, known externals and plugin calls. The AST evaluator stays, because `explain` and the parser info of `source`, `source-env` and `run` still use it. Its call arms now return an error, which fixes two `explain` bugs. `explain` evaluates every argument, and a keyword's argument can be a call. For `else if` that call is `if`, whose `run` panics. For `alias x = cmd` it ran `cmd`. Both now show an error value. An argument that holds a subexpression, like `(1 + 2)`, now shows its source text and parsed type instead of an internal debug dump. `explain` doesn't run it, because that would run its commands. The AST `has_flag` was the only check that a builtin's switch got a bool. The parser rejects `ls --all=5`, but `ls --all=$x` with `$x` typed `any` and set to `5` counted as set. Builtins, const calls and custom commands now give the error `%$cmd` already gave. A builtin checks when it reads the switch, so one that never reads it still ignores a bad value. ## User-facing changes (Release notes) - `explain` no longer crashes on `else if`, and no longer runs the command an `alias` points to. - `explain` shows an argument with a subexpression, like `(1 + 2)`, as its source text and parsed type. - Breaking change: a switch given a value that isn't a bool, as in `ls --all=$x` with `$x` set to `5`, is an error. It used to count as set. ## Additional notes