init.getFirstChild() == null) {
warnings.add(JSError.make(qnameNode, MALFORMED_ENUM));
return;
}
// Last, read the object-literal properties and create the EnumType.
JSDocInfo jsdoc = NodeUtil.getBestJSDocInfo(qnameNode);
Set<String> propNames = new HashSet<>();
for (Node prop : init.children()) {
String pname = NodeUtil.getObjectLitKeyName(prop);
if (propNames.contains(pname)) {
warnings.add(JSError.make(qnameNode, DUPLICATE_PROP_IN_ENUM, pname));
}
if (!convention.isValidEnumKey(pname)) {
warnings.add(
JSError.make(prop, TypeCheck.ENUM_NOT_CONSTANT, pname));
}
propNames.add(pname);
}
currentScope.addEnum(qnameNode,
EnumType.make(
qnameNode.getQualifiedName(),
jsdoc.getEnumParameterType(),
ImmutableSet.copyOf(propNames)));
}