Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when reaches a constructor on an enum #10

Closed
bdlukaa opened this issue Oct 15, 2023 · 0 comments · Fixed by #12
Closed

Error when reaches a constructor on an enum #10

bdlukaa opened this issue Oct 15, 2023 · 0 comments · Fixed by #12

Comments

@bdlukaa
Copy link
Contributor

bdlukaa commented Oct 15, 2023

When the parser reaches a constructor on an enum, an error is thrown.


The following enum, for example, is enough to stop the parser from parsing.

enum ButtonState {
  up,
  upAndSelected,
  down,
  downAndSelected,
  hover,
  hoverAndSelected,
  disabled,
  disabledAndSelected;

  const ButtonState();

}
type 'EnumDeclarationImpl' is not a subtype of type 'ClassDeclaration' in type cast
#0      serializeConstructorDeclaration (package:dartdoc_json/src/constructor_declaration.dart:16:42)
#1      serializeMemberList (package:dartdoc_json/src/member_list.dart:18:14)
#2      serializeEnumDeclaration (package:dartdoc_json/src/enum_declaration.dart:30:16)
#3      serializeCompilationUnit (package:dartdoc_json/src/compilation_unit.dart:25:20)

The code assumes that the parent of the constructor is a class, but it is not the case. Recently, in dart, it was added more features to enums.

Additional resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant