always replace SELF when copying statements (#345)
This commit is contained in:
parent
5cdf53576b
commit
89dfc4e214
5 changed files with 12 additions and 14 deletions
|
|
@ -55,7 +55,7 @@ pub const HASH_SIZE: usize = 4;
|
|||
pub const VALUE_SIZE: usize = 4;
|
||||
|
||||
pub const EMPTY_VALUE: RawValue = RawValue([F::ZERO, F::ZERO, F::ZERO, F::ZERO]);
|
||||
pub const SELF_ID_HASH: Hash = Hash([F::ONE, F::ZERO, F::ZERO, F::ZERO]);
|
||||
pub const SELF_ID_HASH: Hash = Hash([F(0x5), F(0xe), F(0x1), F(0xf)]);
|
||||
pub const EMPTY_HASH: Hash = Hash([F::ZERO, F::ZERO, F::ZERO, F::ZERO]);
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
|
||||
|
|
|
|||
|
|
@ -766,7 +766,7 @@ impl Params {
|
|||
}
|
||||
}
|
||||
|
||||
/// Replace references to SELF by `self_id` in anchored keys of the statement.
|
||||
/// Replace references to SELF by `self_id`.
|
||||
pub fn normalize_statement(statement: &Statement, self_id: PodId) -> Statement {
|
||||
let predicate = statement.predicate();
|
||||
let args = statement
|
||||
|
|
@ -776,6 +776,9 @@ pub fn normalize_statement(statement: &Statement, self_id: PodId) -> Statement {
|
|||
StatementArg::Key(AnchoredKey { pod_id, key }) if *pod_id == SELF => {
|
||||
StatementArg::Key(AnchoredKey::new(self_id, key.clone()))
|
||||
}
|
||||
StatementArg::Literal(value) if value.raw.0 == SELF.0 .0 => {
|
||||
StatementArg::Literal(self_id.into())
|
||||
}
|
||||
_ => sa.clone(),
|
||||
})
|
||||
.collect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue