Skip to content

Commit ffc3079

Browse files
committed
ImportManager: importing module should be in cache as well
Suppose we have this situation: * circular1.egl imports circular2.egl. * circular2.egl imports circular1.egl. * We load and parse circular1.egl as the root module. In this scenario, we want circular1.egl to be in the ImportManager cache before parsing circular2.egl, so that it will be reused when parsing circular2.egl. This prevents the creation of a throwaway EglModule while parsing circular2.egl (which is not used anyway, due to the loop over the ancestors which is done in Import::load).
1 parent 9a0b5f0 commit ffc3079

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plugins/org.eclipse.epsilon.eol.engine/src/org/eclipse/epsilon/eol/ImportManager.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ public class ImportManager implements IImportManager {
2424

2525
@Override
2626
public void loadModuleForImport(Import import_, Class<? extends IModule> moduleImplClass, URI baseURI) throws URISyntaxException {
27-
String importPath = import_.getPath();
27+
/*
28+
* The cache should contain the importing module as well,
29+
* to reuse modules in the presence of dependency cycles.
30+
*/
31+
cache.put(baseURI, import_.getParentModule());
2832

33+
final String importPath = import_.getPath();
2934
final URI importUri = UriUtil.resolve(importPath, baseURI).normalize();
3035
final IEolModule parentModule = import_.getParentModule();
3136

0 commit comments

Comments
 (0)