import org.simantics.scl.compiler.internal.parsing.Symbol;
import org.simantics.scl.compiler.types.Type;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
public class Case extends Symbol {
public Expression[] patterns;
public Expression value;
return lhs;
}
- public void collectRefs(TObjectIntHashMap<Object> allRefs, TIntHashSet refs) {
- value.collectRefs(allRefs, refs);
- }
-
- public void collectVars(TObjectIntHashMap<Variable> allVars,
- TIntHashSet vars) {
- value.collectVars(allVars, vars);
- }
-
- public void collectFreeVariables(THashSet<Variable> vars) {
- value.collectFreeVariables(vars);
- for(int i=patterns.length-1;i>=0;--i)
- patterns[i].removeFreeVariables(vars);
- }
-
public void resolve(TranslationContext context) {
context.pushFrame();
for(int i=0;i<patterns.length;++i)
patterns[i] = patterns[i].checkTypeAsPattern(context, parameterTypes[i]);
value = value.checkIgnoredType(context);
}
-
- public void forVariables(VariableProcedure procedure) {
- value.forVariables(procedure);
- }
}