1 package org.simantics.scl.compiler.elaboration.expressions.block;
3 import org.simantics.scl.compiler.elaboration.contexts.EnvironmentalContext;
4 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;
5 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
6 import org.simantics.scl.compiler.elaboration.expressions.EBind;
7 import org.simantics.scl.compiler.elaboration.expressions.Expression;
8 import org.simantics.scl.compiler.errors.Locations;
10 public class BindStatement extends Statement {
11 public Expression pattern;
12 public Expression value;
14 public BindStatement(Expression pattern, Expression value) {
15 this.pattern = pattern;
20 public Expression toExpression(EnvironmentalContext context, BlockType blockType, Expression in) {
21 return new EBind(location, blockType, pattern, value, in);
25 public void setLocationDeep(long loc) {
26 if(location == Locations.NO_LOCATION) {
28 pattern.setLocationDeep(loc);
29 value.setLocationDeep(loc);
34 public void resolvePattern(TranslationContext context) {
35 pattern = pattern.resolveAsPattern(context);
39 public boolean mayBeRecursive() {
44 public Statement replace(ReplaceContext context) {
45 return new BindStatement(pattern.replaceInPattern(context), value.replace(context));
49 public void accept(StatementVisitor visitor) {
54 public StatementGroup getStatementGroup() {