]> gerrit.simantics Code Review - simantics/platform.git/blob
548cc9f4389b7aadeed49d9e0d7f90621fcf3b8e
[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(String fieldName) {
13         this.fieldName = fieldName;
14     }
15     
16     @Override
17     public Expression asExpression() {
18         return new ELiteral(new StringConstant(fieldName));
19     }
20     
21     @Override
22     public void setLocationDeep(long loc) {
23         if(location == Locations.NO_LOCATION)
24             location = loc;
25     }
26
27     @Override
28     public void accept(FieldAccessorVisitor visitor) {
29         visitor.visit(this);
30     }
31
32     @Override
33     public void forVariables(VariableProcedure procedure) {
34     }
35 }