avoid unnecessary creation of empty containers

This commit is contained in:
Dmitry Jemerov
2015-06-03 14:48:06 +02:00
parent 109c09cf7c
commit 220403b6f6
7 changed files with 81 additions and 45 deletions
@@ -161,8 +161,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
// Since runtime package view descriptor doesn't support getAllDescriptors(), we construct a synthetic package view here.
// It has in its scope descriptors for all the classes and top level members generated by the compiler
val actual = SyntheticPackageViewForTest(module, packageScopes, classes)
return actual
return SyntheticPackageViewForTest(module, packageScopes, classes)
}
private fun addRuntimeRetentionToKotlinSource(text: String): String {
@@ -188,7 +187,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
val writableScope = WritableScopeImpl(JetScope.Empty, this, RedeclarationHandler.THROW_EXCEPTION, "runtime descriptor loader test")
classes.forEach { writableScope.addClassifierDescriptor(it) }
writableScope.changeLockLevel(WritableScope.LockLevel.READING)
scope = ChainedScope(null, "", *(listOf(writableScope) + packageScopes).toTypedArray())
scope = ChainedScope(this, "synthetic package view for test", writableScope, *packageScopes.toTypedArray())
}
override fun getFqName() = LoadDescriptorUtil.TEST_PACKAGE_FQNAME
@@ -625,7 +625,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
}
scopeChain.add(module.getPackage(FqName.ROOT).getMemberScope());
writableScope.changeLockLevel(WritableScope.LockLevel.BOTH);
return new ChainedScope(scope.getContainingDeclaration(), "", scopeChain.toArray(new JetScope[scopeChain.size()]));
return new ChainedScope(scope.getContainingDeclaration(), "JetTypeCheckerTest.addImports scope with imports", scopeChain.toArray(new JetScope[scopeChain.size()]));
}
private JetType makeType(String typeStr) {