1 package org.simantics.scl.compiler.elaboration.expressions;
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;
10 import gnu.trove.map.hash.TObjectIntHashMap;
11 import gnu.trove.set.hash.THashSet;
12 import gnu.trove.set.hash.TIntHashSet;
14 public abstract class ASTExpression extends SimplifiableExpression {
15 public ASTExpression() {
19 final public Expression simplify(SimplificationContext context) {
20 throw new InternalCompilerError(getClass().getSimpleName() + " does not support simplify.");
24 final public void collectFreeVariables(THashSet<Variable> vars) {
25 throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectFreeVariables.");
29 final public void collectVars(TObjectIntHashMap<Variable> allVars,
31 throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectVars.");
35 final protected void updateType() throws MatchException {
36 throw new InternalCompilerError(getClass().getSimpleName() + " does not support updateType.");
40 final public void collectEffects(THashSet<Type> effects) {
41 throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectEffects.");
45 public void accept(ExpressionVisitor visitor) {
46 throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
50 public Expression accept(ExpressionTransformer transformer) {
51 throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
55 public Expression checkBasicType(TypingContext context, Type requiredType) {
56 throw new InternalCompilerError("Class " +
57 getClass().getSimpleName() + " does not implement method checkBasicType.");
61 public Expression inferType(TypingContext context) {
62 throw new InternalCompilerError("Class " +
63 getClass().getSimpleName() + " does not implement method inferType.");
67 public void setLocationDeep(long loc) {
68 if(location == Locations.NO_LOCATION)