From 2f63e7a58e49a233b28c6968b848281060117c43 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Mon, 24 Jul 2017 10:34:38 +0300 Subject: [PATCH] (refs #7375) Replaced forVariables by a visitor Change-Id: I5737e75491a1341711f89fbcf9749ee88d953c92 --- .../compiler/elaboration/chr/CHRLiteral.java | 9 ------- .../compiler/elaboration/chr/CHRQuery.java | 6 ----- .../scl/compiler/elaboration/chr/CHRRule.java | 6 ----- .../compiler/elaboration/chr/CHRRuleset.java | 8 ------ .../elaboration/chr/plan/AssignOp.java | 2 -- .../elaboration/equation/EqBasic.java | 7 ------ .../elaboration/equation/EqGuard.java | 5 ---- .../elaboration/equation/Equation.java | 1 - .../expressions/ASTExpression.java | 6 ----- .../elaboration/expressions/Assignment.java | 4 --- .../elaboration/expressions/Case.java | 4 --- .../expressions/DecoratingExpression.java | 5 ---- .../elaboration/expressions/EAmbiguous.java | 4 --- .../elaboration/expressions/EApply.java | 7 ------ .../elaboration/expressions/EApplyType.java | 5 ---- .../elaboration/expressions/EAsPattern.java | 12 +++------ .../elaboration/expressions/EBind.java | 10 +------- .../elaboration/expressions/ECHRRuleset.java | 5 ---- .../expressions/ECHRRulesetConstructor.java | 4 --- .../elaboration/expressions/ECHRSelect.java | 6 ----- .../elaboration/expressions/EConstant.java | 4 --- .../elaboration/expressions/EEnforce.java | 5 ---- .../elaboration/expressions/EEquations.java | 6 ----- .../elaboration/expressions/EError.java | 4 --- .../expressions/EExternalConstant.java | 4 --- .../elaboration/expressions/EFieldAccess.java | 6 ----- .../expressions/EGetConstraint.java | 5 ---- .../compiler/elaboration/expressions/EIf.java | 7 ------ .../expressions/EIntegerLiteral.java | 6 ----- .../elaboration/expressions/ELambda.java | 6 ----- .../elaboration/expressions/ELambdaType.java | 5 ---- .../elaboration/expressions/ELet.java | 7 ------ .../expressions/EListComprehension.java | 6 ----- .../elaboration/expressions/EListLiteral.java | 6 ----- .../elaboration/expressions/ELiteral.java | 4 --- .../elaboration/expressions/EMatch.java | 8 ------ .../elaboration/expressions/ERealLiteral.java | 6 ----- .../elaboration/expressions/ERuleset.java | 13 ---------- .../elaboration/expressions/ESelect.java | 6 ----- .../expressions/ESimpleLambda.java | 5 ---- .../elaboration/expressions/ESimpleLet.java | 6 ----- .../expressions/ETransformation.java | 5 ---- .../expressions/ETypeAnnotation.java | 5 ---- .../elaboration/expressions/EVariable.java | 8 +----- .../elaboration/expressions/EViewPattern.java | 6 ----- .../elaboration/expressions/EWhen.java | 6 ----- .../elaboration/expressions/Expression.java | 10 +++++--- .../expressions/GuardedExpression.java | 6 ----- .../expressions/GuardedExpressionGroup.java | 6 ----- .../StandardExpressionVisitor.java | 5 ++++ .../accessor/ExpressionAccessor.java | 6 ----- .../expressions/accessor/FieldAccessor.java | 3 --- .../expressions/accessor/IdAccessor.java | 5 ---- .../expressions/accessor/StringAccessor.java | 5 ---- .../expressions/list/ListAssignment.java | 6 ----- .../expressions/list/ListGenerator.java | 6 ----- .../expressions/list/ListGuard.java | 6 ----- .../expressions/list/ListQualifier.java | 2 -- .../elaboration/expressions/list/ListSeq.java | 7 ------ .../expressions/list/ListThen.java | 9 ------- .../visitors/ForVariablesUsesVisitor.java | 25 +++++++++++++++++++ .../elaboration/query/QAbstractCombiner.java | 7 ------ .../elaboration/query/QAbstractModifier.java | 6 ----- .../scl/compiler/elaboration/query/QAtom.java | 8 +----- .../compiler/elaboration/query/QExists.java | 8 ------ .../scl/compiler/elaboration/query/QIf.java | 8 ------ .../compiler/elaboration/query/QMapping.java | 7 ------ .../scl/compiler/elaboration/query/Query.java | 7 ++++-- .../elaboration/query/pre/PreQuery.java | 5 ---- .../relations/TransitiveClosureRelation.java | 1 - .../TransformationBuilder.java | 4 +-- .../transformations/UnifiableFactory.java | 2 +- 72 files changed, 51 insertions(+), 390 deletions(-) create mode 100644 bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/visitors/ForVariablesUsesVisitor.java diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRLiteral.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRLiteral.java index 918dd9fb3..e8bb00a6e 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRLiteral.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRLiteral.java @@ -12,7 +12,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.ERecord; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.elaboration.expressions.printing.ExpressionToStringVisitor; import org.simantics.scl.compiler.elaboration.expressions.records.FieldAssignment; import org.simantics.scl.compiler.elaboration.relations.SCLRelation; @@ -157,14 +156,6 @@ public class CHRLiteral extends Symbol { parameter.collectVars(allVars, vars); } - public void forVariables(VariableProcedure procedure) { - for(Expression parameter : parameters) - parameter.forVariables(procedure); - if(typeConstraintEvidenceParameters != null) - for(Expression parameter : typeConstraintEvidenceParameters) - parameter.forVariables(procedure); - } - public void collectFreeVariables(THashSet vars) { if(relation == SpecialCHRRelation.ASSIGN) { parameters[1].collectFreeVariables(vars); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRQuery.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRQuery.java index 4e5670fcd..777dc9f6c 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRQuery.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRQuery.java @@ -10,7 +10,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.elaboration.expressions.printing.ExpressionToStringVisitor; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.internal.parsing.Symbol; @@ -47,11 +46,6 @@ public class CHRQuery extends Symbol { literal.collectVars(allVars, vars); } - public void forVariables(VariableProcedure procedure) { - for(CHRLiteral literal : literals) - literal.forVariables(procedure); - } - public void collectFreeVariables(THashSet vars) { for(CHRLiteral literal : literals) literal.collectFreeVariables(vars); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRule.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRule.java index c668005d7..31d0ec48c 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRule.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRule.java @@ -11,7 +11,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.EVariable; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.elaboration.expressions.printing.ExpressionToStringVisitor; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.internal.parsing.Symbol; @@ -75,11 +74,6 @@ public class CHRRule extends Symbol { body.collectVars(allVars, vars); } - public void forVariables(VariableProcedure procedure) { - head.forVariables(procedure); - body.forVariables(procedure); - } - public void collectFreeVariables(THashSet vars) { head.collectFreeVariables(vars); body.collectFreeVariables(vars); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRuleset.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRuleset.java index 63a8344f2..9eca12aa9 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRuleset.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRuleset.java @@ -23,7 +23,6 @@ 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.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.elaboration.expressions.block.IncludeStatement; import org.simantics.scl.compiler.environment.AmbiguousNameException; import org.simantics.scl.compiler.errors.Locations; @@ -144,13 +143,6 @@ public class CHRRuleset extends Symbol { rule.collectVars(allVars, vars); } - public void forVariables(VariableProcedure procedure) { - for(IncludeStatement include : includes) - include.value.forVariables(procedure); - for(CHRRule rule : rules) - rule.forVariables(procedure); - } - public void collectFreeVariables(THashSet vars) { for(IncludeStatement include : includes) include.value.collectFreeVariables(vars); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/plan/AssignOp.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/plan/AssignOp.java index 5ef54ea82..730caba73 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/plan/AssignOp.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/plan/AssignOp.java @@ -25,6 +25,4 @@ public class AssignOp extends PlanOp { variable.setVal(expression.toVal(context, w)); planContext.nextOp(w); } - - } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/EqBasic.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/EqBasic.java index 121166f6b..67608de2d 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/EqBasic.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/EqBasic.java @@ -5,7 +5,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.types.Type; @@ -36,12 +35,6 @@ public class EqBasic extends Equation { } } - @Override - public void forVariables(VariableProcedure procedure) { - left.forVariables(procedure); - right.forVariables(procedure); - } - @Override public void collectFreeVariables(THashSet vars) { left.collectFreeVariables(vars); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/EqGuard.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/EqGuard.java index bbd464139..2e434b461 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/EqGuard.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/EqGuard.java @@ -33,11 +33,6 @@ public class EqGuard extends Equation { } } - @Override - public void forVariables(VariableProcedure procedure) { - guard.forVariables(procedure); - } - @Override public void collectFreeVariables(THashSet vars) { guard.collectFreeVariables(vars); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/Equation.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/Equation.java index 34ef75395..dcf11a3e6 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/Equation.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/Equation.java @@ -17,7 +17,6 @@ public abstract class Equation extends Symbol { public abstract void setLocationDeep(long loc); - public abstract void forVariables(VariableProcedure procedure); public abstract void collectFreeVariables(THashSet vars); public abstract void collectEffects(THashSet effects); public abstract void checkType(TypingContext context); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ASTExpression.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ASTExpression.java index a853dfff6..4a65459b8 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ASTExpression.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ASTExpression.java @@ -69,12 +69,6 @@ public abstract class ASTExpression extends SimplifiableExpression { getClass().getSimpleName() + " does not implement method inferType."); } - @Override - public void forVariables(VariableProcedure procedure) { - throw new InternalCompilerError("Class " + - getClass().getSimpleName() + " does not implement method forVariables."); - } - @Override public void setLocationDeep(long loc) { if(location == Locations.NO_LOCATION) diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Assignment.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Assignment.java index 04b70deb0..cb525a9ad 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Assignment.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Assignment.java @@ -28,8 +28,4 @@ public class Assignment { pattern.setLocationDeep(loc); value.setLocationDeep(loc); } - - public void forVariables(VariableProcedure procedure) { - value.forVariables(procedure); - } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Case.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Case.java index 3765fbefc..54be27b3c 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Case.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Case.java @@ -109,8 +109,4 @@ public class Case extends Symbol { patterns[i] = patterns[i].checkTypeAsPattern(context, parameterTypes[i]); value = value.checkIgnoredType(context); } - - public void forVariables(VariableProcedure procedure) { - value.forVariables(procedure); - } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/DecoratingExpression.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/DecoratingExpression.java index 5d91fbc3c..9b6c2645c 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/DecoratingExpression.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/DecoratingExpression.java @@ -100,11 +100,6 @@ public abstract class DecoratingExpression extends SimplifiableExpression { } } - @Override - public void forVariables(VariableProcedure procedure) { - expression.forVariables(procedure); - } - @Override public IVal toVal(CompilationContext context, CodeWriter w) { throw new InternalCompilerError("Cannot generate code for " + getClass().getSimpleName() + "."); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java index 09cbcf25b..73c4fa3a0 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java @@ -52,10 +52,6 @@ public class EAmbiguous extends SimplifiableExpression { TIntHashSet vars) { } - @Override - public void forVariables(VariableProcedure procedure) { - } - @Override protected void updateType() throws MatchException { throw new InternalCompilerError(); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java index 2b488068d..375039e0b 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java @@ -369,13 +369,6 @@ public class EApply extends Expression { return false; } } - - @Override - public void forVariables(VariableProcedure procedure) { - function.forVariables(procedure); - for(Expression parameter : parameters) - parameter.forVariables(procedure); - } @Override public boolean isPattern(int arity) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApplyType.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApplyType.java index e7a9d4246..cd54a44d6 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApplyType.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApplyType.java @@ -133,11 +133,6 @@ public class EApplyType extends Expression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - expression.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAsPattern.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAsPattern.java index 305d53093..1a4a5bbd0 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAsPattern.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAsPattern.java @@ -18,9 +18,9 @@ import gnu.trove.set.hash.TIntHashSet; public class EAsPattern extends Expression { - Variable var; - EVar eVar; - Expression pattern; + public Variable var; + public EVar eVar; + public Expression pattern; public EAsPattern(EVar eVar, Expression pattern) { this.eVar = eVar; @@ -143,12 +143,6 @@ public class EAsPattern extends Expression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - procedure.execute(eVar.location, var); - pattern.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java index 196ddc90f..b4d824caa 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java @@ -23,7 +23,7 @@ public class EBind extends SimplifiableExpression { public Expression pattern; public Expression value; public Expression in; - private EVariable monadEvidence; + EVariable monadEvidence; SCLValue bindFunction; Type monadType; Type valueContentType; @@ -158,14 +158,6 @@ public class EBind extends SimplifiableExpression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - pattern.forVariables(procedure); - value.forVariables(procedure); - if(monadEvidence != null) - monadEvidence.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRuleset.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRuleset.java index 2f8771930..d23b2e4ce 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRuleset.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRuleset.java @@ -37,11 +37,6 @@ public class ECHRRuleset extends Expression { in.collectVars(allVars, vars); } @Override - public void forVariables(VariableProcedure procedure) { - ruleset.forVariables(procedure); - in.forVariables(procedure); - } - @Override protected void updateType() throws MatchException { setType(in.getType()); } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRulesetConstructor.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRulesetConstructor.java index ce0385f81..25ae61345 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRulesetConstructor.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRulesetConstructor.java @@ -34,10 +34,6 @@ public class ECHRRulesetConstructor extends Expression { ruleset.collectVars(allVars, vars); } @Override - public void forVariables(VariableProcedure procedure) { - ruleset.forVariables(procedure); - } - @Override protected void updateType() throws MatchException { throw new InternalCompilerError("Type of ECHRRulesetConstructor should be already given."); } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRSelect.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRSelect.java index aa232cdb5..6b4a7fe86 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRSelect.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRSelect.java @@ -50,12 +50,6 @@ public class ECHRSelect extends Expression { expression.collectVars(allVars, vars); } - @Override - public void forVariables(VariableProcedure procedure) { - query.forVariables(procedure); - expression.forVariables(procedure); - } - @Override protected void updateType() throws MatchException { setType(Types.list(expression.getType())); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EConstant.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EConstant.java index c5b4681a8..037144a4c 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EConstant.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EConstant.java @@ -258,10 +258,6 @@ public class EConstant extends Expression { public Precedence getPrecedence() { return value.getPrecedence(); } - - @Override - public void forVariables(VariableProcedure procedure) { - } @Override public boolean isPattern(int arity) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEnforce.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEnforce.java index ea657f8b1..49d010bce 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEnforce.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEnforce.java @@ -96,11 +96,6 @@ public class EEnforce extends SimplifiableExpression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - query.forVariables(procedure); - } @Override public Expression replace(ReplaceContext context) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEquations.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEquations.java index eec5a5888..dd1a7e415 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEquations.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEquations.java @@ -61,12 +61,6 @@ public class EEquations extends SimplifiableExpression { equation.collectVars(allVars, vars); } - @Override - public void forVariables(VariableProcedure procedure) { - for(Equation equation : equations) - equation.forVariables(procedure); - } - @Override protected void updateType() throws MatchException { setType(Types.UNIT); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EError.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EError.java index fbe8cde2a..c7ea89b30 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EError.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EError.java @@ -87,10 +87,6 @@ public class EError extends Expression { public Expression replace(ReplaceContext context) { return this; } - - @Override - public void forVariables(VariableProcedure procedure) { - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EExternalConstant.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EExternalConstant.java index 1e8341e66..611e96d36 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EExternalConstant.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EExternalConstant.java @@ -116,10 +116,6 @@ public class EExternalConstant extends Expression { public IExpression toIExpression(ExpressionInterpretationContext context) { return new IConstant(value); } - - @Override - public void forVariables(VariableProcedure procedure) { - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EFieldAccess.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EFieldAccess.java index da9a7b38b..0bc8a4317 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EFieldAccess.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EFieldAccess.java @@ -185,12 +185,6 @@ public class EFieldAccess extends SimplifiableExpression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - parent.forVariables(procedure); - accessor.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EGetConstraint.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EGetConstraint.java index fc437cfd8..5f9a1eb59 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EGetConstraint.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EGetConstraint.java @@ -81,11 +81,6 @@ public class EGetConstraint extends SimplifiableExpression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - evidence.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { 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 index 1f3dccc3e..418ba69c9 100644 --- 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 @@ -170,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); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIntegerLiteral.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIntegerLiteral.java index 17cf6e58e..0b5d1a16d 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIntegerLiteral.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIntegerLiteral.java @@ -140,12 +140,6 @@ public class EIntegerLiteral extends SimplifiableExpression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - if(constraint != null) - constraint.forVariables(procedure); - } @Override public boolean isPattern(int arity) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambda.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambda.java index 573abfbb8..5138ec596 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambda.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambda.java @@ -191,12 +191,6 @@ public class ELambda extends SimplifiableExpression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - for(Case case_ : cases) - case_.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambdaType.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambdaType.java index 34464fae4..d413b8c35 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambdaType.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambdaType.java @@ -108,11 +108,6 @@ public class ELambdaType extends Expression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - value.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELet.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELet.java index de72c0c1c..5bde43500 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELet.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELet.java @@ -235,13 +235,6 @@ public class ELet extends Expression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - for(Assignment assignment : assignments) - assignment.forVariables(procedure); - in.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListComprehension.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListComprehension.java index 7a8b71ebb..fa21346f1 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListComprehension.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListComprehension.java @@ -119,12 +119,6 @@ public class EListComprehension extends SimplifiableExpression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - head.forVariables(procedure); - qualifier.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListLiteral.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListLiteral.java index d8d5f7665..5c2a0d9d4 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListLiteral.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListLiteral.java @@ -140,12 +140,6 @@ public class EListLiteral extends SimplifiableExpression { componentExpressions[i] = components[i].toIExpression(target); return new IListLiteral(componentExpressions); } - - @Override - public void forVariables(VariableProcedure procedure) { - for(Expression component : components) - component.forVariables(procedure); - } @Override public Expression replace(ReplaceContext context) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELiteral.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELiteral.java index 0d9d844b6..d2a671a1d 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELiteral.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELiteral.java @@ -119,10 +119,6 @@ public class ELiteral extends Expression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - } @Override public boolean isPattern(int arity) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EMatch.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EMatch.java index a7a726879..4ad8135c4 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EMatch.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EMatch.java @@ -186,14 +186,6 @@ public class EMatch extends Expression { public Case[] getCases() { return cases; } - - @Override - public void forVariables(VariableProcedure procedure) { - for(Expression s : scrutinee) - s.forVariables(procedure); - for(Case case_ : cases) - case_.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERealLiteral.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERealLiteral.java index 4860055c1..9468342bb 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERealLiteral.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERealLiteral.java @@ -128,12 +128,6 @@ public class ERealLiteral extends SimplifiableExpression { public String getValue() { return value; } - - @Override - public void forVariables(VariableProcedure procedure) { - if(constraint != null) - constraint.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERuleset.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERuleset.java index b9e55d849..41d43dd06 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERuleset.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERuleset.java @@ -94,12 +94,6 @@ public class ERuleset extends SimplifiableExpression { visitor.visit(this); return b.toString(); } - - public void forVariables(VariableProcedure procedure) { - for(Expression headParameter : headParameters) - headParameter.forVariables(procedure); - body.forVariables(procedure); - } } private void checkRuleTypes(TypingContext context) { @@ -400,13 +394,6 @@ public class ERuleset extends SimplifiableExpression { public Expression getIn() { return in; } - - @Override - public void forVariables(VariableProcedure procedure) { - for(DatalogRule rule : rules) - rule.forVariables(procedure); - in.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESelect.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESelect.java index 34aca4adc..42fdc6f10 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESelect.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESelect.java @@ -170,12 +170,6 @@ public class ESelect extends SimplifiableExpression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - expression.forVariables(procedure); - query.forVariables(procedure); - } @Override public Expression simplify(SimplificationContext context) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLambda.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLambda.java index 91de49eb2..0038dbf38 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLambda.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLambda.java @@ -226,11 +226,6 @@ public class ESimpleLambda extends Expression { public Variable getParameter() { return parameter; } - - @Override - public void forVariables(VariableProcedure procedure) { - value.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { 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 0a5d67651..1a084b366 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 @@ -198,12 +198,6 @@ public class ESimpleLet extends Expression { return in; } - @Override - public void forVariables(VariableProcedure procedure) { - value.forVariables(procedure); - in.forVariables(procedure); - } - @Override public Expression accept(ExpressionTransformer transformer) { return transformer.transform(this); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETransformation.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETransformation.java index e00514151..3e8f61b03 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETransformation.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETransformation.java @@ -111,11 +111,6 @@ public class ETransformation extends SimplifiableExpression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - seed.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETypeAnnotation.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETypeAnnotation.java index 568b3c108..6452812fc 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETypeAnnotation.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETypeAnnotation.java @@ -93,11 +93,6 @@ public class ETypeAnnotation extends SimplifiableExpression { public Expression getValue() { return value; } - - @Override - public void forVariables(VariableProcedure procedure) { - value.forVariables(procedure); - } @Override public Expression accept(ExpressionTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EVariable.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EVariable.java index 761ed0f2f..669867ff6 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EVariable.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EVariable.java @@ -27,7 +27,7 @@ import gnu.trove.set.hash.TIntHashSet; public class EVariable extends Expression { public static final EVariable[] EMPTY_ARRAY = new EVariable[0]; - Variable variable; + public Variable variable; public EVariable(Variable variable) { this.variable = variable; @@ -180,12 +180,6 @@ public class EVariable extends Expression { public void accept(ExpressionVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - if(variable != null) - procedure.execute(location, variable); - } @Override public boolean isPattern(int arity) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EViewPattern.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EViewPattern.java index 4997fa592..2561e63b9 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EViewPattern.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EViewPattern.java @@ -37,12 +37,6 @@ public class EViewPattern extends Expression { expression.collectVars(allVars, vars); pattern.collectVars(allVars, vars); } - - @Override - public void forVariables(VariableProcedure procedure) { - expression.forVariables(procedure); - pattern.forVariables(procedure); - } @Override public Expression inferType(TypingContext context) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EWhen.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EWhen.java index d8b42fca4..9cdb6eab2 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EWhen.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EWhen.java @@ -149,12 +149,6 @@ public class EWhen extends SimplifiableExpression { public Expression getAction() { return action; } - - @Override - public void forVariables(VariableProcedure procedure) { - query.forVariables(procedure); - action.forVariables(procedure); - } @Override public Expression simplify(SimplificationContext context) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Expression.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Expression.java index d3e226cf4..da3afdbfa 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Expression.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Expression.java @@ -14,6 +14,7 @@ import org.simantics.scl.compiler.elaboration.errors.NotPatternException; import org.simantics.scl.compiler.elaboration.expressions.lhstype.LhsType; import org.simantics.scl.compiler.elaboration.expressions.lhstype.PatternMatchingLhs; import org.simantics.scl.compiler.elaboration.expressions.printing.ExpressionToStringVisitor; +import org.simantics.scl.compiler.elaboration.expressions.visitors.ForVariablesUsesVisitor; import org.simantics.scl.compiler.elaboration.query.QAtom; import org.simantics.scl.compiler.elaboration.relations.SCLRelation; import org.simantics.scl.compiler.internal.codegen.references.IVal; @@ -156,9 +157,12 @@ public abstract class Expression extends Symbol implements Typed { public abstract void collectRefs(TObjectIntHashMap allRefs, TIntHashSet refs); public abstract void collectVars(TObjectIntHashMap allVars, TIntHashSet vars); - public abstract void forVariables(VariableProcedure procedure); - - public Expression decomposeMatching() { + + public void forVariableUses(VariableProcedure procedure) { + accept(new ForVariablesUsesVisitor(procedure)); + } + + public Expression decomposeMatching() { return this; } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/GuardedExpression.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/GuardedExpression.java index fa67162d5..f1e62b2f7 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/GuardedExpression.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/GuardedExpression.java @@ -27,10 +27,4 @@ public class GuardedExpression extends Symbol { value.setLocationDeep(loc); } } - - public void forVariables(VariableProcedure procedure) { - for(Expression guard : guards) - guard.forVariables(procedure); - value.forVariables(procedure); - } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/GuardedExpressionGroup.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/GuardedExpressionGroup.java index 992a9939e..07fbc50a6 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/GuardedExpressionGroup.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/GuardedExpressionGroup.java @@ -160,12 +160,6 @@ public class GuardedExpressionGroup extends Expression { visitor.visit(this); } - @Override - public void forVariables(VariableProcedure procedure) { - for(GuardedExpression expression : expressions) - expression.forVariables(procedure); - } - @Override public Expression accept(ExpressionTransformer transformer) { return transformer.transform(this); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/StandardExpressionVisitor.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/StandardExpressionVisitor.java index d75080095..3cdb32b72 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/StandardExpressionVisitor.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/StandardExpressionVisitor.java @@ -73,6 +73,8 @@ EquationVisitor, StatementVisitor, CHRAstQueryVisitor { expression.pattern.accept(this); expression.value.accept(this); expression.in.accept(this); + if(expression.monadEvidence != null) + visit(expression.monadEvidence); } @Override @@ -145,6 +147,7 @@ EquationVisitor, StatementVisitor, CHRAstQueryVisitor { public void visit(ELet expression) { for(Assignment assignment : expression.assignments) visit(assignment); + expression.in.accept(this); } public void visit(Assignment assignment) { @@ -380,6 +383,8 @@ EquationVisitor, StatementVisitor, CHRAstQueryVisitor { visit(rule.head); visit(rule.body); } + for(IncludeStatement include : ruleset.includes) + include.value.accept(this); } @Override diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/ExpressionAccessor.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/ExpressionAccessor.java index 793bd0065..e4cdd0937 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/ExpressionAccessor.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/ExpressionAccessor.java @@ -5,7 +5,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.types.Types; @@ -70,9 +69,4 @@ public class ExpressionAccessor extends FieldAccessor { public void accept(FieldAccessorVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - fieldName.forVariables(procedure); - } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/FieldAccessor.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/FieldAccessor.java index 0f0d8417f..aaf80610a 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/FieldAccessor.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/FieldAccessor.java @@ -5,7 +5,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.internal.parsing.Symbol; import gnu.trove.map.hash.TObjectIntHashMap; @@ -48,6 +47,4 @@ public abstract class FieldAccessor extends Symbol { public abstract void setLocationDeep(long loc); public abstract void accept(FieldAccessorVisitor visitor); - - public abstract void forVariables(VariableProcedure procedure); } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/IdAccessor.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/IdAccessor.java index 9cb37e58f..920a81606 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/IdAccessor.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/IdAccessor.java @@ -3,7 +3,6 @@ package org.simantics.scl.compiler.elaboration.expressions.accessor; import org.simantics.scl.compiler.constants.StringConstant; import org.simantics.scl.compiler.elaboration.expressions.ELiteral; import org.simantics.scl.compiler.elaboration.expressions.Expression; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; public class IdAccessor extends FieldAccessor { @@ -34,8 +33,4 @@ public class IdAccessor extends FieldAccessor { public void accept(FieldAccessorVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/StringAccessor.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/StringAccessor.java index d08a4383f..ac038d12c 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/StringAccessor.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/StringAccessor.java @@ -3,7 +3,6 @@ package org.simantics.scl.compiler.elaboration.expressions.accessor; import org.simantics.scl.compiler.constants.StringConstant; import org.simantics.scl.compiler.elaboration.expressions.ELiteral; import org.simantics.scl.compiler.elaboration.expressions.Expression; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; public class StringAccessor extends FieldAccessor { @@ -29,8 +28,4 @@ public class StringAccessor extends FieldAccessor { public void accept(FieldAccessorVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListAssignment.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListAssignment.java index b1efd2ca9..a0073b889 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListAssignment.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListAssignment.java @@ -7,7 +7,6 @@ import org.simantics.scl.compiler.elaboration.expressions.Case; import org.simantics.scl.compiler.elaboration.expressions.EVariable; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.types.Type; @@ -99,11 +98,6 @@ public class ListAssignment extends ListQualifier { visitor.visit(this); } - @Override - public void forVariables(VariableProcedure procedure) { - value.forVariables(procedure); - } - @Override public ListQualifier accept(ListQualifierTransformer transformer) { return transformer.transform(this); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGenerator.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGenerator.java index 90b68c5dd..c7f89ba76 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGenerator.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGenerator.java @@ -7,7 +7,6 @@ import org.simantics.scl.compiler.elaboration.expressions.Case; import org.simantics.scl.compiler.elaboration.expressions.EVariable; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.types.TMetaVar; import org.simantics.scl.compiler.types.Type; @@ -105,11 +104,6 @@ public class ListGenerator extends ListQualifier { visitor.visit(this); } - @Override - public void forVariables(VariableProcedure procedure) { - value.forVariables(procedure); - } - @Override public ListQualifier accept(ListQualifierTransformer transformer) { return transformer.transform(this); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGuard.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGuard.java index 626bd48cb..c9e29ca5b 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGuard.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGuard.java @@ -5,7 +5,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.Types; @@ -73,11 +72,6 @@ public class ListGuard extends ListQualifier { visitor.visit(this); } - @Override - public void forVariables(VariableProcedure procedure) { - condition.forVariables(procedure); - } - @Override public ListQualifier accept(ListQualifierTransformer transformer) { return transformer.transform(this); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListQualifier.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListQualifier.java index 939e6fd66..048b525f7 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListQualifier.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListQualifier.java @@ -4,7 +4,6 @@ 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.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.internal.parsing.Symbol; import org.simantics.scl.compiler.types.Type; @@ -27,6 +26,5 @@ public abstract class ListQualifier extends Symbol { public abstract void setLocationDeep(long loc); public abstract void accept(ListQualifierVisitor visitor); public abstract ListQualifier accept(ListQualifierTransformer transformer); - public abstract void forVariables(VariableProcedure procedure); } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListSeq.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListSeq.java index f56820d2a..5d633d8d0 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListSeq.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListSeq.java @@ -5,7 +5,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.types.Type; @@ -95,12 +94,6 @@ public class ListSeq extends ListQualifier { visitor.visit(this); } - @Override - public void forVariables(VariableProcedure procedure) { - a.forVariables(procedure); - b.forVariables(procedure); - } - @Override public ListQualifier accept(ListQualifierTransformer transformer) { return transformer.transform(this); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListThen.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListThen.java index fbc153226..451493ba3 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListThen.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListThen.java @@ -5,7 +5,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.types.TMetaVar; import org.simantics.scl.compiler.types.Type; @@ -122,14 +121,6 @@ public class ListThen extends ListQualifier { public void accept(ListQualifierVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - left.forVariables(procedure); - transformer.forVariables(procedure); - if(by != null) - by.forVariables(procedure); - } @Override public ListQualifier accept(ListQualifierTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/visitors/ForVariablesUsesVisitor.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/visitors/ForVariablesUsesVisitor.java new file mode 100644 index 000000000..b4d1fd4fe --- /dev/null +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/visitors/ForVariablesUsesVisitor.java @@ -0,0 +1,25 @@ +package org.simantics.scl.compiler.elaboration.expressions.visitors; + +import org.simantics.scl.compiler.elaboration.expressions.EAsPattern; +import org.simantics.scl.compiler.elaboration.expressions.EVariable; +import org.simantics.scl.compiler.elaboration.expressions.StandardExpressionVisitor; +import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; + +public class ForVariablesUsesVisitor extends StandardExpressionVisitor { + VariableProcedure procedure; + + public ForVariablesUsesVisitor(VariableProcedure procedure) { + this.procedure = procedure; + } + + @Override + public void visit(EVariable expression) { + if(expression.variable != null) + procedure.execute(expression.location, expression.variable); + } + @Override + public void visit(EAsPattern expression) { + expression.pattern.accept(this); + procedure.execute(expression.eVar.location, expression.var); + } +} diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractCombiner.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractCombiner.java index 53eb780fd..52a59585f 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractCombiner.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractCombiner.java @@ -8,7 +8,6 @@ import org.simantics.scl.compiler.elaboration.expressions.EApply; import org.simantics.scl.compiler.elaboration.expressions.EVar; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.elaboration.query.pre.QPreExists; import org.simantics.scl.compiler.elaboration.query.pre.QPreGuard; import org.simantics.scl.compiler.errors.Locations; @@ -95,10 +94,4 @@ public abstract class QAbstractCombiner extends Query { query.setLocationDeep(loc); } } - - @Override - public void forVariables(VariableProcedure procedure) { - for(Query query : queries) - query.forVariables(procedure); - } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractModifier.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractModifier.java index e04246e40..2b6c67711 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractModifier.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractModifier.java @@ -3,7 +3,6 @@ package org.simantics.scl.compiler.elaboration.query; import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.errors.Locations; import gnu.trove.map.hash.TObjectIntHashMap; @@ -51,9 +50,4 @@ public abstract class QAbstractModifier extends Query { query.setLocationDeep(loc); } } - - @Override - public void forVariables(VariableProcedure procedure) { - query.forVariables(procedure); - } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAtom.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAtom.java index fd7dacb79..7a20ae3c5 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAtom.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAtom.java @@ -129,7 +129,7 @@ public class QAtom extends Query { } else { optionalVariableByParameter[i] = -1; - parameter.forVariables(procedure); + parameter.forVariableUses(procedure); } } } @@ -250,12 +250,6 @@ public class QAtom extends Query { visitor.visit(this); } - @Override - public void forVariables(VariableProcedure procedure) { - for(Expression parameter : parameters) - parameter.forVariables(procedure); - } - @Override public void splitToPhases(TIntObjectHashMap> result) { int phase = relation.getPhase(); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QExists.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QExists.java index 5356eccc2..293c8bf70 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QExists.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QExists.java @@ -8,7 +8,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.EVariable; import org.simantics.scl.compiler.elaboration.expressions.QueryTransformer; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.elaboration.query.compilation.ConstraintCollectionContext; import org.simantics.scl.compiler.elaboration.query.compilation.DerivateException; import org.simantics.scl.compiler.elaboration.query.compilation.UnsolvableQueryException; @@ -92,13 +91,6 @@ public class QExists extends QAbstractModifier { visitor.visit(this); } - @Override - public void forVariables(VariableProcedure procedure) { - for(Variable variable : variables) - procedure.execute(location, variable); - super.forVariables(procedure); - } - @Override public Query accept(QueryTransformer transformer) { return transformer.transform(this); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QIf.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QIf.java index 62ff9583c..719f474b6 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QIf.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QIf.java @@ -5,7 +5,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.QueryTransformer; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.elaboration.query.compilation.ConstraintCollectionContext; import org.simantics.scl.compiler.elaboration.query.compilation.UnsolvableQueryException; import org.simantics.scl.compiler.errors.Locations; @@ -82,13 +81,6 @@ public class QIf extends Query { public void accept(QueryVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - condition.forVariables(procedure); - elseQuery.forVariables(procedure); - thenQuery.forVariables(procedure); - } @Override public Query accept(QueryTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QMapping.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QMapping.java index ca9378c89..12da9da3b 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QMapping.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QMapping.java @@ -6,7 +6,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TypingContext; import org.simantics.scl.compiler.elaboration.expressions.Expression; import org.simantics.scl.compiler.elaboration.expressions.QueryTransformer; import org.simantics.scl.compiler.elaboration.expressions.Variable; -import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.elaboration.query.compilation.ConstraintCollectionContext; import org.simantics.scl.compiler.elaboration.query.compilation.UnsolvableQueryException; import org.simantics.scl.compiler.elaboration.rules.MappingRelation; @@ -82,12 +81,6 @@ public class QMapping extends Query { public void accept(QueryVisitor visitor) { visitor.visit(this); } - - @Override - public void forVariables(VariableProcedure procedure) { - for(Expression parameter : parameters) - parameter.forVariables(procedure); - } @Override public Query accept(QueryTransformer transformer) { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/Query.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/Query.java index 0ac54e22e..0b804caf3 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/Query.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/Query.java @@ -14,6 +14,7 @@ import org.simantics.scl.compiler.elaboration.expressions.StandardExpressionVisi import org.simantics.scl.compiler.elaboration.expressions.Variable; import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure; import org.simantics.scl.compiler.elaboration.expressions.printing.ExpressionToStringVisitor; +import org.simantics.scl.compiler.elaboration.expressions.visitors.ForVariablesUsesVisitor; import org.simantics.scl.compiler.elaboration.query.compilation.ConstraintCollectionContext; import org.simantics.scl.compiler.elaboration.query.compilation.DerivateException; import org.simantics.scl.compiler.elaboration.query.compilation.DynamicProgrammingOrdering; @@ -135,8 +136,6 @@ public abstract class Query extends Symbol { }); } - public abstract void forVariables(VariableProcedure procedure); - public TIntObjectHashMap> splitToPhases() { TIntObjectHashMap> result = new TIntObjectHashMap>(2); splitToPhases(result); @@ -156,4 +155,8 @@ public abstract class Query extends Symbol { } public abstract Query accept(QueryTransformer transformer); + + public void forVariables(VariableProcedure procedure) { + accept(new ForVariablesUsesVisitor(procedure)); + } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/pre/PreQuery.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/pre/PreQuery.java index ee96433d3..dc398f857 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/pre/PreQuery.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/pre/PreQuery.java @@ -71,9 +71,4 @@ public abstract class PreQuery extends Query { query = new QExists(extraVariables.toArray(new Variable[extraVariables.size()]), query); return query; } - - @Override - public void forVariables(VariableProcedure procedure) { - throw new InternalCompilerError(location, getClass().getSimpleName() + " does not support forVariables."); - } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/relations/TransitiveClosureRelation.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/relations/TransitiveClosureRelation.java index 42eb9530d..b404b1c53 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/relations/TransitiveClosureRelation.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/relations/TransitiveClosureRelation.java @@ -8,7 +8,6 @@ import static org.simantics.scl.compiler.elaboration.expressions.Expressions.let import static org.simantics.scl.compiler.elaboration.expressions.Expressions.tuple; import static org.simantics.scl.compiler.elaboration.expressions.Expressions.var; -import org.simantics.scl.compiler.common.names.Name; import org.simantics.scl.compiler.common.names.Names; import org.simantics.scl.compiler.elaboration.expressions.EApply; import org.simantics.scl.compiler.elaboration.expressions.EVariable; diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/TransformationBuilder.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/TransformationBuilder.java index 6060315c4..50958221c 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/TransformationBuilder.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/TransformationBuilder.java @@ -184,7 +184,7 @@ public class TransformationBuilder { } }; for(QMapping mapping : decomposed.targetMappings) - mapping.parameters[0].forVariables(check); + mapping.parameters[0].forVariableUses(check); sourceVariables = sourceVariableList.toArray(new Variable[sourceVariableList.size()]); } @@ -220,7 +220,7 @@ public class TransformationBuilder { } else { PatternAnalyzer analyzer = new PatternAnalyzer(variableSet, mappedVariableUseCount); - expression.forVariables(analyzer); + expression.forVariableUses(analyzer); if(analyzer.containsVariables) semiopenMappings.add(mapping); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/UnifiableFactory.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/UnifiableFactory.java index 75b083f0c..06da23562 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/UnifiableFactory.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/UnifiableFactory.java @@ -186,7 +186,7 @@ public class UnifiableFactory { // Default action final THashSet dependences = new THashSet(); - expression.forVariables(new VariableProcedure() { + expression.forVariableUses(new VariableProcedure() { @Override public void execute(long location, Variable variable) { -- 2.47.1