Remove usages of internal_span (#14700)

# Description
Remove usages of `internal_span` in matches and initializers. I think
this should be the last of the usages, meaning `internal_span` can
finally be refactored out of `Value`(!?)
This commit is contained in:
132ikl
2024-12-30 03:47:06 -05:00
committed by GitHub
parent 2bcf2389aa
commit 378395c22c
10 changed files with 84 additions and 94 deletions

View File

@ -184,16 +184,11 @@ fn value_to_cell_path(value: &Value, span: Span) -> Result<Value, ShellError> {
}
fn value_to_path_member(val: &Value, span: Span) -> Result<PathMember, ShellError> {
let val_span = val.span();
let member = match val {
Value::Int {
val,
internal_span: span,
} => int_to_path_member(*val, *span)?,
Value::String {
val,
internal_span: span,
} => PathMember::string(val.into(), false, *span),
Value::Record { val, internal_span } => record_to_path_member(val, *internal_span, span)?,
Value::Int { val, .. } => int_to_path_member(*val, val_span)?,
Value::String { val, .. } => PathMember::string(val.into(), false, val_span),
Value::Record { val, .. } => record_to_path_member(val, val_span, span)?,
other => {
return Err(ShellError::CantConvert {
to_type: "int or string".to_string(),