提交 a850ca37 编写于 作者: M Maxim Shafirov

fix tests

上级 763e41fc
......@@ -116,7 +116,8 @@ public class ClosureCodegen {
final List<ValueParameterDescriptor> params = funDescriptor.getUnsubstitutedValueParameters();
int count = 1;
for (ValueParameterDescriptor param : params) {
StackValue.local(count, JetTypeMapper.TYPE_OBJECT).put(typeMapper.mapType(param.getOutType()), iv);
StackValue.local(count, JetTypeMapper.TYPE_OBJECT).put(JetTypeMapper.TYPE_OBJECT, iv);
StackValue.onStack(JetTypeMapper.TYPE_OBJECT).upcast(typeMapper.mapType(param.getOutType()), iv);
count++;
}
......
......@@ -795,7 +795,7 @@ public class ExpressionCodegen extends JetVisitor {
if (methodDescriptor.getReturnType() != Type.VOID_TYPE) {
final Type retType = typeMapper.mapType(fd.getUnsubstitutedReturnType());
StackValue.onStack(methodDescriptor.getReturnType()).put(retType, v);
StackValue.onStack(methodDescriptor.getReturnType()).upcast(retType, v);
myStack.push(StackValue.onStack(retType));
}
}
......
......@@ -130,12 +130,23 @@ public abstract class StackValue {
}
}
protected void coerce(Type type, InstructionAdapter v) {
public void upcast(Type type, InstructionAdapter v) {
if (type.equals(this.type)) return;
if (type.getSort() == Type.OBJECT && this.type.getSort() == Type.OBJECT) {
v.checkcast(type);
}
else {
coerce(type, v);
}
}
protected void coerce(Type type, InstructionAdapter v) {
if (type.equals(this.type)) return;
if (type.getSort() == Type.OBJECT && this.type.getSort() == Type.OBJECT) {
// v.checkcast(type);
}
else if (type.getSort() == Type.OBJECT) {
box(this.type, type, v);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册