added frontend compile phase
This commit is contained in:
+12
-12
@@ -1,31 +1,31 @@
|
||||
package p.studio.compiler;
|
||||
|
||||
import p.studio.compiler.models.FrontendSpec;
|
||||
import p.studio.compiler.services.FrontendPhaseService;
|
||||
import p.studio.compiler.services.PBSFrontendPhaseService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class FrontendRegistryService {
|
||||
private static final FrontendSpec[] FRONTEND_SPECS = {
|
||||
PBSDefinitions.PBS,
|
||||
};
|
||||
|
||||
private static final Map<String, FrontendSpec> FRONTENDS = new HashMap<>();
|
||||
private static final Map<String, FrontendSpec> FRONTEND_SPECS = new HashMap<>();
|
||||
private static final Map<String, FrontendPhaseService> FRONTEND_PHASE_SERVICES = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (final var frontendSpec : FRONTEND_SPECS) {
|
||||
FRONTENDS.put(frontendSpec.getLanguageId(), frontendSpec);
|
||||
}
|
||||
if (FRONTENDS.size() != FRONTEND_SPECS.length)
|
||||
throw new IllegalStateException("Duplicate frontend specs found");
|
||||
FRONTEND_SPECS.put(PBSDefinitions.PBS.getLanguageId(), PBSDefinitions.PBS);
|
||||
FRONTEND_PHASE_SERVICES.put(PBSDefinitions.PBS.getLanguageId(), new PBSFrontendPhaseService());
|
||||
}
|
||||
|
||||
public static FrontendSpec getDefaultFrontendSpec() {
|
||||
return FRONTENDS.get(PBSDefinitions.PBS.getLanguageId());
|
||||
return FRONTEND_SPECS.get(PBSDefinitions.PBS.getLanguageId());
|
||||
}
|
||||
|
||||
public static Optional<FrontendSpec> getFrontendSpec(final String languageId) {
|
||||
return Optional.ofNullable(FRONTENDS.get(languageId));
|
||||
return Optional.ofNullable(FRONTEND_SPECS.get(languageId));
|
||||
}
|
||||
|
||||
public static Optional<FrontendPhaseService> getFrontendPhaseService(final String languageId) {
|
||||
return Optional.ofNullable(FRONTEND_PHASE_SERVICES.get(languageId));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user