mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 20:37:43 +02:00
feat(const): implement run_const for const
(#15082)
- fixes #14559 # Description Allow using `const` keyword in const contexts. The `run_const` body is basically empty as the actual logic is already handled by the parser. # User-Facing Changes `const` keyword can now be used in `const` contexts. # Tests + Formatting I'll add some tests before marking this ready. - 🟢 toolkit fmt - 🟢 toolkit clippy - 🟢 toolkit test - 🟢 toolkit test stdlib # After Submitting N/A --------- Co-authored-by: Bahex <17417311+Bahex@users.noreply.github.com>
This commit is contained in:
@ -72,6 +72,19 @@ impl Command for Const {
|
||||
}
|
||||
}
|
||||
|
||||
fn run_const(
|
||||
&self,
|
||||
_working_set: &StateWorkingSet,
|
||||
_call: &Call,
|
||||
_input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
Ok(PipelineData::empty())
|
||||
}
|
||||
|
||||
fn is_const(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
|
Reference in New Issue
Block a user