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.constants.StringInterpolation;
\r
5 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
\r
6 import org.simantics.scl.compiler.elaboration.modules.SCLValue;
\r
7 import org.simantics.scl.compiler.errors.Locations;
\r
9 public class EStringLiteral extends ASTExpression {
\r
12 Expression[] expressions;
\r
14 public EStringLiteral(String[] strings, Expression[] expressions) {
\r
15 this.strings = strings;
\r
16 this.expressions = expressions;
\r
20 public Expression resolve(TranslationContext context) {
\r
21 Expression[] components = new Expression[expressions.length];
\r
22 SCLValue showForPrinting = context.getEnvironment().getValue(Name.create("Prelude", "showForPrinting"));
\r
23 for(int i=0;i<expressions.length;++i)
\r
24 components[i] = new EApply(new EConstant(showForPrinting), expressions[i]);
\r
25 return new EApply(new ELiteral(new StringInterpolation(strings)), components).resolve(context);
\r
29 public void setLocationDeep(long loc) {
\r
30 if(location == Locations.NO_LOCATION) {
\r
32 for(Expression expression : expressions)
\r
33 expression.setLocationDeep(loc);
\r
38 public Expression accept(ExpressionTransformer transformer) {
\r
39 return transformer.transform(this);
\r