Rename method

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