Use OperatorNameConventions constants instead of hardcoded literals
This commit is contained in:
@@ -94,6 +94,7 @@ import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
|
||||
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS;
|
||||
import org.jetbrains.kotlin.types.typesApproximation.CapturedTypeApproximationKt;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
@@ -4152,7 +4153,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
ResolvedCall<FunctionDescriptor> resolvedSetCall = bindingContext.get(INDEXED_LVALUE_SET, expression);
|
||||
ResolvedCall<FunctionDescriptor> resolvedGetCall = bindingContext.get(INDEXED_LVALUE_GET, expression);
|
||||
|
||||
boolean isGetter = "get".equals(operationDescriptor.getName().asString());
|
||||
boolean isGetter = OperatorNameConventions.GET.equals(operationDescriptor.getName());
|
||||
|
||||
Callable callable = resolveToCallable(operationDescriptor, false, isGetter ? resolvedGetCall : resolvedSetCall);
|
||||
Callable callableMethod = resolveToCallableMethod(operationDescriptor, false);
|
||||
|
||||
@@ -57,6 +57,7 @@ import org.jetbrains.kotlin.resolve.calls.util.isSingleUnderscore
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeUtils.*
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import java.util.*
|
||||
|
||||
class ControlFlowInformationProvider private constructor(
|
||||
@@ -647,13 +648,13 @@ class ControlFlowInformationProvider private constructor(
|
||||
val functionDescriptor =
|
||||
trace.get(DECLARATION_TO_DESCRIPTOR, owner) as? FunctionDescriptor
|
||||
?: throw AssertionError(owner.text)
|
||||
val functionName = functionDescriptor.name.asString()
|
||||
val functionName = functionDescriptor.name
|
||||
if (isMain
|
||||
|| functionDescriptor.isOverridableOrOverrides
|
||||
|| owner.hasModifier(KtTokens.OVERRIDE_KEYWORD)
|
||||
|| "getValue" == functionName
|
||||
|| "setValue" == functionName
|
||||
|| "propertyDelegated" == functionName) {
|
||||
|| OperatorNameConventions.GET_VALUE == functionName
|
||||
|| OperatorNameConventions.SET_VALUE == functionName
|
||||
|| OperatorNameConventions.PROPERTY_DELEGATED == functionName) {
|
||||
return
|
||||
}
|
||||
report(UNUSED_PARAMETER.on(element, variableDescriptor), ctxt)
|
||||
|
||||
@@ -257,7 +257,7 @@ public class CallResolver {
|
||||
|
||||
Call.CallType callType = context.call.getCallType();
|
||||
if (callType == Call.CallType.ARRAY_GET_METHOD || callType == Call.CallType.ARRAY_SET_METHOD) {
|
||||
Name name = Name.identifier(callType == Call.CallType.ARRAY_GET_METHOD ? "get" : "set");
|
||||
Name name = callType == Call.CallType.ARRAY_GET_METHOD ? OperatorNameConventions.GET : OperatorNameConventions.SET;
|
||||
KtArrayAccessExpression arrayAccessExpression = (KtArrayAccessExpression) context.call.getCallElement();
|
||||
return computeTasksAndResolveCall(
|
||||
context, name, arrayAccessExpression,
|
||||
|
||||
+1
-1
@@ -1691,7 +1691,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
? CallMaker.makeArrayGetCall(receiver, arrayAccessExpression, Call.CallType.ARRAY_GET_METHOD)
|
||||
: CallMaker.makeArraySetCall(receiver, arrayAccessExpression, rightHandSide, Call.CallType.ARRAY_SET_METHOD);
|
||||
OverloadResolutionResults<FunctionDescriptor> functionResults = components.callResolver.resolveCallWithGivenName(
|
||||
context, call, arrayAccessExpression, Name.identifier(isGet ? "get" : "set"));
|
||||
context, call, arrayAccessExpression, isGet ? OperatorNameConventions.GET : OperatorNameConventions.SET);
|
||||
|
||||
List<KtExpression> indices = arrayAccessExpression.getIndexExpressions();
|
||||
// The accumulated data flow info of all index expressions is saved on the last index
|
||||
|
||||
Reference in New Issue
Block a user