Remove some usages of KotlinBuiltIns.getInstance()

Introduce DeclarationDescriptor.builtIns extension to get builtins where descriptors are available
Introduce various utilities in KotlinBuiltIns to check for primitive types and get fq names of builtins
This commit is contained in:
Pavel V. Talanov
2015-04-23 15:40:16 +03:00
parent 21d9c272c9
commit ac2cb9af74
71 changed files with 334 additions and 288 deletions
@@ -156,7 +156,7 @@ public class InjectorForTopDownAnalyzerForJs {
this.argumentTypeResolver = new ArgumentTypeResolver();
this.expressionTypingComponents = new ExpressionTypingComponents();
this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents);
this.callExpressionResolver = new CallExpressionResolver(callResolver);
this.callExpressionResolver = new CallExpressionResolver(callResolver, kotlinBuiltIns);
this.controlStructureTypingUtils = new ControlStructureTypingUtils(callResolver);
this.descriptorResolver = new DescriptorResolver();
this.delegatedPropertyResolver = new DelegatedPropertyResolver();
@@ -25,12 +25,13 @@ import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.types.TypeProjection
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
public val JetType.nameIfStandardType: Name?
get() {
val descriptor = getConstructor().getDeclarationDescriptor()
if (descriptor?.getContainingDeclaration() == KotlinBuiltIns.getInstance().getBuiltInsPackageFragment()) {
if (descriptor?.getContainingDeclaration() == descriptor?.builtIns?.getBuiltInsPackageFragment()) {
return descriptor?.getName()
}