]> gerrit.simantics Code Review - simantics/platform.git/blob
b4d1fd4fe2d558f8e4efc6c48938aaa63c749ffb
[simantics/platform.git] /
1 package org.simantics.scl.compiler.elaboration.expressions.visitors;
2
3 import org.simantics.scl.compiler.elaboration.expressions.EAsPattern;
4 import org.simantics.scl.compiler.elaboration.expressions.EVariable;
5 import org.simantics.scl.compiler.elaboration.expressions.StandardExpressionVisitor;
6 import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure;
7
8 public class ForVariablesUsesVisitor extends StandardExpressionVisitor {
9     VariableProcedure procedure;
10     
11     public ForVariablesUsesVisitor(VariableProcedure procedure) {
12         this.procedure = procedure;
13     }
14     
15     @Override
16     public void visit(EVariable expression) {
17         if(expression.variable != null)
18             procedure.execute(expression.location, expression.variable);
19     }
20     @Override
21     public void visit(EAsPattern expression) {
22         expression.pattern.accept(this);
23         procedure.execute(expression.eVar.location, expression.var);
24     }
25 }