[roll] Update third-party dart packages
Roller-URL: https://ci.chromium.org/b/8853109331764515984
Cq-Cl-Tag: roller-builder:flutter-with-deps-roller
Cq-Cl-Tag: roller-bid:8853109331764515984
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: Ib802e6fd07cfad8b0b7568e229366fe413d325f1
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/dart-pkg/+/498583
Reviewed-by: GI Roller <global-integration-roller@fuchsia-infra.iam.gserviceaccount.com>
Commit-Queue: GI Roller <global-integration-roller@fuchsia-infra.iam.gserviceaccount.com>
diff --git a/code_builder/BUILD.gn b/code_builder/BUILD.gn
index 96417d0..d9c7a10 100644
--- a/code_builder/BUILD.gn
+++ b/code_builder/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for code_builder-3.6.0
+# This file is generated by importer.py for code_builder-3.7.0
import("//build/dart/dart_library.gni")
diff --git a/code_builder/CHANGELOG.md b/code_builder/CHANGELOG.md
index b80e4d9..d23919e 100644
--- a/code_builder/CHANGELOG.md
+++ b/code_builder/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 3.7.0
+
+* Add support for converting a Method to a generic closure, with
+ `Method.genericClosure`.
+
## 3.6.0
* Add support for creating `extension` methods.
diff --git a/code_builder/lib/src/emitter.dart b/code_builder/lib/src/emitter.dart
index b680235..14093cb 100644
--- a/code_builder/lib/src/emitter.dart
+++ b/code_builder/lib/src/emitter.dart
@@ -278,6 +278,9 @@
case DirectiveType.part:
output.write('part ');
break;
+ case DirectiveType.partOf:
+ output.write('part of ');
+ break;
}
output.write("'${spec.url}'");
if (spec.as != null) {
diff --git a/code_builder/lib/src/specs/directive.dart b/code_builder/lib/src/specs/directive.dart
index 04018d5..ee28f84 100644
--- a/code_builder/lib/src/specs/directive.dart
+++ b/code_builder/lib/src/specs/directive.dart
@@ -58,6 +58,10 @@
..type = DirectiveType.part
..url = url);
+ factory Directive.partOf(String url) => Directive((builder) => builder
+ ..type = DirectiveType.partOf
+ ..url = url);
+
Directive._();
@nullable
@@ -107,6 +111,7 @@
import,
export,
part,
+ partOf,
}
/// Sort import URIs represented by [a] and [b] to honor the
diff --git a/code_builder/lib/src/specs/expression/closure.dart b/code_builder/lib/src/specs/expression/closure.dart
index f10eeee..4f9e1a1 100644
--- a/code_builder/lib/src/specs/expression/closure.dart
+++ b/code_builder/lib/src/specs/expression/closure.dart
@@ -4,6 +4,7 @@
part of code_builder.src.specs.expression;
+/// Returns [method] as closure, removing its return type and type parameters.
Expression toClosure(Method method) {
final withoutTypes = method.rebuild((b) {
b.returns = null;
@@ -12,6 +13,14 @@
return ClosureExpression._(withoutTypes);
}
+/// Returns [method] as a (possibly) generic closure, removing its return type.
+Expression toGenericClosure(Method method) {
+ final withoutReturnType = method.rebuild((b) {
+ b.returns = null;
+ });
+ return ClosureExpression._(withoutReturnType);
+}
+
class ClosureExpression extends Expression {
final Method method;
diff --git a/code_builder/lib/src/specs/method.dart b/code_builder/lib/src/specs/method.dart
index cd6ae1e..9be3929 100644
--- a/code_builder/lib/src/specs/method.dart
+++ b/code_builder/lib/src/specs/method.dart
@@ -94,6 +94,9 @@
/// This method as a closure.
Expression get closure => toClosure(this);
+
+ /// This method as a (possibly) generic closure.
+ Expression get genericClosure => toGenericClosure(this);
}
abstract class MethodBuilder extends Object
diff --git a/code_builder/pubspec.yaml b/code_builder/pubspec.yaml
index 8c8982d..ec8525b 100644
--- a/code_builder/pubspec.yaml
+++ b/code_builder/pubspec.yaml
@@ -1,5 +1,5 @@
name: code_builder
-version: 3.6.0
+version: 3.7.0
description: >-
A fluent, builder-based library for generating valid Dart code