mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
FIX: presence checks for tuples with NULL values works now.
This commit is contained in:
parent
599ed31414
commit
5b05405618
@ -178,4 +178,9 @@ assert {
|
|||||||
assert {
|
assert {
|
||||||
ok = NULL != "string",
|
ok = NULL != "string",
|
||||||
desc = "Strings are comparable to null",
|
desc = "Strings are comparable to null",
|
||||||
|
};
|
||||||
|
|
||||||
|
assert {
|
||||||
|
ok = (foo in {foo = NULL}),
|
||||||
|
desc = "Null valued fields are still present in tuple",
|
||||||
};
|
};
|
@ -780,6 +780,7 @@ impl<'a> FileBuilder<'a> {
|
|||||||
Expression::Copy(_) => return self.eval_expr(right, scope),
|
Expression::Copy(_) => return self.eval_expr(right, scope),
|
||||||
Expression::Call(_) => return self.eval_expr(right, scope),
|
Expression::Call(_) => return self.eval_expr(right, scope),
|
||||||
Expression::Simple(Value::Symbol(ref s)) => {
|
Expression::Simple(Value::Symbol(ref s)) => {
|
||||||
|
let scope = scope.clone().use_curr_val();
|
||||||
scope
|
scope
|
||||||
.lookup_sym(s, true)
|
.lookup_sym(s, true)
|
||||||
.ok_or(Box::new(error::BuildError::new(
|
.ok_or(Box::new(error::BuildError::new(
|
||||||
@ -789,6 +790,7 @@ impl<'a> FileBuilder<'a> {
|
|||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
Expression::Simple(Value::Str(ref s)) => {
|
Expression::Simple(Value::Str(ref s)) => {
|
||||||
|
let scope = scope.clone().use_curr_val();
|
||||||
scope
|
scope
|
||||||
.lookup_sym(s, false)
|
.lookup_sym(s, false)
|
||||||
.ok_or(Box::new(error::BuildError::new(
|
.ok_or(Box::new(error::BuildError::new(
|
||||||
@ -904,6 +906,7 @@ impl<'a> FileBuilder<'a> {
|
|||||||
fn eval_binary(&self, def: &BinaryOpDef, scope: &Scope) -> Result<Rc<Val>, Box<dyn Error>> {
|
fn eval_binary(&self, def: &BinaryOpDef, scope: &Scope) -> Result<Rc<Val>, Box<dyn Error>> {
|
||||||
let kind = &def.kind;
|
let kind = &def.kind;
|
||||||
if let &BinaryExprType::IN = kind {
|
if let &BinaryExprType::IN = kind {
|
||||||
|
// TODO Should we support this operation on strings too?
|
||||||
return self.do_element_check(&def.left, &def.right, scope);
|
return self.do_element_check(&def.left, &def.right, scope);
|
||||||
};
|
};
|
||||||
let left = self.eval_expr(&def.left, scope)?;
|
let left = self.eval_expr(&def.left, scope)?;
|
||||||
|
@ -56,6 +56,11 @@ impl Scope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn use_curr_val(mut self) -> Self {
|
||||||
|
self.search_curr_val = true;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Spawn a child scope based on the current scope but without the current
|
/// Spawn a child scope based on the current scope but without the current
|
||||||
/// val set.
|
/// val set.
|
||||||
pub fn spawn_child(&self) -> Self {
|
pub fn spawn_child(&self) -> Self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user