Skip to content

Commit

Permalink
Adding recursion to owning types
Browse files Browse the repository at this point in the history
  • Loading branch information
ambiguousname committed Nov 15, 2024
1 parent 4232380 commit a2108a3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tool/src/demo_gen/terminus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,15 @@ impl<'ctx, 'tcx> RenderTerminusContext<'ctx, 'tcx> {
self.module_name.clone(),
self.relative_import_path.clone(),
));

let owned_type = format!("{}{}",
node.owning_param.as_ref().map(|o| {format!("{o}:")}).unwrap_or_default(),
param_name
);

let mut child = MethodDependency::new(
self.get_constructor_js(type_name.to_string(), method),
Some(param_name),
Some(owned_type),
);

let call = self.evaluate_constructor(method, &mut child);
Expand Down Expand Up @@ -439,8 +444,13 @@ impl<'ctx, 'tcx> RenderTerminusContext<'ctx, 'tcx> {
self.module_name.clone(),
self.relative_import_path.clone(),
));

let owned_type = format!("{}{}",
node.owning_param.as_ref().map(|o| {format!("{o}:")}).unwrap_or_default(),
param_name
);

let mut child = MethodDependency::new("".to_string(), Some(param_name));
let mut child = MethodDependency::new("".to_string(), Some(owned_type));

#[derive(Template)]
#[template(path = "demo_gen/struct.js.jinja", escape = "none")]
Expand Down

0 comments on commit a2108a3

Please sign in to comment.