More scoping

This commit is contained in:
LeoDog896 2021-03-23 20:13:15 -04:00
parent b5728e2255
commit e9a5389680

View File

@ -312,19 +312,19 @@ public class ExtensionManager {
@NotNull
private List<DiscoveredExtension> generateLoadOrder(@NotNull List<DiscoveredExtension> discoveredExtensions) {
// Do some mapping so we can map strings to extensions.
// Extension --> Extensions it depends on.
Map<DiscoveredExtension, List<DiscoveredExtension>> dependencyMap = new HashMap<>();
// Put dependencies in dependency map
{
Map<String, DiscoveredExtension> extensionMap = new HashMap<>();
// go through all the discovered extensions and assign their name in a map.
for (DiscoveredExtension discoveredExtension : discoveredExtensions) {
extensionMap.put(discoveredExtension.getName().toLowerCase(), discoveredExtension);
}
allExtensions:
// label the loop
allExtensions: // go through all the discovered extensions and get their dependencies as extensions
for (DiscoveredExtension discoveredExtension : discoveredExtensions) {
List<DiscoveredExtension> dependencies = new ArrayList<>(discoveredExtension.getDependencies().length);
@ -366,9 +366,11 @@ public class ExtensionManager {
}
}
// List containing the real load order.
// List containing the load order.
LinkedList<DiscoveredExtension> sortedList = new LinkedList<>();
// TODO actually have to read this
{
// entries with empty lists
List<Map.Entry<DiscoveredExtension, List<DiscoveredExtension>>> loadableExtensions;
@ -392,6 +394,7 @@ public class ExtensionManager {
}
}
}
}
// Check if there are cyclic extensions.
if (!dependencyMap.isEmpty()) {