]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/continuations/ContRef.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / codegen / continuations / ContRef.java
1 package org.simantics.scl.compiler.internal.codegen.continuations;
2
3 import org.simantics.scl.compiler.internal.codegen.references.Val;
4 import org.simantics.scl.compiler.internal.codegen.references.ValRef;
5 import org.simantics.scl.compiler.internal.codegen.ssa.SSAExit;
6
7
8 public final class ContRef {
9     public static final ValRef[] EMPTY_ARRAY = new ValRef[0];
10
11     Cont binding;
12     ContRef prev; // FreeVars with the same binding form a linked list
13     ContRef next;     
14     SSAExit parent;
15     
16     ContRef(Cont binding) {
17         this.binding = binding;
18         
19         ContRef head = binding.occurrence;
20         binding.occurrence = this;
21         this.next = head;
22         if(head != null)
23             head.prev = this;
24     }    
25     
26     public void remove() {
27         if(prev == null)
28             binding.occurrence = next;
29         else
30             prev.next = next;
31         if(next != null)
32             next.prev = prev;
33     }
34
35     public Cont getBinding() {
36         return binding;
37     }
38     
39     public ContRef getNext() {
40         return next;
41     }
42
43     public void setParent(SSAExit parent) {
44         this.parent = parent;
45     }
46
47     public Cont addParametersInFront(Val[] newParameters, Val[] oldParameters, Cont proxy) {
48         return parent.addParametersInFrontOf(this, newParameters, oldParameters, proxy);
49     }
50     
51     public SSAExit getParent() {
52         return parent;
53     }
54 }