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

Simplify GeneratorFrontend #3739

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions lib/src/generator/generator_frontend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ class GeneratorFrontEnd implements Generator {
);
}

var indexElements = packageGraph == null
? const <Indexable>[]
: _generateDocs(packageGraph);

await _generatorBackend.generateAdditionalFiles();

if (packageGraph == null) {
return;
}

var indexElements = _generateDocs(packageGraph);
var categories = indexElements
.whereType<Categorization>()
.where((e) => e.hasCategorization)
Expand Down Expand Up @@ -114,7 +115,7 @@ class GeneratorFrontEnd implements Generator {
}
}

void generateInstanceProperty(Container container) {
void generateInstanceProperties(Container container) {
for (var property in container.instanceFields.whereDocumented) {
if (!property.isCanonical) continue;
indexAccumulator.add(property);
Expand All @@ -132,7 +133,7 @@ class GeneratorFrontEnd implements Generator {
}
}

void generateStaticProperty(Container container) {
void generateStaticProperties(Container container) {
for (var property in container.variableStaticFields.whereDocumented) {
if (!property.isCanonical) continue;
indexAccumulator.add(property);
Expand Down Expand Up @@ -171,9 +172,9 @@ class GeneratorFrontEnd implements Generator {
generateConstructors(class_);
generateInstanceMethods(class_);
generateInstanceOperators(class_);
generateInstanceProperty(class_);
generateInstanceProperties(class_);
generateStaticMethods(class_);
generateStaticProperty(class_);
generateStaticProperties(class_);
}

for (var extension in lib.extensions.whereDocumented) {
Expand All @@ -183,9 +184,9 @@ class GeneratorFrontEnd implements Generator {
generateConstants(extension);
generateInstanceMethods(extension);
generateInstanceOperators(extension);
generateInstanceProperty(extension);
generateInstanceProperties(extension);
generateStaticMethods(extension);
generateStaticProperty(extension);
generateStaticProperties(extension);
}

for (var extensionType in lib.extensionTypes.whereDocumented) {
Expand All @@ -197,21 +198,21 @@ class GeneratorFrontEnd implements Generator {
generateConstructors(extensionType);
generateInstanceMethods(extensionType);
generateInstanceOperators(extensionType);
generateInstanceProperty(extensionType);
generateInstanceProperties(extensionType);
generateStaticMethods(extensionType);
generateStaticProperty(extensionType);
generateStaticProperties(extensionType);
}

for (var mixin in lib.mixins.whereDocumented) {
indexAccumulator.add(mixin);
_generatorBackend.generateMixin(packageGraph, lib, mixin);

generateConstants(mixin);
generateInstanceProperty(mixin);
generateInstanceMethods(mixin);
generateInstanceOperators(mixin);
generateInstanceProperties(mixin);
generateStaticMethods(mixin);
generateStaticProperty(mixin);
generateStaticProperties(mixin);
}

for (var enum_ in lib.enums.whereDocumented) {
Expand All @@ -222,9 +223,9 @@ class GeneratorFrontEnd implements Generator {
generateConstructors(enum_);
generateInstanceMethods(enum_);
generateInstanceOperators(enum_);
generateInstanceProperty(enum_);
generateInstanceProperties(enum_);
generateStaticMethods(enum_);
generateStaticProperty(enum_);
generateStaticProperties(enum_);
}

for (var constant in lib.constants.whereDocumented) {
Expand Down