From fad916900593b92dd280de9405af975a0e5ce4bd Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 28 Nov 2012 19:38:17 +0400 Subject: [PATCH] Remove suspicious code from intrinsics --- .../jet/codegen/ExpressionCodegen.java | 4 +- .../codegen/intrinsics/IntrinsicMethods.java | 7 --- .../jet/codegen/intrinsics/PsiMethodCall.java | 61 ------------------- 3 files changed, 2 insertions(+), 70 deletions(-) delete mode 100644 compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PsiMethodCall.java diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index ca0205d3c71..fdb27111383 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -1907,7 +1907,7 @@ public class ExpressionCodegen extends JetVisitor implem invokeMethodWithArguments(callableMethod, receiver, calleeExpression); } - public void invokeMethodWithArguments(CallableMethod callableMethod, StackValue receiver, JetExpression calleeExpression) { + private void invokeMethodWithArguments(CallableMethod callableMethod, StackValue receiver, JetExpression calleeExpression) { Call call = bindingContext.get(CALL, calleeExpression); ResolvedCall resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, calleeExpression); @@ -1917,7 +1917,7 @@ public class ExpressionCodegen extends JetVisitor implem } - protected void invokeMethodWithArguments( + private void invokeMethodWithArguments( @NotNull CallableMethod callableMethod, @NotNull ResolvedCall resolvedCall, @NotNull Call call, diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java index 4d269630a41..51363958287 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java @@ -21,7 +21,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; -import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.java.JvmPrimitiveType; import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe; @@ -219,12 +218,6 @@ public class IntrinsicMethods { if (descriptor instanceof SimpleFunctionDescriptor) { SimpleFunctionDescriptor functionDescriptor = (SimpleFunctionDescriptor) descriptor; - if (functionDescriptor.getReceiverParameter() == null) { - FqNameUnsafe ownerFqName = DescriptorUtils.getFQName(descriptor.getContainingDeclaration()); - if (ownerFqName.equalsTo("jet.String")) { - return new PsiMethodCall(functionDescriptor); - } - } if (isEnumClassObject(functionDescriptor.getContainingDeclaration())) { if ("values".equals(functionDescriptor.getName().getName())) { diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PsiMethodCall.java b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PsiMethodCall.java deleted file mode 100644 index 813b40ec570..00000000000 --- a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PsiMethodCall.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2010-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.jet.codegen.intrinsics; - -import com.intellij.psi.PsiElement; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.asm4.Type; -import org.jetbrains.asm4.commons.InstructionAdapter; -import org.jetbrains.jet.codegen.CallableMethod; -import org.jetbrains.jet.codegen.ExpressionCodegen; -import org.jetbrains.jet.codegen.OwnerKind; -import org.jetbrains.jet.codegen.StackValue; -import org.jetbrains.jet.codegen.state.GenerationState; -import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor; -import org.jetbrains.jet.lang.psi.JetBinaryExpression; -import org.jetbrains.jet.lang.psi.JetCallElement; -import org.jetbrains.jet.lang.psi.JetCallExpression; -import org.jetbrains.jet.lang.psi.JetExpression; - -import java.util.List; - -/** - * @author yole - * @author alex.tkachman - */ -public class PsiMethodCall implements IntrinsicMethod { - private final SimpleFunctionDescriptor method; - - public PsiMethodCall(SimpleFunctionDescriptor method) { - this.method = method; - } - - @Override - public StackValue generate( - ExpressionCodegen codegen, InstructionAdapter v, @NotNull Type expectedType, PsiElement element, - List arguments, StackValue receiver, @NotNull GenerationState state - ) { - final CallableMethod callableMethod = - state.getTypeMapper().mapToCallableMethod(method, false, false, OwnerKind.IMPLEMENTATION); - if(element instanceof JetBinaryExpression) { - codegen.invokeMethodWithArguments(callableMethod, receiver, ((JetBinaryExpression)element).getOperationReference()); - } else { - codegen.invokeMethodWithArguments(callableMethod, (JetCallElement) element, receiver); - } - return StackValue.onStack(callableMethod.getSignature().getAsmMethod().getReturnType()); - } -}