1 package org.simantics.scl.compiler.elaboration.expressions;
\r
3 import org.simantics.scl.compiler.common.names.Name;
\r
4 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
\r
5 import org.simantics.scl.compiler.elaboration.modules.SCLValue;
\r
6 import org.simantics.scl.compiler.errors.Locations;
\r
8 public class ERange extends ASTExpression {
\r
12 public ERange(Expression from, Expression to) {
\r
17 private static final Name RANGE = Name.create("Prelude", "range");
\r
20 public Expression resolve(TranslationContext context) {
\r
21 from = from.resolve(context);
\r
22 to = to.resolve(context);
\r
23 SCLValue rangeFunction = context.getEnvironment().getValue(RANGE);
\r
24 return new EApply(location, new EConstant(rangeFunction), from, to);
\r
28 public void setLocationDeep(long loc) {
\r
29 if(location == Locations.NO_LOCATION) {
\r
31 from.setLocationDeep(loc);
\r
32 to.setLocationDeep(loc);
\r
37 public Expression accept(ExpressionTransformer transformer) {
\r
38 return transformer.transform(this);
\r