Permalink
Browse files

Renamed runtime Tuple0 class to Unit.

  • Loading branch information...
1 parent f181907 commit 93f8d572fca458e03bb13d65317559743f1c4520 Evgeny Gerashchenko committed Mar 19, 2013
@@ -1147,7 +1147,7 @@ private StackValue generateSingleBranchIf(
}
else {
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);
@@ -1156,7 +1156,7 @@ private StackValue generateSingleBranchIf(
markLineNumber(ifExpression);
v.mark(elseLabel);
- StackValue.putTuple0Instance(v);
+ StackValue.putUnitInstance(v);
v.mark(end);
return StackValue.onStack(targetType);
@@ -29,6 +29,7 @@
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.JetExpression;
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.JvmPrimitiveType;
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
@@ -235,15 +236,15 @@ public static void coerce(Type fromType, Type toType, InstructionAdapter v) {
}
else if (fromType.getSort() == Type.VOID) {
if (toType.getSort() == Type.OBJECT) {
- putTuple0Instance(v);
+ putUnitInstance(v);
}
else {
pushDefaultPrimitiveValueOnStack(toType, v);
}
}
- else if (toType.equals(JET_TUPLE0_TYPE)) {
+ else if (toType.equals(JET_UNIT_TYPE)) {
pop(fromType, v);
- putTuple0Instance(v);
+ putUnitInstance(v);
}
else if (toType.getSort() == Type.ARRAY) {
v.checkcast(toType);
@@ -275,8 +276,8 @@ else if (toType.getSort() == Type.CHAR) {
}
}
- public static void putTuple0Instance(InstructionAdapter v) {
- v.visitFieldInsn(GETSTATIC, "jet/Tuple0", "VALUE", "Ljet/Tuple0;");
+ public static void putUnitInstance(InstructionAdapter v) {
+ v.visitFieldInsn(GETSTATIC, AsmTypeConstants.JET_UNIT_TYPE.getInternalName(), "VALUE", AsmTypeConstants.JET_UNIT_TYPE.getDescriptor());
}
protected void putAsBoolean(InstructionAdapter v) {
@@ -28,7 +28,7 @@
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 {
@@ -42,7 +42,7 @@ public StackValue generate(
StackValue receiver,
@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);
}
}
@@ -31,7 +31,7 @@
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_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_FUNCTION1_TYPE = Type.getObjectType("jet/Function1");
public static final Type JET_ITERATOR_TYPE = Type.getObjectType("jet/Iterator");
@@ -19,10 +19,10 @@
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
@AssertInvisibleInResolver
-public class Tuple0 {
- public static final Tuple0 VALUE = new Tuple0();
+public class Unit {
+ public static final Unit VALUE = new Unit();
- private Tuple0() {
+ private Unit() {
}
@Override

0 comments on commit 93f8d57

Please sign in to comment.