- // ...
- Expression result = parent;
- for(int i=0;i<accessors.length;++i) {
- FieldAccessor accessor = accessors[i];
- if(accessor.accessSeparator == '.')
- result = new EApply(
- getLocation(),
- Types.READ_GRAPH,
- context.getConstant(Names.Simantics_Variables_child_),
- result,
- accessor.asExpression()
- );
- else if(i < accessors.length-1)
- result = new EApply(
- getLocation(),
- Types.READ_GRAPH,
- context.getConstant(Names.Simantics_Variables_property),
- result,
- accessor.asExpression()
- );
- else if(accessor.isVariableId())
- ;
- else
- result = new EApply(
- getLocation(),
- Types.READ_GRAPH,
- context.getConstant(Names.Simantics_Variables_untypedPropertyValue, getType()),
- result,
- accessor.asExpression()
- );
- }
- return result;
- }
-
- private static FieldAccessor[] concat(FieldAccessor[] accessors1,
- FieldAccessor[] accessors2) {
- FieldAccessor[] result = new FieldAccessor[accessors1.length + accessors2.length];
- System.arraycopy(accessors1, 0, result, 0, accessors1.length);
- System.arraycopy(accessors2, 0, result, accessors1.length, accessors2.length);
- return result;
+ if(accessor.accessSeparator == '.')
+ return new EApply(
+ getLocation(),
+ Types.READ_GRAPH,
+ context.getConstant(Names.Simantics_Variables_child_),
+ parent,
+ accessor.asExpression()
+ );
+ else if(!lastAccessor)
+ return new EApply(
+ getLocation(),
+ Types.READ_GRAPH,
+ context.getConstant(Names.Simantics_Variables_property),
+ parent,
+ accessor.asExpression()
+ );
+ else if(accessor.isVariableId())
+ return parent;
+ else
+ return new EApply(
+ getLocation(),
+ Types.READ_GRAPH,
+ context.getConstant(Names.Simantics_Variables_untypedPropertyValue, getType()),
+ parent,
+ accessor.asExpression()
+ );