Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lhstrh committed Jun 30, 2024
1 parent acf31fe commit f2b80e6
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions core/src/main/java/org/lflang/generator/c/CGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -692,19 +692,21 @@ private boolean hasDeadlines(List<Reactor> reactors) {
}

/**
* Look at the 'reactor' eResource. If it is an imported .lf file, gather preambles and relevant
* target properties associated with imported reactors.
* If the given reactor is defined in another file, process its target properties so that they are
* reflected in the target configuration.
*/
private void inspectReactorEResource(ReactorDecl reactor) {
FileConfig fc =
LFGenerator.createFileConfig(
reactor.eResource(), fileConfig.getSrcGenBasePath(), fileConfig.useHierarchicalBin);

var targetDecl = GeneratorUtils.findTargetDecl(fc.resource);
this.context
.getTargetConfig()
.mergeImportedConfig(
fc.resource, this.fileConfig.resource, p -> p.loadFromImport(), this.messageReporter);
private void loadTargetProperties(Resource resource) {
if (resource != this.fileConfig.resource) {
this.context
.getTargetConfig()
.mergeImportedConfig(
LFGenerator.createFileConfig(
resource, fileConfig.getSrcGenBasePath(), fileConfig.useHierarchicalBin)
.resource,
this.fileConfig.resource,
p -> p.loadFromImport(),
this.messageReporter);
}
}

/**
Expand Down Expand Up @@ -824,7 +826,7 @@ private void generateReactorChildren(
if (r.reactorDeclaration != null && !generatedReactors.contains(newTpr)) {
generatedReactors.add(newTpr);
generateReactorChildren(r, generatedReactors);
inspectReactorEResource(r.reactorDeclaration);
loadTargetProperties(r.reactorDeclaration.eResource());
generateReactorClass(newTpr);
}
}
Expand Down

0 comments on commit f2b80e6

Please sign in to comment.