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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ project = { path = "./compiler/plc_project/", package = "plc_project", features
] }
plc_xml = { path = "./compiler/plc_xml" }
test_utils = { path = "./tests/test_utils" }
plc_lowering = { path = "./compiler/plc_lowering" }
serial_test = "*"
tempfile = "3"
encoding_rs.workspace = true
Expand Down
8 changes: 6 additions & 2 deletions compiler/plc_ast/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,13 @@ impl AstVisitor for AstSerializer {
child.walk(self)
}

fn visit_exit_statement(&mut self, _node: &AstNode) {}
fn visit_exit_statement(&mut self, _node: &AstNode) {
self.result.push_str("EXIT;");
}

fn visit_continue_statement(&mut self, _node: &AstNode) {}
fn visit_continue_statement(&mut self, _node: &AstNode) {
self.result.push_str("CONTINUE;");
}

fn visit_return_statement(&mut self, stmt: &ReturnStatement, _node: &AstNode) {
stmt.walk(self)
Expand Down
6 changes: 5 additions & 1 deletion compiler/plc_driver/src/pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ use plc_header_generator::{
GenerateHeaderOptions,
};
use plc_index::GlobalContext;
use plc_lowering::{inheritance::InheritanceLowerer, retain::RetainParticipant};
use plc_lowering::{
control_statement::ControlStatementParticipant, inheritance::InheritanceLowerer,
retain::RetainParticipant,
};
use project::{
object::Object,
project::{LibraryInformation, Project},
Expand Down Expand Up @@ -300,6 +303,7 @@ impl<T: SourceContainer> BuildPipeline<T> {
self.context.provider(),
self.context.should_generate_external_constructors(),
)),
Box::new(ControlStatementParticipant::new(self.context.provider())),
Box::new(PropertyLowerer::new(self.context.provider())),
Box::new(RetainParticipant::new(self.context.provider())),
Box::new(AggregateTypeLowerer::new(self.context.provider())),
Expand Down
13 changes: 12 additions & 1 deletion compiler/plc_driver/src/pipelines/participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ use plc::{
use plc_diagnostics::diagnostics::Diagnostic;
use plc_lowering::{
retain::RetainParticipant,
{inheritance::InheritanceLowerer, initializer::Initializer},
{
control_statement::ControlStatementParticipant, inheritance::InheritanceLowerer,
initializer::Initializer,
},
};
use project::{object::Object, project::LibraryInformation};
use source_code::SourceContainer;
Expand Down Expand Up @@ -319,3 +322,11 @@ impl PipelineParticipantMut for RetainParticipant {
project.index(self.ids.clone())
}
}

impl PipelineParticipantMut for ControlStatementParticipant {
fn pre_index(&mut self, parsed_project: ParsedProject) -> ParsedProject {
let ParsedProject { mut units } = parsed_project;
self.lower_control_statements(&mut units);
ParsedProject { units }
}
}
Loading
Loading