if (type instanceof IObjectSymbolBasedValueType)
{
final IObjectSymbolBasedValueType symbolType =
(IObjectSymbolBasedValueType) type;
final Token firstToken = node.getFirstToken();
if (node.jjtGetNumChildren() == 0
&& firstToken.kind == JSPELParserConstants.DOT)
{
final Token dotId = node.getLastToken();
final int offset =
_context.getDocumentPosition() + dotId.beginColumn - 1;
final int length = dotId.endColumn - dotId.beginColumn + 1;
final DotOperator dotOp = new DotOperator(_diagnosticFactory, _targetFile, _symbolResolver);
final StringLiteralType suffixLiteral = new StringLiteralType(dotId.image);
final Diagnostic diagnostic =
dotOp.validate(symbolType,
suffixLiteral);
if (diagnostic.getSeverity() != Diagnostic.OK)
{
_reporter.report(diagnostic, offset, length);
((EvaluationTracker) data).setType(null);
}
else
{
// // if the base (value-a) is a map, then using the bracket value-a['y'] type
// // syntax is recommended. Note that we do this here instead of
// // DotOperator so that we don't tie the default property resolver
// // behaviour to that operator class. If someone changes the rules
// // of how the prop resolver interprets the base, then they may want to
// // write their own validator that doesn't do this
// if (symbolType.getSymbol().supportsCoercion(TypeConstants.TYPE_MAP))
// {
// _messages.add(ValidationMessageFactory.createFromDiagnostic(
// DiagnosticFactory.create_BINARY_OP_DOT_WITH_VALUEA_MAP_SHOULD_USE_ARRAY
// (symbolType.getSymbol().getName(), dotId.image),
// startOffset, length, _targetFile));
// }
((EvaluationTracker) data).setType(dotOp.performOperation(symbolType,
suffixLiteral));
tracker.setCurMemberSymbol(offset, length);
}
// we finished with the single dot suffix here
return data;
}
else if (firstToken.kind == JSPELParserConstants.LBRACKET)
{
final EvaluationTracker subExprTracker = new EvaluationTracker();
node.childrenAccept(this, subExprTracker);
final SignatureBasedType subExprType = subExprTracker.getType();
if (subExprType instanceof ValueType)
{
final Token lastToken = node.getLastToken();
final int offset =
_context.getDocumentPosition() + firstToken.beginColumn - 1;
final int length = lastToken.endColumn - firstToken.beginColumn + 1;
final BracketOperator bracketOperator = new BracketOperator(_diagnosticFactory, _targetFile, _symbolResolver);