Rename
This commit is contained in:
@@ -598,35 +598,35 @@ public class DescriptorResolver {
|
|||||||
public VariableDescriptor resolveLocalVariableDescriptor(
|
public VariableDescriptor resolveLocalVariableDescriptor(
|
||||||
DeclarationDescriptor containingDeclaration,
|
DeclarationDescriptor containingDeclaration,
|
||||||
JetScope scope,
|
JetScope scope,
|
||||||
JetVariableDeclaration property,
|
JetVariableDeclaration variable,
|
||||||
DataFlowInfo dataFlowInfo,
|
DataFlowInfo dataFlowInfo,
|
||||||
BindingTrace trace
|
BindingTrace trace
|
||||||
) {
|
) {
|
||||||
if (JetPsiUtil.isScriptDeclaration(property)) {
|
if (JetPsiUtil.isScriptDeclaration(variable)) {
|
||||||
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
|
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
|
||||||
containingDeclaration,
|
containingDeclaration,
|
||||||
annotationResolver.createAnnotationStubs(property.getModifierList(), trace),
|
annotationResolver.createAnnotationStubs(variable.getModifierList(), trace),
|
||||||
Modality.FINAL,
|
Modality.FINAL,
|
||||||
Visibilities.INTERNAL,
|
Visibilities.INTERNAL,
|
||||||
property.isVar(),
|
variable.isVar(),
|
||||||
false,
|
false,
|
||||||
JetPsiUtil.safeName(property.getName()),
|
JetPsiUtil.safeName(variable.getName()),
|
||||||
CallableMemberDescriptor.Kind.DECLARATION
|
CallableMemberDescriptor.Kind.DECLARATION
|
||||||
);
|
);
|
||||||
|
|
||||||
JetType type =
|
JetType type =
|
||||||
getVariableType(scope, property, dataFlowInfo, false, trace); // For a local variable the type must not be deferred
|
getVariableType(scope, variable, dataFlowInfo, false, trace); // For a local variable the type must not be deferred
|
||||||
|
|
||||||
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(), scope.getImplicitReceiver(), (JetType) null);
|
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(), scope.getImplicitReceiver(), (JetType) null);
|
||||||
trace.record(BindingContext.VARIABLE, property, propertyDescriptor);
|
trace.record(BindingContext.VARIABLE, variable, propertyDescriptor);
|
||||||
return propertyDescriptor;
|
return propertyDescriptor;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VariableDescriptorImpl variableDescriptor =
|
VariableDescriptorImpl variableDescriptor =
|
||||||
resolveLocalVariableDescriptorWithType(containingDeclaration, property, null, trace);
|
resolveLocalVariableDescriptorWithType(containingDeclaration, variable, null, trace);
|
||||||
|
|
||||||
JetType type =
|
JetType type =
|
||||||
getVariableType(scope, property, dataFlowInfo, false, trace); // For a local variable the type must not be deferred
|
getVariableType(scope, variable, dataFlowInfo, false, trace); // For a local variable the type must not be deferred
|
||||||
variableDescriptor.setOutType(type);
|
variableDescriptor.setOutType(type);
|
||||||
return variableDescriptor;
|
return variableDescriptor;
|
||||||
}
|
}
|
||||||
@@ -635,17 +635,17 @@ public class DescriptorResolver {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public VariableDescriptorImpl resolveLocalVariableDescriptorWithType(
|
public VariableDescriptorImpl resolveLocalVariableDescriptorWithType(
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull JetVariableDeclaration property,
|
@NotNull JetVariableDeclaration variable,
|
||||||
@Nullable JetType type,
|
@Nullable JetType type,
|
||||||
@NotNull BindingTrace trace
|
@NotNull BindingTrace trace
|
||||||
) {
|
) {
|
||||||
VariableDescriptorImpl variableDescriptor = new LocalVariableDescriptor(
|
VariableDescriptorImpl variableDescriptor = new LocalVariableDescriptor(
|
||||||
containingDeclaration,
|
containingDeclaration,
|
||||||
annotationResolver.createAnnotationStubs(property.getModifierList(), trace),
|
annotationResolver.createAnnotationStubs(variable.getModifierList(), trace),
|
||||||
JetPsiUtil.safeName(property.getName()),
|
JetPsiUtil.safeName(variable.getName()),
|
||||||
type,
|
type,
|
||||||
property.isVar());
|
variable.isVar());
|
||||||
trace.record(BindingContext.VARIABLE, property, variableDescriptor);
|
trace.record(BindingContext.VARIABLE, variable, variableDescriptor);
|
||||||
return variableDescriptor;
|
return variableDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -817,16 +817,16 @@ public class DescriptorResolver {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private JetType getVariableType(
|
private JetType getVariableType(
|
||||||
@NotNull final JetScope scope,
|
@NotNull final JetScope scope,
|
||||||
@NotNull final JetVariableDeclaration property,
|
@NotNull final JetVariableDeclaration variable,
|
||||||
@NotNull final DataFlowInfo dataFlowInfo,
|
@NotNull final DataFlowInfo dataFlowInfo,
|
||||||
boolean allowDeferred,
|
boolean allowDeferred,
|
||||||
final BindingTrace trace
|
final BindingTrace trace
|
||||||
) {
|
) {
|
||||||
// TODO : receiver?
|
// TODO : receiver?
|
||||||
JetTypeReference propertyTypeRef = property.getTypeRef();
|
JetTypeReference propertyTypeRef = variable.getTypeRef();
|
||||||
|
|
||||||
if (propertyTypeRef == null) {
|
if (propertyTypeRef == null) {
|
||||||
final JetExpression initializer = property.getInitializer();
|
final JetExpression initializer = variable.getInitializer();
|
||||||
if (initializer == null) {
|
if (initializer == null) {
|
||||||
return ErrorUtils.createErrorType("No type, no body");
|
return ErrorUtils.createErrorType("No type, no body");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user