implements PR006.1
This commit is contained in:
+1
@@ -2,6 +2,7 @@ package p.studio.compiler.pbs.linking;
|
||||
|
||||
public enum PbsLinkErrors {
|
||||
E_LINK_MISSING_BARREL,
|
||||
E_LINK_INVALID_BARREL_FILENAME,
|
||||
E_LINK_DUPLICATE_BARREL_FILE,
|
||||
E_LINK_DUPLICATE_BARREL_ENTRY,
|
||||
E_LINK_UNRESOLVED_BARREL_ENTRY,
|
||||
|
||||
+1
@@ -215,6 +215,7 @@ public final class PbsModuleVisibilityValidator {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO(pbs-interface-modules): include top-level host declarations when interface-module mode is added.
|
||||
if (topDecl instanceof PbsAst.StructDecl structDecl) {
|
||||
registerNonFunctionDeclaration(declarations, NonFunctionKind.STRUCT, structDecl.name(), structDecl.span(), nameTable);
|
||||
} else if (topDecl instanceof PbsAst.ContractDecl contractDecl) {
|
||||
|
||||
+8
@@ -9,14 +9,17 @@ import p.studio.compiler.models.SourceHandle;
|
||||
import p.studio.compiler.pbs.PbsFrontendCompiler;
|
||||
import p.studio.compiler.pbs.ast.PbsAst;
|
||||
import p.studio.compiler.pbs.lexer.PbsLexer;
|
||||
import p.studio.compiler.pbs.linking.PbsLinkErrors;
|
||||
import p.studio.compiler.pbs.linking.PbsModuleVisibilityValidator;
|
||||
import p.studio.compiler.pbs.parser.PbsBarrelParser;
|
||||
import p.studio.compiler.pbs.parser.PbsParser;
|
||||
import p.studio.compiler.source.Span;
|
||||
import p.studio.compiler.source.diagnostics.DiagnosticSink;
|
||||
import p.studio.compiler.source.identifiers.FileId;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
import p.studio.utilities.logs.LogAggregator;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -59,6 +62,11 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
|
||||
if ("mod.barrel".equals(sourceHandle.getFilename())) {
|
||||
final var barrelAst = parseBarrelFile(fId, utf8Content, diagnostics);
|
||||
moduleUnit.barrels.add(new PbsModuleVisibilityValidator.BarrelFile(fId, barrelAst));
|
||||
} else {
|
||||
diagnostics.error(
|
||||
PbsLinkErrors.E_LINK_INVALID_BARREL_FILENAME.name(),
|
||||
"Only 'mod.barrel' is allowed as barrel filename",
|
||||
new Span(fId, 0, utf8Content.getBytes(StandardCharsets.UTF_8).length));
|
||||
}
|
||||
}
|
||||
default -> {
|
||||
|
||||
Reference in New Issue
Block a user