Renamed runtime Tuple0 class to Unit.
This commit is contained in:
@@ -1147,7 +1147,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Type type = expressionType(expression);
|
Type type = expressionType(expression);
|
||||||
Type targetType = type.equals(JET_TUPLE0_TYPE) ? type : OBJECT_TYPE;
|
Type targetType = type.equals(JET_UNIT_TYPE) ? type : OBJECT_TYPE;
|
||||||
|
|
||||||
gen(expression, targetType);
|
gen(expression, targetType);
|
||||||
|
|
||||||
@@ -1156,7 +1156,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
|
|
||||||
markLineNumber(ifExpression);
|
markLineNumber(ifExpression);
|
||||||
v.mark(elseLabel);
|
v.mark(elseLabel);
|
||||||
StackValue.putTuple0Instance(v);
|
StackValue.putUnitInstance(v);
|
||||||
|
|
||||||
v.mark(end);
|
v.mark(end);
|
||||||
return StackValue.onStack(targetType);
|
return StackValue.onStack(targetType);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
|||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JvmPrimitiveType;
|
import org.jetbrains.jet.lang.resolve.java.JvmPrimitiveType;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
||||||
@@ -235,15 +236,15 @@ public abstract class StackValue {
|
|||||||
}
|
}
|
||||||
else if (fromType.getSort() == Type.VOID) {
|
else if (fromType.getSort() == Type.VOID) {
|
||||||
if (toType.getSort() == Type.OBJECT) {
|
if (toType.getSort() == Type.OBJECT) {
|
||||||
putTuple0Instance(v);
|
putUnitInstance(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pushDefaultPrimitiveValueOnStack(toType, v);
|
pushDefaultPrimitiveValueOnStack(toType, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (toType.equals(JET_TUPLE0_TYPE)) {
|
else if (toType.equals(JET_UNIT_TYPE)) {
|
||||||
pop(fromType, v);
|
pop(fromType, v);
|
||||||
putTuple0Instance(v);
|
putUnitInstance(v);
|
||||||
}
|
}
|
||||||
else if (toType.getSort() == Type.ARRAY) {
|
else if (toType.getSort() == Type.ARRAY) {
|
||||||
v.checkcast(toType);
|
v.checkcast(toType);
|
||||||
@@ -275,8 +276,8 @@ public abstract class StackValue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void putTuple0Instance(InstructionAdapter v) {
|
public static void putUnitInstance(InstructionAdapter v) {
|
||||||
v.visitFieldInsn(GETSTATIC, "jet/Tuple0", "VALUE", "Ljet/Tuple0;");
|
v.visitFieldInsn(GETSTATIC, AsmTypeConstants.JET_UNIT_TYPE.getInternalName(), "VALUE", AsmTypeConstants.JET_UNIT_TYPE.getDescriptor());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void putAsBoolean(InstructionAdapter v) {
|
protected void putAsBoolean(InstructionAdapter v) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import org.jetbrains.jet.lang.psi.JetExpression;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.JET_TUPLE0_TYPE;
|
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.JET_UNIT_TYPE;
|
||||||
|
|
||||||
public class UnitValue implements IntrinsicMethod {
|
public class UnitValue implements IntrinsicMethod {
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ public class UnitValue implements IntrinsicMethod {
|
|||||||
StackValue receiver,
|
StackValue receiver,
|
||||||
@NotNull GenerationState state
|
@NotNull GenerationState state
|
||||||
) {
|
) {
|
||||||
v.getstatic(JET_TUPLE0_TYPE.getInternalName(), "VALUE", JET_TUPLE0_TYPE.getDescriptor());
|
v.getstatic(JET_UNIT_TYPE.getInternalName(), "VALUE", JET_UNIT_TYPE.getDescriptor());
|
||||||
return StackValue.onStack(expectedType);
|
return StackValue.onStack(expectedType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ public class AsmTypeConstants {
|
|||||||
public static final Type JAVA_ARRAY_GENERIC_TYPE = getType(Object[].class);
|
public static final Type JAVA_ARRAY_GENERIC_TYPE = getType(Object[].class);
|
||||||
|
|
||||||
public static final Type JET_NOTHING_TYPE = Type.getObjectType("jet/Nothing");
|
public static final Type JET_NOTHING_TYPE = Type.getObjectType("jet/Nothing");
|
||||||
public static final Type JET_TUPLE0_TYPE = Type.getObjectType("jet/Tuple0");
|
public static final Type JET_UNIT_TYPE = Type.getObjectType("jet/Unit");
|
||||||
public static final Type JET_FUNCTION0_TYPE = Type.getObjectType("jet/Function0");
|
public static final Type JET_FUNCTION0_TYPE = Type.getObjectType("jet/Function0");
|
||||||
public static final Type JET_FUNCTION1_TYPE = Type.getObjectType("jet/Function1");
|
public static final Type JET_FUNCTION1_TYPE = Type.getObjectType("jet/Function1");
|
||||||
public static final Type JET_ITERATOR_TYPE = Type.getObjectType("jet/Iterator");
|
public static final Type JET_ITERATOR_TYPE = Type.getObjectType("jet/Iterator");
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ package jet;
|
|||||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||||
|
|
||||||
@AssertInvisibleInResolver
|
@AssertInvisibleInResolver
|
||||||
public class Tuple0 {
|
public class Unit {
|
||||||
public static final Tuple0 VALUE = new Tuple0();
|
public static final Unit VALUE = new Unit();
|
||||||
|
|
||||||
private Tuple0() {
|
private Unit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Reference in New Issue
Block a user