mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 19:37:45 +02:00
Span ID Refactor - Step 1 (#12960)
# Description First part of SpanID refactoring series. This PR adds a `SpanId` type and a corresponding `span_id` field to `Expression`. Parser creating expressions will now add them to an array in `StateWorkingSet`, generates a corresponding ID and saves the ID to the Expression. The IDs are not used anywhere yet. For the rough overall plan, see https://github.com/nushell/nushell/issues/12963. # User-Facing Changes Hopefully none. This is only a refactor of Nushell's internals that shouldn't have visible side effects. # Tests + Formatting # After Submitting
This commit is contained in:
@ -56,12 +56,12 @@ pub fn from_nuon(input: &str, span: Option<Span>) -> Result<Value, ShellError> {
|
||||
}
|
||||
|
||||
let expr = if block.pipelines.is_empty() {
|
||||
Expression {
|
||||
expr: Expr::Nothing,
|
||||
span: span.unwrap_or(Span::unknown()),
|
||||
custom_completion: None,
|
||||
ty: Type::Nothing,
|
||||
}
|
||||
Expression::new(
|
||||
&mut working_set,
|
||||
Expr::Nothing,
|
||||
span.unwrap_or(Span::unknown()),
|
||||
Type::Nothing,
|
||||
)
|
||||
} else {
|
||||
let mut pipeline = Arc::make_mut(&mut block).pipelines.remove(0);
|
||||
|
||||
@ -81,12 +81,12 @@ pub fn from_nuon(input: &str, span: Option<Span>) -> Result<Value, ShellError> {
|
||||
}
|
||||
|
||||
if pipeline.elements.is_empty() {
|
||||
Expression {
|
||||
expr: Expr::Nothing,
|
||||
span: span.unwrap_or(Span::unknown()),
|
||||
custom_completion: None,
|
||||
ty: Type::Nothing,
|
||||
}
|
||||
Expression::new(
|
||||
&mut working_set,
|
||||
Expr::Nothing,
|
||||
span.unwrap_or(Span::unknown()),
|
||||
Type::Nothing,
|
||||
)
|
||||
} else {
|
||||
pipeline.elements.remove(0).expr
|
||||
}
|
||||
|
Reference in New Issue
Block a user