Skip to content

Commit

Permalink
Replace forgotten print with logger
Browse files Browse the repository at this point in the history
  • Loading branch information
spideythewebhead committed Jun 29, 2024
1 parent e6e188f commit ba60979
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions package/lib/src/backend/code_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ class DataClassPluginGenerator extends TachyonPluginCodeGenerator {
classTypeParametersWithoutConstraints: classTypeParametersWithoutConstraints,
factoriesWithRedirectedConstructors: factoriesWithRedirectedConstructors,
unionAnnotationValueExtractor: unionAnnotationValueExtractor,
logger: logger,
jsonKeyNameConventionGetter: jsonKeyNameConventionGetter,
).execute();
}
Expand Down
10 changes: 6 additions & 4 deletions package/lib/src/backend/core/generators/union_from_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ class UnionFromJsonGenerator implements Generator {
required final String classTypeParametersWithoutConstraints,
required final List<ConstructorDeclaration> factoriesWithRedirectedConstructors,
required final AnnotationValueExtractor unionAnnotationValueExtractor,
required final Logger logger,
required JsonKeyNameConventionGetter jsonKeyNameConventionGetter,
}) : _codeWriter = codeWriter,
_className = className,
_classTypeParametersSource = classTypeParametersSource,
_classTypeParametersWithoutConstraints = classTypeParametersWithoutConstraints,
_factoriesWithRedirectedConstructors = factoriesWithRedirectedConstructors,
_unionAnnotationValueExtractor = unionAnnotationValueExtractor,
_jsonKeyNameConventionGetter = jsonKeyNameConventionGetter;
_jsonKeyNameConventionGetter = jsonKeyNameConventionGetter,
_logger = logger;

final CodeWriter _codeWriter;
final String _className;
Expand All @@ -28,6 +30,7 @@ class UnionFromJsonGenerator implements Generator {
final List<ConstructorDeclaration> _factoriesWithRedirectedConstructors;
final AnnotationValueExtractor _unionAnnotationValueExtractor;
final JsonKeyNameConventionGetter _jsonKeyNameConventionGetter;
final Logger _logger;

@override
void execute() {
Expand Down Expand Up @@ -62,7 +65,6 @@ class UnionFromJsonGenerator implements Generator {
}

if (unionJsonKeyValueAnnotations.isEmpty) {
print(_jsonKeyNameConventionGetter(null));
_codeWriter
.writeln("case '${_jsonKeyNameConventionGetter(null).transform(ctor.name!.lexeme)}':");
}
Expand All @@ -72,8 +74,8 @@ class UnionFromJsonGenerator implements Generator {
}

if (unionFallbackJsonValue != null && defaultFallbackConstructor == null) {
print(
'WARNING: "unionFallbackJsonValue: $unionFallbackJsonValue" is not declared as UnionJsonKeyValue');
_logger.warning(
'"unionFallbackJsonValue: $unionFallbackJsonValue" is not declared as UnionJsonKeyValue');
}

_codeWriter.writeln('default:');
Expand Down

0 comments on commit ba60979

Please sign in to comment.