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:
parent
e1d2589163
commit
023e372583
5 changed files with 24 additions and 5 deletions
|
|
@ -973,9 +973,16 @@ impl Compiler<'_> {
|
|||
/// cases.
|
||||
fn compile_param_pattern(&mut self, pattern: &ast::Pattern) -> (Formals, CodeIdx) {
|
||||
let span = self.span_for(pattern);
|
||||
let set_idx = match pattern.pat_bind() {
|
||||
Some(name) => self.declare_local(&name, name.ident().unwrap().to_string()),
|
||||
None => self.scope_mut().declare_phantom(span, true),
|
||||
|
||||
let (set_idx, pat_bind_name) = match pattern.pat_bind() {
|
||||
Some(name) => {
|
||||
let pat_bind_name = name.ident().unwrap().to_string();
|
||||
(
|
||||
self.declare_local(&name, pat_bind_name.clone()),
|
||||
Some(pat_bind_name),
|
||||
)
|
||||
}
|
||||
None => (self.scope_mut().declare_phantom(span, true), None),
|
||||
};
|
||||
|
||||
// At call time, the attribute set is already at the top of the stack.
|
||||
|
|
@ -1126,6 +1133,7 @@ impl Compiler<'_> {
|
|||
arguments,
|
||||
ellipsis,
|
||||
span,
|
||||
name: pat_bind_name,
|
||||
}),
|
||||
throw_idx,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue