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