import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;
import org.simantics.scl.compiler.internal.codegen.writer.RecursiveDefinitionWriter;
import org.simantics.scl.compiler.internal.elaboration.decomposed.DecomposedExpression;
-import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;
import org.simantics.scl.compiler.internal.elaboration.utils.StronglyConnectedComponents;
import org.simantics.scl.compiler.types.Type;
import org.simantics.scl.compiler.types.Types;
import org.simantics.scl.compiler.types.kinds.Kinds;
import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
import gnu.trove.set.hash.TIntHashSet;
/**
this.assignments = assignments;
this.in = in;
}
-
- @Override
- public void collectRefs(final TObjectIntHashMap<Object> allRefs, final TIntHashSet refs) {
- for(Assignment assign : assignments)
- assign.value.collectRefs(allRefs, refs);
- in.collectRefs(allRefs, refs);
- }
-
- @Override
- public void collectVars(TObjectIntHashMap<Variable> allVars,
- TIntHashSet vars) {
- for(Assignment assign : assignments)
- assign.value.collectVars(allVars, vars);
- in.collectVars(allVars, vars);
- }
@Override
protected void updateType() throws MatchException {
return result;
}
- @Override
- public void collectFreeVariables(THashSet<Variable> vars) {
- in.collectFreeVariables(vars);
- for(Assignment assign : assignments)
- assign.value.collectFreeVariables(vars);
- for(Assignment assign : assignments)
- assign.pattern.removeFreeVariables(vars);
- }
-
@Override
public Expression resolve(TranslationContext context) {
throw new InternalCompilerError("ELet should be already resolved.");
IVal[] parameters = newW.getParameters();
for(int j=0;j<parameters.length;++j)
decomposed.parameters[j].setVal(parameters[j]);
- newW.return_(decomposed.body.toVal(context, newW));
+ newW.return_(assignments[i].value.location, decomposed.body.toVal(context, newW));
}
return in.toVal(context, w);
}
in = in.checkIgnoredType(context);
return this;
}
-
- @Override
- public Expression decorate(ExpressionDecorator decorator) {
- in = in.decorate(decorator);
- for(Assignment assignment : assignments)
- assignment.decorate(decorator);
- return decorator.decorate(this);
- }
-
- @Override
- public void collectEffects(THashSet<Type> effects) {
- for(Assignment assignment : assignments) {
- assignment.pattern.collectEffects(effects);
- assignment.value.collectEffects(effects);
- }
- in.collectEffects(effects);
- }
@Override
public void setLocationDeep(long loc) {
public void accept(ExpressionVisitor visitor) {
visitor.visit(this);
}
-
- @Override
- public void forVariables(VariableProcedure procedure) {
- for(Assignment assignment : assignments)
- assignment.forVariables(procedure);
- in.forVariables(procedure);
- }
@Override
public Expression accept(ExpressionTransformer transformer) {