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.internal.elaboration.utils.ExpressionDecorator;
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.");
30 final public void collectRefs(TObjectIntHashMap<Object> allRefs,
32 throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectRefs.");
36 final public void collectVars(TObjectIntHashMap<Variable> allVars,
38 throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectVars.");
42 final protected void updateType() throws MatchException {
43 throw new InternalCompilerError(getClass().getSimpleName() + " does not support updateType.");
47 final public Expression decorate(ExpressionDecorator decorator) {
48 throw new InternalCompilerError(getClass().getSimpleName() + " does not support decorate.");
52 final public void collectEffects(THashSet<Type> effects) {
53 throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectEffects.");
57 final public void accept(ExpressionVisitor visitor) {
58 throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
62 public Expression checkBasicType(TypingContext context, Type requiredType) {
63 throw new InternalCompilerError("Class " +
64 getClass().getSimpleName() + " does not implement method checkBasicType.");
68 public Expression inferType(TypingContext context) {
69 throw new InternalCompilerError("Class " +
70 getClass().getSimpleName() + " does not implement method inferType.");
74 public void forVariables(VariableProcedure procedure) {
75 throw new InternalCompilerError("Class " +
76 getClass().getSimpleName() + " does not implement method forVariables.");