]> gerrit.simantics Code Review - simantics/platform.git/blob
d08a4383fa8816b11c641d3518586ec189b668b9
[simantics/platform.git] /
1 package org.simantics.scl.compiler.elaboration.expressions.accessor;
2
3 import org.simantics.scl.compiler.constants.StringConstant;
4 import org.simantics.scl.compiler.elaboration.expressions.ELiteral;
5 import org.simantics.scl.compiler.elaboration.expressions.Expression;
6 import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure;
7 import org.simantics.scl.compiler.errors.Locations;
8
9 public class StringAccessor extends FieldAccessor {
10     public final String fieldName;
11
12     public StringAccessor(char accessSeparator, String fieldName) {
13         super(accessSeparator);
14         this.fieldName = fieldName;
15     }
16     
17     @Override
18     public Expression asExpression() {
19         return new ELiteral(new StringConstant(fieldName));
20     }
21     
22     @Override
23     public void setLocationDeep(long loc) {
24         if(location == Locations.NO_LOCATION)
25             location = loc;
26     }
27
28     @Override
29     public void accept(FieldAccessorVisitor visitor) {
30         visitor.visit(this);
31     }
32
33     @Override
34     public void forVariables(VariableProcedure procedure) {
35     }
36 }