* @param args arguments (in the case of a call)
* @return AST node representing the specialized dot expr
*/
protected JQLAST analyseDotExpr(JQLAST dot, JQLAST expr, JQLAST ident, JQLAST args)
{
Type exprType = expr.getJQLType();
String name = ident.getText();
dot.setText(expr.getText() + '.' + name);
if (exprType instanceof ClassType)
{
// left expression is of a class type
ClassType classType = (ClassType)exprType;
if (args == null)
{
// no paranethesis specified => field access
FieldInfo fieldInfo = classType.getFieldInfo(name);
if (fieldInfo == null)
{
errorMsg.error(ident.getLine(), ident.getColumn(),
I18NHelper.getMessage(messages, "jqlc.semantic.generic.unknownfield", //NOI18N
ident.getText(), exprType.getName()));
dot.setJQLType(typetab.errorType);
ident.setJQLType(typetab.errorType);
return dot;
}
else if (expr.getType() == TYPENAME)
{
// access of the form: className.staticField
return analyseStaticFieldAccess(dot, expr, ident, classType, fieldInfo);
}
else
{
// access of the form: object.field
return analyseFieldAccess(dot, expr, ident, classType, fieldInfo);
}
}
else
{
// parenthesis specified => method call
if (typetab.isCollectionType(exprType))
{
return analyseCollectionCall(dot, expr, ident, args);
}
else if (exprType.equals(typetab.stringType))
{
return analyseStringCall(dot, expr, ident, args);
}
else if (typetab.isJavaLangMathType(exprType))
{
return analyseMathCall(dot, expr, ident, args);
}
errorMsg.error(dot.getLine(), dot.getColumn(),
I18NHelper.getMessage(messages, "jqlc.semantic.generic.invalidmethodcall")); //NOI18N
dot.setJQLType(typetab.errorType);
return dot;
}
}
else
{
errorMsg.error(expr.getLine(), expr.getColumn(),
I18NHelper.getMessage(messages, "jqlc.semantic.analysedotexpr.classexprexpected", //NOI18N
ident.getText(), exprType.getName()));
dot.setJQLType(typetab.errorType);
return dot;
}
}