Rename method
This commit is contained in:
@@ -3355,7 +3355,7 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
|
||||
@Override
|
||||
public StackValue visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression, StackValue receiver) {
|
||||
JetSimpleNameExpression operationSign = expression.getOperationSign();
|
||||
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
||||
IElementType opToken = operationSign.getReferencedNameElementType();
|
||||
if (opToken == JetTokens.COLON) {
|
||||
return gen(expression.getLeft());
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowInstructionsGenerator
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.LocalDeclarationInstruction;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.Pseudocode;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.PseudocodeImpl;
|
||||
import org.jetbrains.jet.lang.diagnostics.AbstractDiagnosticFactory;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
@@ -745,7 +744,7 @@ public class JetControlFlowProcessor {
|
||||
|
||||
@Override
|
||||
public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) {
|
||||
IElementType operationType = expression.getOperationSign().getReferencedNameElementType();
|
||||
IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
|
||||
if (operationType == JetTokens.COLON || operationType == JetTokens.AS_KEYWORD || operationType == JetTokens.AS_SAFE) {
|
||||
generateInstructions(expression.getLeft(), false);
|
||||
builder.read(expression);
|
||||
|
||||
+5
-3
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
|
||||
public class JetBinaryExpressionWithTypeRHS extends JetExpressionImpl {
|
||||
public class JetBinaryExpressionWithTypeRHS extends JetExpressionImpl implements JetOperationExpression {
|
||||
public JetBinaryExpressionWithTypeRHS(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class JetBinaryExpressionWithTypeRHS extends JetExpressionImpl {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetTypeReference getRight() {
|
||||
ASTNode node = getOperationSign().getNode();
|
||||
ASTNode node = getOperationReference().getNode();
|
||||
while (node != null) {
|
||||
PsiElement psi = node.getPsi();
|
||||
if (psi instanceof JetTypeReference) {
|
||||
@@ -57,8 +57,10 @@ public class JetBinaryExpressionWithTypeRHS extends JetExpressionImpl {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public JetSimpleNameExpression getOperationSign() {
|
||||
public JetSimpleNameExpression getOperationReference() {
|
||||
return (JetSimpleNameExpression) findChildByType(JetNodeTypes.OPERATION_REFERENCE);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.jet.lexer.JetToken;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
import org.jetbrains.jet.util.QualifiedNamesUtil;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -74,7 +73,7 @@ public class JetPsiUtil {
|
||||
) {
|
||||
if (expression instanceof JetBinaryExpressionWithTypeRHS) {
|
||||
JetBinaryExpressionWithTypeRHS binaryExpression = (JetBinaryExpressionWithTypeRHS) expression;
|
||||
JetSimpleNameExpression operationSign = binaryExpression.getOperationSign();
|
||||
JetSimpleNameExpression operationSign = binaryExpression.getOperationReference();
|
||||
if (JetTokens.COLON.equals(operationSign.getReferencedNameElementType())) {
|
||||
expression = binaryExpression.getLeft();
|
||||
JetTypeReference typeReference = binaryExpression.getRight();
|
||||
|
||||
+5
-5
@@ -138,7 +138,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
DataFlowInfo dataFlowInfo = context.dataFlowInfo;
|
||||
if (right != null) {
|
||||
JetType targetType = context.expressionTypingServices.getTypeResolver().resolveType(context.scope, right, context.trace, true);
|
||||
IElementType operationType = expression.getOperationSign().getReferencedNameElementType();
|
||||
IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
|
||||
|
||||
boolean tryWithNoExpectedType = true;
|
||||
if (isTypeFlexible(left) || operationType == JetTokens.COLON) {
|
||||
@@ -180,7 +180,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
@NotNull JetType targetType,
|
||||
JetType actualType
|
||||
) {
|
||||
JetSimpleNameExpression operationSign = expression.getOperationSign();
|
||||
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
||||
IElementType operationType = operationSign.getReferencedNameElementType();
|
||||
if (operationType == JetTokens.COLON) {
|
||||
if (targetType != NO_EXPECTED_TYPE && !JetTypeChecker.INSTANCE.isSubtypeOf(actualType, targetType)) {
|
||||
@@ -210,16 +210,16 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
JetTypeChecker typeChecker = JetTypeChecker.INSTANCE;
|
||||
if (!typeChecker.isSubtypeOf(targetType, actualType)) {
|
||||
if (typeChecker.isSubtypeOf(actualType, targetType)) {
|
||||
context.trace.report(USELESS_CAST_STATIC_ASSERT_IS_FINE.on(expression.getOperationSign()));
|
||||
context.trace.report(USELESS_CAST_STATIC_ASSERT_IS_FINE.on(expression.getOperationReference()));
|
||||
}
|
||||
else {
|
||||
// See JET-58 Make 'as never succeeds' a warning, or even never check for Java (external) types
|
||||
context.trace.report(CAST_NEVER_SUCCEEDS.on(expression.getOperationSign()));
|
||||
context.trace.report(CAST_NEVER_SUCCEEDS.on(expression.getOperationReference()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (typeChecker.isSubtypeOf(actualType, targetType)) {
|
||||
context.trace.report(USELESS_CAST.on(expression.getOperationSign()));
|
||||
context.trace.report(USELESS_CAST.on(expression.getOperationReference()));
|
||||
}
|
||||
else {
|
||||
if (isCastErased(actualType, targetType, typeChecker)) {
|
||||
|
||||
Reference in New Issue
Block a user