mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-23 18:29:50 -04:00
FIX: Bug in dot_lookups
curr_val forms the basis of the scope search but it shouldn't be part of the lookup expression for the field.
This commit is contained in:
parent
7846c631d0
commit
1fbd1c0a50
@ -60,4 +60,11 @@ assert t.ok{
|
||||
assert t.not_ok{
|
||||
test = foo_check({bar="foo"}),
|
||||
desc = "we can check for absent foo string fields",
|
||||
};
|
||||
|
||||
let test_for_field = func(name, tpl) => (name) in tpl;
|
||||
|
||||
assert t.ok{
|
||||
test = test_for_field("name", {name="foo"}),
|
||||
desc = "bareword collisions with field names still works for `in` operator",
|
||||
};
|
@ -852,7 +852,10 @@ impl<'a> FileBuilder<'a> {
|
||||
scope.lookup_idx(right.pos(), &Val::Int(i.val))
|
||||
}
|
||||
_ => {
|
||||
let val = self.eval_expr(right, &scope)?;
|
||||
// We need to clear any curr_vals for the eval so we don't include them
|
||||
// in the scope for dot lookups.
|
||||
let eval_scope = scope.spawn_child();
|
||||
let val = self.eval_expr(right, &eval_scope)?;
|
||||
match val.as_ref() {
|
||||
Val::Int(i) => scope.lookup_idx(right.pos(), &Val::Int(*i)),
|
||||
Val::Str(ref s) => scope
|
||||
|
Loading…
x
Reference in New Issue
Block a user