implements PR022

This commit is contained in:
2026-03-24 13:42:22 +00:00
parent 05258c5363
commit 213c6a2f76
6 changed files with 72 additions and 3 deletions
@@ -6,6 +6,7 @@ import p.studio.compiler.messages.FrontendPhaseContext;
import p.studio.compiler.models.IRBackend;
import p.studio.compiler.models.ProjectDescriptor;
import p.studio.compiler.models.SourceHandle;
import p.studio.compiler.models.SourceKind;
import p.studio.compiler.pbs.PbsFrontendCompiler;
import p.studio.compiler.pbs.ast.PbsAst;
import p.studio.compiler.pbs.lexer.PbsLexer;
@@ -48,6 +49,7 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
for (final var pId : ctx.stack.reverseTopologicalOrder) {
final var projectDescriptor = ctx.projectTable.get(pId);
final var projectSourceKind = ctx.sourceKind(pId);
final var fileIds = ctx.fileTable.getFiles(pId);
for (final var fId : fileIds) {
@@ -65,7 +67,7 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
final var parseErrorBaseline = diagnostics.errorCount();
final var ast = parseSourceFile(fId, utf8Content, diagnostics);
moduleUnit.sources.add(new PbsModuleVisibilityValidator.SourceFile(fId, ast));
parsedSourceFiles.add(new ParsedSourceFile(fId, ast, moduleKey));
parsedSourceFiles.add(new ParsedSourceFile(fId, ast, moduleKey, projectSourceKind));
if (diagnostics.errorCount() > parseErrorBaseline) {
failedModuleKeys.add(moduleKey);
}
@@ -114,6 +116,9 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
continue;
}
final var irBackendFile = frontendCompiler.compileParsedFile(parsedSource.fileId(), parsedSource.ast(), diagnostics);
if (parsedSource.sourceKind() == SourceKind.SDK_INTERFACE) {
continue;
}
irBackendAggregator.merge(irBackendFile);
}
@@ -197,6 +202,7 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
private record ParsedSourceFile(
FileId fileId,
PbsAst.File ast,
String moduleKey) {
String moduleKey,
SourceKind sourceKind) {
}
}