import org.simantics.scl.compiler.common.names.Name;
import org.simantics.scl.compiler.common.precedence.Precedence;
+import org.simantics.scl.compiler.compilation.CompilationContext;
import org.simantics.scl.compiler.constants.Constant;
import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;
import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
import org.simantics.scl.compiler.elaboration.expressions.lhstype.LhsType;
import org.simantics.scl.compiler.elaboration.expressions.lhstype.PatternMatchingLhs;
import org.simantics.scl.compiler.elaboration.modules.SCLValue;
-import org.simantics.scl.compiler.environment.Environment;
import org.simantics.scl.compiler.errors.Locations;
import org.simantics.scl.compiler.internal.codegen.references.IVal;
import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;
-import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;
import org.simantics.scl.compiler.internal.interpreted.IConstant;
import org.simantics.scl.compiler.internal.interpreted.IExpression;
import org.simantics.scl.compiler.top.ExpressionInterpretationContext;
import gnu.trove.set.hash.TIntHashSet;
public class EConstant extends Expression {
- SCLValue value;
+ public SCLValue value;
Type[] typeParameters;
public EConstant(SCLValue value, Type ... typeParameters) {
return this;
}
- public void collectRefs(TObjectIntHashMap<Object> allRefs, TIntHashSet refs) {
- int id = allRefs.get(value);
- if(id >= 0)
- refs.add(id);
+ @Override
+ public void collectVars(TObjectIntHashMap<Variable> allVars,
+ TIntHashSet vars) {
}
-
- @Override
- public void collectVars(TObjectIntHashMap<Variable> allVars,
- TIntHashSet vars) {
- }
- public void toString(StringBuilder b, TypeUnparsingContext tuc) {
- Name name = value.getName();
- if(name.module.equals("Builtin") || name.module.equals("Prelude"))
- b.append(name.name);
- else
- b.append(name);
+ public void toString(StringBuilder b, TypeUnparsingContext tuc) {
+ Name name = value.getName();
+ if(name.module.equals("Builtin") || name.module.equals("Prelude"))
+ b.append(name.name);
+ else
+ b.append(name);
/*for(Type type : typeParameters) {
b.append(" <");
b.append(type.toString(tuc));
}
@Override
- public IVal toVal(Environment env, CodeWriter w) {
+ public IVal toVal(CompilationContext context, CodeWriter w) {
IVal val = value.getValue();
if(typeParameters.length > 0) {
val = val.createSpecialization(typeParameters);
return this;
}
else
- return applyPUnit(context.getCompilationContext());
- }
-
- @Override
- public Expression decorate(ExpressionDecorator decorator) {
- return decorator.decorate(this);
+ return applyPUnit(context);
}
@Override
public Precedence getPrecedence() {
return value.getPrecedence();
}
-
- @Override
- public void forVariables(VariableProcedure procedure) {
- }
@Override
public boolean isPattern(int arity) {