]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - 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
index fbc0a79014dcb107c3b17842ef5bbb06fddaac8b..c96218b6524d74b37dbe1bd1882071bb300239b2 100644 (file)
@@ -3,14 +3,10 @@ package org.simantics.scl.compiler.elaboration.expressions;
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
-import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;
+import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.exceptions.MatchException;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 public abstract class ASTExpression extends SimplifiableExpression {
     public ASTExpression() {
     }
@@ -20,41 +16,18 @@ public abstract class ASTExpression extends SimplifiableExpression {
         throw new InternalCompilerError(getClass().getSimpleName() + " does not support simplify.");
     }
     
-    @Override
-    final public void collectFreeVariables(THashSet<Variable> vars) {
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectFreeVariables.");
-
-    }
-    
-    @Override
-    final public void collectRefs(TObjectIntHashMap<Object> allRefs,
-            TIntHashSet refs) {
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectRefs.");
-    }
-    
-    @Override
-    final public void collectVars(TObjectIntHashMap<Variable> allVars,
-            TIntHashSet vars) {
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectVars.");
-    }
-    
     @Override
     final protected void updateType() throws MatchException {
         throw new InternalCompilerError(getClass().getSimpleName() + " does not support updateType.");
     }
     
     @Override
-    final public Expression decorate(ExpressionDecorator decorator) {
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support decorate.");
-    }
-    
-    @Override
-    final public void collectEffects(THashSet<Type> effects) {
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectEffects.");
+    public void accept(ExpressionVisitor visitor) {
+        throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
     }
     
     @Override
-    public void accept(ExpressionVisitor visitor) {
+    public Expression accept(ExpressionTransformer transformer) {
         throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
     }
     
@@ -71,8 +44,8 @@ public abstract class ASTExpression extends SimplifiableExpression {
     }
     
     @Override
-    public void forVariables(VariableProcedure procedure) {
-        throw new InternalCompilerError("Class " + 
-                getClass().getSimpleName() + " does not implement method forVariables.");
+    public void setLocationDeep(long loc) {
+        if(location == Locations.NO_LOCATION)
+            location = loc;
     }
 }