Skip to content

Commit

Permalink
added type_id to instance node
Browse files Browse the repository at this point in the history
  • Loading branch information
warfaj committed Feb 13, 2024
1 parent d2c21ca commit 7ef9dd2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pax-compiler/templates/cartridge_generation/cartridge.tera
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ impl DefinitionToInstanceTraverser {
compute_properties_fn,
children: None,
template_node_id: 0,
component_type_id: type_id.to_string(),
}
}

Expand Down Expand Up @@ -334,6 +335,7 @@ impl DefinitionToInstanceTraverser {
compute_properties_fn: None,
children: Some(children),
template_node_id: tnd.id,
component_type_id: tnd.type_id.clone(),
})
},
"SLOT" => {
Expand All @@ -356,6 +358,7 @@ impl DefinitionToInstanceTraverser {
compute_properties_fn: None,
children: Some(children),
template_node_id: tnd.id,
component_type_id: tnd.type_id.clone(),
})
},
"REPEAT" => {
Expand Down Expand Up @@ -391,6 +394,7 @@ impl DefinitionToInstanceTraverser {
compute_properties_fn: None,
children: Some(children),
template_node_id: tnd.id,
component_type_id: tnd.type_id.clone(),
})
},
_ => {
Expand Down Expand Up @@ -454,6 +458,7 @@ impl DefinitionToInstanceTraverser {

args.children = Some(self.build_children(containing_component_type_id, node));
args.template_node_id = node.id;
args.component_type_id = node.type_id.clone();
node_component_factory.build_component(args)
}

Expand Down
3 changes: 3 additions & 0 deletions pax-runtime/src/rendering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub struct InstantiationArgs {
pub compute_properties_fn: Option<Box<dyn Fn(&ExpandedNode, &ExpressionTable, &Globals)>>,

pub template_node_id: usize,
pub component_type_id: String,
}

#[derive(Copy, Clone)]
Expand Down Expand Up @@ -290,6 +291,7 @@ pub struct BaseInstance {
pub instance_prototypical_common_properties_factory:
Box<dyn Fn() -> Rc<RefCell<CommonProperties>>>,
pub template_node_id: usize,
pub component_type_id: String,
instance_children: InstanceNodePtrList,
flags: InstanceFlags,
}
Expand Down Expand Up @@ -322,6 +324,7 @@ impl BaseInstance {
instance_children: args.children.unwrap_or_default(),
flags,
template_node_id: args.template_node_id,
component_type_id: args.component_type_id,
}
}

Expand Down

0 comments on commit 7ef9dd2

Please sign in to comment.