Fix layer validation call and entity parse

next
Sayan Nandan 1 year ago
parent ccfb7b2e12
commit d626f9a302
No known key found for this signature in database
GPG Key ID: 42EEDF4AE9D96B54

@ -246,16 +246,19 @@ impl Field {
} }
#[inline(always)] #[inline(always)]
fn compute_index(&self, dc: &Datacell) -> usize { fn compute_index(&self, dc: &Datacell) -> usize {
if ((!self.is_nullable()) & dc.is_null()) | (self.layers[0].tag.tag_class() != dc.kind()) { if {
((!self.is_nullable()) & dc.is_null())
| ((self.layers[0].tag.tag_class() != dc.kind()) & !dc.is_null())
} {
// illegal states: (1) bad null (2) tags don't match // illegal states: (1) bad null (2) tags don't match
7 7
} else { } else {
self.layers()[0].tag.tag_class().word() dc.kind().word()
} }
} }
pub fn validate_data_fpath(&self, data: &Datacell) -> bool { pub fn validate_data_fpath(&self, data: &Datacell) -> bool {
// if someone sends a PR with an added check, I'll personally come to your house and throw a brick on your head // if someone sends a PR with an added check, I'll personally come to your house and throw a brick on your head
if self.layers.len() == 1 { if (self.layers.len() == 1) | data.is_null() {
layertrace("fpath"); layertrace("fpath");
unsafe { unsafe {
// UNSAFE(@ohsayan): checked for non-null, and used correct class // UNSAFE(@ohsayan): checked for non-null, and used correct class

@ -384,7 +384,7 @@ impl<'a> Entity<'a> {
/// Caller guarantees that the token stream matches the exact stream of tokens /// Caller guarantees that the token stream matches the exact stream of tokens
/// expected for a full entity /// expected for a full entity
pub(super) unsafe fn full_entity_from_slice(sl: &'a [Token]) -> Self { pub(super) unsafe fn full_entity_from_slice(sl: &'a [Token]) -> Self {
Entity::Full(sl[0].uck_read_ident(), sl[1].uck_read_ident()) Entity::Full(sl[0].uck_read_ident(), sl[2].uck_read_ident())
} }
#[inline(always)] #[inline(always)]
/// Parse a single entity from the given slice /// Parse a single entity from the given slice

Loading…
Cancel
Save