Rename origin to anchor

This commit is contained in:
Jonathan Turner 2019-09-29 18:13:56 +13:00
parent d52e087453
commit caed87c125
18 changed files with 111 additions and 111 deletions

View File

@ -58,7 +58,7 @@ pub fn autoview(
}
}
};
} else if is_single_origined_text_value(&input) {
} else if is_single_anchored_text_value(&input) {
let text = context.get_command("textview");
if let Some(text) = text {
let result = text.run(raw.with_input(input), &context.commands, false);
@ -111,17 +111,17 @@ fn is_single_text_value(input: &Vec<Tagged<Value>>) -> bool {
}
}
fn is_single_origined_text_value(input: &Vec<Tagged<Value>>) -> bool {
fn is_single_anchored_text_value(input: &Vec<Tagged<Value>>) -> bool {
if input.len() != 1 {
return false;
}
if let Tagged {
item: Value::Primitive(Primitive::String(_)),
tag: Tag { origin, .. },
tag: Tag { anchor, .. },
} = input[0]
{
origin != uuid::Uuid::nil()
anchor != uuid::Uuid::nil()
} else {
false
}

View File

@ -75,10 +75,10 @@ impl PerItemCommand for Enter {
)
.await.unwrap();
if contents_tag.origin != uuid::Uuid::nil() {
if contents_tag.anchor != uuid::Uuid::nil() {
// If we have loaded something, track its source
yield ReturnSuccess::action(CommandAction::AddSpanSource(
contents_tag.origin,
contents_tag.anchor,
span_source,
));
}

View File

@ -76,10 +76,10 @@ fn run(
file_extension.or(path_str.split('.').last().map(String::from))
};
if contents_tag.origin != uuid::Uuid::nil() {
if contents_tag.anchor != uuid::Uuid::nil() {
// If we have loaded something, track its source
yield ReturnSuccess::action(CommandAction::AddSpanSource(
contents_tag.origin,
contents_tag.anchor,
span_source,
));
}
@ -158,7 +158,7 @@ pub async fn fetch(
})?),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::Url(location.to_string()),
)),
@ -173,7 +173,7 @@ pub async fn fetch(
})?),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::Url(location.to_string()),
)),
@ -190,7 +190,7 @@ pub async fn fetch(
Value::binary(buf),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::Url(location.to_string()),
))
@ -206,7 +206,7 @@ pub async fn fetch(
})?),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::Url(location.to_string()),
)),
@ -223,7 +223,7 @@ pub async fn fetch(
Value::binary(buf),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::Url(location.to_string()),
))
@ -239,7 +239,7 @@ pub async fn fetch(
})?),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::Url(location.to_string()),
)),
@ -266,7 +266,7 @@ pub async fn fetch(
})?),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::Url(location.to_string()),
))
@ -276,7 +276,7 @@ pub async fn fetch(
Value::string(format!("Not yet supported MIME type: {} {}", ty, sub_ty)),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::Url(location.to_string()),
)),
@ -287,7 +287,7 @@ pub async fn fetch(
Value::string(format!("No content type found")),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::Url(location.to_string()),
)),

View File

@ -77,10 +77,10 @@ fn run(
file_extension.or(path_str.split('.').last().map(String::from))
};
if contents_tag.origin != uuid::Uuid::nil() {
if contents_tag.anchor != uuid::Uuid::nil() {
// If we have loaded something, track its source
yield ReturnSuccess::action(CommandAction::AddSpanSource(
contents_tag.origin,
contents_tag.anchor,
span_source,
));
}
@ -147,7 +147,7 @@ pub async fn fetch(
Value::string(s),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::File(cwd.to_string_lossy().to_string()),
)),
@ -166,7 +166,7 @@ pub async fn fetch(
Value::string(s),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::File(cwd.to_string_lossy().to_string()),
)),
@ -175,7 +175,7 @@ pub async fn fetch(
Value::binary(bytes),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::File(cwd.to_string_lossy().to_string()),
)),
@ -186,7 +186,7 @@ pub async fn fetch(
Value::binary(bytes),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::File(cwd.to_string_lossy().to_string()),
))
@ -204,7 +204,7 @@ pub async fn fetch(
Value::string(s),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::File(cwd.to_string_lossy().to_string()),
)),
@ -213,7 +213,7 @@ pub async fn fetch(
Value::binary(bytes),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::File(cwd.to_string_lossy().to_string()),
)),
@ -224,7 +224,7 @@ pub async fn fetch(
Value::binary(bytes),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::File(cwd.to_string_lossy().to_string()),
))
@ -235,7 +235,7 @@ pub async fn fetch(
Value::binary(bytes),
Tag {
span,
origin: Uuid::new_v4(),
anchor: Uuid::new_v4(),
},
SpanSource::File(cwd.to_string_lossy().to_string()),
)),

