]> 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
old mode 100755 (executable)
new mode 100644 (file)
index af0a43d..c96218b
@@ -1,78 +1,51 @@
-package org.simantics.scl.compiler.elaboration.expressions;\r
-\r
-import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
-import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
-import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
-import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;\r
-import org.simantics.scl.compiler.types.Type;\r
-import org.simantics.scl.compiler.types.exceptions.MatchException;\r
-\r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
-public abstract class ASTExpression extends SimplifiableExpression {\r
-    public ASTExpression() {\r
-    }\r
-    \r
-    @Override\r
-    final public Expression simplify(SimplificationContext context) {\r
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support simplify.");\r
-    }\r
-    \r
-    @Override\r
-    final public void collectFreeVariables(THashSet<Variable> vars) {\r
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectFreeVariables.");\r
-\r
-    }\r
-    \r
-    @Override\r
-    final public void collectRefs(TObjectIntHashMap<Object> allRefs,\r
-            TIntHashSet refs) {\r
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectRefs.");\r
-    }\r
-    \r
-    @Override\r
-    final public void collectVars(TObjectIntHashMap<Variable> allVars,\r
-            TIntHashSet vars) {\r
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectVars.");\r
-    }\r
-    \r
-    @Override\r
-    final protected void updateType() throws MatchException {\r
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support updateType.");\r
-    }\r
-    \r
-    @Override\r
-    final public Expression decorate(ExpressionDecorator decorator) {\r
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support decorate.");\r
-    }\r
-    \r
-    @Override\r
-    final public void collectEffects(THashSet<Type> effects) {\r
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support collectEffects.");\r
-    }\r
-    \r
-    @Override\r
-    final public void accept(ExpressionVisitor visitor) {\r
-        throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");\r
-    }\r
-    \r
-    @Override\r
-    public Expression checkBasicType(TypingContext context, Type requiredType) {\r
-        throw new InternalCompilerError("Class " + \r
-                getClass().getSimpleName() + " does not implement method checkBasicType.");\r
-    }\r
-    \r
-    @Override\r
-    public Expression inferType(TypingContext context) {\r
-        throw new InternalCompilerError("Class " + \r
-                getClass().getSimpleName() + " does not implement method inferType.");\r
-    }\r
-    \r
-    @Override\r
-    public void forVariables(VariableProcedure procedure) {\r
-        throw new InternalCompilerError("Class " + \r
-                getClass().getSimpleName() + " does not implement method forVariables.");\r
-    }\r
-}\r
+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.errors.Locations;
+import org.simantics.scl.compiler.types.Type;
+import org.simantics.scl.compiler.types.exceptions.MatchException;
+
+public abstract class ASTExpression extends SimplifiableExpression {
+    public ASTExpression() {
+    }
+    
+    @Override
+    final public Expression simplify(SimplificationContext context) {
+        throw new InternalCompilerError(getClass().getSimpleName() + " does not support simplify.");
+    }
+    
+    @Override
+    final protected void updateType() throws MatchException {
+        throw new InternalCompilerError(getClass().getSimpleName() + " does not support updateType.");
+    }
+    
+    @Override
+    public void accept(ExpressionVisitor visitor) {
+        throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
+    }
+    
+    @Override
+    public Expression accept(ExpressionTransformer transformer) {
+        throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
+    }
+    
+    @Override
+    public Expression checkBasicType(TypingContext context, Type requiredType) {
+        throw new InternalCompilerError("Class " + 
+                getClass().getSimpleName() + " does not implement method checkBasicType.");
+    }
+    
+    @Override
+    public Expression inferType(TypingContext context) {
+        throw new InternalCompilerError("Class " + 
+                getClass().getSimpleName() + " does not implement method inferType.");
+    }
+    
+    @Override
+    public void setLocationDeep(long loc) {
+        if(location == Locations.NO_LOCATION)
+            location = loc;
+    }
+}