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