Intrinsic arguments parameter annotated with NotNull
This commit is contained in:
@@ -41,6 +41,7 @@ import org.jetbrains.org.objectweb.asm.Type;
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.*;
|
||||
@@ -1004,7 +1005,7 @@ public abstract class StackValue {
|
||||
((CallableMethod) getter).invokeWithNotNullAssertion(v, state, resolvedGetCall);
|
||||
}
|
||||
else {
|
||||
StackValue result = ((IntrinsicMethod) getter).generate(codegen, this.type, null, null, null);
|
||||
StackValue result = ((IntrinsicMethod) getter).generate(codegen, this.type, null, Collections.<JetExpression>emptyList(), null);
|
||||
result.put(result.type, v);
|
||||
}
|
||||
coerceTo(type, v);
|
||||
@@ -1069,7 +1070,7 @@ public abstract class StackValue {
|
||||
}
|
||||
else {
|
||||
//noinspection ConstantConditions
|
||||
StackValue result = ((IntrinsicMethod) setter).generate(codegen, null, null, null, null);
|
||||
StackValue result = ((IntrinsicMethod) setter).generate(codegen, null, null, Collections.<JetExpression>emptyList(), null);
|
||||
result.put(result.type, v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ArrayIterator extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
receiver.put(receiver.type, v);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ArraySet extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
receiver.put(receiver.type, v);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ArraySize extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
receiver.put(receiver.type, v);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class BinaryOp extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
assert isPrimitive(returnType) : "Return type of BinaryOp intrinsic should be of primitive type : " + returnType;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Clone extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
@Nullable PsiElement element,
|
||||
@Nullable List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
@Nullable StackValue receiver
|
||||
) {
|
||||
ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(((JetElement) element), codegen.getBindingContext());
|
||||
|
||||
@@ -37,7 +37,7 @@ public class CompareTo extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
@Nullable PsiElement element,
|
||||
@Nullable List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
JetExpression argument;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Concat extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
if (receiver == null || receiver == StackValue.none()) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CopyToArray extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
@Nullable PsiElement element,
|
||||
@Nullable List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
@Nullable StackValue receiver
|
||||
) {
|
||||
assert receiver != null;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Equals extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
StackValue leftExpr;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class HashCode extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
@Nullable PsiElement element,
|
||||
@Nullable List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
receiver.put(AsmTypeConstants.OBJECT_TYPE, v);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class IdentityEquals extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
StackValue left;
|
||||
|
||||
@@ -21,10 +21,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.codegen.ExpressionCodegen;
|
||||
import org.jetbrains.jet.codegen.StackValue;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||
|
||||
@@ -32,7 +28,6 @@ import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.genIncrement;
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.isPrimitive;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.EXPRESSION_TYPE;
|
||||
|
||||
public class Increment extends IntrinsicMethod {
|
||||
private final int myDelta;
|
||||
@@ -48,7 +43,7 @@ public class Increment extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
assert isPrimitive(returnType) : "Return type of Increment intrinsic should be of primitive type : " + returnType;
|
||||
|
||||
@@ -35,7 +35,7 @@ public abstract class IntrinsicMethod implements Callable {
|
||||
@NotNull final ExpressionCodegen codegen,
|
||||
@NotNull final Type returnType,
|
||||
@Nullable final PsiElement element,
|
||||
@Nullable final List<JetExpression> arguments,
|
||||
@NotNull final List<JetExpression> arguments,
|
||||
@Nullable final StackValue receiver
|
||||
) {
|
||||
return StackValue.operation(returnType, new Function1<InstructionAdapter, Unit>() {
|
||||
@@ -55,7 +55,7 @@ public abstract class IntrinsicMethod implements Callable {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
@Nullable PsiElement element,
|
||||
@Nullable List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
@Nullable StackValue receiver
|
||||
);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Inv extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
assert isPrimitive(returnType) : "Return type of Inv intrinsic should be of primitive type : " + returnType;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class IteratorNext extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
String name;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class JavaClassArray extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
@Nullable PsiElement element,
|
||||
@Nullable List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
assert element != null : "Element should not be null";
|
||||
|
||||
@@ -43,7 +43,7 @@ public class JavaClassFunction extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type expectedType,
|
||||
@Nullable PsiElement element,
|
||||
@Nullable List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCallWithAssert(
|
||||
|
||||
@@ -40,7 +40,7 @@ public class JavaClassProperty extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
@Nullable PsiElement element,
|
||||
@Nullable List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
Type type = receiver.type;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class MonitorInstruction extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
@Nullable PsiElement element,
|
||||
@Nullable List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
@Nullable StackValue receiver
|
||||
) {
|
||||
assert element != null : "Element should not be null";
|
||||
|
||||
@@ -35,7 +35,7 @@ public class NewArray extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
codegen.generateNewArray((JetCallExpression) element).put(returnType, v);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class NumberCast extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
receiver.put(returnType, v);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class RangeTo extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
v.anew(returnType);
|
||||
|
||||
@@ -34,13 +34,13 @@ public class StringGetChar extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
if (receiver != null) {
|
||||
receiver.put(receiver.type, v);
|
||||
}
|
||||
if (arguments != null) {
|
||||
if (!arguments.isEmpty()) {
|
||||
codegen.gen(arguments.get(0)).put(Type.INT_TYPE, v);
|
||||
}
|
||||
v.invokeinterface("java/lang/CharSequence", "charAt", "(I)C");
|
||||
|
||||
@@ -37,7 +37,7 @@ public class StringPlus extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
if (receiver == null || receiver == StackValue.none()) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ToString extends IntrinsicMethod {
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type returnType,
|
||||
PsiElement element,
|
||||
List<JetExpression> arguments,
|
||||
@NotNull List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
genToString(v, receiver, receiver.type).put(returnType, v);
|
||||
|
||||
Reference in New Issue
Block a user