return null;
}
Expression expression = getAdapter(ExpressionAdapter.class).adapt(expressionContext);
Invocation invocation = null;
if (expression instanceof ThisExpression) {
invocation = createNode(context, ThisInvocation.class);
} else if (expression instanceof SuperExpression) {
invocation = createNode(context, SuperInvocation.class);
} else if (expression instanceof Identifier) {
MethodInvocation methodInvocation = createNode(context, MethodInvocation.class);
methodInvocation.setName((Identifier) expression);
} else if (expression instanceof ScopedExpression) {
ScopedExpression scopedExpression = (ScopedExpression) expression;
if (scopedExpression.getExpression() instanceof ThisExpression) {
invocation = createNode(context, ThisInvocation.class);
invocation.setScope(scopedExpression.getScope());
} else if (scopedExpression.getExpression() instanceof SuperExpression) {
invocation = createNode(context, SuperInvocation.class);
invocation.setScope(scopedExpression.getScope());
} else if (scopedExpression.getExpression() instanceof Identifier) {
MethodInvocation methodInvocation = createNode(context, MethodInvocation.class);
methodInvocation.setScope(scopedExpression.getScope());
methodInvocation.setName((Identifier) scopedExpression.getExpression());
invocation = methodInvocation;
}
}
if (invocation == null) {
GeneralInvocation generalInvocation = createNode(context, GeneralInvocation.class);
if (expression instanceof ScopedExpression) {
ScopedExpression scopedExpression = (ScopedExpression) expression;
generalInvocation.setScope(scopedExpression.getScope());
generalInvocation.setExpression(scopedExpression.getExpression());
invocation = generalInvocation;
} else {
generalInvocation.setExpression(expression);
}
invocation = generalInvocation;
}
ExpressionListContext expressionListContext = getChild(context, ExpressionListContext.class);
if (expressionListContext != null) {
invocation.setArguments(getAdapter(ExpressionListAdapter.class).adapt(expressionListContext));
}
return invocation;
}