import org.simantics.scl.compiler.types.kinds.Kinds;
import org.simantics.scl.compiler.types.util.MultiFunction;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
public class ELambda extends SimplifiableExpression {
public Case[] cases;
- Type effect = Types.NO_EFFECTS;
+ public Type effect = Types.NO_EFFECTS;
public ELambda(Case[] cases) {
this.cases = cases;
this.cases = cases;
}
+ public ELambda(long loc, Type effect, Case ... cases) {
+ super(loc);
+ this.cases = cases;
+ this.effect = effect;
+ }
+
public ELambda(long loc, Expression pat, Expression exp) {
this(loc, new Case(new Expression[] {pat}, exp));
}
- @Override
- public void collectVars(TObjectIntHashMap<Variable> allVars,
- TIntHashSet vars) {
- for(Case case_ : cases)
- case_.collectVars(allVars, vars);
- }
-
public Expression decomposeMatching() {
Expression[] patterns = cases[0].patterns;
int arity = patterns.length;
return decomposeMatching().simplify(context);
}
- @Override
- public void collectFreeVariables(THashSet<Variable> vars) {
- for(Case case_ : cases)
- case_.collectFreeVariables(vars);
- }
-
@Override
public Expression resolve(TranslationContext context) {
for(Case case_ : cases)