implements PR-O4.1

This commit is contained in:
2026-03-24 13:42:28 +00:00
parent bbcb65b048
commit d4f6d96437
15 changed files with 404 additions and 56 deletions
@@ -3,6 +3,7 @@ package p.studio.compiler.models;
import org.junit.jupiter.api.Test;
import p.studio.compiler.source.Span;
import p.studio.compiler.source.identifiers.FileId;
import p.studio.compiler.source.tables.CallableSignatureRef;
import p.studio.utilities.structures.ReadOnlyList;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -25,6 +26,7 @@ class IRBackendExecutableContractTest {
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
"app/main",
"foo",
7,
null,
null,
Span.none());
@@ -37,6 +39,7 @@ class IRBackendExecutableContractTest {
new FileId(1),
"app",
"main",
1,
10,
5,
0,
@@ -50,6 +53,7 @@ class IRBackendExecutableContractTest {
new FileId(1),
"app",
"main",
1,
0,
10,
0,
@@ -67,6 +71,7 @@ class IRBackendExecutableContractTest {
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
"app/main",
"foo",
1,
new IRBackendExecutableFunction.HostCallMetadata("gfx", "draw", 1, 0, 0),
null,
Span.none()));
@@ -87,6 +92,7 @@ class IRBackendExecutableContractTest {
"",
null,
null,
null,
"",
"",
null,
@@ -99,6 +105,7 @@ class IRBackendExecutableContractTest {
"",
null,
null,
null,
"",
"",
null,
@@ -116,6 +123,7 @@ class IRBackendExecutableContractTest {
"app/main",
"entry",
0,
0,
10,
0,
0,
@@ -127,9 +135,11 @@ class IRBackendExecutableContractTest {
"",
null,
null,
null,
Span.none())),
Span.none())),
IRReservedMetadata.empty());
IRReservedMetadata.empty(),
ReadOnlyList.from(new CallableSignatureRef("app/main", "entry", 0, "() -> unit")));
final var fileB = new IRBackendFile(
new FileId(2),
ReadOnlyList.empty(),
@@ -137,6 +147,7 @@ class IRBackendExecutableContractTest {
new FileId(2),
"app/main",
"aux",
0,
11,
20,
0,
@@ -149,9 +160,11 @@ class IRBackendExecutableContractTest {
"",
null,
null,
null,
Span.none())),
Span.none())),
IRReservedMetadata.empty());
IRReservedMetadata.empty(),
ReadOnlyList.from(new CallableSignatureRef("app/main", "aux", 0, "() -> unit")));
final var aggregator = IRBackend.aggregator();
aggregator.merge(fileA);
@@ -161,5 +174,6 @@ class IRBackendExecutableContractTest {
assertEquals(2, backend.getExecutableFunctions().size());
assertEquals("entry", backend.getExecutableFunctions().get(0).callableName());
assertEquals("aux", backend.getExecutableFunctions().get(1).callableName());
assertEquals(2, backend.getCallableSignatures().size());
}
}