| Index: lib/clone.dart
|
| diff --git a/lib/clone.dart b/lib/clone.dart
|
| index 68277c49fea4d36a60862090051918da9267e3aa..ee315e6bba24827c34d38571cb84341490033e19 100644
|
| --- a/lib/clone.dart
|
| +++ b/lib/clone.dart
|
| @@ -20,7 +20,16 @@ class CloneVisitor extends TreeVisitor {
|
| final Map<TypeParameter, DartType> typeSubstitution;
|
|
|
| CloneVisitor({Map<TypeParameter, DartType> typeSubstitution})
|
| - : this.typeSubstitution = typeSubstitution ?? <TypeParameter, DartType>{};
|
| + : this.typeSubstitution = ensureMutable(typeSubstitution);
|
| +
|
| + static Map<TypeParameter, DartType> ensureMutable(
|
| + Map<TypeParameter, DartType> map) {
|
| + // We need to mutate this map, so make sure we don't use a constant map.
|
| + if (map == null || map.isEmpty) {
|
| + return <TypeParameter, DartType>{};
|
| + }
|
| + return map;
|
| + }
|
|
|
| TreeNode visitLibrary(Library node) {
|
| throw 'Cloning of libraries is not implemented';
|
|
|