Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -13,6 +13,7 @@ public abstract class JetUnaryExpression extends JetExpression {
|
|||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable @IfNotParsed
|
||||||
public abstract JetExpression getBaseExpression();
|
public abstract JetExpression getBaseExpression();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.*;
|
|||||||
public class WritableScopeImpl extends WritableScopeWithImports {
|
public class WritableScopeImpl extends WritableScopeWithImports {
|
||||||
|
|
||||||
private final Collection<DeclarationDescriptor> allDescriptors = Sets.newHashSet();
|
private final Collection<DeclarationDescriptor> allDescriptors = Sets.newHashSet();
|
||||||
|
private boolean allDescriptorsDone = false;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final DeclarationDescriptor ownerDeclarationDescriptor;
|
private final DeclarationDescriptor ownerDeclarationDescriptor;
|
||||||
@@ -38,7 +39,6 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
|||||||
public WritableScopeImpl(@NotNull JetScope scope, @NotNull DeclarationDescriptor owner, @NotNull ErrorHandler errorHandler) {
|
public WritableScopeImpl(@NotNull JetScope scope, @NotNull DeclarationDescriptor owner, @NotNull ErrorHandler errorHandler) {
|
||||||
super(scope, errorHandler);
|
super(scope, errorHandler);
|
||||||
this.ownerDeclarationDescriptor = owner;
|
this.ownerDeclarationDescriptor = owner;
|
||||||
this.allDescriptors.addAll(scope.getAllDescriptors());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -57,7 +57,6 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importScope(@NotNull JetScope imported) {
|
public void importScope(@NotNull JetScope imported) {
|
||||||
allDescriptors.addAll(imported.getAllDescriptors());
|
|
||||||
super.importScope(imported);
|
super.importScope(imported);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +68,13 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<DeclarationDescriptor> getAllDescriptors() {
|
public Collection<DeclarationDescriptor> getAllDescriptors() {
|
||||||
|
if (!allDescriptorsDone) {
|
||||||
|
allDescriptorsDone = true;
|
||||||
|
allDescriptors.addAll(getWorkerScope().getAllDescriptors());
|
||||||
|
for (JetScope imported : getImports()) {
|
||||||
|
allDescriptors.addAll(imported.getAllDescriptors());
|
||||||
|
}
|
||||||
|
}
|
||||||
return allDescriptors;
|
return allDescriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1885,10 +1885,14 @@ public class JetTypeInferrer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitUnaryExpression(JetUnaryExpression expression) {
|
public void visitUnaryExpression(JetUnaryExpression expression) {
|
||||||
|
JetExpression baseExpression = expression.getBaseExpression();
|
||||||
|
if (baseExpression == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
JetSimpleNameExpression operationSign = expression.getOperationSign();
|
JetSimpleNameExpression operationSign = expression.getOperationSign();
|
||||||
if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) {
|
if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) {
|
||||||
// TODO : Some processing for the label?
|
// TODO : Some processing for the label?
|
||||||
result = getType(expression.getBaseExpression());
|
result = getType(baseExpression);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IElementType operationType = operationSign.getReferencedNameElementType();
|
IElementType operationType = operationSign.getReferencedNameElementType();
|
||||||
@@ -1897,7 +1901,7 @@ public class JetTypeInferrer {
|
|||||||
trace.getErrorHandler().genericError(operationSign.getNode(), "Unknown unary operation");
|
trace.getErrorHandler().genericError(operationSign.getNode(), "Unknown unary operation");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JetType receiverType = getType(scope, expression.getBaseExpression(), false);
|
JetType receiverType = getType(scope, baseExpression, false);
|
||||||
if (receiverType != null) {
|
if (receiverType != null) {
|
||||||
FunctionDescriptor functionDescriptor = lookupFunction(scope, expression.getOperationSign(), name, receiverType, Collections.<JetType>emptyList(), true);
|
FunctionDescriptor functionDescriptor = lookupFunction(scope, expression.getOperationSign(), name, receiverType, Collections.<JetType>emptyList(), true);
|
||||||
if (functionDescriptor != null) {
|
if (functionDescriptor != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user