nushell/crates/nu-protocol/src/ast
StevenDoesStuffs 400a9d3b1e
Allow NU_LIBS_DIR and friends to be const (#8310)
# Description

Allow NU_LIBS_DIR and friends to be const they can be updated within the
same parse pass. This will allow us to remove having multiple config
files eventually.

Small implementation detail: I've changed `call.parser_info` to a
hashmap with string keys, so the information can have names rather than
indices, and we don't have to worry too much about the order in which we
put things into it.

Closes https://github.com/nushell/nushell/issues/8422

# User-Facing Changes

In a single file, users can now do stuff like
```
const NU_LIBS_DIR = ['/some/path/here']
source script.nu
```
and the source statement will use the value of NU_LIBS_DIR declared the
line before.

Currently, if there is no `NU_LIBS_DIR` const, then we fallback to using
the value of the `NU_LIBS_DIR` env-var, so there are no breaking changes
(unless someone named a const NU_LIBS_DIR for some reason).


![2023-03-04-014103_hyprshot](https://user-images.githubusercontent.com/13265529/222885263-135cdd0d-7884-438b-b2ed-c3979fa44463.png)

# Tests + Formatting

~~TODO: write tests~~ Done

# After Submitting

~~TODO: update docs~~ Will do when we update default_env.nu/merge
default_env.nu into default_config.nu.
2023-03-17 07:23:29 -05:00
..
block.rs Limit recursion to avoid stack overflow (#7657) 2023-01-04 18:38:50 -08:00
call.rs Allow NU_LIBS_DIR and friends to be const (#8310) 2023-03-17 07:23:29 -05:00
cell_path.rs Optional members in cell paths: Attempt 2 (#8379) 2023-03-15 20:50:58 -07:00
expr.rs Make external command substitution works friendly(like fish shell, trailing ending newlines) (#7156) 2022-11-23 16:51:57 +13:00
expression.rs Add logical xor operator (#7242) 2022-11-26 17:02:37 +01:00
import_pattern.rs Protocol: debug_assert!() Span to reflect a valid slice (#6806) 2022-12-03 11:44:12 +02:00
mod.rs Remove statements, replaced by pipelines (#4482) 2022-02-15 14:31:14 -05:00
operator.rs ++= appendAssign operator (#7346) (#7354) 2022-12-09 11:20:58 -05:00
pipeline.rs explain command (#7957) 2023-02-09 13:59:38 -06:00