String trimmedDestinationValue = null;
if (sourceAttribute == null)
{
// 'source' attribute is required
ICompilerProblem problem = new MXMLRequiredAttributeProblem(tag, ATTRIBUTE_SOURCE);
builder.addProblem(problem);
markInvalidForCodeGen();
}
else
{
trimmedSourceValue = builder.getMXMLDialect().trim(sourceAttribute.getRawValue());
if (trimmedSourceValue.isEmpty())
{
// 'source' attribute value cannot be empty
ICompilerProblem problem = new MXMLEmptyAttributeProblem(sourceAttribute);
builder.addProblem(problem);
markInvalidForCodeGen();
}
}
if (destinationAttribute == null)
{
// 'destination' attribute is required
ICompilerProblem problem = new MXMLRequiredAttributeProblem(tag, ATTRIBUTE_DESTINATION);
builder.addProblem(problem);
markInvalidForCodeGen();
}
else
{
trimmedDestinationValue = builder.getMXMLDialect().trim(destinationAttribute.getRawValue());
if (trimmedDestinationValue.isEmpty())
{
// 'destination' attribute value cannot be empty
ICompilerProblem problem = new MXMLEmptyAttributeProblem(destinationAttribute);
builder.addProblem(problem);
markInvalidForCodeGen();
}
}
if (trimmedSourceValue != null && !trimmedSourceValue.isEmpty() &&
trimmedDestinationValue != null && !trimmedDestinationValue.isEmpty() &&
trimmedSourceValue.equals(trimmedDestinationValue))
{
// 'source' and 'destination' values cannot be the same
// TODO "a.b" and "a . b" won't be detected as the same.
// Should we compare tokens instead?
ICompilerProblem problem = new MXMLSameBindingSourceAndDestinationProblem(tag);
builder.addProblem(problem);
markInvalidForCodeGen();
}
}