use of net.vtst.ow.eclipse.soy.soy.ListOrMapLiteralItem in project ow by vtst.
the class SoyJavaValidator method checkListOrMapLiteral.
// **************************************************************************
// Patches for the parser
/**
* Check that all elements of a list-or-map are either list elements or map elements.
*/
@Check
@ConfigurableCheck(configurable = false)
public void checkListOrMapLiteral(ListOrMapLiteral listOrMap) {
EList<ListOrMapLiteralItem> items = listOrMap.getItem();
boolean isMap = false;
int index = 0;
for (ListOrMapLiteralItem item : items) {
if (index == 0) {
isMap = (item.getSecond() != null);
} else {
if ((item.getSecond() != null) != isMap) {
error(messages.getString(isMap ? "map_becoming_list" : "list_becoming_map"), listOrMap, SoyPackage.Literals.LIST_OR_MAP_LITERAL__ITEM, index);
}
}
++index;
}
}
Aggregations