1 package org.simantics.scl.compiler.internal.codegen.continuations;
\r
3 import org.simantics.scl.compiler.constants.Constant;
\r
4 import org.simantics.scl.compiler.internal.codegen.utils.CopyContext;
\r
6 public class BranchRef {
\r
7 public Constant constructor;
\r
10 public BranchRef(Constant constructor, ContRef cont) {
\r
11 this.constructor = constructor;
\r
15 public static BranchRef toBranchRef(Branch branch) {
\r
16 return new BranchRef(branch.constructor, branch.cont.createOccurrence());
\r
19 public static BranchRef[] toBranchRefs(Branch[] branches) {
\r
20 BranchRef[] result = new BranchRef[branches.length];
\r
21 for(int i=0;i<branches.length;++i)
\r
22 result[i] = toBranchRef(branches[i]);
\r
26 public BranchRef copy(CopyContext context) {
\r
27 return new BranchRef(constructor, context.copy(cont));
\r
30 public static BranchRef[] copy(CopyContext context, BranchRef[] src) {
\r
31 BranchRef[] tgt = new BranchRef[src.length];
\r
32 for(int i=0;i<src.length;++i)
\r
33 tgt[i] = src[i].copy(context);
\r