mce.setSourcePosition(exp);
mce.setImplicitThis(false);
return mce;
} else if (exp instanceof VariableExpression) {
VariableExpression vexp = (VariableExpression) exp;
Variable accessedVariable = vexp.getAccessedVariable();
if (accessedVariable instanceof FieldNode) {
FieldNode fn = (FieldNode) accessedVariable;
Expression receiver = createFieldHelperReceiver();
if (fn.isStatic()) {
receiver = new PropertyExpression(createFieldHelperReceiver(), "class");
}
MethodCallExpression mce = new MethodCallExpression(
receiver,
Traits.helperGetterName((FieldNode) accessedVariable),
ArgumentListExpression.EMPTY_ARGUMENTS
);
mce.setSourcePosition(exp);
mce.setImplicitThis(false);
return mce;
} else if (accessedVariable instanceof PropertyNode) {
String propName = accessedVariable.getName();
if (knownFields.contains(propName)) {
String method = Traits.helperGetterName(new FieldNode(propName, 0, ClassHelper.OBJECT_TYPE, weavedType, null));
MethodCallExpression mce = new MethodCallExpression(
createFieldHelperReceiver(),
method,
ArgumentListExpression.EMPTY_ARGUMENTS
);
mce.setSourcePosition(exp);
mce.setImplicitThis(false);
return mce;
} else {
return new PropertyExpression(
new VariableExpression(weaved),
accessedVariable.getName()
);
}
} else if (accessedVariable instanceof DynamicVariable) {
return new PropertyExpression(
new VariableExpression(weaved),
accessedVariable.getName()
);
}
if (vexp.isThisExpression()) {
VariableExpression res = new VariableExpression(weaved);
res.setSourcePosition(exp);