View File

@ -85,10 +85,10 @@ fn run(
file_extension.or(path_str.split('.').last().map(String::from))
};
if contents_tag.origin != uuid::Uuid::nil() {
if contents_tag.anchor != uuid::Uuid::nil() {
// If we have loaded something, track its source
yield ReturnSuccess::action(CommandAction::AddSpanSource(
contents_tag.origin,
contents_tag.anchor,
span_source,
));
}

View File

@ -133,10 +133,10 @@ fn save(
let stream = async_stream! {
let input: Vec<Tagged<Value>> = input.values.collect().await;
if path.is_none() {
// If there is no filename, check the metadata for the origin filename
// If there is no filename, check the metadata for the anchor filename
if input.len() > 0 {
let origin = input[0].origin();
match source_map.get(&origin) {
let anchor = input[0].anchor();
match source_map.get(&anchor) {
Some(path) => match path {
SpanSource::File(file) => {
full_path.push(Path::new(file));

View File

@ -35,19 +35,19 @@ fn tags(args: CommandArgs, _registry: &CommandRegistry) -> Result<OutputStream,
.map(move |v| {
let mut tags = TaggedDictBuilder::new(v.tag());
{
let origin = v.origin();
let anchor = v.anchor();
let span = v.tag().span;
let mut dict = TaggedDictBuilder::new(v.tag());
dict.insert("start", Value::int(span.start as i64));
dict.insert("end", Value::int(span.end as i64));
tags.insert_tagged("span", dict.into_tagged_value());
match source_map.get(&origin) {
match source_map.get(&anchor) {
Some(SpanSource::File(source)) => {
tags.insert("origin", Value::string(source));
tags.insert("anchor", Value::string(source));
}
Some(SpanSource::Url(source)) => {
tags.insert("origin", Value::string(source));
tags.insert("anchor", Value::string(source));
}
_ => {}
}

View File

@ -39,7 +39,7 @@ pub trait TaggedItem: Sized {
self,
Tag {
span: Span::unknown(),
origin: uuid::Uuid::nil(),
anchor: uuid::Uuid::nil(),
},
)
}
@ -90,12 +90,12 @@ impl<T> Tagged<T> {
self.tag.span
}
pub fn origin(&self) -> uuid::Uuid {
self.tag.origin
pub fn anchor(&self) -> uuid::Uuid {
self.tag.anchor
}
pub fn origin_name(&self, source_map: &SourceMap) -> Option<String> {
match source_map.get(&self.tag.origin) {
pub fn anchor_name(&self, source_map: &SourceMap) -> Option<String> {
match source_map.get(&self.tag.anchor) {
Some(SpanSource::File(file)) => Some(file.clone()),
Some(SpanSource::Url(url)) => Some(url.clone()),
_ => None,
@ -167,14 +167,14 @@ impl From<&std::ops::Range<usize>> for Span {
Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Serialize, Deserialize, Hash, Getters,
)]
pub struct Tag {
pub origin: Uuid,
pub anchor: Uuid,
pub span: Span,
}
impl From<Span> for Tag {
fn from(span: Span) -> Self {
Tag {
origin: uuid::Uuid::nil(),
anchor: uuid::Uuid::nil(),
span,
}
}
@ -183,25 +183,25 @@ impl From<Span> for Tag {
impl From<&Span> for Tag {
fn from(span: &Span) -> Self {
Tag {
origin: uuid::Uuid::nil(),
anchor: uuid::Uuid::nil(),
span: *span,
}
}
}
impl From<(usize, usize, Uuid)> for Tag {
fn from((start, end, origin): (usize, usize, Uuid)) -> Self {
fn from((start, end, anchor): (usize, usize, Uuid)) -> Self {
Tag {
origin,
anchor,
span: Span { start, end },
}
}
}
impl From<(usize, usize, Option<Uuid>)> for Tag {
fn from((start, end, origin): (usize, usize, Option<Uuid>)) -> Self {
fn from((start, end, anchor): (usize, usize, Option<Uuid>)) -> Self {
Tag {
origin: if let Some(uuid) = origin {
anchor: if let Some(uuid) = anchor {
uuid
} else {
uuid::Uuid::nil()
@ -214,7 +214,7 @@ impl From<(usize, usize, Option<Uuid>)> for Tag {
impl From<nom_locate::LocatedSpanEx<&str, Uuid>> for Tag {
fn from(input: nom_locate::LocatedSpanEx<&str, Uuid>) -> Tag {
Tag {
origin: input.extra,
anchor: input.extra,
span: Span {
start: input.offset,
end: input.offset + input.fragment.len(),
@ -236,23 +236,23 @@ impl From<&Tag> for Span {
}
impl Tag {
pub fn unknown_origin(span: Span) -> Tag {
pub fn unknown_anchor(span: Span) -> Tag {
Tag {
origin: uuid::Uuid::nil(),
anchor: uuid::Uuid::nil(),
span,
}
}
pub fn unknown_span(origin: Uuid) -> Tag {
pub fn unknown_span(anchor: Uuid) -> Tag {
Tag {
origin,
anchor,
span: Span::unknown(),
}
}
pub fn unknown() -> Tag {
Tag {
origin: uuid::Uuid::nil(),
anchor: uuid::Uuid::nil(),
span: Span::unknown(),
}
}
@ -260,8 +260,8 @@ impl Tag {
pub fn until(&self, other: impl Into<Tag>) -> Tag {
let other = other.into();
debug_assert!(
self.origin == other.origin,
"Can only merge two tags with the same origin"
self.anchor == other.anchor,
"Can only merge two tags with the same anchor"
);
Tag {
@ -269,7 +269,7 @@ impl Tag {
start: self.span.start,
end: other.span.end,
},
origin: self.origin,
anchor: self.anchor,
}
}
@ -348,7 +348,7 @@ impl language_reporting::ReportingSpan for Tag {
start,
end: self.span.end,
},
origin: self.origin,
anchor: self.anchor,
}
}
@ -358,7 +358,7 @@ impl language_reporting::ReportingSpan for Tag {
start: self.span.start,
end,
},
origin: self.origin,
anchor: self.anchor,
}
}

View File

@ -21,10 +21,10 @@ pub(crate) use parse::unit::Unit;
pub(crate) use parse_command::parse_command;
pub(crate) use registry::CommandRegistry;
pub fn parse(input: &str, origin: uuid::Uuid) -> Result<TokenNode, ShellError> {
pub fn parse(input: &str, anchor: uuid::Uuid) -> Result<TokenNode, ShellError> {
let _ = pretty_env_logger::try_init();
match pipeline(nom_input(input, origin)) {
match pipeline(nom_input(input, anchor)) {
Ok((_rest, val)) => Ok(val),
Err(err) => Err(ShellError::parse_error(err)),
}

View File

@ -22,7 +22,7 @@ impl language_reporting::ReportingFiles for Files {
}
fn file_id(&self, tag: Self::Span) -> Self::FileId {
tag.origin
tag.anchor
}
fn file_name(&self, _file: Self::FileId) -> FileName {

View File

@ -26,8 +26,8 @@ use uuid::Uuid;
pub type NomSpan<'a> = LocatedSpanEx<&'a str, Uuid>;
pub fn nom_input(s: &str, origin: Uuid) -> NomSpan<'_> {
LocatedSpanEx::new_extra(s, origin)
pub fn nom_input(s: &str, anchor: Uuid) -> NomSpan<'_> {
LocatedSpanEx::new_extra(s, anchor)
}
macro_rules! operator {
@ -149,7 +149,7 @@ impl Into<Number> for BigDecimal {
}
pub fn raw_number(input: NomSpan) -> IResult<NomSpan, Tagged<RawNumber>> {
let original = input;
let anchoral = input;
let start = input.offset;
trace_step(input, "raw_decimal", move |input| {
let (input, neg) = opt(tag("-"))(input)?;
@ -1308,7 +1308,7 @@ mod tests {
right: usize,
) -> TokenNode {
let node = DelimitedNode::new(*delimiter, children);
let spanned = node.tagged((left, right, delimiter.tag.origin));
let spanned = node.tagged((left, right, delimiter.tag.anchor));
TokenNode::Delimited(spanned)
}
@ -1319,7 +1319,7 @@ mod tests {
Box::new(head),
tail.into_iter().map(TokenNode::Token).collect(),
);
let spanned = node.tagged((left, right, tag.origin));
let spanned = node.tagged((left, right, tag.anchor));
TokenNode::Path(spanned)
}

View File

@ -18,15 +18,15 @@ pub struct TokenTreeBuilder {
#[new(default)]
output: String,
origin: Uuid,
anchor: Uuid,
}
pub type CurriedToken = Box<dyn FnOnce(&mut TokenTreeBuilder) -> TokenNode + 'static>;
pub type CurriedCall = Box<dyn FnOnce(&mut TokenTreeBuilder) -> Tagged<CallNode> + 'static>;
impl TokenTreeBuilder {
pub fn build(origin: Uuid, block: impl FnOnce(&mut Self) -> TokenNode) -> (TokenNode, String) {
let mut builder = TokenTreeBuilder::new(origin);
pub fn build(anchor: Uuid, block: impl FnOnce(&mut Self) -> TokenNode) -> (TokenNode, String) {
let mut builder = TokenTreeBuilder::new(anchor);
let node = block(&mut builder);
(node, builder.output)
}
@ -76,7 +76,7 @@ impl TokenTreeBuilder {
let end = b.pos;
TokenTreeBuilder::tagged_pipeline((out, None), (start, end, b.origin))
TokenTreeBuilder::tagged_pipeline((out, None), (start, end, b.anchor))
})
}
@ -95,7 +95,7 @@ impl TokenTreeBuilder {
b.pos = end;
TokenTreeBuilder::tagged_op(input, (start, end, b.origin))
TokenTreeBuilder::tagged_op(input, (start, end, b.anchor))
})
}
@ -113,8 +113,8 @@ impl TokenTreeBuilder {
b.pos = end;
TokenTreeBuilder::tagged_string(
(inner_start, inner_end, b.origin),
(start, end, b.origin),
(inner_start, inner_end, b.anchor),
(start, end, b.anchor),
)
})
}
@ -130,7 +130,7 @@ impl TokenTreeBuilder {
let (start, end) = b.consume(&input);
b.pos = end;
TokenTreeBuilder::tagged_bare((start, end, b.origin))
TokenTreeBuilder::tagged_bare((start, end, b.anchor))
})
}
@ -145,7 +145,7 @@ impl TokenTreeBuilder {
let (start, end) = b.consume(&input);
b.pos = end;
TokenTreeBuilder::tagged_pattern((start, end, b.origin))
TokenTreeBuilder::tagged_pattern((start, end, b.anchor))
})
}
@ -160,7 +160,7 @@ impl TokenTreeBuilder {
let (start, end) = b.consume(&input);
b.pos = end;
TokenTreeBuilder::tagged_external_word((start, end, b.origin))
TokenTreeBuilder::tagged_external_word((start, end, b.anchor))
})
}
@ -180,8 +180,8 @@ impl TokenTreeBuilder {
b.pos = end;
TokenTreeBuilder::tagged_number(
RawNumber::Int((start, end, b.origin).into()),
(start, end, b.origin),
RawNumber::Int((start, end, b.anchor).into()),
(start, end, b.anchor),
)
})
}
@ -194,8 +194,8 @@ impl TokenTreeBuilder {
b.pos = end;
TokenTreeBuilder::tagged_number(
RawNumber::Decimal((start, end, b.origin).into()),
(start, end, b.origin),
RawNumber::Decimal((start, end, b.anchor).into()),
(start, end, b.anchor),
)
})
}
@ -214,8 +214,8 @@ impl TokenTreeBuilder {
b.pos = end_unit;
TokenTreeBuilder::tagged_size(
(RawNumber::Int((start_int, end_int, b.origin).into()), unit),
(start_int, end_unit, b.origin),
(RawNumber::Int((start_int, end_int, b.anchor).into()), unit),
(start_int, end_unit, b.anchor),
)
})
}
@ -244,7 +244,7 @@ impl TokenTreeBuilder {
let end = b.pos;
TokenTreeBuilder::tagged_path((head, output), (start, end, b.origin))
TokenTreeBuilder::tagged_path((head, output), (start, end, b.anchor))
})
}
@ -259,7 +259,7 @@ impl TokenTreeBuilder {
let (start, _) = b.consume("$");
let (inner_start, end) = b.consume(&input);
TokenTreeBuilder::tagged_var((inner_start, end, b.origin), (start, end, b.origin))
TokenTreeBuilder::tagged_var((inner_start, end, b.anchor), (start, end, b.anchor))
})
}
@ -274,7 +274,7 @@ impl TokenTreeBuilder {
let (start, _) = b.consume("--");
let (inner_start, end) = b.consume(&input);
TokenTreeBuilder::tagged_flag((inner_start, end, b.origin), (start, end, b.origin))
TokenTreeBuilder::tagged_flag((inner_start, end, b.anchor), (start, end, b.anchor))
})
}
@ -289,7 +289,7 @@ impl TokenTreeBuilder {
let (start, _) = b.consume("-");
let (inner_start, end) = b.consume(&input);
TokenTreeBuilder::tagged_shorthand((inner_start, end, b.origin), (start, end, b.origin))
TokenTreeBuilder::tagged_shorthand((inner_start, end, b.anchor), (start, end, b.anchor))
})
}
@ -302,7 +302,7 @@ impl TokenTreeBuilder {
Box::new(move |b| {
let (start, end) = b.consume(&input);
TokenTreeBuilder::tagged_member((start, end, b.origin))
TokenTreeBuilder::tagged_member((start, end, b.anchor))
})
}
@ -323,7 +323,7 @@ impl TokenTreeBuilder {
let end = b.pos;
TokenTreeBuilder::tagged_call(nodes, (start, end, b.origin))
TokenTreeBuilder::tagged_call(nodes, (start, end, b.anchor))
})
}
@ -350,7 +350,7 @@ impl TokenTreeBuilder {
let (_, end) = b.consume(")");
TokenTreeBuilder::tagged_parens(output, (start, end, b.origin))
TokenTreeBuilder::tagged_parens(output, (start, end, b.anchor))
})
}
@ -368,7 +368,7 @@ impl TokenTreeBuilder {
let (_, end) = b.consume("]");
TokenTreeBuilder::tagged_square(output, (start, end, b.origin))
TokenTreeBuilder::tagged_square(output, (start, end, b.anchor))
})
}
@ -386,7 +386,7 @@ impl TokenTreeBuilder {
let (_, end) = b.consume(" }");
TokenTreeBuilder::tagged_brace(output, (start, end, b.origin))
TokenTreeBuilder::tagged_brace(output, (start, end, b.anchor))
})
}
@ -397,7 +397,7 @@ impl TokenTreeBuilder {
pub fn sp() -> CurriedToken {
Box::new(|b| {
let (start, end) = b.consume(" ");
TokenNode::Whitespace(Tag::from((start, end, b.origin)))
TokenNode::Whitespace(Tag::from((start, end, b.anchor)))
})
}
@ -406,7 +406,7 @@ impl TokenTreeBuilder {
Box::new(move |b| {
let (start, end) = b.consume(&input);
TokenTreeBuilder::tagged_ws((start, end, b.origin))
TokenTreeBuilder::tagged_ws((start, end, b.anchor))
})
}
@ -425,6 +425,6 @@ impl TokenTreeBuilder {
let start = self.pos;
self.pos += input.len();
self.output.push_str(input);
(start, self.pos, self.origin).into()
(start, self.pos, self.anchor).into()
}
}

View File

@ -21,10 +21,10 @@ impl Plugin for BinaryView {
fn sink(&mut self, call_info: CallInfo, input: Vec<Tagged<Value>>) {
for v in input {
let value_origin = v.origin();
let value_anchor = v.anchor();
match v.item {
Value::Primitive(Primitive::Binary(b)) => {
let source = call_info.source_map.get(&value_origin);
let source = call_info.source_map.get(&value_anchor);
let _ = view_binary(&b, source, call_info.args.has("lores"));
}
_ => {}

View File

@ -186,15 +186,15 @@ mod tests {
};
struct CallStub {
origin: uuid::Uuid,
anchor: uuid::Uuid,
positionals: Vec<Tagged<Value>>,
flags: IndexMap<String, Tagged<Value>>,
}
impl CallStub {
fn new(origin: uuid::Uuid) -> CallStub {
fn new(anchor: uuid::Uuid) -> CallStub {
CallStub {
origin,
anchor,
positionals: vec![],
flags: indexmap::IndexMap::new(),
}
@ -210,7 +210,7 @@ mod tests {
fn with_parameter(&mut self, name: &str) -> &mut Self {
self.positionals
.push(Value::string(name.to_string()).tagged(Tag::unknown_span(self.origin)));
.push(Value::string(name.to_string()).tagged(Tag::unknown_span(self.anchor)));
self
}
@ -218,7 +218,7 @@ mod tests {
CallInfo {
args: EvaluatedArgs::new(Some(self.positionals.clone()), Some(self.flags.clone())),
source_map: SourceMap::new(),
name_tag: Tag::unknown_span(self.origin),
name_tag: Tag::unknown_span(self.anchor),
}
}
}

View File

@ -204,7 +204,7 @@ mod tests {
use num_bigint::BigInt;
struct CallStub {
origin: uuid::Uuid,
anchor: uuid::Uuid,
positionals: Vec<Tagged<Value>>,
flags: IndexMap<String, Tagged<Value>>,
}
@ -212,7 +212,7 @@ mod tests {
impl CallStub {
fn new() -> CallStub {
CallStub {
origin: uuid::Uuid::nil(),
anchor: uuid::Uuid::nil(),
positionals: vec![],
flags: indexmap::IndexMap::new(),
}
@ -236,7 +236,7 @@ mod tests {
CallInfo {
args: EvaluatedArgs::new(Some(self.positionals.clone()), Some(self.flags.clone())),
source_map: SourceMap::new(),
name_tag: Tag::unknown_span(self.origin),
name_tag: Tag::unknown_span(self.anchor),
}
}
}

View File

@ -216,10 +216,10 @@ fn scroll_view(s: &str) {
}
fn view_text_value(value: &Tagged<Value>, source_map: &SourceMap) {
let value_origin = value.origin();
let value_anchor = value.anchor();
match value.item {
Value::Primitive(Primitive::String(ref s)) => {
let source = source_map.get(&value_origin);
let source = source_map.get(&value_anchor);
if let Some(source) = source {
let extension: Option<String> = match source {

View File

@ -99,10 +99,10 @@ impl HelpShell {
impl Shell for HelpShell {
fn name(&self, source_map: &SourceMap) -> String {
let origin_name = self.value.origin_name(source_map);
let anchor_name = self.value.anchor_name(source_map);
format!(
"{}",
match origin_name {
match anchor_name {
Some(x) => format!("{{{}}}", x),
None => format!("<{}>", self.value.item.type_name(),),
}

View File

@ -73,10 +73,10 @@ impl ValueShell {
impl Shell for ValueShell {
fn name(&self, source_map: &SourceMap) -> String {
let origin_name = self.value.origin_name(source_map);
let anchor_name = self.value.anchor_name(source_map);
format!(
"{}",
match origin_name {
match anchor_name {
Some(x) => format!("{{{}}}", x),
None => format!("<{}>", self.value.item.type_name(),),
}