Passing DataFlowInfo when analyzing property initializers

#KT-2835 In Progress
#KT-2225 In Progress
#KT-338 In Progress
This commit is contained in:
Andrey Breslav
2013-08-19 17:45:22 +04:00
parent 232d1cac7b
commit 4908766813
6 changed files with 35 additions and 9 deletions
@@ -204,7 +204,12 @@ public class DeclarationResolver {
@Override
public void visitProperty(JetProperty property) {
PropertyDescriptor propertyDescriptor = descriptorResolver.resolvePropertyDescriptor(namespaceLike.getOwnerForChildren(), scopeForPropertyInitializers, property, trace);
PropertyDescriptor propertyDescriptor = descriptorResolver.resolvePropertyDescriptor(
namespaceLike.getOwnerForChildren(),
scopeForPropertyInitializers,
property,
trace,
context.getOuterDataFlowInfo());
namespaceLike.addPropertyDescriptor(propertyDescriptor);
context.getProperties().put(property, propertyDescriptor);
context.registerDeclaringScope(property, scopeForPropertyInitializers);
@@ -941,7 +941,8 @@ public class DescriptorResolver {
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull JetScope scope,
@NotNull JetProperty property,
BindingTrace trace
@NotNull BindingTrace trace,
@NotNull DataFlowInfo dataFlowInfo
) {
JetModifierList modifierList = property.getModifierList();
@@ -994,7 +995,7 @@ public class DescriptorResolver {
JetScope propertyScope = getPropertyDeclarationInnerScope(propertyDescriptor, scope, typeParameterDescriptors,
NO_RECEIVER_PARAMETER, trace);
JetType type = getVariableType(propertyDescriptor, propertyScope, property, DataFlowInfo.EMPTY, true, trace);
JetType type = getVariableType(propertyDescriptor, propertyScope, property, dataFlowInfo, true, trace);
propertyDescriptor.setType(type, typeParameterDescriptors, getExpectedThisObjectIfNeeded(containingDeclaration),
receiverDescriptor);
@@ -1031,7 +1032,7 @@ public class DescriptorResolver {
@NotNull final JetVariableDeclaration variable,
@NotNull final DataFlowInfo dataFlowInfo,
boolean notLocal,
final BindingTrace trace
@NotNull final BindingTrace trace
) {
JetTypeReference propertyTypeRef = variable.getTypeRef();
@@ -186,9 +186,13 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
for (JetProperty propertyDeclaration : declarations) {
JetScope resolutionScope = getScopeForMemberDeclarationResolution(propertyDeclaration);
PropertyDescriptor propertyDescriptor =
resolveSession.getInjector().getDescriptorResolver().resolvePropertyDescriptor(thisDescriptor, resolutionScope,
propertyDeclaration,
resolveSession.getTrace());
resolveSession.getInjector().getDescriptorResolver().resolvePropertyDescriptor(
thisDescriptor, resolutionScope,
propertyDeclaration,
resolveSession.getTrace(),
// this relies on the assumption that a lazily resolved declaration is not a local one,
// thus doesn't have a surrounding data flow
DataFlowInfo.EMPTY);
result.add(propertyDescriptor);
resolveSession.getInjector().getAnnotationResolver().resolveAnnotationsArguments(propertyDescriptor, resolveSession.getTrace(), resolutionScope);
}