package org.simantics.scl.compiler.elaboration.expressions;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Set;
import org.simantics.scl.compiler.compilation.CompilationContext;
import org.simantics.scl.compiler.constants.Constant;
import org.simantics.scl.compiler.internal.interpreted.IConstant;
import org.simantics.scl.compiler.internal.interpreted.IExpression;
import org.simantics.scl.compiler.top.ExpressionInterpretationContext;
-import org.simantics.scl.compiler.types.Type;
import org.simantics.scl.compiler.types.exceptions.MatchException;
import org.simantics.scl.compiler.types.util.TypeUnparsingContext;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
public class ELiteral extends Expression {
Constant value;
public Constant getValue() {
return value;
}
-
- public void collectRefs(TObjectIntHashMap<Object> allRefs, TIntHashSet refs) {
+
+ @Override
+ public Set<Variable> getFreeVariables() {
+ return Collections.emptySet();
}
- @Override
- public void collectVars(TObjectIntHashMap<Variable> allVars,
- TIntHashSet vars) {
- }
-
- public void toString(StringBuilder b, TypeUnparsingContext tuc) {
+ public void toString(StringBuilder b, TypeUnparsingContext tuc) {
b.append(value);
}
-
- @Override
- protected void updateType() throws MatchException {
- setType(value.getType());
- }
- @Override
- public IVal toVal(CompilationContext context, CodeWriter w) {
- return value;
+ @Override
+ protected void updateType() throws MatchException {
+ setType(value.getType());
}
@Override
- public void collectFreeVariables(THashSet<Variable> vars) {
+ public IVal toVal(CompilationContext context, CodeWriter w) {
+ return value;
}
-
@Override
public Expression simplify(SimplificationContext context) {
return this;
return new ELiteral(value);
}
- @Override
- public void removeFreeVariables(THashSet<Variable> vars) {
- }
-
@Override
public IExpression toIExpression(ExpressionInterpretationContext target) {
return new IConstant(value.realizeValue(target.localClassBuilder));
public Expression inferType(TypingContext context) {
return this;
}
-
- @Override
- public void collectEffects(THashSet<Type> effects) {
- }
@Override
public void setLocationDeep(long loc) {
public void accept(ExpressionVisitor visitor) {
visitor.visit(this);
}
-
- @Override
- public void forVariables(VariableProcedure procedure) {
- }
@Override
public boolean isPattern(int arity) {