some fixes to bring the test a bit closer to working condition

This commit is contained in:
Dmitry Jemerov
2011-04-29 21:02:10 +02:00
parent 86536deb7a
commit 42a36e0cf6
3 changed files with 10 additions and 5 deletions
@@ -69,7 +69,7 @@ public class ClassCodegen {
ClassVisitor v = kind == OwnerKind.IMPLEMENTATION ? factory.forClassImplementation(descriptor) : factory.forClassDelegatingImplementation(descriptor); ClassVisitor v = kind == OwnerKind.IMPLEMENTATION ? factory.forClassImplementation(descriptor) : factory.forClassDelegatingImplementation(descriptor);
v.visit(Opcodes.V1_6, v.visit(Opcodes.V1_6,
Opcodes.ACC_PUBLIC, Opcodes.ACC_PUBLIC,
JetTypeMapper.jvmNameForImplementation(descriptor), JetTypeMapper.jvmName(descriptor, kind),
null, null,
superClass, superClass,
new String[] {JetTypeMapper.jvmNameForInterface(descriptor)} new String[] {JetTypeMapper.jvmNameForInterface(descriptor)}
@@ -197,7 +197,7 @@ public class ClassCodegen {
if (specifiers.isEmpty() || !(specifiers.get(0) instanceof JetDelegatorToSuperCall)) { if (specifiers.isEmpty() || !(specifiers.get(0) instanceof JetDelegatorToSuperCall)) {
String superClass = getSuperClass(aClass, kind); String superClass = getSuperClass(aClass, kind);
iv.load(0, Type.getType("L" + superClass + ";")); iv.load(0, Type.getType("L" + superClass + ";"));
iv.invokespecial(superClass, "<init>", method.getDescriptor()); iv.invokespecial(superClass, "<init>", /* TODO super constructor descriptor */"()V");
} }
int n = 0; int n = 0;
@@ -466,6 +466,7 @@ public class ExpressionCodegen extends JetVisitor {
boolean isStatic = propertyDescriptor.getContainingDeclaration() instanceof NamespaceDescriptor; boolean isStatic = propertyDescriptor.getContainingDeclaration() instanceof NamespaceDescriptor;
String owner = JetTypeMapper.getOwner(propertyDescriptor); String owner = JetTypeMapper.getOwner(propertyDescriptor);
final JetType outType = propertyDescriptor.getOutType(); final JetType outType = propertyDescriptor.getOutType();
boolean isInsideClass = propertyDescriptor.getContainingDeclaration() == contextType;
Method getter; Method getter;
Method setter; Method setter;
if (directToField) { if (directToField) {
@@ -473,8 +474,8 @@ public class ExpressionCodegen extends JetVisitor {
setter = null; setter = null;
} }
else { else {
getter = propertyDescriptor.getGetter() == null ? null : typeMapper.mapGetterSignature(propertyDescriptor); getter = isInsideClass && propertyDescriptor.getGetter() == null ? null : typeMapper.mapGetterSignature(propertyDescriptor);
setter = propertyDescriptor.getSetter() == null ? null : typeMapper.mapSetterSignature(propertyDescriptor); setter = isInsideClass && propertyDescriptor.getSetter() == null ? null : typeMapper.mapSetterSignature(propertyDescriptor);
} }
return StackValue.property(propertyDescriptor.getName(), owner, typeMapper.mapType(outType), isStatic, getter, setter); return StackValue.property(propertyDescriptor.getName(), owner, typeMapper.mapType(outType), isStatic, getter, setter);
} }
@@ -203,7 +203,11 @@ public class JetTypeMapper {
} }
public Method mapSetterSignature(PropertyDescriptor descriptor) { public Method mapSetterSignature(PropertyDescriptor descriptor) {
Type paramType = mapType(descriptor.getInType()); final JetType inType = descriptor.getInType();
if (inType == null) {
return null;
}
Type paramType = mapType(inType);
return new Method(PropertyCodegen.setterName(descriptor.getName()), Type.VOID_TYPE, new Type[] { paramType }); return new Method(PropertyCodegen.setterName(descriptor.getName()), Type.VOID_TYPE, new Type[] { paramType });
} }