Skip to content

Commit a436c06

Browse files
stereotype441commit-bot@chromium.org
authored andcommitted
Migration: fix DecoratedType.toString to support named function parameters.
Change-Id: Ia49e4b381de5928d26be16fe4a9ab45fe8a64678 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107515 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
1 parent 9dee307 commit a436c06

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/nnbd_migration/lib/src/decorated_type.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,12 @@ class DecoratedType {
237237
if (type.typeFormals.isNotEmpty) {
238238
formals = '<${type.typeFormals.join(', ')}>';
239239
}
240-
assert(type.namedParameterTypes.isEmpty &&
241-
namedParameters.isEmpty); // TODO(paulberry)
242-
var args = positionalParameters.map((p) => p.toString()).join(', ');
240+
List<Object> argStrings =
241+
positionalParameters.map((p) => p.toString()).toList();
242+
for (var entry in namedParameters.entries) {
243+
argStrings.add('${entry.key}: ${entry.value}');
244+
}
245+
var args = argStrings.join(', ');
243246
return '$returnType Function$formals($args)$trailing';
244247
} else if (type is DynamicTypeImpl) {
245248
return 'dynamic';

0 commit comments

Comments
 (0)