]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/continuations/BranchRef.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / codegen / continuations / BranchRef.java
1 package org.simantics.scl.compiler.internal.codegen.continuations;
2
3 import org.simantics.scl.compiler.constants.Constant;
4 import org.simantics.scl.compiler.internal.codegen.utils.CopyContext;
5
6 public class BranchRef {
7     public Constant constructor;
8     public ContRef cont;
9     
10     public BranchRef(Constant constructor, ContRef cont) {
11         this.constructor = constructor;
12         this.cont = cont;
13     }
14     
15     public static BranchRef toBranchRef(Branch branch) {
16         return new BranchRef(branch.constructor, branch.cont.createOccurrence());
17     }
18     
19     public static BranchRef[] toBranchRefs(Branch[] branches) {
20         BranchRef[] result = new BranchRef[branches.length];
21         for(int i=0;i<branches.length;++i)
22             result[i] = toBranchRef(branches[i]);
23         return result;        
24     }
25     
26     public BranchRef copy(CopyContext context) {
27         return new BranchRef(constructor, context.copy(cont));
28     }
29     
30     public static BranchRef[] copy(CopyContext context, BranchRef[] src) {
31         BranchRef[] tgt = new BranchRef[src.length];
32         for(int i=0;i<src.length;++i)
33             tgt[i] = src[i].copy(context);
34         return tgt;
35     }
36 }