[FIR IDE] Initial descriptor-based implementation of the Analysis API

This commit is contained in:
Yan Zhulanow
2021-10-05 19:15:01 +09:00
committed by teamcityserver
parent e2c9be0932
commit 516dd825c2
150 changed files with 9228 additions and 36 deletions
@@ -19,25 +19,23 @@ package org.jetbrains.kotlin.descriptors.impl
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.KtProperty
import org.jetbrains.kotlin.resolve.source.toSourceElement
class SyntheticFieldDescriptor private constructor(
val propertyDescriptor: PropertyDescriptor,
accessorDescriptor: PropertyAccessorDescriptor,
property: KtProperty
sourceElement: SourceElement
) : LocalVariableDescriptor(
accessorDescriptor, Annotations.EMPTY, SyntheticFieldDescriptor.NAME,
propertyDescriptor.type, propertyDescriptor.isVar, false, false,
property.toSourceElement()
sourceElement
) {
constructor(
accessorDescriptor: PropertyAccessorDescriptor,
property: KtProperty
) : this(accessorDescriptor.correspondingProperty, accessorDescriptor, property)
sourceElement: SourceElement
) : this(accessorDescriptor.correspondingProperty, accessorDescriptor, sourceElement)
override fun getDispatchReceiverParameter() = null
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver;
import org.jetbrains.kotlin.resolve.scopes.*;
import org.jetbrains.kotlin.resolve.source.KotlinSourceElementKt;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices;
@@ -1013,7 +1014,8 @@ public class BodyResolver {
if (functionDescriptor instanceof PropertyAccessorDescriptor && functionDescriptor.getExtensionReceiverParameter() == null) {
PropertyAccessorDescriptor accessorDescriptor = (PropertyAccessorDescriptor) functionDescriptor;
KtProperty property = (KtProperty) function.getParent();
SyntheticFieldDescriptor fieldDescriptor = new SyntheticFieldDescriptor(accessorDescriptor, property);
SourceElement propertySourceElement = KotlinSourceElementKt.toSourceElement(property);
SyntheticFieldDescriptor fieldDescriptor = new SyntheticFieldDescriptor(accessorDescriptor, propertySourceElement);
innerScope = new LexicalScopeImpl(innerScope, functionDescriptor, true, null,
LexicalScopeKind.PROPERTY_ACCESSOR_BODY,
LocalRedeclarationChecker.DO_NOTHING.INSTANCE, handler -> {