(refs #7375) Replaced collectFreeVariables method by a visitor
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / query / QAbstractModifier.java
1 package org.simantics.scl.compiler.elaboration.query;
2
3 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
4 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
5 import org.simantics.scl.compiler.elaboration.expressions.Variable;
6 import org.simantics.scl.compiler.errors.Locations;
7
8 import gnu.trove.map.hash.TObjectIntHashMap;
9 import gnu.trove.set.hash.TIntHashSet;
10
11 public abstract class QAbstractModifier extends Query {
12     public Query query;
13     
14     public QAbstractModifier(Query query) {
15         this.query = query;
16     }
17     
18     @Override
19     public Query resolve(TranslationContext context) {
20         query = query.resolve(context);
21         return this;
22     }
23
24     @Override
25     public void checkType(TypingContext context) {
26         query.checkType(context);
27     }
28     
29     @Override
30     public void collectVars(TObjectIntHashMap<Variable> allVars,
31             TIntHashSet vars) {
32         query.collectVars(allVars, vars);
33     }
34     
35     @Override
36     public void setLocationDeep(long loc) {
37         if(location == Locations.NO_LOCATION) {
38             location = loc;
39             query.setLocationDeep(loc);
40         }
41     }
42 }