]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/continuations/ReturnCont.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / codegen / continuations / ReturnCont.java
1 package org.simantics.scl.compiler.internal.codegen.continuations;
2
3 import org.simantics.scl.compiler.internal.codegen.ssa.SSAFunction;
4 import org.simantics.scl.compiler.internal.codegen.utils.CopyContext;
5 import org.simantics.scl.compiler.types.TVar;
6 import org.simantics.scl.compiler.types.Type;
7 import org.simantics.scl.compiler.types.util.Typed;
8
9
10 public final class ReturnCont extends Cont implements Typed {
11     Type returnType;
12     transient SSAFunction parent;
13     
14     public ReturnCont(Type returnType) {
15         this.returnType = returnType;
16     }
17     
18     public void setParent(SSAFunction parent) {
19         this.parent = parent;
20     }
21     
22     @Override
23     public Type getType() {
24         return returnType;
25     }
26     
27     @Override
28     public int getArity() {
29         return 1;
30     }
31     
32     @Override
33     public Type getParameterType(int parameterId) {
34         if(parameterId != 0)
35             throw new IllegalArgumentException();
36         return returnType;
37     }
38
39     public ReturnCont copy(CopyContext context) {
40         return new ReturnCont(context.copyType(returnType));
41     }
42     
43     @Override
44     public void replace(TVar[] vars, Type[] replacements) {
45         returnType = returnType.replace(vars, replacements);        
46     }
47
48     public void setType(Type type) {
49         this.returnType = type;        
50     }
51 }