new test main with code directly (fixes)
This commit is contained in:
+19
-1
@@ -16,6 +16,8 @@ import java.util.LinkedHashSet;
|
||||
@Builder
|
||||
@Getter
|
||||
public class IRBackend {
|
||||
@Builder.Default
|
||||
private final String entryPointCallableName = "main";
|
||||
@Builder.Default
|
||||
private final ReadOnlyList<IRFunction> functions = ReadOnlyList.empty();
|
||||
@Builder.Default
|
||||
@@ -32,6 +34,7 @@ public class IRBackend {
|
||||
}
|
||||
|
||||
public static final class IRBackendAggregator {
|
||||
private String entryPointCallableName;
|
||||
private final ArrayList<IRFunction> functions = new ArrayList<>();
|
||||
private final ArrayList<IRBackendExecutableFunction> executableFunctions = new ArrayList<>();
|
||||
private final CallableTable callableTable = new CallableTable();
|
||||
@@ -58,6 +61,13 @@ public class IRBackend {
|
||||
requiredCapabilities.addAll(metadata.requiredCapabilities().asList());
|
||||
}
|
||||
|
||||
public IRBackendAggregator entryPointCallableName(final String callableName) {
|
||||
if (callableName != null && !callableName.isBlank()) {
|
||||
entryPointCallableName = callableName;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private CallableId[] reindexCallables(final ReadOnlyList<CallableSignatureRef> localCallableSignatures) {
|
||||
if (localCallableSignatures == null || localCallableSignatures.isEmpty()) {
|
||||
return new CallableId[0];
|
||||
@@ -170,6 +180,7 @@ public class IRBackend {
|
||||
public IRBackend emit() {
|
||||
return IRBackend
|
||||
.builder()
|
||||
.entryPointCallableName(resolveEntryPointCallableName())
|
||||
.functions(ReadOnlyList.wrap(functions))
|
||||
.executableFunctions(ReadOnlyList.wrap(executableFunctions))
|
||||
.callableSignatures(emitCallableSignatures())
|
||||
@@ -181,12 +192,19 @@ public class IRBackend {
|
||||
ReadOnlyList.wrap(requiredCapabilities.stream().toList())))
|
||||
.build();
|
||||
}
|
||||
|
||||
private String resolveEntryPointCallableName() {
|
||||
return entryPointCallableName == null || entryPointCallableName.isBlank()
|
||||
? "main"
|
||||
: entryPointCallableName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final var sb = new StringBuilder();
|
||||
sb.append("IRBackend{functions=").append(functions.size())
|
||||
sb.append("IRBackend{entrypoint=").append(entryPointCallableName)
|
||||
.append(", functions=").append(functions.size())
|
||||
.append(", executableFunctions=").append(executableFunctions.size())
|
||||
.append(", callableSignatures=").append(callableSignatures.size())
|
||||
.append(", intrinsicPool=").append(intrinsicPool.size())
|
||||
|
||||
Reference in New Issue
Block a user