package org.simantics.scl.compiler.internal.codegen.continuations; import org.simantics.scl.compiler.internal.codegen.ssa.SSAFunction; import org.simantics.scl.compiler.internal.codegen.utils.CopyContext; import org.simantics.scl.compiler.types.TVar; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.util.Typed; public final class ReturnCont extends Cont implements Typed { Type returnType; transient SSAFunction parent; public ReturnCont(Type returnType) { this.returnType = returnType; } public void setParent(SSAFunction parent) { this.parent = parent; } @Override public Type getType() { return returnType; } @Override public int getArity() { return 1; } @Override public Type getParameterType(int parameterId) { if(parameterId != 0) throw new IllegalArgumentException(); return returnType; } public ReturnCont copy(CopyContext context) { return new ReturnCont(context.copyType(returnType)); } @Override public void replace(TVar[] vars, Type[] replacements) { returnType = returnType.replace(vars, replacements); } public void setType(Type type) { this.returnType = type; } }