mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Special cases of refs to data (#41)
1. Numeric indices will be converted to strings for refs beginning with `data` if there is not valid numeric key 2. Error out if input document already contains value for a ref Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
02c6c6b827
commit
1c492144b3
+4
-1
@@ -331,6 +331,9 @@ impl Value {
|
||||
}
|
||||
|
||||
pub fn merge(&mut self, mut new: Value) -> Result<()> {
|
||||
if self == &new {
|
||||
return Ok(());
|
||||
}
|
||||
match (self, &mut new) {
|
||||
(v @ Value::Undefined, _) => *v = new,
|
||||
(Value::Set(ref mut set), Value::Set(new)) => {
|
||||
@@ -351,7 +354,7 @@ impl Value {
|
||||
};
|
||||
}
|
||||
}
|
||||
_ => bail!("internal error: could not merge value"),
|
||||
_ => bail!("error: could not merge value"),
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user