1 package org.simantics.scl.compiler.elaboration.expressions;
\r
3 import gnu.trove.map.hash.TObjectIntHashMap;
\r
4 import gnu.trove.set.hash.THashSet;
\r
5 import gnu.trove.set.hash.TIntHashSet;
\r
7 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;
\r
8 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
\r
9 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
\r
10 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
\r
11 import org.simantics.scl.compiler.environment.Environment;
\r
12 import org.simantics.scl.compiler.errors.Locations;
\r
13 import org.simantics.scl.compiler.internal.codegen.references.IVal;
\r
14 import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;
\r
15 import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;
\r
16 import org.simantics.scl.compiler.types.Type;
\r
17 import org.simantics.scl.compiler.types.Types;
\r
18 import org.simantics.scl.compiler.types.exceptions.MatchException;
\r
19 import org.simantics.scl.compiler.types.kinds.Kinds;
\r
21 public class EError extends Expression {
\r
23 public EError(long loc, Type type) {
\r
31 public EError(long loc) {
\r
32 this(loc, Types.metaVar(Kinds.STAR));
\r
35 public void collectRefs(TObjectIntHashMap<Object> allRefs, TIntHashSet refs) {
\r
39 public void collectVars(TObjectIntHashMap<Variable> allVars,
\r
40 TIntHashSet vars) {
\r
44 protected void updateType() throws MatchException {
\r
45 setType(Types.metaVar(Kinds.STAR));
\r
49 public IVal toVal(Environment env, CodeWriter w) {
\r
50 throw new UnsupportedOperationException();
\r
54 public void collectFreeVariables(THashSet<Variable> vars) {
\r
58 public Expression simplify(SimplificationContext context) {
\r
63 public Expression resolve(TranslationContext context) {
\r
68 public Expression inferType(TypingContext context) {
\r
73 public Expression decorate(ExpressionDecorator decorator) {
\r
78 public void collectEffects(THashSet<Type> effects) {
\r
82 public void setLocationDeep(long loc) {
\r
83 if(location == Locations.NO_LOCATION)
\r
88 public void accept(ExpressionVisitor visitor) {
\r
89 visitor.visit(this);
\r
93 public Expression replace(ReplaceContext context) {
\r
98 public void forVariables(VariableProcedure procedure) {
\r
102 public Expression accept(ExpressionTransformer transformer) {
\r
103 return transformer.transform(this);
\r