fixed more filtering issues and promoted enum condition generation
This commit is contained in:
@ -191,9 +191,10 @@ impl Database {
|
||||
}
|
||||
|
||||
pub fn compile(&mut self, errors: &mut Vec<crate::drop::Error>) {
|
||||
// Phase 1: Registration
|
||||
self.collect_schemas(errors);
|
||||
|
||||
// Formally evaluate properties with strict 3-pass Ordered Graph execution natively
|
||||
// Phase 2: Formally evaluate properties with strict 3-pass Ordered Graph execution natively
|
||||
for (_, enum_def) in &self.enums {
|
||||
for (schema_id, schema_arc) in &enum_def.schemas {
|
||||
let root_id = schema_id.split('/').next().unwrap_or(schema_id);
|
||||
@ -219,7 +220,25 @@ impl Database {
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 2: Synthesize Composed Filter References
|
||||
// Phase 3: Synthesize Virtual Boundaries
|
||||
let mut compile_ids = self.compile_filters(errors);
|
||||
let mut condition_ids = self.compile_conditions();
|
||||
compile_ids.append(&mut condition_ids);
|
||||
|
||||
// Phase 4: Compile Virtual Boundaries
|
||||
// Now actively compile the newly injected schemas to lock all nested compose references natively
|
||||
for (_, id) in compile_ids {
|
||||
if let Some(schema_arc) = self.schemas.get(&id).cloned() {
|
||||
let root_id = id.split('/').next().unwrap_or(&id);
|
||||
schema_arc
|
||||
.as_ref()
|
||||
.compile(self, root_id, id.clone(), errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Synthesizes Composed Filter References for all table-backed boundaries.
|
||||
fn compile_filters(&mut self, errors: &mut Vec<crate::drop::Error>) -> Vec<(String, String)> {
|
||||
let mut filter_schemas = Vec::new();
|
||||
for (type_name, type_def) in &self.types {
|
||||
for (id, schema_arc) in &type_def.schemas {
|
||||
@ -246,21 +265,30 @@ impl Database {
|
||||
t.schemas.insert(id, filter_arc);
|
||||
}
|
||||
}
|
||||
filter_ids
|
||||
}
|
||||
|
||||
// Now actively compile the newly injected filters to lock all nested compose references natively
|
||||
for (type_name, id) in filter_ids {
|
||||
if let Some(filter_arc) = self
|
||||
.types
|
||||
.get(&type_name)
|
||||
.and_then(|t| t.schemas.get(&id))
|
||||
.cloned()
|
||||
{
|
||||
let root_id = id.split('/').next().unwrap_or(&id);
|
||||
filter_arc
|
||||
.as_ref()
|
||||
.compile(self, root_id, id.clone(), errors);
|
||||
/// Synthesizes strong Enum Conditions mirroring the string.condition capabilities.
|
||||
fn compile_conditions(&mut self) -> Vec<(String, String)> {
|
||||
let mut enum_conditions = Vec::new();
|
||||
for (enum_name, enum_def) in &self.enums {
|
||||
let cond_schema = enum_def.compile_condition();
|
||||
enum_conditions.push((
|
||||
enum_name.clone(),
|
||||
format!("{}.condition", enum_name),
|
||||
Arc::new(cond_schema),
|
||||
));
|
||||
}
|
||||
|
||||
let mut condition_ids = Vec::new();
|
||||
for (enum_name, id, cond_arc) in enum_conditions {
|
||||
condition_ids.push((enum_name.clone(), id.clone()));
|
||||
self.schemas.insert(id.clone(), cond_arc.clone());
|
||||
if let Some(e) = self.enums.get_mut(&enum_name) {
|
||||
e.schemas.insert(id.clone(), cond_arc.clone());
|
||||
}
|
||||
}
|
||||
condition_ids
|
||||
}
|
||||
|
||||
fn collect_schemas(&mut self, errors: &mut Vec<crate::drop::Error>) {
|
||||
|
||||
Reference in New Issue
Block a user