getting rid of JetObject.getOuterObject
This commit is contained in:
@@ -590,14 +590,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
iv.load(0, classType);
|
||||
iv.load(frameMap.getOuterThisIndex(), type);
|
||||
iv.putfield(classname, fieldName, interfaceDesc);
|
||||
|
||||
Type outerType = typeMapper.mapType(outerDescriptor.getDefaultType());
|
||||
MethodVisitor outer = v.newMethod(myClass, ACC_PUBLIC, JvmStdlibNames.JET_OBJECT_GET_OUTER_OBJECT_METHOD, "()Ljet/JetObject;", null, null);
|
||||
outer.visitCode();
|
||||
outer.visitVarInsn(ALOAD, 0);
|
||||
outer.visitFieldInsn(GETFIELD, classname, "this$0", outerType.getDescriptor());
|
||||
outer.visitInsn(ARETURN);
|
||||
FunctionCodegen.endVisit(outer, JvmStdlibNames.JET_OBJECT_GET_OUTER_OBJECT_METHOD, myClass);
|
||||
}
|
||||
|
||||
if(closure != null) {
|
||||
@@ -937,19 +929,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
return myClass instanceof JetClass ? ((JetClass) myClass).getClassObject() : null;
|
||||
}
|
||||
|
||||
private void staticTypeInfoField() {
|
||||
v.newField(myClass, ACC_PUBLIC | ACC_FINAL | ACC_STATIC, "$staticTypeInfo", "Ljet/TypeInfo;", null, null);
|
||||
staticInitializerChunks.add(new CodeChunk() {
|
||||
@Override
|
||||
public void generate(InstructionAdapter v) {
|
||||
v.aconst(typeMapper.mapType(descriptor.getDefaultType(), OwnerKind.IMPLEMENTATION));
|
||||
v.iconst(0);
|
||||
v.invokestatic("jet/TypeInfo", JvmStdlibNames.JET_OBJECT_GET_TYPEINFO_METHOD, "(Ljava/lang/Class;Z)Ljet/TypeInfo;");
|
||||
v.putstatic(typeMapper.mapType(descriptor.getDefaultType(), kind).getInternalName(), "$staticTypeInfo", "Ljet/TypeInfo;");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return pairs of descriptors. First is member of this that should be implemented by delegating to trait,
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import jet.JetObject;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
@@ -42,7 +41,6 @@ import static org.objectweb.asm.Opcodes.*;
|
||||
public class JetTypeMapper {
|
||||
public static final Type TYPE_OBJECT = Type.getObjectType("java/lang/Object");
|
||||
public static final Type TYPE_THROWABLE = Type.getObjectType("java/lang/Throwable");
|
||||
public static final Type TYPE_JET_OBJECT = Type.getType(JetObject.class);
|
||||
public static final Type TYPE_NOTHING = Type.getObjectType("jet/Nothing");
|
||||
public static final Type JL_NUMBER_TYPE = Type.getObjectType("java/lang/Number");
|
||||
public static final Type JL_STRING_BUILDER = Type.getObjectType("java/lang/StringBuilder");
|
||||
|
||||
-13
@@ -1364,19 +1364,6 @@ public class JavaDescriptorResolver {
|
||||
if (ownerClassName.equals("java.lang.Object")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (method.getName().equals(JvmStdlibNames.JET_OBJECT_GET_TYPEINFO_METHOD) && method.getParameters().size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (method.getName().equals(JvmStdlibNames.JET_OBJECT_GET_OUTER_OBJECT_METHOD) && method.getParameters().size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO: check signature
|
||||
if (method.getName().equals(JvmAbi.SET_TYPE_INFO_METHOD)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
ClassOrNamespaceDescriptor classDescriptor;
|
||||
|
||||
-4
@@ -116,10 +116,6 @@ class JavaDescriptorResolverHelper {
|
||||
// TODO: some java properties too
|
||||
if (method.getJetMethod().kind() == JvmStdlibNames.JET_METHOD_KIND_PROPERTY) {
|
||||
|
||||
if (method.getName().equals(JvmStdlibNames.JET_OBJECT_GET_TYPEINFO_METHOD)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
TypeSource receiverType;
|
||||
|
||||
@@ -25,8 +25,6 @@ public class JvmAbi {
|
||||
public static final String GETTER_PREFIX = "get";
|
||||
public static final String SETTER_PREFIX = "set";
|
||||
public static final String PACKAGE_CLASS = "namespace";
|
||||
public static final String SET_TYPE_INFO_METHOD = "$setTypeInfo";
|
||||
public static final String TYPE_INFO_FIELD = "$typeInfo";
|
||||
|
||||
public static final JvmClassName JETBRAINS_NOT_NULL_ANNOTATION = new JvmClassName("org.jetbrains.annotations.NotNull");
|
||||
}
|
||||
|
||||
@@ -65,10 +65,6 @@ public class JvmStdlibNames {
|
||||
|
||||
public static final JvmClassName JET_OBJECT = new JvmClassName("jet.JetObject");
|
||||
|
||||
public static final String JET_OBJECT_GET_TYPEINFO_METHOD = "getTypeInfo";
|
||||
public static final String JET_OBJECT_GET_OUTER_OBJECT_METHOD = "getOuterObject";
|
||||
|
||||
|
||||
private JvmStdlibNames() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import jet.JetObject;
|
||||
import jet.TypeCastException;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package jet;
|
||||
|
||||
public final class ByteRange implements Range<Byte>, ByteIterable, JetObject {
|
||||
public final class ByteRange implements Range<Byte>, ByteIterable {
|
||||
private final byte start;
|
||||
private final int count;
|
||||
|
||||
@@ -72,11 +72,6 @@ public final class ByteRange implements Range<Byte>, ByteIterable, JetObject {
|
||||
return new MyIterator(start, count, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ByteRange count(int length) {
|
||||
return new ByteRange((byte) 0, length);
|
||||
}
|
||||
@@ -119,10 +114,5 @@ public final class ByteRange implements Range<Byte>, ByteIterable, JetObject {
|
||||
return (byte) (cur - step);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package jet;
|
||||
|
||||
public final class CharRange implements Range<Character>, CharIterable, JetObject {
|
||||
public final class CharRange implements Range<Character>, CharIterable {
|
||||
private final char start;
|
||||
private final int count;
|
||||
|
||||
@@ -72,11 +72,6 @@ public final class CharRange implements Range<Character>, CharIterable, JetObjec
|
||||
return new MyIterator(start, count, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CharRange count(int length) {
|
||||
return new CharRange((char) 0, length);
|
||||
}
|
||||
@@ -119,10 +114,5 @@ public final class CharRange implements Range<Character>, CharIterable, JetObjec
|
||||
return (char) (cur - step);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +19,7 @@ package jet;
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class DefaultJetObject implements JetObject {
|
||||
public class DefaultJetObject {
|
||||
protected DefaultJetObject() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package jet;
|
||||
|
||||
public final class DoubleRange implements Range<Double>, JetObject {
|
||||
public final class DoubleRange implements Range<Double> {
|
||||
private final double start;
|
||||
private final double size;
|
||||
|
||||
@@ -61,11 +61,6 @@ public final class DoubleRange implements Range<Double>, JetObject {
|
||||
return new DoubleRange(getEnd(), -size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DoubleRange count(int length) {
|
||||
return new DoubleRange(0, length);
|
||||
}
|
||||
@@ -110,10 +105,5 @@ public final class DoubleRange implements Range<Double>, JetObject {
|
||||
return cur - step;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package jet;
|
||||
|
||||
public final class FloatRange implements Range<Float>, JetObject {
|
||||
public final class FloatRange implements Range<Float> {
|
||||
private final float start;
|
||||
private final float size;
|
||||
|
||||
@@ -61,12 +61,6 @@ public final class FloatRange implements Range<Float>, JetObject {
|
||||
return new FloatRange(getEnd(), -size);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FloatRange count(int length) {
|
||||
return new FloatRange(0, length);
|
||||
}
|
||||
@@ -111,10 +105,5 @@ public final class FloatRange implements Range<Float>, JetObject {
|
||||
return cur - step;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package jet;
|
||||
|
||||
public final class IntRange implements Range<Integer>, IntIterable, JetObject {
|
||||
public final class IntRange implements Range<Integer>, IntIterable {
|
||||
private final int start;
|
||||
private final int count;
|
||||
|
||||
@@ -72,11 +72,6 @@ public final class IntRange implements Range<Integer>, IntIterable, JetObject {
|
||||
return new MyIterator(start, count, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IntRange count(int length) {
|
||||
return new IntRange(0, length);
|
||||
}
|
||||
@@ -119,10 +114,5 @@ public final class IntRange implements Range<Integer>, IntIterable, JetObject {
|
||||
return cur - step;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
|
||||
package jet;
|
||||
|
||||
public interface Iterable<T> extends JetObject {
|
||||
public interface Iterable<T> {
|
||||
Iterator<T> iterator ();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package jet;
|
||||
|
||||
import jet.runtime.typeinfo.JetMethod;
|
||||
|
||||
public interface Iterator<T> extends JetObject {
|
||||
public interface Iterator<T> {
|
||||
@JetMethod(kind = JetMethod.KIND_PROPERTY)
|
||||
boolean getHasNext();
|
||||
T next ();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-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.
|
||||
@@ -21,5 +21,4 @@ package jet;
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public interface JetObject {
|
||||
JetObject getOuterObject();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package jet;
|
||||
|
||||
public final class LongRange implements Range<Long>, LongIterable, JetObject {
|
||||
public final class LongRange implements Range<Long>, LongIterable {
|
||||
private final long start;
|
||||
private final long count;
|
||||
|
||||
@@ -72,11 +72,6 @@ public final class LongRange implements Range<Long>, LongIterable, JetObject {
|
||||
return new MyIterator(start, count, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LongRange count(int length) {
|
||||
return new LongRange(0, length);
|
||||
}
|
||||
@@ -119,10 +114,5 @@ public final class LongRange implements Range<Long>, LongIterable, JetObject {
|
||||
return (cur - step);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package jet;
|
||||
|
||||
public final class ShortRange implements Range<Short>, ShortIterable, JetObject {
|
||||
public final class ShortRange implements Range<Short>, ShortIterable {
|
||||
private final short start;
|
||||
private final int count;
|
||||
|
||||
@@ -72,11 +72,6 @@ public final class ShortRange implements Range<Short>, ShortIterable, JetObject
|
||||
return new MyIterator(start, count, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ShortRange count(int length) {
|
||||
return new ShortRange((byte) 0, length);
|
||||
}
|
||||
@@ -119,10 +114,5 @@ public final class ShortRange implements Range<Short>, ShortIterable, JetObject
|
||||
return (short) (cur - step);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package jet;
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class Tuple0 implements JetObject {
|
||||
public class Tuple0 {
|
||||
public static final Tuple0 INSTANCE = new Tuple0();
|
||||
|
||||
private Tuple0() {
|
||||
@@ -39,9 +39,4 @@ public class Tuple0 implements JetObject {
|
||||
public int hashCode() {
|
||||
return 239;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import jet.*;
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
private final int size;
|
||||
protected int index;
|
||||
|
||||
@@ -46,11 +46,6 @@ public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public T next() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> Iterator<T> iterator(T[] array) {
|
||||
@@ -74,11 +69,6 @@ public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public byte nextByte() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ByteIterator iterator(byte[] array) {
|
||||
@@ -103,11 +93,6 @@ public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public short nextShort() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortIterator iterator(short[] array) {
|
||||
@@ -132,11 +117,6 @@ public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public int nextInt() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static IntIterator iterator(int[] array) {
|
||||
@@ -161,11 +141,6 @@ public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public long nextLong() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static LongIterator iterator(long[] array) {
|
||||
@@ -190,11 +165,6 @@ public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public float nextFloat() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static FloatIterator iterator(float[] array) {
|
||||
@@ -219,11 +189,6 @@ public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public double nextDouble() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static DoubleIterator iterator(double[] array) {
|
||||
@@ -248,11 +213,6 @@ public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public char nextChar() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static CharIterator iterator(char[] array) {
|
||||
@@ -277,11 +237,6 @@ public abstract class ArrayIterator<T> implements Iterator<T>, JetObject {
|
||||
public boolean nextBoolean() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetObject getOuterObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static BooleanIterator iterator(boolean[] array) {
|
||||
|
||||
Reference in New Issue
Block a user