X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Fexpressions%2FESimpleLet.java;h=aedb05d4b118906355728558f6598a3ee3f3641d;hb=refs%2Fchanges%2F56%2F756%2F1;hp=1a084b3666283ae79e6fa5758e6fec82d047aceb;hpb=dcb08ba8db427e1e9951e61892c653c23977a8cc;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLet.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLet.java index 1a084b366..aedb05d4b 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLet.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLet.java @@ -15,14 +15,10 @@ import org.simantics.scl.compiler.top.ExpressionInterpretationContext; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.exceptions.MatchException; -import gnu.trove.map.hash.TObjectIntHashMap; -import gnu.trove.set.hash.THashSet; -import gnu.trove.set.hash.TIntHashSet; - public class ESimpleLet extends Expression { - Variable variable; // may be null - Expression value; - Expression in; + public Variable variable; // may be null + public Expression value; + public Expression in; public ESimpleLet(Variable variable, Expression value, Expression in) { if(value == null) @@ -45,36 +41,17 @@ public class ESimpleLet extends Expression { this.in = in; } - public void collectRefs(TObjectIntHashMap allRefs, TIntHashSet refs) { - value.collectRefs(allRefs, refs); - in.collectRefs(allRefs, refs); - } - - @Override - public void collectVars(TObjectIntHashMap allVars, - TIntHashSet vars) { - value.collectVars(allVars, vars); - in.collectVars(allVars, vars); - } - @Override protected void updateType() throws MatchException { setType(in.getType()); } - - @Override - public IVal toVal(CompilationContext context, CodeWriter w) { - IVal valueVal = value.toVal(context, w); - if(variable != null) - variable.setVal(valueVal); - return in.toVal(context, w); - } @Override - public void collectFreeVariables(THashSet vars) { - value.collectFreeVariables(vars); - in.collectFreeVariables(vars); - vars.remove(variable); + public IVal toVal(CompilationContext context, CodeWriter w) { + IVal valueVal = value.toVal(context, w); + if(variable != null) + variable.setVal(valueVal); + return in.toVal(context, w); } @Override @@ -174,12 +151,6 @@ public class ESimpleLet extends Expression { in = in.checkIgnoredType(context); return this; } - - @Override - public void collectEffects(THashSet effects) { - value.collectEffects(effects); - in.collectEffects(effects); - } @Override public void accept(ExpressionVisitor visitor) {