assert attribute != null;
Map<String, AstAttributeElement> elements = AttributeUtil.getElementMap(attribute);
AstAttributeElement nameElement = elements.remove(ELEMENT_NAME);
environment.reportAll(AttributeUtil.reportInvalidElements(attribute, elements.values()));
if (nameElement == null) {
environment.report(new Diagnostic(
Level.ERROR,
attribute.name,
"@{0} must declare the element \"{1}=...\"",
TARGET_NAME,
ELEMENT_NAME));
return Collections.emptyList();
} else if ((nameElement.value instanceof AstAttributeValueArray) == false) {
environment.report(new Diagnostic(
Level.ERROR,
nameElement,
"@{0}.{1} must be an array of name",
TARGET_NAME,
ELEMENT_NAME));
return Collections.emptyList();
}
AstAttributeValueArray array = (AstAttributeValueArray) nameElement.value;
List<PropertySymbol> properties = Lists.create();
for (AstAttributeValue value : array.elements) {
if ((value instanceof AstSimpleName) == false) {
environment.report(new Diagnostic(
Level.ERROR,
value,
"{0}.{1} must be a simple property name of array",
TARGET_NAME,
ELEMENT_NAME));
continue;
}
PropertySymbol property = declaration.createPropertySymbol((AstSimpleName) value);
if (property.findDeclaration() == null) {
environment.report(new Diagnostic(
Level.ERROR,
value,
"{0} is not declared in {1}",
value,
declaration.getName()));