1 package org.simantics.scl.compiler.elaboration.expressions.accessor;
3 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
4 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
5 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
6 import org.simantics.scl.compiler.elaboration.expressions.Expression;
7 import org.simantics.scl.compiler.elaboration.expressions.Variable;
8 import org.simantics.scl.compiler.errors.Locations;
9 import org.simantics.scl.compiler.types.Types;
11 import gnu.trove.map.hash.TObjectIntHashMap;
12 import gnu.trove.set.hash.TIntHashSet;
14 public class ExpressionAccessor extends FieldAccessor {
15 public Expression fieldName;
17 public ExpressionAccessor(char accessSeparator, Expression fieldName) {
18 super(accessSeparator);
19 this.fieldName = fieldName;
23 public void collectVars(TObjectIntHashMap<Variable> allVars,
25 fieldName.collectVars(allVars, vars);
29 public void resolve(TranslationContext context) {
30 fieldName = fieldName.resolve(context);
34 public void simplify(SimplificationContext context) {
35 fieldName = fieldName.simplify(context);
39 public void checkType(TypingContext context) {
40 fieldName = fieldName.checkType(context, Types.STRING);
44 public Expression asExpression() {
49 public void setLocationDeep(long loc) {
50 if(location == Locations.NO_LOCATION) {
52 fieldName.setLocationDeep(loc);
57 public void accept(FieldAccessorVisitor visitor) {