feat(tvix/eval): track pattern binding names

These need to be preserved at least for builtins.toXML.

Also, we incorrectly only wrote an <attrspat> in case ellipsis was true,
but that's not the case.

Change-Id: I6bff9c47c2922f878d5c43e48280cda9c9ddb692
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10686
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: aspen <root@gws.fyi>
This commit is contained in:
Florian Klink 2024-01-23 15:34:38 +02:00 committed by clbot
parent e1d2589163
commit 023e372583
5 changed files with 24 additions and 5 deletions

View file

@ -90,15 +90,22 @@ fn value_variant_to_xml<W: Write>(w: &mut EventWriter<W>, value: &Value) -> Resu
match &c.lambda.formals {
Some(formals) => {
let mut attrspat = XmlEvent::start_element("attrspat");
if formals.ellipsis {
w.write(XmlEvent::start_element("attrspat").attr("ellipsis", "1"))?;
w.write(XmlEvent::end_element())?;
attrspat = attrspat.attr("ellipsis", "1");
}
if let Some(ref name) = &formals.name {
attrspat = attrspat.attr("name", name.as_str());
}
w.write(attrspat)?;
for arg in formals.arguments.iter() {
w.write(XmlEvent::start_element("attr").attr("name", arg.0.as_str()))?;
w.write(XmlEvent::end_element())?;
}
w.write(XmlEvent::end_element())?;
}
None => {
// TODO(tazjin): tvix does not currently persist function