Get rid of getModuleName(), pass configuration to createContextWithSealedModule

Add KotlinTestUtils.newConfiguration() which creates a configuration and sets
the module name to the default test one ("test-module")
This commit is contained in:
Alexander Udalov
2016-05-23 14:19:50 +03:00
parent 69343549b7
commit c5e2f55ea7
15 changed files with 46 additions and 73 deletions
@@ -138,12 +138,14 @@ public enum TopDownAnalyzerFacadeForJVM {
}
@NotNull
public static MutableModuleContext createContextWithSealedModule(@NotNull Project project, @NotNull String moduleName) {
public static MutableModuleContext createContextWithSealedModule(
@NotNull Project project, @NotNull CompilerConfiguration configuration
) {
ProjectContext projectContext = ContextKt.ProjectContext(project);
JvmBuiltIns builtIns = new JvmBuiltIns(projectContext.getStorageManager());
MutableModuleContext context = ContextKt.ContextForNewModule(
projectContext, Name.special("<" + moduleName + ">"), JvmPlatform.INSTANCE,
builtIns
projectContext, Name.special("<" + configuration.getNotNull(JVMConfigurationKeys.MODULE_NAME) + ">"),
JvmPlatform.INSTANCE, builtIns
);
builtIns.setOwnerModuleDescriptor(context.getModule());
context.setDependencies(context.getModule(), context.getBuiltIns().getBuiltInsModule());