added frontend compile phase
This commit is contained in:
@@ -5,5 +5,6 @@ plugins {
|
||||
dependencies {
|
||||
implementation(project(":prometeu-infra"))
|
||||
|
||||
implementation(project(":prometeu-compiler:prometeu-frontend-api"))
|
||||
implementation(project(":prometeu-compiler:prometeu-compiler-core"))
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package p.studio.compiler.services;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.messages.FrontendPhaseContext;
|
||||
import p.studio.compiler.models.IRBackend;
|
||||
import p.studio.utilities.logs.LogAggregator;
|
||||
|
||||
@Slf4j
|
||||
public class PBSFrontendPhaseService implements FrontendPhaseService {
|
||||
@Override
|
||||
public IRBackend compile(final FrontendPhaseContext ctx, final LogAggregator logs, final BuildingIssueSink issues) {
|
||||
for (final var pId : ctx.stack.reverseTopologicalOrder) {
|
||||
for (final var fId : ctx.fileTable.getFiles(pId)) {
|
||||
final var sourceHandle = ctx.fileTable.get(fId);
|
||||
sourceHandle.readUtf8().ifPresentOrElse(
|
||||
utf8Content -> logs.using(log).info("File content: %s".formatted(utf8Content)),
|
||||
() -> issues.report(builder -> builder
|
||||
.error(true)
|
||||
.message("Failed to read file content: %s".formatted(sourceHandle.toString()))));
|
||||
}
|
||||
}
|
||||
return new IRBackend();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user