Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: lib/src/shelf_unmodifiable_map.dart

Issue 837193005: pkg/shelf: formatted code (Closed) Base URL: https://github.com/dart-lang/shelf.git@master
Patch Set: nits Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/response.dart ('k') | lib/src/util.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library shelf.shelf_unmodifiable_map; 5 library shelf.shelf_unmodifiable_map;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:collection/wrappers.dart' as pc; 9 import 'package:collection/wrappers.dart' as pc;
10 10
(...skipping 13 matching lines...) Expand all
24 {bool ignoreKeyCase: false}) { 24 {bool ignoreKeyCase: false}) {
25 if (source is ShelfUnmodifiableMap<V>) { 25 if (source is ShelfUnmodifiableMap<V>) {
26 return source; 26 return source;
27 } 27 }
28 28
29 if (source == null || source.isEmpty) { 29 if (source == null || source.isEmpty) {
30 return const _EmptyShelfUnmodifiableMap(); 30 return const _EmptyShelfUnmodifiableMap();
31 } 31 }
32 32
33 if (ignoreKeyCase) { 33 if (ignoreKeyCase) {
34 source = new pc.CanonicalizedMap<String, String, V>.from(source, 34 source = new pc.CanonicalizedMap<String, String, V>.from(
35 (key) => key.toLowerCase(), isValidKey: (key) => key != null); 35 source, (key) => key.toLowerCase(), isValidKey: (key) => key != null);
36 } else { 36 } else {
37 source = new Map<String, V>.from(source); 37 source = new Map<String, V>.from(source);
38 } 38 }
39 39
40 return new ShelfUnmodifiableMap<V>._(source); 40 return new ShelfUnmodifiableMap<V>._(source);
41 } 41 }
42 42
43 ShelfUnmodifiableMap._(Map<String, V> source) : super(source); 43 ShelfUnmodifiableMap._(Map<String, V> source) : super(source);
44 } 44 }
45 45
46 /// An const empty implementation of [ShelfUnmodifiableMap]. 46 /// An const empty implementation of [ShelfUnmodifiableMap].
47 // TODO(kevmoo): Consider using MapView from dart:collection which has a const 47 // TODO(kevmoo): Consider using MapView from dart:collection which has a const
48 // ctor. Would require updating min SDK to 1.5. 48 // ctor. Would require updating min SDK to 1.5.
49 class _EmptyShelfUnmodifiableMap<V> extends pc.DelegatingMap<String, V> 49 class _EmptyShelfUnmodifiableMap<V> extends pc.DelegatingMap<String, V>
50 implements ShelfUnmodifiableMap<V> { 50 implements ShelfUnmodifiableMap<V> {
51 const _EmptyShelfUnmodifiableMap() : super(const {}); 51 const _EmptyShelfUnmodifiableMap() : super(const {});
52 } 52 }
OLDNEW
« no previous file with comments | « lib/src/response.dart ('k') | lib/src/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698