]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ASTExpression.java
2858a579c3938d8ebdfb44c24ac05d02bf03bab5
[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.TIntHashSet;
12
13 public abstract class ASTExpression extends SimplifiableExpression {
14     public ASTExpression() {
15     }
16     
17     @Override
18     final public Expression simplify(SimplificationContext context) {
19         throw new InternalCompilerError(getClass().getSimpleName() + " does not support simplify.");
20     }
21     
22     @Override
23     final public void collectVars(TObjectIntHashMap<Variable> allVars,
24             TIntHashSet vars) {
25         throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectVars.");
26     }
27     
28     @Override
29     final protected void updateType() throws MatchException {
30         throw new InternalCompilerError(getClass().getSimpleName() + " does not support updateType.");
31     }
32     
33     @Override
34     public void accept(ExpressionVisitor visitor) {
35         throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
36     }
37     
38     @Override
39     public Expression accept(ExpressionTransformer transformer) {
40         throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
41     }
42     
43     @Override
44     public Expression checkBasicType(TypingContext context, Type requiredType) {
45         throw new InternalCompilerError("Class " + 
46                 getClass().getSimpleName() + " does not implement method checkBasicType.");
47     }
48     
49     @Override
50     public Expression inferType(TypingContext context) {
51         throw new InternalCompilerError("Class " + 
52                 getClass().getSimpleName() + " does not implement method inferType.");
53     }
54     
55     @Override
56     public void setLocationDeep(long loc) {
57         if(location == Locations.NO_LOCATION)
58             location = loc;
59     }
60 }