Skip to content

Commit

Permalink
Merge pull request #228 from davidmorgan/no-computenode
Browse files Browse the repository at this point in the history
Remove an unneeded use of computeNode in generator.
  • Loading branch information
davidmorgan authored Sep 14, 2017
2 parents 67055d3 + 45a8aad commit cb0c445
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

## 4.1.1 (unreleased)

- Generated code now tells the analyzer to ignore prefer_expression_function_bodies
and sort_constructors_first.

- Generated code now tells the analyzer to ignore
prefer_expression_function_bodies and sort_constructors_first.
- Remove an unneeded use of computeNode in generator; improves generator
performance.

## 4.1.0

Expand Down
5 changes: 3 additions & 2 deletions built_value_generator/lib/src/serializer_source_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ abstract class SerializerSourceField
type, classGenericParameters ?? new BuiltSet<String>());
}

@memoized
bool get needsBuilder => element.getter.returnType.displayName.contains('<');

/// Generates a cast using 'as' to this field type.
///
/// Generics are cast to the bound of the generic. If there is no bound,
Expand All @@ -95,8 +98,6 @@ abstract class SerializerSourceField
return result == 'Object' ? '' : 'as $result';
}

bool get needsBuilder => type.contains('<');

String generateBuilder() {
final bareType = _getBareType(type);
if (typesWithBuilder.containsKey(bareType)) {
Expand Down
4 changes: 4 additions & 0 deletions built_value_generator/lib/src/serializer_source_field.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb0c445

Please sign in to comment.