Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions compiler/plc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,16 @@ impl Default for VariableBlock {

impl Debug for VariableBlock {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct("VariableBlock")
.field("variables", &self.variables)
.field("variable_block_type", &self.kind)
.finish()
let mut result = f.debug_struct("VariableBlock");
result.field("variables", &self.variables).field("variable_block_type", &self.kind);

if self.constant {
result.field("constant", &self.constant);
}
if self.retain {
result.field("retain", &self.retain);
}
result.finish()
}
}

Expand Down
3 changes: 2 additions & 1 deletion compiler/plc_driver/src/pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use plc_header_generator::{
GenerateHeaderOptions,
};
use plc_index::GlobalContext;
use plc_lowering::inheritance::InheritanceLowerer;
use plc_lowering::{inheritance::InheritanceLowerer, retain::RetainParticipant};
use project::{
object::Object,
project::{LibraryInformation, Project},
Expand Down Expand Up @@ -301,6 +301,7 @@ impl<T: SourceContainer> BuildPipeline<T> {
self.context.should_generate_external_constructors(),
)),
Box::new(PropertyLowerer::new(self.context.provider())),
Box::new(RetainParticipant::new(self.context.provider())),
Box::new(AggregateTypeLowerer::new(self.context.provider())),
Box::new(InheritanceLowerer::new(self.context.provider())),
Box::new(InitParticipant::new(
Expand Down
14 changes: 13 additions & 1 deletion compiler/plc_driver/src/pipelines/participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ use plc::{
ConfigFormat, OnlineChange, Target,
};
use plc_diagnostics::diagnostics::Diagnostic;
use plc_lowering::{inheritance::InheritanceLowerer, initializer::Initializer};
use plc_lowering::{
retain::RetainParticipant,
{inheritance::InheritanceLowerer, initializer::Initializer},
};
use project::{object::Object, project::LibraryInformation};
use source_code::SourceContainer;

Expand Down Expand Up @@ -307,3 +310,12 @@ impl PipelineParticipantMut for PolymorphismLowerer {
project.index(self.ids.clone()).annotate(self.ids.clone())
}
}

impl PipelineParticipantMut for RetainParticipant {
fn post_index(&mut self, indexed_project: IndexedProject) -> IndexedProject {
let IndexedProject { mut project, index, .. } = indexed_project;
self.lower_retain(&mut project.units, index);
//Re-index
project.index(self.ids.clone())
}
}
1 change: 1 addition & 0 deletions compiler/plc_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use plc_ast::{ast::AstNode, provider::IdProvider};

pub mod inheritance;
pub mod initializer;
pub mod retain;
#[cfg(test)]
mod tests;

Expand Down
Loading
Loading