import org.simantics.scl.compiler.elaboration.expressions.EVariable;
import org.simantics.scl.compiler.elaboration.expressions.Expression;
import org.simantics.scl.compiler.elaboration.expressions.Variable;
+import org.simantics.scl.compiler.elaboration.expressions.records.FieldAssignment;
import org.simantics.scl.compiler.types.TVar;
import org.simantics.scl.compiler.types.Type;
+import org.simantics.scl.compiler.types.Types;
import gnu.trove.map.hash.THashMap;
public ReplaceContext(TypingContext typingContext) {
this(new THashMap<TVar, Type>(), new THashMap<Variable, Expression>(), typingContext);
}
+
+ public Expression[] replace(Expression[] expressions) {
+ if(expressions == null)
+ return null;
+ Expression[] result = new Expression[expressions.length];
+ for(int i=0;i<expressions.length;++i)
+ result[i] = expressions[i].replace(this);
+ return result;
+ }
+
+ public Type[] replace(Type[] types) {
+ if(types == null)
+ return null;
+ return Types.replace(types, tvarMap);
+ }
+
+ public FieldAssignment[] replace(FieldAssignment[] fields) {
+ if(fields == null)
+ return null;
+ FieldAssignment[] result = new FieldAssignment[fields.length];
+ for(int i=0;i<fields.length;++i)
+ result[i] = fields[i].replace(this);
+ return result;
+ }
}