get common edge (#5869)

* get common edge

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fmt

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add get common edge

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-03-19 15:12:27 -07:00
committed by GitHub
parent a7e09a89ef
commit b54295f2f7
10 changed files with 507 additions and 258 deletions

View File

@ -144,7 +144,7 @@ impl Args {
KclError::Type(KclErrorDetails {
source_ranges: vec![self.source_range],
message: format!(
"The optional arg {label} was given, but it was the wrong type. It should be type {} but it was {}",
"The arg {label} was given, but it was the wrong type. It should be type {} but it was {}",
type_name::<T>(),
arg.value.human_friendly_type(),
),
@ -423,7 +423,7 @@ impl Args {
// Run flush.
// Yes, we do need to actually flush the batch here, or references will fail later.
self.ctx.engine.flush_batch(false, SourceRange::default()).await?;
self.ctx.engine.flush_batch(false, self.source_range).await?;
Ok(())
}
@ -972,6 +972,22 @@ impl<'a> FromKclValue<'a> for TagIdentifier {
}
}
impl<'a> FromKclValue<'a> for Vec<TagIdentifier> {
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
match arg {
KclValue::HomArray { value, .. } => {
let tags = value.iter().map(|v| v.get_tag_identifier().unwrap()).collect();
Some(tags)
}
KclValue::MixedArray { value, .. } => {
let tags = value.iter().map(|v| v.get_tag_identifier().unwrap()).collect();
Some(tags)
}
_ => None,
}
}
}
impl<'a> FromKclValue<'a> for KclValue {
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
Some(arg.clone())