X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Fexpressions%2FEIf.java;h=418ba69c9cda9c2e3b1c352daedc02176e8b1570;hp=e3bb2fe0a313d86e24c3b82d1a32d04eb0e47a65;hb=2f63e7a58e49a233b28c6968b848281060117c43;hpb=ca40974f87c9db00eb77aaf1acc1e9937b37261b diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIf.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIf.java old mode 100755 new mode 100644 index e3bb2fe0a..418ba69c9 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIf.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIf.java @@ -1,14 +1,13 @@ package org.simantics.scl.compiler.elaboration.expressions; +import org.simantics.scl.compiler.compilation.CompilationContext; import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext; import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext; import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; -import org.simantics.scl.compiler.environment.Environment; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.internal.codegen.references.IVal; import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter; -import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator; import org.simantics.scl.compiler.internal.interpreted.IConstant; import org.simantics.scl.compiler.internal.interpreted.IExpression; import org.simantics.scl.compiler.internal.interpreted.IIf; @@ -62,21 +61,21 @@ public class EIf extends Expression { } @Override - public IVal toVal(Environment env, CodeWriter w) { - IVal conditionVal = condition.toVal(env, w); + public IVal toVal(CompilationContext context, CodeWriter w) { + IVal conditionVal = condition.toVal(context, w); CodeWriter joinPoint = w.createBlock(getType()); CodeWriter thenBlock = w.createBlock(); if(else_ != null) { CodeWriter elseBlock = w.createBlock(); w.if_(conditionVal, thenBlock.getContinuation(), elseBlock.getContinuation()); - IVal elseVal = else_.toVal(env, elseBlock); + IVal elseVal = else_.toVal(context, elseBlock); elseBlock.jump(joinPoint.getContinuation(), elseVal); } else { w.if_(conditionVal, thenBlock.getContinuation(), joinPoint.getContinuation()); } - IVal thenVal = then_.toVal(env, thenBlock); + IVal thenVal = then_.toVal(context, thenBlock); thenBlock.jump(joinPoint.getContinuation(), thenVal); w.continueAs(joinPoint); @@ -136,15 +135,6 @@ public class EIf extends Expression { return this; } - @Override - public Expression decorate(ExpressionDecorator decorator) { - condition = condition.decorate(decorator); - then_ = then_.decorate(decorator); - if(else_ != null) - else_ = else_.decorate(decorator); - return decorator.decorate(this); - } - @Override public boolean isEffectful() { return condition.isEffectful() || then_.isEffectful() || (else_ != null && else_.isEffectful()); @@ -180,13 +170,6 @@ public class EIf extends Expression { else_ != null ? else_.toIExpression(target) : new IConstant(Tuple0.INSTANCE)); } - @Override - public void forVariables(VariableProcedure procedure) { - condition.forVariables(procedure); - then_.forVariables(procedure); - if(else_ != null) - else_.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { return transformer.transform(this);