Skip to content

Commit

Permalink
Fix the preamble generator
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed Nov 30, 2024
1 parent a7d9dc4 commit 344a310
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ class UcPreambleGenerator(
private val reactor: Reactor,
) {
fun generateReactorPrivatePreamble() = reactor.preambles.joinToString(prefix= "// Private preambles\n", separator = "\n", postfix = "\n") { it.code.toText()}
fun generateReactorPublicPreamble() = resource.model.preambles.joinToString(prefix = "// Public preambles ", separator = "\n", postfix = "\n") {it.code.toText()}
fun generateReactorPublicPreamble() = resource.model.preambles.joinToString(prefix = "// Public preambles\n", separator = "\n", postfix = "\n") {it.code.toText()}
}
4 changes: 4 additions & 0 deletions test/lf/src/Preamble.lf
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
target uC

preamble {=
static int test2 = 32;
=}

main reactor {
preamble {=
static int test = 42;
=}
reaction(startup) {=
validate(test == 42);
validate(test2 == 32);
=}
}

0 comments on commit 344a310

Please sign in to comment.