1 package org.simantics.scl.compiler.elaboration.expressions;
3 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;
4 import org.simantics.scl.compiler.errors.Locations;
5 import org.simantics.scl.compiler.internal.parsing.Symbol;
7 public class GuardedExpression extends Symbol {
8 public Expression[] guards;
9 public Expression value;
11 public GuardedExpression(Expression[] guards, Expression value) {
16 public GuardedExpression replace(ReplaceContext context) {
17 return new GuardedExpression(
18 Expression.replace(context, guards),
19 value.replace(context));
22 public void setLocationDeep(long loc) {
23 if(location == Locations.NO_LOCATION) {
25 for(Expression guard : guards)
26 guard.setLocationDeep(loc);
27 value.setLocationDeep(loc);
31 public void forVariables(VariableProcedure procedure) {
32 for(Expression guard : guards)
33 guard.forVariables(procedure);
34 value.forVariables(procedure);