Revert "Revert "Migrate most uses of the Span concept to Tag""

This reverts commit bee7c5639c.
This commit is contained in:
Yehuda Katz
2019-09-14 11:30:24 -05:00
parent 52e71cad18
commit ab915f1c44
98 changed files with 1178 additions and 1248 deletions

View File

@ -76,7 +76,7 @@ pub fn value_to_yaml_value(v: &Tagged<Value>) -> Result<serde_yaml::Value, Shell
fn to_yaml(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream, ShellError> {
let args = args.evaluate_once(registry)?;
let name_span = args.name_span();
let name_tag = args.name_tag();
let stream = async_stream_block! {
let input: Vec<Tagged<Value>> = args.input.values.collect().await;
@ -94,21 +94,21 @@ fn to_yaml(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream
Ok(yaml_value) => {
match serde_yaml::to_string(&yaml_value) {
Ok(x) => yield ReturnSuccess::value(
Value::Primitive(Primitive::String(x)).simple_spanned(name_span),
Value::Primitive(Primitive::String(x)).tagged(name_tag),
),
_ => yield Err(ShellError::labeled_error_with_secondary(
"Expected a table with YAML-compatible structure.span() from pipeline",
"Expected a table with YAML-compatible structure.tag() from pipeline",
"requires YAML-compatible input",
name_span,
name_tag,
"originates from here".to_string(),
value.span(),
value.tag(),
)),
}
}
_ => yield Err(ShellError::labeled_error(
"Expected a table with YAML-compatible structure from pipeline",
"requires YAML-compatible input",
name_span))
name_tag))
}
}
};