rename
This commit is contained in:
committed by
Andrey Breslav
parent
115bd21bea
commit
3e5026407d
@@ -49,7 +49,7 @@ public class PositioningStrategies {
|
||||
}
|
||||
else if (declaration instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) declaration;
|
||||
returnTypeRef = property.getPropertyTypeRef();
|
||||
returnTypeRef = property.getTypeRef();
|
||||
nameNode = getNameNode(property);
|
||||
}
|
||||
else if (declaration instanceof JetPropertyAccessor) {
|
||||
@@ -108,7 +108,7 @@ public class PositioningStrategies {
|
||||
else if (element instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) element;
|
||||
PsiElement endOfSignatureElement;
|
||||
JetTypeReference propertyTypeRef = property.getPropertyTypeRef();
|
||||
JetTypeReference propertyTypeRef = property.getTypeRef();
|
||||
PsiElement nameIdentifier = property.getNameIdentifier();
|
||||
if (propertyTypeRef != null) {
|
||||
endOfSignatureElement = propertyTypeRef;
|
||||
|
||||
@@ -45,7 +45,7 @@ public final class JetModifiableBlockHelper {
|
||||
}
|
||||
else if (declaration instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) declaration;
|
||||
if (property.getPropertyTypeRef() != null) {
|
||||
if (property.getTypeRef() != null) {
|
||||
return takePartInDeclarationTypeInference(property);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class JetModifiableBlockHelper {
|
||||
}
|
||||
else if (declaration instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) declaration;
|
||||
if (property.getPropertyTypeRef() == null) {
|
||||
if (property.getTypeRef() == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class JetMultiDeclarationEntry extends JetNamedDeclarationNotStubbed impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetTypeReference getPropertyTypeRef() {
|
||||
public JetTypeReference getTypeRef() {
|
||||
return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStu
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference getPropertyTypeRef() {
|
||||
public JetTypeReference getTypeRef() {
|
||||
ASTNode node = getNode().getFirstChildNode();
|
||||
boolean passedColon = false;
|
||||
while (node != null) {
|
||||
|
||||
@@ -59,7 +59,7 @@ public class JetPsiFactory {
|
||||
|
||||
public static JetTypeReference createType(Project project, String type) {
|
||||
JetProperty property = createProperty(project, "val x : " + type);
|
||||
return property.getPropertyTypeRef();
|
||||
return property.getTypeRef();
|
||||
}
|
||||
|
||||
//the pair contains the first and the last elements of a range
|
||||
|
||||
@@ -188,7 +188,7 @@ public class JetPsiUtil {
|
||||
}
|
||||
if (pattern instanceof JetBindingPattern) {
|
||||
JetBindingPattern bindingPattern = (JetBindingPattern) pattern;
|
||||
if (bindingPattern.getVariableDeclaration().getPropertyTypeRef() == null && bindingPattern.getCondition() == null) {
|
||||
if (bindingPattern.getVariableDeclaration().getTypeRef() == null && bindingPattern.getCondition() == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,5 @@ public interface JetVariableDeclaration extends JetDeclaration, JetWithExpressio
|
||||
ASTNode getValOrVarNode();
|
||||
|
||||
@Nullable
|
||||
JetTypeReference getPropertyTypeRef();
|
||||
JetTypeReference getTypeRef();
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class JetPropertyElementType extends JetStubElementType<PsiJetPropertyStu
|
||||
|
||||
@Override
|
||||
public PsiJetPropertyStub createStub(@NotNull JetProperty psi, StubElement parentStub) {
|
||||
JetTypeReference typeRef = psi.getPropertyTypeRef();
|
||||
JetTypeReference typeRef = psi.getTypeRef();
|
||||
JetExpression expression = psi.getInitializer();
|
||||
|
||||
assert !psi.isLocal() : "Should not store local property";
|
||||
|
||||
@@ -455,7 +455,7 @@ public class BodyResolver {
|
||||
|
||||
private void resolvePropertyInitializer(JetProperty property, PropertyDescriptor propertyDescriptor, JetExpression initializer, JetScope scope) {
|
||||
//JetFlowInformationProvider flowInformationProvider = context.getDescriptorResolver().computeFlowData(property, initializer); // TODO : flow JET-15
|
||||
JetType expectedTypeForInitializer = property.getPropertyTypeRef() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
|
||||
JetType expectedTypeForInitializer = property.getTypeRef() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
|
||||
JetScope propertyDeclarationInnerScope = descriptorResolver.getPropertyDeclarationInnerScope(scope, propertyDescriptor.getTypeParameters(), ReceiverDescriptor.NO_RECEIVER, trace);
|
||||
JetType type = expressionTypingServices.getType(propertyDeclarationInnerScope, initializer, expectedTypeForInitializer, DataFlowInfo.EMPTY, trace);
|
||||
//
|
||||
|
||||
@@ -144,7 +144,7 @@ public class DeclarationsChecker {
|
||||
private void checkDeclaredTypeInPublicMember(JetNamedDeclaration member, CallableMemberDescriptor memberDescriptor) {
|
||||
boolean hasDeferredType;
|
||||
if (member instanceof JetProperty) {
|
||||
hasDeferredType = ((JetProperty) member).getPropertyTypeRef() == null && DescriptorResolver.hasBody((JetProperty) member);
|
||||
hasDeferredType = ((JetProperty) member).getTypeRef() == null && DescriptorResolver.hasBody((JetProperty) member);
|
||||
}
|
||||
else {
|
||||
assert member instanceof JetFunction;
|
||||
@@ -204,7 +204,7 @@ public class DeclarationsChecker {
|
||||
(setter != null && setter.getBodyExpression() != null);
|
||||
|
||||
if (propertyDescriptor.getModality() == Modality.ABSTRACT) {
|
||||
if (property.getInitializer() == null && property.getPropertyTypeRef() == null) {
|
||||
if (property.getInitializer() == null && property.getTypeRef() == null) {
|
||||
trace.report(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(property));
|
||||
}
|
||||
return;
|
||||
@@ -229,7 +229,7 @@ public class DeclarationsChecker {
|
||||
trace.report(MUST_BE_INITIALIZED_OR_BE_ABSTRACT.on(property));
|
||||
}
|
||||
}
|
||||
if (!error && property.getPropertyTypeRef() == null) {
|
||||
if (!error && property.getTypeRef() == null) {
|
||||
trace.report(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(property));
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -823,7 +823,7 @@ public class DescriptorResolver {
|
||||
final BindingTrace trace
|
||||
) {
|
||||
// TODO : receiver?
|
||||
JetTypeReference propertyTypeRef = property.getPropertyTypeRef();
|
||||
JetTypeReference propertyTypeRef = property.getTypeRef();
|
||||
|
||||
if (propertyTypeRef == null) {
|
||||
final JetExpression initializer = property.getInitializer();
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@ package org.jetbrains.jet.lang.types.expressions;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
@@ -110,7 +109,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
|
||||
VariableDescriptor propertyDescriptor = context.expressionTypingServices.getDescriptorResolver().resolveLocalVariableDescriptor(scope.getContainingDeclaration(), scope, property, context.dataFlowInfo, context.trace);
|
||||
JetExpression initializer = property.getInitializer();
|
||||
if (property.getPropertyTypeRef() != null && initializer != null) {
|
||||
if (property.getTypeRef() != null && initializer != null) {
|
||||
JetType outType = propertyDescriptor.getType();
|
||||
JetType initializerType = facade.getTypeInfo(initializer, context.replaceExpectedType(outType).replaceScope(scope)).getType();
|
||||
}
|
||||
|
||||
+1
-1
@@ -297,7 +297,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
|
||||
@Override
|
||||
public void visitBindingPattern(JetBindingPattern pattern) {
|
||||
JetProperty variableDeclaration = pattern.getVariableDeclaration();
|
||||
JetTypeReference propertyTypeRef = variableDeclaration.getPropertyTypeRef();
|
||||
JetTypeReference propertyTypeRef = variableDeclaration.getTypeRef();
|
||||
JetType type = propertyTypeRef == null ? subjectType : context.expressionTypingServices.getTypeResolver().resolveType(context.scope, propertyTypeRef, context.trace, true);
|
||||
VariableDescriptor variableDescriptor = context.expressionTypingServices.getDescriptorResolver().resolveLocalVariableDescriptorWithType(context.scope.getContainingDeclaration(), variableDeclaration, type, context.trace);
|
||||
scopeToExtend.addVariableDescriptor(variableDescriptor);
|
||||
|
||||
@@ -731,7 +731,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
||||
declaration.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitProperty(JetProperty property) {
|
||||
if (property.getPropertyTypeRef() != null) {
|
||||
if (property.getTypeRef() != null) {
|
||||
memberDeclarations.addPropertyDescriptor(descriptorResolver.resolvePropertyDescriptor(classDescriptor, parameterScope, property, JetTestUtils.DUMMY_TRACE));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
|
||||
}
|
||||
if (parent instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) parent;
|
||||
if (property.getPropertyTypeRef() == null) {
|
||||
if (property.getTypeRef() == null) {
|
||||
addTypeAnnotation(project, property, type);
|
||||
}
|
||||
else {
|
||||
@@ -105,7 +105,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
|
||||
}
|
||||
JetNamedDeclaration declaration = (JetNamedDeclaration) parent;
|
||||
if (declaration instanceof JetProperty && !PsiTreeUtil.isAncestor(((JetProperty) declaration).getInitializer(), element, false)) {
|
||||
if (((JetProperty) declaration).getPropertyTypeRef() != null) {
|
||||
if (((JetProperty) declaration).getTypeRef() != null) {
|
||||
setText(JetBundle.message("specify.type.explicitly.remove.action.name"));
|
||||
return true;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
|
||||
}
|
||||
|
||||
public static void addTypeAnnotation(Project project, JetProperty property, @NotNull JetType exprType) {
|
||||
if (property.getPropertyTypeRef() != null) return;
|
||||
if (property.getTypeRef() != null) return;
|
||||
PsiElement anchor = property.getNameIdentifier();
|
||||
if (anchor == null) return;
|
||||
anchor = anchor.getNextSibling();
|
||||
@@ -227,7 +227,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
|
||||
}
|
||||
|
||||
public static void removeTypeAnnotation(JetProperty property) {
|
||||
removeTypeAnnotation(property, property.getPropertyTypeRef());
|
||||
removeTypeAnnotation(property, property.getTypeRef());
|
||||
}
|
||||
|
||||
public static void removeTypeAnnotation(JetParameter parameter) {
|
||||
|
||||
@@ -22,15 +22,9 @@ import com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeNode;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.plugin.formatter.JetCodeStyleSettings;
|
||||
import org.jetbrains.jet.plugin.project.WholeProjectAnalyzerFacade;
|
||||
import org.jetbrains.jet.plugin.structureView.JetStructureViewElement;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -69,7 +63,7 @@ public class JetDeclarationTreeNode extends AbstractPsiBasedNode<JetDeclaration>
|
||||
text = CLASS_INITIALIZER;
|
||||
} else if (declaration instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) declaration;
|
||||
JetTypeReference ref = property.getPropertyTypeRef();
|
||||
JetTypeReference ref = property.getTypeRef();
|
||||
if (ref != null) {
|
||||
if (settings.SPACE_BEFORE_TYPE_COLON) text += " ";
|
||||
text += ":";
|
||||
|
||||
@@ -114,7 +114,7 @@ public class RemovePartsFromPropertyFix extends JetIntentionAction<JetProperty>
|
||||
assert nextSibling != null;
|
||||
newElement.deleteChildRange(nextSibling, initializer);
|
||||
|
||||
if (newElement.getPropertyTypeRef() == null && type != null) {
|
||||
if (newElement.getTypeRef() == null && type != null) {
|
||||
typeToAdd = type;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user