1 package org.simantics.scl.compiler.elaboration.expressions.list;
3 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
4 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
5 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
6 import org.simantics.scl.compiler.elaboration.expressions.Expression;
7 import org.simantics.scl.compiler.errors.Locations;
8 import org.simantics.scl.compiler.types.Types;
10 public class ListGuard extends ListQualifier {
11 public Expression condition;
13 public ListGuard(Expression condition) {
14 this.condition = condition;
18 public void checkType(TypingContext context) {
19 condition.checkType(context, Types.BOOLEAN);
23 public CompiledQualifier compile(SimplificationContext context) {
24 return new CompiledQualifier(
25 context.guardList(condition.copy()),
30 public void resolve(TranslationContext context) {
31 condition = condition.resolve(context);
35 public void setLocationDeep(long loc) {
36 if(location == Locations.NO_LOCATION) {
38 condition.setLocationDeep(loc);
43 public void accept(ListQualifierVisitor visitor) {
48 public ListQualifier accept(ListQualifierTransformer transformer) {
49 return transformer.transform(this);