]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ASTExpression.java
a853dfff6731f9309699b822fce6fec5d3d5999a
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / ASTExpression.java
1 package org.simantics.scl.compiler.elaboration.expressions;
2
3 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
4 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
5 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
6 import org.simantics.scl.compiler.errors.Locations;
7 import org.simantics.scl.compiler.types.Type;
8 import org.simantics.scl.compiler.types.exceptions.MatchException;
9
10 import gnu.trove.map.hash.TObjectIntHashMap;
11 import gnu.trove.set.hash.THashSet;
12 import gnu.trove.set.hash.TIntHashSet;
13
14 public abstract class ASTExpression extends SimplifiableExpression {
15     public ASTExpression() {
16     }
17     
18     @Override
19     final public Expression simplify(SimplificationContext context) {
20         throw new InternalCompilerError(getClass().getSimpleName() + " does not support simplify.");
21     }
22     
23     @Override
24     final public void collectFreeVariables(THashSet<Variable> vars) {
25         throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectFreeVariables.");
26     }
27     
28     @Override
29     final public void collectRefs(TObjectIntHashMap<Object> allRefs,
30             TIntHashSet refs) {
31         throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectRefs.");
32     }
33     
34     @Override
35     final public void collectVars(TObjectIntHashMap<Variable> allVars,
36             TIntHashSet vars) {
37         throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectVars.");
38     }
39     
40     @Override
41     final protected void updateType() throws MatchException {
42         throw new InternalCompilerError(getClass().getSimpleName() + " does not support updateType.");
43     }
44     
45     @Override
46     final public void collectEffects(THashSet<Type> effects) {
47         throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectEffects.");
48     }
49     
50     @Override
51     public void accept(ExpressionVisitor visitor) {
52         throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
53     }
54     
55     @Override
56     public Expression accept(ExpressionTransformer transformer) {
57         throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
58     }
59     
60     @Override
61     public Expression checkBasicType(TypingContext context, Type requiredType) {
62         throw new InternalCompilerError("Class " + 
63                 getClass().getSimpleName() + " does not implement method checkBasicType.");
64     }
65     
66     @Override
67     public Expression inferType(TypingContext context) {
68         throw new InternalCompilerError("Class " + 
69                 getClass().getSimpleName() + " does not implement method inferType.");
70     }
71     
72     @Override
73     public void forVariables(VariableProcedure procedure) {
74         throw new InternalCompilerError("Class " + 
75                 getClass().getSimpleName() + " does not implement method forVariables.");
76     }
77     
78     @Override
79     public void setLocationDeep(long loc) {
80         if(location == Locations.NO_LOCATION)
81             location = loc;
82     }
83 }