Skip to content

Commit

Permalink
refactor(codegen): added TODO: about wrongly dispatched type reference
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Feb 23, 2022
1 parent d99e1e3 commit e9aa564
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void enterDiscriminatorField(MSpecParser.DiscriminatorFieldContext ctx) {
@Override
public void enterEnumField(MSpecParser.EnumFieldContext ctx) {
String typeRefName = ctx.type.complexTypeReference.getText();
DefaultComplexTypeReference type = new DefaultComplexTypeReference(typeRefName, null);
DefaultEnumTypeReference type = new DefaultEnumTypeReference(typeRefName, null);
setOrScheduleTypeDefinitionConsumer(typeRefName, type::setTypeDefinition);
String name = getIdString(ctx.name);
String fieldName = null;
Expand Down Expand Up @@ -533,6 +533,7 @@ private TypeReference getTypeReference(MSpecParser.TypeReferenceContext ctx) {
return getSimpleTypeReference(ctx.simpleTypeReference);
} else {
String typeRefName = ctx.complexTypeReference.getText();
// FIXME: TODO: we need to check if we reference a enum
DefaultComplexTypeReference type = new DefaultComplexTypeReference(typeRefName, getParams(ctx.params));
setOrScheduleTypeDefinitionConsumer(typeRefName, type::setTypeDefinition);
return type;
Expand Down Expand Up @@ -675,8 +676,7 @@ public void setOrScheduleTypeDefinitionConsumer(String typeRefName, Consumer<Typ
TypeDefinition typeDefinition = types.get(typeRefName);
if (typeDefinition != null) {
LOGGER.debug("{} present so setting for {}", typeRefName, setTypeDefinition);
// TODO: This should actually only be a complex-type, right?
setTypeDefinition.accept((ComplexTypeDefinition) typeDefinition);
setTypeDefinition.accept(typeDefinition);
} else {
// put up order
if (LOGGER.isDebugEnabled()) {
Expand Down

0 comments on commit e9aa564

Please sign in to comment.